@companieshouse/api-sdk-node 2.0.20 → 2.0.23

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.
@@ -1,9 +1,11 @@
1
1
  import { IHttpClient } from "../../../http";
2
- import { CertifiedCopyItem } from "./types";
3
- import Resource from "../../resource";
2
+ import { CertifiedCopyItem, CertifiedCopyItemPatchRequest } from "./types";
3
+ import Resource, { ApiResponse, ApiResult } from "../../resource";
4
4
  export default class CertifiedCopyService {
5
5
  private readonly client;
6
6
  private static readonly EXCLUDED_FIELDS;
7
7
  constructor(client: IHttpClient);
8
8
  getCertifiedCopy(certifiedCopyId: string): Promise<Resource<CertifiedCopyItem>>;
9
+ patchCertifiedCopy(certifiedCopyItemRequest: CertifiedCopyItemPatchRequest, certifiedCopyId: string): Promise<ApiResult<ApiResponse<CertifiedCopyItem>>>;
10
+ private handleResponse;
9
11
  }
@@ -13,6 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const mapping_1 = __importDefault(require("../../../mapping/mapping"));
16
+ const result_1 = require("../../result");
16
17
  class CertifiedCopyService {
17
18
  constructor(client) {
18
19
  this.client = client;
@@ -32,6 +33,35 @@ class CertifiedCopyService {
32
33
  });
33
34
  }
34
35
  ;
36
+ /*
37
+ * Add or amend certified copy item properties; there can be one or more patch requests.
38
+ *
39
+ * Note: use this method after the certified copy item has been created.
40
+ */
41
+ patchCertifiedCopy(certifiedCopyItemRequest, certifiedCopyId) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ const additionalHeaders = {
44
+ "Content-Type": "application/merge-patch+json"
45
+ };
46
+ const response = yield this.client.httpPatch(`/orderable/certified-copies/${certifiedCopyId}`, mapping_1.default.snakeCaseKeys(certifiedCopyItemRequest), additionalHeaders);
47
+ return this.handleResponse(response);
48
+ });
49
+ }
50
+ handleResponse(serverResponse) {
51
+ const response = {
52
+ httpStatusCode: serverResponse.status
53
+ };
54
+ if (serverResponse.error) {
55
+ return result_1.failure({
56
+ httpStatusCode: serverResponse.status,
57
+ errors: serverResponse.error.errors
58
+ });
59
+ }
60
+ else {
61
+ response.resource = mapping_1.default.camelCaseKeys(serverResponse.body);
62
+ return result_1.success(response);
63
+ }
64
+ }
35
65
  }
36
66
  exports.default = CertifiedCopyService;
37
67
  CertifiedCopyService.EXCLUDED_FIELDS = {
@@ -1 +1 @@
1
- {"version":3,"file":"service.js","sourceRoot":"","sources":["../../../../src/services/order/certified-copies/service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAGA,uEAA+C;AAE/C,MAAqB,oBAAoB;IASrC,YAA8B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAI,CAAC;IAEzC,gBAAgB,CAAE,eAAuB;;YAClD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,+BAA+B,eAAe,EAAE,CAAC,CAAC;YAEzF,MAAM,QAAQ,GAAgC;gBAC1C,cAAc,EAAE,IAAI,CAAC,MAAM;aAC9B,CAAC;YAEF,IAAI,IAAI,CAAC,KAAK,EAAE;gBACZ,OAAO,QAAQ,CAAC;aACnB;YAED,MAAM,IAAI,GAAG,IAAI,CAAC,IAAiC,CAAC;YAEpD,QAAQ,CAAC,QAAQ,GAAG,iBAAO,CAAC,aAAa,CAAC,IAAI,EAAE,oBAAoB,CAAC,eAAe,CAAC,CAAC;YACtF,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;IAAA,CAAC;;AA1BN,uCA2BC;AA1B2B,oCAAe,GAAG;IACtC,IAAI,EAAE,IAAI;IACV,SAAS,EAAE;QACP,oBAAoB;QACpB,yEAAyE,CAAC,mBAAmB;KAChG;CACJ,CAAC;AAoBL,CAAC"}
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../../../../src/services/order/certified-copies/service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,uEAA+C;AAE/C,yCA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,GAAG,iBAAO,CAAC,aAAa,CAAoB,cAAc,CAAC,IAAI,CAAC,CAAC;YAClF,OAAO,gBAAO,CAAC,QAAQ,CAAC,CAAC;SAC5B;IACL,CAAC;;AAxDL,uCAyDC;AAxD2B,oCAAe,GAAG;IACtC,IAAI,EAAE,IAAI;IACV,SAAS,EAAE;QACP,oBAAoB;QACpB,yEAAyE,CAAC,mBAAmB;KAChG;CACJ,CAAC;AAkDL,CAAC"}
@@ -86,3 +86,8 @@ export interface FilingHistoryDocuments {
86
86
  filingHistoryDescriptionValues?: Record<string, any>;
87
87
  filingHistoryCost: string;
88
88
  }
89
+ export interface CertifiedCopyItemPatchRequest {
90
+ customerReference?: string;
91
+ itemOptions?: ItemOptions;
92
+ quantity?: number;
93
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@companieshouse/api-sdk-node",
3
- "version": "2.0.20",
3
+ "version": "2.0.23",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
@@ -42,7 +42,7 @@
42
42
  "eslint-config-standard": "14.1.1",
43
43
  "eslint-plugin-import": "2.23.0",
44
44
  "eslint-plugin-node": "11.1.0",
45
- "eslint-plugin-promise": "4.3.1",
45
+ "eslint-plugin-promise": "6.0.0",
46
46
  "eslint-plugin-standard": "5.0.0",
47
47
  "mocha": "^9.2.0",
48
48
  "sinon": "^9.2.4",