@ogcio/building-blocks-sdk 0.1.17 → 0.2.0
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/.gitleaksignore +2 -0
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +18 -0
- package/dist/client/clients/featureFlags/schema.d.ts +205 -63
- package/dist/client/clients/featureFlags/schema.d.ts.map +1 -1
- package/dist/client/clients/messaging/index.d.ts +2 -1835
- package/dist/client/clients/messaging/index.d.ts.map +1 -1
- package/dist/client/clients/messaging/index.js +3 -179
- package/dist/client/clients/messaging/index.js.map +1 -1
- package/dist/client/clients/messaging/schema.d.ts +2763 -2750
- package/dist/client/clients/messaging/schema.d.ts.map +1 -1
- package/dist/client/clients/payments/index.d.ts +240 -1
- package/dist/client/clients/payments/index.d.ts.map +1 -1
- package/dist/client/clients/payments/index.js +23 -0
- package/dist/client/clients/payments/index.js.map +1 -1
- package/dist/client/clients/payments/schema.d.ts +256 -1
- package/dist/client/clients/payments/schema.d.ts.map +1 -1
- package/dist/client/clients/profile/index.d.ts +852 -440
- package/dist/client/clients/profile/index.d.ts.map +1 -1
- package/dist/client/clients/profile/index.js +88 -54
- package/dist/client/clients/profile/index.js.map +1 -1
- package/dist/client/clients/profile/schema.d.ts +1237 -1114
- package/dist/client/clients/profile/schema.d.ts.map +1 -1
- package/dist/clients-configurations/clients-configuration.json +5 -4
- package/package.json +1 -1
- package/src/client/clients/featureFlags/open-api-definition.json +184 -95
- package/src/client/clients/featureFlags/schema.ts +205 -63
- package/src/client/clients/messaging/index.ts +2 -278
- package/src/client/clients/messaging/open-api-definition.json +30 -18
- package/src/client/clients/messaging/schema.ts +2763 -2750
- package/src/client/clients/payments/index.ts +37 -0
- package/src/client/clients/payments/open-api-definition.json +773 -185
- package/src/client/clients/payments/schema.ts +256 -1
- package/src/client/clients/profile/index.ts +140 -84
- package/src/client/clients/profile/open-api-definition.json +1825 -1323
- package/src/client/clients/profile/schema.ts +1237 -1114
- package/src/clients-configurations/clients-configuration.json +5 -4
|
@@ -1238,7 +1238,7 @@ export interface paths {
|
|
|
1238
1238
|
content: {
|
|
1239
1239
|
"application/json": {
|
|
1240
1240
|
data: {
|
|
1241
|
-
amount?:
|
|
1241
|
+
amount?: string;
|
|
1242
1242
|
runId: string;
|
|
1243
1243
|
journeyId: string;
|
|
1244
1244
|
redirectUrl: string;
|
|
@@ -1473,6 +1473,7 @@ export interface paths {
|
|
|
1473
1473
|
journeyId?: string;
|
|
1474
1474
|
journeyTitle?: string;
|
|
1475
1475
|
redirectUrl?: string;
|
|
1476
|
+
amount?: string;
|
|
1476
1477
|
};
|
|
1477
1478
|
description: string;
|
|
1478
1479
|
providerName: string;
|
|
@@ -1718,6 +1719,7 @@ export interface paths {
|
|
|
1718
1719
|
journeyId?: string;
|
|
1719
1720
|
journeyTitle?: string;
|
|
1720
1721
|
redirectUrl?: string;
|
|
1722
|
+
amount?: string;
|
|
1721
1723
|
};
|
|
1722
1724
|
description: string;
|
|
1723
1725
|
providerName: string;
|
|
@@ -1831,7 +1833,9 @@ export interface paths {
|
|
|
1831
1833
|
journeyId?: string;
|
|
1832
1834
|
journeyTitle?: string;
|
|
1833
1835
|
redirectUrl?: string;
|
|
1836
|
+
amount?: string;
|
|
1834
1837
|
};
|
|
1838
|
+
token?: string;
|
|
1835
1839
|
};
|
|
1836
1840
|
};
|
|
1837
1841
|
};
|
|
@@ -2294,6 +2298,237 @@ export interface paths {
|
|
|
2294
2298
|
patch?: never;
|
|
2295
2299
|
trace?: never;
|
|
2296
2300
|
};
|
|
2301
|
+
"/api/v1/transactions/{transactionId}/refund": {
|
|
2302
|
+
parameters: {
|
|
2303
|
+
query?: never;
|
|
2304
|
+
header?: never;
|
|
2305
|
+
path?: never;
|
|
2306
|
+
cookie?: never;
|
|
2307
|
+
};
|
|
2308
|
+
get: {
|
|
2309
|
+
parameters: {
|
|
2310
|
+
query?: never;
|
|
2311
|
+
header?: never;
|
|
2312
|
+
path: {
|
|
2313
|
+
transactionId: string;
|
|
2314
|
+
};
|
|
2315
|
+
cookie?: never;
|
|
2316
|
+
};
|
|
2317
|
+
requestBody?: never;
|
|
2318
|
+
responses: {
|
|
2319
|
+
/** @description Default Response */
|
|
2320
|
+
200: {
|
|
2321
|
+
headers: {
|
|
2322
|
+
[name: string]: unknown;
|
|
2323
|
+
};
|
|
2324
|
+
content: {
|
|
2325
|
+
"application/json": {
|
|
2326
|
+
data: {
|
|
2327
|
+
id: string;
|
|
2328
|
+
transactionId: string;
|
|
2329
|
+
amount: number;
|
|
2330
|
+
status: "pending" | "succeeded" | "failed" | "requires_action" | "canceled";
|
|
2331
|
+
type: "full" | "partial";
|
|
2332
|
+
reason: string;
|
|
2333
|
+
notes?: string;
|
|
2334
|
+
createdAt: string;
|
|
2335
|
+
updatedAt: string;
|
|
2336
|
+
username: string;
|
|
2337
|
+
email: string;
|
|
2338
|
+
organizationId: string;
|
|
2339
|
+
};
|
|
2340
|
+
metadata?: {
|
|
2341
|
+
/** @description Object containing the links to the related endpoints */
|
|
2342
|
+
links?: {
|
|
2343
|
+
self: {
|
|
2344
|
+
/** @description URL pointing to the request itself */
|
|
2345
|
+
href?: string;
|
|
2346
|
+
};
|
|
2347
|
+
next?: {
|
|
2348
|
+
/** @description URL pointing to the next page of results in a paginated response. If there are no more results, this field may be omitted */
|
|
2349
|
+
href?: string;
|
|
2350
|
+
};
|
|
2351
|
+
prev?: {
|
|
2352
|
+
/** @description URL pointing to the previous page of results in a paginated response. If there are no more results, this field may be omitted */
|
|
2353
|
+
href?: string;
|
|
2354
|
+
};
|
|
2355
|
+
first: {
|
|
2356
|
+
/** @description URL pointing to the first page of results in a paginated response */
|
|
2357
|
+
href?: string;
|
|
2358
|
+
};
|
|
2359
|
+
last: {
|
|
2360
|
+
/** @description URL pointing to the first page of results in a paginated response */
|
|
2361
|
+
href?: string;
|
|
2362
|
+
};
|
|
2363
|
+
/** @description It may contain a list of other useful URLs, e.g. one entry for page:'page 1', 'page 2' */
|
|
2364
|
+
pages: {
|
|
2365
|
+
[key: string]: {
|
|
2366
|
+
href?: string;
|
|
2367
|
+
};
|
|
2368
|
+
};
|
|
2369
|
+
};
|
|
2370
|
+
/** @description Number representing the total number of available items */
|
|
2371
|
+
totalCount?: number;
|
|
2372
|
+
};
|
|
2373
|
+
};
|
|
2374
|
+
};
|
|
2375
|
+
};
|
|
2376
|
+
/** @description Default Response */
|
|
2377
|
+
401: {
|
|
2378
|
+
headers: {
|
|
2379
|
+
[name: string]: unknown;
|
|
2380
|
+
};
|
|
2381
|
+
content: {
|
|
2382
|
+
"application/json": {
|
|
2383
|
+
code: string;
|
|
2384
|
+
detail: string;
|
|
2385
|
+
requestId: string;
|
|
2386
|
+
name: string;
|
|
2387
|
+
validation?: unknown;
|
|
2388
|
+
validationContext?: string;
|
|
2389
|
+
};
|
|
2390
|
+
};
|
|
2391
|
+
};
|
|
2392
|
+
/** @description Default Response */
|
|
2393
|
+
404: {
|
|
2394
|
+
headers: {
|
|
2395
|
+
[name: string]: unknown;
|
|
2396
|
+
};
|
|
2397
|
+
content: {
|
|
2398
|
+
"application/json": {
|
|
2399
|
+
code: string;
|
|
2400
|
+
detail: string;
|
|
2401
|
+
requestId: string;
|
|
2402
|
+
name: string;
|
|
2403
|
+
validation?: unknown;
|
|
2404
|
+
validationContext?: string;
|
|
2405
|
+
};
|
|
2406
|
+
};
|
|
2407
|
+
};
|
|
2408
|
+
/** @description Default Response */
|
|
2409
|
+
500: {
|
|
2410
|
+
headers: {
|
|
2411
|
+
[name: string]: unknown;
|
|
2412
|
+
};
|
|
2413
|
+
content: {
|
|
2414
|
+
"application/json": {
|
|
2415
|
+
code: string;
|
|
2416
|
+
detail: string;
|
|
2417
|
+
requestId: string;
|
|
2418
|
+
name: string;
|
|
2419
|
+
validation?: unknown;
|
|
2420
|
+
validationContext?: string;
|
|
2421
|
+
};
|
|
2422
|
+
};
|
|
2423
|
+
};
|
|
2424
|
+
};
|
|
2425
|
+
};
|
|
2426
|
+
put?: never;
|
|
2427
|
+
post: {
|
|
2428
|
+
parameters: {
|
|
2429
|
+
query?: never;
|
|
2430
|
+
header?: never;
|
|
2431
|
+
path: {
|
|
2432
|
+
transactionId: string;
|
|
2433
|
+
};
|
|
2434
|
+
cookie?: never;
|
|
2435
|
+
};
|
|
2436
|
+
requestBody: {
|
|
2437
|
+
content: {
|
|
2438
|
+
"application/json": {
|
|
2439
|
+
amount: number;
|
|
2440
|
+
reason: string;
|
|
2441
|
+
notes?: string;
|
|
2442
|
+
};
|
|
2443
|
+
};
|
|
2444
|
+
};
|
|
2445
|
+
responses: {
|
|
2446
|
+
/** @description Default Response */
|
|
2447
|
+
200: {
|
|
2448
|
+
headers: {
|
|
2449
|
+
[name: string]: unknown;
|
|
2450
|
+
};
|
|
2451
|
+
content: {
|
|
2452
|
+
"application/json": {
|
|
2453
|
+
data: {
|
|
2454
|
+
status: string;
|
|
2455
|
+
};
|
|
2456
|
+
metadata?: {
|
|
2457
|
+
/** @description Object containing the links to the related endpoints */
|
|
2458
|
+
links?: {
|
|
2459
|
+
self: {
|
|
2460
|
+
/** @description URL pointing to the request itself */
|
|
2461
|
+
href?: string;
|
|
2462
|
+
};
|
|
2463
|
+
next?: {
|
|
2464
|
+
/** @description URL pointing to the next page of results in a paginated response. If there are no more results, this field may be omitted */
|
|
2465
|
+
href?: string;
|
|
2466
|
+
};
|
|
2467
|
+
prev?: {
|
|
2468
|
+
/** @description URL pointing to the previous page of results in a paginated response. If there are no more results, this field may be omitted */
|
|
2469
|
+
href?: string;
|
|
2470
|
+
};
|
|
2471
|
+
first: {
|
|
2472
|
+
/** @description URL pointing to the first page of results in a paginated response */
|
|
2473
|
+
href?: string;
|
|
2474
|
+
};
|
|
2475
|
+
last: {
|
|
2476
|
+
/** @description URL pointing to the first page of results in a paginated response */
|
|
2477
|
+
href?: string;
|
|
2478
|
+
};
|
|
2479
|
+
/** @description It may contain a list of other useful URLs, e.g. one entry for page:'page 1', 'page 2' */
|
|
2480
|
+
pages: {
|
|
2481
|
+
[key: string]: {
|
|
2482
|
+
href?: string;
|
|
2483
|
+
};
|
|
2484
|
+
};
|
|
2485
|
+
};
|
|
2486
|
+
/** @description Number representing the total number of available items */
|
|
2487
|
+
totalCount?: number;
|
|
2488
|
+
};
|
|
2489
|
+
};
|
|
2490
|
+
};
|
|
2491
|
+
};
|
|
2492
|
+
/** @description Default Response */
|
|
2493
|
+
401: {
|
|
2494
|
+
headers: {
|
|
2495
|
+
[name: string]: unknown;
|
|
2496
|
+
};
|
|
2497
|
+
content: {
|
|
2498
|
+
"application/json": {
|
|
2499
|
+
code: string;
|
|
2500
|
+
detail: string;
|
|
2501
|
+
requestId: string;
|
|
2502
|
+
name: string;
|
|
2503
|
+
validation?: unknown;
|
|
2504
|
+
validationContext?: string;
|
|
2505
|
+
};
|
|
2506
|
+
};
|
|
2507
|
+
};
|
|
2508
|
+
/** @description Default Response */
|
|
2509
|
+
500: {
|
|
2510
|
+
headers: {
|
|
2511
|
+
[name: string]: unknown;
|
|
2512
|
+
};
|
|
2513
|
+
content: {
|
|
2514
|
+
"application/json": {
|
|
2515
|
+
code: string;
|
|
2516
|
+
detail: string;
|
|
2517
|
+
requestId: string;
|
|
2518
|
+
name: string;
|
|
2519
|
+
validation?: unknown;
|
|
2520
|
+
validationContext?: string;
|
|
2521
|
+
};
|
|
2522
|
+
};
|
|
2523
|
+
};
|
|
2524
|
+
};
|
|
2525
|
+
};
|
|
2526
|
+
delete?: never;
|
|
2527
|
+
options?: never;
|
|
2528
|
+
head?: never;
|
|
2529
|
+
patch?: never;
|
|
2530
|
+
trace?: never;
|
|
2531
|
+
};
|
|
2297
2532
|
"/api/v1/citizen/transactions": {
|
|
2298
2533
|
parameters: {
|
|
2299
2534
|
query?: never;
|
|
@@ -2461,6 +2696,7 @@ export interface paths {
|
|
|
2461
2696
|
journeyId?: string;
|
|
2462
2697
|
journeyTitle?: string;
|
|
2463
2698
|
redirectUrl?: string;
|
|
2699
|
+
amount?: string;
|
|
2464
2700
|
};
|
|
2465
2701
|
description: string;
|
|
2466
2702
|
providerName: string;
|
|
@@ -2542,6 +2778,8 @@ export interface paths {
|
|
|
2542
2778
|
amount: string;
|
|
2543
2779
|
intentId: string;
|
|
2544
2780
|
providerId: string;
|
|
2781
|
+
paymentRequestId: string;
|
|
2782
|
+
token?: string;
|
|
2545
2783
|
};
|
|
2546
2784
|
header?: never;
|
|
2547
2785
|
path?: never;
|
|
@@ -3125,6 +3363,7 @@ export interface paths {
|
|
|
3125
3363
|
"application/json": {
|
|
3126
3364
|
paymentRequestId: string;
|
|
3127
3365
|
amount: number;
|
|
3366
|
+
token?: string;
|
|
3128
3367
|
};
|
|
3129
3368
|
};
|
|
3130
3369
|
};
|
|
@@ -3177,6 +3416,22 @@ export interface paths {
|
|
|
3177
3416
|
};
|
|
3178
3417
|
};
|
|
3179
3418
|
/** @description Default Response */
|
|
3419
|
+
400: {
|
|
3420
|
+
headers: {
|
|
3421
|
+
[name: string]: unknown;
|
|
3422
|
+
};
|
|
3423
|
+
content: {
|
|
3424
|
+
"application/json": {
|
|
3425
|
+
code: string;
|
|
3426
|
+
detail: string;
|
|
3427
|
+
requestId: string;
|
|
3428
|
+
name: string;
|
|
3429
|
+
validation?: unknown;
|
|
3430
|
+
validationContext?: string;
|
|
3431
|
+
};
|
|
3432
|
+
};
|
|
3433
|
+
};
|
|
3434
|
+
/** @description Default Response */
|
|
3180
3435
|
401: {
|
|
3181
3436
|
headers: {
|
|
3182
3437
|
[name: string]: unknown;
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
+
import createError from "http-errors";
|
|
1
2
|
import type createClient from "openapi-fetch";
|
|
2
3
|
import { PROFILE } from "../../../types/index.js";
|
|
3
4
|
import { BaseClient } from "../../base-client.js";
|
|
4
5
|
import { formatError, formatResponse } from "../../utils/client-utils.js";
|
|
5
6
|
import type { paths } from "./schema.js";
|
|
6
|
-
|
|
7
7
|
export class Profile extends BaseClient<paths> {
|
|
8
8
|
protected declare client: ReturnType<typeof createClient<paths>>;
|
|
9
9
|
protected serviceName = PROFILE;
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
);
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Use getProfile() instead of getUser()
|
|
13
|
+
*/
|
|
14
|
+
async getUser(profileId: string) {
|
|
15
|
+
console.warn("Warning: getUser() is deprecated. Use getProfile() instead.");
|
|
16
|
+
return this.getProfile(profileId);
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
async
|
|
19
|
+
async getProfile(profileId: string) {
|
|
19
20
|
return this.client
|
|
20
|
-
.GET("/api/v1/
|
|
21
|
-
params: { path: {
|
|
21
|
+
.GET("/api/v1/profiles/{profileId}", {
|
|
22
|
+
params: { path: { profileId } },
|
|
22
23
|
})
|
|
23
24
|
.then(
|
|
24
25
|
(response) => formatResponse(response, this.serviceName, this.logger),
|
|
@@ -26,31 +27,27 @@ export class Profile extends BaseClient<paths> {
|
|
|
26
27
|
);
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated Use getProfile() instead of getUser()
|
|
32
|
+
*/
|
|
33
|
+
async createUser(
|
|
34
|
+
data: NonNullable<
|
|
35
|
+
paths["/api/v1/profiles/import-profiles"]["post"]["requestBody"]
|
|
36
|
+
>["content"]["application/json"],
|
|
31
37
|
) {
|
|
32
|
-
|
|
33
|
-
.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
.then(
|
|
37
|
-
(response) => formatResponse(response, this.serviceName, this.logger),
|
|
38
|
-
(reason) => formatError(reason, this.serviceName, this.logger),
|
|
39
|
-
);
|
|
38
|
+
console.warn(
|
|
39
|
+
"Warning: createUser() is deprecated. Use createProfile() instead.",
|
|
40
|
+
);
|
|
41
|
+
return this.createProfile(data);
|
|
40
42
|
}
|
|
41
43
|
|
|
42
|
-
async
|
|
43
|
-
addressId: string,
|
|
44
|
+
async createProfile(
|
|
44
45
|
data: NonNullable<
|
|
45
|
-
paths["/api/v1/
|
|
46
|
+
paths["/api/v1/profiles/import-profiles"]["post"]["requestBody"]
|
|
46
47
|
>["content"]["application/json"],
|
|
47
48
|
) {
|
|
48
|
-
if (!data || Object.keys(data).length === 0) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
49
|
return this.client
|
|
52
|
-
.
|
|
53
|
-
params: { path: { addressId } },
|
|
50
|
+
.POST("/api/v1/profiles/import-profiles", {
|
|
54
51
|
body: data,
|
|
55
52
|
})
|
|
56
53
|
.then(
|
|
@@ -59,25 +56,33 @@ export class Profile extends BaseClient<paths> {
|
|
|
59
56
|
);
|
|
60
57
|
}
|
|
61
58
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated Use getProfile() instead of getUser()
|
|
61
|
+
*/
|
|
62
|
+
async updateUser(
|
|
63
|
+
profileId: string,
|
|
64
|
+
data: NonNullable<
|
|
65
|
+
paths["/api/v1/profiles/{profileId}"]["put"]["requestBody"]
|
|
66
|
+
>["content"]["application/json"],
|
|
67
|
+
organizationId?: string,
|
|
65
68
|
) {
|
|
66
|
-
|
|
67
|
-
.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
})
|
|
71
|
-
.then(
|
|
72
|
-
(response) => formatResponse(response, this.serviceName, this.logger),
|
|
73
|
-
(reason) => formatError(reason, this.serviceName, this.logger),
|
|
74
|
-
);
|
|
69
|
+
console.warn(
|
|
70
|
+
"Warning: updateUser() is deprecated. Use updateProfile() instead.",
|
|
71
|
+
);
|
|
72
|
+
return this.updateProfile(profileId, data, organizationId);
|
|
75
73
|
}
|
|
76
74
|
|
|
77
|
-
async
|
|
75
|
+
async updateProfile(
|
|
76
|
+
profileId: string,
|
|
77
|
+
data: NonNullable<
|
|
78
|
+
paths["/api/v1/profiles/{profileId}"]["put"]["requestBody"]
|
|
79
|
+
>["content"]["application/json"],
|
|
80
|
+
organizationId?: string,
|
|
81
|
+
) {
|
|
78
82
|
return this.client
|
|
79
|
-
.
|
|
80
|
-
params: { path: {
|
|
83
|
+
.PUT("/api/v1/profiles/{profileId}", {
|
|
84
|
+
params: { path: { profileId }, query: { organizationId } },
|
|
85
|
+
body: data,
|
|
81
86
|
})
|
|
82
87
|
.then(
|
|
83
88
|
(response) => formatResponse(response, this.serviceName, this.logger),
|
|
@@ -85,17 +90,36 @@ export class Profile extends BaseClient<paths> {
|
|
|
85
90
|
);
|
|
86
91
|
}
|
|
87
92
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
/**
|
|
94
|
+
* @deprecated Use getProfile() instead of getUser()
|
|
95
|
+
*/
|
|
96
|
+
async patchUser(
|
|
97
|
+
profileId: string,
|
|
98
|
+
data: NonNullable<
|
|
99
|
+
paths["/api/v1/profiles/{profileId}"]["put"]["requestBody"]
|
|
100
|
+
>["content"]["application/json"],
|
|
101
|
+
organizationId?: string,
|
|
102
|
+
) {
|
|
103
|
+
console.warn(
|
|
104
|
+
"Warning: patchUser() is deprecated. Use patchProfile() instead.",
|
|
92
105
|
);
|
|
106
|
+
return this.patchProfile(profileId, data, organizationId);
|
|
93
107
|
}
|
|
94
108
|
|
|
95
|
-
async
|
|
109
|
+
async patchProfile(
|
|
110
|
+
profileId: string,
|
|
111
|
+
data?: NonNullable<
|
|
112
|
+
paths["/api/v1/profiles/{profileId}"]["patch"]["requestBody"]
|
|
113
|
+
>["content"]["application/json"],
|
|
114
|
+
organizationId?: string,
|
|
115
|
+
) {
|
|
116
|
+
if (!data || Object.keys(data).length === 0) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
96
119
|
return this.client
|
|
97
|
-
.
|
|
98
|
-
params: { path: {
|
|
120
|
+
.PATCH("/api/v1/profiles/{profileId}", {
|
|
121
|
+
params: { path: { profileId }, query: { organizationId } },
|
|
122
|
+
body: data,
|
|
99
123
|
})
|
|
100
124
|
.then(
|
|
101
125
|
(response) => formatResponse(response, this.serviceName, this.logger),
|
|
@@ -103,27 +127,26 @@ export class Profile extends BaseClient<paths> {
|
|
|
103
127
|
);
|
|
104
128
|
}
|
|
105
129
|
|
|
106
|
-
|
|
107
|
-
|
|
130
|
+
/**
|
|
131
|
+
* @deprecated Use getProfile() instead of getUser()
|
|
132
|
+
*/
|
|
133
|
+
async findUser(
|
|
134
|
+
query: paths["/api/v1/profiles/find-profile"]["get"]["parameters"]["query"],
|
|
108
135
|
) {
|
|
109
|
-
|
|
110
|
-
.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
.then(
|
|
114
|
-
(response) => formatResponse(response, this.serviceName, this.logger),
|
|
115
|
-
(reason) => formatError(reason, this.serviceName, this.logger),
|
|
116
|
-
);
|
|
136
|
+
console.warn(
|
|
137
|
+
"Warning: findUser() is deprecated. Use findProfile() instead.",
|
|
138
|
+
);
|
|
139
|
+
return this.findProfile(query);
|
|
117
140
|
}
|
|
118
141
|
|
|
119
|
-
async
|
|
120
|
-
|
|
121
|
-
data: paths["/api/v1/users/{userId}"]["put"]["requestBody"]["content"]["application/json"],
|
|
142
|
+
async findProfile(
|
|
143
|
+
query: paths["/api/v1/profiles/find-profile"]["get"]["parameters"]["query"],
|
|
122
144
|
) {
|
|
123
145
|
return this.client
|
|
124
|
-
.
|
|
125
|
-
params: {
|
|
126
|
-
|
|
146
|
+
.GET("/api/v1/profiles/find-profile", {
|
|
147
|
+
params: {
|
|
148
|
+
query,
|
|
149
|
+
},
|
|
127
150
|
})
|
|
128
151
|
.then(
|
|
129
152
|
(response) => formatResponse(response, this.serviceName, this.logger),
|
|
@@ -131,19 +154,28 @@ export class Profile extends BaseClient<paths> {
|
|
|
131
154
|
);
|
|
132
155
|
}
|
|
133
156
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
157
|
+
/**
|
|
158
|
+
* @deprecated Use getProfile() instead of getUser()
|
|
159
|
+
*/
|
|
160
|
+
async selectUsers(
|
|
161
|
+
ids: paths["/api/v1/profiles/select-profiles"]["get"]["parameters"]["query"]["ids"],
|
|
162
|
+
) {
|
|
163
|
+
console.warn(
|
|
164
|
+
"Warning: selectUsers() is deprecated. Use selectProfiles() instead.",
|
|
165
|
+
);
|
|
166
|
+
return this.selectProfiles(ids);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
async selectProfiles(
|
|
170
|
+
ids: paths["/api/v1/profiles/select-profiles"]["get"]["parameters"]["query"]["ids"],
|
|
139
171
|
) {
|
|
140
|
-
if (!data || Object.keys(data).length === 0) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
172
|
return this.client
|
|
144
|
-
.
|
|
145
|
-
params: {
|
|
146
|
-
|
|
173
|
+
.GET("/api/v1/profiles/select-profiles", {
|
|
174
|
+
params: {
|
|
175
|
+
query: {
|
|
176
|
+
ids,
|
|
177
|
+
},
|
|
178
|
+
},
|
|
147
179
|
})
|
|
148
180
|
.then(
|
|
149
181
|
(response) => formatResponse(response, this.serviceName, this.logger),
|
|
@@ -151,11 +183,11 @@ export class Profile extends BaseClient<paths> {
|
|
|
151
183
|
);
|
|
152
184
|
}
|
|
153
185
|
|
|
154
|
-
async
|
|
155
|
-
query: paths["/api/v1/
|
|
186
|
+
async listProfiles(
|
|
187
|
+
query: paths["/api/v1/profiles/"]["get"]["parameters"]["query"],
|
|
156
188
|
) {
|
|
157
189
|
return this.client
|
|
158
|
-
.GET("/api/v1/
|
|
190
|
+
.GET("/api/v1/profiles/", {
|
|
159
191
|
params: {
|
|
160
192
|
query,
|
|
161
193
|
},
|
|
@@ -166,12 +198,36 @@ export class Profile extends BaseClient<paths> {
|
|
|
166
198
|
);
|
|
167
199
|
}
|
|
168
200
|
|
|
169
|
-
async
|
|
170
|
-
|
|
171
|
-
|
|
201
|
+
async importProfiles(toImport: {
|
|
202
|
+
file?: File;
|
|
203
|
+
records?: NonNullable<
|
|
204
|
+
paths["/api/v1/profiles/import-profiles"]["post"]["requestBody"]
|
|
205
|
+
>["content"]["application/json"]["profiles"];
|
|
206
|
+
}) {
|
|
207
|
+
if (toImport.file) {
|
|
208
|
+
const { data, error } = await this.client.POST(
|
|
209
|
+
"/api/v1/profiles/import-profiles",
|
|
210
|
+
{
|
|
211
|
+
body: {
|
|
212
|
+
file: toImport.file,
|
|
213
|
+
},
|
|
214
|
+
bodySerializer: (body: unknown) => {
|
|
215
|
+
const parsed = body as { file?: File } | undefined;
|
|
216
|
+
if (!parsed || !parsed.file) {
|
|
217
|
+
throw createError.BadRequest("File is missing!");
|
|
218
|
+
}
|
|
219
|
+
const formData = new FormData();
|
|
220
|
+
formData.set("file", parsed.file);
|
|
221
|
+
return formData;
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
);
|
|
225
|
+
return { data, error };
|
|
226
|
+
}
|
|
227
|
+
|
|
172
228
|
return this.client
|
|
173
|
-
.POST("/api/v1/
|
|
174
|
-
body: {
|
|
229
|
+
.POST("/api/v1/profiles/import-profiles", {
|
|
230
|
+
body: { profiles: toImport.records },
|
|
175
231
|
})
|
|
176
232
|
.then(
|
|
177
233
|
(response) => formatResponse(response, this.serviceName, this.logger),
|