@companieshouse/api-sdk-node 2.0.303 → 2.0.305

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,4 +1,4 @@
1
- import { PscExtension, PscExtensionData } from "./types";
1
+ import { PscExtension, PscExtensionData, ValidationStatusResponse } from "./types";
2
2
  import { Headers, IHttpClient } from "../../http";
3
3
  import Resource, { ApiErrorResponse } from "../resource";
4
4
  /**
@@ -19,6 +19,28 @@ export default class PscExtensionService {
19
19
  * - An `ApiErrorResponse` object if an error occurs during the request.
20
20
  */
21
21
  postPscExtension(transactionId: string, pscExtension: PscExtensionData, headers?: Headers): Promise<Resource<PscExtension> | ApiErrorResponse>;
22
+ /**
23
+ * Retrieves the count of extension requests for a specific PSC notification.
24
+ *
25
+ * @param pscNotificationId - The unique identifier of the PSC notification.
26
+ * @param headers - Optional headers to include in the request.
27
+ * @returns A promise that resolves to either:
28
+ * - A `Resource<number>` object containing the extension count (0, 1, or 2).
29
+ * - An `ApiErrorResponse` object if an error occurs during the request.
30
+ */
31
+ getPscExtensionCount(pscNotificationId: string, headers?: Headers): Promise<Resource<number> | ApiErrorResponse>;
32
+ /**
33
+ * Validates whether a PSC extension request is valid for the given parameters.
34
+ *
35
+ * @param transactionId - The unique identifier of the transaction.
36
+ * @param pscNotificationId - The unique identifier of the PSC notification.
37
+ * @param companyNumber - The company number.
38
+ * @param headers - Optional headers to include in the request.
39
+ * @returns A promise that resolves to either:
40
+ * - A `Resource<ValidationStatusResponse>` object containing validation results.
41
+ * - An `ApiErrorResponse` object if an error occurs during the request.
42
+ */
43
+ getIsPscExtensionValid(transactionId: string, pscNotificationId: string, companyNumber: string, headers?: Headers): Promise<Resource<ValidationStatusResponse> | ApiErrorResponse>;
22
44
  /**
23
45
  * Maps the response body to a front-end resource format with camelCase keys.
24
46
  *
@@ -42,6 +42,54 @@ class PscExtensionService {
42
42
  return this.populateFrontEndResource(response);
43
43
  });
44
44
  }
45
+ /**
46
+ * Retrieves the count of extension requests for a specific PSC notification.
47
+ *
48
+ * @param pscNotificationId - The unique identifier of the PSC notification.
49
+ * @param headers - Optional headers to include in the request.
50
+ * @returns A promise that resolves to either:
51
+ * - A `Resource<number>` object containing the extension count (0, 1, or 2).
52
+ * - An `ApiErrorResponse` object if an error occurs during the request.
53
+ */
54
+ getPscExtensionCount(pscNotificationId, headers) {
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ const resourceUri = `/persons-with-significant-control-extensions/${pscNotificationId}/extensionCount`;
57
+ const response = yield this.client.httpGet(resourceUri, headers);
58
+ if (response.error) {
59
+ return this.handleErrorResponse(response);
60
+ }
61
+ const frontEndResource = {
62
+ httpStatusCode: response.status,
63
+ resource: response.body
64
+ };
65
+ return frontEndResource;
66
+ });
67
+ }
68
+ /**
69
+ * Validates whether a PSC extension request is valid for the given parameters.
70
+ *
71
+ * @param transactionId - The unique identifier of the transaction.
72
+ * @param pscNotificationId - The unique identifier of the PSC notification.
73
+ * @param companyNumber - The company number.
74
+ * @param headers - Optional headers to include in the request.
75
+ * @returns A promise that resolves to either:
76
+ * - A `Resource<ValidationStatusResponse>` object containing validation results.
77
+ * - An `ApiErrorResponse` object if an error occurs during the request.
78
+ */
79
+ getIsPscExtensionValid(transactionId, pscNotificationId, companyNumber, headers) {
80
+ return __awaiter(this, void 0, void 0, function* () {
81
+ const resourceUri = `/persons-with-significant-control-extensions/${transactionId}/${pscNotificationId}/${companyNumber}/isPscExtensionRequestValid`;
82
+ const response = yield this.client.httpGet(resourceUri, headers);
83
+ if (response.error) {
84
+ return this.handleErrorResponse(response);
85
+ }
86
+ const frontEndResource = {
87
+ httpStatusCode: response.status,
88
+ resource: mapping_1.default.camelCaseKeys(response.body)
89
+ };
90
+ return frontEndResource;
91
+ });
92
+ }
45
93
  /**
46
94
  * Maps the response body to a front-end resource format with camelCase keys.
47
95
  *
@@ -1 +1 @@
1
- {"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/services/psc-extensions-link/service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3H,MAAM,WAAW,GAAG,gDAAgD,aAAa,IAAI,iBAAiB,IAAI,aAAa,6BAA6B,CAAC;YACrJ,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;YAEjE,IAAI,QAAQ,CAAC,KAAK,EAAE;gBAChB,OAAO,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;aAC7C;YAED,MAAM,gBAAgB,GAAuC;gBACzD,cAAc,EAAE,QAAQ,CAAC,MAAM;gBAC/B,QAAQ,EAAE,iBAAO,CAAC,aAAa,CAA2B,QAAQ,CAAC,IAAI,CAAC;aAC3E,CAAC;YAEF,OAAO,gBAAgB,CAAC;QAC5B,CAAC;KAAA;IAED;;;;;OAKG;IACK,wBAAwB,CAAE,QAAsB;QACpD,MAAM,gBAAgB,GAA2B;YAC7C,cAAc,EAAE,QAAQ,CAAC,MAAM;YAC/B,QAAQ,EAAE,QAAQ,CAAC,IAAoB;SAC1C,CAAC;QAEF,MAAM,IAAI,GAAG,QAAQ,CAAC,IAA4C,CAAC;QACnE,gBAAgB,CAAC,QAAQ,GAAG,iBAAO,CAAC,aAAa,CAAe,IAAI,CAAC,CAAC;QAEtE,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED;;;;;OAKG;IACK,mBAAmB,CAAE,QAAsB;QAC/C,OAAO;YACH,cAAc,EAAE,QAAQ,CAAC,MAAM;YAC/B,MAAM,EAAE,CAAC,iBAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SAClD,CAAC;IACN,CAAC;CACJ;AA1GD,sCA0GC"}
@@ -120,12 +120,12 @@ export interface PscExtensionData {
120
120
  }
121
121
  export interface ExtensionDetailsResource {
122
122
  extensionReason?: string;
123
- nameMismatchReason?: string;
123
+ extensionStatus?: string;
124
124
  extensionRequestDate?: string;
125
125
  }
126
126
  export interface ExtensionDetails {
127
127
  extensionReason?: string;
128
- nameMismatchReason?: string;
128
+ extensionStatus?: string;
129
129
  extensionRequestDate?: string;
130
130
  }
131
131
  export interface ValidationStatusError {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@companieshouse/api-sdk-node",
3
- "version": "2.0.303",
3
+ "version": "2.0.305",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [