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
Size: 223
Language: Go
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Golang API wrapper for Force.com, Salesforce.com
go get github.com/coreos/go-force/force
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)