Documentation ¶
Overview ¶
Package force provides access to Salesforce various APIs
Package force provides access to Salesforce various APIs
Index ¶
- func CheckResponse(r *http.Response) error
- type Client
- func (c *Client) Do(req *http.Request, v interface{}) (err error)
- func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)
- func (c *Client) Query(query string, v interface{}) (err error)
- func (c *Client) QueryExplain(query string) (explain QueryExplainResponse, err error)
- type CodeCoverageResult
- type CodeCoverageWarning
- type CodeLocation
- type DescribeGlobalResult
- type DescribeGlobalSObjectResult
- type ErrorResponse
- type ExecuteAnonymousResult
- type QueryExplainResponse
- type RunTestFailure
- type RunTestSuccess
- type RunTestsAsynchronousRequest
- type RunTestsResult
- type ToolingService
- func (c *ToolingService) DescribeGlobal() (result DescribeGlobalResult, err error)
- func (c *ToolingService) ExecuteAnonymous(apex string) (result ExecuteAnonymousResult, err error)
- func (c *ToolingService) Query(soql string, v interface{}) (err error)
- func (c *ToolingService) RunTests(classnames []string) (result RunTestsResult, err error)
- func (c *ToolingService) RunTestsAsynchronous(classids []string, suiteids []string, maxFailedTests string, testLevel string) (result string, err error)
- func (c *ToolingService) Search(sosl string, v interface{}) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.
Types ¶
type Client ¶
type Client struct { // Base URL for API requests. Defaults to the production Salesforce API, // but can be set to a domain endpoint to use with Salesforce sandboxes. // BaseURL should always be specified with a trailing slash. BaseURL *url.URL // User agent used when communicating. UserAgent string // Services used for talking to different parts of the Salesforce API. Tooling *ToolingService // contains filtered or unexported fields }
Client is an HTTP client used to interact with the Salesforce API
func NewClient ¶
NewClient returns a new Salesforce API client. If a nil httpClient is provided, http.DefaultClient will be used. To use API methods which require authentication, provide an http.Client that will perform the authentication for you (such as that provided by the golang.org/x/oauth2 library).
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.
func (*Client) NewRequest ¶
NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.
func (*Client) Query ¶
Query is used for retrieving query performance feedback without executing the query
func (*Client) QueryExplain ¶
func (c *Client) QueryExplain(query string) (explain QueryExplainResponse, err error)
QueryExplain is used for retrieving query performance feedback without executing the query
type CodeCoverageResult ¶
type CodeCoverageResult struct { DmlInfo []CodeLocation `json:"dmlInfo"` ID string `json:"id"` LocationsNotCovered []CodeLocation `json:"locationsNotCovered"` MethodInfo []CodeLocation `json:"methodInfo"` Name string `json:"name"` Namespace string `json:"namespace"` NumLocations int `json:"numLocations"` NumLocationsNotCovered int `json:"numLocationsNotCovered"` SoqlInfo []CodeLocation `json:"soqlInfo"` SoslInfo []CodeLocation `json:"soslInfo"` Type string `json:"type"` }
CodeCoverageResult contains the details of the code coverage for the specified unit tests.
type CodeCoverageWarning ¶
type CodeCoverageWarning struct { Id string `json:"id"` Message string `json:"message"` Name string `json:"name"` Namespace string `json:"namespace"` }
CodeCoverageWarning contains results include both the total number of lines that could have been executed, as well as the number, line, and column positions of code that was not executed.
type CodeLocation ¶
type CodeLocation struct { Column int `json:"column"` Line int `json:"line"` NumExecutions int `json:"numExecutions"` Time float64 `json:"time"` }
CodeLocation contains if any code is not covered, the line and column of the code not tested, and the number of times the code was executed
type DescribeGlobalResult ¶
type DescribeGlobalResult struct { Encoding string `json:"encoding"` MaxBatchSize int `json:"maxBatchSize"` SObjects []DescribeGlobalSObjectResult `json:"sobjects"` }
DescribeGlobalResult represents the response of DescribeGlobal()
type DescribeGlobalSObjectResult ¶
type DescribeGlobalSObjectResult struct { Activateable bool `json:"activateable"` Createable bool `json:"createable"` Custom bool `json:"custom"` CustomSetting bool `json:"customSetting"` Deletable bool `json:"deletable"` DeprecatedAndHidden bool `json:"deprecatedAndHidden"` FeedEnabled bool `json:"feedEnabled"` KeyPrefix string `json:"keyPrefix"` Label string `json:"label"` LabelPlural string `json:"labelPlural"` Layoutable bool `json:"layoutable"` Mergeable bool `json:"mergeable"` Name string `json:"name"` Queryable bool `json:"queryable"` Replicateable bool `json:"replicateable"` Retrieveable bool `json:"retrieveable"` Searchable bool `json:"searchable"` Triggerable bool `json:"triggerable"` Undeletable bool `json:"undeletable"` Updateable bool `json:"updateable"` }
DescribeGlobalSObjectResult represents the properties for one of the objects available for your organization.
type ErrorResponse ¶
type ErrorResponse struct { Response *http.Response // HTTP response that caused this error Errors []struct { Message string `json:"message"` Errorcode string `json:"errorCode"` } }
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type ExecuteAnonymousResult ¶
type ExecuteAnonymousResult struct { Column int `json:"column"` CompileProblem string `json:"compileProblem"` Compiled bool `json:"compiled"` ExceptionMessage string `json:"exceptionMessage"` ExceptionStackTrace string `json:"exceptionStackTrace"` Line int `json:"line"` Success bool `json:"success"` }
ExecuteAnonymousResult specifies information about whether or not the compile and run of the code was successful
type QueryExplainResponse ¶
type QueryExplainResponse struct { Plans []struct { Cardinality int `json:"cardinality"` Fields []string `json:"fields"` LeadingOperationType string `json:"leadingOperationType"` RelativeCost float64 `json:"relativeCost"` SobjectCardinality int `json:"sobjectCardinality"` SobjectType string `json:"sobjectType"` Notes []struct { Description string `json:"description"` Fields []string `json:"fields"` TableEnumOrID string `json:"tableEnumOrId"` } `json:"notes"` } `json:"plans"` }
QueryExplainResponse is returned by QueryExplain
type RunTestFailure ¶
type RunTestFailure struct { Id string `json:"id"` Message string `json:"message"` MethodName string `json:"methodName"` Name string `json:"name"` Namespace string `json:"namespace"` SeeAllData string `json:"seeAllData"` StackTrace string `json:"stackTrace"` Time float64 `json:"time"` Type string `json:"string"` }
RunTestFailure contains information about failures during the unit test run.
type RunTestSuccess ¶
type RunTestSuccess struct { Id string `json:"id"` MethodName string `json:"methodName"` Name string `json:"name"` Namespace string `json:"namespace"` SeeAllData string `json:"seeAllData"` Time float64 `json:"time"` }
RunTestSuccess contains information about successes during the unit test run.
type RunTestsAsynchronousRequest ¶
type RunTestsAsynchronousRequest struct { ClassIDs string `json:"classids,omitempty"` SuiteIDs string `json:"suiteids,omitempty"` MaxFailedTests string `json:"maxFailedTests,omitempty"` TestLevel string `json:"testLevel,omitempty"` }
RunTestsAsynchronousRequest contains a sample request to the runTestAsynchronous method
type RunTestsResult ¶
type RunTestsResult struct { ApexLogID string `json:"apexLogId"` CodeCoverage []CodeCoverageResult `json:"codeCoverage"` CodeCoverageWarnings []CodeCoverageWarning `json:"codeCoverageWarnings"` Failures []RunTestFailure `json:"failures"` NumFailures int `json:"numFailures"` NumTestsRun int `json:"numTestsRun"` Successes []RunTestSuccess `json:"successes"` TotalTime float64 `json:"totalTime"` }
RunTestsResult contains information about the execution of unit tests, including whether unit tests were completed successfully, code coverage results, and failures.
type ToolingService ¶
type ToolingService struct {
// contains filtered or unexported fields
}
ToolingService handles communication with the Tooling API methods of the Salesforce Tooling API.
func (*ToolingService) DescribeGlobal ¶
func (c *ToolingService) DescribeGlobal() (result DescribeGlobalResult, err error)
DescribeGlobal lists the available Tooling API objects and their metadata
func (*ToolingService) ExecuteAnonymous ¶
func (c *ToolingService) ExecuteAnonymous(apex string) (result ExecuteAnonymousResult, err error)
ExecuteAnonymous executes the specified block of Apex anonymously and returns the result.
func (*ToolingService) Query ¶
func (c *ToolingService) Query(soql string, v interface{}) (err error)
Query executes a query against a Tooling API object and returns data that matches the specified criteria.
func (*ToolingService) RunTests ¶
func (c *ToolingService) RunTests(classnames []string) (result RunTestsResult, err error)
RunTests executes the tests in the specified classes using the synchronous test execution mechanism.
func (*ToolingService) RunTestsAsynchronous ¶
func (*ToolingService) Search ¶
func (c *ToolingService) Search(sosl string, v interface{}) (err error)
Search is used to search for records that match a specified text string.