Documentation ¶
Index ¶
- Constants
- Variables
- func ParseSalesforceError(statusCode int, responseBody []byte) (err error)
- type BearerTokenResponse
- type Client
- func (client *Client) ApexREST(method, path string, requestBody io.Reader) ([]byte, error)
- func (client *Client) CreateScratch(params CreateScratchParams) (*CreateScratchResult, error)
- func (client *Client) DescribeGlobal() (*SObjectMeta, error)
- func (client *Client) DownloadFile(contentVersionID string, filepath string) error
- func (client *Client) ExecuteAnonymous(apexBody string) (*ExecuteAnonymousResult, error)
- func (client *Client) GetLoc() (loc string)
- func (client *Client) GetSid() (sid string)
- func (client *Client) HasScratch(name string) (bool, string, error)
- func (client *Client) LoginPassword(username, password, token string) error
- func (client *Client) LoginWithAuthCode(loginURL string, code string) error
- func (c *Client) MetaDeploy(zip []byte, testLevel string) (*MetaDeployResult, error)
- func (client *Client) Query(q string) (*QueryResult, error)
- func (client *Client) RemoveScratch(name string) (*RemoveScratchResult, error)
- func (client *Client) SObject(typeName ...string) *SObject
- func (client *Client) SetHttpClient(c *http.Client)
- func (client *Client) SetSidLoc(sid string, loc string)
- func (client *Client) Tooling() *Client
- func (client *Client) UnTooling()
- type CreateScratchParams
- type CreateScratchResult
- type ExecuteAnonymousResult
- type MetaDeployResponse
- type MetaDeployResponseResult
- type MetaDeployResult
- type QueryResult
- type RemoveScratchResult
- type SObject
- func (obj *SObject) AttributesField() *SObjectAttributes
- func (obj *SObject) Create() *SObject
- func (obj *SObject) Delete(id ...string) error
- func (obj *SObject) Describe() *SObjectMeta
- func (obj *SObject) Get(id ...string) *SObject
- func (obj *SObject) ID() string
- func (obj *SObject) InterfaceField(key string) interface{}
- func (obj *SObject) SObjectField(typeName, key string) *SObject
- func (obj *SObject) Set(key string, value interface{}) *SObject
- func (obj *SObject) StringField(key string) string
- func (obj *SObject) Type() string
- func (obj *SObject) Update() *SObject
- type SObjectAttributes
- type SObjectMeta
- type ScratchSettings
Constants ¶
const ( DefaultAPIVersion = "54.0" DefaultClientID = "PlatformCLI" // to match SFDX DefaultRedirectURI = `http://localhost:1717/OauthRedirect` // to match SFDX DefaultURL = "https://login.salesforce.com" )
const ScratchPackageXML = `` /* 314-byte string literal not displayed */
const ScratchQuoteSettingsMeta = `` /* 155-byte string literal not displayed */
const ScratchSecuritySettingsMetaTpl = `` /* 45546-byte string literal not displayed */
Variables ¶
var ( // ErrFailure is a generic error if none of the other errors are appropriate. ErrFailure = errors.New("general failure") // ErrAuthentication is returned when authentication failed. ErrAuthentication = errors.New("authentication failure") )
Functions ¶
func ParseSalesforceError ¶
Need to get information out of this package.
Types ¶
type BearerTokenResponse ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the main instance to access salesforce.
func (*Client) ApexREST ¶
ApexREST executes a custom rest request with the provided method, path, and body. The path is relative to the domain.
func (*Client) CreateScratch ¶
func (client *Client) CreateScratch(params CreateScratchParams) (*CreateScratchResult, error)
func (*Client) DescribeGlobal ¶
func (client *Client) DescribeGlobal() (*SObjectMeta, error)
Get the List of all available objects and their metadata for your organization's data
func (*Client) DownloadFile ¶
DownloadFile downloads a file based on the REST API path given. Saves to filePath.
func (*Client) ExecuteAnonymous ¶
func (client *Client) ExecuteAnonymous(apexBody string) (*ExecuteAnonymousResult, error)
ExecuteAnonymous executes a body of Apex code
func (*Client) HasScratch ¶
HasScratch creates scratch with given OrgName
func (*Client) LoginPassword ¶
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 (*Client) LoginWithAuthCode ¶
func (*Client) MetaDeploy ¶
func (c *Client) MetaDeploy(zip []byte, testLevel string) (*MetaDeployResult, error)
func (*Client) Query ¶
func (client *Client) Query(q string) (*QueryResult, error)
Query runs an SOQL query. q could either be the SOQL string or the nextRecordsURL.
func (*Client) RemoveScratch ¶
func (client *Client) RemoveScratch(name string) (*RemoveScratchResult, error)
func (*Client) SObject ¶
SObject creates an SObject instance with provided type name and associate the SObject with the client.
func (*Client) SetHttpClient ¶
type CreateScratchParams ¶
type CreateScratchParams struct { Namespace string Name string Username string AdminEmail string Features string Phone string CountryName string Settings ScratchSettings Description string }
CreateScratch creates scratch with given OrgName
type CreateScratchResult ¶
type CreateScratchResult struct { Namespace string `json:"namespace"` Features string `json:"features"` LoginURL string `json:"loginUrl"` User string `json:"user"` Pass string `json:"pass"` AuthCode string `json:"authCode"` Success bool `json:"success"` ExpiresAt string `json:"expiresAt"` ExceptionStackTrace interface{} `json:"exceptionStackTrace"` ExceptionMessage interface{} `json:"exceptionMessage"` }
ExecuteAnonymousResult is returned by ExecuteAnonymous function
type ExecuteAnonymousResult ¶
type ExecuteAnonymousResult struct { Line int `json:"line"` Column int `json:"column"` Compiled bool `json:"compiled"` Success bool `json:"success"` CompileProblem interface{} `json:"compileProblem"` ExceptionStackTrace interface{} `json:"exceptionStackTrace"` ExceptionMessage interface{} `json:"exceptionMessage"` }
ExecuteAnonymousResult is returned by ExecuteAnonymous function
type MetaDeployResponse ¶
type MetaDeployResponse struct { ID string `json:"id"` DeployResult MetaDeployResponseResult `json:"deployResult"` }
type MetaDeployResult ¶
type QueryResult ¶
type QueryResult struct { TotalSize int `json:"totalSize"` Done bool `json:"done"` NextRecordsURL string `json:"nextRecordsUrl"` Records []SObject `json:"records"` }
QueryResult holds the response data from an SOQL query.
type RemoveScratchResult ¶
type RemoveScratchResult struct { Success bool `json:"success"` ExceptionStackTrace interface{} `json:"exceptionStackTrace"` ExceptionMessage interface{} `json:"exceptionMessage"` }
type SObject ¶
type SObject map[string]interface{}
SObject describes an instance of SObject. Ref: https://developer.salesforce.com/docs/atlas.en-us.214.0.api_rest.meta/api_rest/resources_sobject_basic_info.htm
func (*SObject) AttributesField ¶
func (obj *SObject) AttributesField() *SObjectAttributes
AttributesField returns a read-only copy of the attributes field of an SObject.
func (*SObject) Create ¶
Create posts the JSON representation of the SObject to salesforce to create the entry. If the creation is successful, the ID of the SObject instance is updated with the ID returned. Otherwise, nil is returned for failures. Ref: https://developer.salesforce.com/docs/atlas.en-us.214.0.api_rest.meta/api_rest/dome_sobject_create.htm
func (*SObject) Delete ¶
Delete deletes an SObject record identified by external ID. nil is returned if the operation completes successfully; otherwise an error is returned
func (*SObject) Describe ¶
func (obj *SObject) Describe() *SObjectMeta
Describe queries the metadata of an SObject using the "describe" API. Ref: https://developer.salesforce.com/docs/atlas.en-us.214.0.api_rest.meta/api_rest/resources_sobject_describe.htm
func (*SObject) Get ¶
Get retrieves all the data fields of an SObject. If id is provided, the SObject with the provided external ID will be retrieved; otherwise, the existing ID of the SObject will be checked. If the SObject doesn't contain an ID field and id is not provided as the parameter, nil is returned. If query is successful, the SObject is updated in-place and exact same address is returned; otherwise, nil is returned if failed.
func (*SObject) InterfaceField ¶
InterfaceField accesses a field in the SObject as raw interface. This allows access to any type of fields.
func (*SObject) SObjectField ¶
SObjectField accesses a field in the SObject as another SObject. This is only applicable if the field is an external ID to another object. The typeName of the SObject must be provided. <nil> is returned if the field is empty.
func (*SObject) Set ¶
Set indexes value into SObject instance with provided key. The same SObject pointer is returned to allow chained access.
func (*SObject) StringField ¶
StringField accesses a field in the SObject as string. Empty string is returned if the field doesn't exist.
type SObjectAttributes ¶
SObjectAttributes describes the basic attributes (type and url) of an SObject.
type SObjectMeta ¶
type SObjectMeta map[string]interface{}
SObjectMeta describes the metadata returned by describing the object. Ref: https://developer.salesforce.com/docs/atlas.en-us.214.0.api_rest.meta/api_rest/resources_sobject_describe.htm
type ScratchSettings ¶
type ScratchSettings struct {
EnableAuditFieldsInactiveOwner bool
}