@arrowsphere/api-client 3.49.0 → 3.50.0-rc.bdj.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
4
4
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
+ ## [3.50.0] - 2023-08-17
7
+
8
+ ### Changed
9
+
10
+ - Adds create & update customer
11
+
6
12
  ## [3.49.0] - 2023-08-16
7
13
 
8
14
  ### Changed
@@ -5,6 +5,8 @@ import { DataInvitation } from './entities/dataInvitation';
5
5
  import { DataListOrders } from '../orders';
6
6
  import { CustomerContactList } from './entities/customers/customerContact/customerContactList';
7
7
  import { CustomerContact, CustomerContactRoleType, CustomerContactTypeType } from './entities/customers/customerContact/customerContact';
8
+ import { CustomerFields, CustomerType } from './entities/customers/customer';
9
+ import { ContactFields } from './entities/customers/contact/contact';
8
10
  export declare enum CustomerContactPayloadFields {
9
11
  COLUMN_FIRST_NAME = "firstName",
10
12
  COLUMN_LAST_NAME = "lastName",
@@ -23,6 +25,49 @@ export declare type PostCustomerContactPayload = {
23
25
  [CustomerContactPayloadFields.COLUMN_TYPE]: CustomerContactTypeType;
24
26
  [CustomerContactPayloadFields.COLUMN_ROLE]: CustomerContactRoleType;
25
27
  };
28
+ export declare type PostCustomerContact = {
29
+ [ContactFields.COLUMN_FIRSTNAME]: string;
30
+ [ContactFields.COLUMN_LASTNAME]: string;
31
+ [ContactFields.COLUMN_EMAIL]: string;
32
+ [ContactFields.COLUMN_PHONE]: string;
33
+ [ContactFields.COLUMN_TYPE]: CustomerContactTypeType;
34
+ [ContactFields.COLUMN_ROLE]: CustomerContactRoleType;
35
+ };
36
+ export declare type PostCustomerPayload = {
37
+ [CustomerFields.COLUMN_COMPANY_NAME]: string;
38
+ [CustomerFields.COLUMN_PARTNER_COMPANY_ID]?: string;
39
+ [CustomerFields.COLUMN_ADDRESS_LINE_1]: string;
40
+ [CustomerFields.COLUMN_ADDRESS_LINE_2]?: string;
41
+ [CustomerFields.COLUMN_ZIP]: string;
42
+ [CustomerFields.COLUMN_CITY]: string;
43
+ [CustomerFields.COLUMN_COUNTRY_CODE]: string;
44
+ [CustomerFields.COLUMN_STATE]?: string;
45
+ [CustomerFields.COLUMN_RECEPTION_PHONE]: string;
46
+ [CustomerFields.COLUMN_WEBSITE_URL]?: string;
47
+ [CustomerFields.COLUMN_EMAIL_CONTACT]?: string;
48
+ [CustomerFields.COLUMN_HEADCOUNT]?: number;
49
+ [CustomerFields.COLUMN_TAX_NUMBER]?: string;
50
+ [CustomerFields.COLUMN_REF]?: string;
51
+ [CustomerFields.COLUMN_BILLING_ID]?: string;
52
+ [CustomerFields.COLUMN_INTERNAL_REFERENCE]?: string;
53
+ [CustomerFields.COLUMN_CONTACT]?: PostCustomerContact;
54
+ };
55
+ export declare type APIResponseResourceCreated = {
56
+ status: number;
57
+ data: {
58
+ reference: string;
59
+ };
60
+ };
61
+ export declare type APIResponseCustomerUpdated = {
62
+ status: number;
63
+ data: {
64
+ customers: CustomerType[];
65
+ };
66
+ };
67
+ export interface APIResponseError {
68
+ status: number;
69
+ message: string;
70
+ }
26
71
  export declare type PatchCustomerContactPayload = {
27
72
  [Property in keyof PostCustomerContactPayload]?: PostCustomerContactPayload[Property];
28
73
  };
@@ -39,4 +84,6 @@ export declare class CustomersClient extends AbstractRestfulClient {
39
84
  getCustomerContact(customerReference: string, contactReference: string, parameters?: Parameters): Promise<GetResult<CustomerContact>>;
40
85
  deleteCustomerContact(customerReference: string, contactReference: string, parameters?: Parameters): Promise<void>;
41
86
  patchCustomerContact(customerReference: string, contactReference: string, payload: PatchCustomerContactPayload, parameters?: Parameters): Promise<GetResult<CustomerContact>>;
87
+ createCustomer(payload: PostCustomerPayload, parameters?: Parameters): Promise<APIResponseResourceCreated | APIResponseError>;
88
+ updateCustomer(customerReference: string, payload: Partial<PostCustomerPayload>, parameters?: Parameters): Promise<APIResponseCustomerUpdated | APIResponseError>;
42
89
  }
@@ -8,6 +8,9 @@ const dataInvitation_1 = require("./entities/dataInvitation");
8
8
  const orders_1 = require("../orders");
9
9
  const customerContactList_1 = require("./entities/customers/customerContact/customerContactList");
10
10
  const customerContact_1 = require("./entities/customers/customerContact/customerContact");
11
+ const customer_1 = require("./entities/customers/customer");
12
+ const contact_1 = require("./entities/customers/contact/contact");
13
+ const lodash_1 = require("lodash");
11
14
  var CustomerContactPayloadFields;
12
15
  (function (CustomerContactPayloadFields) {
13
16
  CustomerContactPayloadFields["COLUMN_FIRST_NAME"] = "firstName";
@@ -59,6 +62,42 @@ class CustomersClient extends abstractRestfulClient_1.AbstractRestfulClient {
59
62
  this.path = `/${customerReference}/contacts/${contactReference}`;
60
63
  return new getResult_1.GetResult(customerContact_1.CustomerContact, await this.patch(payload, parameters));
61
64
  }
65
+ async createCustomer(payload, parameters = {}) {
66
+ this.path = '';
67
+ try {
68
+ const { data } = await this.post(payload, parameters);
69
+ const response = {
70
+ status: 201,
71
+ data,
72
+ };
73
+ return response;
74
+ }
75
+ catch (error) {
76
+ const response = {
77
+ status: (0, lodash_1.get)(error, 'httpCode', (0, lodash_1.get)(error, 'code', 500)),
78
+ message: (0, lodash_1.get)(error, 'httpError', (0, lodash_1.get)(error, 'message', 'An error has occurred')),
79
+ };
80
+ return response;
81
+ }
82
+ }
83
+ async updateCustomer(customerReference, payload, parameters = {}) {
84
+ this.path = `/${customerReference}`;
85
+ try {
86
+ const { data } = await this.patch(payload, parameters);
87
+ const response = {
88
+ status: 200,
89
+ data,
90
+ };
91
+ return response;
92
+ }
93
+ catch (error) {
94
+ const response = {
95
+ status: (0, lodash_1.get)(error, 'httpCode', (0, lodash_1.get)(error, 'code', 500)),
96
+ message: (0, lodash_1.get)(error, 'httpError', (0, lodash_1.get)(error, 'message', 'An error has occurred')),
97
+ };
98
+ return response;
99
+ }
100
+ }
62
101
  }
63
102
  exports.CustomersClient = CustomersClient;
64
103
  //# sourceMappingURL=customersClient.js.map
@@ -4,6 +4,8 @@ export declare enum ContactFields {
4
4
  COLUMN_LASTNAME = "LastName",
5
5
  COLUMN_EMAIL = "Email",
6
6
  COLUMN_PHONE = "Phone",
7
+ COLUMN_TYPE = "Type",
8
+ COLUMN_ROLE = "Role",
7
9
  COLUMN_SYNC_PARTNER_CONTACT_REF_ID = "SyncPartnerContactRefId",
8
10
  COLUMN_CONTACT_PERSON_ID = "ContactPersonID"
9
11
  }
@@ -20,6 +20,8 @@ var ContactFields;
20
20
  ContactFields["COLUMN_LASTNAME"] = "LastName";
21
21
  ContactFields["COLUMN_EMAIL"] = "Email";
22
22
  ContactFields["COLUMN_PHONE"] = "Phone";
23
+ ContactFields["COLUMN_TYPE"] = "Type";
24
+ ContactFields["COLUMN_ROLE"] = "Role";
23
25
  ContactFields["COLUMN_SYNC_PARTNER_CONTACT_REF_ID"] = "SyncPartnerContactRefId";
24
26
  ContactFields["COLUMN_CONTACT_PERSON_ID"] = "ContactPersonID";
25
27
  })(ContactFields = exports.ContactFields || (exports.ContactFields = {}));
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/ArrowSphere/nodejs-api-client.git"
6
6
  },
7
- "version": "3.49.0",
7
+ "version": "3.50.0-rc.bdj.1",
8
8
  "description": "Node.js client for ArrowSphere's public API",
9
9
  "main": "build/index.js",
10
10
  "types": "build/index.d.ts",