@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.
Files changed (37) hide show
  1. package/.gitleaksignore +2 -0
  2. package/.release-please-manifest.json +1 -1
  3. package/CHANGELOG.md +18 -0
  4. package/dist/client/clients/featureFlags/schema.d.ts +205 -63
  5. package/dist/client/clients/featureFlags/schema.d.ts.map +1 -1
  6. package/dist/client/clients/messaging/index.d.ts +109 -1960
  7. package/dist/client/clients/messaging/index.d.ts.map +1 -1
  8. package/dist/client/clients/messaging/index.js +3 -179
  9. package/dist/client/clients/messaging/index.js.map +1 -1
  10. package/dist/client/clients/messaging/schema.d.ts +1689 -3486
  11. package/dist/client/clients/messaging/schema.d.ts.map +1 -1
  12. package/dist/client/clients/payments/index.d.ts +93 -7
  13. package/dist/client/clients/payments/index.d.ts.map +1 -1
  14. package/dist/client/clients/payments/index.js +11 -0
  15. package/dist/client/clients/payments/index.js.map +1 -1
  16. package/dist/client/clients/payments/schema.d.ts +113 -7
  17. package/dist/client/clients/payments/schema.d.ts.map +1 -1
  18. package/dist/client/clients/profile/index.d.ts +882 -440
  19. package/dist/client/clients/profile/index.d.ts.map +1 -1
  20. package/dist/client/clients/profile/index.js +88 -54
  21. package/dist/client/clients/profile/index.js.map +1 -1
  22. package/dist/client/clients/profile/schema.d.ts +1257 -1114
  23. package/dist/client/clients/profile/schema.d.ts.map +1 -1
  24. package/dist/clients-configurations/clients-configuration.json +7 -6
  25. package/package.json +1 -1
  26. package/src/client/clients/featureFlags/open-api-definition.json +184 -95
  27. package/src/client/clients/featureFlags/schema.ts +205 -63
  28. package/src/client/clients/messaging/index.ts +2 -278
  29. package/src/client/clients/messaging/open-api-definition.json +419 -4558
  30. package/src/client/clients/messaging/schema.ts +1689 -3486
  31. package/src/client/clients/payments/index.ts +17 -0
  32. package/src/client/clients/payments/open-api-definition.json +314 -0
  33. package/src/client/clients/payments/schema.ts +113 -7
  34. package/src/client/clients/profile/index.ts +140 -84
  35. package/src/client/clients/profile/open-api-definition.json +1925 -1343
  36. package/src/client/clients/profile/schema.ts +1257 -1114
  37. 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
- async getAddresses() {
12
- return this.client.GET("/api/v1/addresses/").then(
13
- (response) => formatResponse(response, this.serviceName, this.logger),
14
- (reason) => formatError(reason, this.serviceName, this.logger),
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 getAddress(addressId: string) {
19
+ async getProfile(profileId: string) {
19
20
  return this.client
20
- .GET("/api/v1/addresses/{addressId}", {
21
- params: { path: { addressId } },
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
- async createAddress(
30
- data: paths["/api/v1/addresses/"]["post"]["requestBody"]["content"]["application/json"],
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
- return this.client
33
- .POST("/api/v1/addresses/", {
34
- body: data,
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 patchAddress(
43
- addressId: string,
44
+ async createProfile(
44
45
  data: NonNullable<
45
- paths["/api/v1/addresses/{addressId}"]["patch"]["requestBody"]
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
- .PATCH("/api/v1/addresses/{addressId}", {
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
- async updateAddress(
63
- addressId: string,
64
- data: paths["/api/v1/addresses/{addressId}"]["put"]["requestBody"]["content"]["application/json"],
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
- return this.client
67
- .PUT("/api/v1/addresses/{addressId}", {
68
- params: { path: { addressId } },
69
- body: data,
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 deleteAddress(addressId: string) {
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
- .DELETE("/api/v1/addresses/{addressId}", {
80
- params: { path: { addressId } },
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
- async getEntitlements() {
89
- return this.client.GET("/api/v1/entitlements/").then(
90
- (response) => formatResponse(response, this.serviceName, this.logger),
91
- (reason) => formatError(reason, this.serviceName, this.logger),
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 getUser(userId: string) {
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
- .GET("/api/v1/users/{userId}", {
98
- params: { path: { userId } },
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
- async createUser(
107
- data: paths["/api/v1/users/"]["post"]["requestBody"]["content"]["application/json"],
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
- return this.client
110
- .POST("/api/v1/users/", {
111
- body: data,
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 updateUser(
120
- userId: string,
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
- .PUT("/api/v1/users/{userId}", {
125
- params: { path: { userId } },
126
- body: data,
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
- async patchUser(
135
- userId: string,
136
- data?: NonNullable<
137
- paths["/api/v1/users/{userId}"]["patch"]["requestBody"]
138
- >["content"]["application/json"],
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
- .PATCH("/api/v1/users/{userId}", {
145
- params: { path: { userId } },
146
- body: data,
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 findUser(
155
- query: paths["/api/v1/users/find"]["get"]["parameters"]["query"],
186
+ async listProfiles(
187
+ query: paths["/api/v1/profiles/"]["get"]["parameters"]["query"],
156
188
  ) {
157
189
  return this.client
158
- .GET("/api/v1/users/find", {
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 selectUsers(
170
- ids: paths["/api/v1/users/select"]["post"]["requestBody"]["content"]["application/json"]["ids"],
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/users/select", {
174
- body: { ids },
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),