Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action string
Action performed on the API URI
const ( ActionMetadata Action = http.MethodHead ActionCreate Action = http.MethodPost ActionUpdate Action = http.MethodPatch ActionRetrieve Action = http.MethodGet ActionDelete Action = http.MethodDelete )
Available actions at the Salesforce API
type Options ¶
type Options func(*SalesforceClient)
Options for the Salesforce client
func WithAPIVersion ¶
WithAPIVersion sets a specific API version at the Salesforce client. If version is an empty string the client will choose latest upon authentication.
func WithHTTPClient ¶
WithHTTPClient sets the HTTP client to be used.
type SalesforceAPIRequest ¶
type SalesforceAPIRequest struct { // Action top perform on the URI resource. Action Action `json:"action"` // ResourcePathPath defines the first part of the user defined path for the HTTP request. // It is placed just after the base path at the URL: // https://<salesforce-host>/services/data/<version>/ResourcePath ResourcePath string `json:"resource"` // ObjectPath determines the type to manage under the resource: // https://<salesforce-host>/services/data/<version>/<resource>/ObjectPath ObjectPath string `json:"object"` // RecordPath identifies the object instance to manage: // https://<salesforce-host>/services/data/<version>/<resource>/<object>/RecordPath // // In some cases this field can inform Record and Field by using "record/field" syntax. RecordPath string `json:"record"` // Query is the set of key and values appeded to the operation: // https://<salesforce-host>/services/data/<version>/<resource>/<object>/<record>?query Query map[string]string `json:"query"` // Payload is the JSON content of the request to be sent. Payload json.RawMessage `json:"payload"` }
SalesforceAPIRequest contains common parameters used for interacting with Salesforce using the API.
func (*SalesforceAPIRequest) Validate ¶
func (sfr *SalesforceAPIRequest) Validate() error
Validate API request
type SalesforceClient ¶
type SalesforceClient struct {
// contains filtered or unexported fields
}
SalesforceClient is the implementation of the Salesforce client
func New ¶
func New(authenticator *auth.JWTAuthenticator, logger *zap.SugaredLogger, opts ...Options) *SalesforceClient
New creates a default Salesforce API client.
func (*SalesforceClient) Authenticate ¶
func (c *SalesforceClient) Authenticate(ctx context.Context) error
Authenticate and performs checks regarding the Salesforce version
func (*SalesforceClient) Do ¶
func (c *SalesforceClient) Do(ctx context.Context, sfr SalesforceAPIRequest) (*http.Response, error)
Do method will use the Salesforce API using the passed parameters adding only authentication header and the host. It is the caller responsibility to add all toher elements to the call.
This can be useful when a previous API call returned an URL that contains the full path to an element or a pagination.