Documentation
¶
Index ¶
- Variables
- type Auth
- type Client
- func (c *Client) AbortJobQuery(jobID string) error
- func (c *Client) CancelDeploy(asyncProcessID string) (*MetadataAsyncResult, error)
- func (c *Client) CheckDeployStatus(asyncProcessID string) (*MetadataDeployResult, error)
- func (c *Client) CheckRetrieveStatus(asyncProcessID string) (*MetadataRetrieveResult, error)
- func (c *Client) CreateCustomField(fieldData CustomField) (map[string]interface{}, error)
- func (c *Client) CreateJobQuery(query string) (*JobQueryResponse, error)
- func (c *Client) CreateRecord(objectType string, record map[string]interface{}) (*SobjectResponse, error)
- func (c *Client) CreateRecords(objectType string, records []map[string]interface{}) ([]CompositeResponse, error)
- func (c *Client) DeleteJobQuery(jobID string) error
- func (c *Client) DeleteRecord(objectType, recordID string) error
- func (c *Client) DeleteRecords(objectType string, recordIDs []string) error
- func (c *Client) DeployMetadata(zipFileBase64 string, options MetadataDeployOptions) (*MetadataAsyncResult, error)
- func (c *Client) DescribeSObject(objectType string) (map[string]interface{}, error)
- func (c *Client) GetJobQuery(jobID string) (*JobQueryResponse, error)
- func (c *Client) GetJobQueryResults(jobID, queryLocator string, maxRecords int) (string, string, error)
- func (c *Client) GetJobQueryResultsParsed(jobID, queryLocator string, maxRecords int) ([]JobQueryResult, string, error)
- func (c *Client) GetLimits() (LimitsResponse, error)
- func (c *Client) GetRecord(objectType, recordID string) (map[string]interface{}, error)
- func (c *Client) GetRecordCounts(objects []string) (CountResponse, error)
- func (c *Client) Query(soql string) (*QueryResponse, error)
- func (c *Client) QueryToolingAPI(soql string) (*ToolingResponse, error)
- func (c *Client) RetrieveMetadata(options MetadataRetrieveOptions) (*MetadataAsyncResult, error)
- func (c *Client) UpdateRecord(objectType, recordID string, updates map[string]interface{}) error
- func (c *Client) UpdateRecords(objectType string, records []map[string]interface{}) error
- type CodeCoverageResult
- type CodeLocation
- type ComponentFailure
- type ComponentSuccess
- type CompositeResponse
- type CountResponse
- type CustomField
- type DeployDetails
- type FileProperty
- type JobQueryResponse
- type JobQueryResult
- type LimitsResponse
- type MetadataAsyncResult
- type MetadataDeployOptions
- type MetadataDeployResult
- type MetadataRetrieveOptions
- type MetadataRetrieveResult
- type QueryResponse
- type RetrieveMessage
- type RunTestResult
- type SobjectResponse
- type TestFailure
- type TestSuccess
- type ToolingResponse
Constants ¶
This section is empty.
Variables ¶
var ( ErrSOAPFault = errors.New("SOAP fault occurred") ErrInvalidSession = errors.New("invalid session ID") ErrDeployFailed = errors.New("deployment failed") ErrRetrieveFailed = errors.New("retrieve failed") ErrInvalidZip = errors.New("invalid ZIP file") ErrInvalidManifest = errors.New("invalid package manifest") )
Error variables
Functions ¶
This section is empty.
Types ¶
type Auth ¶
type Auth struct {
ClientID string
ClientSecret string
Username string
Password string
TokenURL string
}
Auth handles authentication with Salesforce
func (*Auth) AuthenticateClientCredentials ¶
AuthenticateClientCredentials performs Client Credentials OAuth flow
func (*Auth) AuthenticatePassword ¶
AuthenticatePassword performs an OAuth login and retrieves an access token
type Client ¶
type Client struct {
AccessToken string `json:"access_token"`
InstanceURL string `json:"instance_url"`
TokenType string `json:"token_type"`
IssuedAt string `json:"issued_at"`
}
Client represents the Salesforce OAuth token response
func (*Client) AbortJobQuery ¶ added in v1.1.0
func (*Client) CancelDeploy ¶ added in v1.2.0
func (c *Client) CancelDeploy(asyncProcessID string) (*MetadataAsyncResult, error)
CancelDeploy cancels an in-progress deployment
func (*Client) CheckDeployStatus ¶ added in v1.2.0
func (c *Client) CheckDeployStatus(asyncProcessID string) (*MetadataDeployResult, error)
CheckDeployStatus checks the status of an asynchronous deployment
func (*Client) CheckRetrieveStatus ¶ added in v1.2.0
func (c *Client) CheckRetrieveStatus(asyncProcessID string) (*MetadataRetrieveResult, error)
CheckRetrieveStatus checks the status of an asynchronous retrieval
func (*Client) CreateCustomField ¶ added in v1.1.0
func (c *Client) CreateCustomField(fieldData CustomField) (map[string]interface{}, error)
CreateCustomField creates a new custom field in Salesforce using the Tooling API
func (*Client) CreateJobQuery ¶ added in v1.1.0
func (c *Client) CreateJobQuery(query string) (*JobQueryResponse, error)
CreateJobQuery initiates a Bulk Query Job in Salesforce
func (*Client) CreateRecord ¶
func (c *Client) CreateRecord(objectType string, record map[string]interface{}) (*SobjectResponse, error)
CreateRecord creates a new Salesforce record
func (*Client) CreateRecords ¶
func (c *Client) CreateRecords(objectType string, records []map[string]interface{}) ([]CompositeResponse, error)
CreateRecords creates multiple Salesforce records
func (*Client) DeleteJobQuery ¶ added in v1.1.0
DeleteJobQuery permanently removes a Bulk Query Job in Salesforce
func (*Client) DeleteRecord ¶
DeleteRecord deletes a Salesforce record by ID
func (*Client) DeleteRecords ¶
DeleteRecords deletes multiple Salesforce records
func (*Client) DeployMetadata ¶ added in v1.2.0
func (c *Client) DeployMetadata(zipFileBase64 string, options MetadataDeployOptions) (*MetadataAsyncResult, error)
DeployMetadata initiates an asynchronous metadata deployment
func (*Client) DescribeSObject ¶
DescribeSObject retrieves metadata for a given Salesforce object
func (*Client) GetJobQuery ¶ added in v1.1.0
func (c *Client) GetJobQuery(jobID string) (*JobQueryResponse, error)
GetJobQuery retrieves the status and details of a Bulk Query Job in Salesforce
func (*Client) GetJobQueryResults ¶ added in v1.1.0
func (c *Client) GetJobQueryResults(jobID, queryLocator string, maxRecords int) (string, string, error)
GetJobQueryResults retrieves the job query results using pagination and maxRecords
func (*Client) GetJobQueryResultsParsed ¶ added in v1.1.0
func (c *Client) GetJobQueryResultsParsed(jobID, queryLocator string, maxRecords int) ([]JobQueryResult, string, error)
GetJobQueryResultsParsed retrieves job query results and converts them into a structured format
func (*Client) GetLimits ¶
func (c *Client) GetLimits() (LimitsResponse, error)
GetLimits retrieves the API usage limits from Salesforce
func (*Client) GetRecordCounts ¶
func (c *Client) GetRecordCounts(objects []string) (CountResponse, error)
GetRecordCounts retrieves the record count for specified Salesforce objects
func (*Client) Query ¶
func (c *Client) Query(soql string) (*QueryResponse, error)
Query executes a SOQL query against Salesforce
func (*Client) QueryToolingAPI ¶
func (c *Client) QueryToolingAPI(soql string) (*ToolingResponse, error)
QueryToolingAPI executes a SOQL query against the Salesforce Tooling API
func (*Client) RetrieveMetadata ¶ added in v1.2.0
func (c *Client) RetrieveMetadata(options MetadataRetrieveOptions) (*MetadataAsyncResult, error)
RetrieveMetadata initiates an asynchronous metadata retrieval
func (*Client) UpdateRecord ¶
UpdateRecord updates a Salesforce record by ID
type CodeCoverageResult ¶ added in v1.2.0
type CodeCoverageResult struct {
ID string
LocationsNotCovered []CodeLocation
Name string
Namespace string
NumLocations int
NumLocationsNotCovered int
Type string
}
CodeCoverageResult represents code coverage for a class
type CodeLocation ¶ added in v1.2.0
CodeLocation represents a code location
type ComponentFailure ¶ added in v1.2.0
type ComponentFailure struct {
Changed bool
Created bool
Deleted bool
FileName string
FullName string
ComponentType string
Problem string
ProblemType string
LineNumber int
ColumnNumber int
Success bool
}
ComponentFailure represents failed component
type ComponentSuccess ¶ added in v1.2.0
type ComponentSuccess struct {
Changed bool
Created bool
Deleted bool
FileName string
FullName string
ComponentType string
Success bool
}
ComponentSuccess represents successful component
type CompositeResponse ¶
type CompositeResponse struct {
ID string `json:"id"`
Success bool `json:"success"`
Errors []any `json:"errors"`
}
CompositeResponse represents the generic Salesforce API response
type CountResponse ¶
type CountResponse map[string]interface{}
CountResponse represents the response structure from Salesforce record count API
type CustomField ¶ added in v1.1.0
type CustomField struct {
FullName string `json:"FullName"`
Metadata struct {
Label string `json:"label"`
Type string `json:"type"`
Length int `json:"length,omitempty"`
} `json:"Metadata"`
}
CustomField represents the structure for creating a Salesforce custom field
type DeployDetails ¶ added in v1.2.0
type DeployDetails struct {
ComponentSuccesses []ComponentSuccess
ComponentFailures []ComponentFailure
RunTestResult *RunTestResult
}
DeployDetails contains detailed deploy results
type FileProperty ¶ added in v1.2.0
type FileProperty struct {
CreatedByID string
CreatedByName string
CreatedDate string
FileName string
FullName string
ID string
LastModifiedByID string
LastModifiedByName string
LastModifiedDate string
ManageableState string
NamespacePrefix string
Type string
}
FileProperty represents metadata about a retrieved file
type JobQueryResponse ¶ added in v1.1.0
type JobQueryResponse struct {
ID string `json:"id"`
State string `json:"state"`
Object string `json:"object"`
}
JobQueryResponse represents the response from Salesforce Bulk Query API
type JobQueryResult ¶ added in v1.1.0
JobQueryResult represents a single row in the job query results.
type LimitsResponse ¶
type LimitsResponse map[string]interface{}
LimitsResponse represents the response structure from Salesforce limits API
type MetadataAsyncResult ¶ added in v1.2.0
type MetadataAsyncResult struct {
ID string
Done bool
State string
StateDetail string
StatusCode string
ErrorMessage string
ErrorStatusCode string
}
MetadataAsyncResult represents async operation status
type MetadataDeployOptions ¶ added in v1.2.0
type MetadataDeployOptions struct {
AllowMissingFiles bool
AutoUpdatePackage bool
CheckOnly bool // Validation deploy only
IgnoreWarnings bool
PerformRetrieve bool
PurgeOnDelete bool
RollbackOnError bool
RunTests []string // Test classes to run
SinglePackage bool
TestLevel string // NoTestRun, RunSpecifiedTests, RunLocalTests, RunAllTestsInOrg
}
MetadataDeployOptions configures deploy behavior
type MetadataDeployResult ¶ added in v1.2.0
type MetadataDeployResult struct {
CheckOnly bool
CompletedDate string
CreatedDate string
Details *DeployDetails
Done bool
ErrorMessage string
ID string
IgnoreWarnings bool
NumberComponentErrors int
NumberComponentsDeployed int
NumberComponentsTotal int
NumberTestErrors int
NumberTestsCompleted int
NumberTestsTotal int
RollbackOnError bool
RunTestsEnabled bool
StartDate string
Status string
Success bool
}
MetadataDeployResult represents deploy operation result
type MetadataRetrieveOptions ¶ added in v1.2.0
type MetadataRetrieveOptions struct {
ApiVersion string
PackageNames []string
SinglePackage bool
SpecificFiles []string
UnpackageManifest string // XML manifest content
}
MetadataRetrieveOptions configures retrieve behavior
type MetadataRetrieveResult ¶ added in v1.2.0
type MetadataRetrieveResult struct {
Done bool
ErrorMessage string
ErrorStatusCode string
FileProperties []FileProperty
ID string
Messages []RetrieveMessage
State string
Status string
Success bool
ZipFileBase64 string
}
MetadataRetrieveResult represents retrieve operation result
type QueryResponse ¶
type QueryResponse struct {
TotalSize int `json:"totalSize"`
Done bool `json:"done"`
Records []map[string]any `json:"records"`
}
QueryResponse represents the response structure from Salesforce SOQL query
type RetrieveMessage ¶ added in v1.2.0
RetrieveMessage represents a retrieve status message
type RunTestResult ¶ added in v1.2.0
type RunTestResult struct {
NumFailures int
NumTestsRun int
TotalTime float64
Successes []TestSuccess
Failures []TestFailure
CodeCoverage []CodeCoverageResult
}
RunTestResult contains test execution results
type SobjectResponse ¶
type SobjectResponse struct {
ID string `json:"id"`
Success bool `json:"success"`
Errors []any `json:"errors"`
}
SobjectResponse represents the generic Salesforce API response
type TestFailure ¶ added in v1.2.0
type TestFailure struct {
ID string
Message string
MethodName string
Name string
Namespace string
StackTrace string
Time float64
Type string
}
TestFailure represents failed test
type TestSuccess ¶ added in v1.2.0
TestSuccess represents passed test
type ToolingResponse ¶
type ToolingResponse struct {
TotalSize int `json:"totalSize"`
Done bool `json:"done"`
Records []map[string]interface{} `json:"records"`
}
ToolingResponse represents the response structure from Salesforce tooling API