@ogcio/building-blocks-sdk 0.0.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 (106) hide show
  1. package/.husky/commit-msg +1 -0
  2. package/.husky/pre-push +1 -0
  3. package/.nvmrc +1 -0
  4. package/.vscode/settings.json +20 -0
  5. package/biome.jsonc +45 -0
  6. package/commitlint.config.js +6 -0
  7. package/dist/client/auth/index.d.ts +4 -0
  8. package/dist/client/auth/index.d.ts.map +1 -0
  9. package/dist/client/auth/index.js +83 -0
  10. package/dist/client/auth/index.js.map +1 -0
  11. package/dist/client/base-client.d.ts +18 -0
  12. package/dist/client/base-client.d.ts.map +1 -0
  13. package/dist/client/base-client.js +71 -0
  14. package/dist/client/base-client.js.map +1 -0
  15. package/dist/client/clients/messaging/index.d.ts +2407 -0
  16. package/dist/client/clients/messaging/index.d.ts.map +1 -0
  17. package/dist/client/clients/messaging/index.js +430 -0
  18. package/dist/client/clients/messaging/index.js.map +1 -0
  19. package/dist/client/clients/messaging/schema.d.ts +3823 -0
  20. package/dist/client/clients/messaging/schema.d.ts.map +1 -0
  21. package/dist/client/clients/messaging/schema.js +2 -0
  22. package/dist/client/clients/messaging/schema.js.map +1 -0
  23. package/dist/client/clients/payments/index.d.ts +2294 -0
  24. package/dist/client/clients/payments/index.d.ts.map +1 -0
  25. package/dist/client/clients/payments/index.js +217 -0
  26. package/dist/client/clients/payments/index.js.map +1 -0
  27. package/dist/client/clients/payments/schema.d.ts +2534 -0
  28. package/dist/client/clients/payments/schema.d.ts.map +1 -0
  29. package/dist/client/clients/payments/schema.js +2 -0
  30. package/dist/client/clients/payments/schema.js.map +1 -0
  31. package/dist/client/clients/profile/index.d.ts +1364 -0
  32. package/dist/client/clients/profile/index.d.ts.map +1 -0
  33. package/dist/client/clients/profile/index.js +102 -0
  34. package/dist/client/clients/profile/index.js.map +1 -0
  35. package/dist/client/clients/profile/schema.d.ts +1429 -0
  36. package/dist/client/clients/profile/schema.d.ts.map +1 -0
  37. package/dist/client/clients/profile/schema.js +2 -0
  38. package/dist/client/clients/profile/schema.js.map +1 -0
  39. package/dist/client/clients/scheduler/index.d.ts +14 -0
  40. package/dist/client/clients/scheduler/index.d.ts.map +1 -0
  41. package/dist/client/clients/scheduler/index.js +14 -0
  42. package/dist/client/clients/scheduler/index.js.map +1 -0
  43. package/dist/client/clients/scheduler/schema.d.ts +114 -0
  44. package/dist/client/clients/scheduler/schema.d.ts.map +1 -0
  45. package/dist/client/clients/scheduler/schema.js +2 -0
  46. package/dist/client/clients/scheduler/schema.js.map +1 -0
  47. package/dist/client/clients/upload/index.d.ts +390 -0
  48. package/dist/client/clients/upload/index.d.ts.map +1 -0
  49. package/dist/client/clients/upload/index.js +93 -0
  50. package/dist/client/clients/upload/index.js.map +1 -0
  51. package/dist/client/clients/upload/schema.d.ts +564 -0
  52. package/dist/client/clients/upload/schema.d.ts.map +1 -0
  53. package/dist/client/clients/upload/schema.js +2 -0
  54. package/dist/client/clients/upload/schema.js.map +1 -0
  55. package/dist/client/utils/client-utils.d.ts +15 -0
  56. package/dist/client/utils/client-utils.d.ts.map +1 -0
  57. package/dist/client/utils/client-utils.js +14 -0
  58. package/dist/client/utils/client-utils.js.map +1 -0
  59. package/dist/clients-configurations/clients-configuration.json +92 -0
  60. package/dist/clients-configurations/read-configuration-file.d.ts +22 -0
  61. package/dist/clients-configurations/read-configuration-file.d.ts.map +1 -0
  62. package/dist/clients-configurations/read-configuration-file.js +47 -0
  63. package/dist/clients-configurations/read-configuration-file.js.map +1 -0
  64. package/dist/index.d.ts +6 -0
  65. package/dist/index.d.ts.map +1 -0
  66. package/dist/index.js +33 -0
  67. package/dist/index.js.map +1 -0
  68. package/dist/types/index.d.ts +63 -0
  69. package/dist/types/index.d.ts.map +1 -0
  70. package/dist/types/index.js +6 -0
  71. package/dist/types/index.js.map +1 -0
  72. package/dist/utils/get-absolute-path.d.ts +3 -0
  73. package/dist/utils/get-absolute-path.d.ts.map +1 -0
  74. package/dist/utils/get-absolute-path.js +8 -0
  75. package/dist/utils/get-absolute-path.js.map +1 -0
  76. package/package.json +44 -0
  77. package/src/cli/cli-utils.ts +25 -0
  78. package/src/cli/index.ts +13 -0
  79. package/src/cli/outdated-clients-command.ts +148 -0
  80. package/src/cli/update-clients-command.ts +298 -0
  81. package/src/client/auth/index.ts +131 -0
  82. package/src/client/base-client.ts +97 -0
  83. package/src/client/clients/messaging/index.ts +683 -0
  84. package/src/client/clients/messaging/open-api-definition.json +8394 -0
  85. package/src/client/clients/messaging/schema.ts +3822 -0
  86. package/src/client/clients/payments/index.ts +349 -0
  87. package/src/client/clients/payments/open-api-definition.json +6094 -0
  88. package/src/client/clients/payments/schema.ts +2533 -0
  89. package/src/client/clients/profile/index.ts +182 -0
  90. package/src/client/clients/profile/open-api-definition.json +2876 -0
  91. package/src/client/clients/profile/schema.ts +1428 -0
  92. package/src/client/clients/scheduler/index.ts +28 -0
  93. package/src/client/clients/scheduler/open-api-definition.json +120 -0
  94. package/src/client/clients/scheduler/schema.ts +113 -0
  95. package/src/client/clients/upload/index.ts +129 -0
  96. package/src/client/clients/upload/open-api-definition.json +985 -0
  97. package/src/client/clients/upload/schema.ts +563 -0
  98. package/src/client/utils/client-utils.ts +50 -0
  99. package/src/clients-configurations/clients-configuration.json +92 -0
  100. package/src/clients-configurations/read-configuration-file.ts +68 -0
  101. package/src/index.ts +43 -0
  102. package/src/logto-node.d.ts +12 -0
  103. package/src/types/index.ts +82 -0
  104. package/src/utils/get-absolute-path.ts +10 -0
  105. package/tsconfig.json +18 -0
  106. package/tsconfig.prod.json +4 -0
@@ -0,0 +1,182 @@
1
+ import type createClient from "openapi-fetch";
2
+ import { PROFILE } from "../../../types/index.js";
3
+ import BaseClient from "../../base-client.js";
4
+ import type { paths } from "./schema.js";
5
+
6
+ class Profile extends BaseClient<paths> {
7
+ declare client: ReturnType<typeof createClient<paths>>;
8
+ protected serviceName = PROFILE;
9
+
10
+ async getAddresses() {
11
+ return this.client.GET("/api/v1/addresses/").then(
12
+ (response) => this.formatResponse(response),
13
+ (reason) => this.formatError(reason),
14
+ );
15
+ }
16
+
17
+ async getAddress(addressId: string) {
18
+ return this.client
19
+ .GET("/api/v1/addresses/{addressId}", {
20
+ params: { path: { addressId } },
21
+ })
22
+ .then(
23
+ (response) => this.formatResponse(response),
24
+ (reason) => this.formatError(reason),
25
+ );
26
+ }
27
+
28
+ async createAddress(
29
+ data: paths["/api/v1/addresses/"]["post"]["requestBody"]["content"]["application/json"],
30
+ ) {
31
+ return this.client
32
+ .POST("/api/v1/addresses/", {
33
+ body: data,
34
+ })
35
+ .then(
36
+ (response) => this.formatResponse(response),
37
+ (reason) => this.formatError(reason),
38
+ );
39
+ }
40
+
41
+ async patchAddress(
42
+ addressId: string,
43
+ data: NonNullable<
44
+ paths["/api/v1/addresses/{addressId}"]["patch"]["requestBody"]
45
+ >["content"]["application/json"],
46
+ ) {
47
+ if (!data || Object.keys(data).length === 0) {
48
+ return;
49
+ }
50
+ return this.client
51
+ .PATCH("/api/v1/addresses/{addressId}", {
52
+ params: { path: { addressId } },
53
+ body: data,
54
+ })
55
+ .then(
56
+ (response) => this.formatResponse(response),
57
+ (reason) => this.formatError(reason),
58
+ );
59
+ }
60
+
61
+ async updateAddress(
62
+ addressId: string,
63
+ data: paths["/api/v1/addresses/{addressId}"]["put"]["requestBody"]["content"]["application/json"],
64
+ ) {
65
+ return this.client
66
+ .PUT("/api/v1/addresses/{addressId}", {
67
+ params: { path: { addressId } },
68
+ body: data,
69
+ })
70
+ .then(
71
+ (response) => this.formatResponse(response),
72
+ (reason) => this.formatError(reason),
73
+ );
74
+ }
75
+
76
+ async deleteAddress(addressId: string) {
77
+ return this.client
78
+ .DELETE("/api/v1/addresses/{addressId}", {
79
+ params: { path: { addressId } },
80
+ })
81
+ .then(
82
+ (response) => this.formatResponse(response),
83
+ (reason) => this.formatError(reason),
84
+ );
85
+ }
86
+
87
+ async getEntitlements() {
88
+ return this.client.GET("/api/v1/entitlements/").then(
89
+ (response) => this.formatResponse(response),
90
+ (reason) => this.formatError(reason),
91
+ );
92
+ }
93
+
94
+ async getUser(userId: string) {
95
+ return this.client
96
+ .GET("/api/v1/users/{userId}", {
97
+ params: { path: { userId } },
98
+ })
99
+ .then(
100
+ (response) => this.formatResponse(response),
101
+ (reason) => this.formatError(reason),
102
+ );
103
+ }
104
+
105
+ async createUser(
106
+ data: paths["/api/v1/users/"]["post"]["requestBody"]["content"]["application/json"],
107
+ ) {
108
+ return this.client
109
+ .POST("/api/v1/users/", {
110
+ body: data,
111
+ })
112
+ .then(
113
+ (response) => this.formatResponse(response),
114
+ (reason) => this.formatError(reason),
115
+ );
116
+ }
117
+
118
+ async updateUser(
119
+ userId: string,
120
+ data: paths["/api/v1/users/{userId}"]["put"]["requestBody"]["content"]["application/json"],
121
+ ) {
122
+ return this.client
123
+ .PUT("/api/v1/users/{userId}", {
124
+ params: { path: { userId } },
125
+ body: data,
126
+ })
127
+ .then(
128
+ (response) => this.formatResponse(response),
129
+ (reason) => this.formatError(reason),
130
+ );
131
+ }
132
+
133
+ async patchUser(
134
+ userId: string,
135
+ data?: NonNullable<
136
+ paths["/api/v1/users/{userId}"]["patch"]["requestBody"]
137
+ >["content"]["application/json"],
138
+ ) {
139
+ if (!data || Object.keys(data).length === 0) {
140
+ return;
141
+ }
142
+ return this.client
143
+ .PATCH("/api/v1/users/{userId}", {
144
+ params: { path: { userId } },
145
+ body: data,
146
+ })
147
+ .then(
148
+ (response) => this.formatResponse(response),
149
+ (reason) => this.formatError(reason),
150
+ );
151
+ }
152
+
153
+ async findUser(
154
+ query: paths["/api/v1/users/find"]["get"]["parameters"]["query"],
155
+ ) {
156
+ return this.client
157
+ .GET("/api/v1/users/find", {
158
+ params: {
159
+ query,
160
+ },
161
+ })
162
+ .then(
163
+ (response) => this.formatResponse(response),
164
+ (reason) => this.formatError(reason),
165
+ );
166
+ }
167
+
168
+ async selectUsers(
169
+ ids: paths["/api/v1/users/select"]["post"]["requestBody"]["content"]["application/json"]["ids"],
170
+ ) {
171
+ return this.client
172
+ .POST("/api/v1/users/select", {
173
+ body: { ids },
174
+ })
175
+ .then(
176
+ (response) => this.formatResponse(response),
177
+ (reason) => this.formatError(reason),
178
+ );
179
+ }
180
+ }
181
+
182
+ export default Profile;