Skip to content
This repository has been archived by the owner on Apr 23, 2022. It is now read-only.

Latest commit

 

History

History
728 lines (539 loc) · 39.9 KB

API.md

File metadata and controls

728 lines (539 loc) · 39.9 KB

Classes

CompositeCall
CompositeSubrequest
CompositeSubrequestQueryCompositeSubrequest
CompositeSubrequestSObjectCompositeSubrequest
CompositeSubrequestSObjectCollectionCompositeSubrequest

CompositeCall

Kind: global class

new CompositeCall([options])

Main class for constructing a composite call. Tracks and enforces limits on query and request imposed by Salesforce API.

Param Type Description
[options] object

Optional. Options for creating the instance.

[options.version] string

Optional. The version of Salesforce API to use.

[options.allOrNone] boolean

Optional. Used in the request to Salesforce. See their documentation.

[options.collateSubrequests] boolean

Optional. Used in the request to Salesforce. See their documentation.

[options.jsforceConnection] object

Optional. This connection enables the execute() method for convenience. Without it, the result of Composite Call will have to be passed to another method to post it to Salesforce.

compositeCall.url

Kind: instance property of CompositeCall
Properties

Name Type Description
url string

The versioned url of the composite request.

compositeCall.request

Kind: instance property of CompositeCall
Properties

Name Type Description
request object

The result of constructing the composite call.

[request.allOrNone] boolean

Optional. Specifies what to do when an error occurs while processing a subrequest.

[request.collateSubrequests] boolean

Optional. Specifies what to do when an error occurs while processing a subrequest.

request.CompositeSubrequest Array.<object>

Collection of subrequests to execute.

compositeCall.addQuery(query, [referenceId], [version]) ⇒ CompositeSubrequestQuery

Add a query subrequest instance to the composite request.

Kind: instance method of CompositeCall
Returns: CompositeSubrequestQuery -

  • An instance of CompositeSubrequestQuery.
**Throws**:
  • Error

    Query limit met. No more queries may be added.

  • Error

    Total request limit met. No more requests may be added.

Param Type Description
query string

A SOQL query.

[referenceId] string

Optional. The reference ID of the query subrequest.

[version] string

Optional. The version of the Salesforce API to use. Must be less than or equal to the version defined for the Composite Call.

compositeCall.addSObject(sobject, [referenceId], [version]) ⇒ CompositeSubrequestSObject

Add a SObject subrequest instance to the composite request.

Kind: instance method of CompositeCall
Returns: CompositeSubrequestSObject -

  • An instance of CompositeSubrequestSObject.
**Throws**:
  • Error

    Total request limit met. No more requests may be added.

Param Type Description
sobject string

A SObject name; may be built-in or custom.

[referenceId] string

Optional. The reference ID of the SObject subrequest.

[version] string

Optional. The version of the Salesforce API to use. Must be less than or equal to the version defined for the Composite Call.

compositeCall.addSObjectCollection([referenceId], [version]) ⇒ CompositeSubrequestSObjectCollection

Add a SObject Collection subrequest instance to the composite request.

Kind: instance method of CompositeCall
Returns: CompositeSubrequestSObjectCollection -

  • An instance of CompositeSubrequestSObjectCollection.
**Throws**:
  • Error

    Total request limit met. No more requests may be added.

Param Type Description
[referenceId] string

Optional. The reference ID of the SObject subrequest.

[version] string

Optional. The version of the Salesforce API to use. Must be less than or equal to the version defined for the Composite Call.

compositeCall.clear()

Convenience method for internally clearing previous calls, limits, etc.

Kind: instance method of CompositeCall

compositeCall.execute([connection]) ⇒ Promise.<CompositeCallResponse>

Convenience method for integrating with JSforce.

Kind: instance method of CompositeCall
Returns: Promise.<CompositeCallResponse> -

  • The result of executing the composite call, or undefined if no JSforce connection was given.
Param Type Description
[connection] any

Optionally pass a JSforce connection instance; used if not defined as part this class instance options.

CompositeSubrequest

Kind: global class

new CompositeSubrequest([referenceId], [version])

Base class for Composite Subrequests.

Param Type Description
[referenceId] string

The reference ID of the query subrequest.

[version] string

The version of the Salesforce API to use.

compositeSubrequest.subrequest

Kind: instance property of CompositeSubrequest
Properties

Name Type Description
subrequest object

The result of constructing the composite call.

[subrequest.body] any

Optional. The input body for the subrequest.

[subrequest.httpHeaders] object

Optional. Request headers and their values to include with the subrequest.

subrequest.method string

The method to use with the requested resource. Possible values are POST, PUT, PATCH, GET, and DELETE (case-sensitive).

subrequest.referenceId string

Reference ID that maps to the subrequest’s response and can be used to reference the response in later subrequests.

subrequest.url string

The resource to request.

compositeSubrequest.makeRequest(method, url, body, httpHeaders) ⇒ CompositeSubrequestBody

Base method for building the request.

Kind: instance method of CompositeSubrequest
Returns: CompositeSubrequestBody -

  • A subrequest object.
Param Type Description
method string

The method to use with the requested resource. Possible values are POST, PUT, PATCH, GET, and DELETE (case-sensitive).

url string

The resource to request.

body any

Optional. The input body for the subrequest.

httpHeaders object

Optional. Request headers and their values to include with the subrequest.

CompositeSubrequestQuery ⇐ CompositeSubrequest

Kind: global class
Extends: CompositeSubrequest

new CompositeSubrequestQuery(query, [referenceId], [version])

Class for SOQL query and queryAll Composite Subrequests.

Param Type Description
query string

A SOQL query.

[referenceId] string

The reference ID of the query subrequest.

[version] string

The version of the Salesforce API to use.

compositeSubrequestQuery.subrequest

Kind: instance property of CompositeSubrequestQuery
Overrides: subrequest
Properties

Name Type Description
subrequest object

The result of constructing the composite call.

[subrequest.body] any

Optional. The input body for the subrequest.

[subrequest.httpHeaders] object

Optional. Request headers and their values to include with the subrequest.

subrequest.method string

The method to use with the requested resource. Possible values are POST, PUT, PATCH, GET, and DELETE (case-sensitive).

subrequest.referenceId string

Reference ID that maps to the subrequest’s response and can be used to reference the response in later subrequests.

subrequest.url string

The resource to request.

compositeSubrequestQuery.get([queryId], [httpHeaders]) ⇒ CompositeSubrequestBody

Base request method for query operations.

Kind: instance method of CompositeSubrequestQuery
Returns: CompositeSubrequestBody -

  • A subrequest object.
Param Type Description
[queryId] string

Optional. The word explain or the nextRecordsUrl of a query.

[httpHeaders] object

Optional. Additional HTTP headers to include in the request.

compositeSubrequestQuery.explain([httpHeaders]) ⇒ CompositeSubrequestBody

Method for creating an explain operation.

Kind: instance method of CompositeSubrequestQuery
Returns: CompositeSubrequestBody -

  • A subrequest object.
Param Type Description
[httpHeaders] object

Optional. Additional HTTP headers to include in the request.

compositeSubrequestQuery.explainAll([httpHeaders]) ⇒ CompositeSubrequestBody

Method for creating an explain operation with queryAll.

Kind: instance method of CompositeSubrequestQuery
Returns: CompositeSubrequestBody -

  • A subrequest object.
Param Type Description
[httpHeaders] object

Optional. Additional HTTP headers to include in the request.

compositeSubrequestQuery.nextRecords(nextRecordsUrl, [httpHeaders]) ⇒ CompositeSubrequestBody

Method for creating an operation to obtain next records.

Kind: instance method of CompositeSubrequestQuery
Returns: CompositeSubrequestBody -

  • A subrequest object.
Param Type Description
nextRecordsUrl string

The nextRecordsUrl of a query.

[httpHeaders] object

Optional. Additional HTTP headers to include in the request.

compositeSubrequestQuery.nextRecordsAll(nextRecordsUrl, [httpHeaders]) ⇒ CompositeSubrequestBody

Method for creating an operation to obtain next records with queryAll.

Kind: instance method of CompositeSubrequestQuery
Returns: CompositeSubrequestBody -

  • A subrequest object.
Param Type Description
nextRecordsUrl string

The nextRecordsUrl of a query.

[httpHeaders] object

Optional. Additional HTTP headers to include in the request.

compositeSubrequestQuery.query([httpHeaders]) ⇒ CompositeSubrequestBody

Method for creating a query operation.

Kind: instance method of CompositeSubrequestQuery
Returns: CompositeSubrequestBody -

  • A subrequest object.
Param Type Description
[httpHeaders] object

Optional. Additional HTTP headers to include in the request.

compositeSubrequestQuery.queryAll([httpHeaders]) ⇒ CompositeSubrequestBody

Method for creating a query operation with queryAll.

Kind: instance method of CompositeSubrequestQuery
Returns: CompositeSubrequestBody -

  • A subrequest object.
Param Type Description
[httpHeaders] object

Optional. Additional HTTP headers to include in the request.

compositeSubrequestQuery.makeRequest(method, url, body, httpHeaders) ⇒ CompositeSubrequestBody

Base method for building the request.

Kind: instance method of CompositeSubrequestQuery
Overrides: makeRequest
Returns: CompositeSubrequestBody -

  • A subrequest object.
Param Type Description
method string

The method to use with the requested resource. Possible values are POST, PUT, PATCH, GET, and DELETE (case-sensitive).

url string

The resource to request.

body any

Optional. The input body for the subrequest.

httpHeaders object

Optional. Request headers and their values to include with the subrequest.

CompositeSubrequestSObject ⇐ CompositeSubrequest

Kind: global class
Extends: CompositeSubrequest

new CompositeSubrequestSObject(sobject, [referenceId], [version])

Class for SObject Composite Subrequests.

Param Type Description
sobject string

A valid built-in or custom SObject name.

[referenceId] string

The reference ID of the query subrequest.

[version] string

The version of the Salesforce API to use.

compositeSubrequestSObject.subrequest

Kind: instance property of CompositeSubrequestSObject
Overrides: subrequest
Properties

Name Type Description
subrequest object

The result of constructing the composite call.

[subrequest.body] any

Optional. The input body for the subrequest.

[subrequest.httpHeaders] object

Optional. Request headers and their values to include with the subrequest.

subrequest.method string

The method to use with the requested resource. Possible values are POST, PUT, PATCH, GET, and DELETE (case-sensitive).

subrequest.referenceId string

Reference ID that maps to the subrequest’s response and can be used to reference the response in later subrequests.

subrequest.url string

The resource to request.

compositeSubrequestSObject.destroy(id, [httpHeaders]) ⇒ CompositeSubrequestBody

Method to delete an SObject record.

Kind: instance method of CompositeSubrequestSObject
Returns: CompositeSubrequestBody -

  • A subrequest object.
Param Type Description
id string

The ID of the SObject resource to destory.

[httpHeaders] object

Optional. Additional HTTP headers to include in the request.

compositeSubrequestSObject.describe([httpHeaders]) ⇒ CompositeSubrequestBody

Method to describe an SObject type.

Kind: instance method of CompositeSubrequestSObject
Returns: CompositeSubrequestBody -

  • A subrequest object.
Param Type Description
[httpHeaders] object

Optional. Additional HTTP headers to include in the request.

compositeSubrequestSObject.retrieve(id, [httpHeaders]) ⇒ CompositeSubrequestBody

Method to retrieve an SObject record.

Kind: instance method of CompositeSubrequestSObject
Returns: CompositeSubrequestBody -

  • A subrequest object.
Param Type Description
id string

The ID of the SObject resource to retrieve.

[httpHeaders] object

Optional. Additional HTTP headers to include in the request.

compositeSubrequestSObject.update(record, [externalId], [httpHeaders]) ⇒ CompositeSubrequestBody

Method to update an SObject record.

Kind: instance method of CompositeSubrequestSObject
Returns: CompositeSubrequestBody -

  • A subrequest object.
Param Type Default Description
record object

An object with valid fields for the SObject record.

[record.Id] string

The ID of the SObject resource to update.

[externalId] string "'Id'"

The field name to use as the Id of the object.

[httpHeaders] object

Optional. Additional HTTP headers to include in the request.

compositeSubrequestSObject.create(record, [httpHeaders]) ⇒ CompositeSubrequestBody

Method to create an SObject record.

Kind: instance method of CompositeSubrequestSObject
Returns: CompositeSubrequestBody -

  • A subrequest object.
Param Type Description
record object

An object with valid fields for the SObject record; do not include an Id field.

[httpHeaders] object

Optional. Additional HTTP headers to include in the request.

compositeSubrequestSObject.insert(record, [httpHeaders]) ⇒ CompositeSubrequestBody

Synonym of create().

Kind: instance method of CompositeSubrequestSObject
Returns: CompositeSubrequestBody -

  • A subrequest object.
Param Type Description
record object

An object with valid fields for the SObject record; do not include an Id field.

[httpHeaders] object

Optional. Additional HTTP headers to include in the request.

compositeSubrequestSObject.makeRequest(method, url, body, httpHeaders) ⇒ CompositeSubrequestBody

Base method for building the request.

Kind: instance method of CompositeSubrequestSObject
Overrides: makeRequest
Returns: CompositeSubrequestBody -

  • A subrequest object.
Param Type Description
method string

The method to use with the requested resource. Possible values are POST, PUT, PATCH, GET, and DELETE (case-sensitive).

url string

The resource to request.

body any

Optional. The input body for the subrequest.

httpHeaders object

Optional. Request headers and their values to include with the subrequest.

CompositeSubrequestSObjectCollection ⇐ CompositeSubrequest

Kind: global class
Extends: CompositeSubrequest

new CompositeSubrequestSObjectCollection([referenceId], [version])

Class for SObject Collection Composite Subrequests.

Param Type Description
[referenceId] string

The reference ID of the query subrequest.

[version] string

The version of the Salesforce API to use.

compositeSubrequestSObjectCollection.subrequest

Kind: instance property of CompositeSubrequestSObjectCollection
Properties

Name Type Description
subrequest object

The result of constructing the composite call.

[subrequest.body] any

Optional. The input body for the subrequest.

[subrequest.httpHeaders] object

Optional. Request headers and their values to include with the subrequest.

subrequest.method string

The method to use with the requested resource. Possible values are POST, PUT, PATCH, GET, and DELETE (case-sensitive).

subrequest.referenceId string

Reference ID that maps to the subrequest’s response and can be used to reference the response in later subrequests.

subrequest.url string

The resource to request.

compositeSubrequestSObjectCollection.delete(ids, [allOrNone], [httpHeaders]) ⇒ CompositeSubrequestBody

Method to delete a collection of SObjects.

Kind: instance method of CompositeSubrequestSObjectCollection
Returns: CompositeSubrequestBody -

  • A subrequest object.
**Throws**:
  • Error

    Too many IDs specified for SObject Collection DELETE request; limit is 200, ${ids.length} were provided.

Param Type Default Description
ids Array.<string>

An array of IDs to delete; limit is 200 records.

[allOrNone] boolean false

Optional. Indicates whether to roll back the entire request when the deletion of any object fails (true) or to continue with the independent deletion of other objects in the request. The default is false.

[httpHeaders] object

Optional. Additional HTTP headers to include in the request.

compositeSubrequestSObjectCollection.destroy(id, [allOrNone], [httpHeaders]) ⇒ CompositeSubrequestBody

Method to delete a collection of SObjects.

Kind: instance method of CompositeSubrequestSObjectCollection
Returns: CompositeSubrequestBody -

  • A subrequest object.
**Throws**:
  • Error

    Too many IDs specified for SObject Collection DELETE request; limit is 200, ${ids.length} were provided.

Param Type Default Description
id string | Array.<string>

A single ID or an array of IDs to delete; limit is 200 records.

[allOrNone] boolean false

Optional. Indicates whether to roll back the entire request when the deletion of any object fails (true) or to continue with the independent deletion of other objects in the request. The default is false.

[httpHeaders] object

Optional. Additional HTTP headers to include in the request.

compositeSubrequestSObjectCollection.get(sobject, ids, fields, [httpHeaders]) ⇒ CompositeSubrequestBody

Method to get a collection of SObjects.

Kind: instance method of CompositeSubrequestSObjectCollection
Returns: CompositeSubrequestBody -

  • A subrequest object.
**Throws**:
  • Error

    Too many IDs specified for SObject Collection GET request; limit is 800, ${ids.length} were provided.

Param Type Description
sobject string

Name of the sobject(s) to get.

ids Array.<string>

A single ID or an array of IDs to get; limit is 800 records.

fields Array.<string>

The field names to retrieve for each sobject.

[httpHeaders] object

Optional. Additional HTTP headers to include in the request.

compositeSubrequestSObjectCollection.update(record, [sobjectOrExternalIdRef], [allOrNone], [httpHeaders]) ⇒ CompositeSubrequestBody

Method to update a collection of SObjects.

Kind: instance method of CompositeSubrequestSObjectCollection
Returns: CompositeSubrequestBody -

  • A subrequest object.
**Throws**:
  • Error

    Too many records specified for PATCH request; limit is 200, ${records.length} were provided.

  • Error

    No SObject type provided for PATCH request.

Param Type Description
record object | Array.<object>

The SObject records to update, limit is 200; ensure that all records have an Id field and object attributes with field type containing the SOBject name of the record.

[sobjectOrExternalIdRef] string | ExternalIdReference

Optional, if all records have a type; required for external ID upserts. A SObject name; used to add type information to any records missing attributes.type.

[allOrNone] boolean

Optional. Indicates whether to roll back the entire request when the deletion of any object fails (true) or to continue with the independent deletion of other objects in the request. The default is false.

[httpHeaders] object

Optional. Additional HTTP headers to include in the request.

compositeSubrequestSObjectCollection.retrieve(sobject, id, field, [httpHeaders]) ⇒ CompositeSubrequestBody

Method to get a collection of SObjects.

Kind: instance method of CompositeSubrequestSObjectCollection
Returns: CompositeSubrequestBody -

  • A subrequest object.
**Throws**:
  • Error

    Too many IDs specified for SObject Collection retrieve request; limit is 2000, ${id.length} were provided.

Param Type Description
sobject string

Name of the sobject(s) to get.

id string | Array.<string>

A single ID or an array of IDs to get; limit is 2000 records.

field string | Array.<string>

The field name(s) to retrieve for each sobject.

[httpHeaders] object

Optional. Additional HTTP headers to include in the request.

compositeSubrequestSObjectCollection.create(record, [sobject], [allOrNone], [httpHeaders]) ⇒ CompositeSubrequestBody

Method to create a collection of SObjects.

Kind: instance method of CompositeSubrequestSObjectCollection
Returns: CompositeSubrequestBody -

  • A subrequest object.
**Throws**:
  • Error

    Too many records specified for create request; limit is 200, ${records.length} were provided.

  • Error

    No SObject type provided for PATCH request.

Param Type Description
record object | Array.<object>

The SObject records to create, limit is 200; ensure that each record has object attributes with field type containing the SOBject name of the record and NO records have an Id field.

[sobject] string

Optional, if all records have a type. A SObject name; used to add type information to any records missing attributes.type.

[allOrNone] boolean

Optional. Indicates whether to roll back the entire request when the deletion of any object fails (true) or to continue with the independent deletion of other objects in the request. The default is false.

[httpHeaders] object

Optional. Additional HTTP headers to include in the request.

compositeSubrequestSObjectCollection.insert(record, [sobject], [allOrNone], [httpHeaders]) ⇒ CompositeSubrequestBody

Synonym of create().

Kind: instance method of CompositeSubrequestSObjectCollection
Returns: CompositeSubrequestBody -

  • A subrequest object.
**Throws**:
  • Error

    Too many records specified for create request; limit is 200, ${records.length} were provided.

  • Error

    No SObject type provided for PATCH request.

Param Type Description
record object | Array.<object>

The SObject records to create, limit is 200; ensure that each record has object attributes with field type containing the SOBject name of the record and NO records have an Id field.

[sobject] string

Optional, if all records have a type. A SObject name; used to add type information to any records missing attributes.type.

[allOrNone] boolean

Optional. Indicates whether to roll back the entire request when the deletion of any object fails (true) or to continue with the independent deletion of other objects in the request. The default is false.

[httpHeaders] object

Optional. Additional HTTP headers to include in the request.

compositeSubrequestSObjectCollection.makeRequest(method, url, body, httpHeaders) ⇒ CompositeSubrequestBody

Base method for building the request.

Kind: instance method of CompositeSubrequestSObjectCollection
Returns: CompositeSubrequestBody -

  • A subrequest object.
Param Type Description
method string

The method to use with the requested resource. Possible values are POST, PUT, PATCH, GET, and DELETE (case-sensitive).

url string

The resource to request.

body any

Optional. The input body for the subrequest.

httpHeaders object

Optional. Request headers and their values to include with the subrequest.