@arrowsphere/api-client 3.2.0 → 3.2.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,20 @@
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.2.1] - 2022-04-06
7
+
8
+ ### Changed
9
+
10
+ - OrderClient :
11
+ - Update type CreateOrderInputType, Fields subscription was optional
12
+ - Update type CreateOrderInputType, Add Fields discount and uplift
13
+ - Endpoint List Order :
14
+ - add Pagination
15
+ - Fields Partner was optional
16
+ - Endpoint Get Order :
17
+ - Update generated URL
18
+ - Fields Partner was optional
19
+
6
20
  ## [3.2.0] - 2022-04-01
7
21
 
8
22
  ### Changed
@@ -19,7 +19,7 @@ export declare type OrderType = {
19
19
  [OrderFields.COLUMN_DATESTATUS]: string;
20
20
  [OrderFields.COLUMN_DATECREATION]: string;
21
21
  [OrderFields.COLUMN_ORDER_REFERENCE]: string;
22
- [OrderFields.COLUMN_PARTNER]: OrderPartnerType;
22
+ [OrderFields.COLUMN_PARTNER]?: OrderPartnerType;
23
23
  [OrderFields.COLUMN_CUSTOMER]: ReferenceLinkType;
24
24
  [OrderFields.COLUMN_PONUMBER]: string;
25
25
  [OrderFields.COLUMN_PRODUCTS]: Array<OrderProductsType>;
@@ -32,7 +32,7 @@ export declare class Order extends AbstractEntity<OrderType> {
32
32
  get dateStatus(): string;
33
33
  get dateCreation(): string;
34
34
  get order_reference(): string;
35
- get partner(): OrderPartner;
35
+ get partner(): OrderPartner | undefined;
36
36
  get customer(): ReferenceLink;
37
37
  get ponumber(): string;
38
38
  get products(): Array<OrderProduct>;
@@ -48,7 +48,9 @@ class Order extends abstractEntity_1.AbstractEntity {
48
48
  __classPrivateFieldSet(this, _dateStatus, getOrderDataInput[OrderFields.COLUMN_DATESTATUS]);
49
49
  __classPrivateFieldSet(this, _dateCreation, getOrderDataInput[OrderFields.COLUMN_DATECREATION]);
50
50
  __classPrivateFieldSet(this, _order_reference, getOrderDataInput[OrderFields.COLUMN_ORDER_REFERENCE]);
51
- __classPrivateFieldSet(this, _partner, new partner_1.OrderPartner(getOrderDataInput[OrderFields.COLUMN_PARTNER]));
51
+ __classPrivateFieldSet(this, _partner, getOrderDataInput[OrderFields.COLUMN_PARTNER]
52
+ ? new partner_1.OrderPartner(getOrderDataInput[OrderFields.COLUMN_PARTNER])
53
+ : undefined);
52
54
  __classPrivateFieldSet(this, _customer, new referenceLink_1.ReferenceLink(getOrderDataInput[OrderFields.COLUMN_CUSTOMER]));
53
55
  __classPrivateFieldSet(this, _ponumber, getOrderDataInput[OrderFields.COLUMN_PONUMBER]);
54
56
  __classPrivateFieldSet(this, _products, getOrderDataInput[OrderFields.COLUMN_PRODUCTS].map((order) => new products_1.OrderProduct(order)));
@@ -81,13 +83,14 @@ class Order extends abstractEntity_1.AbstractEntity {
81
83
  return __classPrivateFieldGet(this, _products);
82
84
  }
83
85
  toJSON() {
86
+ var _a;
84
87
  return {
85
88
  [OrderFields.COLUMN_REFERENCE]: this.reference,
86
89
  [OrderFields.COLUMN_STATUS]: this.status,
87
90
  [OrderFields.COLUMN_DATESTATUS]: this.dateStatus,
88
91
  [OrderFields.COLUMN_DATECREATION]: this.dateCreation,
89
92
  [OrderFields.COLUMN_ORDER_REFERENCE]: this.order_reference,
90
- [OrderFields.COLUMN_PARTNER]: this.partner.toJSON(),
93
+ [OrderFields.COLUMN_PARTNER]: (_a = this.partner) === null || _a === void 0 ? void 0 : _a.toJSON(),
91
94
  [OrderFields.COLUMN_CUSTOMER]: this.customer.toJSON(),
92
95
  [OrderFields.COLUMN_PONUMBER]: this.ponumber,
93
96
  [OrderFields.COLUMN_PRODUCTS]: this.products.map((order) => order.toJSON()),
@@ -13,7 +13,9 @@ export declare enum CreateOrderInputFields {
13
13
  COLUMN_PARENT_LICENSE_ID = "parentLicenseId",
14
14
  COLUMN_PARENT_SKU = "parentSku",
15
15
  COLUMN_PERIODICITY = "periodicity",
16
- COLUMN_TERM = "term"
16
+ COLUMN_TERM = "term",
17
+ COLUMN_DISCOUNT = "discount",
18
+ COLUMN_UPLIFT = "uplift"
17
19
  }
18
20
  export declare type CreateOrderInputType = {
19
21
  [CreateOrderInputFields.COLUMN_CUSTOMER]: {
@@ -23,13 +25,15 @@ export declare type CreateOrderInputType = {
23
25
  [CreateOrderInputFields.COLUMN_PRODUCTS]: Array<{
24
26
  [CreateOrderInputFields.COLUMN_SKU]: string;
25
27
  [CreateOrderInputFields.COLUMN_QUANTITY]: number;
26
- [CreateOrderInputFields.COLUMN_SUBSCRIPTION]: {
28
+ [CreateOrderInputFields.COLUMN_SUBSCRIPTION]?: {
27
29
  [CreateOrderInputFields.COLUMN_REFERENCE]: string;
28
30
  };
29
31
  [CreateOrderInputFields.COLUMN_PARENT_LICENSE_ID]?: string;
30
32
  [CreateOrderInputFields.COLUMN_PARENT_SKU]?: string;
31
33
  [CreateOrderInputFields.COLUMN_PERIODICITY]?: string;
32
34
  [CreateOrderInputFields.COLUMN_TERM]?: string;
35
+ [CreateOrderInputFields.COLUMN_DISCOUNT]?: number;
36
+ [CreateOrderInputFields.COLUMN_UPLIFT]?: number;
33
37
  }>;
34
38
  };
35
39
  export declare class OrdersClient extends AbstractClient {
@@ -44,6 +48,6 @@ export declare class OrdersClient extends AbstractClient {
44
48
  */
45
49
  protected basePath: string;
46
50
  create(postData: CreateOrderInputType, parameters?: Parameters): Promise<GetResult<ReferenceLink>>;
47
- getListOrders(parameters?: Parameters): Promise<GetResult<DataListOrders>>;
48
- getOrder(orderReference: string): Promise<GetResult<DataListOrders>>;
51
+ getListOrders(perPage?: number, page?: number, parameters?: Parameters): Promise<GetResult<DataListOrders>>;
52
+ getOrder(orderReference: string, parameters?: Parameters): Promise<GetResult<DataListOrders>>;
49
53
  }
@@ -18,6 +18,8 @@ var CreateOrderInputFields;
18
18
  CreateOrderInputFields["COLUMN_PARENT_SKU"] = "parentSku";
19
19
  CreateOrderInputFields["COLUMN_PERIODICITY"] = "periodicity";
20
20
  CreateOrderInputFields["COLUMN_TERM"] = "term";
21
+ CreateOrderInputFields["COLUMN_DISCOUNT"] = "discount";
22
+ CreateOrderInputFields["COLUMN_UPLIFT"] = "uplift";
21
23
  })(CreateOrderInputFields = exports.CreateOrderInputFields || (exports.CreateOrderInputFields = {}));
22
24
  class OrdersClient extends abstractClient_1.AbstractClient {
23
25
  constructor() {
@@ -36,12 +38,14 @@ class OrdersClient extends abstractClient_1.AbstractClient {
36
38
  async create(postData, parameters = {}) {
37
39
  return new getResult_1.GetResult(referenceLink_1.ReferenceLink, await this.post(postData, parameters));
38
40
  }
39
- async getListOrders(parameters = {}) {
41
+ async getListOrders(perPage = 25, page = 1, parameters = {}) {
42
+ this.setPerPage(perPage);
43
+ this.setPage(page);
40
44
  return new getResult_1.GetResult(dataListOrders_1.DataListOrders, await this.get(parameters));
41
45
  }
42
- async getOrder(orderReference) {
43
- this.path = `${this.ROOT_PATH}/${orderReference}`;
44
- return new getResult_1.GetResult(dataListOrders_1.DataListOrders, await this.get());
46
+ async getOrder(orderReference, parameters = {}) {
47
+ this.path = `/${orderReference}`;
48
+ return new getResult_1.GetResult(dataListOrders_1.DataListOrders, await this.get(parameters));
45
49
  }
46
50
  }
47
51
  exports.OrdersClient = OrdersClient;
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.2.0",
7
+ "version": "3.2.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",