@ogcio/building-blocks-sdk 0.1.18 → 0.2.1
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 +109 -1960
- 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 +1689 -3486
- package/dist/client/clients/messaging/schema.d.ts.map +1 -1
- package/dist/client/clients/payments/index.d.ts +93 -7
- package/dist/client/clients/payments/index.d.ts.map +1 -1
- package/dist/client/clients/payments/index.js +11 -0
- package/dist/client/clients/payments/index.js.map +1 -1
- package/dist/client/clients/payments/schema.d.ts +113 -7
- package/dist/client/clients/payments/schema.d.ts.map +1 -1
- package/dist/client/clients/profile/index.d.ts +882 -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 +1257 -1114
- package/dist/client/clients/profile/schema.d.ts.map +1 -1
- package/dist/clients-configurations/clients-configuration.json +7 -6
- 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 +419 -4558
- package/src/client/clients/messaging/schema.ts +1689 -3486
- package/src/client/clients/payments/index.ts +17 -0
- package/src/client/clients/payments/open-api-definition.json +314 -0
- package/src/client/clients/payments/schema.ts +113 -7
- package/src/client/clients/profile/index.ts +140 -84
- package/src/client/clients/profile/open-api-definition.json +1925 -1343
- package/src/client/clients/profile/schema.ts +1257 -1114
- package/src/clients-configurations/clients-configuration.json +7 -6
|
@@ -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),
|