@softruck/api-contracts 0.1.1-beta.3

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 (250) hide show
  1. package/README.md +0 -0
  2. package/dist/alerts/api.d.ts +9 -0
  3. package/dist/alerts/api.js +8 -0
  4. package/dist/alerts/index.d.ts +3 -0
  5. package/dist/alerts/index.js +3 -0
  6. package/dist/alerts/schemas.d.ts +65 -0
  7. package/dist/alerts/schemas.js +29 -0
  8. package/dist/alerts/types.d.ts +36 -0
  9. package/dist/alerts/types.js +1 -0
  10. package/dist/auth/api.d.ts +26 -0
  11. package/dist/auth/api.js +39 -0
  12. package/dist/auth/index.d.ts +3 -0
  13. package/dist/auth/index.js +3 -0
  14. package/dist/auth/schemas/access-codes.d.ts +16 -0
  15. package/dist/auth/schemas/access-codes.js +13 -0
  16. package/dist/auth/schemas/login.d.ts +13 -0
  17. package/dist/auth/schemas/login.js +9 -0
  18. package/dist/auth/schemas/passwords.d.ts +81 -0
  19. package/dist/auth/schemas/passwords.js +28 -0
  20. package/dist/auth/schemas/sessions.d.ts +3 -0
  21. package/dist/auth/schemas/sessions.js +2 -0
  22. package/dist/auth/schemas/tokens.d.ts +11 -0
  23. package/dist/auth/schemas/tokens.js +9 -0
  24. package/dist/auth/schemas.d.ts +5 -0
  25. package/dist/auth/schemas.js +5 -0
  26. package/dist/auth/types.d.ts +1 -0
  27. package/dist/auth/types.js +1 -0
  28. package/dist/checklist/api.d.ts +30 -0
  29. package/dist/checklist/api.js +15 -0
  30. package/dist/checklist/index.d.ts +3 -0
  31. package/dist/checklist/index.js +3 -0
  32. package/dist/checklist/schemas.d.ts +62 -0
  33. package/dist/checklist/schemas.js +46 -0
  34. package/dist/checklist/types.d.ts +76 -0
  35. package/dist/checklist/types.js +1 -0
  36. package/dist/chips/api.d.ts +17 -0
  37. package/dist/chips/api.js +8 -0
  38. package/dist/chips/connections/api.d.ts +13 -0
  39. package/dist/chips/connections/api.js +4 -0
  40. package/dist/chips/connections/index.d.ts +3 -0
  41. package/dist/chips/connections/index.js +3 -0
  42. package/dist/chips/connections/schemas.d.ts +31 -0
  43. package/dist/chips/connections/schemas.js +31 -0
  44. package/dist/chips/connections/types.d.ts +26 -0
  45. package/dist/chips/connections/types.js +1 -0
  46. package/dist/chips/index.d.ts +5 -0
  47. package/dist/chips/index.js +5 -0
  48. package/dist/chips/requirements/api.d.ts +13 -0
  49. package/dist/chips/requirements/api.js +4 -0
  50. package/dist/chips/requirements/index.d.ts +3 -0
  51. package/dist/chips/requirements/index.js +3 -0
  52. package/dist/chips/requirements/schemas.d.ts +21 -0
  53. package/dist/chips/requirements/schemas.js +21 -0
  54. package/dist/chips/requirements/types.d.ts +16 -0
  55. package/dist/chips/requirements/types.js +1 -0
  56. package/dist/chips/schemas.d.ts +78 -0
  57. package/dist/chips/schemas.js +72 -0
  58. package/dist/chips/types.d.ts +76 -0
  59. package/dist/chips/types.js +1 -0
  60. package/dist/core/client.d.ts +45 -0
  61. package/dist/core/client.js +42 -0
  62. package/dist/core/index.d.ts +4 -0
  63. package/dist/core/index.js +4 -0
  64. package/dist/core/query-builder.d.ts +34 -0
  65. package/dist/core/query-builder.js +86 -0
  66. package/dist/core/schemas.d.ts +80 -0
  67. package/dist/core/schemas.js +31 -0
  68. package/dist/core/types.d.ts +119 -0
  69. package/dist/core/types.js +2 -0
  70. package/dist/devices/activations/api.d.ts +20 -0
  71. package/dist/devices/activations/api.js +9 -0
  72. package/dist/devices/activations/index.d.ts +3 -0
  73. package/dist/devices/activations/index.js +3 -0
  74. package/dist/devices/activations/schemas.d.ts +42 -0
  75. package/dist/devices/activations/schemas.js +42 -0
  76. package/dist/devices/activations/types.d.ts +75 -0
  77. package/dist/devices/activations/types.js +1 -0
  78. package/dist/devices/api.d.ts +28 -0
  79. package/dist/devices/api.js +11 -0
  80. package/dist/devices/commands/api.d.ts +17 -0
  81. package/dist/devices/commands/api.js +8 -0
  82. package/dist/devices/commands/index.d.ts +3 -0
  83. package/dist/devices/commands/index.js +3 -0
  84. package/dist/devices/commands/schemas.d.ts +39 -0
  85. package/dist/devices/commands/schemas.js +33 -0
  86. package/dist/devices/commands/types.d.ts +58 -0
  87. package/dist/devices/commands/types.js +1 -0
  88. package/dist/devices/index.d.ts +5 -0
  89. package/dist/devices/index.js +5 -0
  90. package/dist/devices/schemas.d.ts +115 -0
  91. package/dist/devices/schemas.js +96 -0
  92. package/dist/devices/types.d.ts +142 -0
  93. package/dist/devices/types.js +1 -0
  94. package/dist/enterprises/api.d.ts +27 -0
  95. package/dist/enterprises/api.js +15 -0
  96. package/dist/enterprises/index.d.ts +3 -0
  97. package/dist/enterprises/index.js +3 -0
  98. package/dist/enterprises/schemas.d.ts +59 -0
  99. package/dist/enterprises/schemas.js +53 -0
  100. package/dist/enterprises/types.d.ts +160 -0
  101. package/dist/enterprises/types.js +1 -0
  102. package/dist/events/api.d.ts +18 -0
  103. package/dist/events/api.js +13 -0
  104. package/dist/events/index.d.ts +3 -0
  105. package/dist/events/index.js +3 -0
  106. package/dist/events/schemas.d.ts +262 -0
  107. package/dist/events/schemas.js +54 -0
  108. package/dist/events/types.d.ts +130 -0
  109. package/dist/events/types.js +1 -0
  110. package/dist/exports/api.d.ts +18 -0
  111. package/dist/exports/api.js +9 -0
  112. package/dist/exports/index.d.ts +3 -0
  113. package/dist/exports/index.js +3 -0
  114. package/dist/exports/schemas.d.ts +27 -0
  115. package/dist/exports/schemas.js +22 -0
  116. package/dist/exports/types.d.ts +47 -0
  117. package/dist/exports/types.js +1 -0
  118. package/dist/fuelings/api.d.ts +22 -0
  119. package/dist/fuelings/api.js +9 -0
  120. package/dist/fuelings/index.d.ts +3 -0
  121. package/dist/fuelings/index.js +3 -0
  122. package/dist/fuelings/schemas.d.ts +84 -0
  123. package/dist/fuelings/schemas.js +52 -0
  124. package/dist/fuelings/types.d.ts +80 -0
  125. package/dist/fuelings/types.js +1 -0
  126. package/dist/index.d.ts +22 -0
  127. package/dist/index.js +22 -0
  128. package/dist/maintenances/api.d.ts +31 -0
  129. package/dist/maintenances/api.js +12 -0
  130. package/dist/maintenances/index.d.ts +3 -0
  131. package/dist/maintenances/index.js +3 -0
  132. package/dist/maintenances/schemas.d.ts +74 -0
  133. package/dist/maintenances/schemas.js +44 -0
  134. package/dist/maintenances/types.d.ts +69 -0
  135. package/dist/maintenances/types.js +1 -0
  136. package/dist/operation-logs/api.d.ts +13 -0
  137. package/dist/operation-logs/api.js +10 -0
  138. package/dist/operation-logs/index.d.ts +3 -0
  139. package/dist/operation-logs/index.js +3 -0
  140. package/dist/operation-logs/schemas.d.ts +34 -0
  141. package/dist/operation-logs/schemas.js +22 -0
  142. package/dist/operation-logs/types.d.ts +32 -0
  143. package/dist/operation-logs/types.js +1 -0
  144. package/dist/protocols/api.d.ts +34 -0
  145. package/dist/protocols/api.js +13 -0
  146. package/dist/protocols/index.d.ts +3 -0
  147. package/dist/protocols/index.js +3 -0
  148. package/dist/protocols/schemas.d.ts +66 -0
  149. package/dist/protocols/schemas.js +36 -0
  150. package/dist/protocols/types.d.ts +99 -0
  151. package/dist/protocols/types.js +1 -0
  152. package/dist/service-orders/api.d.ts +38 -0
  153. package/dist/service-orders/api.js +14 -0
  154. package/dist/service-orders/index.d.ts +3 -0
  155. package/dist/service-orders/index.js +3 -0
  156. package/dist/service-orders/schemas.d.ts +82 -0
  157. package/dist/service-orders/schemas.js +47 -0
  158. package/dist/service-orders/types.d.ts +84 -0
  159. package/dist/service-orders/types.js +1 -0
  160. package/dist/sharings/api.d.ts +17 -0
  161. package/dist/sharings/api.js +8 -0
  162. package/dist/sharings/index.d.ts +3 -0
  163. package/dist/sharings/index.js +3 -0
  164. package/dist/sharings/schemas.d.ts +47 -0
  165. package/dist/sharings/schemas.js +36 -0
  166. package/dist/sharings/types.d.ts +54 -0
  167. package/dist/sharings/types.js +1 -0
  168. package/dist/surveys/api.d.ts +2 -0
  169. package/dist/surveys/api.js +3 -0
  170. package/dist/surveys/index.d.ts +3 -0
  171. package/dist/surveys/index.js +3 -0
  172. package/dist/surveys/schemas.d.ts +33 -0
  173. package/dist/surveys/schemas.js +23 -0
  174. package/dist/surveys/types.d.ts +27 -0
  175. package/dist/surveys/types.js +1 -0
  176. package/dist/tags/api.d.ts +24 -0
  177. package/dist/tags/api.js +28 -0
  178. package/dist/tags/index.d.ts +3 -0
  179. package/dist/tags/index.js +3 -0
  180. package/dist/tags/schemas.d.ts +26 -0
  181. package/dist/tags/schemas.js +19 -0
  182. package/dist/tags/types.d.ts +16 -0
  183. package/dist/tags/types.js +1 -0
  184. package/dist/tracking/api.d.ts +2 -0
  185. package/dist/tracking/api.js +3 -0
  186. package/dist/tracking/index.d.ts +3 -0
  187. package/dist/tracking/index.js +3 -0
  188. package/dist/tracking/schemas.d.ts +12 -0
  189. package/dist/tracking/schemas.js +12 -0
  190. package/dist/tracking/types.d.ts +11 -0
  191. package/dist/tracking/types.js +1 -0
  192. package/dist/trajectories/api.d.ts +27 -0
  193. package/dist/trajectories/api.js +13 -0
  194. package/dist/trajectories/index.d.ts +3 -0
  195. package/dist/trajectories/index.js +3 -0
  196. package/dist/trajectories/schemas.d.ts +39 -0
  197. package/dist/trajectories/schemas.js +30 -0
  198. package/dist/trajectories/types.d.ts +58 -0
  199. package/dist/trajectories/types.js +1 -0
  200. package/dist/trips/api.d.ts +30 -0
  201. package/dist/trips/api.js +12 -0
  202. package/dist/trips/index.d.ts +3 -0
  203. package/dist/trips/index.js +3 -0
  204. package/dist/trips/schemas.d.ts +62 -0
  205. package/dist/trips/schemas.js +36 -0
  206. package/dist/trips/types.d.ts +65 -0
  207. package/dist/trips/types.js +1 -0
  208. package/dist/users/api.d.ts +533 -0
  209. package/dist/users/api.js +102 -0
  210. package/dist/users/configuration/api.d.ts +21 -0
  211. package/dist/users/configuration/api.js +16 -0
  212. package/dist/users/configuration/index.d.ts +3 -0
  213. package/dist/users/configuration/index.js +3 -0
  214. package/dist/users/configuration/schemas.d.ts +91 -0
  215. package/dist/users/configuration/schemas.js +42 -0
  216. package/dist/users/configuration/types.d.ts +36 -0
  217. package/dist/users/configuration/types.js +1 -0
  218. package/dist/users/index.d.ts +4 -0
  219. package/dist/users/index.js +4 -0
  220. package/dist/users/schemas/addresses.d.ts +136 -0
  221. package/dist/users/schemas/addresses.js +94 -0
  222. package/dist/users/schemas/authenticated-user.d.ts +30 -0
  223. package/dist/users/schemas/authenticated-user.js +21 -0
  224. package/dist/users/schemas/common.d.ts +28 -0
  225. package/dist/users/schemas/common.js +26 -0
  226. package/dist/users/schemas/documents.d.ts +40 -0
  227. package/dist/users/schemas/documents.js +53 -0
  228. package/dist/users/schemas/passwords.d.ts +10 -0
  229. package/dist/users/schemas/passwords.js +15 -0
  230. package/dist/users/schemas/roles.d.ts +60 -0
  231. package/dist/users/schemas/roles.js +9 -0
  232. package/dist/users/schemas/sessions.d.ts +84 -0
  233. package/dist/users/schemas/sessions.js +55 -0
  234. package/dist/users/schemas/usernames.d.ts +14 -0
  235. package/dist/users/schemas/usernames.js +12 -0
  236. package/dist/users/schemas/users.d.ts +648 -0
  237. package/dist/users/schemas/users.js +243 -0
  238. package/dist/users/schemas.d.ts +8 -0
  239. package/dist/users/schemas.js +8 -0
  240. package/dist/users/types.d.ts +1 -0
  241. package/dist/users/types.js +1 -0
  242. package/dist/vehicles/api.d.ts +28 -0
  243. package/dist/vehicles/api.js +13 -0
  244. package/dist/vehicles/index.d.ts +3 -0
  245. package/dist/vehicles/index.js +3 -0
  246. package/dist/vehicles/schemas.d.ts +88 -0
  247. package/dist/vehicles/schemas.js +71 -0
  248. package/dist/vehicles/types.d.ts +142 -0
  249. package/dist/vehicles/types.js +1 -0
  250. package/package.json +59 -0
@@ -0,0 +1,533 @@
1
+ import type { ApiClientLike } from '../core/client';
2
+ import type { AddressQueryParams, CheckUsernamePayload, ConfirmUserDocumentUploadPayload, CreateAddressPayload, CreateUserPayload, CreateUsersPayload, DeleteUsersPayload, RoleQueryParams, SessionQueryParams, UpdateAddressPayload, UpdatePasswordPayload, UpdateUserPayload, UserDocumentSignedLinkPayload, UserPanelQueryParams, UserQueryParams } from './types';
3
+ export declare function createUsersApi(client: ApiClientLike): {
4
+ create: (payload: CreateUserPayload, signal?: AbortSignal) => Promise<undefined>;
5
+ createUsers: (payload: CreateUsersPayload, signal?: AbortSignal) => Promise<{
6
+ data: {
7
+ id: string;
8
+ type?: string | undefined;
9
+ attributes?: Record<string, unknown> | undefined;
10
+ relationships?: Record<string, unknown> | undefined;
11
+ }[];
12
+ }>;
13
+ update: (id: string, payload: UpdateUserPayload, signal?: AbortSignal) => Promise<{
14
+ data: {
15
+ id: string;
16
+ attributes: {
17
+ name: string;
18
+ username: string;
19
+ email: string | null;
20
+ birthdate: string | null;
21
+ locale: string | null;
22
+ last_login_at: string | null;
23
+ last_integration_source: string | null;
24
+ last_integration_time: string | null;
25
+ deactivated_at: string | null;
26
+ phone1: string | null;
27
+ phone2: string | null;
28
+ emergency_contact: string | null;
29
+ emergency_phone: string | null;
30
+ cpf: string | null;
31
+ document_number: string | null;
32
+ created_at: string | null;
33
+ updated_at: string | null;
34
+ };
35
+ relationships: {
36
+ enterprise?: {
37
+ id: string;
38
+ attributes: {
39
+ name: string | null;
40
+ cnpj: string | null;
41
+ email?: string | null | undefined;
42
+ };
43
+ } | null | undefined;
44
+ roles?: {
45
+ attributes: {
46
+ name: string;
47
+ };
48
+ }[] | undefined;
49
+ tags?: {
50
+ id: string;
51
+ attributes: {
52
+ name: string;
53
+ color: string | null;
54
+ };
55
+ }[] | undefined;
56
+ document?: {
57
+ attributes: {
58
+ folder: string;
59
+ };
60
+ } | null | undefined;
61
+ };
62
+ };
63
+ }>;
64
+ updateUser: (id: string, payload: UpdateUserPayload, signal?: AbortSignal) => Promise<{
65
+ data: {
66
+ id: string;
67
+ attributes: {
68
+ name: string;
69
+ username: string;
70
+ email: string | null;
71
+ birthdate: string | null;
72
+ locale: string | null;
73
+ last_login_at: string | null;
74
+ last_integration_source: string | null;
75
+ last_integration_time: string | null;
76
+ deactivated_at: string | null;
77
+ phone1: string | null;
78
+ phone2: string | null;
79
+ emergency_contact: string | null;
80
+ emergency_phone: string | null;
81
+ cpf: string | null;
82
+ document_number: string | null;
83
+ created_at: string | null;
84
+ updated_at: string | null;
85
+ };
86
+ relationships: {
87
+ enterprise?: {
88
+ id: string;
89
+ attributes: {
90
+ name: string | null;
91
+ cnpj: string | null;
92
+ email?: string | null | undefined;
93
+ };
94
+ } | null | undefined;
95
+ roles?: {
96
+ attributes: {
97
+ name: string;
98
+ };
99
+ }[] | undefined;
100
+ tags?: {
101
+ id: string;
102
+ attributes: {
103
+ name: string;
104
+ color: string | null;
105
+ };
106
+ }[] | undefined;
107
+ document?: {
108
+ attributes: {
109
+ folder: string;
110
+ };
111
+ } | null | undefined;
112
+ };
113
+ };
114
+ }>;
115
+ remove: (id: string, signal?: AbortSignal) => Promise<undefined>;
116
+ deleteUser: (id: string, signal?: AbortSignal) => Promise<undefined>;
117
+ deleteUsers: (payload: DeleteUsersPayload, signal?: AbortSignal) => Promise<undefined>;
118
+ listUsers: (params?: Partial<UserQueryParams>, signal?: AbortSignal) => Promise<{
119
+ data: {
120
+ id: string;
121
+ attributes: {
122
+ name: string;
123
+ username: string;
124
+ email: string | null;
125
+ birthdate: string | null;
126
+ locale: string | null;
127
+ last_login_at: string | null;
128
+ last_integration_source: string | null;
129
+ last_integration_time: string | null;
130
+ deactivated_at: string | null;
131
+ phone1: string | null;
132
+ phone2: string | null;
133
+ emergency_contact: string | null;
134
+ emergency_phone: string | null;
135
+ cpf: string | null;
136
+ document_number: string | null;
137
+ created_at: string | null;
138
+ updated_at: string | null;
139
+ };
140
+ relationships: {
141
+ enterprise?: {
142
+ id: string;
143
+ attributes: {
144
+ name: string | null;
145
+ cnpj: string | null;
146
+ email?: string | null | undefined;
147
+ };
148
+ } | null | undefined;
149
+ roles?: {
150
+ attributes: {
151
+ name: string;
152
+ };
153
+ }[] | undefined;
154
+ tags?: {
155
+ id: string;
156
+ attributes: {
157
+ name: string;
158
+ color: string | null;
159
+ };
160
+ }[] | undefined;
161
+ document?: {
162
+ attributes: {
163
+ folder: string;
164
+ };
165
+ } | null | undefined;
166
+ };
167
+ }[];
168
+ count: number | undefined;
169
+ }>;
170
+ getUser: (id: string, params?: Partial<UserQueryParams>, signal?: AbortSignal) => Promise<{
171
+ data: {
172
+ id: string;
173
+ attributes: {
174
+ name: string;
175
+ username: string;
176
+ email: string | null;
177
+ birthdate: string | null;
178
+ locale: string | null;
179
+ last_login_at: string | null;
180
+ last_integration_source: string | null;
181
+ last_integration_time: string | null;
182
+ deactivated_at: string | null;
183
+ phone1: string | null;
184
+ phone2: string | null;
185
+ emergency_contact: string | null;
186
+ emergency_phone: string | null;
187
+ cpf: string | null;
188
+ document_number: string | null;
189
+ created_at: string | null;
190
+ updated_at: string | null;
191
+ };
192
+ relationships: {
193
+ enterprise?: {
194
+ id: string;
195
+ attributes: {
196
+ name: string | null;
197
+ cnpj: string | null;
198
+ email?: string | null | undefined;
199
+ };
200
+ } | null | undefined;
201
+ roles?: {
202
+ attributes: {
203
+ name: string;
204
+ };
205
+ }[] | undefined;
206
+ tags?: {
207
+ id: string;
208
+ attributes: {
209
+ name: string;
210
+ color: string | null;
211
+ };
212
+ }[] | undefined;
213
+ document?: {
214
+ attributes: {
215
+ folder: string;
216
+ };
217
+ } | null | undefined;
218
+ };
219
+ };
220
+ }>;
221
+ panelUsers: (params: UserPanelQueryParams, signal?: AbortSignal) => Promise<{
222
+ data: {
223
+ type: string;
224
+ attributes: {
225
+ created_at: {
226
+ day: string;
227
+ };
228
+ deactivated_at: string | null;
229
+ locale: string;
230
+ count: string;
231
+ roles: {
232
+ name: string | null;
233
+ };
234
+ };
235
+ relationships: Record<string, unknown>;
236
+ }[];
237
+ count: number | undefined;
238
+ }>;
239
+ checkUsername: (payload: CheckUsernamePayload, signal?: AbortSignal) => Promise<{
240
+ data: {
241
+ username: string;
242
+ isTaken: boolean;
243
+ }[];
244
+ }>;
245
+ createAddress: (userId: string, payload: CreateAddressPayload, signal?: AbortSignal) => Promise<{
246
+ data: {
247
+ id: string;
248
+ attributes: {
249
+ type: "HOME" | "WORK" | "OTHER";
250
+ formatted_address: string | null;
251
+ coords?: [number, number] | Record<string, never> | {
252
+ type?: "Point" | undefined;
253
+ coordinates?: [number, number] | undefined;
254
+ } | null | undefined;
255
+ street?: string | null | undefined;
256
+ city?: string | null | undefined;
257
+ region?: string | null | undefined;
258
+ country?: string | null | undefined;
259
+ zip_code?: string | null | undefined;
260
+ street_number?: string | null | undefined;
261
+ complement?: string | null | undefined;
262
+ region_short?: string | null | undefined;
263
+ country_code?: string | null | undefined;
264
+ continent_code?: string | null | undefined;
265
+ description?: string | null | undefined;
266
+ model?: string | null | undefined;
267
+ created_at?: string | null | undefined;
268
+ updated_at?: string | null | undefined;
269
+ deleted_at?: string | null | undefined;
270
+ };
271
+ type?: "addresses" | undefined;
272
+ uuid?: string | undefined;
273
+ };
274
+ }>;
275
+ getAddress: (userId: string, addressId: string, params?: Partial<AddressQueryParams>, signal?: AbortSignal) => Promise<{
276
+ data: {
277
+ id: string;
278
+ attributes: {
279
+ type: "HOME" | "WORK" | "OTHER";
280
+ formatted_address: string | null;
281
+ coords?: [number, number] | Record<string, never> | {
282
+ type?: "Point" | undefined;
283
+ coordinates?: [number, number] | undefined;
284
+ } | null | undefined;
285
+ street?: string | null | undefined;
286
+ city?: string | null | undefined;
287
+ region?: string | null | undefined;
288
+ country?: string | null | undefined;
289
+ zip_code?: string | null | undefined;
290
+ street_number?: string | null | undefined;
291
+ complement?: string | null | undefined;
292
+ region_short?: string | null | undefined;
293
+ country_code?: string | null | undefined;
294
+ continent_code?: string | null | undefined;
295
+ description?: string | null | undefined;
296
+ model?: string | null | undefined;
297
+ created_at?: string | null | undefined;
298
+ updated_at?: string | null | undefined;
299
+ deleted_at?: string | null | undefined;
300
+ };
301
+ type?: "addresses" | undefined;
302
+ uuid?: string | undefined;
303
+ };
304
+ }>;
305
+ updateAddress: (userId: string, addressId: string, payload: UpdateAddressPayload, signal?: AbortSignal) => Promise<{
306
+ data: {
307
+ id: string;
308
+ attributes: {
309
+ type: "HOME" | "WORK" | "OTHER";
310
+ formatted_address: string | null;
311
+ coords?: [number, number] | Record<string, never> | {
312
+ type?: "Point" | undefined;
313
+ coordinates?: [number, number] | undefined;
314
+ } | null | undefined;
315
+ street?: string | null | undefined;
316
+ city?: string | null | undefined;
317
+ region?: string | null | undefined;
318
+ country?: string | null | undefined;
319
+ zip_code?: string | null | undefined;
320
+ street_number?: string | null | undefined;
321
+ complement?: string | null | undefined;
322
+ region_short?: string | null | undefined;
323
+ country_code?: string | null | undefined;
324
+ continent_code?: string | null | undefined;
325
+ description?: string | null | undefined;
326
+ model?: string | null | undefined;
327
+ created_at?: string | null | undefined;
328
+ updated_at?: string | null | undefined;
329
+ deleted_at?: string | null | undefined;
330
+ };
331
+ type?: "addresses" | undefined;
332
+ uuid?: string | undefined;
333
+ };
334
+ }>;
335
+ deleteAddress: (userId: string, addressId: string, signal?: AbortSignal) => Promise<undefined>;
336
+ createDocumentSignedLink: (userId: string, payload: UserDocumentSignedLinkPayload, signal?: AbortSignal) => Promise<{
337
+ data: {
338
+ signed_link: string;
339
+ };
340
+ }>;
341
+ confirmDocumentUpload: (userId: string, payload: ConfirmUserDocumentUploadPayload, signal?: AbortSignal) => Promise<{
342
+ data: {
343
+ id: string;
344
+ attributes: {
345
+ name?: string | null | undefined;
346
+ key_name?: string | null | undefined;
347
+ file_size?: number | null | undefined;
348
+ mime?: string | null | undefined;
349
+ folder?: string | null | undefined;
350
+ created_at?: string | null | undefined;
351
+ updated_at?: string | null | undefined;
352
+ deleted_at?: string | null | undefined;
353
+ };
354
+ type?: "documents" | undefined;
355
+ };
356
+ }>;
357
+ listAddresses: (userId: string, params?: Partial<AddressQueryParams>, signal?: AbortSignal) => Promise<{
358
+ data: {
359
+ id: string;
360
+ attributes: {
361
+ type: "HOME" | "WORK" | "OTHER";
362
+ formatted_address: string | null;
363
+ coords?: [number, number] | Record<string, never> | {
364
+ type?: "Point" | undefined;
365
+ coordinates?: [number, number] | undefined;
366
+ } | null | undefined;
367
+ street?: string | null | undefined;
368
+ city?: string | null | undefined;
369
+ region?: string | null | undefined;
370
+ country?: string | null | undefined;
371
+ zip_code?: string | null | undefined;
372
+ street_number?: string | null | undefined;
373
+ complement?: string | null | undefined;
374
+ region_short?: string | null | undefined;
375
+ country_code?: string | null | undefined;
376
+ continent_code?: string | null | undefined;
377
+ description?: string | null | undefined;
378
+ model?: string | null | undefined;
379
+ created_at?: string | null | undefined;
380
+ updated_at?: string | null | undefined;
381
+ deleted_at?: string | null | undefined;
382
+ };
383
+ type?: "addresses" | undefined;
384
+ uuid?: string | undefined;
385
+ }[];
386
+ count: number;
387
+ }>;
388
+ listRoles: (params?: Partial<RoleQueryParams>, signal?: AbortSignal) => Promise<{
389
+ data: {
390
+ id: string;
391
+ attributes: {
392
+ name: string;
393
+ };
394
+ }[];
395
+ }>;
396
+ listSessions: (userId: string, params?: Partial<SessionQueryParams>, signal?: AbortSignal) => Promise<{
397
+ data: {
398
+ id: string;
399
+ attributes: {
400
+ os_name: string | null;
401
+ os_version: string | null;
402
+ browser: string | null;
403
+ browser_version: string | null;
404
+ last_seen_ip: string | null;
405
+ created_at: string | null;
406
+ issued_at: string | null;
407
+ refreshes?: number | null | undefined;
408
+ user_agent_name?: string | null | undefined;
409
+ device?: string | null | undefined;
410
+ device_model?: string | null | undefined;
411
+ screen?: string | null | undefined;
412
+ connection?: string | null | undefined;
413
+ platform?: string | null | undefined;
414
+ expires_at?: string | null | undefined;
415
+ updated_at?: string | null | undefined;
416
+ currentSession?: boolean | undefined;
417
+ };
418
+ type?: "user_sessions" | undefined;
419
+ uuid?: string | undefined;
420
+ relationships?: {
421
+ user?: {
422
+ type: "user";
423
+ id: string;
424
+ } | undefined;
425
+ } | undefined;
426
+ }[];
427
+ count: number;
428
+ }>;
429
+ updatePassword: (payload: UpdatePasswordPayload) => Promise<undefined>;
430
+ changePassword: (payload: UpdatePasswordPayload, signal?: AbortSignal) => Promise<undefined>;
431
+ endpoint: string;
432
+ list: <R = {
433
+ id: string;
434
+ attributes: {
435
+ name: string;
436
+ username: string;
437
+ email: string | null;
438
+ birthdate: string | null;
439
+ locale: string | null;
440
+ last_login_at: string | null;
441
+ last_integration_source: string | null;
442
+ last_integration_time: string | null;
443
+ deactivated_at: string | null;
444
+ phone1: string | null;
445
+ phone2: string | null;
446
+ emergency_contact: string | null;
447
+ emergency_phone: string | null;
448
+ cpf: string | null;
449
+ document_number: string | null;
450
+ created_at: string | null;
451
+ updated_at: string | null;
452
+ };
453
+ relationships: {
454
+ enterprise?: {
455
+ id: string;
456
+ attributes: {
457
+ name: string | null;
458
+ cnpj: string | null;
459
+ email?: string | null | undefined;
460
+ };
461
+ } | null | undefined;
462
+ roles?: {
463
+ attributes: {
464
+ name: string;
465
+ };
466
+ }[] | undefined;
467
+ tags?: {
468
+ id: string;
469
+ attributes: {
470
+ name: string;
471
+ color: string | null;
472
+ };
473
+ }[] | undefined;
474
+ document?: {
475
+ attributes: {
476
+ folder: string;
477
+ };
478
+ } | null | undefined;
479
+ };
480
+ }>(params?: Partial<import("..").QueryParams>, signal?: AbortSignal) => Promise<import("..").ListResponse<R>>;
481
+ get: <R = {
482
+ id: string;
483
+ attributes: {
484
+ name: string;
485
+ username: string;
486
+ email: string | null;
487
+ birthdate: string | null;
488
+ locale: string | null;
489
+ last_login_at: string | null;
490
+ last_integration_source: string | null;
491
+ last_integration_time: string | null;
492
+ deactivated_at: string | null;
493
+ phone1: string | null;
494
+ phone2: string | null;
495
+ emergency_contact: string | null;
496
+ emergency_phone: string | null;
497
+ cpf: string | null;
498
+ document_number: string | null;
499
+ created_at: string | null;
500
+ updated_at: string | null;
501
+ };
502
+ relationships: {
503
+ enterprise?: {
504
+ id: string;
505
+ attributes: {
506
+ name: string | null;
507
+ cnpj: string | null;
508
+ email?: string | null | undefined;
509
+ };
510
+ } | null | undefined;
511
+ roles?: {
512
+ attributes: {
513
+ name: string;
514
+ };
515
+ }[] | undefined;
516
+ tags?: {
517
+ id: string;
518
+ attributes: {
519
+ name: string;
520
+ color: string | null;
521
+ };
522
+ }[] | undefined;
523
+ document?: {
524
+ attributes: {
525
+ folder: string;
526
+ };
527
+ } | null | undefined;
528
+ };
529
+ }>(id: string, params?: Partial<import("..").QueryParams>, signal?: AbortSignal) => Promise<{
530
+ data: R;
531
+ }>;
532
+ removeMany: (payload: unknown, signal?: AbortSignal) => Promise<undefined>;
533
+ };
@@ -0,0 +1,102 @@
1
+ import { z } from 'zod';
2
+ import { createResourceApi, parseOrLog } from '../core/client.js';
3
+ import { withQuery } from '../core/query-builder.js';
4
+ import { AddressQueryParamsSchema, CheckUsernamePayloadSchema, CheckUsernameResponseSchema, ConfirmUserDocumentUploadPayloadSchema, CreateAddressPayloadSchema, CreateUserPayloadSchema, CreateUsersPayloadSchema, CreateUsersResponseSchema, DeleteUsersPayloadSchema, RoleQueryParamsSchema, RoleSchema, SessionQueryParamsSchema, UpdateAddressPayloadSchema, UpdatePasswordPayloadSchema, UpdateUserPayloadSchema, UserAddressSchema, UserDocumentSchema, UserDocumentSignedLinkPayloadSchema, UserDocumentSignedLinkResponseSchema, UserPanelQueryParamsSchema, UserPanelRowSchema, UserQueryParamsSchema, UserSchema, UserSessionSchema, } from './schemas.js';
5
+ export function createUsersApi(client) {
6
+ const resourceApi = createResourceApi(client, '/v5/users', {
7
+ createPayload: CreateUserPayloadSchema,
8
+ bulkDeletePayload: DeleteUsersPayloadSchema,
9
+ });
10
+ const updateUser = (id, payload, signal) => Promise.resolve(payload)
11
+ .then(p => parseOrLog(UpdateUserPayloadSchema, p, `PATCH /v5/users/${id} (payload)`))
12
+ .then(validPayload => client.patch(`/v5/users/${id}`, { data: validPayload }, { signal }))
13
+ .then(r => ({ data: parseOrLog(UserSchema, r.data.data, `PATCH /v5/users/${id} (response)`) }));
14
+ const deleteUser = (id, signal) => client.delete(`/v5/users/${id}`, { signal }).then(() => undefined);
15
+ return {
16
+ ...resourceApi,
17
+ create: (payload, signal) => Promise.resolve(payload)
18
+ .then(p => parseOrLog(CreateUserPayloadSchema, p, 'POST /v5/users (payload)'))
19
+ .then(validPayload => ({ data: [validPayload] }))
20
+ .then(validPayload => client.post('/v5/users', validPayload, { signal }))
21
+ .then(r => parseOrLog(CreateUsersResponseSchema, r.data, 'POST /v5/users (response)'))
22
+ .then(() => undefined),
23
+ createUsers: (payload, signal) => Promise.resolve(payload)
24
+ .then(p => parseOrLog(CreateUsersPayloadSchema, p, 'POST /v5/users (payload)'))
25
+ .then(validPayload => client.post('/v5/users', validPayload, { signal }))
26
+ .then(r => parseOrLog(CreateUsersResponseSchema, r.data, 'POST /v5/users (response)')),
27
+ update: updateUser,
28
+ updateUser,
29
+ remove: deleteUser,
30
+ deleteUser,
31
+ deleteUsers: (payload, signal) => resourceApi.removeMany(payload, signal),
32
+ listUsers: (params = {}, signal) => Promise.resolve(params)
33
+ .then(p => parseOrLog(UserQueryParamsSchema, p, 'GET /v5/users (params)'))
34
+ .then(validParams => client.get(withQuery('/v5/users', validParams), { signal }))
35
+ .then(r => ({
36
+ data: parseOrLog(z.array(UserSchema), r.data.data, 'GET /v5/users (response)'),
37
+ count: r.data.count,
38
+ })),
39
+ getUser: (id, params = {}, signal) => Promise.resolve(params)
40
+ .then(p => parseOrLog(UserQueryParamsSchema, p, `GET /v5/users/${id} (params)`))
41
+ .then(validParams => client.get(withQuery(`/v5/users/${id}`, validParams), { signal }))
42
+ .then(r => ({ data: parseOrLog(UserSchema, r.data.data, `GET /v5/users/${id} (response)`) })),
43
+ panelUsers: (params, signal) => Promise.resolve(params)
44
+ .then(p => parseOrLog(UserPanelQueryParamsSchema, p, 'GET /v5/users (panel params)'))
45
+ .then(validParams => client.get(withQuery('/v5/users', validParams), { signal }))
46
+ .then(r => ({
47
+ data: parseOrLog(z.array(UserPanelRowSchema), r.data.data, 'GET /v5/users (panel response)'),
48
+ count: r.data.count,
49
+ })),
50
+ checkUsername: (payload, signal) => Promise.resolve(payload)
51
+ .then(p => parseOrLog(CheckUsernamePayloadSchema, p, 'POST /v5/users/check-usernames (payload)'))
52
+ .then(validPayload => client.post('/v5/users/check-usernames', validPayload, { signal }))
53
+ .then(r => parseOrLog(CheckUsernameResponseSchema, r.data, 'POST /v5/users/check-usernames (response)')),
54
+ createAddress: (userId, payload, signal) => Promise.resolve(payload)
55
+ .then(p => parseOrLog(CreateAddressPayloadSchema, p, `POST /v5/users/${userId}/addresses (payload)`))
56
+ .then(validPayload => client.post(`/v5/users/${userId}/addresses`, validPayload, { signal }))
57
+ .then(r => ({ data: parseOrLog(UserAddressSchema, r.data.data, `POST /v5/users/${userId}/addresses (response)`) })),
58
+ getAddress: (userId, addressId, params = {}, signal) => Promise.resolve(params)
59
+ .then(p => parseOrLog(AddressQueryParamsSchema, p, `GET /v5/users/${userId}/addresses/${addressId} (params)`))
60
+ .then(validParams => client.get(withQuery(`/v5/users/${userId}/addresses/${addressId}`, validParams), { signal }))
61
+ .then(r => ({ data: parseOrLog(UserAddressSchema, r.data.data, `GET /v5/users/${userId}/addresses/${addressId} (response)`) })),
62
+ updateAddress: (userId, addressId, payload, signal) => Promise.resolve(payload)
63
+ .then(p => parseOrLog(UpdateAddressPayloadSchema, p, `PATCH /v5/users/${userId}/addresses/${addressId} (payload)`))
64
+ .then(validPayload => client.patch(`/v5/users/${userId}/addresses/${addressId}`, validPayload, { signal }))
65
+ .then(r => ({ data: parseOrLog(UserAddressSchema, r.data.data, `PATCH /v5/users/${userId}/addresses/${addressId} (response)`) })),
66
+ deleteAddress: (userId, addressId, signal) => client.delete(`/v5/users/${userId}/addresses/${addressId}`, { signal }).then(() => undefined),
67
+ createDocumentSignedLink: (userId, payload, signal) => Promise.resolve(payload)
68
+ .then(p => parseOrLog(UserDocumentSignedLinkPayloadSchema, p, `POST /v5/users/${userId}/documents/signed-link (payload)`))
69
+ .then(validPayload => client.post(`/v5/users/${userId}/documents/signed-link`, validPayload, { signal }))
70
+ .then(r => parseOrLog(UserDocumentSignedLinkResponseSchema, r.data, `POST /v5/users/${userId}/documents/signed-link (response)`)),
71
+ confirmDocumentUpload: (userId, payload, signal) => Promise.resolve(payload)
72
+ .then(p => parseOrLog(ConfirmUserDocumentUploadPayloadSchema, p, `POST /v5/users/${userId}/documents/confirm-upload (payload)`))
73
+ .then(validPayload => client.post(`/v5/users/${userId}/documents/confirm-upload`, validPayload, { signal }))
74
+ .then(r => ({ data: parseOrLog(UserDocumentSchema, r.data.data, `POST /v5/users/${userId}/documents/confirm-upload (response)`) })),
75
+ listAddresses: (userId, params = {}, signal) => Promise.resolve(params)
76
+ .then(p => parseOrLog(AddressQueryParamsSchema, p, `GET /v5/users/${userId}/addresses (params)`))
77
+ .then(validParams => client.get(withQuery(`/v5/users/${userId}/addresses`, validParams), { signal }))
78
+ .then(r => ({
79
+ data: parseOrLog(z.array(UserAddressSchema), r.data.data, `GET /v5/users/${userId}/addresses (response)`),
80
+ count: r.data.count,
81
+ })),
82
+ listRoles: (params = {}, signal) => Promise.resolve(params)
83
+ .then(p => parseOrLog(RoleQueryParamsSchema, p, 'GET /v5/users/roles (params)'))
84
+ .then(validParams => client.get(withQuery('/v5/users/roles', validParams), { signal }))
85
+ .then(r => ({ data: parseOrLog(z.array(RoleSchema), r.data.data, 'GET /v5/users/roles (response)') })),
86
+ listSessions: (userId, params = {}, signal) => Promise.resolve(params)
87
+ .then(p => parseOrLog(SessionQueryParamsSchema, p, `GET /v5/users/${userId}/sessions (params)`))
88
+ .then(validParams => client.get(withQuery(`/v5/users/${userId}/sessions`, validParams), { signal }))
89
+ .then(r => ({
90
+ data: parseOrLog(z.array(UserSessionSchema), r.data.data, `GET /v5/users/${userId}/sessions (response)`),
91
+ count: r.data.count,
92
+ })),
93
+ updatePassword: (payload) => Promise.resolve(payload)
94
+ .then(p => parseOrLog(UpdatePasswordPayloadSchema, p, 'POST /v5/users/update-password (payload)'))
95
+ .then(validPayload => client.post('/v5/users/update-password', validPayload))
96
+ .then(() => undefined),
97
+ changePassword: (payload, signal) => Promise.resolve(payload)
98
+ .then(p => parseOrLog(UpdatePasswordPayloadSchema, p, 'PATCH /v5/users/update-password (payload)'))
99
+ .then(validPayload => client.patch('/v5/users/update-password', validPayload, { signal }))
100
+ .then(() => undefined),
101
+ };
102
+ }
@@ -0,0 +1,21 @@
1
+ import type { ApiClientLike } from '../../core/client';
2
+ import type { AlertConfigData, ConfigureAlertsPayload, CreateSubscriptionPayload, CreateVehicleSubscriptionPayload, RegisterConfigurationSubscriptionPayload } from './types';
3
+ export declare function createUserConfigurationApi(client: ApiClientLike): {
4
+ getSubscriptions: (uuid: string, signal?: AbortSignal) => Promise<{
5
+ data: unknown;
6
+ }>;
7
+ getSubscriptionsByToken: (uuid: string, dtk: string, signal?: AbortSignal) => Promise<{
8
+ data: unknown;
9
+ }>;
10
+ createSubscription: (uuid: string, payload: CreateSubscriptionPayload) => Promise<undefined>;
11
+ deleteSubscription: (uuid: string, dtk: string) => Promise<undefined>;
12
+ getAlertConfig: (uuid: string, dtk: string, signal?: AbortSignal) => Promise<AlertConfigData>;
13
+ configureAlerts: (uuid: string, payload: ConfigureAlertsPayload) => Promise<undefined>;
14
+ getVehicleSubscription: (uuid: string, dtk: string, vehicleUUID: string, signal?: AbortSignal) => Promise<{
15
+ data: unknown;
16
+ }>;
17
+ createVehicleSubscription: (uuid: string, dtk: string, vehicleUUID: string, payload: CreateVehicleSubscriptionPayload) => Promise<undefined>;
18
+ deleteVehicleSubscription: (uuid: string, dtk: string, vehicleUUID: string, alert: string) => Promise<undefined>;
19
+ registerToken: (payload: RegisterConfigurationSubscriptionPayload) => Promise<undefined>;
20
+ unregisterToken: (token: string) => Promise<undefined>;
21
+ };
@@ -0,0 +1,16 @@
1
+ export function createUserConfigurationApi(client) {
2
+ const base = (uuid) => `/v4/users/${uuid}/configuration`;
3
+ return {
4
+ getSubscriptions: (uuid, signal) => client.get(`${base(uuid)}/subscriptions`, { signal }).then(r => r.data),
5
+ getSubscriptionsByToken: (uuid, dtk, signal) => client.get(`${base(uuid)}/subscriptions/${dtk}`, { signal }).then(r => r.data),
6
+ createSubscription: (uuid, payload) => client.post(`${base(uuid)}/subscriptions`, { data: payload }).then(() => undefined),
7
+ deleteSubscription: (uuid, dtk) => client.delete(`${base(uuid)}/subscriptions/${dtk}`).then(() => undefined),
8
+ getAlertConfig: (uuid, dtk, signal) => client.get(`${base(uuid)}/alerts?dtk=${encodeURIComponent(dtk)}`, { signal }).then(r => r.data),
9
+ configureAlerts: (uuid, payload) => client.post(`${base(uuid)}/alerts`, { data: payload }).then(() => undefined),
10
+ getVehicleSubscription: (uuid, dtk, vehicleUUID, signal) => client.get(`${base(uuid)}/subscriptions/${dtk}/vehicles/${vehicleUUID}`, { signal }).then(r => r.data),
11
+ createVehicleSubscription: (uuid, dtk, vehicleUUID, payload) => client.post(`${base(uuid)}/subscriptions/${dtk}/vehicles/${vehicleUUID}`, { data: payload }).then(() => undefined),
12
+ deleteVehicleSubscription: (uuid, dtk, vehicleUUID, alert) => client.delete(`${base(uuid)}/subscriptions/${dtk}/vehicles/${vehicleUUID}/${alert}`).then(() => undefined),
13
+ registerToken: (payload) => client.post('/v5/configuration/subscriptions', { data: payload }).then(() => undefined),
14
+ unregisterToken: (token) => client.delete(`/v5/configuration/subscriptions/${encodeURIComponent(token)}`).then(() => undefined),
15
+ };
16
+ }
@@ -0,0 +1,3 @@
1
+ export * from './api';
2
+ export * from './schemas';
3
+ export * from './types';