@companieshouse/api-sdk-node 2.0.275 → 2.0.276
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.
|
@@ -18,17 +18,23 @@ export default class AssociationsService {
|
|
|
18
18
|
* @param includeRemoved - a flag to get a list of companies where status is "removed". Default value: false.
|
|
19
19
|
* @param pageIndex - a page number to be returned. Default value: 0.
|
|
20
20
|
* @param itemsPerPage - a number of items to be returned per page. Default value: 15.
|
|
21
|
-
* @param userId - a unique identifier of a user to check if associated with the company.
|
|
22
21
|
* @returns a promise that resolves to the HTTP response from the server that includes the associations or errors object.
|
|
23
22
|
*/
|
|
24
|
-
getCompanyAssociations(companyNumber: string, includeRemoved?: boolean, pageIndex?: number, itemsPerPage?: number
|
|
23
|
+
getCompanyAssociations(companyNumber: string, includeRemoved?: boolean, pageIndex?: number, itemsPerPage?: number): Promise<Resource<AssociationList | Errors>>;
|
|
25
24
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
25
|
+
* Searches for an association between a user and a company using either the user's email or user ID.
|
|
26
|
+
* Only one of userEmail or userId should be provided.
|
|
27
|
+
* Optionally filter by association status.
|
|
28
|
+
*
|
|
29
|
+
* @param companyNumber - The company number to search associations for.
|
|
30
|
+
* @param userEmail - The user's email address (optional).
|
|
31
|
+
* @param userId - The user's unique identifier (optional).
|
|
32
|
+
* @param associationStatus - Array of association statuses to filter by (optional).
|
|
33
|
+
* Available values: confirmed, awaiting-approval, removed, migrated, unauthorised.
|
|
34
|
+
* Default: confirmed.
|
|
35
|
+
* @returns Promise resolving to the association or errors object.
|
|
30
36
|
*/
|
|
31
|
-
|
|
37
|
+
searchForCompanyAssociation(companyNumber: string, userEmail?: string, userId?: string, associationStatus?: AssociationStatus[]): Promise<Resource<Association | Errors>>;
|
|
32
38
|
/**
|
|
33
39
|
* Initiates an HTTP GET request to retrieve the associations searched based on association status.
|
|
34
40
|
* @param associationStatus - an association status used to filter associations. This parameter is required. Available values: confirmed, awaiting-approval, removed. Default value: confirmed.
|
|
@@ -39,12 +45,19 @@ export default class AssociationsService {
|
|
|
39
45
|
*/
|
|
40
46
|
searchAssociations(associationStatus: AssociationStatus[], pageIndex?: number, itemsPerPage?: number, companyNumber?: string): Promise<Resource<AssociationList | Errors>>;
|
|
41
47
|
/**
|
|
42
|
-
* Creates a new association for a user
|
|
43
|
-
* @param companyNumber -
|
|
44
|
-
* @param
|
|
45
|
-
* @returns
|
|
48
|
+
* Creates a new association for a user with provided userId.
|
|
49
|
+
* @param companyNumber - The company number for the new association.
|
|
50
|
+
* @param userId - The user's unique identifier.
|
|
51
|
+
* @returns A promise resolving to the new association's link or errors object.
|
|
46
52
|
*/
|
|
47
|
-
createAssociation(companyNumber: string,
|
|
53
|
+
createAssociation(companyNumber: string, userId: string): Promise<Resource<NewAssociationResponse | Errors>>;
|
|
54
|
+
/**
|
|
55
|
+
* Invites a user with the provided email address to a company.
|
|
56
|
+
* @param companyNumber - The company number.
|
|
57
|
+
* @param inviteeEmailAddress - The email address of the user to invite.
|
|
58
|
+
* @returns A promise resolving to the new association's link or errors object.
|
|
59
|
+
*/
|
|
60
|
+
inviteUser(companyNumber: string, inviteeEmailAddress: string): Promise<Resource<NewAssociationResponse | Errors>>;
|
|
48
61
|
/**
|
|
49
62
|
* Returns an association data for the association with the provided association identifier.
|
|
50
63
|
* @param associationId - an identifier of the association for which data has to be returned.
|
|
@@ -30,18 +30,16 @@ class AssociationsService {
|
|
|
30
30
|
* @param includeRemoved - a flag to get a list of companies where status is "removed". Default value: false.
|
|
31
31
|
* @param pageIndex - a page number to be returned. Default value: 0.
|
|
32
32
|
* @param itemsPerPage - a number of items to be returned per page. Default value: 15.
|
|
33
|
-
* @param userId - a unique identifier of a user to check if associated with the company.
|
|
34
33
|
* @returns a promise that resolves to the HTTP response from the server that includes the associations or errors object.
|
|
35
34
|
*/
|
|
36
|
-
getCompanyAssociations(companyNumber, includeRemoved, pageIndex, itemsPerPage
|
|
35
|
+
getCompanyAssociations(companyNumber, includeRemoved, pageIndex, itemsPerPage) {
|
|
37
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
37
|
let queryString = "";
|
|
39
|
-
if (includeRemoved || pageIndex || itemsPerPage
|
|
38
|
+
if (includeRemoved || pageIndex || itemsPerPage) {
|
|
40
39
|
const queryParameters = {
|
|
41
40
|
include_removed: includeRemoved || undefined,
|
|
42
41
|
page_index: pageIndex || undefined,
|
|
43
|
-
items_per_page: itemsPerPage || undefined
|
|
44
|
-
user_id: userId || undefined
|
|
42
|
+
items_per_page: itemsPerPage || undefined
|
|
45
43
|
};
|
|
46
44
|
queryString = this.getQueryString(queryParameters);
|
|
47
45
|
}
|
|
@@ -51,15 +49,28 @@ class AssociationsService {
|
|
|
51
49
|
});
|
|
52
50
|
}
|
|
53
51
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
52
|
+
* Searches for an association between a user and a company using either the user's email or user ID.
|
|
53
|
+
* Only one of userEmail or userId should be provided.
|
|
54
|
+
* Optionally filter by association status.
|
|
55
|
+
*
|
|
56
|
+
* @param companyNumber - The company number to search associations for.
|
|
57
|
+
* @param userEmail - The user's email address (optional).
|
|
58
|
+
* @param userId - The user's unique identifier (optional).
|
|
59
|
+
* @param associationStatus - Array of association statuses to filter by (optional).
|
|
60
|
+
* Available values: confirmed, awaiting-approval, removed, migrated, unauthorised.
|
|
61
|
+
* Default: confirmed.
|
|
62
|
+
* @returns Promise resolving to the association or errors object.
|
|
58
63
|
*/
|
|
59
|
-
|
|
64
|
+
searchForCompanyAssociation(companyNumber, userEmail, userId, associationStatus) {
|
|
60
65
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
const url = `/associations/companies/${companyNumber}`;
|
|
62
|
-
const body = {
|
|
66
|
+
const url = `/associations/companies/${companyNumber}/search`;
|
|
67
|
+
const body = {};
|
|
68
|
+
if (userEmail)
|
|
69
|
+
body.user_email = userEmail;
|
|
70
|
+
if (userId)
|
|
71
|
+
body.user_id = userId;
|
|
72
|
+
if (associationStatus)
|
|
73
|
+
body.status = associationStatus;
|
|
63
74
|
const response = yield this.client.httpPost(url, body);
|
|
64
75
|
return this.getResource(response);
|
|
65
76
|
});
|
|
@@ -87,17 +98,29 @@ class AssociationsService {
|
|
|
87
98
|
});
|
|
88
99
|
}
|
|
89
100
|
/**
|
|
90
|
-
* Creates a new association for a user
|
|
91
|
-
* @param companyNumber -
|
|
92
|
-
* @param
|
|
93
|
-
* @returns
|
|
101
|
+
* Creates a new association for a user with provided userId.
|
|
102
|
+
* @param companyNumber - The company number for the new association.
|
|
103
|
+
* @param userId - The user's unique identifier.
|
|
104
|
+
* @returns A promise resolving to the new association's link or errors object.
|
|
105
|
+
*/
|
|
106
|
+
createAssociation(companyNumber, userId) {
|
|
107
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
const url = "/associations";
|
|
109
|
+
const body = { company_number: companyNumber, user_id: userId };
|
|
110
|
+
const response = yield this.client.httpPost(url, body);
|
|
111
|
+
return this.getResource(response);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Invites a user with the provided email address to a company.
|
|
116
|
+
* @param companyNumber - The company number.
|
|
117
|
+
* @param inviteeEmailAddress - The email address of the user to invite.
|
|
118
|
+
* @returns A promise resolving to the new association's link or errors object.
|
|
94
119
|
*/
|
|
95
|
-
|
|
120
|
+
inviteUser(companyNumber, inviteeEmailAddress) {
|
|
96
121
|
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
-
const url =
|
|
98
|
-
const body = inviteeEmailAddress
|
|
99
|
-
? { company_number: companyNumber, invitee_email_id: inviteeEmailAddress }
|
|
100
|
-
: { company_number: companyNumber };
|
|
122
|
+
const url = "/associations/invitations";
|
|
123
|
+
const body = { company_number: companyNumber, invitee_email_id: inviteeEmailAddress };
|
|
101
124
|
const response = yield this.client.httpPost(url, body);
|
|
102
125
|
return this.getResource(response);
|
|
103
126
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/services/associations/service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/services/associations/service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAcA,oEAA4C;AAE5C;;GAEG;AACH,MAAqB,mBAAmB;IAGpC;;;OAGG;IACH,YAA8B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAI,CAAC;IAEtD;;;;;;;OAOG;IACU,sBAAsB,CAC/B,aAAqB,EACrB,cAAwB,EACxB,SAAkB,EAClB,YAAqB;;YAErB,IAAI,WAAW,GAAW,EAAE,CAAC;YAC7B,IAAI,cAAc,IAAI,SAAS,IAAI,YAAY,EAAE;gBAC7C,MAAM,eAAe,GAAoB;oBACrC,eAAe,EAAE,cAAc,IAAI,SAAS;oBAC5C,UAAU,EAAE,SAAS,IAAI,SAAS;oBAClC,cAAc,EAAE,YAAY,IAAI,SAAS;iBAC5C,CAAC;gBACF,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;aACtD;YAED,MAAM,GAAG,GAAG,2BAA2B,aAAa,GAAG,WAAW,EAAE,CAAC;YACrE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAEhD,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAuC,CAAC;QAC5E,CAAC;KAAA;IAED;;;;;;;;;;;;OAYG;IACU,2BAA2B,CACpC,aAAqB,EACrB,SAAkB,EAClB,MAAe,EACf,iBAAuC;;YAEvC,MAAM,GAAG,GAAG,2BAA2B,aAAa,SAAS,CAAC;YAE9D,MAAM,IAAI,GAAwC,EAAE,CAAC;YACrD,IAAI,SAAS;gBAAE,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;YAC3C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AAO,CAAC,aAAa,CAAuB,QAAQ,CAAC,IAAI,CAAC,CAAC;QAE/E,OAAO,QAAQ,CAAC;IACpB,CAAC;;AAlSL,sCAmSC;AAlS2B,0BAAM,GAAG,QAAQ,CAAC"}
|
|
@@ -186,3 +186,8 @@ export interface NewAssociationResponse {
|
|
|
186
186
|
associationLink: string;
|
|
187
187
|
}
|
|
188
188
|
export declare type AssociationsResponse = AssociationList | Association | NewAssociationResponse | Errors;
|
|
189
|
+
export interface SearchForCompanyAssociationPostBody {
|
|
190
|
+
user_email?: string;
|
|
191
|
+
user_id?: string;
|
|
192
|
+
status?: AssociationStatus[];
|
|
193
|
+
}
|