@envsync-cloud/envsync-ts-sdk 0.1.2 → 0.2.2

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.
@@ -380,9 +380,9 @@
380
380
  this.httpRequest = httpRequest;
381
381
  }
382
382
  /**
383
- * Create CLI Login URL
383
+ * Initiate CLI Login
384
384
  * Generate authentication URL for CLI login
385
- * @returns LoginUrlResponse CLI login URL created successfully
385
+ * @returns LoginUrlResponse CLI login initiated successfully.
386
386
  * @throws ApiError
387
387
  */
388
388
  createCliLogin() {
@@ -394,26 +394,6 @@
394
394
  }
395
395
  });
396
396
  }
397
- /**
398
- * CLI Login Callback
399
- * Handle CLI login callback from Auth0
400
- * @param code
401
- * @returns void
402
- * @throws ApiError
403
- */
404
- callbackCliLogin(code) {
405
- return this.httpRequest.request({
406
- method: "GET",
407
- url: "/api/access/cli/callback",
408
- query: {
409
- "code": code
410
- },
411
- errors: {
412
- 302: `Redirect with authentication token`,
413
- 500: `Internal server error`
414
- }
415
- });
416
- }
417
397
  /**
418
398
  * Create Web Login URL
419
399
  * Generate authentication URL for web login
@@ -485,6 +465,125 @@
485
465
  }
486
466
  };
487
467
 
468
+ // src/services/ApiKeysService.ts
469
+ var ApiKeysService = class {
470
+ constructor(httpRequest) {
471
+ this.httpRequest = httpRequest;
472
+ }
473
+ /**
474
+ * Create API Key
475
+ * Create a new API key for the organization
476
+ * @param requestBody
477
+ * @returns ApiKeyResponse API key created successfully
478
+ * @throws ApiError
479
+ */
480
+ createApiKey(requestBody) {
481
+ return this.httpRequest.request({
482
+ method: "POST",
483
+ url: "/api/api_key",
484
+ body: requestBody,
485
+ mediaType: "application/json",
486
+ errors: {
487
+ 500: `Internal server error`
488
+ }
489
+ });
490
+ }
491
+ /**
492
+ * Get All API Keys
493
+ * Retrieve all API keys for the organization
494
+ * @returns ApiKeysResponse API keys retrieved successfully
495
+ * @throws ApiError
496
+ */
497
+ getAllApiKeys() {
498
+ return this.httpRequest.request({
499
+ method: "GET",
500
+ url: "/api/api_key",
501
+ errors: {
502
+ 500: `Internal server error`
503
+ }
504
+ });
505
+ }
506
+ /**
507
+ * Get API Key
508
+ * Retrieve a specific API key
509
+ * @param id
510
+ * @returns ApiKeyResponse API key retrieved successfully
511
+ * @throws ApiError
512
+ */
513
+ getApiKey(id) {
514
+ return this.httpRequest.request({
515
+ method: "GET",
516
+ url: "/api/api_key/{id}",
517
+ path: {
518
+ "id": id
519
+ },
520
+ errors: {
521
+ 500: `Internal server error`
522
+ }
523
+ });
524
+ }
525
+ /**
526
+ * Update API Key
527
+ * Update an existing API key
528
+ * @param id
529
+ * @param requestBody
530
+ * @returns ApiKeyResponse API key updated successfully
531
+ * @throws ApiError
532
+ */
533
+ updateApiKey(id, requestBody) {
534
+ return this.httpRequest.request({
535
+ method: "PUT",
536
+ url: "/api/api_key/{id}",
537
+ path: {
538
+ "id": id
539
+ },
540
+ body: requestBody,
541
+ mediaType: "application/json",
542
+ errors: {
543
+ 500: `Internal server error`
544
+ }
545
+ });
546
+ }
547
+ /**
548
+ * Delete API Key
549
+ * Delete an existing API key
550
+ * @param id
551
+ * @returns ApiKeyResponse API key deleted successfully
552
+ * @throws ApiError
553
+ */
554
+ deleteApiKey(id) {
555
+ return this.httpRequest.request({
556
+ method: "DELETE",
557
+ url: "/api/api_key/{id}",
558
+ path: {
559
+ "id": id
560
+ },
561
+ errors: {
562
+ 500: `Internal server error`
563
+ }
564
+ });
565
+ }
566
+ /**
567
+ * Regenerate API Key
568
+ * Generate a new value for an existing API key
569
+ * @param id
570
+ * @returns RegenerateApiKeyResponse API key regenerated successfully
571
+ * @throws ApiError
572
+ */
573
+ regenerateApiKey(id) {
574
+ return this.httpRequest.request({
575
+ method: "GET",
576
+ url: "/api/api_key/{id}/regenerate",
577
+ path: {
578
+ "id": id
579
+ },
580
+ errors: {
581
+ 500: `Internal server error`
582
+ }
583
+ });
584
+ }
585
+ };
586
+
488
587
  // src/services/ApplicationsService.ts
489
588
  var ApplicationsService = class {
490
589
  constructor(httpRequest) {
@@ -598,7 +697,7 @@
598
697
  * @returns GetAuditLogsResponse Audit logs retrieved successfully
599
698
  * @throws ApiError
600
699
  */
601
- getAuditLogs(page = 1, perPage = 20) {
700
+ getAuditLogs(page = "1", perPage = "20") {
602
701
  return this.httpRequest.request({
603
702
  method: "GET",
604
703
  url: "/api/audit_log",
@@ -655,24 +754,6 @@
655
754
  }
656
755
  });
657
756
  }
658
- /**
659
- * Create Environment Type
660
- * Create a new environment type
661
- * @param requestBody
662
- * @returns EnvTypeResponse Environment type created successfully
663
- * @throws ApiError
664
- */
665
- createEnvType(requestBody) {
666
- return this.httpRequest.request({
667
- method: "POST",
668
- url: "/api/env_type",
669
- body: requestBody,
670
- mediaType: "application/json",
671
- errors: {
672
- 500: `Internal server error`
673
- }
674
- });
675
- }
676
757
  /**
677
758
  * Get Environment Type
678
759
  * Retrieve a specific environment type
@@ -692,47 +773,6 @@
692
773
  }
693
774
  });
694
775
  }
695
- /**
696
- * Update Environment Type
697
- * Update an existing environment type
698
- * @param id
699
- * @param requestBody
700
- * @returns EnvTypeResponse Environment type updated successfully
701
- * @throws ApiError
702
- */
703
- updateEnvType(id, requestBody) {
704
- return this.httpRequest.request({
705
- method: "PATCH",
706
- url: "/api/env_type/{id}",
707
- path: {
708
- "id": id
709
- },
710
- body: requestBody,
711
- mediaType: "application/json",
712
- errors: {
713
- 500: `Internal server error`
714
- }
715
- });
716
- }
717
- /**
718
- * Delete Environment Type
719
- * Delete an existing environment type
720
- * @param id
721
- * @returns DeleteEnvTypeRequest Environment type deleted successfully
722
- * @throws ApiError
723
- */
724
- deleteEnvType(id) {
725
- return this.httpRequest.request({
726
- method: "DELETE",
727
- url: "/api/env_type/{id}",
728
- path: {
729
- "id": id
730
- },
731
- errors: {
732
- 500: `Internal server error`
733
- }
734
- });
735
- }
736
776
  };
737
777
 
738
778
  // src/services/EnvironmentVariablesService.ts
@@ -799,20 +839,16 @@
799
839
  });
800
840
  }
801
841
  /**
802
- * Update Environment Variable
803
- * Update an existing environment variable
804
- * @param key
842
+ * Create Environment Variable
843
+ * Create a new environment variable
805
844
  * @param requestBody
806
- * @returns EnvResponse Environment variable updated successfully
845
+ * @returns EnvResponse Environment variable created successfully
807
846
  * @throws ApiError
808
847
  */
809
- updateEnv(key, requestBody) {
848
+ createEnv(requestBody) {
810
849
  return this.httpRequest.request({
811
- method: "PATCH",
812
- url: "/api/env/{key}",
813
- path: {
814
- "key": key
815
- },
850
+ method: "PUT",
851
+ url: "/api/env/single",
816
852
  body: requestBody,
817
853
  mediaType: "application/json",
818
854
  errors: {
@@ -821,16 +857,16 @@
821
857
  });
822
858
  }
823
859
  /**
824
- * Create Environment Variable
825
- * Create a new environment variable
860
+ * Batch Create Environment Variables
861
+ * Create multiple environment variables in a single request
826
862
  * @param requestBody
827
- * @returns EnvResponse Environment variable created successfully
863
+ * @returns EnvsResponse Environment variables created successfully
828
864
  * @throws ApiError
829
865
  */
830
- createEnv(requestBody) {
866
+ batchCreateEnvs(requestBody) {
831
867
  return this.httpRequest.request({
832
868
  method: "PUT",
833
- url: "/api/env/single",
869
+ url: "/api/env/batch",
834
870
  body: requestBody,
835
871
  mediaType: "application/json",
836
872
  errors: {
@@ -839,15 +875,15 @@
839
875
  });
840
876
  }
841
877
  /**
842
- * Batch Create Environment Variables
843
- * Create multiple environment variables in a single request
878
+ * Batch Update Environment Variables
879
+ * Update multiple environment variables in a single request
844
880
  * @param requestBody
845
- * @returns EnvsResponse Environment variables created successfully
881
+ * @returns EnvsResponse Environment variables updated successfully
846
882
  * @throws ApiError
847
883
  */
848
- batchCreateEnvs(requestBody) {
884
+ batchUpdateEnvs(requestBody) {
849
885
  return this.httpRequest.request({
850
- method: "PUT",
886
+ method: "PATCH",
851
887
  url: "/api/env/batch",
852
888
  body: requestBody,
853
889
  mediaType: "application/json",
@@ -856,6 +892,53 @@
856
892
  }
857
893
  });
858
894
  }
895
+ /**
896
+ * Update Environment Variable
897
+ * Update an existing environment variable
898
+ * @param key
899
+ * @param requestBody
900
+ * @returns EnvResponse Environment variable updated successfully
901
+ * @throws ApiError
902
+ */
903
+ updateEnv(key, requestBody) {
904
+ return this.httpRequest.request({
905
+ method: "PATCH",
906
+ url: "/api/env/i/{key}",
907
+ path: {
908
+ "key": key
909
+ },
910
+ body: requestBody,
911
+ mediaType: "application/json",
912
+ errors: {
913
+ 500: `Internal server error`
914
+ }
915
+ });
916
+ }
917
+ };
918
+
919
+ // src/services/FileUploadService.ts
920
+ var FileUploadService = class {
921
+ constructor(httpRequest) {
922
+ this.httpRequest = httpRequest;
923
+ }
924
+ /**
925
+ * Upload File
926
+ * Upload a file to the server. The file should be less than 5MB in size.
927
+ * @param formData
928
+ * @returns UploadFileResponse File uploaded successfully
929
+ * @throws ApiError
930
+ */
931
+ uploadFile(formData) {
932
+ return this.httpRequest.request({
933
+ method: "POST",
934
+ url: "/api/upload/file",
935
+ formData,
936
+ mediaType: "multipart/form-data",
937
+ errors: {
938
+ 500: `Internal server error`
939
+ }
940
+ });
941
+ }
859
942
  };
860
943
 
861
944
  // src/services/OnboardingService.ts
@@ -1086,6 +1169,121 @@
1086
1169
  }
1087
1170
  };
1088
1171
 
1172
+ // src/services/RolesService.ts
1173
+ var RolesService = class {
1174
+ constructor(httpRequest) {
1175
+ this.httpRequest = httpRequest;
1176
+ }
1177
+ /**
1178
+ * Get All Roles
1179
+ * Retrieve all roles in the organization
1180
+ * @returns RolesResponse Roles retrieved successfully
1181
+ * @throws ApiError
1182
+ */
1183
+ getAllRoles() {
1184
+ return this.httpRequest.request({
1185
+ method: "GET",
1186
+ url: "/api/role",
1187
+ errors: {
1188
+ 500: `Internal server error`
1189
+ }
1190
+ });
1191
+ }
1192
+ /**
1193
+ * Create Role
1194
+ * Create a new role in the organization
1195
+ * @param requestBody
1196
+ * @returns RoleResponse Role created successfully
1197
+ * @throws ApiError
1198
+ */
1199
+ createRole(requestBody) {
1200
+ return this.httpRequest.request({
1201
+ method: "POST",
1202
+ url: "/api/role",
1203
+ body: requestBody,
1204
+ mediaType: "application/json",
1205
+ errors: {
1206
+ 500: `Internal server error`
1207
+ }
1208
+ });
1209
+ }
1210
+ /**
1211
+ * Get Role Statistics
1212
+ * Retrieve statistics about roles in the organization
1213
+ * @returns RoleStatsResponse Role statistics retrieved successfully
1214
+ * @throws ApiError
1215
+ */
1216
+ getRoleStats() {
1217
+ return this.httpRequest.request({
1218
+ method: "GET",
1219
+ url: "/api/role/stats",
1220
+ errors: {
1221
+ 500: `Internal server error`
1222
+ }
1223
+ });
1224
+ }
1225
+ /**
1226
+ * Get Role
1227
+ * Retrieve a specific role by ID
1228
+ * @param id
1229
+ * @returns RoleResponse Role retrieved successfully
1230
+ * @throws ApiError
1231
+ */
1232
+ getRole(id) {
1233
+ return this.httpRequest.request({
1234
+ method: "GET",
1235
+ url: "/api/role/{id}",
1236
+ path: {
1237
+ "id": id
1238
+ },
1239
+ errors: {
1240
+ 500: `Internal server error`
1241
+ }
1242
+ });
1243
+ }
1244
+ /**
1245
+ * Update Role
1246
+ * Update an existing role
1247
+ * @param id
1248
+ * @param requestBody
1249
+ * @returns RoleResponse Role updated successfully
1250
+ * @throws ApiError
1251
+ */
1252
+ updateRole(id, requestBody) {
1253
+ return this.httpRequest.request({
1254
+ method: "PATCH",
1255
+ url: "/api/role/{id}",
1256
+ path: {
1257
+ "id": id
1258
+ },
1259
+ body: requestBody,
1260
+ mediaType: "application/json",
1261
+ errors: {
1262
+ 500: `Internal server error`
1263
+ }
1264
+ });
1265
+ }
1266
+ /**
1267
+ * Delete Role
1268
+ * Delete an existing role (non-master roles only)
1269
+ * @param id
1270
+ * @returns RoleResponse Role deleted successfully
1271
+ * @throws ApiError
1272
+ */
1273
+ deleteRole(id) {
1274
+ return this.httpRequest.request({
1275
+ method: "DELETE",
1276
+ url: "/api/role/{id}",
1277
+ path: {
1278
+ "id": id
1279
+ },
1280
+ errors: {
1281
+ 500: `Internal server error`
1282
+ }
1283
+ });
1284
+ }
1285
+ };
1286
+
1089
1287
  // src/services/UsersService.ts
1090
1288
  var UsersService = class {
1091
1289
  constructor(httpRequest) {
@@ -1215,19 +1413,22 @@
1215
1413
  // src/EnvSyncAPISDK.ts
1216
1414
  var EnvSyncAPISDK = class {
1217
1415
  access;
1416
+ apiKeys;
1218
1417
  applications;
1219
1418
  auditLogs;
1220
1419
  authentication;
1221
1420
  environmentTypes;
1222
1421
  environmentVariables;
1422
+ fileUpload;
1223
1423
  onboarding;
1224
1424
  organizations;
1425
+ roles;
1225
1426
  users;
1226
1427
  request;
1227
1428
  constructor(config, HttpRequest = FetchHttpRequest) {
1228
1429
  this.request = new HttpRequest({
1229
1430
  BASE: config?.BASE ?? "http://localhost:8600",
1230
- VERSION: config?.VERSION ?? "0.1.1",
1431
+ VERSION: config?.VERSION ?? "0.2.2",
1231
1432
  WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
1232
1433
  CREDENTIALS: config?.CREDENTIALS ?? "include",
1233
1434
  TOKEN: config?.TOKEN,
@@ -1237,13 +1438,16 @@
1237
1438
  ENCODE_PATH: config?.ENCODE_PATH
1238
1439
  });
1239
1440
  this.access = new AccessService(this.request);
1441
+ this.apiKeys = new ApiKeysService(this.request);
1240
1442
  this.applications = new ApplicationsService(this.request);
1241
1443
  this.auditLogs = new AuditLogsService(this.request);
1242
1444
  this.authentication = new AuthenticationService(this.request);
1243
1445
  this.environmentTypes = new EnvironmentTypesService(this.request);
1244
1446
  this.environmentVariables = new EnvironmentVariablesService(this.request);
1447
+ this.fileUpload = new FileUploadService(this.request);
1245
1448
  this.onboarding = new OnboardingService(this.request);
1246
1449
  this.organizations = new OrganizationsService(this.request);
1450
+ this.roles = new RolesService(this.request);
1247
1451
  this.users = new UsersService(this.request);
1248
1452
  }
1249
1453
  };
@@ -1251,7 +1455,7 @@
1251
1455
  // src/core/OpenAPI.ts
1252
1456
  var OpenAPI = {
1253
1457
  BASE: "http://localhost:8600",
1254
- VERSION: "0.1.1",
1458
+ VERSION: "0.2.2",
1255
1459
  WITH_CREDENTIALS: false,
1256
1460
  CREDENTIALS: "include",
1257
1461
  TOKEN: void 0,