@planpoint/sdk 0.1.0 → 0.1.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 (3) hide show
  1. package/dist/index.d.ts +1010 -22
  2. package/dist/index.js +150 -1
  3. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -308,6 +308,19 @@ type Options$1<TData extends TDataShape = TDataShape, ThrowOnError extends boole
308
308
  type ClientOptions = {
309
309
  baseUrl: 'https://app.planpoint.io' | (string & {});
310
310
  };
311
+ type LoginResponse = {
312
+ message: string;
313
+ access_token: string;
314
+ };
315
+ type ErrorResponse = {
316
+ message: string;
317
+ paused?: boolean;
318
+ };
319
+ type LoginBody = {
320
+ username: string;
321
+ password?: string;
322
+ impersonate?: boolean;
323
+ };
311
324
  type UnitModel = {
312
325
  _id: string;
313
326
  name?: string;
@@ -396,14 +409,161 @@ type Project = {
396
409
  customDomain?: string;
397
410
  sharePageEnabled?: boolean;
398
411
  };
399
- type ErrorResponse = {
400
- message: string;
401
- paused?: boolean;
402
- };
403
412
  type FindProjectBody = {
404
413
  namespace: string;
405
414
  hostName: string;
406
415
  };
416
+ type ProjectSummary = {
417
+ _id: string;
418
+ name: string;
419
+ namespace: string;
420
+ hostName: string;
421
+ projectType?: string;
422
+ status?: string;
423
+ statusOverride?: string;
424
+ paused?: boolean;
425
+ createdAt?: string;
426
+ };
427
+ type UpdateProjectBody = {
428
+ [key: string]: unknown;
429
+ };
430
+ type GroupProject = {
431
+ _id: string;
432
+ name: string;
433
+ namespace?: string;
434
+ hostName?: string;
435
+ paused?: boolean;
436
+ };
437
+ type Group = {
438
+ _id: string;
439
+ name: string;
440
+ namespace?: string;
441
+ hostName?: string;
442
+ type?: string;
443
+ propertyType?: string;
444
+ user: string;
445
+ projects?: Array<GroupProject>;
446
+ isOwner?: boolean;
447
+ isAdmin?: boolean;
448
+ isEditor?: boolean;
449
+ };
450
+ type GroupsListResponse = {
451
+ records: Array<Group>;
452
+ count: number;
453
+ };
454
+ type CreateGroupBody = {
455
+ name: string;
456
+ namespace?: string;
457
+ hostName?: string;
458
+ type?: string;
459
+ propertyType?: string;
460
+ };
461
+ type UpdateGroupBody = {
462
+ [key: string]: unknown;
463
+ };
464
+ type FloorFull = {
465
+ _id: string;
466
+ name?: string;
467
+ project: string;
468
+ level?: number;
469
+ position?: number;
470
+ path?: string;
471
+ alternativePaths?: Array<string>;
472
+ image?: string;
473
+ };
474
+ type CreateFloorBody = {
475
+ project: {
476
+ _id: string;
477
+ };
478
+ name: string;
479
+ position?: number;
480
+ path?: string;
481
+ alternativePaths?: Array<string>;
482
+ };
483
+ type UpdateFloorBody = {
484
+ [key: string]: unknown;
485
+ };
486
+ type UnitFull = {
487
+ _id: string;
488
+ floor: string;
489
+ name?: string;
490
+ unitNumber?: string;
491
+ status?: 'Available' | 'OnHold' | 'Sold' | 'Leased' | 'Unavailable';
492
+ price?: number;
493
+ bed?: number;
494
+ bath?: number;
495
+ sqft?: number;
496
+ model?: string;
497
+ orientation?: string;
498
+ parking?: number;
499
+ };
500
+ type UnitsListResponse = {
501
+ records: Array<UnitFull>;
502
+ count: number;
503
+ };
504
+ type CreateUnitBody = {
505
+ floor: {
506
+ _id: string;
507
+ };
508
+ };
509
+ type BatchUpdateUnitsBody = {
510
+ ids: Array<string>;
511
+ patchData: {
512
+ [key: string]: unknown;
513
+ };
514
+ };
515
+ type UpdateUnitBody = {
516
+ [key: string]: unknown;
517
+ };
518
+ type Lead = {
519
+ _id?: string;
520
+ name?: string;
521
+ email?: string;
522
+ phone?: string;
523
+ message?: string;
524
+ unit?: string;
525
+ createdAt?: string;
526
+ };
527
+ type LoginData = {
528
+ body: LoginBody;
529
+ path?: never;
530
+ query?: never;
531
+ url: '/api/users/login';
532
+ };
533
+ type LoginErrors = {
534
+ /**
535
+ * Bad request
536
+ */
537
+ 400: ErrorResponse;
538
+ /**
539
+ * Unauthorized
540
+ */
541
+ 401: ErrorResponse;
542
+ /**
543
+ * Forbidden
544
+ */
545
+ 403: ErrorResponse;
546
+ /**
547
+ * Not found
548
+ */
549
+ 404: ErrorResponse;
550
+ /**
551
+ * Method not allowed
552
+ */
553
+ 405: ErrorResponse;
554
+ /**
555
+ * Internal server error
556
+ */
557
+ 500: ErrorResponse;
558
+ };
559
+ type LoginError = LoginErrors[keyof LoginErrors];
560
+ type LoginResponses = {
561
+ /**
562
+ * Login successful
563
+ */
564
+ 200: LoginResponse;
565
+ };
566
+ type LoginResponse2 = LoginResponses[keyof LoginResponses];
407
567
  type FindProjectData = {
408
568
  body: FindProjectBody;
409
569
  path?: never;
@@ -412,11 +572,19 @@ type FindProjectData = {
412
572
  };
413
573
  type FindProjectErrors = {
414
574
  /**
415
- * Validation error or project is paused
575
+ * Bad request
416
576
  */
417
577
  400: ErrorResponse;
418
578
  /**
419
- * Project not found
579
+ * Unauthorized
580
+ */
581
+ 401: ErrorResponse;
582
+ /**
583
+ * Forbidden
584
+ */
585
+ 403: ErrorResponse;
586
+ /**
587
+ * Not found
420
588
  */
421
589
  404: ErrorResponse;
422
590
  /**
@@ -436,25 +604,845 @@ type FindProjectResponses = {
436
604
  201: Project;
437
605
  };
438
606
  type FindProjectResponse = FindProjectResponses[keyof FindProjectResponses];
439
-
440
- type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options$1<TData, ThrowOnError> & {
607
+ type GetMyProjectsData = {
608
+ body?: never;
609
+ path?: never;
610
+ query?: never;
611
+ url: '/api/projects/mine';
612
+ };
613
+ type GetMyProjectsErrors = {
441
614
  /**
442
- * You can provide a client instance returned by `createClient()` instead of
443
- * individual options. This might be also useful if you want to implement a
444
- * custom client.
615
+ * Bad request
445
616
  */
446
- client?: Client;
617
+ 400: ErrorResponse;
447
618
  /**
448
- * You can pass arbitrary values through the `meta` object. This can be
449
- * used to access values that aren't defined as part of the SDK function.
619
+ * Unauthorized
450
620
  */
451
- meta?: Record<string, unknown>;
621
+ 401: ErrorResponse;
622
+ /**
623
+ * Forbidden
624
+ */
625
+ 403: ErrorResponse;
626
+ /**
627
+ * Not found
628
+ */
629
+ 404: ErrorResponse;
630
+ /**
631
+ * Method not allowed
632
+ */
633
+ 405: ErrorResponse;
634
+ /**
635
+ * Internal server error
636
+ */
637
+ 500: ErrorResponse;
452
638
  };
453
- /**
454
- * Find a project by namespace and hostname
455
- *
456
- * Returns the full project document including populated floors, units, commercial spaces, and collections. Sensitive fields (credentials, leads, admin lists) are stripped from the response.
457
- */
458
- declare const findProject: <ThrowOnError extends boolean = false>(options: Options<FindProjectData, ThrowOnError>) => RequestResult<FindProjectResponses, FindProjectErrors, ThrowOnError, "fields">;
639
+ type GetMyProjectsError = GetMyProjectsErrors[keyof GetMyProjectsErrors];
640
+ type GetMyProjectsResponses = {
641
+ /**
642
+ * Projects list
643
+ */
644
+ 201: Array<ProjectSummary>;
645
+ };
646
+ type GetMyProjectsResponse = GetMyProjectsResponses[keyof GetMyProjectsResponses];
647
+ type GetProjectData = {
648
+ body?: never;
649
+ path: {
650
+ id: string;
651
+ };
652
+ query?: never;
653
+ url: '/api/projects/{id}';
654
+ };
655
+ type GetProjectErrors = {
656
+ /**
657
+ * Bad request
658
+ */
659
+ 400: ErrorResponse;
660
+ /**
661
+ * Unauthorized
662
+ */
663
+ 401: ErrorResponse;
664
+ /**
665
+ * Forbidden
666
+ */
667
+ 403: ErrorResponse;
668
+ /**
669
+ * Not found
670
+ */
671
+ 404: ErrorResponse;
672
+ /**
673
+ * Method not allowed
674
+ */
675
+ 405: ErrorResponse;
676
+ /**
677
+ * Internal server error
678
+ */
679
+ 500: ErrorResponse;
680
+ };
681
+ type GetProjectError = GetProjectErrors[keyof GetProjectErrors];
682
+ type GetProjectResponses = {
683
+ /**
684
+ * Project
685
+ */
686
+ 201: Project;
687
+ };
688
+ type GetProjectResponse = GetProjectResponses[keyof GetProjectResponses];
689
+ type UpdateProjectData = {
690
+ body: UpdateProjectBody;
691
+ path: {
692
+ id: string;
693
+ };
694
+ query?: never;
695
+ url: '/api/projects/{id}';
696
+ };
697
+ type UpdateProjectErrors = {
698
+ /**
699
+ * Bad request
700
+ */
701
+ 400: ErrorResponse;
702
+ /**
703
+ * Unauthorized
704
+ */
705
+ 401: ErrorResponse;
706
+ /**
707
+ * Forbidden
708
+ */
709
+ 403: ErrorResponse;
710
+ /**
711
+ * Not found
712
+ */
713
+ 404: ErrorResponse;
714
+ /**
715
+ * Method not allowed
716
+ */
717
+ 405: ErrorResponse;
718
+ /**
719
+ * Internal server error
720
+ */
721
+ 500: ErrorResponse;
722
+ };
723
+ type UpdateProjectError = UpdateProjectErrors[keyof UpdateProjectErrors];
724
+ type UpdateProjectResponses = {
725
+ /**
726
+ * Updated project
727
+ */
728
+ 201: Project;
729
+ };
730
+ type UpdateProjectResponse = UpdateProjectResponses[keyof UpdateProjectResponses];
731
+ type GetGroupsData = {
732
+ body?: never;
733
+ path?: never;
734
+ query?: never;
735
+ url: '/api/groups';
736
+ };
737
+ type GetGroupsErrors = {
738
+ /**
739
+ * Bad request
740
+ */
741
+ 400: ErrorResponse;
742
+ /**
743
+ * Unauthorized
744
+ */
745
+ 401: ErrorResponse;
746
+ /**
747
+ * Forbidden
748
+ */
749
+ 403: ErrorResponse;
750
+ /**
751
+ * Not found
752
+ */
753
+ 404: ErrorResponse;
754
+ /**
755
+ * Method not allowed
756
+ */
757
+ 405: ErrorResponse;
758
+ /**
759
+ * Internal server error
760
+ */
761
+ 500: ErrorResponse;
762
+ };
763
+ type GetGroupsError = GetGroupsErrors[keyof GetGroupsErrors];
764
+ type GetGroupsResponses = {
765
+ /**
766
+ * Groups list
767
+ */
768
+ 201: GroupsListResponse;
769
+ };
770
+ type GetGroupsResponse = GetGroupsResponses[keyof GetGroupsResponses];
771
+ type CreateGroupData = {
772
+ body: CreateGroupBody;
773
+ path?: never;
774
+ query?: never;
775
+ url: '/api/groups';
776
+ };
777
+ type CreateGroupErrors = {
778
+ /**
779
+ * Bad request
780
+ */
781
+ 400: ErrorResponse;
782
+ /**
783
+ * Unauthorized
784
+ */
785
+ 401: ErrorResponse;
786
+ /**
787
+ * Forbidden
788
+ */
789
+ 403: ErrorResponse;
790
+ /**
791
+ * Not found
792
+ */
793
+ 404: ErrorResponse;
794
+ /**
795
+ * Method not allowed
796
+ */
797
+ 405: ErrorResponse;
798
+ /**
799
+ * Internal server error
800
+ */
801
+ 500: ErrorResponse;
802
+ };
803
+ type CreateGroupError = CreateGroupErrors[keyof CreateGroupErrors];
804
+ type CreateGroupResponses = {
805
+ /**
806
+ * Created group
807
+ */
808
+ 201: Group;
809
+ };
810
+ type CreateGroupResponse = CreateGroupResponses[keyof CreateGroupResponses];
811
+ type GetGroupData = {
812
+ body?: never;
813
+ path: {
814
+ id: string;
815
+ };
816
+ query?: never;
817
+ url: '/api/groups/{id}';
818
+ };
819
+ type GetGroupErrors = {
820
+ /**
821
+ * Bad request
822
+ */
823
+ 400: ErrorResponse;
824
+ /**
825
+ * Unauthorized
826
+ */
827
+ 401: ErrorResponse;
828
+ /**
829
+ * Forbidden
830
+ */
831
+ 403: ErrorResponse;
832
+ /**
833
+ * Not found
834
+ */
835
+ 404: ErrorResponse;
836
+ /**
837
+ * Method not allowed
838
+ */
839
+ 405: ErrorResponse;
840
+ /**
841
+ * Internal server error
842
+ */
843
+ 500: ErrorResponse;
844
+ };
845
+ type GetGroupError = GetGroupErrors[keyof GetGroupErrors];
846
+ type GetGroupResponses = {
847
+ /**
848
+ * Group
849
+ */
850
+ 201: Group;
851
+ };
852
+ type GetGroupResponse = GetGroupResponses[keyof GetGroupResponses];
853
+ type UpdateGroupData = {
854
+ body: UpdateGroupBody;
855
+ path: {
856
+ id: string;
857
+ };
858
+ query?: never;
859
+ url: '/api/groups/{id}';
860
+ };
861
+ type UpdateGroupErrors = {
862
+ /**
863
+ * Bad request
864
+ */
865
+ 400: ErrorResponse;
866
+ /**
867
+ * Unauthorized
868
+ */
869
+ 401: ErrorResponse;
870
+ /**
871
+ * Forbidden
872
+ */
873
+ 403: ErrorResponse;
874
+ /**
875
+ * Not found
876
+ */
877
+ 404: ErrorResponse;
878
+ /**
879
+ * Method not allowed
880
+ */
881
+ 405: ErrorResponse;
882
+ /**
883
+ * Internal server error
884
+ */
885
+ 500: ErrorResponse;
886
+ };
887
+ type UpdateGroupError = UpdateGroupErrors[keyof UpdateGroupErrors];
888
+ type UpdateGroupResponses = {
889
+ /**
890
+ * Updated group
891
+ */
892
+ 201: Group;
893
+ };
894
+ type UpdateGroupResponse = UpdateGroupResponses[keyof UpdateGroupResponses];
895
+ type GetFloorsData = {
896
+ body?: never;
897
+ path?: never;
898
+ query: {
899
+ pid: string;
900
+ };
901
+ url: '/api/floors';
902
+ };
903
+ type GetFloorsErrors = {
904
+ /**
905
+ * Bad request
906
+ */
907
+ 400: ErrorResponse;
908
+ /**
909
+ * Unauthorized
910
+ */
911
+ 401: ErrorResponse;
912
+ /**
913
+ * Forbidden
914
+ */
915
+ 403: ErrorResponse;
916
+ /**
917
+ * Not found
918
+ */
919
+ 404: ErrorResponse;
920
+ /**
921
+ * Method not allowed
922
+ */
923
+ 405: ErrorResponse;
924
+ /**
925
+ * Internal server error
926
+ */
927
+ 500: ErrorResponse;
928
+ };
929
+ type GetFloorsError = GetFloorsErrors[keyof GetFloorsErrors];
930
+ type GetFloorsResponses = {
931
+ /**
932
+ * Floors list
933
+ */
934
+ 200: Array<FloorFull>;
935
+ };
936
+ type GetFloorsResponse = GetFloorsResponses[keyof GetFloorsResponses];
937
+ type CreateFloorData = {
938
+ body: CreateFloorBody;
939
+ path?: never;
940
+ query?: never;
941
+ url: '/api/floors';
942
+ };
943
+ type CreateFloorErrors = {
944
+ /**
945
+ * Bad request
946
+ */
947
+ 400: ErrorResponse;
948
+ /**
949
+ * Unauthorized
950
+ */
951
+ 401: ErrorResponse;
952
+ /**
953
+ * Forbidden
954
+ */
955
+ 403: ErrorResponse;
956
+ /**
957
+ * Not found
958
+ */
959
+ 404: ErrorResponse;
960
+ /**
961
+ * Method not allowed
962
+ */
963
+ 405: ErrorResponse;
964
+ /**
965
+ * Internal server error
966
+ */
967
+ 500: ErrorResponse;
968
+ };
969
+ type CreateFloorError = CreateFloorErrors[keyof CreateFloorErrors];
970
+ type CreateFloorResponses = {
971
+ /**
972
+ * Created floor
973
+ */
974
+ 201: FloorFull;
975
+ };
976
+ type CreateFloorResponse = CreateFloorResponses[keyof CreateFloorResponses];
977
+ type GetFloorData = {
978
+ body?: never;
979
+ path: {
980
+ id: string;
981
+ };
982
+ query?: never;
983
+ url: '/api/floors/{id}';
984
+ };
985
+ type GetFloorErrors = {
986
+ /**
987
+ * Bad request
988
+ */
989
+ 400: ErrorResponse;
990
+ /**
991
+ * Unauthorized
992
+ */
993
+ 401: ErrorResponse;
994
+ /**
995
+ * Forbidden
996
+ */
997
+ 403: ErrorResponse;
998
+ /**
999
+ * Not found
1000
+ */
1001
+ 404: ErrorResponse;
1002
+ /**
1003
+ * Method not allowed
1004
+ */
1005
+ 405: ErrorResponse;
1006
+ /**
1007
+ * Internal server error
1008
+ */
1009
+ 500: ErrorResponse;
1010
+ };
1011
+ type GetFloorError = GetFloorErrors[keyof GetFloorErrors];
1012
+ type GetFloorResponses = {
1013
+ /**
1014
+ * Floor
1015
+ */
1016
+ 200: FloorFull;
1017
+ };
1018
+ type GetFloorResponse = GetFloorResponses[keyof GetFloorResponses];
1019
+ type UpdateFloorData = {
1020
+ body: UpdateFloorBody;
1021
+ path: {
1022
+ id: string;
1023
+ };
1024
+ query?: never;
1025
+ url: '/api/floors/{id}';
1026
+ };
1027
+ type UpdateFloorErrors = {
1028
+ /**
1029
+ * Bad request
1030
+ */
1031
+ 400: ErrorResponse;
1032
+ /**
1033
+ * Unauthorized
1034
+ */
1035
+ 401: ErrorResponse;
1036
+ /**
1037
+ * Forbidden
1038
+ */
1039
+ 403: ErrorResponse;
1040
+ /**
1041
+ * Not found
1042
+ */
1043
+ 404: ErrorResponse;
1044
+ /**
1045
+ * Method not allowed
1046
+ */
1047
+ 405: ErrorResponse;
1048
+ /**
1049
+ * Internal server error
1050
+ */
1051
+ 500: ErrorResponse;
1052
+ };
1053
+ type UpdateFloorError = UpdateFloorErrors[keyof UpdateFloorErrors];
1054
+ type UpdateFloorResponses = {
1055
+ /**
1056
+ * Updated floor
1057
+ */
1058
+ 200: FloorFull;
1059
+ };
1060
+ type UpdateFloorResponse = UpdateFloorResponses[keyof UpdateFloorResponses];
1061
+ type GetUnitsData = {
1062
+ body?: never;
1063
+ path?: never;
1064
+ query: {
1065
+ pid: string;
1066
+ };
1067
+ url: '/api/units';
1068
+ };
1069
+ type GetUnitsErrors = {
1070
+ /**
1071
+ * Bad request
1072
+ */
1073
+ 400: ErrorResponse;
1074
+ /**
1075
+ * Unauthorized
1076
+ */
1077
+ 401: ErrorResponse;
1078
+ /**
1079
+ * Forbidden
1080
+ */
1081
+ 403: ErrorResponse;
1082
+ /**
1083
+ * Not found
1084
+ */
1085
+ 404: ErrorResponse;
1086
+ /**
1087
+ * Method not allowed
1088
+ */
1089
+ 405: ErrorResponse;
1090
+ /**
1091
+ * Internal server error
1092
+ */
1093
+ 500: ErrorResponse;
1094
+ };
1095
+ type GetUnitsError = GetUnitsErrors[keyof GetUnitsErrors];
1096
+ type GetUnitsResponses = {
1097
+ /**
1098
+ * Units list
1099
+ */
1100
+ 201: UnitsListResponse;
1101
+ };
1102
+ type GetUnitsResponse = GetUnitsResponses[keyof GetUnitsResponses];
1103
+ type BatchUpdateUnitsData = {
1104
+ body: BatchUpdateUnitsBody;
1105
+ path?: never;
1106
+ query?: never;
1107
+ url: '/api/units';
1108
+ };
1109
+ type BatchUpdateUnitsErrors = {
1110
+ /**
1111
+ * Bad request
1112
+ */
1113
+ 400: ErrorResponse;
1114
+ /**
1115
+ * Unauthorized
1116
+ */
1117
+ 401: ErrorResponse;
1118
+ /**
1119
+ * Forbidden
1120
+ */
1121
+ 403: ErrorResponse;
1122
+ /**
1123
+ * Not found
1124
+ */
1125
+ 404: ErrorResponse;
1126
+ /**
1127
+ * Method not allowed
1128
+ */
1129
+ 405: ErrorResponse;
1130
+ /**
1131
+ * Internal server error
1132
+ */
1133
+ 500: ErrorResponse;
1134
+ };
1135
+ type BatchUpdateUnitsError = BatchUpdateUnitsErrors[keyof BatchUpdateUnitsErrors];
1136
+ type BatchUpdateUnitsResponses = {
1137
+ /**
1138
+ * Updated units
1139
+ */
1140
+ 201: Array<UnitFull>;
1141
+ };
1142
+ type BatchUpdateUnitsResponse = BatchUpdateUnitsResponses[keyof BatchUpdateUnitsResponses];
1143
+ type CreateUnitData = {
1144
+ body: CreateUnitBody;
1145
+ path?: never;
1146
+ query?: never;
1147
+ url: '/api/units';
1148
+ };
1149
+ type CreateUnitErrors = {
1150
+ /**
1151
+ * Bad request
1152
+ */
1153
+ 400: ErrorResponse;
1154
+ /**
1155
+ * Unauthorized
1156
+ */
1157
+ 401: ErrorResponse;
1158
+ /**
1159
+ * Forbidden
1160
+ */
1161
+ 403: ErrorResponse;
1162
+ /**
1163
+ * Not found
1164
+ */
1165
+ 404: ErrorResponse;
1166
+ /**
1167
+ * Method not allowed
1168
+ */
1169
+ 405: ErrorResponse;
1170
+ /**
1171
+ * Internal server error
1172
+ */
1173
+ 500: ErrorResponse;
1174
+ };
1175
+ type CreateUnitError = CreateUnitErrors[keyof CreateUnitErrors];
1176
+ type CreateUnitResponses = {
1177
+ /**
1178
+ * Created unit
1179
+ */
1180
+ 201: UnitFull;
1181
+ };
1182
+ type CreateUnitResponse = CreateUnitResponses[keyof CreateUnitResponses];
1183
+ type DeleteUnitData = {
1184
+ body?: never;
1185
+ path: {
1186
+ id: string;
1187
+ };
1188
+ query?: never;
1189
+ url: '/api/units/{id}';
1190
+ };
1191
+ type DeleteUnitErrors = {
1192
+ /**
1193
+ * Bad request
1194
+ */
1195
+ 400: ErrorResponse;
1196
+ /**
1197
+ * Unauthorized
1198
+ */
1199
+ 401: ErrorResponse;
1200
+ /**
1201
+ * Forbidden
1202
+ */
1203
+ 403: ErrorResponse;
1204
+ /**
1205
+ * Not found
1206
+ */
1207
+ 404: ErrorResponse;
1208
+ /**
1209
+ * Method not allowed
1210
+ */
1211
+ 405: ErrorResponse;
1212
+ /**
1213
+ * Internal server error
1214
+ */
1215
+ 500: ErrorResponse;
1216
+ };
1217
+ type DeleteUnitError = DeleteUnitErrors[keyof DeleteUnitErrors];
1218
+ type DeleteUnitResponses = {
1219
+ /**
1220
+ * Unit deleted
1221
+ */
1222
+ 200: ErrorResponse;
1223
+ };
1224
+ type DeleteUnitResponse = DeleteUnitResponses[keyof DeleteUnitResponses];
1225
+ type GetUnitData = {
1226
+ body?: never;
1227
+ path: {
1228
+ id: string;
1229
+ };
1230
+ query?: never;
1231
+ url: '/api/units/{id}';
1232
+ };
1233
+ type GetUnitErrors = {
1234
+ /**
1235
+ * Bad request
1236
+ */
1237
+ 400: ErrorResponse;
1238
+ /**
1239
+ * Unauthorized
1240
+ */
1241
+ 401: ErrorResponse;
1242
+ /**
1243
+ * Forbidden
1244
+ */
1245
+ 403: ErrorResponse;
1246
+ /**
1247
+ * Not found
1248
+ */
1249
+ 404: ErrorResponse;
1250
+ /**
1251
+ * Method not allowed
1252
+ */
1253
+ 405: ErrorResponse;
1254
+ /**
1255
+ * Internal server error
1256
+ */
1257
+ 500: ErrorResponse;
1258
+ };
1259
+ type GetUnitError = GetUnitErrors[keyof GetUnitErrors];
1260
+ type GetUnitResponses = {
1261
+ /**
1262
+ * Unit
1263
+ */
1264
+ 200: UnitFull;
1265
+ };
1266
+ type GetUnitResponse = GetUnitResponses[keyof GetUnitResponses];
1267
+ type UpdateUnitData = {
1268
+ body: UpdateUnitBody;
1269
+ path: {
1270
+ id: string;
1271
+ };
1272
+ query?: never;
1273
+ url: '/api/units/{id}';
1274
+ };
1275
+ type UpdateUnitErrors = {
1276
+ /**
1277
+ * Bad request
1278
+ */
1279
+ 400: ErrorResponse;
1280
+ /**
1281
+ * Unauthorized
1282
+ */
1283
+ 401: ErrorResponse;
1284
+ /**
1285
+ * Forbidden
1286
+ */
1287
+ 403: ErrorResponse;
1288
+ /**
1289
+ * Not found
1290
+ */
1291
+ 404: ErrorResponse;
1292
+ /**
1293
+ * Method not allowed
1294
+ */
1295
+ 405: ErrorResponse;
1296
+ /**
1297
+ * Internal server error
1298
+ */
1299
+ 500: ErrorResponse;
1300
+ };
1301
+ type UpdateUnitError = UpdateUnitErrors[keyof UpdateUnitErrors];
1302
+ type UpdateUnitResponses = {
1303
+ /**
1304
+ * Updated unit
1305
+ */
1306
+ 200: UnitFull;
1307
+ };
1308
+ type UpdateUnitResponse = UpdateUnitResponses[keyof UpdateUnitResponses];
1309
+ type GetLeadsData = {
1310
+ body?: never;
1311
+ path?: never;
1312
+ query: {
1313
+ pid: string;
1314
+ };
1315
+ url: '/api/leads';
1316
+ };
1317
+ type GetLeadsErrors = {
1318
+ /**
1319
+ * Bad request
1320
+ */
1321
+ 400: ErrorResponse;
1322
+ /**
1323
+ * Unauthorized
1324
+ */
1325
+ 401: ErrorResponse;
1326
+ /**
1327
+ * Forbidden
1328
+ */
1329
+ 403: ErrorResponse;
1330
+ /**
1331
+ * Not found
1332
+ */
1333
+ 404: ErrorResponse;
1334
+ /**
1335
+ * Method not allowed
1336
+ */
1337
+ 405: ErrorResponse;
1338
+ /**
1339
+ * Internal server error
1340
+ */
1341
+ 500: ErrorResponse;
1342
+ };
1343
+ type GetLeadsError = GetLeadsErrors[keyof GetLeadsErrors];
1344
+ type GetLeadsResponses = {
1345
+ /**
1346
+ * Leads list
1347
+ */
1348
+ 200: Array<Lead>;
1349
+ };
1350
+ type GetLeadsResponse = GetLeadsResponses[keyof GetLeadsResponses];
1351
+
1352
+ type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options$1<TData, ThrowOnError> & {
1353
+ /**
1354
+ * You can provide a client instance returned by `createClient()` instead of
1355
+ * individual options. This might be also useful if you want to implement a
1356
+ * custom client.
1357
+ */
1358
+ client?: Client;
1359
+ /**
1360
+ * You can pass arbitrary values through the `meta` object. This can be
1361
+ * used to access values that aren't defined as part of the SDK function.
1362
+ */
1363
+ meta?: Record<string, unknown>;
1364
+ };
1365
+ /**
1366
+ * Login
1367
+ */
1368
+ declare const login: <ThrowOnError extends boolean = false>(options: Options<LoginData, ThrowOnError>) => RequestResult<LoginResponses, LoginErrors, ThrowOnError, "fields">;
1369
+ /**
1370
+ * Find a project by namespace and hostname
1371
+ *
1372
+ * Returns the full project document including floors, units, commercial spaces, and collections.
1373
+ */
1374
+ declare const findProject: <ThrowOnError extends boolean = false>(options: Options<FindProjectData, ThrowOnError>) => RequestResult<FindProjectResponses, FindProjectErrors, ThrowOnError, "fields">;
1375
+ /**
1376
+ * Get my projects
1377
+ */
1378
+ declare const getMyProjects: <ThrowOnError extends boolean = false>(options?: Options<GetMyProjectsData, ThrowOnError>) => RequestResult<GetMyProjectsResponses, GetMyProjectsErrors, ThrowOnError, "fields">;
1379
+ /**
1380
+ * Get a project by ID
1381
+ */
1382
+ declare const getProject: <ThrowOnError extends boolean = false>(options: Options<GetProjectData, ThrowOnError>) => RequestResult<GetProjectResponses, GetProjectErrors, ThrowOnError, "fields">;
1383
+ /**
1384
+ * Update a project
1385
+ */
1386
+ declare const updateProject: <ThrowOnError extends boolean = false>(options: Options<UpdateProjectData, ThrowOnError>) => RequestResult<UpdateProjectResponses, UpdateProjectErrors, ThrowOnError, "fields">;
1387
+ /**
1388
+ * Get groups
1389
+ */
1390
+ declare const getGroups: <ThrowOnError extends boolean = false>(options?: Options<GetGroupsData, ThrowOnError>) => RequestResult<GetGroupsResponses, GetGroupsErrors, ThrowOnError, "fields">;
1391
+ /**
1392
+ * Create a group
1393
+ */
1394
+ declare const createGroup: <ThrowOnError extends boolean = false>(options: Options<CreateGroupData, ThrowOnError>) => RequestResult<CreateGroupResponses, CreateGroupErrors, ThrowOnError, "fields">;
1395
+ /**
1396
+ * Get a group by ID
1397
+ */
1398
+ declare const getGroup: <ThrowOnError extends boolean = false>(options: Options<GetGroupData, ThrowOnError>) => RequestResult<GetGroupResponses, GetGroupErrors, ThrowOnError, "fields">;
1399
+ /**
1400
+ * Update a group
1401
+ */
1402
+ declare const updateGroup: <ThrowOnError extends boolean = false>(options: Options<UpdateGroupData, ThrowOnError>) => RequestResult<UpdateGroupResponses, UpdateGroupErrors, ThrowOnError, "fields">;
1403
+ /**
1404
+ * Get floors for a project
1405
+ */
1406
+ declare const getFloors: <ThrowOnError extends boolean = false>(options: Options<GetFloorsData, ThrowOnError>) => RequestResult<GetFloorsResponses, GetFloorsErrors, ThrowOnError, "fields">;
1407
+ /**
1408
+ * Create a floor
1409
+ */
1410
+ declare const createFloor: <ThrowOnError extends boolean = false>(options: Options<CreateFloorData, ThrowOnError>) => RequestResult<CreateFloorResponses, CreateFloorErrors, ThrowOnError, "fields">;
1411
+ /**
1412
+ * Get a floor by ID
1413
+ */
1414
+ declare const getFloor: <ThrowOnError extends boolean = false>(options: Options<GetFloorData, ThrowOnError>) => RequestResult<GetFloorResponses, GetFloorErrors, ThrowOnError, "fields">;
1415
+ /**
1416
+ * Update a floor
1417
+ */
1418
+ declare const updateFloor: <ThrowOnError extends boolean = false>(options: Options<UpdateFloorData, ThrowOnError>) => RequestResult<UpdateFloorResponses, UpdateFloorErrors, ThrowOnError, "fields">;
1419
+ /**
1420
+ * Get units for a project
1421
+ */
1422
+ declare const getUnits: <ThrowOnError extends boolean = false>(options: Options<GetUnitsData, ThrowOnError>) => RequestResult<GetUnitsResponses, GetUnitsErrors, ThrowOnError, "fields">;
1423
+ /**
1424
+ * Batch update units
1425
+ */
1426
+ declare const batchUpdateUnits: <ThrowOnError extends boolean = false>(options: Options<BatchUpdateUnitsData, ThrowOnError>) => RequestResult<BatchUpdateUnitsResponses, BatchUpdateUnitsErrors, ThrowOnError, "fields">;
1427
+ /**
1428
+ * Create a unit
1429
+ */
1430
+ declare const createUnit: <ThrowOnError extends boolean = false>(options: Options<CreateUnitData, ThrowOnError>) => RequestResult<CreateUnitResponses, CreateUnitErrors, ThrowOnError, "fields">;
1431
+ /**
1432
+ * Delete a unit
1433
+ */
1434
+ declare const deleteUnit: <ThrowOnError extends boolean = false>(options: Options<DeleteUnitData, ThrowOnError>) => RequestResult<DeleteUnitResponses, DeleteUnitErrors, ThrowOnError, "fields">;
1435
+ /**
1436
+ * Get a unit by ID
1437
+ */
1438
+ declare const getUnit: <ThrowOnError extends boolean = false>(options: Options<GetUnitData, ThrowOnError>) => RequestResult<GetUnitResponses, GetUnitErrors, ThrowOnError, "fields">;
1439
+ /**
1440
+ * Update a unit
1441
+ */
1442
+ declare const updateUnit: <ThrowOnError extends boolean = false>(options: Options<UpdateUnitData, ThrowOnError>) => RequestResult<UpdateUnitResponses, UpdateUnitErrors, ThrowOnError, "fields">;
1443
+ /**
1444
+ * Get leads for a project
1445
+ */
1446
+ declare const getLeads: <ThrowOnError extends boolean = false>(options: Options<GetLeadsData, ThrowOnError>) => RequestResult<GetLeadsResponses, GetLeadsErrors, ThrowOnError, "fields">;
459
1447
 
460
- export { type ClientOptions, type Collection, type CommercialSpace, type ErrorResponse, type FindProjectBody, type FindProjectData, type FindProjectError, type FindProjectErrors, type FindProjectResponse, type FindProjectResponses, type Floor, type Options, type Project, type Unit, type UnitModel, findProject };
1448
+ export { type BatchUpdateUnitsBody, type BatchUpdateUnitsData, type BatchUpdateUnitsError, type BatchUpdateUnitsErrors, type BatchUpdateUnitsResponse, type BatchUpdateUnitsResponses, type ClientOptions, type Collection, type CommercialSpace, type CreateFloorBody, type CreateFloorData, type CreateFloorError, type CreateFloorErrors, type CreateFloorResponse, type CreateFloorResponses, type CreateGroupBody, type CreateGroupData, type CreateGroupError, type CreateGroupErrors, type CreateGroupResponse, type CreateGroupResponses, type CreateUnitBody, type CreateUnitData, type CreateUnitError, type CreateUnitErrors, type CreateUnitResponse, type CreateUnitResponses, type DeleteUnitData, type DeleteUnitError, type DeleteUnitErrors, type DeleteUnitResponse, type DeleteUnitResponses, type ErrorResponse, type FindProjectBody, type FindProjectData, type FindProjectError, type FindProjectErrors, type FindProjectResponse, type FindProjectResponses, type Floor, type FloorFull, type GetFloorData, type GetFloorError, type GetFloorErrors, type GetFloorResponse, type GetFloorResponses, type GetFloorsData, type GetFloorsError, type GetFloorsErrors, type GetFloorsResponse, type GetFloorsResponses, type GetGroupData, type GetGroupError, type GetGroupErrors, type GetGroupResponse, type GetGroupResponses, type GetGroupsData, type GetGroupsError, type GetGroupsErrors, type GetGroupsResponse, type GetGroupsResponses, type GetLeadsData, type GetLeadsError, type GetLeadsErrors, type GetLeadsResponse, type GetLeadsResponses, type GetMyProjectsData, type GetMyProjectsError, type GetMyProjectsErrors, type GetMyProjectsResponse, type GetMyProjectsResponses, type GetProjectData, type GetProjectError, type GetProjectErrors, type GetProjectResponse, type GetProjectResponses, type GetUnitData, type GetUnitError, type GetUnitErrors, type GetUnitResponse, type GetUnitResponses, type GetUnitsData, type GetUnitsError, type GetUnitsErrors, type GetUnitsResponse, type GetUnitsResponses, type Group, type GroupProject, type GroupsListResponse, type Lead, type LoginBody, type LoginData, type LoginError, type LoginErrors, type LoginResponse, type LoginResponse2, type LoginResponses, type Options, type Project, type ProjectSummary, type Unit, type UnitFull, type UnitModel, type UnitsListResponse, type UpdateFloorBody, type UpdateFloorData, type UpdateFloorError, type UpdateFloorErrors, type UpdateFloorResponse, type UpdateFloorResponses, type UpdateGroupBody, type UpdateGroupData, type UpdateGroupError, type UpdateGroupErrors, type UpdateGroupResponse, type UpdateGroupResponses, type UpdateProjectBody, type UpdateProjectData, type UpdateProjectError, type UpdateProjectErrors, type UpdateProjectResponse, type UpdateProjectResponses, type UpdateUnitBody, type UpdateUnitData, type UpdateUnitError, type UpdateUnitErrors, type UpdateUnitResponse, type UpdateUnitResponses, batchUpdateUnits, createFloor, createGroup, createUnit, deleteUnit, findProject, getFloor, getFloors, getGroup, getGroups, getLeads, getMyProjects, getProject, getUnit, getUnits, login, updateFloor, updateGroup, updateProject, updateUnit };
package/dist/index.js CHANGED
@@ -805,6 +805,14 @@ var createClient = (config = {}) => {
805
805
  var client = createClient(createConfig({ baseUrl: "https://app.planpoint.io" }));
806
806
 
807
807
  // src/client/sdk.gen.ts
808
+ var login = (options) => (options.client ?? client).post({
809
+ url: "/api/users/login",
810
+ ...options,
811
+ headers: {
812
+ "Content-Type": "application/json",
813
+ ...options.headers
814
+ }
815
+ });
808
816
  var findProject = (options) => (options.client ?? client).post({
809
817
  url: "/api/projects/find",
810
818
  ...options,
@@ -813,6 +821,147 @@ var findProject = (options) => (options.client ?? client).post({
813
821
  ...options.headers
814
822
  }
815
823
  });
824
+ var getMyProjects = (options) => (options?.client ?? client).get({
825
+ security: [{ scheme: "bearer", type: "http" }],
826
+ url: "/api/projects/mine",
827
+ ...options
828
+ });
829
+ var getProject = (options) => (options.client ?? client).get({
830
+ security: [{ scheme: "bearer", type: "http" }],
831
+ url: "/api/projects/{id}",
832
+ ...options
833
+ });
834
+ var updateProject = (options) => (options.client ?? client).patch({
835
+ security: [{ scheme: "bearer", type: "http" }],
836
+ url: "/api/projects/{id}",
837
+ ...options,
838
+ headers: {
839
+ "Content-Type": "application/json",
840
+ ...options.headers
841
+ }
842
+ });
843
+ var getGroups = (options) => (options?.client ?? client).get({
844
+ security: [{ scheme: "bearer", type: "http" }],
845
+ url: "/api/groups",
846
+ ...options
847
+ });
848
+ var createGroup = (options) => (options.client ?? client).post({
849
+ security: [{ scheme: "bearer", type: "http" }],
850
+ url: "/api/groups",
851
+ ...options,
852
+ headers: {
853
+ "Content-Type": "application/json",
854
+ ...options.headers
855
+ }
856
+ });
857
+ var getGroup = (options) => (options.client ?? client).get({
858
+ security: [{ scheme: "bearer", type: "http" }],
859
+ url: "/api/groups/{id}",
860
+ ...options
861
+ });
862
+ var updateGroup = (options) => (options.client ?? client).patch({
863
+ security: [{ scheme: "bearer", type: "http" }],
864
+ url: "/api/groups/{id}",
865
+ ...options,
866
+ headers: {
867
+ "Content-Type": "application/json",
868
+ ...options.headers
869
+ }
870
+ });
871
+ var getFloors = (options) => (options.client ?? client).get({
872
+ security: [{ scheme: "bearer", type: "http" }],
873
+ url: "/api/floors",
874
+ ...options
875
+ });
876
+ var createFloor = (options) => (options.client ?? client).post({
877
+ security: [{ scheme: "bearer", type: "http" }],
878
+ url: "/api/floors",
879
+ ...options,
880
+ headers: {
881
+ "Content-Type": "application/json",
882
+ ...options.headers
883
+ }
884
+ });
885
+ var getFloor = (options) => (options.client ?? client).get({
886
+ security: [{ scheme: "bearer", type: "http" }],
887
+ url: "/api/floors/{id}",
888
+ ...options
889
+ });
890
+ var updateFloor = (options) => (options.client ?? client).patch({
891
+ security: [{ scheme: "bearer", type: "http" }],
892
+ url: "/api/floors/{id}",
893
+ ...options,
894
+ headers: {
895
+ "Content-Type": "application/json",
896
+ ...options.headers
897
+ }
898
+ });
899
+ var getUnits = (options) => (options.client ?? client).get({
900
+ security: [{ scheme: "bearer", type: "http" }],
901
+ url: "/api/units",
902
+ ...options
903
+ });
904
+ var batchUpdateUnits = (options) => (options.client ?? client).patch({
905
+ security: [{ scheme: "bearer", type: "http" }],
906
+ url: "/api/units",
907
+ ...options,
908
+ headers: {
909
+ "Content-Type": "application/json",
910
+ ...options.headers
911
+ }
912
+ });
913
+ var createUnit = (options) => (options.client ?? client).post({
914
+ security: [{ scheme: "bearer", type: "http" }],
915
+ url: "/api/units",
916
+ ...options,
917
+ headers: {
918
+ "Content-Type": "application/json",
919
+ ...options.headers
920
+ }
921
+ });
922
+ var deleteUnit = (options) => (options.client ?? client).delete({
923
+ security: [{ scheme: "bearer", type: "http" }],
924
+ url: "/api/units/{id}",
925
+ ...options
926
+ });
927
+ var getUnit = (options) => (options.client ?? client).get({
928
+ security: [{ scheme: "bearer", type: "http" }],
929
+ url: "/api/units/{id}",
930
+ ...options
931
+ });
932
+ var updateUnit = (options) => (options.client ?? client).patch({
933
+ security: [{ scheme: "bearer", type: "http" }],
934
+ url: "/api/units/{id}",
935
+ ...options,
936
+ headers: {
937
+ "Content-Type": "application/json",
938
+ ...options.headers
939
+ }
940
+ });
941
+ var getLeads = (options) => (options.client ?? client).get({
942
+ security: [{ scheme: "bearer", type: "http" }],
943
+ url: "/api/leads",
944
+ ...options
945
+ });
816
946
  export {
817
- findProject
947
+ batchUpdateUnits,
948
+ createFloor,
949
+ createGroup,
950
+ createUnit,
951
+ deleteUnit,
952
+ findProject,
953
+ getFloor,
954
+ getFloors,
955
+ getGroup,
956
+ getGroups,
957
+ getLeads,
958
+ getMyProjects,
959
+ getProject,
960
+ getUnit,
961
+ getUnits,
962
+ login,
963
+ updateFloor,
964
+ updateGroup,
965
+ updateProject,
966
+ updateUnit
818
967
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planpoint/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "TypeScript SDK for the PlanPoint API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -25,4 +25,4 @@
25
25
  "tsup": "^8.0.0",
26
26
  "typescript": "^5.0.0"
27
27
  }
28
- }
28
+ }