Documentation ¶
Index ¶
- Constants
- func ParseXMLError(resp *http.Response) error
- type CreateResponse
- type DescribeResponse
- type JSONErrors
- type JSONResponse
- type QueryResult
- type Session
- func (session *Session) JSONRequest(method, u string, data map[string]interface{}) (*JSONResponse, error)
- func (session *Session) MakeSObjectsURL() string
- func (session *Session) SOCreate(sobject string, data map[string]interface{}) (*CreateResponse, error)
- func (session *Session) SODelete(sobject string, id string) (*JSONResponse, error)
- func (session *Session) SODescribe(sobject string) (*DescribeResponse, error)
- func (session *Session) SOQuery(query string) (*QueryResult, error)
- func (session *Session) SOUpdate(sobject string, id string, data map[string]interface{}) (*JSONResponse, error)
- func (session *Session) SOUpsert(sobject string, extIDFName string, extID string, data map[string]interface{}) (*UpsertResponse, error)
- type UpsertResponse
Constants ¶
const ( DefaultAPIVersion = "50.0" DefaultClientID = "goforce" DefaultLoginURL = "https://login.salesforce.com" )
Variables ¶
This section is empty.
Functions ¶
func ParseXMLError ¶
Types ¶
type CreateResponse ¶
type CreateResponse struct { ID string StatusCode int Success bool Errors JSONErrors }
type DescribeResponse ¶
type DescribeResponse struct { Body map[string]interface{} Success bool StatusCode int Errors JSONErrors }
type JSONErrors ¶
type JSONResponse ¶
type JSONResponse struct { Body []byte Success bool StatusCode int Errors JSONErrors }
type QueryResult ¶
type QueryResult struct { TotalSize int `json:"totalSize"` Done bool `json:"done"` NextRecordsURL string `json:"nextRecordsUrl"` Records []map[string]interface{} `json:"records"` Success bool StatusCode int }
QueryResult holds the response data from an SOQL query.
type Session ¶
type Session struct { InstanceURL string ID string Username string Password string Token string ClientID string APIVersion string LoginURL string HTTPClient http.Client }
func Login ¶
func Login(username string, password string, token string, clientID string, apiVersion string, loginURL string, httpClient http.Client) (*Session, error)
LoginPassword signs into salesforce using password. token is optional if trusted IP is configured. Ref: https://developer.salesforce.com/docs/atlas.en-us.214.0.api_rest.meta/api_rest/intro_understanding_username_password_oauth_flow.htm Ref: https://developer.salesforce.com/docs/atlas.en-us.214.0.api.meta/api/sforce_api_calls_login.htm
func (*Session) JSONRequest ¶
func (session *Session) JSONRequest(method, u string, data map[string]interface{}) (*JSONResponse, error)
func (*Session) MakeSObjectsURL ¶
func (*Session) SOCreate ¶
func (session *Session) SOCreate(sobject string, data map[string]interface{}) (*CreateResponse, error)
Create https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_create.htm
func (*Session) SODelete ¶
func (session *Session) SODelete(sobject string, id string) (*JSONResponse, error)
Delete https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_delete_record.htm
func (*Session) SODescribe ¶
func (session *Session) SODescribe(sobject string) (*DescribeResponse, error)
func (*Session) SOQuery ¶
func (session *Session) SOQuery(query string) (*QueryResult, error)
Perform SOQL Query
func (*Session) SOUpdate ¶
func (session *Session) SOUpdate(sobject string, id string, data map[string]interface{}) (*JSONResponse, error)
Update https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_update_fields.htm
func (*Session) SOUpsert ¶
func (session *Session) SOUpsert(sobject string, extIDFName string, extID string, data map[string]interface{}) (*UpsertResponse, error)
Upsert https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_upsert.htm
type UpsertResponse ¶
type UpsertResponse struct { ID string Created bool StatusCode int Success bool Errors JSONErrors }