yaslama / go-force

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-force

wercker status

Golang API wrapper for Force.com, Salesforce.com

Installation

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

Example

package main

import (
	"fmt"
	"log"

	"github.com/nimajalali/go-force/force"
	"github.com/nimajalali/go-force/sobjects"
)

type SomeCustomSObject struct {
	sobjects.BaseSObject
	Active    bool   `force:"Active__c"`
	AccountId string `force:"Account__c"`
}

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

func 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)
	}

	someCustomSObject := &SomeCustomSObject{}
	err = forceApi.GetSObject("Your-Object-ID", someCustomSObject)
	if err != nil {
		fmt.Println(err)
	}
	
	fmt.Printf("%#v", someCustomSObject)
}

Documentation

About

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


Languages

Language:Go 100.0%