@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.
package/dist/index.js CHANGED
@@ -22,6 +22,7 @@ var src_exports = {};
22
22
  __export(src_exports, {
23
23
  AccessService: () => AccessService,
24
24
  ApiError: () => ApiError,
25
+ ApiKeysService: () => ApiKeysService,
25
26
  ApplicationsService: () => ApplicationsService,
26
27
  AuditLogsService: () => AuditLogsService,
27
28
  AuthenticationService: () => AuthenticationService,
@@ -31,9 +32,11 @@ __export(src_exports, {
31
32
  EnvSyncAPISDK: () => EnvSyncAPISDK,
32
33
  EnvironmentTypesService: () => EnvironmentTypesService,
33
34
  EnvironmentVariablesService: () => EnvironmentVariablesService,
35
+ FileUploadService: () => FileUploadService,
34
36
  OnboardingService: () => OnboardingService,
35
37
  OpenAPI: () => OpenAPI,
36
38
  OrganizationsService: () => OrganizationsService,
39
+ RolesService: () => RolesService,
37
40
  UsersService: () => UsersService
38
41
  });
39
42
  module.exports = __toCommonJS(src_exports);
@@ -418,9 +421,9 @@ var AccessService = class {
418
421
  this.httpRequest = httpRequest;
419
422
  }
420
423
  /**
421
- * Create CLI Login URL
424
+ * Initiate CLI Login
422
425
  * Generate authentication URL for CLI login
423
- * @returns LoginUrlResponse CLI login URL created successfully
426
+ * @returns LoginUrlResponse CLI login initiated successfully.
424
427
  * @throws ApiError
425
428
  */
426
429
  createCliLogin() {
@@ -432,26 +435,6 @@ var AccessService = class {
432
435
  }
433
436
  });
434
437
  }
435
- /**
436
- * CLI Login Callback
437
- * Handle CLI login callback from Auth0
438
- * @param code
439
- * @returns void
440
- * @throws ApiError
441
- */
442
- callbackCliLogin(code) {
443
- return this.httpRequest.request({
444
- method: "GET",
445
- url: "/api/access/cli/callback",
446
- query: {
447
- "code": code
448
- },
449
- errors: {
450
- 302: `Redirect with authentication token`,
451
- 500: `Internal server error`
452
- }
453
- });
454
- }
455
438
  /**
456
439
  * Create Web Login URL
457
440
  * Generate authentication URL for web login
@@ -523,6 +506,125 @@ var AccessService = class {
523
506
  }
524
507
  };
525
508
 
509
+ // src/services/ApiKeysService.ts
510
+ var ApiKeysService = class {
511
+ constructor(httpRequest) {
512
+ this.httpRequest = httpRequest;
513
+ }
514
+ /**
515
+ * Create API Key
516
+ * Create a new API key for the organization
517
+ * @param requestBody
518
+ * @returns ApiKeyResponse API key created successfully
519
+ * @throws ApiError
520
+ */
521
+ createApiKey(requestBody) {
522
+ return this.httpRequest.request({
523
+ method: "POST",
524
+ url: "/api/api_key",
525
+ body: requestBody,
526
+ mediaType: "application/json",
527
+ errors: {
528
+ 500: `Internal server error`
529
+ }
530
+ });
531
+ }
532
+ /**
533
+ * Get All API Keys
534
+ * Retrieve all API keys for the organization
535
+ * @returns ApiKeysResponse API keys retrieved successfully
536
+ * @throws ApiError
537
+ */
538
+ getAllApiKeys() {
539
+ return this.httpRequest.request({
540
+ method: "GET",
541
+ url: "/api/api_key",
542
+ errors: {
543
+ 500: `Internal server error`
544
+ }
545
+ });
546
+ }
547
+ /**
548
+ * Get API Key
549
+ * Retrieve a specific API key
550
+ * @param id
551
+ * @returns ApiKeyResponse API key retrieved successfully
552
+ * @throws ApiError
553
+ */
554
+ getApiKey(id) {
555
+ return this.httpRequest.request({
556
+ method: "GET",
557
+ url: "/api/api_key/{id}",
558
+ path: {
559
+ "id": id
560
+ },
561
+ errors: {
562
+ 500: `Internal server error`
563
+ }
564
+ });
565
+ }
566
+ /**
567
+ * Update API Key
568
+ * Update an existing API key
569
+ * @param id
570
+ * @param requestBody
571
+ * @returns ApiKeyResponse API key updated successfully
572
+ * @throws ApiError
573
+ */
574
+ updateApiKey(id, requestBody) {
575
+ return this.httpRequest.request({
576
+ method: "PUT",
577
+ url: "/api/api_key/{id}",
578
+ path: {
579
+ "id": id
580
+ },
581
+ body: requestBody,
582
+ mediaType: "application/json",
583
+ errors: {
584
+ 500: `Internal server error`
585
+ }
586
+ });
587
+ }
588
+ /**
589
+ * Delete API Key
590
+ * Delete an existing API key
591
+ * @param id
592
+ * @returns ApiKeyResponse API key deleted successfully
593
+ * @throws ApiError
594
+ */
595
+ deleteApiKey(id) {
596
+ return this.httpRequest.request({
597
+ method: "DELETE",
598
+ url: "/api/api_key/{id}",
599
+ path: {
600
+ "id": id
601
+ },
602
+ errors: {
603
+ 500: `Internal server error`
604
+ }
605
+ });
606
+ }
607
+ /**
608
+ * Regenerate API Key
609
+ * Generate a new value for an existing API key
610
+ * @param id
611
+ * @returns RegenerateApiKeyResponse API key regenerated successfully
612
+ * @throws ApiError
613
+ */
614
+ regenerateApiKey(id) {
615
+ return this.httpRequest.request({
616
+ method: "GET",
617
+ url: "/api/api_key/{id}/regenerate",
618
+ path: {
619
+ "id": id
620
+ },
621
+ errors: {
622
+ 500: `Internal server error`
623
+ }
624
+ });
625
+ }
626
+ };
627
+
526
628
  // src/services/ApplicationsService.ts
527
629
  var ApplicationsService = class {
528
630
  constructor(httpRequest) {
@@ -636,7 +738,7 @@ var AuditLogsService = class {
636
738
  * @returns GetAuditLogsResponse Audit logs retrieved successfully
637
739
  * @throws ApiError
638
740
  */
639
- getAuditLogs(page = 1, perPage = 20) {
741
+ getAuditLogs(page = "1", perPage = "20") {
640
742
  return this.httpRequest.request({
641
743
  method: "GET",
642
744
  url: "/api/audit_log",
@@ -693,24 +795,6 @@ var EnvironmentTypesService = class {
693
795
  }
694
796
  });
695
797
  }
696
- /**
697
- * Create Environment Type
698
- * Create a new environment type
699
- * @param requestBody
700
- * @returns EnvTypeResponse Environment type created successfully
701
- * @throws ApiError
702
- */
703
- createEnvType(requestBody) {
704
- return this.httpRequest.request({
705
- method: "POST",
706
- url: "/api/env_type",
707
- body: requestBody,
708
- mediaType: "application/json",
709
- errors: {
710
- 500: `Internal server error`
711
- }
712
- });
713
- }
714
798
  /**
715
799
  * Get Environment Type
716
800
  * Retrieve a specific environment type
@@ -730,47 +814,6 @@ var EnvironmentTypesService = class {
730
814
  }
731
815
  });
732
816
  }
733
- /**
734
- * Update Environment Type
735
- * Update an existing environment type
736
- * @param id
737
- * @param requestBody
738
- * @returns EnvTypeResponse Environment type updated successfully
739
- * @throws ApiError
740
- */
741
- updateEnvType(id, requestBody) {
742
- return this.httpRequest.request({
743
- method: "PATCH",
744
- url: "/api/env_type/{id}",
745
- path: {
746
- "id": id
747
- },
748
- body: requestBody,
749
- mediaType: "application/json",
750
- errors: {
751
- 500: `Internal server error`
752
- }
753
- });
754
- }
755
- /**
756
- * Delete Environment Type
757
- * Delete an existing environment type
758
- * @param id
759
- * @returns DeleteEnvTypeRequest Environment type deleted successfully
760
- * @throws ApiError
761
- */
762
- deleteEnvType(id) {
763
- return this.httpRequest.request({
764
- method: "DELETE",
765
- url: "/api/env_type/{id}",
766
- path: {
767
- "id": id
768
- },
769
- errors: {
770
- 500: `Internal server error`
771
- }
772
- });
773
- }
774
817
  };
775
818
 
776
819
  // src/services/EnvironmentVariablesService.ts
@@ -837,20 +880,16 @@ var EnvironmentVariablesService = class {
837
880
  });
838
881
  }
839
882
  /**
840
- * Update Environment Variable
841
- * Update an existing environment variable
842
- * @param key
883
+ * Create Environment Variable
884
+ * Create a new environment variable
843
885
  * @param requestBody
844
- * @returns EnvResponse Environment variable updated successfully
886
+ * @returns EnvResponse Environment variable created successfully
845
887
  * @throws ApiError
846
888
  */
847
- updateEnv(key, requestBody) {
889
+ createEnv(requestBody) {
848
890
  return this.httpRequest.request({
849
- method: "PATCH",
850
- url: "/api/env/{key}",
851
- path: {
852
- "key": key
853
- },
891
+ method: "PUT",
892
+ url: "/api/env/single",
854
893
  body: requestBody,
855
894
  mediaType: "application/json",
856
895
  errors: {
@@ -859,16 +898,16 @@ var EnvironmentVariablesService = class {
859
898
  });
860
899
  }
861
900
  /**
862
- * Create Environment Variable
863
- * Create a new environment variable
901
+ * Batch Create Environment Variables
902
+ * Create multiple environment variables in a single request
864
903
  * @param requestBody
865
- * @returns EnvResponse Environment variable created successfully
904
+ * @returns EnvsResponse Environment variables created successfully
866
905
  * @throws ApiError
867
906
  */
868
- createEnv(requestBody) {
907
+ batchCreateEnvs(requestBody) {
869
908
  return this.httpRequest.request({
870
909
  method: "PUT",
871
- url: "/api/env/single",
910
+ url: "/api/env/batch",
872
911
  body: requestBody,
873
912
  mediaType: "application/json",
874
913
  errors: {
@@ -877,15 +916,15 @@ var EnvironmentVariablesService = class {
877
916
  });
878
917
  }
879
918
  /**
880
- * Batch Create Environment Variables
881
- * Create multiple environment variables in a single request
919
+ * Batch Update Environment Variables
920
+ * Update multiple environment variables in a single request
882
921
  * @param requestBody
883
- * @returns EnvsResponse Environment variables created successfully
922
+ * @returns EnvsResponse Environment variables updated successfully
884
923
  * @throws ApiError
885
924
  */
886
- batchCreateEnvs(requestBody) {
925
+ batchUpdateEnvs(requestBody) {
887
926
  return this.httpRequest.request({
888
- method: "PUT",
927
+ method: "PATCH",
889
928
  url: "/api/env/batch",
890
929
  body: requestBody,
891
930
  mediaType: "application/json",
@@ -894,6 +933,53 @@ var EnvironmentVariablesService = class {
894
933
  }
895
934
  });
896
935
  }
936
+ /**
937
+ * Update Environment Variable
938
+ * Update an existing environment variable
939
+ * @param key
940
+ * @param requestBody
941
+ * @returns EnvResponse Environment variable updated successfully
942
+ * @throws ApiError
943
+ */
944
+ updateEnv(key, requestBody) {
945
+ return this.httpRequest.request({
946
+ method: "PATCH",
947
+ url: "/api/env/i/{key}",
948
+ path: {
949
+ "key": key
950
+ },
951
+ body: requestBody,
952
+ mediaType: "application/json",
953
+ errors: {
954
+ 500: `Internal server error`
955
+ }
956
+ });
957
+ }
958
+ };
959
+
960
+ // src/services/FileUploadService.ts
961
+ var FileUploadService = class {
962
+ constructor(httpRequest) {
963
+ this.httpRequest = httpRequest;
964
+ }
965
+ /**
966
+ * Upload File
967
+ * Upload a file to the server. The file should be less than 5MB in size.
968
+ * @param formData
969
+ * @returns UploadFileResponse File uploaded successfully
970
+ * @throws ApiError
971
+ */
972
+ uploadFile(formData) {
973
+ return this.httpRequest.request({
974
+ method: "POST",
975
+ url: "/api/upload/file",
976
+ formData,
977
+ mediaType: "multipart/form-data",
978
+ errors: {
979
+ 500: `Internal server error`
980
+ }
981
+ });
982
+ }
897
983
  };
898
984
 
899
985
  // src/services/OnboardingService.ts
@@ -1124,6 +1210,121 @@ var OrganizationsService = class {
1124
1210
  }
1125
1211
  };
1126
1212
 
1213
+ // src/services/RolesService.ts
1214
+ var RolesService = class {
1215
+ constructor(httpRequest) {
1216
+ this.httpRequest = httpRequest;
1217
+ }
1218
+ /**
1219
+ * Get All Roles
1220
+ * Retrieve all roles in the organization
1221
+ * @returns RolesResponse Roles retrieved successfully
1222
+ * @throws ApiError
1223
+ */
1224
+ getAllRoles() {
1225
+ return this.httpRequest.request({
1226
+ method: "GET",
1227
+ url: "/api/role",
1228
+ errors: {
1229
+ 500: `Internal server error`
1230
+ }
1231
+ });
1232
+ }
1233
+ /**
1234
+ * Create Role
1235
+ * Create a new role in the organization
1236
+ * @param requestBody
1237
+ * @returns RoleResponse Role created successfully
1238
+ * @throws ApiError
1239
+ */
1240
+ createRole(requestBody) {
1241
+ return this.httpRequest.request({
1242
+ method: "POST",
1243
+ url: "/api/role",
1244
+ body: requestBody,
1245
+ mediaType: "application/json",
1246
+ errors: {
1247
+ 500: `Internal server error`
1248
+ }
1249
+ });
1250
+ }
1251
+ /**
1252
+ * Get Role Statistics
1253
+ * Retrieve statistics about roles in the organization
1254
+ * @returns RoleStatsResponse Role statistics retrieved successfully
1255
+ * @throws ApiError
1256
+ */
1257
+ getRoleStats() {
1258
+ return this.httpRequest.request({
1259
+ method: "GET",
1260
+ url: "/api/role/stats",
1261
+ errors: {
1262
+ 500: `Internal server error`
1263
+ }
1264
+ });
1265
+ }
1266
+ /**
1267
+ * Get Role
1268
+ * Retrieve a specific role by ID
1269
+ * @param id
1270
+ * @returns RoleResponse Role retrieved successfully
1271
+ * @throws ApiError
1272
+ */
1273
+ getRole(id) {
1274
+ return this.httpRequest.request({
1275
+ method: "GET",
1276
+ url: "/api/role/{id}",
1277
+ path: {
1278
+ "id": id
1279
+ },
1280
+ errors: {
1281
+ 500: `Internal server error`
1282
+ }
1283
+ });
1284
+ }
1285
+ /**
1286
+ * Update Role
1287
+ * Update an existing role
1288
+ * @param id
1289
+ * @param requestBody
1290
+ * @returns RoleResponse Role updated successfully
1291
+ * @throws ApiError
1292
+ */
1293
+ updateRole(id, requestBody) {
1294
+ return this.httpRequest.request({
1295
+ method: "PATCH",
1296
+ url: "/api/role/{id}",
1297
+ path: {
1298
+ "id": id
1299
+ },
1300
+ body: requestBody,
1301
+ mediaType: "application/json",
1302
+ errors: {
1303
+ 500: `Internal server error`
1304
+ }
1305
+ });
1306
+ }
1307
+ /**
1308
+ * Delete Role
1309
+ * Delete an existing role (non-master roles only)
1310
+ * @param id
1311
+ * @returns RoleResponse Role deleted successfully
1312
+ * @throws ApiError
1313
+ */
1314
+ deleteRole(id) {
1315
+ return this.httpRequest.request({
1316
+ method: "DELETE",
1317
+ url: "/api/role/{id}",
1318
+ path: {
1319
+ "id": id
1320
+ },
1321
+ errors: {
1322
+ 500: `Internal server error`
1323
+ }
1324
+ });
1325
+ }
1326
+ };
1327
+
1127
1328
  // src/services/UsersService.ts
1128
1329
  var UsersService = class {
1129
1330
  constructor(httpRequest) {
@@ -1253,19 +1454,22 @@ var UsersService = class {
1253
1454
  // src/EnvSyncAPISDK.ts
1254
1455
  var EnvSyncAPISDK = class {
1255
1456
  access;
1457
+ apiKeys;
1256
1458
  applications;
1257
1459
  auditLogs;
1258
1460
  authentication;
1259
1461
  environmentTypes;
1260
1462
  environmentVariables;
1463
+ fileUpload;
1261
1464
  onboarding;
1262
1465
  organizations;
1466
+ roles;
1263
1467
  users;
1264
1468
  request;
1265
1469
  constructor(config, HttpRequest = FetchHttpRequest) {
1266
1470
  this.request = new HttpRequest({
1267
1471
  BASE: config?.BASE ?? "http://localhost:8600",
1268
- VERSION: config?.VERSION ?? "0.1.1",
1472
+ VERSION: config?.VERSION ?? "0.2.2",
1269
1473
  WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
1270
1474
  CREDENTIALS: config?.CREDENTIALS ?? "include",
1271
1475
  TOKEN: config?.TOKEN,
@@ -1275,13 +1479,16 @@ var EnvSyncAPISDK = class {
1275
1479
  ENCODE_PATH: config?.ENCODE_PATH
1276
1480
  });
1277
1481
  this.access = new AccessService(this.request);
1482
+ this.apiKeys = new ApiKeysService(this.request);
1278
1483
  this.applications = new ApplicationsService(this.request);
1279
1484
  this.auditLogs = new AuditLogsService(this.request);
1280
1485
  this.authentication = new AuthenticationService(this.request);
1281
1486
  this.environmentTypes = new EnvironmentTypesService(this.request);
1282
1487
  this.environmentVariables = new EnvironmentVariablesService(this.request);
1488
+ this.fileUpload = new FileUploadService(this.request);
1283
1489
  this.onboarding = new OnboardingService(this.request);
1284
1490
  this.organizations = new OrganizationsService(this.request);
1491
+ this.roles = new RolesService(this.request);
1285
1492
  this.users = new UsersService(this.request);
1286
1493
  }
1287
1494
  };
@@ -1289,7 +1496,7 @@ var EnvSyncAPISDK = class {
1289
1496
  // src/core/OpenAPI.ts
1290
1497
  var OpenAPI = {
1291
1498
  BASE: "http://localhost:8600",
1292
- VERSION: "0.1.1",
1499
+ VERSION: "0.2.2",
1293
1500
  WITH_CREDENTIALS: false,
1294
1501
  CREDENTIALS: "include",
1295
1502
  TOKEN: void 0,
@@ -1302,6 +1509,7 @@ var OpenAPI = {
1302
1509
  0 && (module.exports = {
1303
1510
  AccessService,
1304
1511
  ApiError,
1512
+ ApiKeysService,
1305
1513
  ApplicationsService,
1306
1514
  AuditLogsService,
1307
1515
  AuthenticationService,
@@ -1311,8 +1519,10 @@ var OpenAPI = {
1311
1519
  EnvSyncAPISDK,
1312
1520
  EnvironmentTypesService,
1313
1521
  EnvironmentVariablesService,
1522
+ FileUploadService,
1314
1523
  OnboardingService,
1315
1524
  OpenAPI,
1316
1525
  OrganizationsService,
1526
+ RolesService,
1317
1527
  UsersService
1318
1528
  });