sf-composite-call
Version:
Support for making Salesforce composite call requests with integration for JSforce.
88 lines (87 loc) • 7.6 kB
TypeScript
import { CompositeSubrequest, CompositeSubrequestBody } from './CompositeSubrequest';
export interface ExternalIdReference {
externalId: string;
sobject?: string;
}
/**
* @description Class for SObject Collection Composite Subrequests.
* @augments CompositeSubrequest
* @param {string} [referenceId] - The reference ID of the query subrequest.
* @param {string} [version] - The version of the Salesforce API to use.
*/
export declare class CompositeSubrequestSObjectCollection extends CompositeSubrequest {
url(): string;
/**
* @description Method to delete a collection of SObjects.
* @param {string[]} ids - An array of IDs to delete; limit is 200 records.
* @param {boolean} [allOrNone=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.
* @param {object} [httpHeaders] - **Optional.** Additional HTTP headers to include in the request.
* @returns {CompositeSubrequestBody} - A subrequest object.
* @throws {Error} Too many IDs specified for SObject Collection DELETE request; limit is 200, ${ids.length} were provided.
*/
delete(ids: string[], allOrNone?: boolean, httpHeaders?: any): CompositeSubrequestBody;
/**
* @description Method to delete a collection of SObjects.
* @param {string | string[]} id - A single ID or an array of IDs to delete; limit is 200 records.
* @param {boolean} [allOrNone=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.
* @param {object} [httpHeaders] - **Optional.** Additional HTTP headers to include in the request.
* @returns {CompositeSubrequestBody} - A subrequest object.
* @throws {Error} Too many IDs specified for SObject Collection DELETE request; limit is 200, ${ids.length} were provided.
*/
destroy(id: string | string[], allOrNone?: boolean, httpHeaders?: any): CompositeSubrequestBody;
/**
* @description Method to get a collection of SObjects.
* @param {string} sobject - Name of the sobject(s) to get.
* @param {string[]} ids - A single ID or an array of IDs to get; limit is 800 records.
* @param {string[]} fields - The field names to retrieve for each sobject.
* @param {object} [httpHeaders] - **Optional.** Additional HTTP headers to include in the request.
* @returns {CompositeSubrequestBody} - A subrequest object.
* @throws {Error} Too many IDs specified for SObject Collection GET request; limit is 800, ${ids.length} were provided.
*/
get(sobject: string, ids: string[], fields: string[], httpHeaders?: any): CompositeSubrequestBody;
patch(records: any[], sobjectOrExternalIdRef?: string | ExternalIdReference, allOrNone?: boolean, httpHeaders?: any): CompositeSubrequestBody;
/**
* @description Method to update a collection of SObjects.
* @param {object | object[]} record - 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.
* @param {string | ExternalIdReference} [sobjectOrExternalIdRef] - **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`.
* @param {boolean} [allOrNone] - **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.
* @param {object} [httpHeaders] - **Optional.** Additional HTTP headers to include in the request.
* @returns {CompositeSubrequestBody} - A subrequest object.
* @throws {Error} Too many records specified for PATCH request; limit is 200, ${records.length} were provided.
* @throws {Error} No SObject type provided for PATCH request.
*/
update(record: any | any[], sobjectOrExternalIdRef?: string | ExternalIdReference, allOrNone?: boolean, httpHeaders?: any): CompositeSubrequestBody;
post(body?: any, operation?: string, httpHeaders?: any): CompositeSubrequestBody;
/**
* @description Method to get a collection of SObjects.
* @param {string} sobject - Name of the sobject(s) to get.
* @param {string | string[]} id - A single ID or an array of IDs to get; limit is 2000 records.
* @param {string | string[]} field - The field name(s) to retrieve for each sobject.
* @param {object} [httpHeaders] - **Optional.** Additional HTTP headers to include in the request.
* @returns {CompositeSubrequestBody} - A subrequest object.
* @throws {Error} Too many IDs specified for SObject Collection retrieve request; limit is 2000, ${id.length} were provided.
*/
retrieve(sobject: string, id: string | string[], field: string | string[], httpHeaders?: any): CompositeSubrequestBody;
/**
* @description Method to create a collection of SObjects.
* @param {object | object[]} record - 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.
* @param {string} [sobject] - **Optional, if all records have a type.** A SObject name; used to add type information to any records missing `attributes.type`.
* @param {boolean} [allOrNone] - **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.
* @param {object} [httpHeaders] - **Optional.** Additional HTTP headers to include in the request.
* @returns {CompositeSubrequestBody} - A subrequest object.
* @throws {Error} Too many records specified for create request; limit is 200, ${records.length} were provided.
* @throws {Error} No SObject type provided for PATCH request.
*/
create(record: any | any[], sobject?: string, allOrNone?: boolean, httpHeaders?: any): CompositeSubrequestBody;
/**
* @description Synonym of `create()`.
* @param {object | object[]} record - 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.
* @param {string} [sobject] - **Optional, if all records have a type.** A SObject name; used to add type information to any records missing `attributes.type`.
* @param {boolean} [allOrNone] - **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.
* @param {object} [httpHeaders] - **Optional.** Additional HTTP headers to include in the request.
* @returns {CompositeSubrequestBody} - A subrequest object.
* @throws {Error} Too many records specified for create request; limit is 200, ${records.length} were provided.
* @throws {Error} No SObject type provided for PATCH request.
*/
insert(record: any | any[], sobject?: string, allOrNone?: boolean, httpHeaders?: any): CompositeSubrequestBody;
}