@homespot-sdk/validators 0.0.641 → 0.0.643

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
@@ -25,6 +25,123 @@ const BatchAssignRoleRequest = z
25
25
  memberIds: z.array(z.string().uuid()).min(1),
26
26
  })
27
27
  .passthrough();
28
+ const ChangeStatusRequest = z
29
+ .object({
30
+ status: z.enum([
31
+ 'NEW',
32
+ 'ATTEMPTED_CONTACT',
33
+ 'CONTACTED',
34
+ 'DISQUALIFIED',
35
+ 'CONVERTED',
36
+ 'LOST',
37
+ ]),
38
+ })
39
+ .passthrough();
40
+ const SourceRequest = z.object({ sourceUrl: z.string().min(1) }).passthrough();
41
+ const PriceRangeRequest = z
42
+ .object({ min: z.number(), max: z.number() })
43
+ .partial()
44
+ .passthrough();
45
+ const LocationRefRequest = z
46
+ .object({
47
+ regionId: z.number().int(),
48
+ cityId: z.number().int(),
49
+ districtId: z.number().int(),
50
+ subDistrictId: z.number().int(),
51
+ streetId: z.number().int(),
52
+ })
53
+ .partial()
54
+ .passthrough();
55
+ const SearchIntentRequest = z
56
+ .object({
57
+ propertyType: z.enum([
58
+ 'HOUSE',
59
+ 'TOWN_HOUSE',
60
+ 'COUNTRY_HOUSE',
61
+ 'VILLA',
62
+ 'COTTAGE',
63
+ 'APARTMENT',
64
+ 'DUPLEX',
65
+ 'TRIPLEX',
66
+ 'SEMI_BASEMENT',
67
+ 'ATTIC',
68
+ 'AGRICULTURAL_LAND',
69
+ 'RESIDENTIAL_LAND',
70
+ 'HOTEL_ROOM',
71
+ 'MOTEL_ROOM',
72
+ 'CO_LIVING_SPACE',
73
+ 'OFFICE',
74
+ 'COMMERCIAL_SPACE',
75
+ 'CO_WORKING_SPACE',
76
+ 'WAREHOUSE',
77
+ 'GARAGE',
78
+ ]),
79
+ dealType: z.enum(['BUY', 'RENT']),
80
+ budget: PriceRangeRequest.optional(),
81
+ targetLocation: LocationRefRequest.optional(),
82
+ area: z.number().optional(),
83
+ numberOfRooms: z.number().int().optional(),
84
+ })
85
+ .passthrough();
86
+ const UpdateNoteRequest = z.object({ note: z.string().min(1) }).passthrough();
87
+ const CoordinatesRequest = z
88
+ .object({
89
+ lat: z.number().gte(-90).lte(90),
90
+ lng: z.number().gte(-90).lte(90),
91
+ })
92
+ .passthrough();
93
+ const AddressRefRequest = z
94
+ .object({
95
+ regionId: z.number().int().optional(),
96
+ cityId: z.number().int().optional(),
97
+ districtId: z.number().int().optional(),
98
+ subDistrictId: z.number().int().optional(),
99
+ streetId: z.number().int().optional(),
100
+ coordinates: CoordinatesRequest,
101
+ })
102
+ .passthrough();
103
+ const ListingIntentRequest = z
104
+ .object({
105
+ propertyType: z.enum([
106
+ 'HOUSE',
107
+ 'TOWN_HOUSE',
108
+ 'COUNTRY_HOUSE',
109
+ 'VILLA',
110
+ 'COTTAGE',
111
+ 'APARTMENT',
112
+ 'DUPLEX',
113
+ 'TRIPLEX',
114
+ 'SEMI_BASEMENT',
115
+ 'ATTIC',
116
+ 'AGRICULTURAL_LAND',
117
+ 'RESIDENTIAL_LAND',
118
+ 'HOTEL_ROOM',
119
+ 'MOTEL_ROOM',
120
+ 'CO_LIVING_SPACE',
121
+ 'OFFICE',
122
+ 'COMMERCIAL_SPACE',
123
+ 'CO_WORKING_SPACE',
124
+ 'WAREHOUSE',
125
+ 'GARAGE',
126
+ ]),
127
+ dealType: z.enum(['BUY', 'RENT']),
128
+ desiredPrice: PriceRangeRequest.optional(),
129
+ address: AddressRefRequest.optional(),
130
+ area: z.number().optional(),
131
+ numberOfRooms: z.number().int().optional(),
132
+ })
133
+ .passthrough();
134
+ const ContactInfoRequest = z
135
+ .object({
136
+ firstName: z.string().optional(),
137
+ lastName: z.string().optional(),
138
+ email: z.string().email().optional(),
139
+ phone: z.string().min(1),
140
+ })
141
+ .passthrough();
142
+ const AssignToMemberRequest = z
143
+ .object({ memberId: z.string().uuid() })
144
+ .passthrough();
28
145
  const AddressRequest = z
29
146
  .object({
30
147
  country: z.string().min(0).max(100),
@@ -60,8 +177,15 @@ const SocialMediaRequest = z
60
177
  const SocialMediasRequest = z
61
178
  .object({ data: z.array(SocialMediaRequest).min(1).max(5) })
62
179
  .passthrough();
180
+ const CreateLeadRequest = z
181
+ .object({
182
+ contactInfo: ContactInfoRequest,
183
+ note: z.string().min(0).max(500).optional(),
184
+ sourceUrl: z.string().optional(),
185
+ })
186
+ .passthrough();
63
187
  const InvitationDetailsRequest = z
64
- .object({ email: z.string().min(1), roleId: z.number().int() })
188
+ .object({ email: z.string().email(), roleId: z.number().int() })
65
189
  .passthrough();
66
190
  const InviteMemberRequest = z
67
191
  .object({ emails: z.array(InvitationDetailsRequest).min(1) })
@@ -141,18 +265,18 @@ const SortObject = z
141
265
  const PageableObject = z
142
266
  .object({
143
267
  offset: z.number().int(),
268
+ unpaged: z.boolean(),
144
269
  paged: z.boolean(),
145
270
  pageNumber: z.number().int(),
146
271
  pageSize: z.number().int(),
147
272
  sort: SortObject,
148
- unpaged: z.boolean(),
149
273
  })
150
274
  .partial()
151
275
  .passthrough();
152
276
  const PageRoleResponse = z
153
277
  .object({
154
- totalElements: z.number().int(),
155
278
  totalPages: z.number().int(),
279
+ totalElements: z.number().int(),
156
280
  size: z.number().int(),
157
281
  content: z.array(RoleResponse),
158
282
  number: z.number().int(),
@@ -203,26 +327,6 @@ const PagedModelAgencySummaryResponse = z
203
327
  .object({ content: z.array(AgencySummaryResponse), page: PageMetadata })
204
328
  .partial()
205
329
  .passthrough();
206
- const AddressViewResponse = z
207
- .object({
208
- country: z.string(),
209
- city: z.string(),
210
- district: z.string(),
211
- subdistrict: z.string(),
212
- street: z.string(),
213
- })
214
- .passthrough();
215
- const AgencyProfileResponse = z
216
- .object({
217
- name: z.string(),
218
- email: z.string(),
219
- seats: z.number().int(),
220
- subDomain: z.string(),
221
- phone: z.string(),
222
- address: AddressViewResponse,
223
- yearSince: z.number().int(),
224
- })
225
- .passthrough();
226
330
  const PermissionResponse = z
227
331
  .object({
228
332
  permission: z.enum([
@@ -269,6 +373,122 @@ const PagedModelMemberViewResponse = z
269
373
  .object({ content: z.array(MemberViewResponse), page: PageMetadata })
270
374
  .partial()
271
375
  .passthrough();
376
+ const SearchIntentResponse = z
377
+ .object({
378
+ propertyType: z.enum([
379
+ 'HOUSE',
380
+ 'TOWN_HOUSE',
381
+ 'COUNTRY_HOUSE',
382
+ 'VILLA',
383
+ 'COTTAGE',
384
+ 'APARTMENT',
385
+ 'DUPLEX',
386
+ 'TRIPLEX',
387
+ 'SEMI_BASEMENT',
388
+ 'ATTIC',
389
+ 'AGRICULTURAL_LAND',
390
+ 'RESIDENTIAL_LAND',
391
+ 'HOTEL_ROOM',
392
+ 'MOTEL_ROOM',
393
+ 'CO_LIVING_SPACE',
394
+ 'OFFICE',
395
+ 'COMMERCIAL_SPACE',
396
+ 'CO_WORKING_SPACE',
397
+ 'WAREHOUSE',
398
+ 'GARAGE',
399
+ ]),
400
+ dealType: z.enum(['BUY', 'RENT']),
401
+ budgetMin: z.number().optional(),
402
+ budgetMax: z.number().optional(),
403
+ regionId: z.number().int().optional(),
404
+ cityId: z.number().int().optional(),
405
+ districtId: z.number().int().optional(),
406
+ subDistrictId: z.number().int().optional(),
407
+ streetId: z.number().int().optional(),
408
+ area: z.number().optional(),
409
+ numberOfRooms: z.number().int().optional(),
410
+ })
411
+ .passthrough();
412
+ const ListingIntentResponse = z
413
+ .object({
414
+ propertyType: z.enum([
415
+ 'HOUSE',
416
+ 'TOWN_HOUSE',
417
+ 'COUNTRY_HOUSE',
418
+ 'VILLA',
419
+ 'COTTAGE',
420
+ 'APARTMENT',
421
+ 'DUPLEX',
422
+ 'TRIPLEX',
423
+ 'SEMI_BASEMENT',
424
+ 'ATTIC',
425
+ 'AGRICULTURAL_LAND',
426
+ 'RESIDENTIAL_LAND',
427
+ 'HOTEL_ROOM',
428
+ 'MOTEL_ROOM',
429
+ 'CO_LIVING_SPACE',
430
+ 'OFFICE',
431
+ 'COMMERCIAL_SPACE',
432
+ 'CO_WORKING_SPACE',
433
+ 'WAREHOUSE',
434
+ 'GARAGE',
435
+ ]),
436
+ dealType: z.enum(['BUY', 'RENT']),
437
+ desiredPriceMin: z.number().optional(),
438
+ desiredPriceMax: z.number().optional(),
439
+ regionId: z.number().int().optional(),
440
+ cityId: z.number().int().optional(),
441
+ districtId: z.number().int().optional(),
442
+ subDistrictId: z.number().int().optional(),
443
+ streetId: z.number().int().optional(),
444
+ lat: z.number().optional(),
445
+ lng: z.number().optional(),
446
+ area: z.number().optional(),
447
+ numberOfRooms: z.number().int().optional(),
448
+ })
449
+ .passthrough();
450
+ const LeadProjectionResponse = z
451
+ .object({
452
+ id: z.string().uuid(),
453
+ createdBy: z.string().uuid(),
454
+ assignedTo: z.string().uuid().optional(),
455
+ status: z.enum([
456
+ 'NEW',
457
+ 'ATTEMPTED_CONTACT',
458
+ 'CONTACTED',
459
+ 'DISQUALIFIED',
460
+ 'CONVERTED',
461
+ 'LOST',
462
+ ]),
463
+ contactFullName: z.string().optional(),
464
+ contactPhoneNumber: z.string(),
465
+ contactEmail: z.string().optional(),
466
+ noteTitle: z.string().optional(),
467
+ noteContent: z.string().optional(),
468
+ sourceType: z.string().optional(),
469
+ sourceLink: z.string().optional(),
470
+ isSearcher: z.boolean(),
471
+ isLister: z.boolean(),
472
+ searchIntents: z.array(SearchIntentResponse).optional(),
473
+ listingIntents: z.array(ListingIntentResponse).optional(),
474
+ })
475
+ .passthrough();
476
+ const PageLeadProjectionResponse = z
477
+ .object({
478
+ totalPages: z.number().int(),
479
+ totalElements: z.number().int(),
480
+ size: z.number().int(),
481
+ content: z.array(LeadProjectionResponse),
482
+ number: z.number().int(),
483
+ first: z.boolean(),
484
+ last: z.boolean(),
485
+ numberOfElements: z.number().int(),
486
+ pageable: PageableObject,
487
+ sort: SortObject,
488
+ empty: z.boolean(),
489
+ })
490
+ .partial()
491
+ .passthrough();
272
492
  const InvitationViewResponse = z
273
493
  .object({
274
494
  invitationId: z.string().uuid(),
@@ -284,15 +504,47 @@ const PagedModelInvitationViewResponse = z
284
504
  .object({ content: z.array(InvitationViewResponse), page: PageMetadata })
285
505
  .partial()
286
506
  .passthrough();
507
+ const AddressViewResponse = z
508
+ .object({
509
+ country: z.string(),
510
+ city: z.string(),
511
+ district: z.string(),
512
+ subdistrict: z.string(),
513
+ street: z.string(),
514
+ })
515
+ .passthrough();
516
+ const AgencyProfileResponse = z
517
+ .object({
518
+ name: z.string(),
519
+ email: z.string(),
520
+ seats: z.number().int(),
521
+ subDomain: z.string(),
522
+ phone: z.string(),
523
+ address: AddressViewResponse,
524
+ yearSince: z.number().int(),
525
+ })
526
+ .passthrough();
287
527
 
288
528
  export const schemas = {
289
529
  RolesRequest,
290
530
  AssignRoleRequest,
291
531
  BatchAssignRoleRequest,
532
+ ChangeStatusRequest,
533
+ SourceRequest,
534
+ PriceRangeRequest,
535
+ LocationRefRequest,
536
+ SearchIntentRequest,
537
+ UpdateNoteRequest,
538
+ CoordinatesRequest,
539
+ AddressRefRequest,
540
+ ListingIntentRequest,
541
+ ContactInfoRequest,
542
+ AssignToMemberRequest,
292
543
  AddressRequest,
293
544
  CreateAgencyRequest,
294
545
  SocialMediaRequest,
295
546
  SocialMediasRequest,
547
+ CreateLeadRequest,
296
548
  InvitationDetailsRequest,
297
549
  InviteMemberRequest,
298
550
  PhotoRequest,
@@ -311,14 +563,18 @@ export const schemas = {
311
563
  AgencySummaryResponse,
312
564
  PageMetadata,
313
565
  PagedModelAgencySummaryResponse,
314
- AddressViewResponse,
315
- AgencyProfileResponse,
316
566
  PermissionResponse,
317
567
  GroupedPermissionsResponse,
318
568
  MemberViewResponse,
319
569
  PagedModelMemberViewResponse,
570
+ SearchIntentResponse,
571
+ ListingIntentResponse,
572
+ LeadProjectionResponse,
573
+ PageLeadProjectionResponse,
320
574
  InvitationViewResponse,
321
575
  PagedModelInvitationViewResponse,
576
+ AddressViewResponse,
577
+ AgencyProfileResponse,
322
578
  };
323
579
 
324
580
  const endpoints = makeApi([
@@ -336,6 +592,20 @@ const endpoints = makeApi([
336
592
  ],
337
593
  response: z.void(),
338
594
  },
595
+ {
596
+ method: 'get',
597
+ path: '/agency/:agencyId',
598
+ alias: 'getAgency',
599
+ requestFormat: 'json',
600
+ parameters: [
601
+ {
602
+ name: 'agencyId',
603
+ type: 'Path',
604
+ schema: z.string().uuid(),
605
+ },
606
+ ],
607
+ response: z.void(),
608
+ },
339
609
  {
340
610
  method: 'put',
341
611
  path: '/agency/:agencyId/activate',
@@ -485,6 +755,289 @@ const endpoints = makeApi([
485
755
  ],
486
756
  response: z.void(),
487
757
  },
758
+ {
759
+ method: 'get',
760
+ path: '/lead',
761
+ alias: 'searchLeads',
762
+ requestFormat: 'json',
763
+ parameters: [
764
+ {
765
+ name: 'status',
766
+ type: 'Query',
767
+ schema: z
768
+ .enum([
769
+ 'NEW',
770
+ 'ATTEMPTED_CONTACT',
771
+ 'CONTACTED',
772
+ 'DISQUALIFIED',
773
+ 'CONVERTED',
774
+ 'LOST',
775
+ ])
776
+ .optional(),
777
+ },
778
+ {
779
+ name: 'isSearcher',
780
+ type: 'Query',
781
+ schema: z.boolean().optional(),
782
+ },
783
+ {
784
+ name: 'isLister',
785
+ type: 'Query',
786
+ schema: z.boolean().optional(),
787
+ },
788
+ {
789
+ name: 'page',
790
+ type: 'Query',
791
+ schema: z.number().int().gte(0).optional().default(0),
792
+ },
793
+ {
794
+ name: 'size',
795
+ type: 'Query',
796
+ schema: z.number().int().gte(1).optional().default(20),
797
+ },
798
+ {
799
+ name: 'sort',
800
+ type: 'Query',
801
+ schema: z.array(z.string()).optional(),
802
+ },
803
+ ],
804
+ response: z.void(),
805
+ },
806
+ {
807
+ method: 'post',
808
+ path: '/lead',
809
+ alias: 'createLead',
810
+ requestFormat: 'json',
811
+ parameters: [
812
+ {
813
+ name: 'body',
814
+ type: 'Body',
815
+ schema: CreateLeadRequest,
816
+ },
817
+ ],
818
+ response: z.void(),
819
+ },
820
+ {
821
+ method: 'get',
822
+ path: '/lead/:leadId',
823
+ alias: 'getLeadById',
824
+ requestFormat: 'json',
825
+ parameters: [
826
+ {
827
+ name: 'leadId',
828
+ type: 'Path',
829
+ schema: z.string().uuid(),
830
+ },
831
+ ],
832
+ response: z.void(),
833
+ },
834
+ {
835
+ method: 'delete',
836
+ path: '/lead/:leadId',
837
+ alias: 'removeIntent',
838
+ requestFormat: 'json',
839
+ parameters: [
840
+ {
841
+ name: 'leadId',
842
+ type: 'Path',
843
+ schema: z.string().uuid(),
844
+ },
845
+ {
846
+ name: 'index',
847
+ type: 'Query',
848
+ schema: z.number().int(),
849
+ },
850
+ {
851
+ name: 'type',
852
+ type: 'Query',
853
+ schema: z.enum(['SEARCH', 'LISTING']),
854
+ },
855
+ ],
856
+ response: z.void(),
857
+ },
858
+ {
859
+ method: 'put',
860
+ path: '/lead/:leadId/assign',
861
+ alias: 'assignToAgent',
862
+ requestFormat: 'json',
863
+ parameters: [
864
+ {
865
+ name: 'body',
866
+ type: 'Body',
867
+ schema: z.object({ memberId: z.string().uuid() }).passthrough(),
868
+ },
869
+ {
870
+ name: 'leadId',
871
+ type: 'Path',
872
+ schema: z.string().uuid(),
873
+ },
874
+ ],
875
+ response: z.void(),
876
+ },
877
+ {
878
+ method: 'put',
879
+ path: '/lead/:leadId/contact-info',
880
+ alias: 'updateContactInfo',
881
+ requestFormat: 'json',
882
+ parameters: [
883
+ {
884
+ name: 'body',
885
+ type: 'Body',
886
+ schema: ContactInfoRequest,
887
+ },
888
+ {
889
+ name: 'leadId',
890
+ type: 'Path',
891
+ schema: z.string().uuid(),
892
+ },
893
+ ],
894
+ response: z.void(),
895
+ },
896
+ {
897
+ method: 'put',
898
+ path: '/lead/:leadId/listing-intents',
899
+ alias: 'updateListingIntent',
900
+ requestFormat: 'json',
901
+ parameters: [
902
+ {
903
+ name: 'body',
904
+ type: 'Body',
905
+ schema: ListingIntentRequest,
906
+ },
907
+ {
908
+ name: 'leadId',
909
+ type: 'Path',
910
+ schema: z.string().uuid(),
911
+ },
912
+ {
913
+ name: 'index',
914
+ type: 'Query',
915
+ schema: z.number().int(),
916
+ },
917
+ ],
918
+ response: z.void(),
919
+ },
920
+ {
921
+ method: 'post',
922
+ path: '/lead/:leadId/listing-intents',
923
+ alias: 'addListingIntent',
924
+ requestFormat: 'json',
925
+ parameters: [
926
+ {
927
+ name: 'body',
928
+ type: 'Body',
929
+ schema: ListingIntentRequest,
930
+ },
931
+ {
932
+ name: 'leadId',
933
+ type: 'Path',
934
+ schema: z.string().uuid(),
935
+ },
936
+ ],
937
+ response: z.void(),
938
+ },
939
+ {
940
+ method: 'put',
941
+ path: '/lead/:leadId/note',
942
+ alias: 'updateNote',
943
+ requestFormat: 'json',
944
+ parameters: [
945
+ {
946
+ name: 'body',
947
+ type: 'Body',
948
+ schema: z.object({ note: z.string().min(1) }).passthrough(),
949
+ },
950
+ {
951
+ name: 'leadId',
952
+ type: 'Path',
953
+ schema: z.string().uuid(),
954
+ },
955
+ ],
956
+ response: z.void(),
957
+ },
958
+ {
959
+ method: 'put',
960
+ path: '/lead/:leadId/search-intents',
961
+ alias: 'updateSearchIntent',
962
+ requestFormat: 'json',
963
+ parameters: [
964
+ {
965
+ name: 'body',
966
+ type: 'Body',
967
+ schema: SearchIntentRequest,
968
+ },
969
+ {
970
+ name: 'leadId',
971
+ type: 'Path',
972
+ schema: z.string().uuid(),
973
+ },
974
+ {
975
+ name: 'index',
976
+ type: 'Query',
977
+ schema: z.number().int(),
978
+ },
979
+ ],
980
+ response: z.void(),
981
+ },
982
+ {
983
+ method: 'post',
984
+ path: '/lead/:leadId/search-intents',
985
+ alias: 'addSearchIntent',
986
+ requestFormat: 'json',
987
+ parameters: [
988
+ {
989
+ name: 'body',
990
+ type: 'Body',
991
+ schema: SearchIntentRequest,
992
+ },
993
+ {
994
+ name: 'leadId',
995
+ type: 'Path',
996
+ schema: z.string().uuid(),
997
+ },
998
+ ],
999
+ response: z.void(),
1000
+ },
1001
+ {
1002
+ method: 'put',
1003
+ path: '/lead/:leadId/source',
1004
+ alias: 'updateSource',
1005
+ requestFormat: 'json',
1006
+ parameters: [
1007
+ {
1008
+ name: 'body',
1009
+ type: 'Body',
1010
+ schema: z
1011
+ .object({ sourceUrl: z.string().min(1) })
1012
+ .passthrough(),
1013
+ },
1014
+ {
1015
+ name: 'leadId',
1016
+ type: 'Path',
1017
+ schema: z.string().uuid(),
1018
+ },
1019
+ ],
1020
+ response: z.void(),
1021
+ },
1022
+ {
1023
+ method: 'put',
1024
+ path: '/lead/:leadId/status',
1025
+ alias: 'changeStatus',
1026
+ requestFormat: 'json',
1027
+ parameters: [
1028
+ {
1029
+ name: 'body',
1030
+ type: 'Body',
1031
+ schema: ChangeStatusRequest,
1032
+ },
1033
+ {
1034
+ name: 'leadId',
1035
+ type: 'Path',
1036
+ schema: z.string().uuid(),
1037
+ },
1038
+ ],
1039
+ response: z.void(),
1040
+ },
488
1041
  {
489
1042
  method: 'get',
490
1043
  path: '/member',
@@ -581,20 +1134,6 @@ const endpoints = makeApi([
581
1134
  ],
582
1135
  response: z.void(),
583
1136
  },
584
- {
585
- method: 'get',
586
- path: '/public/agency/:agencyId',
587
- alias: 'getAgency',
588
- requestFormat: 'json',
589
- parameters: [
590
- {
591
- name: 'agencyId',
592
- type: 'Path',
593
- schema: z.string().uuid(),
594
- },
595
- ],
596
- response: z.void(),
597
- },
598
1137
  {
599
1138
  method: 'get',
600
1139
  path: '/public/agency/roles/permissions',