@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
@@ -328,248 +328,8 @@ export class Messaging extends BaseClient<paths> {
328
328
  async deleteEmailProvider(providerId: string) {
329
329
  return this.client
330
330
  .DELETE("/api/v1/providers/{providerId}", {
331
- params: { path: { providerId } },
332
- })
333
- .then(
334
- (response) => formatResponse(response, this.serviceName, this.logger),
335
- (reason) => formatError(reason, this.serviceName, this.logger),
336
- );
337
- }
338
-
339
- async getSmsProviders(
340
- params?: {
341
- primary?: boolean;
342
- } & PaginationParams,
343
- ) {
344
- const { primary } = params || {};
345
- const { error, data } = await this.client.GET("/api/v1/providers/", {
346
- params: {
347
- query: {
348
- type: "sms",
349
- ...preparePaginationParams(params),
350
- primary:
351
- primary !== undefined ? (primary ? "true" : "false") : undefined,
352
- },
353
- },
354
- });
355
-
356
- return {
357
- error,
358
- data: data?.data
359
- .filter((item: { type?: string }) => item.type === "sms")
360
- .map(
361
- (item: { id: string; providerName: string; isPrimary: boolean }) => ({
362
- id: item.id,
363
- providerName: item.providerName,
364
- isPrimary: item.isPrimary,
365
- }),
366
- ),
367
- };
368
- }
369
-
370
- async getSmsProvider(providerId: string) {
371
- const { data, error } = await this.client.GET(
372
- "/api/v1/providers/{providerId}",
373
- {
374
- params: { path: { providerId }, query: { type: "sms" } },
375
- },
376
- );
377
-
378
- // Let's do some type plumbing for the implementor
379
- if (data?.data.type === "sms") {
380
- return { data: data.data };
381
- }
382
-
383
- // Can we throw or return a new NotFoundError here?
384
- return { error };
385
- }
386
-
387
- async updateSmsProvider(provider: {
388
- id: string;
389
- providerName: string;
390
- isPrimary: boolean;
391
- // Union other config types
392
- config: {
393
- type: "AWS";
394
- accessKey: string;
395
- secretAccessKey: string;
396
- region: string;
397
- };
398
- }) {
399
- return this.client
400
- .PUT("/api/v1/providers/{providerId}", {
401
- params: { path: { providerId: provider.id } },
402
- body: {
403
- type: "sms",
404
- ...provider,
405
- },
406
- })
407
- .then(
408
- (response) => formatResponse(response, this.serviceName, this.logger),
409
- (reason) => formatError(reason, this.serviceName, this.logger),
410
- );
411
- }
412
-
413
- async createSmsProvider(provider: {
414
- providerName: string;
415
- isPrimary: boolean;
416
- // Union other config types
417
- config: {
418
- type: "AWS";
419
- accessKey: string;
420
- secretAccessKey: string;
421
- region: string;
422
- };
423
- }) {
424
- return this.client
425
- .POST("/api/v1/providers/", {
426
- body: {
427
- type: "sms",
428
- ...provider,
429
- },
430
- })
431
- .then(
432
- (response) => formatResponse(response, this.serviceName, this.logger),
433
- (reason) => formatError(reason, this.serviceName, this.logger),
434
- );
435
- }
436
-
437
- async deleteSmsProvider(providerId: string) {
438
- return this.client
439
- .DELETE("/api/v1/providers/{providerId}", {
440
- params: { path: { providerId } },
441
- })
442
- .then(
443
- (response) => formatResponse(response, this.serviceName, this.logger),
444
- (reason) => formatError(reason, this.serviceName, this.logger),
445
- );
446
- }
447
-
448
- async importUsers(toImport: { file?: File; records?: object[] }) {
449
- if (toImport.file) {
450
- const { data, error } = await this.client.POST("/api/v1/user-imports/", {
451
- body: {
452
- file: toImport.file,
453
- },
454
- bodySerializer: (body: unknown) => {
455
- const parsed = body as { file?: File } | undefined;
456
- if (!parsed || !parsed.file) {
457
- throw createError.BadRequest("File is missing!");
458
- }
459
- const formData = new FormData();
460
- formData.set("file", parsed.file);
461
- return formData;
462
- },
463
- });
464
- return { data: data?.data, error };
465
- }
466
-
467
- return this.client
468
- .POST("/api/v1/user-imports/", {
469
- body: toImport.records,
470
- })
471
- .then(
472
- (response) => formatResponse(response, this.serviceName, this.logger),
473
- (reason) => formatError(reason, this.serviceName, this.logger),
474
- );
475
- }
476
-
477
- async downloadUsersCsvTemplate() {
478
- return this.client
479
- .GET("/api/v1/user-imports/template-download", {
480
- parseAs: "blob",
481
- })
482
- .then(
483
- (response) => formatResponse(response, this.serviceName, this.logger),
484
- (reason) => formatError(reason, this.serviceName, this.logger),
485
- );
486
- }
487
-
488
- async getUsersImports(
489
- pagination: { limit: number; offset: number } = { limit: 100, offset: 0 },
490
- ) {
491
- return this.client
492
- .GET("/api/v1/user-imports/", {
493
- params: {
494
- query: {
495
- limit: toStringOrUndefined(pagination?.limit),
496
- offset: toStringOrUndefined(pagination?.offset),
497
- },
498
- },
499
- })
500
- .then(
501
- (response) => formatResponse(response, this.serviceName, this.logger),
502
- (reason) => formatError(reason, this.serviceName, this.logger),
503
- );
504
- }
505
-
506
- async getUsersImport(importId: string, includeUsersData?: boolean) {
507
- const includeImportedData =
508
- typeof includeUsersData === "undefined"
509
- ? undefined
510
- : includeUsersData
511
- ? "true"
512
- : "false";
513
- return this.client
514
- .GET("/api/v1/user-imports/{importId}", {
515
- params: {
516
- path: { importId },
517
- query: {
518
- includeImportedData,
519
- },
520
- },
521
- })
522
- .then(
523
- (response) => formatResponse(response, this.serviceName, this.logger),
524
- (reason) => formatError(reason, this.serviceName, this.logger),
525
- );
526
- }
527
-
528
- async getUsersForImport(importId: string, activeOnly: boolean) {
529
- return this.client
530
- .GET("/api/v1/users/", {
531
- params: { query: { importId, activeOnly: String(activeOnly) } },
532
- })
533
- .then(
534
- (response) => formatResponse(response, this.serviceName, this.logger),
535
- (reason) => formatError(reason, this.serviceName, this.logger),
536
- );
537
- }
538
-
539
- async getOrganisationsSettings(filter?: PaginationParams) {
540
- return this.client
541
- .GET("/api/v1/organisation-settings/", {
542
- params: {
543
- query: {
544
- ...preparePaginationParams(filter),
545
- },
546
- },
547
- })
548
- .then(
549
- (response) => formatResponse(response, this.serviceName, this.logger),
550
- (reason) => formatError(reason, this.serviceName, this.logger),
551
- );
552
- }
553
-
554
- async getOrganisationSettings(organisationSettingId: string) {
555
- return this.client
556
- .GET("/api/v1/organisation-settings/{organisationSettingId}", {
557
- params: { path: { organisationSettingId } },
558
- })
559
- .then(
560
- (response) => formatResponse(response, this.serviceName, this.logger),
561
- (reason) => formatError(reason, this.serviceName, this.logger),
562
- );
563
- }
564
-
565
- async updateOrganisationSettings(
566
- organisationSettingId: string,
567
- body: paths["/api/v1/organisation-settings/{organisationSettingId}"]["patch"]["requestBody"]["content"]["application/json"],
568
- ) {
569
- return this.client
570
- .PATCH("/api/v1/organisation-settings/{organisationSettingId}", {
571
- body,
572
- params: { path: { organisationSettingId } },
331
+ // biome-ignore lint/suspicious/noExplicitAny: <explanation>
332
+ params: { path: { providerId }, query: { type: "email" } as any },
573
333
  })
574
334
  .then(
575
335
  (response) => formatResponse(response, this.serviceName, this.logger),
@@ -601,42 +361,6 @@ export class Messaging extends BaseClient<paths> {
601
361
  );
602
362
  }
603
363
 
604
- async getUsers(
605
- query?: paths["/api/v1/users/"]["get"]["parameters"]["query"],
606
- ) {
607
- return this.client
608
- .GET("/api/v1/users/", {
609
- params: {
610
- query: { ...query, ...preparePaginationParams(query) },
611
- },
612
- })
613
- .then(
614
- (response) => formatResponse(response, this.serviceName, this.logger),
615
- (reason) => formatError(reason, this.serviceName, this.logger),
616
- );
617
- }
618
-
619
- async getUser(
620
- userId: paths["/api/v1/users/{userId}"]["get"]["parameters"]["path"]["userId"],
621
- activeOnly: boolean,
622
- ) {
623
- return this.client
624
- .GET("/api/v1/users/{userId}", {
625
- params: {
626
- path: {
627
- userId,
628
- },
629
- query: {
630
- activeOnly: toStringOrUndefined(activeOnly),
631
- },
632
- },
633
- })
634
- .then(
635
- (response) => formatResponse(response, this.serviceName, this.logger),
636
- (reason) => formatError(reason, this.serviceName, this.logger),
637
- );
638
- }
639
-
640
364
  async seeMessage(messageId: string) {
641
365
  return this.client
642
366
  .PUT("/api/v1/message-actions/{messageId}", {