Documentation ¶
Index ¶
- type BulkJobRecord
- type CollectionsDeleteRequest
- type CollectionsRequest
- type CollectionsResponseError
- type CollectionsResponseItem
- type CompositeObject
- type CompositeRequest
- type CompositeResponse
- type CompositeSubRequest
- type CompositeSubResponse
- type CompositeSubResponseBody
- type Config
- type DescribeObjectResponse
- type DescribeObjectResponseFields
- type GetBulkQueryJobResultsResponse
- type Limit
- type LimitsResponse
- type ListBulkJobsResponse
- type ObjectResponse
- type PermissionSetsLimit
- type SalesforceCredentials
- type SalesforceUtils
- func (s *SalesforceUtils) Authenticate() error
- func (s *SalesforceUtils) CollectionsCreateObjects(recordsJsonBytes [][]byte) (response []CollectionsResponseItem, err error)
- func (s *SalesforceUtils) CollectionsDeleteObjects(ids []string) (response []CollectionsResponseItem, err error)
- func (s *SalesforceUtils) CollectionsUpdateObjects(recordsJsonBytes [][]byte) (response []CollectionsResponseItem, err error)
- func (s *SalesforceUtils) CompositeCreateObjects(objects []CompositeObject) (response CompositeResponse, err error)
- func (s *SalesforceUtils) CompositeDeleteObjects(objects []CompositeObject) (response CompositeResponse, err error)
- func (s *SalesforceUtils) CompositeUpdateObjects(objects []CompositeObject) (response CompositeResponse, err error)
- func (s *SalesforceUtils) CompositeUpsertObjects(objects []CompositeObject) (response CompositeResponse, err error)
- func (s *SalesforceUtils) CreateBulkQueryAllJob(query string) (BulkJobRecord, error)
- func (s *SalesforceUtils) CreateBulkQueryJob(query string) (BulkJobRecord, error)
- func (s *SalesforceUtils) CreateObject(typeName string, jsonBytes []byte) (response ObjectResponse, err error)
- func (s *SalesforceUtils) DeleteObject(typeName, id string) error
- func (s *SalesforceUtils) DescribeObject(typeName string) (response DescribeObjectResponse, err error)
- func (s *SalesforceUtils) ExecuteSoqlQuery(query string) (SoqlResponse, error)
- func (s *SalesforceUtils) ExecuteSoqlQueryAll(query string) (SoqlResponse, error)
- func (s *SalesforceUtils) GetBulkQueryJob(queryJobID string) (response BulkJobRecord, err error)
- func (s *SalesforceUtils) GetBulkQueryJobResults(queryJobID string, locator string) (response GetBulkQueryJobResultsResponse, err error)
- func (s *SalesforceUtils) GetLimits() (*LimitsResponse, error)
- func (s *SalesforceUtils) GetNextRecords(nextRecordsUrl string) (response SoqlResponse, err error)
- func (s *SalesforceUtils) ListBulkJobs() (response ListBulkJobsResponse, err error)
- func (s *SalesforceUtils) UpdateObject(typeName, id string, jsonBytes []byte) error
- type SoqlResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BulkJobRecord ¶ added in v1.0.4
type BulkJobRecord struct { ID string `json:"id"` Operation string `json:"operation"` Object string `json:"object"` CreatedById string `json:"createdById"` CreatedDate string `json:"createdDate"` SystemModstamp string `json:"systemModstamp"` State string `json:"state"` ConcurrencyMode string `json:"concurrencyMode"` ContentType string `json:"contentType"` ApiVersion float64 `json:"apiVersion"` LineEnding string `json:"lineEnding"` ColumnDelimiter string `json:"columnDelimiter"` NumberRecordsProcessed int64 `json:"numberRecordsProcessed"` Retries int64 `json:"retries"` TotalProcessingTimeMilliseconds int64 `json:"totalProcessingTime"` }
type CollectionsDeleteRequest ¶ added in v1.2.0
type CollectionsDeleteRequest struct { AllOrNone bool `json:"allOrNone"` Ids []string `json:"ids"` }
CollectionsDeleteRequest is used by the CollectionsDeleteObjects method when interacting with the composite collections api
type CollectionsRequest ¶ added in v1.2.0
type CollectionsRequest struct { AllOrNone bool `json:"allOrNone"` // the use of json.RawMessage here is to avoid the need to unmarshal the // provided records json and remarshal it. Records []json.RawMessage `json:"records"` }
CollectionsRequest is used by the CollectionsCreateObjects and CollectionsUpdateObjects methods when interacting with the composite collections api
type CollectionsResponseError ¶ added in v1.2.0
type CollectionsResponseError struct { StatusCode string `json:"statusCode"` Message string `json:"message"` Fields []string `json:"fields"` }
CollectionsResponseError is the error response item for a single object in the response from the collections api
type CollectionsResponseItem ¶ added in v1.2.0
type CollectionsResponseItem struct { Id string `json:"id"` Success bool `json:"success"` Errors []CollectionsResponseError `json:"errors"` }
CollectionsResponseItem is the response item for a single object in the response from the collections api
type CompositeObject ¶ added in v1.2.0
type CompositeObject struct { // SalesforceId is only used for UpdateObjects and DeleteObjects SalesforceId string // ReferenceId is used to correlate the response to the request ReferenceId string // ObjectType is the salesforce object type, e.g. "Account" ObjectType string // Body is the json body to send to salesforce Body []byte }
CompositeObject is a type used for input into CreateObjects. Contains all the information that the library needs to build a CompositeRequest to send to salesforce
type CompositeRequest ¶ added in v1.2.0
type CompositeRequest struct { AllOrNone bool `json:"allOrNone"` CompositeRequest []CompositeSubRequest `json:"compositeRequest"` }
CompositeRequest is used by the CreateObjects method when interacting with the salesforce API
ref: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/requests_composite.htm
type CompositeResponse ¶ added in v1.2.0
type CompositeResponse struct {
CompositeResponse []CompositeSubResponse `json:"compositeResponse"`
}
type CompositeSubRequest ¶ added in v1.2.0
type CompositeSubRequest struct { // the use of json.RawMessage here is to avoid the need to unmarshal the // body from json and remarshal it. Body json.RawMessage `json:"body,omitempty"` HttpHeaders interface{} `json:"httpHeaders,omitempty"` Method string `json:"method"` ReferenceId string `json:"referenceId"` Url string `json:"url"` }
type CompositeSubResponse ¶ added in v1.2.0
type CompositeSubResponse struct { Body CompositeSubResponseBody `json:"body"` HttpStatusCode int `json:"httpStatusCode"` ReferenceId string `json:"referenceId"` }
type CompositeSubResponseBody ¶ added in v1.2.0
type Config ¶
type Config struct { BaseUrl string `valid:"url,required"` ApiVersion string `valid:"required"` ClientId string `valid:"required"` ClientSecret string `valid:"required"` Username string `valid:"required"` Password string `valid:"required"` GrantType string `valid:"required"` FastHTTPClient *fasthttp.Client }
type DescribeObjectResponse ¶ added in v1.0.2
type DescribeObjectResponse struct { Name string `json:"name"` Fields []DescribeObjectResponseFields `json:"fields"` }
DescribeObjectResponse is a simplified struct representation of the json response from the "sObject Describe" API call. Currently only contains the "name" and "fields" fields.
type DescribeObjectResponseFields ¶ added in v1.0.2
type DescribeObjectResponseFields struct { Name string `json:"name"` Type string `json:"type"` Calculated bool `json:"calculated"` Createable bool `json:"createable"` }
DescribeObjectResponseFields is a nested struct for the Fields field in the "sObject Describe" API response
type GetBulkQueryJobResultsResponse ¶ added in v1.0.4
type LimitsResponse ¶ added in v1.1.0
type LimitsResponse struct { AnalyticsExternalDataSizeMB Limit `json:"AnalyticsExternalDataSizeMB"` ConcurrentAsyncGetReportInstances Limit `json:"ConcurrentAsyncGetReportInstances"` ConcurrentEinsteinDataInsightsStoryCreation Limit `json:"ConcurrentEinsteinDataInsightsStoryCreation"` ConcurrentEinsteinDiscoveryStoryCreation Limit `json:"ConcurrentEinsteinDiscoveryStoryCreation"` ConcurrentSyncReportRuns Limit `json:"ConcurrentSyncReportRuns"` DailyAnalyticsDataflowJobExecutions Limit `json:"DailyAnalyticsDataflowJobExecutions"` DailyAnalyticsUploadedFilesSizeMB Limit `json:"DailyAnalyticsUploadedFilesSizeMB"` DailyApiRequests Limit `json:"DailyApiRequests"` DailyAsyncApexExecutions Limit `json:"DailyAsyncApexExecutions"` DailyAsyncApexTests Limit `json:"DailyAsyncApexTests"` DailyBulkApiBatches Limit `json:"DailyBulkApiBatches"` DailyBulkV2QueryFileStorageMB Limit `json:"DailyBulkV2QueryFileStorageMB"` DailyBulkV2QueryJobs Limit `json:"DailyBulkV2QueryJobs"` DailyDeliveredPlatformEvents Limit `json:"DailyDeliveredPlatformEvents"` DailyDurableGenericStreamingApiEvents Limit `json:"DailyDurableGenericStreamingApiEvents"` DailyDurableStreamingApiEvents Limit `json:"DailyDurableStreamingApiEvents"` DailyEinsteinDataInsightsStoryCreation Limit `json:"DailyEinsteinDataInsightsStoryCreation"` DailyEinsteinDiscoveryOptimizationJobRuns Limit `json:"DailyEinsteinDiscoveryOptimizationJobRuns"` DailyEinsteinDiscoveryPredictAPICalls Limit `json:"DailyEinsteinDiscoveryPredictAPICalls"` DailyEinsteinDiscoveryPredictionsByCDC Limit `json:"DailyEinsteinDiscoveryPredictionsByCDC"` DailyEinsteinDiscoveryStoryCreation Limit `json:"DailyEinsteinDiscoveryStoryCreation"` DailyFunctionsApiCallLimit Limit `json:"DailyFunctionsApiCallLimit"` DailyGenericStreamingApiEvents Limit `json:"DailyGenericStreamingApiEvents"` DailyStandardVolumePlatformEvents Limit `json:"DailyStandardVolumePlatformEvents"` DailyStreamingApiEvents Limit `json:"DailyStreamingApiEvents"` DailyWorkflowEmails Limit `json:"DailyWorkflowEmails"` DataStorageMB Limit `json:"DataStorageMB"` DurableStreamingApiConcurrentClients Limit `json:"DurableStreamingApiConcurrentClients"` FileStorageMB Limit `json:"FileStorageMB"` HourlyAsyncReportRuns Limit `json:"HourlyAsyncReportRuns"` HourlyDashboardRefreshes Limit `json:"HourlyDashboardRefreshes"` HourlyDashboardResults Limit `json:"HourlyDashboardResults"` HourlyDashboardStatuses Limit `json:"HourlyDashboardStatuses"` HourlyLongTermIdMapping Limit `json:"HourlyLongTermIdMapping"` HourlyManagedContentPublicRequests Limit `json:"HourlyManagedContentPublicRequests"` HourlyODataCallout Limit `json:"HourlyODataCallout"` HourlyPublishedPlatformEvents Limit `json:"HourlyPublishedPlatformEvents"` HourlyPublishedStandardVolumePlatformEvents Limit `json:"HourlyPublishedStandardVolumePlatformEvents"` HourlyShortTermIdMapping Limit `json:"HourlyShortTermIdMapping"` HourlySyncReportRuns Limit `json:"HourlySyncReportRuns"` HourlyTimeBasedWorkflow Limit `json:"HourlyTimeBasedWorkflow"` MassEmail Limit `json:"MassEmail"` MonthlyEinsteinDiscoveryStoryCreation Limit `json:"MonthlyEinsteinDiscoveryStoryCreation"` MonthlyPlatformEventsUsageEntitlement Limit `json:"MonthlyPlatformEventsUsageEntitlement"` Package2VersionCreates Limit `json:"Package2VersionCreates"` Package2VersionCreatesWithoutValidation Limit `json:"Package2VersionCreatesWithoutValidation"` PermissionSets PermissionSetsLimit `json:"PermissionSets"` PrivateConnectOutboundCalloutHourlyLimitMB Limit `json:"PrivateConnectOutboundCalloutHourlyLimitMB"` PublishCallbackUsageInApex Limit `json:"PublishCallbackUsageInApex"` SingleEmail Limit `json:"SingleEmail"` StreamingApiConcurrentClients Limit `json:"StreamingApiConcurrentClients"` }
LimitsResponse is the response from the limits endpoint https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_limits.htm?q=limits
type ListBulkJobsResponse ¶ added in v1.0.4
type ListBulkJobsResponse struct { Done bool `json:"done"` Records []BulkJobRecord `json:"records"` NextRecordsUrl string `json:"nextRecordsUrl"` }
type ObjectResponse ¶
type PermissionSetsLimit ¶ added in v1.1.0
type SalesforceCredentials ¶
type SalesforceCredentials struct { AccessToken string `json:"access_token"` InstanceUrl string `json:"instance_url"` Id string `json:"id"` TokenType string `json:"token_type"` IssuedAt int `json:"issued_at,string"` Signature string `json:"signature"` }
SalesforceCredentials represents the response from salesforce's /services/oauth2/token endpoint to get an access token
type SalesforceUtils ¶
type SalesforceUtils struct { Config Config Credentials SalesforceCredentials FastHTTPClient *fasthttp.Client }
SalesforceUtils is the struct that holds config and credentials
func NewSalesforceUtils ¶
func NewSalesforceUtils(authenticate bool, config Config) (*SalesforceUtils, error)
NewSalesforceUtils creates a new instance of SalesforceUtils with the given configuration. If any configuration is not set, it will look up the value from environment variables instead. If the configuration is inavlid, an error will be returned.
func (*SalesforceUtils) Authenticate ¶
func (s *SalesforceUtils) Authenticate() error
Authenticate authenticates with salesforce, storing the resulting credentials on the SalesforceUtils object
func (*SalesforceUtils) CollectionsCreateObjects ¶ added in v1.2.0
func (s *SalesforceUtils) CollectionsCreateObjects(recordsJsonBytes [][]byte) (response []CollectionsResponseItem, err error)
CollectionsCreateObjects creates objects in salesforce using the composite "collections" api. this implementation requires that you marshal your objects to json yourself with an attributes field to your object to define the type.
ex:
{ "attributes" : {"type" : "Account"}, "Name" : "Example" ... }
func (*SalesforceUtils) CollectionsDeleteObjects ¶ added in v1.2.0
func (s *SalesforceUtils) CollectionsDeleteObjects(ids []string) (response []CollectionsResponseItem, err error)
CollectionsDeleteObjects deletes objects in salesforce using the composite "collections" api. all that is required is the IDs of the objects to delete.
func (*SalesforceUtils) CollectionsUpdateObjects ¶ added in v1.2.0
func (s *SalesforceUtils) CollectionsUpdateObjects(recordsJsonBytes [][]byte) (response []CollectionsResponseItem, err error)
CollectionsUpdateObjects updates objects in salesforce using the composite "collections" api. this implementation requires that you marshal your objects to json yourself with an attributes field to your object to define the type. the objects must also have an id field.
ex:
{ "attributes" : {"type" : "Account"}, "id" : "001RM0000068xVCYAY", "Name" : "Example" ... }
func (*SalesforceUtils) CompositeCreateObjects ¶ added in v1.2.0
func (s *SalesforceUtils) CompositeCreateObjects(objects []CompositeObject) (response CompositeResponse, err error)
CompositeCreateObjects creates a list of objects in salesforce using the composite api ref: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_composite_post.htm
func (*SalesforceUtils) CompositeDeleteObjects ¶ added in v1.2.0
func (s *SalesforceUtils) CompositeDeleteObjects(objects []CompositeObject) (response CompositeResponse, err error)
CompositeDeleteObjects deletes a list of objects from salesforce using the composite api ref: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_composite_post.htm
func (*SalesforceUtils) CompositeUpdateObjects ¶ added in v1.2.0
func (s *SalesforceUtils) CompositeUpdateObjects(objects []CompositeObject) (response CompositeResponse, err error)
CompositeUpdateObjects updates a list of objects in salesforce using the composite api ref: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_composite_post.htm
func (*SalesforceUtils) CompositeUpsertObjects ¶ added in v1.2.0
func (s *SalesforceUtils) CompositeUpsertObjects(objects []CompositeObject) (response CompositeResponse, err error)
CompositeUpsertObjects creates or updates a list of objects in salesforce using the composite api. determines update vs create based on the existence of the salesforce id ref: https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_composite_post.htm
func (*SalesforceUtils) CreateBulkQueryAllJob ¶ added in v1.2.1
func (s *SalesforceUtils) CreateBulkQueryAllJob(query string) (BulkJobRecord, error)
func (*SalesforceUtils) CreateBulkQueryJob ¶ added in v1.0.4
func (s *SalesforceUtils) CreateBulkQueryJob(query string) (BulkJobRecord, error)
func (*SalesforceUtils) CreateObject ¶
func (s *SalesforceUtils) CreateObject(typeName string, jsonBytes []byte) (response ObjectResponse, err error)
func (*SalesforceUtils) DeleteObject ¶
func (s *SalesforceUtils) DeleteObject(typeName, id string) error
func (*SalesforceUtils) DescribeObject ¶ added in v1.0.2
func (s *SalesforceUtils) DescribeObject(typeName string) (response DescribeObjectResponse, err error)
DescribeObject describes the object type, returning all of the field and types
func (*SalesforceUtils) ExecuteSoqlQuery ¶
func (s *SalesforceUtils) ExecuteSoqlQuery(query string) (SoqlResponse, error)
func (*SalesforceUtils) ExecuteSoqlQueryAll ¶ added in v1.0.6
func (s *SalesforceUtils) ExecuteSoqlQueryAll(query string) (SoqlResponse, error)
func (*SalesforceUtils) GetBulkQueryJob ¶ added in v1.0.4
func (s *SalesforceUtils) GetBulkQueryJob(queryJobID string) (response BulkJobRecord, err error)
func (*SalesforceUtils) GetBulkQueryJobResults ¶ added in v1.0.4
func (s *SalesforceUtils) GetBulkQueryJobResults(queryJobID string, locator string) (response GetBulkQueryJobResultsResponse, err error)
func (*SalesforceUtils) GetLimits ¶ added in v1.1.0
func (s *SalesforceUtils) GetLimits() (*LimitsResponse, error)
func (*SalesforceUtils) GetNextRecords ¶
func (s *SalesforceUtils) GetNextRecords(nextRecordsUrl string) (response SoqlResponse, err error)
func (*SalesforceUtils) ListBulkJobs ¶ added in v1.0.4
func (s *SalesforceUtils) ListBulkJobs() (response ListBulkJobsResponse, err error)
func (*SalesforceUtils) UpdateObject ¶
func (s *SalesforceUtils) UpdateObject(typeName, id string, jsonBytes []byte) error