@homespot-sdk/validators 0.0.5 → 0.0.601

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.
package/src/index.ts CHANGED
@@ -1,364 +1,345 @@
1
- import { makeApi, Zodios, type ZodiosOptions } from '@zodios/core';
2
- import { z } from 'zod';
1
+ import { makeApi, Zodios, type ZodiosOptions } from "@zodios/core";
2
+ import { z } from "zod";
3
3
 
4
4
  const SocialMediaRequest = z
5
- .object({
6
- type: z.enum([
7
- 'FACEBOOK',
8
- 'YOUTUBE',
9
- 'INSTAGRAM',
10
- 'TIKTOK',
11
- 'LINKEDIN',
12
- ]),
13
- url: z.string().optional(),
14
- })
15
- .strict()
16
- .passthrough();
5
+ .object({
6
+ type: z.enum(["FACEBOOK", "YOUTUBE", "INSTAGRAM", "TIKTOK", "LINKEDIN"]),
7
+ url: z.string().optional(),
8
+ })
9
+ .strict()
10
+ .passthrough();
17
11
  const SocialMediasRequest = z
18
- .object({ data: z.array(SocialMediaRequest).min(1).max(5) })
19
- .strict()
20
- .passthrough();
12
+ .object({ data: z.array(SocialMediaRequest).min(1).max(5) })
13
+ .strict()
14
+ .passthrough();
21
15
  const RolesRequest = z
22
- .object({
23
- name: z.string().min(1),
24
- description: z.string().min(1),
25
- authorities: z.array(
26
- z.enum([
27
- 'properties_read',
28
- 'properties_write',
29
- 'agents_read',
30
- 'agents_write',
31
- ])
32
- ),
33
- })
34
- .strict()
35
- .passthrough();
16
+ .object({
17
+ name: z.string().min(1),
18
+ description: z.string().min(1),
19
+ authorities: z.array(
20
+ z.enum([
21
+ "properties_read",
22
+ "properties_write",
23
+ "agents_read",
24
+ "agents_write",
25
+ ])
26
+ ),
27
+ })
28
+ .strict()
29
+ .passthrough();
36
30
  const PhotoRequest = z
37
- .object({
38
- photo: z.string().min(0).max(255),
39
- type: z.enum(['JPEG', 'JPG', 'PNG', 'WEBP']),
40
- width: z.number().int().gte(10).lte(11000),
41
- height: z.number().int().gte(10).lte(11000).optional(),
42
- })
43
- .strict()
44
- .passthrough();
31
+ .object({
32
+ photo: z.string().min(0).max(255),
33
+ type: z.enum(["JPEG", "JPG", "PNG", "WEBP"]),
34
+ width: z.number().int().gte(10).lte(11000),
35
+ height: z.number().int().gte(10).lte(11000).optional(),
36
+ })
37
+ .strict()
38
+ .passthrough();
45
39
  const AddressRequest = z
46
- .object({
47
- placeId: z.string().min(0).max(255),
48
- cadastralCode: z.string().min(0).max(255),
49
- fullName: z.string().min(0).max(500),
50
- lat: z.number().gte(-90).lte(90),
51
- lng: z.number().gte(-180).lte(180),
52
- country: z.string().min(0).max(100),
53
- city: z.string().min(0).max(100),
54
- street: z.string().min(0).max(255),
55
- })
56
- .strict()
57
- .passthrough();
40
+ .object({
41
+ country: z.string().min(0).max(100),
42
+ city: z.string().min(0).max(100),
43
+ district: z.string().min(0).max(100),
44
+ subdistrict: z.string().min(0).max(100),
45
+ street: z.string().min(0).max(255),
46
+ })
47
+ .strict()
48
+ .passthrough();
58
49
  const CreateAgencyRequest = z
59
- .object({
60
- name: z.string().min(1),
61
- slogan: z.string().min(1),
62
- logoUrl: z.string().min(1),
63
- coverImage: z.string().min(1),
64
- email: z.string().min(1).email(),
65
- seats: z.number().int(),
66
- domain: z.string().min(1),
67
- phone: z.string().min(1),
68
- website: z.string().min(1),
69
- address: AddressRequest,
70
- yearSince: z.number().int(),
71
- })
72
- .strict()
73
- .passthrough();
50
+ .object({
51
+ name: z.string().min(1),
52
+ email: z.string().min(1).email(),
53
+ seats: z.number().int(),
54
+ subDomain: z.string().min(1),
55
+ phone: z.string().min(1),
56
+ address: AddressRequest,
57
+ yearSince: z.number().int(),
58
+ })
59
+ .strict()
60
+ .passthrough();
74
61
  const InviteMemberRequest = z
75
- .object({ emails: z.array(z.string()).min(1) })
76
- .strict()
77
- .passthrough();
62
+ .object({ emails: z.array(z.string()).min(1) })
63
+ .strict()
64
+ .passthrough();
78
65
  const PresignedUrlResponse = z
79
- .object({ originalName: z.string(), key: z.string(), url: z.string() })
80
- .strict()
81
- .passthrough();
66
+ .object({ originalName: z.string(), key: z.string(), url: z.string() })
67
+ .strict()
68
+ .passthrough();
82
69
  const PresignedUrlsResponse = z
83
- .object({ data: z.array(PresignedUrlResponse) })
84
- .strict()
85
- .passthrough();
70
+ .object({ data: z.array(PresignedUrlResponse) })
71
+ .strict()
72
+ .passthrough();
86
73
  const IdResponse = z.object({ id: z.string() }).strict().passthrough();
87
74
  const UploadAcknowledgmentResponse = z
88
- .object({ success: z.array(z.string()), fail: z.array(z.string()) })
89
- .strict()
90
- .passthrough();
75
+ .object({ success: z.array(z.string()), fail: z.array(z.string()) })
76
+ .strict()
77
+ .passthrough();
91
78
  const InvitationViewResponse = z
92
- .object({
93
- invitationId: z.string().uuid(),
94
- email: z.string(),
95
- status: z.enum([
96
- 'PENDING',
97
- 'ACCEPTED',
98
- 'REJECTED',
99
- 'CANCELLED',
100
- 'EXPIRED',
101
- ]),
102
- createdAt: z.string().datetime({ offset: true }),
103
- expiresAt: z.string().datetime({ offset: true }),
104
- acceptedAt: z.string().datetime({ offset: true }).optional(),
105
- acceptedBy: z.string().optional(),
106
- })
107
- .strict()
108
- .passthrough();
79
+ .object({
80
+ invitationId: z.string().uuid(),
81
+ email: z.string(),
82
+ status: z.enum(["PENDING", "ACCEPTED", "REJECTED", "CANCELLED", "EXPIRED"]),
83
+ createdAt: z.string().datetime({ offset: true }),
84
+ expiresAt: z.string().datetime({ offset: true }),
85
+ acceptedAt: z.string().datetime({ offset: true }).optional(),
86
+ acceptedBy: z.string().optional(),
87
+ })
88
+ .strict()
89
+ .passthrough();
109
90
 
110
91
  export const schemas = {
111
- SocialMediaRequest,
112
- SocialMediasRequest,
113
- RolesRequest,
114
- PhotoRequest,
115
- AddressRequest,
116
- CreateAgencyRequest,
117
- InviteMemberRequest,
118
- PresignedUrlResponse,
119
- PresignedUrlsResponse,
120
- IdResponse,
121
- UploadAcknowledgmentResponse,
122
- InvitationViewResponse,
92
+ SocialMediaRequest,
93
+ SocialMediasRequest,
94
+ RolesRequest,
95
+ PhotoRequest,
96
+ AddressRequest,
97
+ CreateAgencyRequest,
98
+ InviteMemberRequest,
99
+ PresignedUrlResponse,
100
+ PresignedUrlsResponse,
101
+ IdResponse,
102
+ UploadAcknowledgmentResponse,
103
+ InvitationViewResponse,
123
104
  };
124
105
 
125
106
  const endpoints = makeApi([
126
- {
127
- method: 'post',
128
- path: '/agency',
129
- alias: 'createAgency',
130
- requestFormat: 'json',
131
- parameters: [
132
- {
133
- name: 'body',
134
- type: 'Body',
135
- schema: CreateAgencyRequest,
136
- },
137
- ],
138
- response: z.void(),
139
- },
140
- {
141
- method: 'get',
142
- path: '/agency/:agencyId',
143
- alias: 'getAgency',
144
- requestFormat: 'json',
145
- parameters: [
146
- {
147
- name: 'agencyId',
148
- type: 'Path',
149
- schema: z.string().uuid(),
150
- },
151
- ],
152
- response: z.void(),
153
- },
154
- {
155
- method: 'post',
156
- path: '/agency/:agencyId/activate',
157
- alias: 'activateAgency',
158
- requestFormat: 'json',
159
- parameters: [
160
- {
161
- name: 'agencyId',
162
- type: 'Path',
163
- schema: z.string().uuid(),
164
- },
165
- ],
166
- response: z.void(),
167
- },
168
- {
169
- method: 'get',
170
- path: '/agency/:agencyId/invitation',
171
- alias: 'getAllInvitations',
172
- requestFormat: 'json',
173
- parameters: [
174
- {
175
- name: 'agencyId',
176
- type: 'Path',
177
- schema: z.string().uuid(),
178
- },
179
- ],
180
- response: z.void(),
181
- },
182
- {
183
- method: 'post',
184
- path: '/agency/:agencyId/invitation',
185
- alias: 'inviteMember',
186
- requestFormat: 'json',
187
- parameters: [
188
- {
189
- name: 'body',
190
- type: 'Body',
191
- schema: InviteMemberRequest,
192
- },
193
- {
194
- name: 'agencyId',
195
- type: 'Path',
196
- schema: z.string().uuid(),
197
- },
198
- ],
199
- response: z.void(),
200
- },
201
- {
202
- method: 'post',
203
- path: '/agency/:agencyId/invitation/:invitationId',
204
- alias: 'inviteAccepted',
205
- requestFormat: 'json',
206
- parameters: [
207
- {
208
- name: 'agencyId',
209
- type: 'Path',
210
- schema: z.string().uuid(),
211
- },
212
- {
213
- name: 'invitationId',
214
- type: 'Path',
215
- schema: z.string().uuid(),
216
- },
217
- ],
218
- response: z.void(),
219
- },
220
- {
221
- method: 'put',
222
- path: '/agency/:agencyId/presigned-urls',
223
- alias: 'generatePresignedUrl',
224
- requestFormat: 'json',
225
- parameters: [
226
- {
227
- name: 'body',
228
- type: 'Body',
229
- schema: PhotoRequest,
230
- },
231
- {
232
- name: 'agencyId',
233
- type: 'Path',
234
- schema: z.string().uuid(),
235
- },
236
- ],
237
- response: z.void(),
238
- },
239
- {
240
- method: 'post',
241
- path: '/agency/:agencyId/presigned-urls/notify/cover',
242
- alias: 'notifyCoverUploadCompletion',
243
- requestFormat: 'json',
244
- parameters: [
245
- {
246
- name: 'body',
247
- type: 'Body',
248
- schema: PhotoRequest,
249
- },
250
- {
251
- name: 'agencyId',
252
- type: 'Path',
253
- schema: z.string().uuid(),
254
- },
255
- ],
256
- response: z.void(),
257
- },
258
- {
259
- method: 'post',
260
- path: '/agency/:agencyId/presigned-urls/notify/logo',
261
- alias: 'notifyLogoUploadCompletion',
262
- requestFormat: 'json',
263
- parameters: [
264
- {
265
- name: 'body',
266
- type: 'Body',
267
- schema: PhotoRequest,
268
- },
269
- {
270
- name: 'agencyId',
271
- type: 'Path',
272
- schema: z.string().uuid(),
273
- },
274
- ],
275
- response: z.void(),
276
- },
277
- {
278
- method: 'post',
279
- path: '/agency/:agencyId/roles',
280
- alias: 'addRole',
281
- requestFormat: 'json',
282
- parameters: [
283
- {
284
- name: 'body',
285
- type: 'Body',
286
- schema: RolesRequest,
287
- },
288
- {
289
- name: 'agencyId',
290
- type: 'Path',
291
- schema: z.string().uuid(),
292
- },
293
- ],
294
- response: z.void(),
295
- },
296
- {
297
- method: 'put',
298
- path: '/agency/:agencyId/roles/:roleId',
299
- alias: 'updateRole',
300
- requestFormat: 'json',
301
- parameters: [
302
- {
303
- name: 'body',
304
- type: 'Body',
305
- schema: RolesRequest,
306
- },
307
- {
308
- name: 'agencyId',
309
- type: 'Path',
310
- schema: z.string().uuid(),
311
- },
312
- {
313
- name: 'roleId',
314
- type: 'Path',
315
- schema: z.number().int(),
316
- },
317
- ],
318
- response: z.void(),
319
- },
320
- {
321
- method: 'delete',
322
- path: '/agency/:agencyId/roles/:roleId',
323
- alias: 'removeRole',
324
- requestFormat: 'json',
325
- parameters: [
326
- {
327
- name: 'agencyId',
328
- type: 'Path',
329
- schema: z.string().uuid(),
330
- },
331
- {
332
- name: 'roleId',
333
- type: 'Path',
334
- schema: z.number().int(),
335
- },
336
- ],
337
- response: z.void(),
338
- },
339
- {
340
- method: 'put',
341
- path: '/agency/:agencyId/social-media',
342
- alias: 'updateSocialUrls',
343
- requestFormat: 'json',
344
- parameters: [
345
- {
346
- name: 'body',
347
- type: 'Body',
348
- schema: SocialMediasRequest,
349
- },
350
- {
351
- name: 'agencyId',
352
- type: 'Path',
353
- schema: z.string().uuid(),
354
- },
355
- ],
356
- response: z.void(),
357
- },
107
+ {
108
+ method: "post",
109
+ path: "/agency",
110
+ alias: "createAgency",
111
+ requestFormat: "json",
112
+ parameters: [
113
+ {
114
+ name: "body",
115
+ type: "Body",
116
+ schema: CreateAgencyRequest,
117
+ },
118
+ ],
119
+ response: z.void(),
120
+ },
121
+ {
122
+ method: "get",
123
+ path: "/agency/:agencyId",
124
+ alias: "getAgency",
125
+ requestFormat: "json",
126
+ parameters: [
127
+ {
128
+ name: "agencyId",
129
+ type: "Path",
130
+ schema: z.string().uuid(),
131
+ },
132
+ ],
133
+ response: z.void(),
134
+ },
135
+ {
136
+ method: "post",
137
+ path: "/agency/:agencyId/activate",
138
+ alias: "activateAgency",
139
+ requestFormat: "json",
140
+ parameters: [
141
+ {
142
+ name: "agencyId",
143
+ type: "Path",
144
+ schema: z.string().uuid(),
145
+ },
146
+ ],
147
+ response: z.void(),
148
+ },
149
+ {
150
+ method: "get",
151
+ path: "/agency/:agencyId/invitation",
152
+ alias: "getAllInvitations",
153
+ requestFormat: "json",
154
+ parameters: [
155
+ {
156
+ name: "agencyId",
157
+ type: "Path",
158
+ schema: z.string().uuid(),
159
+ },
160
+ ],
161
+ response: z.void(),
162
+ },
163
+ {
164
+ method: "post",
165
+ path: "/agency/:agencyId/invitation",
166
+ alias: "inviteMember",
167
+ requestFormat: "json",
168
+ parameters: [
169
+ {
170
+ name: "body",
171
+ type: "Body",
172
+ schema: InviteMemberRequest,
173
+ },
174
+ {
175
+ name: "agencyId",
176
+ type: "Path",
177
+ schema: z.string().uuid(),
178
+ },
179
+ ],
180
+ response: z.void(),
181
+ },
182
+ {
183
+ method: "post",
184
+ path: "/agency/:agencyId/invitation/:invitationId",
185
+ alias: "inviteAccepted",
186
+ requestFormat: "json",
187
+ parameters: [
188
+ {
189
+ name: "agencyId",
190
+ type: "Path",
191
+ schema: z.string().uuid(),
192
+ },
193
+ {
194
+ name: "invitationId",
195
+ type: "Path",
196
+ schema: z.string().uuid(),
197
+ },
198
+ ],
199
+ response: z.void(),
200
+ },
201
+ {
202
+ method: "put",
203
+ path: "/agency/:agencyId/presigned-urls",
204
+ alias: "generatePresignedUrl",
205
+ requestFormat: "json",
206
+ parameters: [
207
+ {
208
+ name: "body",
209
+ type: "Body",
210
+ schema: PhotoRequest,
211
+ },
212
+ {
213
+ name: "agencyId",
214
+ type: "Path",
215
+ schema: z.string().uuid(),
216
+ },
217
+ ],
218
+ response: z.void(),
219
+ },
220
+ {
221
+ method: "post",
222
+ path: "/agency/:agencyId/presigned-urls/notify/cover",
223
+ alias: "notifyCoverUploadCompletion",
224
+ requestFormat: "json",
225
+ parameters: [
226
+ {
227
+ name: "body",
228
+ type: "Body",
229
+ schema: PhotoRequest,
230
+ },
231
+ {
232
+ name: "agencyId",
233
+ type: "Path",
234
+ schema: z.string().uuid(),
235
+ },
236
+ ],
237
+ response: z.void(),
238
+ },
239
+ {
240
+ method: "post",
241
+ path: "/agency/:agencyId/presigned-urls/notify/logo",
242
+ alias: "notifyLogoUploadCompletion",
243
+ requestFormat: "json",
244
+ parameters: [
245
+ {
246
+ name: "body",
247
+ type: "Body",
248
+ schema: PhotoRequest,
249
+ },
250
+ {
251
+ name: "agencyId",
252
+ type: "Path",
253
+ schema: z.string().uuid(),
254
+ },
255
+ ],
256
+ response: z.void(),
257
+ },
258
+ {
259
+ method: "post",
260
+ path: "/agency/:agencyId/roles",
261
+ alias: "addRole",
262
+ requestFormat: "json",
263
+ parameters: [
264
+ {
265
+ name: "body",
266
+ type: "Body",
267
+ schema: RolesRequest,
268
+ },
269
+ {
270
+ name: "agencyId",
271
+ type: "Path",
272
+ schema: z.string().uuid(),
273
+ },
274
+ ],
275
+ response: z.void(),
276
+ },
277
+ {
278
+ method: "put",
279
+ path: "/agency/:agencyId/roles/:roleId",
280
+ alias: "updateRole",
281
+ requestFormat: "json",
282
+ parameters: [
283
+ {
284
+ name: "body",
285
+ type: "Body",
286
+ schema: RolesRequest,
287
+ },
288
+ {
289
+ name: "agencyId",
290
+ type: "Path",
291
+ schema: z.string().uuid(),
292
+ },
293
+ {
294
+ name: "roleId",
295
+ type: "Path",
296
+ schema: z.number().int(),
297
+ },
298
+ ],
299
+ response: z.void(),
300
+ },
301
+ {
302
+ method: "delete",
303
+ path: "/agency/:agencyId/roles/:roleId",
304
+ alias: "removeRole",
305
+ requestFormat: "json",
306
+ parameters: [
307
+ {
308
+ name: "agencyId",
309
+ type: "Path",
310
+ schema: z.string().uuid(),
311
+ },
312
+ {
313
+ name: "roleId",
314
+ type: "Path",
315
+ schema: z.number().int(),
316
+ },
317
+ ],
318
+ response: z.void(),
319
+ },
320
+ {
321
+ method: "put",
322
+ path: "/agency/:agencyId/social-media",
323
+ alias: "updateSocialUrls",
324
+ requestFormat: "json",
325
+ parameters: [
326
+ {
327
+ name: "body",
328
+ type: "Body",
329
+ schema: SocialMediasRequest,
330
+ },
331
+ {
332
+ name: "agencyId",
333
+ type: "Path",
334
+ schema: z.string().uuid(),
335
+ },
336
+ ],
337
+ response: z.void(),
338
+ },
358
339
  ]);
359
340
 
360
341
  export const api = new Zodios(endpoints);
361
342
 
362
343
  export function createApiClient(baseUrl: string, options?: ZodiosOptions) {
363
- return new Zodios(baseUrl, endpoints, options);
344
+ return new Zodios(baseUrl, endpoints, options);
364
345
  }