@ogcio/building-blocks-sdk 0.2.1 → 0.2.3
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/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +14 -0
- package/dist/client/clients/journey/index.d.ts.map +1 -1
- package/dist/client/clients/journey/index.js +12 -1
- package/dist/client/clients/journey/index.js.map +1 -1
- package/dist/client/clients/messaging/index.d.ts +7 -0
- package/dist/client/clients/messaging/index.d.ts.map +1 -1
- package/dist/client/clients/messaging/index.js +19 -2
- package/dist/client/clients/messaging/index.js.map +1 -1
- package/dist/client/clients/messaging/schema.d.ts +10 -1
- package/dist/client/clients/messaging/schema.d.ts.map +1 -1
- package/dist/client/clients/payments/index.d.ts.map +1 -1
- package/dist/client/clients/payments/index.js +16 -1
- package/dist/client/clients/payments/index.js.map +1 -1
- package/dist/client/clients/profile/index.d.ts.map +1 -1
- package/dist/client/clients/profile/index.js +7 -1
- package/dist/client/clients/profile/index.js.map +1 -1
- package/dist/client/clients/upload/index.d.ts.map +1 -1
- package/dist/client/clients/upload/index.js +10 -1
- package/dist/client/clients/upload/index.js.map +1 -1
- package/dist/client/utils/client-utils.d.ts +1 -0
- package/dist/client/utils/client-utils.d.ts.map +1 -1
- package/dist/client/utils/client-utils.js +5 -0
- package/dist/client/utils/client-utils.js.map +1 -1
- package/package.json +1 -1
- package/src/client/clients/journey/index.ts +16 -1
- package/src/client/clients/messaging/index.ts +26 -3
- package/src/client/clients/messaging/open-api-definition.json +27 -1
- package/src/client/clients/messaging/schema.ts +10 -1
- package/src/client/clients/payments/index.ts +20 -1
- package/src/client/clients/profile/index.ts +13 -1
- package/src/client/clients/upload/index.ts +14 -1
- package/src/client/utils/client-utils.ts +6 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UPLOAD } from "../../../types/index.js";
|
|
2
2
|
import { BaseClient } from "../../base-client.js";
|
|
3
|
-
import { formatError, formatResponse } from "../../utils/client-utils.js";
|
|
3
|
+
import { formatError, formatResponse, throwIfEmpty, } from "../../utils/client-utils.js";
|
|
4
4
|
export class Upload extends BaseClient {
|
|
5
5
|
serviceName = UPLOAD;
|
|
6
6
|
getFilesMetadata({ organizationId, userId, }) {
|
|
@@ -16,6 +16,7 @@ export class Upload extends BaseClient {
|
|
|
16
16
|
.then((response) => formatResponse(response, this.serviceName, this.logger), (reason) => formatError(reason, this.serviceName, this.logger));
|
|
17
17
|
}
|
|
18
18
|
async getFile(id) {
|
|
19
|
+
throwIfEmpty(id);
|
|
19
20
|
try {
|
|
20
21
|
const { error, data, response: { headers, status }, } = await this.client.GET("/api/v1/files/{id}", {
|
|
21
22
|
params: { path: { id } },
|
|
@@ -38,6 +39,7 @@ export class Upload extends BaseClient {
|
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
getSharedFilesForUser(userId, organizationId) {
|
|
42
|
+
throwIfEmpty(userId);
|
|
41
43
|
return this.client
|
|
42
44
|
.GET("/api/v1/metadata/", {
|
|
43
45
|
params: { query: { userId, organizationId } },
|
|
@@ -45,6 +47,7 @@ export class Upload extends BaseClient {
|
|
|
45
47
|
.then((response) => formatResponse(response, this.serviceName, this.logger), (reason) => formatError(reason, this.serviceName, this.logger));
|
|
46
48
|
}
|
|
47
49
|
getFileMetadata(id, organizationId) {
|
|
50
|
+
throwIfEmpty(id);
|
|
48
51
|
return this.client
|
|
49
52
|
.GET("/api/v1/metadata/{id}", {
|
|
50
53
|
params: { path: { id, organizationId } },
|
|
@@ -52,6 +55,7 @@ export class Upload extends BaseClient {
|
|
|
52
55
|
.then((response) => formatResponse(response, this.serviceName, this.logger), (reason) => formatError(reason, this.serviceName, this.logger));
|
|
53
56
|
}
|
|
54
57
|
scheduleFileDeletion(id) {
|
|
58
|
+
throwIfEmpty(id);
|
|
55
59
|
return this.client
|
|
56
60
|
.DELETE("/api/v1/metadata/", {
|
|
57
61
|
body: { fileId: id },
|
|
@@ -59,6 +63,7 @@ export class Upload extends BaseClient {
|
|
|
59
63
|
.then((response) => formatResponse(response, this.serviceName, this.logger), (reason) => formatError(reason, this.serviceName, this.logger));
|
|
60
64
|
}
|
|
61
65
|
getFileSharings(id) {
|
|
66
|
+
throwIfEmpty(id);
|
|
62
67
|
return this.client
|
|
63
68
|
.GET("/api/v1/permissions/", {
|
|
64
69
|
params: {
|
|
@@ -70,6 +75,8 @@ export class Upload extends BaseClient {
|
|
|
70
75
|
.then((response) => formatResponse(response, this.serviceName, this.logger), (reason) => formatError(reason, this.serviceName, this.logger));
|
|
71
76
|
}
|
|
72
77
|
shareFile(fileId, userId) {
|
|
78
|
+
throwIfEmpty(fileId);
|
|
79
|
+
throwIfEmpty(userId);
|
|
73
80
|
return this.client
|
|
74
81
|
.POST("/api/v1/permissions/", {
|
|
75
82
|
body: { fileId, userId },
|
|
@@ -77,6 +84,8 @@ export class Upload extends BaseClient {
|
|
|
77
84
|
.then((response) => formatResponse(response, this.serviceName, this.logger), (reason) => formatError(reason, this.serviceName, this.logger));
|
|
78
85
|
}
|
|
79
86
|
removeFileSharing(fileId, userId) {
|
|
87
|
+
throwIfEmpty(userId);
|
|
88
|
+
throwIfEmpty(fileId);
|
|
80
89
|
return this.client
|
|
81
90
|
.DELETE("/api/v1/permissions/", {
|
|
82
91
|
body: { fileId, userId },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/clients/upload/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/clients/upload/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACL,WAAW,EACX,cAAc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AAC,sBAAsB,EAAE;YAC9B,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;SACzB,CAAC;aACD,IAAI,CACH,CAAC,QAAQ,EAAE,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,EACrE,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,CAC/D,CAAC;IACN,CAAC;IAED,KAAK,CAAC,UAAU,CACd,IAAU,EACV,cAAuB;QAYvB,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE;YAC/D,IAAI,EAAE;gBACJ,IAAI;gBACJ,cAAc;aACf;YAED,cAAc,EAAE,CAAC,IAAa,EAAE,EAAE;gBAChC,MAAM,OAAO,GAAG,IAA8C,CAAC;gBAC/D,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;gBAChC,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;oBAC3B,QAAQ,CAAC,GAAG,CAAC,gBAAgB,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;gBACzD,CAAC;gBACD,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;gBACnC,OAAO,QAAQ,CAAC;YAClB,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC;IACtD,CAAC;CACF"}
|
|
@@ -20,4 +20,5 @@ export declare function parseJwtToken(token: string): {
|
|
|
20
20
|
payload: Record<string, unknown>;
|
|
21
21
|
};
|
|
22
22
|
export declare function getNumberValueFromObject(object: Record<string, unknown>, key: string): number;
|
|
23
|
+
export declare function throwIfEmpty(input: string): void;
|
|
23
24
|
//# sourceMappingURL=client-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-utils.d.ts","sourceRoot":"","sources":["../../../src/client/utils/client-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,QAAQ,EACR,eAAe,EACf,iBAAiB,EAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEnD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,iBAAiB,CAAC,CAAC,EAAE,CAAC,IAAI,eAAe,CACnD,UAAU,CACR,eAAe,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,EAC3D,kBAAkB,CACnB,EACD,CAAC,CACF,GAAG;IACF,KAAK,EAAE,eAAe,CACpB,UAAU,CACR,eAAe,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,EAC9D,kBAAkB,CACnB,EACD,CAAC,CACF,CAAC;CACH,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,sBAEzE;AAED,wBAAgB,uBAAuB,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,GAAG;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAYA;AAGD,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC,EACtE,QAAQ,EAAE,aAAa,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I,CAIhD"}
|
|
@@ -74,4 +74,9 @@ export function getNumberValueFromObject(object, key) {
|
|
|
74
74
|
}
|
|
75
75
|
return Number(value);
|
|
76
76
|
}
|
|
77
|
+
export function throwIfEmpty(input) {
|
|
78
|
+
if (!input || input.length === 0) {
|
|
79
|
+
throw Error("Parameter cannot be an empty string!");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
77
82
|
//# sourceMappingURL=client-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-utils.js","sourceRoot":"","sources":["../../../src/client/utils/client-utils.ts"],"names":[],"mappings":"AA+BA,MAAM,UAAU,mBAAmB,CAAC,QAAsC;IACxE,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,gBAAmC;IAIzE,MAAM,MAAM,GAAwC,EAAE,CAAC;IAEvD,IAAI,gBAAgB,EAAE,MAAM,EAAE,CAAC;QAC7B,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAClD,CAAC;IAED,IAAI,gBAAgB,EAAE,KAAK,EAAE,CAAC;QAC5B,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,cAAc,CAC5B,QAAiD,EACjD,WAAmB,EACnB,MAAe;IAEf,IAAI,UAAU,GAAG,SAAS,CAAC;IAC3B,IAAI,cAAc,GAAG,SAAS,CAAC;IAE/B,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,EAAE,KAAK,CAAC,GAAG,WAAW,uBAAuB,CAAC,CAAC;QACrD,OAAO,EAA6B,CAAC;IACvC,CAAC;IAED,MAAM,EAAE,KAAK,CAAC,E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AAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;SACnE,CAAC;IACJ,CAAC;IAAC,OAAO,IAAI,EAAE,CAAC;QACd,MAAM,oBAAoB,CAAC;IAC7B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,MAA+B,EAC/B,GAAW;IAEX,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1B,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACxD,CAAC;IAED,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,kBAAkB,KAAK,YAAY,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjC,MAAM,KAAK,CAAC,sCAAsC,CAAC,CAAC;IACtD,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type createClient from "openapi-fetch";
|
|
2
2
|
import { JOURNEY } from "../../../types/index.js";
|
|
3
3
|
import { BaseClient } from "../../base-client.js";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
formatError,
|
|
6
|
+
formatResponse,
|
|
7
|
+
throwIfEmpty,
|
|
8
|
+
} from "../../utils/client-utils.js";
|
|
5
9
|
import type { paths } from "./schema.js";
|
|
6
10
|
|
|
7
11
|
export class Journey extends BaseClient<paths> {
|
|
@@ -14,6 +18,7 @@ export class Journey extends BaseClient<paths> {
|
|
|
14
18
|
async getConnectionById(
|
|
15
19
|
connectionId: paths["/api/v1/journey_step_connections/{connectionId}"]["get"]["parameters"]["path"]["connectionId"],
|
|
16
20
|
) {
|
|
21
|
+
throwIfEmpty(connectionId);
|
|
17
22
|
return this.client
|
|
18
23
|
.GET("/api/v1/journey_step_connections/{connectionId}", {
|
|
19
24
|
params: {
|
|
@@ -44,6 +49,7 @@ export class Journey extends BaseClient<paths> {
|
|
|
44
49
|
async deleteConnection(
|
|
45
50
|
connectionId: paths["/api/v1/journey_step_connections/{connectionId}"]["delete"]["parameters"]["path"]["connectionId"],
|
|
46
51
|
) {
|
|
52
|
+
throwIfEmpty(connectionId);
|
|
47
53
|
return this.client
|
|
48
54
|
.DELETE("/api/v1/journey_step_connections/{connectionId}", {
|
|
49
55
|
params: {
|
|
@@ -64,6 +70,7 @@ export class Journey extends BaseClient<paths> {
|
|
|
64
70
|
async getStepById(
|
|
65
71
|
stepId: paths["/api/v1/journey_steps/{stepId}"]["get"]["parameters"]["path"]["stepId"],
|
|
66
72
|
) {
|
|
73
|
+
throwIfEmpty(stepId);
|
|
67
74
|
return this.client
|
|
68
75
|
.GET("/api/v1/journey_steps/{stepId}", {
|
|
69
76
|
params: {
|
|
@@ -94,6 +101,7 @@ export class Journey extends BaseClient<paths> {
|
|
|
94
101
|
async deleteStep(
|
|
95
102
|
stepId: paths["/api/v1/journey_steps/{stepId}"]["delete"]["parameters"]["path"]["stepId"],
|
|
96
103
|
) {
|
|
104
|
+
throwIfEmpty(stepId);
|
|
97
105
|
return this.client
|
|
98
106
|
.DELETE("/api/v1/journey_steps/{stepId}", {
|
|
99
107
|
params: {
|
|
@@ -112,6 +120,7 @@ export class Journey extends BaseClient<paths> {
|
|
|
112
120
|
stepId: paths["/api/v1/journey_steps/{stepId}"]["put"]["parameters"]["path"]["stepId"],
|
|
113
121
|
data: paths["/api/v1/journey_steps/{stepId}"]["put"]["requestBody"]["content"]["application/json"],
|
|
114
122
|
) {
|
|
123
|
+
throwIfEmpty(stepId);
|
|
115
124
|
return this.client
|
|
116
125
|
.PUT("/api/v1/journey_steps/{stepId}", {
|
|
117
126
|
params: {
|
|
@@ -133,6 +142,7 @@ export class Journey extends BaseClient<paths> {
|
|
|
133
142
|
async getJourneyPublicInfo(
|
|
134
143
|
journeyId: paths["/api/v1/journeys/{journeyId}/public-info"]["get"]["parameters"]["path"]["journeyId"],
|
|
135
144
|
) {
|
|
145
|
+
throwIfEmpty(journeyId);
|
|
136
146
|
return this.client
|
|
137
147
|
.GET("/api/v1/journeys/{journeyId}/public-info", {
|
|
138
148
|
params: {
|
|
@@ -150,6 +160,7 @@ export class Journey extends BaseClient<paths> {
|
|
|
150
160
|
async getJourneyById(
|
|
151
161
|
journeyId: paths["/api/v1/journeys/{journeyId}"]["get"]["parameters"]["path"]["journeyId"],
|
|
152
162
|
) {
|
|
163
|
+
throwIfEmpty(journeyId);
|
|
153
164
|
return this.client
|
|
154
165
|
.GET("/api/v1/journeys/{journeyId}", {
|
|
155
166
|
params: {
|
|
@@ -196,6 +207,7 @@ export class Journey extends BaseClient<paths> {
|
|
|
196
207
|
journeyId: paths["/api/v1/journeys/{journeyId}"]["put"]["parameters"]["path"]["journeyId"],
|
|
197
208
|
data: paths["/api/v1/journeys/{journeyId}"]["put"]["requestBody"]["content"]["application/json"],
|
|
198
209
|
) {
|
|
210
|
+
throwIfEmpty(journeyId);
|
|
199
211
|
return this.client
|
|
200
212
|
.PUT("/api/v1/journeys/{journeyId}", {
|
|
201
213
|
params: {
|
|
@@ -216,6 +228,7 @@ export class Journey extends BaseClient<paths> {
|
|
|
216
228
|
async getUserRunById(
|
|
217
229
|
runId: paths["/api/v1/executor/runs/self/{runId}"]["get"]["parameters"]["path"]["runId"],
|
|
218
230
|
) {
|
|
231
|
+
throwIfEmpty(runId);
|
|
219
232
|
return this.client
|
|
220
233
|
.GET("/api/v1/executor/runs/self/{runId}", {
|
|
221
234
|
params: {
|
|
@@ -240,6 +253,7 @@ export class Journey extends BaseClient<paths> {
|
|
|
240
253
|
async getRunsByJourneyId(
|
|
241
254
|
journeyId: paths["/api/v1/executor/runs/journeys/{journeyId}"]["get"]["parameters"]["path"]["journeyId"],
|
|
242
255
|
) {
|
|
256
|
+
throwIfEmpty(journeyId);
|
|
243
257
|
return this.client
|
|
244
258
|
.GET("/api/v1/executor/runs/journeys/{journeyId}", {
|
|
245
259
|
params: {
|
|
@@ -257,6 +271,7 @@ export class Journey extends BaseClient<paths> {
|
|
|
257
271
|
async getRunById(
|
|
258
272
|
runId: paths["/api/v1/executor/runs/{runId}"]["get"]["parameters"]["path"]["runId"],
|
|
259
273
|
) {
|
|
274
|
+
throwIfEmpty(runId);
|
|
260
275
|
return this.client
|
|
261
276
|
.GET("/api/v1/executor/runs/{runId}", {
|
|
262
277
|
params: {
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
formatError,
|
|
8
8
|
formatResponse,
|
|
9
9
|
preparePaginationParams,
|
|
10
|
-
|
|
10
|
+
throwIfEmpty,
|
|
11
11
|
} from "../../utils/client-utils.js";
|
|
12
12
|
import type { paths } from "./schema.js";
|
|
13
13
|
|
|
@@ -22,6 +22,7 @@ export class Messaging extends BaseClient<paths> {
|
|
|
22
22
|
search?: string;
|
|
23
23
|
} & PaginationParams,
|
|
24
24
|
) {
|
|
25
|
+
throwIfEmpty(userId);
|
|
25
26
|
const isSeen =
|
|
26
27
|
filter?.isSeen === undefined
|
|
27
28
|
? undefined
|
|
@@ -50,6 +51,7 @@ export class Messaging extends BaseClient<paths> {
|
|
|
50
51
|
organisationId: string,
|
|
51
52
|
filter?: PaginationParams,
|
|
52
53
|
) {
|
|
54
|
+
throwIfEmpty(organisationId);
|
|
53
55
|
return this.client
|
|
54
56
|
.GET("/api/v1/messages/", {
|
|
55
57
|
params: {
|
|
@@ -68,6 +70,7 @@ export class Messaging extends BaseClient<paths> {
|
|
|
68
70
|
async getMessage(
|
|
69
71
|
messageId: paths["/api/v1/messages/{messageId}"]["get"]["parameters"]["path"]["messageId"],
|
|
70
72
|
) {
|
|
73
|
+
throwIfEmpty(messageId);
|
|
71
74
|
return this.client
|
|
72
75
|
.GET("/api/v1/messages/{messageId}", {
|
|
73
76
|
params: { path: { messageId } },
|
|
@@ -109,6 +112,7 @@ export class Messaging extends BaseClient<paths> {
|
|
|
109
112
|
async getTemplate(
|
|
110
113
|
templateId: paths["/api/v1/templates/{templateId}"]["get"]["parameters"]["path"]["templateId"],
|
|
111
114
|
) {
|
|
115
|
+
throwIfEmpty(templateId);
|
|
112
116
|
return this.client
|
|
113
117
|
.GET("/api/v1/templates/{templateId}", {
|
|
114
118
|
params: {
|
|
@@ -205,6 +209,7 @@ export class Messaging extends BaseClient<paths> {
|
|
|
205
209
|
templateId: paths["/api/v1/templates/{templateId}"]["put"]["parameters"]["path"]["templateId"],
|
|
206
210
|
body: paths["/api/v1/templates/{templateId}"]["put"]["requestBody"]["content"]["application/json"],
|
|
207
211
|
) {
|
|
212
|
+
throwIfEmpty(templateId);
|
|
208
213
|
return this.client
|
|
209
214
|
.PUT("/api/v1/templates/{templateId}", {
|
|
210
215
|
params: { path: { templateId } },
|
|
@@ -219,6 +224,7 @@ export class Messaging extends BaseClient<paths> {
|
|
|
219
224
|
async deleteTemplate(
|
|
220
225
|
templateId: paths["/api/v1/templates/{templateId}"]["delete"]["parameters"]["path"]["templateId"],
|
|
221
226
|
) {
|
|
227
|
+
throwIfEmpty(templateId);
|
|
222
228
|
return this.client
|
|
223
229
|
.DELETE("/api/v1/templates/{templateId}", {
|
|
224
230
|
params: { path: { templateId } },
|
|
@@ -261,6 +267,7 @@ export class Messaging extends BaseClient<paths> {
|
|
|
261
267
|
}
|
|
262
268
|
|
|
263
269
|
async getEmailProvider(providerId: string) {
|
|
270
|
+
throwIfEmpty(providerId);
|
|
264
271
|
const { data, error } = await this.client.GET(
|
|
265
272
|
"/api/v1/providers/{providerId}",
|
|
266
273
|
{
|
|
@@ -311,6 +318,7 @@ export class Messaging extends BaseClient<paths> {
|
|
|
311
318
|
fromAddress: string;
|
|
312
319
|
ssl: boolean;
|
|
313
320
|
}) {
|
|
321
|
+
throwIfEmpty(provider.id);
|
|
314
322
|
return this.client
|
|
315
323
|
.PUT("/api/v1/providers/{providerId}", {
|
|
316
324
|
params: { path: { providerId: provider.id } },
|
|
@@ -326,6 +334,7 @@ export class Messaging extends BaseClient<paths> {
|
|
|
326
334
|
}
|
|
327
335
|
|
|
328
336
|
async deleteEmailProvider(providerId: string) {
|
|
337
|
+
throwIfEmpty(providerId);
|
|
329
338
|
return this.client
|
|
330
339
|
.DELETE("/api/v1/providers/{providerId}", {
|
|
331
340
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
@@ -337,11 +346,22 @@ export class Messaging extends BaseClient<paths> {
|
|
|
337
346
|
);
|
|
338
347
|
}
|
|
339
348
|
|
|
340
|
-
async getMessageEvents(
|
|
349
|
+
async getMessageEvents(
|
|
350
|
+
params: {
|
|
351
|
+
search?: string;
|
|
352
|
+
dateFrom?: string;
|
|
353
|
+
dateTo?: string;
|
|
354
|
+
} & PaginationParams,
|
|
355
|
+
) {
|
|
341
356
|
return this.client
|
|
342
357
|
.GET("/api/v1/message-events/", {
|
|
343
358
|
params: {
|
|
344
|
-
query: {
|
|
359
|
+
query: {
|
|
360
|
+
search: params.search,
|
|
361
|
+
dateFrom: params.dateFrom,
|
|
362
|
+
dateTo: params.dateTo,
|
|
363
|
+
...preparePaginationParams(params),
|
|
364
|
+
},
|
|
345
365
|
},
|
|
346
366
|
})
|
|
347
367
|
.then(
|
|
@@ -351,6 +371,7 @@ export class Messaging extends BaseClient<paths> {
|
|
|
351
371
|
}
|
|
352
372
|
|
|
353
373
|
async getMessageEvent(eventId: string) {
|
|
374
|
+
throwIfEmpty(eventId);
|
|
354
375
|
return this.client
|
|
355
376
|
.GET("/api/v1/message-events/{eventId}", {
|
|
356
377
|
params: { path: { eventId } },
|
|
@@ -362,6 +383,7 @@ export class Messaging extends BaseClient<paths> {
|
|
|
362
383
|
}
|
|
363
384
|
|
|
364
385
|
async seeMessage(messageId: string) {
|
|
386
|
+
throwIfEmpty(messageId);
|
|
365
387
|
return this.client
|
|
366
388
|
.PUT("/api/v1/message-actions/{messageId}", {
|
|
367
389
|
params: {
|
|
@@ -381,6 +403,7 @@ export class Messaging extends BaseClient<paths> {
|
|
|
381
403
|
}
|
|
382
404
|
|
|
383
405
|
async unseeMessage(messageId: string) {
|
|
406
|
+
throwIfEmpty(messageId);
|
|
384
407
|
return this.client
|
|
385
408
|
.PUT("/api/v1/message-actions/{messageId}", {
|
|
386
409
|
params: {
|
|
@@ -4009,7 +4009,27 @@
|
|
|
4009
4009
|
"in": "query",
|
|
4010
4010
|
"name": "search",
|
|
4011
4011
|
"required": false,
|
|
4012
|
-
"description": "If set, it filters the events for the messages containing the
|
|
4012
|
+
"description": "If set, it filters the events for the messages containing the searched value in the subject or recipients of the message"
|
|
4013
|
+
},
|
|
4014
|
+
{
|
|
4015
|
+
"schema": {
|
|
4016
|
+
"format": "date",
|
|
4017
|
+
"type": "string"
|
|
4018
|
+
},
|
|
4019
|
+
"in": "query",
|
|
4020
|
+
"name": "dateFrom",
|
|
4021
|
+
"required": false,
|
|
4022
|
+
"description": "If set, it filters the events for the messages created after the set date"
|
|
4023
|
+
},
|
|
4024
|
+
{
|
|
4025
|
+
"schema": {
|
|
4026
|
+
"format": "date",
|
|
4027
|
+
"type": "string"
|
|
4028
|
+
},
|
|
4029
|
+
"in": "query",
|
|
4030
|
+
"name": "dateTo",
|
|
4031
|
+
"required": false,
|
|
4032
|
+
"description": "If set, it filters the events for the messages created before the set date"
|
|
4013
4033
|
},
|
|
4014
4034
|
{
|
|
4015
4035
|
"schema": {
|
|
@@ -4328,6 +4348,11 @@
|
|
|
4328
4348
|
"items": {
|
|
4329
4349
|
"type": "object",
|
|
4330
4350
|
"properties": {
|
|
4351
|
+
"messageId": {
|
|
4352
|
+
"format": "uuid",
|
|
4353
|
+
"description": "Message id",
|
|
4354
|
+
"type": "string"
|
|
4355
|
+
},
|
|
4331
4356
|
"eventType": {
|
|
4332
4357
|
"description": "Event type description",
|
|
4333
4358
|
"type": "string"
|
|
@@ -4477,6 +4502,7 @@
|
|
|
4477
4502
|
}
|
|
4478
4503
|
},
|
|
4479
4504
|
"required": [
|
|
4505
|
+
"messageId",
|
|
4480
4506
|
"eventType",
|
|
4481
4507
|
"eventStatus",
|
|
4482
4508
|
"data",
|
|
@@ -251,8 +251,12 @@ export interface paths {
|
|
|
251
251
|
get: {
|
|
252
252
|
parameters: {
|
|
253
253
|
query?: {
|
|
254
|
-
/** @description If set, it filters the events for the messages containing the
|
|
254
|
+
/** @description If set, it filters the events for the messages containing the searched value in the subject or recipients of the message */
|
|
255
255
|
search?: string;
|
|
256
|
+
/** @description If set, it filters the events for the messages created after the set date */
|
|
257
|
+
dateFrom?: string;
|
|
258
|
+
/** @description If set, it filters the events for the messages created before the set date */
|
|
259
|
+
dateTo?: string;
|
|
256
260
|
/** @description Indicates where to start fetching data or how many records to skip, defining the initial position within the list */
|
|
257
261
|
offset?: string;
|
|
258
262
|
/** @description Indicates the maximum number (100) of items that will be returned in a single request */
|
|
@@ -416,6 +420,11 @@ export interface paths {
|
|
|
416
420
|
content: {
|
|
417
421
|
"application/json": {
|
|
418
422
|
data: {
|
|
423
|
+
/**
|
|
424
|
+
* Format: uuid
|
|
425
|
+
* @description Message id
|
|
426
|
+
*/
|
|
427
|
+
messageId: string;
|
|
419
428
|
/** @description Event type description */
|
|
420
429
|
eventType: string;
|
|
421
430
|
/** @description Status for event type */
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type createClient from "openapi-fetch";
|
|
2
2
|
import { PAYMENTS } from "../../../types/index.js";
|
|
3
3
|
import { BaseClient } from "../../base-client.js";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
formatError,
|
|
6
|
+
formatResponse,
|
|
7
|
+
throwIfEmpty,
|
|
8
|
+
} from "../../utils/client-utils.js";
|
|
5
9
|
import type { paths } from "./schema.js";
|
|
6
10
|
|
|
7
11
|
export class Payments extends BaseClient<paths> {
|
|
@@ -21,6 +25,7 @@ export class Payments extends BaseClient<paths> {
|
|
|
21
25
|
async getProviderById(
|
|
22
26
|
providerId: paths["/api/v1/providers/{providerId}"]["get"]["parameters"]["path"]["providerId"],
|
|
23
27
|
) {
|
|
28
|
+
throwIfEmpty(providerId);
|
|
24
29
|
return this.client
|
|
25
30
|
.GET("/api/v1/providers/{providerId}", {
|
|
26
31
|
params: {
|
|
@@ -52,6 +57,7 @@ export class Payments extends BaseClient<paths> {
|
|
|
52
57
|
providerId: paths["/api/v1/providers/{providerId}"]["put"]["parameters"]["path"]["providerId"],
|
|
53
58
|
data: paths["/api/v1/providers/{providerId}"]["put"]["requestBody"]["content"]["application/json"],
|
|
54
59
|
) {
|
|
60
|
+
throwIfEmpty(providerId);
|
|
55
61
|
return this.client
|
|
56
62
|
.PUT("/api/v1/providers/{providerId}", {
|
|
57
63
|
params: {
|
|
@@ -104,6 +110,7 @@ export class Payments extends BaseClient<paths> {
|
|
|
104
110
|
async getPaymentRequest(
|
|
105
111
|
requestId: paths["/api/v1/requests/{requestId}"]["get"]["parameters"]["path"]["requestId"],
|
|
106
112
|
) {
|
|
113
|
+
throwIfEmpty(requestId);
|
|
107
114
|
return this.client
|
|
108
115
|
.GET("/api/v1/requests/{requestId}", {
|
|
109
116
|
params: {
|
|
@@ -122,6 +129,7 @@ export class Payments extends BaseClient<paths> {
|
|
|
122
129
|
requestId: paths["/api/v1/requests/{requestId}/transactions"]["get"]["parameters"]["path"]["requestId"],
|
|
123
130
|
query: paths["/api/v1/requests/{requestId}/transactions"]["get"]["parameters"]["query"],
|
|
124
131
|
) {
|
|
132
|
+
throwIfEmpty(requestId);
|
|
125
133
|
return this.client
|
|
126
134
|
.GET("/api/v1/requests/{requestId}/transactions", {
|
|
127
135
|
params: {
|
|
@@ -153,6 +161,7 @@ export class Payments extends BaseClient<paths> {
|
|
|
153
161
|
async getPaymentRequestPublicInfo(
|
|
154
162
|
requestId: paths["/api/v1/requests/{requestId}/public-info"]["get"]["parameters"]["path"]["requestId"],
|
|
155
163
|
) {
|
|
164
|
+
throwIfEmpty(requestId);
|
|
156
165
|
return this.client
|
|
157
166
|
.GET("/api/v1/requests/{requestId}/public-info", {
|
|
158
167
|
params: {
|
|
@@ -183,6 +192,7 @@ export class Payments extends BaseClient<paths> {
|
|
|
183
192
|
async deletePaymentRequest(
|
|
184
193
|
requestId: paths["/api/v1/requests/{requestId}"]["delete"]["parameters"]["path"]["requestId"],
|
|
185
194
|
) {
|
|
195
|
+
throwIfEmpty(requestId);
|
|
186
196
|
return this.client
|
|
187
197
|
.DELETE("/api/v1/requests/{requestId}", {
|
|
188
198
|
params: {
|
|
@@ -217,6 +227,7 @@ export class Payments extends BaseClient<paths> {
|
|
|
217
227
|
}
|
|
218
228
|
|
|
219
229
|
async getTransactionDetails(transactionId: string) {
|
|
230
|
+
throwIfEmpty(transactionId);
|
|
220
231
|
return this.client
|
|
221
232
|
.GET("/api/v1/transactions/{transactionId}", {
|
|
222
233
|
params: {
|
|
@@ -232,6 +243,7 @@ export class Payments extends BaseClient<paths> {
|
|
|
232
243
|
}
|
|
233
244
|
|
|
234
245
|
async getTransactionIdByExtPaymentId(extPaymentId: string) {
|
|
246
|
+
throwIfEmpty(extPaymentId);
|
|
235
247
|
return this.client
|
|
236
248
|
.GET("/api/v1/transactions/transactionId/{extPaymentId}", {
|
|
237
249
|
params: {
|
|
@@ -250,6 +262,7 @@ export class Payments extends BaseClient<paths> {
|
|
|
250
262
|
transactionId: paths["/api/v1/transactions/{transactionId}"]["patch"]["parameters"]["path"]["transactionId"],
|
|
251
263
|
data: paths["/api/v1/transactions/{transactionId}"]["patch"]["requestBody"]["content"]["application/json"],
|
|
252
264
|
) {
|
|
265
|
+
throwIfEmpty(transactionId);
|
|
253
266
|
return this.client
|
|
254
267
|
.PATCH("/api/v1/transactions/{transactionId}", {
|
|
255
268
|
params: {
|
|
@@ -317,6 +330,7 @@ export class Payments extends BaseClient<paths> {
|
|
|
317
330
|
transactionId: paths["/api/v1/transactions/{transactionId}/refund"]["post"]["parameters"]["path"]["transactionId"],
|
|
318
331
|
data: paths["/api/v1/transactions/{transactionId}/refund"]["post"]["requestBody"]["content"]["application/json"],
|
|
319
332
|
) {
|
|
333
|
+
throwIfEmpty(transactionId);
|
|
320
334
|
return this.client
|
|
321
335
|
.POST("/api/v1/transactions/{transactionId}/refund", {
|
|
322
336
|
params: {
|
|
@@ -335,6 +349,7 @@ export class Payments extends BaseClient<paths> {
|
|
|
335
349
|
async getRefoundByTransactionId(
|
|
336
350
|
transactionId: paths["/api/v1/transactions/{transactionId}/refund"]["post"]["parameters"]["path"]["transactionId"],
|
|
337
351
|
) {
|
|
352
|
+
throwIfEmpty(transactionId);
|
|
338
353
|
return this.client
|
|
339
354
|
.GET("/api/v1/transactions/{transactionId}/refund", {
|
|
340
355
|
params: {
|
|
@@ -352,6 +367,7 @@ export class Payments extends BaseClient<paths> {
|
|
|
352
367
|
async cancelPayment(
|
|
353
368
|
transactionId: paths["/api/v1/transactions/{transactionId}/cancel-payment"]["post"]["parameters"]["path"]["transactionId"],
|
|
354
369
|
) {
|
|
370
|
+
throwIfEmpty(transactionId);
|
|
355
371
|
return this.client
|
|
356
372
|
.POST("/api/v1/transactions/{transactionId}/cancel-payment", {
|
|
357
373
|
params: {
|
|
@@ -386,6 +402,7 @@ export class Payments extends BaseClient<paths> {
|
|
|
386
402
|
}
|
|
387
403
|
|
|
388
404
|
async getCitizenTransactionDetails(transactionId: string) {
|
|
405
|
+
throwIfEmpty(transactionId);
|
|
389
406
|
return this.client
|
|
390
407
|
.GET("/api/v1/citizen/transactions/{transactionId}", {
|
|
391
408
|
params: {
|
|
@@ -422,6 +439,7 @@ export class Payments extends BaseClient<paths> {
|
|
|
422
439
|
async getAuditLogDetails(
|
|
423
440
|
auditLogId: paths["/api/v1/auditLogs/{auditLogId}"]["get"]["parameters"]["path"]["auditLogId"],
|
|
424
441
|
) {
|
|
442
|
+
throwIfEmpty(auditLogId);
|
|
425
443
|
return this.client
|
|
426
444
|
.GET("/api/v1/auditLogs/{auditLogId}", {
|
|
427
445
|
params: {
|
|
@@ -446,6 +464,7 @@ export class Payments extends BaseClient<paths> {
|
|
|
446
464
|
async getRedirectToken(
|
|
447
465
|
transactionId: paths["/api/v1/transactions/{transactionId}/token"]["get"]["parameters"]["path"]["transactionId"],
|
|
448
466
|
) {
|
|
467
|
+
throwIfEmpty(transactionId);
|
|
449
468
|
return this.client
|
|
450
469
|
.GET("/api/v1/transactions/{transactionId}/token", {
|
|
451
470
|
params: {
|
|
@@ -2,7 +2,11 @@ import createError from "http-errors";
|
|
|
2
2
|
import type createClient from "openapi-fetch";
|
|
3
3
|
import { PROFILE } from "../../../types/index.js";
|
|
4
4
|
import { BaseClient } from "../../base-client.js";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
formatError,
|
|
7
|
+
formatResponse,
|
|
8
|
+
throwIfEmpty,
|
|
9
|
+
} from "../../utils/client-utils.js";
|
|
6
10
|
import type { paths } from "./schema.js";
|
|
7
11
|
export class Profile extends BaseClient<paths> {
|
|
8
12
|
protected declare client: ReturnType<typeof createClient<paths>>;
|
|
@@ -17,6 +21,7 @@ export class Profile extends BaseClient<paths> {
|
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
async getProfile(profileId: string) {
|
|
24
|
+
throwIfEmpty(profileId);
|
|
20
25
|
return this.client
|
|
21
26
|
.GET("/api/v1/profiles/{profileId}", {
|
|
22
27
|
params: { path: { profileId } },
|
|
@@ -79,6 +84,8 @@ export class Profile extends BaseClient<paths> {
|
|
|
79
84
|
>["content"]["application/json"],
|
|
80
85
|
organizationId?: string,
|
|
81
86
|
) {
|
|
87
|
+
throwIfEmpty(profileId);
|
|
88
|
+
|
|
82
89
|
return this.client
|
|
83
90
|
.PUT("/api/v1/profiles/{profileId}", {
|
|
84
91
|
params: { path: { profileId }, query: { organizationId } },
|
|
@@ -113,6 +120,8 @@ export class Profile extends BaseClient<paths> {
|
|
|
113
120
|
>["content"]["application/json"],
|
|
114
121
|
organizationId?: string,
|
|
115
122
|
) {
|
|
123
|
+
throwIfEmpty(profileId);
|
|
124
|
+
|
|
116
125
|
if (!data || Object.keys(data).length === 0) {
|
|
117
126
|
return;
|
|
118
127
|
}
|
|
@@ -169,6 +178,9 @@ export class Profile extends BaseClient<paths> {
|
|
|
169
178
|
async selectProfiles(
|
|
170
179
|
ids: paths["/api/v1/profiles/select-profiles"]["get"]["parameters"]["query"]["ids"],
|
|
171
180
|
) {
|
|
181
|
+
for (const id of ids) {
|
|
182
|
+
throwIfEmpty(id);
|
|
183
|
+
}
|
|
172
184
|
return this.client
|
|
173
185
|
.GET("/api/v1/profiles/select-profiles", {
|
|
174
186
|
params: {
|