@companieshouse/api-sdk-node 2.0.304 → 2.0.306
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.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAIA,oEAA4C;AAG5C;;;;GAIG;AACH,MAAqB,mBAAmB;IACpC,YAA8B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAErD;;;;;;;;OAQG;IACU,gBAAgB,CAAE,aAAqB,EAAE,YAA8B,EAAE,OAAiB;;YACnG,MAAM,WAAW,GAAG,iBAAiB,aAAa,8CAA8C,CAAC;YACjG,MAAM,oBAAoB,GAAG,iBAAO,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;YACjE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,oBAAoB,EAAE,OAAO,CAAC,CAAC;YAExF,IAAI,QAAQ,CAAC,KAAK,EAAE;gBAChB,OAAO,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC;aAC7C;YAED,OAAO,IAAI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/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"}
|
|
@@ -136,7 +136,7 @@ export interface ValidationStatusError {
|
|
|
136
136
|
}
|
|
137
137
|
export interface ValidationStatusResponse {
|
|
138
138
|
errors: ValidationStatusError[];
|
|
139
|
-
|
|
139
|
+
valid: boolean;
|
|
140
140
|
}
|
|
141
141
|
export interface ValidationStatusErrorResource {
|
|
142
142
|
error: string;
|
|
@@ -146,5 +146,5 @@ export interface ValidationStatusErrorResource {
|
|
|
146
146
|
}
|
|
147
147
|
export interface ValidationStatusResponseResource {
|
|
148
148
|
errors: ValidationStatusErrorResource[];
|
|
149
|
-
|
|
149
|
+
valid: boolean;
|
|
150
150
|
}
|