@companieshouse/api-sdk-node 2.0.75 → 2.0.77
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/dist/services/company-officers/types.d.ts +1 -0
- package/dist/services/officer-filing/service.d.ts +15 -1
- package/dist/services/officer-filing/service.js +43 -0
- package/dist/services/officer-filing/service.js.map +1 -1
- package/dist/services/officer-filing/types.d.ts +33 -2
- package/dist/services/officer-filing/types.js +2 -2
- package/dist/services/officer-filing/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CompanyOfficer } from "./types";
|
|
1
|
+
import { CompanyOfficer, FilingResponse, OfficerFiling } from "./types";
|
|
2
2
|
import { IHttpClient } from "../../http";
|
|
3
3
|
import Resource, { ApiErrorResponse } from "../resource";
|
|
4
4
|
export default class {
|
|
@@ -15,5 +15,19 @@ export default class {
|
|
|
15
15
|
*/
|
|
16
16
|
getDirectorAndTerminationDate(transactionId: string, submissionId: string): Promise<Resource<CompanyOfficer> | ApiErrorResponse>;
|
|
17
17
|
getCurrentOrFutureDissolved(companyNumber: String): Promise<Resource<Boolean> | ApiErrorResponse>;
|
|
18
|
+
/**
|
|
19
|
+
* Post an officer filing object to update on the API.
|
|
20
|
+
*/
|
|
21
|
+
postOfficerFiling(transactionId: string, officerFiling: OfficerFiling): Promise<Resource<FilingResponse> | ApiErrorResponse>;
|
|
22
|
+
/**
|
|
23
|
+
* Map an OfficerFiling object to an OfficerFilingDto which represents the expected json data model
|
|
24
|
+
*/
|
|
25
|
+
private mapToDto;
|
|
26
|
+
/**
|
|
27
|
+
* Map a FilingResponseDto in its json data model to a regular FilingResponse object
|
|
28
|
+
* @param resource Where the FilingResponse fields will be set
|
|
29
|
+
* @param body The FilingResponseDto json data model that will be mapped
|
|
30
|
+
*/
|
|
31
|
+
private populateResource;
|
|
18
32
|
private getCompanyOfficerDetails;
|
|
19
33
|
}
|
|
@@ -51,6 +51,49 @@ class default_1 {
|
|
|
51
51
|
return { httpStatusCode: resp.status, resource: resp.body };
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Post an officer filing object to update on the API.
|
|
56
|
+
*/
|
|
57
|
+
postOfficerFiling(transactionId, officerFiling) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
const url = `/transactions/${transactionId}/officers`;
|
|
60
|
+
const officerFilingResource = this.mapToDto(officerFiling);
|
|
61
|
+
const resp = yield this.client.httpPost(url, officerFilingResource);
|
|
62
|
+
if (resp.error) {
|
|
63
|
+
return {
|
|
64
|
+
httpStatusCode: resp.status,
|
|
65
|
+
errors: [resp.error]
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
const resource = {
|
|
69
|
+
httpStatusCode: resp.status
|
|
70
|
+
};
|
|
71
|
+
const body = resp.body;
|
|
72
|
+
this.populateResource(resource, body);
|
|
73
|
+
return resource;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Map an OfficerFiling object to an OfficerFilingDto which represents the expected json data model
|
|
78
|
+
*/
|
|
79
|
+
mapToDto(officerFiling) {
|
|
80
|
+
return {
|
|
81
|
+
reference_appointment_id: officerFiling.referenceAppointmentId,
|
|
82
|
+
reference_etag: officerFiling.referenceEtag,
|
|
83
|
+
resigned_on: officerFiling.resignedOn
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Map a FilingResponseDto in its json data model to a regular FilingResponse object
|
|
88
|
+
* @param resource Where the FilingResponse fields will be set
|
|
89
|
+
* @param body The FilingResponseDto json data model that will be mapped
|
|
90
|
+
*/
|
|
91
|
+
populateResource(resource, body) {
|
|
92
|
+
resource.resource = {
|
|
93
|
+
submissionId: body.submission_id,
|
|
94
|
+
name: body.name
|
|
95
|
+
};
|
|
96
|
+
}
|
|
54
97
|
getCompanyOfficerDetails(url) {
|
|
55
98
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
99
|
const resp = yield this.client.httpGet(url);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/services/officer-filing/service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/services/officer-filing/service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAUA,oEAA4C;AAE5C;IACI,YAA8B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAI,CAAC;IAEzC,4BAA4B,CAAE,aAAqB;;YAC5D,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,mCAAmC,CAAC,aAAa,CAAC,2BAA2B,CAAC;YAClG,OAAO,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC;QAC9C,CAAC;KAAA;IAEO,mCAAmC,CAAE,aAAqB;QAC9D,OAAO,iBAAiB,aAAa,WAAW,CAAC;IACrD,CAAC;IAEO,kDAAkD,CAAE,aAAqB,EAAE,YAAoB;QACnG,OAAO,iBAAiB,aAAa,aAAa,YAAY,GAAG,CAAC;IACtE,CAAC;IAED;;;;;MAKE;IACW,6BAA6B,CAAE,aAAqB,EAAE,YAAoB;;YACnF,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,kDAAkD,CAAC,aAAa,EAAE,YAAY,CAAC,uCAAuC,CAAC;YAC3I,OAAO,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC;QAC9C,CAAC;KAAA;IAEY,2BAA2B,CAAE,aAAqB;;YAC3D,MAAM,GAAG,GAAG,2BAA2B,aAAa,0CAA0C,CAAC;YAC/F,MAAM,IAAI,GAAiB,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAE1D,IAAI,IAAI,CAAC,MAAM,IAAI,GAAG,EAAE;gBACpB,OAAO,EAAE,cAAc,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,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AAI,GAAiB,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAE1D,IAAI,IAAI,CAAC,MAAM,IAAI,GAAG,EAAE;gBACpB,OAAO,EAAE,cAAc,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;aAChE;YAED,MAAM,QAAQ,GAA+B,EAAE,cAAc,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;YAE7E,MAAM,IAAI,GAAG,IAAI,CAAC,IAAgC,CAAC;YAEnD,QAAQ,CAAC,QAAQ,GAAG,iBAAO,CAAC,aAAa,CAAmB,IAAI,CAAC,CAAC;YAElE,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;CACJ;AAnGD,4BAmGC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
* CompanyOfficerResource is what is returned from the api.
|
|
3
|
+
*/
|
|
4
4
|
export interface CompanyOfficerResource {
|
|
5
5
|
address: AddressResource;
|
|
6
6
|
appointed_on: string;
|
|
@@ -43,6 +43,7 @@ export interface IdentificationResource {
|
|
|
43
43
|
registration_number?: string;
|
|
44
44
|
}
|
|
45
45
|
export interface CompanyOfficerResourceLinks {
|
|
46
|
+
self: string;
|
|
46
47
|
officer: OfficerResourceLinks;
|
|
47
48
|
}
|
|
48
49
|
export interface OfficerResourceLinks {
|
|
@@ -51,6 +52,10 @@ export interface OfficerResourceLinks {
|
|
|
51
52
|
/**
|
|
52
53
|
* CompanyOfficers is the interface used within this SDK.
|
|
53
54
|
*/
|
|
55
|
+
export interface OfficerCard {
|
|
56
|
+
removeUrl: string;
|
|
57
|
+
officer: CompanyOfficer;
|
|
58
|
+
}
|
|
54
59
|
export interface CompanyOfficer {
|
|
55
60
|
address: Address;
|
|
56
61
|
appointedOn: string;
|
|
@@ -93,8 +98,34 @@ export interface Identification {
|
|
|
93
98
|
registrationNumber?: string;
|
|
94
99
|
}
|
|
95
100
|
export interface CompanyOfficerLinks {
|
|
101
|
+
self: string;
|
|
96
102
|
officer: OfficerLinks;
|
|
97
103
|
}
|
|
98
104
|
export interface OfficerLinks {
|
|
99
105
|
appointments: string;
|
|
100
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* The response returned when a filing has been sent to the api. The submission ID can be used to refer back to the saved filing.
|
|
109
|
+
*/
|
|
110
|
+
export interface FilingResponse {
|
|
111
|
+
submissionId: string;
|
|
112
|
+
name: string;
|
|
113
|
+
}
|
|
114
|
+
export interface FilingResponseDto {
|
|
115
|
+
submission_id: string;
|
|
116
|
+
name: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* OfficerFiling represents the filing of an officer. It is populated with the necessary information for a filing to be processed.
|
|
120
|
+
* This is used for both post and patch requests.
|
|
121
|
+
*/
|
|
122
|
+
export interface OfficerFiling {
|
|
123
|
+
referenceAppointmentId?: string;
|
|
124
|
+
referenceEtag?: string;
|
|
125
|
+
resignedOn?: string;
|
|
126
|
+
}
|
|
127
|
+
export interface OfficerFilingDto {
|
|
128
|
+
reference_appointment_id?: string;
|
|
129
|
+
reference_etag?: string;
|
|
130
|
+
resigned_on?: string;
|
|
131
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/services/officer-filing/types.ts"],"names":[],"mappings":";AAAA;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/services/officer-filing/types.ts"],"names":[],"mappings":";AAAA;;EAEE"}
|