coreos/go-force

Name: go-force

Owner: CoreOS

Description: Go (golang) library for calling Salesforce.com (force.com) web api's

Created: 2015-07-31 18:50:25.0

Updated: 2015-09-28 19:59:59.0

Pushed: 2015-08-01 00:01:05.0

Homepage:

Size: 223

Language: Go

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

go-force

wercker status

Golang API wrapper for Force.com, Salesforce.com

Installation

go get github.com/coreos/go-force/force

Example

age main

rt (
"fmt"
"log"

"github.com/coreos/go-force/force"
"github.com/coreos/go-force/sobjects"


 SomeCustomSObject struct {
sobjects.BaseSObject

Active    bool   `force:"Active__c"`
AccountId string `force:"Account__c"`


 (t *SomeCustomSObject) ApiName() string {
return "SomeCustomObject__c"


 SomeCustomSObjectQueryResponse struct {
sobjects.BaseQuery

Records []*SomeCustomSObject `force:"records"`


 main() {
// Init the force
forceApi, err := force.Create(
    "YOUR-API-VERSION",
    "YOUR-CLIENT-ID",
    "YOUR-CLIENT-SECRET",
    "YOUR-USERNAME",
    "YOUR-PASSWORD",
    "YOUR-SECURITY-TOKEN",
    "YOUR-ENVIRONMENT",
)
if err != nil {
    log.Fatal(err)
}

// Get somCustomSObject by ID
someCustomSObject := &SomeCustomSObject{}
err = forceApi.GetSObject("Your-Object-ID", someCustomSObject)
if err != nil {
    fmt.Println(err)
}

fmt.Printf("%#v", someCustomSObject)

// Query
someCustomSObjects := &SomeCustomSObjectQueryResponse{}
err = forceApi.Query("SELECT Id FROM SomeCustomSObject__c LIMIT 10", someCustomSObjects)
if err != nil {
    fmt.Println(err)
}

fmt.Printf("%#v", someCustomSObjects)

Documentation


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.