@ogcio/building-blocks-sdk 0.2.51 → 0.2.53

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 (32) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +14 -0
  3. package/dist/client/auth/index.d.ts.map +1 -1
  4. package/dist/client/clients/journey/index.d.ts +1 -2
  5. package/dist/client/clients/journey/index.d.ts.map +1 -1
  6. package/dist/client/clients/journey/schema.d.ts +1 -2
  7. package/dist/client/clients/journey/schema.d.ts.map +1 -1
  8. package/dist/client/clients/messaging/index.d.ts.map +1 -1
  9. package/dist/client/clients/profile/citizen.d.ts +191 -40
  10. package/dist/client/clients/profile/citizen.d.ts.map +1 -1
  11. package/dist/client/clients/profile/citizen.js +31 -10
  12. package/dist/client/clients/profile/citizen.js.map +1 -1
  13. package/dist/client/clients/profile/index.d.ts +77 -8
  14. package/dist/client/clients/profile/index.d.ts.map +1 -1
  15. package/dist/client/clients/profile/index.js +4 -4
  16. package/dist/client/clients/profile/index.js.map +1 -1
  17. package/dist/client/clients/profile/organisation.d.ts +861 -21
  18. package/dist/client/clients/profile/organisation.d.ts.map +1 -1
  19. package/dist/client/clients/profile/organisation.js +64 -4
  20. package/dist/client/clients/profile/organisation.js.map +1 -1
  21. package/dist/client/clients/profile/schema.d.ts +1773 -595
  22. package/dist/client/clients/profile/schema.d.ts.map +1 -1
  23. package/dist/client/clients/upload/index.d.ts +1 -1
  24. package/dist/index.d.ts.map +1 -1
  25. package/package.json +16 -16
  26. package/src/client/clients/journey/open-api-definition.json +3 -8
  27. package/src/client/clients/journey/schema.ts +1 -2
  28. package/src/client/clients/profile/citizen.ts +54 -14
  29. package/src/client/clients/profile/index.ts +13 -5
  30. package/src/client/clients/profile/open-api-definition.json +6812 -3375
  31. package/src/client/clients/profile/organisation.ts +117 -5
  32. package/src/client/clients/profile/schema.ts +1773 -595
@@ -1,16 +1,128 @@
1
1
  import type createClient from "openapi-fetch";
2
+ import type { Logger } from "../../../types/index.js";
3
+ import {
4
+ formatError,
5
+ formatResponse,
6
+ throwIfEmpty,
7
+ } from "../../utils/client-utils.js";
2
8
  import type { paths } from "./schema.js";
3
9
 
4
10
  export class ProfileOrganisation {
5
11
  constructor(
6
12
  private readonly client: ReturnType<typeof createClient<paths>>,
13
+ private readonly serviceName: string,
14
+ private readonly logger: Logger | undefined,
7
15
  ) {}
8
16
 
9
- async getLatestConsentStatement(
10
- query: paths["/api/v1/organisations/consent-statements/latest"]["get"]["parameters"]["query"],
17
+ async getCurrentConsentStatement(
18
+ query: paths["/api/v1/organisations/consent-statements/current"]["get"]["parameters"]["query"],
11
19
  ) {
12
- return this.client.GET("/api/v1/organisations/consent-statements/latest", {
13
- params: { query },
14
- });
20
+ return this.client
21
+ .GET("/api/v1/organisations/consent-statements/current", {
22
+ params: { query },
23
+ })
24
+ .then(
25
+ (response) => formatResponse(response, this.serviceName, this.logger),
26
+ (reason) => formatError(reason, this.serviceName, this.logger),
27
+ );
28
+ }
29
+
30
+ async createConsentStatement(
31
+ data: NonNullable<
32
+ paths["/api/v1/organisations/consent-statements/"]["post"]["requestBody"]
33
+ >["content"]["application/json"],
34
+ ) {
35
+ return this.client
36
+ .POST("/api/v1/organisations/consent-statements/", {
37
+ body: data,
38
+ })
39
+ .then(
40
+ (response) => formatResponse(response, this.serviceName, this.logger),
41
+ (reason) => formatError(reason, this.serviceName, this.logger),
42
+ );
43
+ }
44
+
45
+ async updateConsentStatement(
46
+ id: string,
47
+ data: NonNullable<
48
+ paths["/api/v1/organisations/consent-statements/{id}"]["put"]["requestBody"]
49
+ >["content"]["application/json"],
50
+ ) {
51
+ throwIfEmpty(id);
52
+
53
+ return this.client
54
+ .PUT("/api/v1/organisations/consent-statements/{id}", {
55
+ params: { path: { id } },
56
+ body: data,
57
+ })
58
+ .then(
59
+ (response) => formatResponse(response, this.serviceName, this.logger),
60
+ (reason) => formatError(reason, this.serviceName, this.logger),
61
+ );
62
+ }
63
+
64
+ async listConsentStatements(
65
+ query: paths["/api/v1/organisations/consent-statements/"]["get"]["parameters"]["query"],
66
+ ) {
67
+ return this.client
68
+ .GET("/api/v1/organisations/consent-statements/", {
69
+ params: { query },
70
+ })
71
+ .then(
72
+ (response) => formatResponse(response, this.serviceName, this.logger),
73
+ (reason) => formatError(reason, this.serviceName, this.logger),
74
+ );
75
+ }
76
+
77
+ async getConsentStatement(id: string) {
78
+ throwIfEmpty(id);
79
+
80
+ return this.client
81
+ .GET("/api/v1/organisations/consent-statements/{id}", {
82
+ params: { path: { id } },
83
+ })
84
+ .then(
85
+ (response) => formatResponse(response, this.serviceName, this.logger),
86
+ (reason) => formatError(reason, this.serviceName, this.logger),
87
+ );
88
+ }
89
+
90
+ async disableConsentStatement(id: string) {
91
+ throwIfEmpty(id);
92
+
93
+ return this.client
94
+ .PATCH("/api/v1/organisations/consent-statements/{id}/disable", {
95
+ params: { path: { id } },
96
+ })
97
+ .then(
98
+ (response) => formatResponse(response, this.serviceName, this.logger),
99
+ (reason) => formatError(reason, this.serviceName, this.logger),
100
+ );
101
+ }
102
+
103
+ async listConsents(
104
+ query: paths["/api/v1/organisations/consents/"]["get"]["parameters"]["query"],
105
+ ) {
106
+ return this.client
107
+ .GET("/api/v1/organisations/consents/", {
108
+ params: { query },
109
+ })
110
+ .then(
111
+ (response) => formatResponse(response, this.serviceName, this.logger),
112
+ (reason) => formatError(reason, this.serviceName, this.logger),
113
+ );
114
+ }
115
+
116
+ async listLatestConsents(
117
+ query: paths["/api/v1/organisations/consents/latest"]["get"]["parameters"]["query"],
118
+ ) {
119
+ return this.client
120
+ .GET("/api/v1/organisations/consents/latest", {
121
+ params: { query },
122
+ })
123
+ .then(
124
+ (response) => formatResponse(response, this.serviceName, this.logger),
125
+ (reason) => formatError(reason, this.serviceName, this.logger),
126
+ );
15
127
  }
16
128
  }