Package Exports
- brightpearl-client
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (brightpearl-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Brightpearl Client
- Still in beta
Usage
- Setup
const clientParams: BrightpearlClientParams = {
dataCenter: "use",
account: "OrgAccount",
appRef: "privateAppRef",
appToken: "privateAppToken"
}
const brightPearlClient = new BrightpearlClient(Axios, clientParams);- Get Sales Order
const order: SalesOrderInformation[] = await brightPearlClient.getSalesOrder(100743);- Update multiple freeform custom fields
/*
Set cache lookups to true to reduce # of calls to Brightpearl until next instantiation
Find Purchase Order custom fields Accepted and Date Of Acceptance
*/
const customFieldHelper = new CustomField(brightPearlClient, true);
const [acceptedField, dateOfAcceptanceField] = await Promise.all<CustomFieldMetadataInformation>([
customFieldHelper.find("Accepted", OrderType.PURCHASE_ORDER),
customFieldHelper.find("Date Of Acceptance", OrderType.PURCHASE_ORDER)
])
// Build Requests
const acceptedFieldRequest = customFieldHelper.buildFreeformRequest<boolean>(acceptedField.code, true, CustomFieldOperation.ADD);
const dateOfAcceptanceRequest = customFieldHelper.buildFreeformRequest<string>(dateOfAcceptanceField.code, new DateTime().toISOString(), CustomFieldOperation.ADD);
// Update custom fields
await customFieldHelper.update<boolean | string>(100743, [acceptedFieldRequest, dateOfAcceptanceRequest]);- Update Order Status
// Set cache lookups to true to reduce # of calls to Brightpearl until next instantiation
const orderStatusHelper = new OrderStatus(brightpearlClient, true);
// Update Order Status
const orderId = 10001;
await orderStatusHelper.update(orderId, "New Web Order");