@envsync-cloud/envsync-ts-sdk 0.1.0

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.
@@ -0,0 +1,1150 @@
1
+ "use strict";
2
+ (() => {
3
+ // src/core/BaseHttpRequest.ts
4
+ var BaseHttpRequest = class {
5
+ constructor(config) {
6
+ this.config = config;
7
+ }
8
+ };
9
+
10
+ // src/core/ApiError.ts
11
+ var ApiError = class extends Error {
12
+ url;
13
+ status;
14
+ statusText;
15
+ body;
16
+ request;
17
+ constructor(request2, response, message) {
18
+ super(message);
19
+ this.name = "ApiError";
20
+ this.url = response.url;
21
+ this.status = response.status;
22
+ this.statusText = response.statusText;
23
+ this.body = response.body;
24
+ this.request = request2;
25
+ }
26
+ };
27
+
28
+ // src/core/CancelablePromise.ts
29
+ var CancelError = class extends Error {
30
+ constructor(message) {
31
+ super(message);
32
+ this.name = "CancelError";
33
+ }
34
+ get isCancelled() {
35
+ return true;
36
+ }
37
+ };
38
+ var CancelablePromise = class {
39
+ #isResolved;
40
+ #isRejected;
41
+ #isCancelled;
42
+ #cancelHandlers;
43
+ #promise;
44
+ #resolve;
45
+ #reject;
46
+ constructor(executor) {
47
+ this.#isResolved = false;
48
+ this.#isRejected = false;
49
+ this.#isCancelled = false;
50
+ this.#cancelHandlers = [];
51
+ this.#promise = new Promise((resolve2, reject) => {
52
+ this.#resolve = resolve2;
53
+ this.#reject = reject;
54
+ const onResolve = (value) => {
55
+ if (this.#isResolved || this.#isRejected || this.#isCancelled) {
56
+ return;
57
+ }
58
+ this.#isResolved = true;
59
+ if (this.#resolve) this.#resolve(value);
60
+ };
61
+ const onReject = (reason) => {
62
+ if (this.#isResolved || this.#isRejected || this.#isCancelled) {
63
+ return;
64
+ }
65
+ this.#isRejected = true;
66
+ if (this.#reject) this.#reject(reason);
67
+ };
68
+ const onCancel = (cancelHandler) => {
69
+ if (this.#isResolved || this.#isRejected || this.#isCancelled) {
70
+ return;
71
+ }
72
+ this.#cancelHandlers.push(cancelHandler);
73
+ };
74
+ Object.defineProperty(onCancel, "isResolved", {
75
+ get: () => this.#isResolved
76
+ });
77
+ Object.defineProperty(onCancel, "isRejected", {
78
+ get: () => this.#isRejected
79
+ });
80
+ Object.defineProperty(onCancel, "isCancelled", {
81
+ get: () => this.#isCancelled
82
+ });
83
+ return executor(onResolve, onReject, onCancel);
84
+ });
85
+ }
86
+ get [Symbol.toStringTag]() {
87
+ return "Cancellable Promise";
88
+ }
89
+ then(onFulfilled, onRejected) {
90
+ return this.#promise.then(onFulfilled, onRejected);
91
+ }
92
+ catch(onRejected) {
93
+ return this.#promise.catch(onRejected);
94
+ }
95
+ finally(onFinally) {
96
+ return this.#promise.finally(onFinally);
97
+ }
98
+ cancel() {
99
+ if (this.#isResolved || this.#isRejected || this.#isCancelled) {
100
+ return;
101
+ }
102
+ this.#isCancelled = true;
103
+ if (this.#cancelHandlers.length) {
104
+ try {
105
+ for (const cancelHandler of this.#cancelHandlers) {
106
+ cancelHandler();
107
+ }
108
+ } catch (error) {
109
+ console.warn("Cancellation threw an error", error);
110
+ return;
111
+ }
112
+ }
113
+ this.#cancelHandlers.length = 0;
114
+ if (this.#reject) this.#reject(new CancelError("Request aborted"));
115
+ }
116
+ get isCancelled() {
117
+ return this.#isCancelled;
118
+ }
119
+ };
120
+
121
+ // src/core/request.ts
122
+ var isDefined = (value) => {
123
+ return value !== void 0 && value !== null;
124
+ };
125
+ var isString = (value) => {
126
+ return typeof value === "string";
127
+ };
128
+ var isStringWithValue = (value) => {
129
+ return isString(value) && value !== "";
130
+ };
131
+ var isBlob = (value) => {
132
+ return typeof value === "object" && typeof value.type === "string" && typeof value.stream === "function" && typeof value.arrayBuffer === "function" && typeof value.constructor === "function" && typeof value.constructor.name === "string" && /^(Blob|File)$/.test(value.constructor.name) && /^(Blob|File)$/.test(value[Symbol.toStringTag]);
133
+ };
134
+ var isFormData = (value) => {
135
+ return value instanceof FormData;
136
+ };
137
+ var base64 = (str) => {
138
+ try {
139
+ return btoa(str);
140
+ } catch (err) {
141
+ return Buffer.from(str).toString("base64");
142
+ }
143
+ };
144
+ var getQueryString = (params) => {
145
+ const qs = [];
146
+ const append = (key, value) => {
147
+ qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
148
+ };
149
+ const process = (key, value) => {
150
+ if (isDefined(value)) {
151
+ if (Array.isArray(value)) {
152
+ value.forEach((v) => {
153
+ process(key, v);
154
+ });
155
+ } else if (typeof value === "object") {
156
+ Object.entries(value).forEach(([k, v]) => {
157
+ process(`${key}[${k}]`, v);
158
+ });
159
+ } else {
160
+ append(key, value);
161
+ }
162
+ }
163
+ };
164
+ Object.entries(params).forEach(([key, value]) => {
165
+ process(key, value);
166
+ });
167
+ if (qs.length > 0) {
168
+ return `?${qs.join("&")}`;
169
+ }
170
+ return "";
171
+ };
172
+ var getUrl = (config, options) => {
173
+ const encoder = config.ENCODE_PATH || encodeURI;
174
+ const path = options.url.replace("{api-version}", config.VERSION).replace(/{(.*?)}/g, (substring, group) => {
175
+ if (options.path?.hasOwnProperty(group)) {
176
+ return encoder(String(options.path[group]));
177
+ }
178
+ return substring;
179
+ });
180
+ const url = `${config.BASE}${path}`;
181
+ if (options.query) {
182
+ return `${url}${getQueryString(options.query)}`;
183
+ }
184
+ return url;
185
+ };
186
+ var getFormData = (options) => {
187
+ if (options.formData) {
188
+ const formData = new FormData();
189
+ const process = (key, value) => {
190
+ if (isString(value) || isBlob(value)) {
191
+ formData.append(key, value);
192
+ } else {
193
+ formData.append(key, JSON.stringify(value));
194
+ }
195
+ };
196
+ Object.entries(options.formData).filter(([_, value]) => isDefined(value)).forEach(([key, value]) => {
197
+ if (Array.isArray(value)) {
198
+ value.forEach((v) => process(key, v));
199
+ } else {
200
+ process(key, value);
201
+ }
202
+ });
203
+ return formData;
204
+ }
205
+ return void 0;
206
+ };
207
+ var resolve = async (options, resolver) => {
208
+ if (typeof resolver === "function") {
209
+ return resolver(options);
210
+ }
211
+ return resolver;
212
+ };
213
+ var getHeaders = async (config, options) => {
214
+ const [token, username, password, additionalHeaders] = await Promise.all([
215
+ resolve(options, config.TOKEN),
216
+ resolve(options, config.USERNAME),
217
+ resolve(options, config.PASSWORD),
218
+ resolve(options, config.HEADERS)
219
+ ]);
220
+ const headers = Object.entries({
221
+ Accept: "application/json",
222
+ ...additionalHeaders,
223
+ ...options.headers
224
+ }).filter(([_, value]) => isDefined(value)).reduce((headers2, [key, value]) => ({
225
+ ...headers2,
226
+ [key]: String(value)
227
+ }), {});
228
+ if (isStringWithValue(token)) {
229
+ headers["Authorization"] = `Bearer ${token}`;
230
+ }
231
+ if (isStringWithValue(username) && isStringWithValue(password)) {
232
+ const credentials = base64(`${username}:${password}`);
233
+ headers["Authorization"] = `Basic ${credentials}`;
234
+ }
235
+ if (options.body !== void 0) {
236
+ if (options.mediaType) {
237
+ headers["Content-Type"] = options.mediaType;
238
+ } else if (isBlob(options.body)) {
239
+ headers["Content-Type"] = options.body.type || "application/octet-stream";
240
+ } else if (isString(options.body)) {
241
+ headers["Content-Type"] = "text/plain";
242
+ } else if (!isFormData(options.body)) {
243
+ headers["Content-Type"] = "application/json";
244
+ }
245
+ }
246
+ return new Headers(headers);
247
+ };
248
+ var getRequestBody = (options) => {
249
+ if (options.body !== void 0) {
250
+ if (options.mediaType?.includes("/json")) {
251
+ return JSON.stringify(options.body);
252
+ } else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {
253
+ return options.body;
254
+ } else {
255
+ return JSON.stringify(options.body);
256
+ }
257
+ }
258
+ return void 0;
259
+ };
260
+ var sendRequest = async (config, options, url, body, formData, headers, onCancel) => {
261
+ const controller = new AbortController();
262
+ const request2 = {
263
+ headers,
264
+ body: body ?? formData,
265
+ method: options.method,
266
+ signal: controller.signal
267
+ };
268
+ if (config.WITH_CREDENTIALS) {
269
+ request2.credentials = config.CREDENTIALS;
270
+ }
271
+ onCancel(() => controller.abort());
272
+ return await fetch(url, request2);
273
+ };
274
+ var getResponseHeader = (response, responseHeader) => {
275
+ if (responseHeader) {
276
+ const content = response.headers.get(responseHeader);
277
+ if (isString(content)) {
278
+ return content;
279
+ }
280
+ }
281
+ return void 0;
282
+ };
283
+ var getResponseBody = async (response) => {
284
+ if (response.status !== 204) {
285
+ try {
286
+ const contentType = response.headers.get("Content-Type");
287
+ if (contentType) {
288
+ const jsonTypes = ["application/json", "application/problem+json"];
289
+ const isJSON = jsonTypes.some((type) => contentType.toLowerCase().startsWith(type));
290
+ if (isJSON) {
291
+ return await response.json();
292
+ } else {
293
+ return await response.text();
294
+ }
295
+ }
296
+ } catch (error) {
297
+ console.error(error);
298
+ }
299
+ }
300
+ return void 0;
301
+ };
302
+ var catchErrorCodes = (options, result) => {
303
+ const errors = {
304
+ 400: "Bad Request",
305
+ 401: "Unauthorized",
306
+ 403: "Forbidden",
307
+ 404: "Not Found",
308
+ 500: "Internal Server Error",
309
+ 502: "Bad Gateway",
310
+ 503: "Service Unavailable",
311
+ ...options.errors
312
+ };
313
+ const error = errors[result.status];
314
+ if (error) {
315
+ throw new ApiError(options, result, error);
316
+ }
317
+ if (!result.ok) {
318
+ const errorStatus = result.status ?? "unknown";
319
+ const errorStatusText = result.statusText ?? "unknown";
320
+ const errorBody = (() => {
321
+ try {
322
+ return JSON.stringify(result.body, null, 2);
323
+ } catch (e) {
324
+ return void 0;
325
+ }
326
+ })();
327
+ throw new ApiError(
328
+ options,
329
+ result,
330
+ `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`
331
+ );
332
+ }
333
+ };
334
+ var request = (config, options) => {
335
+ return new CancelablePromise(async (resolve2, reject, onCancel) => {
336
+ try {
337
+ const url = getUrl(config, options);
338
+ const formData = getFormData(options);
339
+ const body = getRequestBody(options);
340
+ const headers = await getHeaders(config, options);
341
+ if (!onCancel.isCancelled) {
342
+ const response = await sendRequest(config, options, url, body, formData, headers, onCancel);
343
+ const responseBody = await getResponseBody(response);
344
+ const responseHeader = getResponseHeader(response, options.responseHeader);
345
+ const result = {
346
+ url,
347
+ ok: response.ok,
348
+ status: response.status,
349
+ statusText: response.statusText,
350
+ body: responseHeader ?? responseBody
351
+ };
352
+ catchErrorCodes(options, result);
353
+ resolve2(result.body);
354
+ }
355
+ } catch (error) {
356
+ reject(error);
357
+ }
358
+ });
359
+ };
360
+
361
+ // src/core/FetchHttpRequest.ts
362
+ var FetchHttpRequest = class extends BaseHttpRequest {
363
+ constructor(config) {
364
+ super(config);
365
+ }
366
+ /**
367
+ * Request method
368
+ * @param options The request options from the service
369
+ * @returns CancelablePromise<T>
370
+ * @throws ApiError
371
+ */
372
+ request(options) {
373
+ return request(this.config, options);
374
+ }
375
+ };
376
+
377
+ // src/services/ApplicationsService.ts
378
+ var ApplicationsService = class {
379
+ constructor(httpRequest) {
380
+ this.httpRequest = httpRequest;
381
+ }
382
+ /**
383
+ * Get All Applications
384
+ * Retrieve all applications for the organization
385
+ * @returns GetAppsResponse Applications retrieved successfully
386
+ * @throws ApiError
387
+ */
388
+ getApps() {
389
+ return this.httpRequest.request({
390
+ method: "GET",
391
+ url: "/api/app",
392
+ errors: {
393
+ 500: `Internal server error`
394
+ }
395
+ });
396
+ }
397
+ /**
398
+ * Create Application
399
+ * Create a new application
400
+ * @param requestBody
401
+ * @returns CreateAppResponse Application created successfully
402
+ * @throws ApiError
403
+ */
404
+ createApp(requestBody) {
405
+ return this.httpRequest.request({
406
+ method: "POST",
407
+ url: "/api/app",
408
+ body: requestBody,
409
+ mediaType: "application/json",
410
+ errors: {
411
+ 500: `Internal server error`
412
+ }
413
+ });
414
+ }
415
+ /**
416
+ * Get Application
417
+ * Retrieve a specific application by ID
418
+ * @param id
419
+ * @returns GetAppResponse Application retrieved successfully
420
+ * @throws ApiError
421
+ */
422
+ getApp(id) {
423
+ return this.httpRequest.request({
424
+ method: "GET",
425
+ url: "/api/app/{id}",
426
+ path: {
427
+ "id": id
428
+ },
429
+ errors: {
430
+ 500: `Internal server error`
431
+ }
432
+ });
433
+ }
434
+ /**
435
+ * Update Application
436
+ * Update an existing application
437
+ * @param id
438
+ * @param requestBody
439
+ * @returns UpdateAppResponse Application updated successfully
440
+ * @throws ApiError
441
+ */
442
+ updateApp(id, requestBody) {
443
+ return this.httpRequest.request({
444
+ method: "PATCH",
445
+ url: "/api/app/{id}",
446
+ path: {
447
+ "id": id
448
+ },
449
+ body: requestBody,
450
+ mediaType: "application/json",
451
+ errors: {
452
+ 500: `Internal server error`
453
+ }
454
+ });
455
+ }
456
+ /**
457
+ * Delete Application
458
+ * Delete an existing application
459
+ * @param id
460
+ * @returns DeleteAppResponse Application deleted successfully
461
+ * @throws ApiError
462
+ */
463
+ deleteApp(id) {
464
+ return this.httpRequest.request({
465
+ method: "DELETE",
466
+ url: "/api/app/{id}",
467
+ path: {
468
+ "id": id
469
+ },
470
+ errors: {
471
+ 500: `Internal server error`
472
+ }
473
+ });
474
+ }
475
+ };
476
+
477
+ // src/services/AuditLogsService.ts
478
+ var AuditLogsService = class {
479
+ constructor(httpRequest) {
480
+ this.httpRequest = httpRequest;
481
+ }
482
+ /**
483
+ * Get Audit Logs
484
+ * Retrieve audit logs for the organization with pagination
485
+ * @param page
486
+ * @param perPage
487
+ * @returns GetAuditLogsResponse Audit logs retrieved successfully
488
+ * @throws ApiError
489
+ */
490
+ getAuditLogs(page = 1, perPage = 20) {
491
+ return this.httpRequest.request({
492
+ method: "GET",
493
+ url: "/api/audit_log",
494
+ query: {
495
+ "page": page,
496
+ "per_page": perPage
497
+ },
498
+ errors: {
499
+ 500: `Internal server error`
500
+ }
501
+ });
502
+ }
503
+ };
504
+
505
+ // src/services/AuthenticationService.ts
506
+ var AuthenticationService = class {
507
+ constructor(httpRequest) {
508
+ this.httpRequest = httpRequest;
509
+ }
510
+ /**
511
+ * Get Current User
512
+ * Retrieve the current authenticated user's information and their organization details
513
+ * @returns WhoAmIResponse User information retrieved successfully
514
+ * @throws ApiError
515
+ */
516
+ whoami() {
517
+ return this.httpRequest.request({
518
+ method: "GET",
519
+ url: "/api/auth/me",
520
+ errors: {
521
+ 500: `Internal server error`
522
+ }
523
+ });
524
+ }
525
+ };
526
+
527
+ // src/services/EnvironmentTypesService.ts
528
+ var EnvironmentTypesService = class {
529
+ constructor(httpRequest) {
530
+ this.httpRequest = httpRequest;
531
+ }
532
+ /**
533
+ * Get Environment Types
534
+ * Retrieve all environment types for the organization
535
+ * @returns EnvTypesResponse Environment types retrieved successfully
536
+ * @throws ApiError
537
+ */
538
+ getEnvTypes() {
539
+ return this.httpRequest.request({
540
+ method: "GET",
541
+ url: "/api/env_type",
542
+ errors: {
543
+ 500: `Internal server error`
544
+ }
545
+ });
546
+ }
547
+ /**
548
+ * Create Environment Type
549
+ * Create a new environment type
550
+ * @param requestBody
551
+ * @returns EnvTypeResponse Environment type created successfully
552
+ * @throws ApiError
553
+ */
554
+ createEnvType(requestBody) {
555
+ return this.httpRequest.request({
556
+ method: "POST",
557
+ url: "/api/env_type",
558
+ body: requestBody,
559
+ mediaType: "application/json",
560
+ errors: {
561
+ 500: `Internal server error`
562
+ }
563
+ });
564
+ }
565
+ /**
566
+ * Get Environment Type
567
+ * Retrieve a specific environment type
568
+ * @param id
569
+ * @returns EnvTypeResponse Environment type retrieved successfully
570
+ * @throws ApiError
571
+ */
572
+ getEnvType(id) {
573
+ return this.httpRequest.request({
574
+ method: "GET",
575
+ url: "/api/env_type/{id}",
576
+ path: {
577
+ "id": id
578
+ },
579
+ errors: {
580
+ 500: `Internal server error`
581
+ }
582
+ });
583
+ }
584
+ /**
585
+ * Update Environment Type
586
+ * Update an existing environment type
587
+ * @param id
588
+ * @param requestBody
589
+ * @returns EnvTypeResponse Environment type updated successfully
590
+ * @throws ApiError
591
+ */
592
+ updateEnvType(id, requestBody) {
593
+ return this.httpRequest.request({
594
+ method: "PATCH",
595
+ url: "/api/env_type/{id}",
596
+ path: {
597
+ "id": id
598
+ },
599
+ body: requestBody,
600
+ mediaType: "application/json",
601
+ errors: {
602
+ 500: `Internal server error`
603
+ }
604
+ });
605
+ }
606
+ /**
607
+ * Delete Environment Type
608
+ * Delete an existing environment type
609
+ * @param id
610
+ * @returns DeleteEnvTypeRequest Environment type deleted successfully
611
+ * @throws ApiError
612
+ */
613
+ deleteEnvType(id) {
614
+ return this.httpRequest.request({
615
+ method: "DELETE",
616
+ url: "/api/env_type/{id}",
617
+ path: {
618
+ "id": id
619
+ },
620
+ errors: {
621
+ 500: `Internal server error`
622
+ }
623
+ });
624
+ }
625
+ };
626
+
627
+ // src/services/EnvironmentVariablesService.ts
628
+ var EnvironmentVariablesService = class {
629
+ constructor(httpRequest) {
630
+ this.httpRequest = httpRequest;
631
+ }
632
+ /**
633
+ * Get Environment Variables
634
+ * Retrieve all environment variables for an application and environment type
635
+ * @param requestBody
636
+ * @returns EnvsResponse Environment variables retrieved successfully
637
+ * @throws ApiError
638
+ */
639
+ getEnvs(requestBody) {
640
+ return this.httpRequest.request({
641
+ method: "POST",
642
+ url: "/api/env",
643
+ body: requestBody,
644
+ mediaType: "application/json",
645
+ errors: {
646
+ 500: `Internal server error`
647
+ }
648
+ });
649
+ }
650
+ /**
651
+ * Delete Environment Variable
652
+ * Delete an existing environment variable
653
+ * @param requestBody
654
+ * @returns DeleteEnvRequest Environment variable deleted successfully
655
+ * @throws ApiError
656
+ */
657
+ deleteEnv(requestBody) {
658
+ return this.httpRequest.request({
659
+ method: "DELETE",
660
+ url: "/api/env",
661
+ body: requestBody,
662
+ mediaType: "application/json",
663
+ errors: {
664
+ 500: `Internal server error`
665
+ }
666
+ });
667
+ }
668
+ /**
669
+ * Get Single Environment Variable
670
+ * Retrieve a specific environment variable
671
+ * @param key
672
+ * @param requestBody
673
+ * @returns EnvResponse Environment variable retrieved successfully
674
+ * @throws ApiError
675
+ */
676
+ getEnv(key, requestBody) {
677
+ return this.httpRequest.request({
678
+ method: "POST",
679
+ url: "/api/env/{key}",
680
+ path: {
681
+ "key": key
682
+ },
683
+ body: requestBody,
684
+ mediaType: "application/json",
685
+ errors: {
686
+ 500: `Internal server error`
687
+ }
688
+ });
689
+ }
690
+ /**
691
+ * Update Environment Variable
692
+ * Update an existing environment variable
693
+ * @param key
694
+ * @param requestBody
695
+ * @returns EnvResponse Environment variable updated successfully
696
+ * @throws ApiError
697
+ */
698
+ updateEnv(key, requestBody) {
699
+ return this.httpRequest.request({
700
+ method: "PATCH",
701
+ url: "/api/env/{key}",
702
+ path: {
703
+ "key": key
704
+ },
705
+ body: requestBody,
706
+ mediaType: "application/json",
707
+ errors: {
708
+ 500: `Internal server error`
709
+ }
710
+ });
711
+ }
712
+ /**
713
+ * Create Environment Variable
714
+ * Create a new environment variable
715
+ * @param requestBody
716
+ * @returns EnvResponse Environment variable created successfully
717
+ * @throws ApiError
718
+ */
719
+ createEnv(requestBody) {
720
+ return this.httpRequest.request({
721
+ method: "PUT",
722
+ url: "/api/env/single",
723
+ body: requestBody,
724
+ mediaType: "application/json",
725
+ errors: {
726
+ 500: `Internal server error`
727
+ }
728
+ });
729
+ }
730
+ /**
731
+ * Batch Create Environment Variables
732
+ * Create multiple environment variables in a single request
733
+ * @param requestBody
734
+ * @returns EnvsResponse Environment variables created successfully
735
+ * @throws ApiError
736
+ */
737
+ batchCreateEnvs(requestBody) {
738
+ return this.httpRequest.request({
739
+ method: "PUT",
740
+ url: "/api/env/batch",
741
+ body: requestBody,
742
+ mediaType: "application/json",
743
+ errors: {
744
+ 500: `Internal server error`
745
+ }
746
+ });
747
+ }
748
+ };
749
+
750
+ // src/services/OnboardingService.ts
751
+ var OnboardingService = class {
752
+ constructor(httpRequest) {
753
+ this.httpRequest = httpRequest;
754
+ }
755
+ /**
756
+ * Create Organization Invite
757
+ * Create an organization invite
758
+ * @param requestBody
759
+ * @returns CreateOrgInviteResponse Successful greeting response
760
+ * @throws ApiError
761
+ */
762
+ createOrgInvite(requestBody) {
763
+ return this.httpRequest.request({
764
+ method: "POST",
765
+ url: "/api/onboarding/org",
766
+ body: requestBody,
767
+ mediaType: "application/json",
768
+ errors: {
769
+ 500: `Internal server error`
770
+ }
771
+ });
772
+ }
773
+ /**
774
+ * Get Organization Invite by Code
775
+ * Get organization invite by code
776
+ * @param inviteCode
777
+ * @returns GetOrgInviteByCodeResponse Organization invite retrieved successfully
778
+ * @throws ApiError
779
+ */
780
+ getOrgInviteByCode(inviteCode) {
781
+ return this.httpRequest.request({
782
+ method: "GET",
783
+ url: "/api/onboarding/org/{invite_code}",
784
+ path: {
785
+ "invite_code": inviteCode
786
+ },
787
+ errors: {
788
+ 500: `Internal server error`
789
+ }
790
+ });
791
+ }
792
+ /**
793
+ * Accept Organization Invite
794
+ * Accept organization invite
795
+ * @param inviteCode
796
+ * @param requestBody
797
+ * @returns AcceptOrgInviteResponse Organization invite accepted successfully
798
+ * @throws ApiError
799
+ */
800
+ acceptOrgInvite(inviteCode, requestBody) {
801
+ return this.httpRequest.request({
802
+ method: "PUT",
803
+ url: "/api/onboarding/org/{invite_code}/accept",
804
+ path: {
805
+ "invite_code": inviteCode
806
+ },
807
+ body: requestBody,
808
+ mediaType: "application/json",
809
+ errors: {
810
+ 500: `Internal server error`
811
+ }
812
+ });
813
+ }
814
+ /**
815
+ * Get User Invite by Code
816
+ * Get user invite by code
817
+ * @param inviteCode
818
+ * @returns GetUserInviteByTokenResponse User invite retrieved successfully
819
+ * @throws ApiError
820
+ */
821
+ getUserInviteByCode(inviteCode) {
822
+ return this.httpRequest.request({
823
+ method: "GET",
824
+ url: "/api/onboarding/user/{invite_code}",
825
+ path: {
826
+ "invite_code": inviteCode
827
+ },
828
+ errors: {
829
+ 500: `Internal server error`
830
+ }
831
+ });
832
+ }
833
+ /**
834
+ * Update User Invite
835
+ * Update user invite
836
+ * @param inviteCode
837
+ * @param requestBody
838
+ * @returns UpdateUserInviteResponse User invite updated successfully
839
+ * @throws ApiError
840
+ */
841
+ updateUserInvite(inviteCode, requestBody) {
842
+ return this.httpRequest.request({
843
+ method: "PATCH",
844
+ url: "/api/onboarding/user/{invite_code}",
845
+ path: {
846
+ "invite_code": inviteCode
847
+ },
848
+ body: requestBody,
849
+ mediaType: "application/json",
850
+ errors: {
851
+ 500: `Internal server error`
852
+ }
853
+ });
854
+ }
855
+ /**
856
+ * Accept User Invite
857
+ * Accept user invite
858
+ * @param inviteCode
859
+ * @param requestBody
860
+ * @returns AcceptUserInviteResponse User invite accepted successfully
861
+ * @throws ApiError
862
+ */
863
+ acceptUserInvite(inviteCode, requestBody) {
864
+ return this.httpRequest.request({
865
+ method: "PUT",
866
+ url: "/api/onboarding/user/{invite_code}/accept",
867
+ path: {
868
+ "invite_code": inviteCode
869
+ },
870
+ body: requestBody,
871
+ mediaType: "application/json",
872
+ errors: {
873
+ 500: `Internal server error`
874
+ }
875
+ });
876
+ }
877
+ /**
878
+ * Create User Invite
879
+ * Create a user invite
880
+ * @param requestBody
881
+ * @returns CreateUserInviteResponse User invite created successfully
882
+ * @throws ApiError
883
+ */
884
+ createUserInvite(requestBody) {
885
+ return this.httpRequest.request({
886
+ method: "POST",
887
+ url: "/api/onboarding/user",
888
+ body: requestBody,
889
+ mediaType: "application/json",
890
+ errors: {
891
+ 500: `Internal server error`
892
+ }
893
+ });
894
+ }
895
+ /**
896
+ * Delete User Invite
897
+ * Delete user invite
898
+ * @param inviteId
899
+ * @param requestBody
900
+ * @returns DeleteUserInviteResponse User invite deleted successfully
901
+ * @throws ApiError
902
+ */
903
+ deleteUserInvite(inviteId, requestBody) {
904
+ return this.httpRequest.request({
905
+ method: "DELETE",
906
+ url: "/api/onboarding/user/{invite_id}",
907
+ path: {
908
+ "invite_id": inviteId
909
+ },
910
+ body: requestBody,
911
+ mediaType: "application/json",
912
+ errors: {
913
+ 500: `Internal server error`
914
+ }
915
+ });
916
+ }
917
+ };
918
+
919
+ // src/services/OrganizationsService.ts
920
+ var OrganizationsService = class {
921
+ constructor(httpRequest) {
922
+ this.httpRequest = httpRequest;
923
+ }
924
+ /**
925
+ * Get Organization
926
+ * Retrieve the current organization's details
927
+ * @returns OrgResponse Organization retrieved successfully
928
+ * @throws ApiError
929
+ */
930
+ getOrg() {
931
+ return this.httpRequest.request({
932
+ method: "GET",
933
+ url: "/api/org",
934
+ errors: {
935
+ 500: `Internal server error`
936
+ }
937
+ });
938
+ }
939
+ /**
940
+ * Update Organization
941
+ * Update the current organization's details
942
+ * @param requestBody
943
+ * @returns OrgResponse Organization updated successfully
944
+ * @throws ApiError
945
+ */
946
+ updateOrg(requestBody) {
947
+ return this.httpRequest.request({
948
+ method: "PATCH",
949
+ url: "/api/org",
950
+ body: requestBody,
951
+ mediaType: "application/json",
952
+ errors: {
953
+ 500: `Internal server error`
954
+ }
955
+ });
956
+ }
957
+ /**
958
+ * Check Slug Availability
959
+ * Check if an organization slug is available
960
+ * @param slug
961
+ * @returns CheckSlugResponse Slug availability checked successfully
962
+ * @throws ApiError
963
+ */
964
+ checkIfSlugExists(slug) {
965
+ return this.httpRequest.request({
966
+ method: "GET",
967
+ url: "/api/org/check-slug",
968
+ query: {
969
+ "slug": slug
970
+ },
971
+ errors: {
972
+ 500: `Internal server error`
973
+ }
974
+ });
975
+ }
976
+ };
977
+
978
+ // src/services/UsersService.ts
979
+ var UsersService = class {
980
+ constructor(httpRequest) {
981
+ this.httpRequest = httpRequest;
982
+ }
983
+ /**
984
+ * Get All Users
985
+ * Retrieve all users in the organization
986
+ * @returns UsersResponse Users retrieved successfully
987
+ * @throws ApiError
988
+ */
989
+ getUsers() {
990
+ return this.httpRequest.request({
991
+ method: "GET",
992
+ url: "/api/user",
993
+ errors: {
994
+ 500: `Internal server error`
995
+ }
996
+ });
997
+ }
998
+ /**
999
+ * Get User by ID
1000
+ * Retrieve a specific user by their ID
1001
+ * @param id
1002
+ * @returns UserResponse User retrieved successfully
1003
+ * @throws ApiError
1004
+ */
1005
+ getUserById(id) {
1006
+ return this.httpRequest.request({
1007
+ method: "GET",
1008
+ url: "/api/user/{id}",
1009
+ path: {
1010
+ "id": id
1011
+ },
1012
+ errors: {
1013
+ 500: `Internal server error`
1014
+ }
1015
+ });
1016
+ }
1017
+ /**
1018
+ * Update User
1019
+ * Update a user's profile information
1020
+ * @param id
1021
+ * @param requestBody
1022
+ * @returns UserResponse User updated successfully
1023
+ * @throws ApiError
1024
+ */
1025
+ updateUser(id, requestBody) {
1026
+ return this.httpRequest.request({
1027
+ method: "PATCH",
1028
+ url: "/api/user/{id}",
1029
+ path: {
1030
+ "id": id
1031
+ },
1032
+ body: requestBody,
1033
+ mediaType: "application/json",
1034
+ errors: {
1035
+ 500: `Internal server error`
1036
+ }
1037
+ });
1038
+ }
1039
+ /**
1040
+ * Delete User
1041
+ * Delete a user from the organization (Admin only)
1042
+ * @param id
1043
+ * @returns UserResponse User deleted successfully
1044
+ * @throws ApiError
1045
+ */
1046
+ deleteUser(id) {
1047
+ return this.httpRequest.request({
1048
+ method: "DELETE",
1049
+ url: "/api/user/{id}",
1050
+ path: {
1051
+ "id": id
1052
+ },
1053
+ errors: {
1054
+ 500: `Internal server error`
1055
+ }
1056
+ });
1057
+ }
1058
+ /**
1059
+ * Update User Role
1060
+ * Update a user's role (Admin only)
1061
+ * @param id
1062
+ * @param requestBody
1063
+ * @returns UserResponse User role updated successfully
1064
+ * @throws ApiError
1065
+ */
1066
+ updateRole(id, requestBody) {
1067
+ return this.httpRequest.request({
1068
+ method: "PATCH",
1069
+ url: "/api/user/role/{id}",
1070
+ path: {
1071
+ "id": id
1072
+ },
1073
+ body: requestBody,
1074
+ mediaType: "application/json",
1075
+ errors: {
1076
+ 500: `Internal server error`
1077
+ }
1078
+ });
1079
+ }
1080
+ /**
1081
+ * Update User Password
1082
+ * Update a user's password (Admin only)
1083
+ * @param id
1084
+ * @param requestBody
1085
+ * @returns UserResponse Password update request sent successfully
1086
+ * @throws ApiError
1087
+ */
1088
+ updatePassword(id, requestBody) {
1089
+ return this.httpRequest.request({
1090
+ method: "PATCH",
1091
+ url: "/api/user/password/{id}",
1092
+ path: {
1093
+ "id": id
1094
+ },
1095
+ body: requestBody,
1096
+ mediaType: "application/json",
1097
+ errors: {
1098
+ 500: `Internal server error`
1099
+ }
1100
+ });
1101
+ }
1102
+ };
1103
+
1104
+ // src/EnvSyncAPISDK.ts
1105
+ var EnvSyncAPISDK = class {
1106
+ applications;
1107
+ auditLogs;
1108
+ authentication;
1109
+ environmentTypes;
1110
+ environmentVariables;
1111
+ onboarding;
1112
+ organizations;
1113
+ users;
1114
+ request;
1115
+ constructor(config, HttpRequest = FetchHttpRequest) {
1116
+ this.request = new HttpRequest({
1117
+ BASE: config?.BASE ?? "http://localhost:8600",
1118
+ VERSION: config?.VERSION ?? "0.0.0",
1119
+ WITH_CREDENTIALS: config?.WITH_CREDENTIALS ?? false,
1120
+ CREDENTIALS: config?.CREDENTIALS ?? "include",
1121
+ TOKEN: config?.TOKEN,
1122
+ USERNAME: config?.USERNAME,
1123
+ PASSWORD: config?.PASSWORD,
1124
+ HEADERS: config?.HEADERS,
1125
+ ENCODE_PATH: config?.ENCODE_PATH
1126
+ });
1127
+ this.applications = new ApplicationsService(this.request);
1128
+ this.auditLogs = new AuditLogsService(this.request);
1129
+ this.authentication = new AuthenticationService(this.request);
1130
+ this.environmentTypes = new EnvironmentTypesService(this.request);
1131
+ this.environmentVariables = new EnvironmentVariablesService(this.request);
1132
+ this.onboarding = new OnboardingService(this.request);
1133
+ this.organizations = new OrganizationsService(this.request);
1134
+ this.users = new UsersService(this.request);
1135
+ }
1136
+ };
1137
+
1138
+ // src/core/OpenAPI.ts
1139
+ var OpenAPI = {
1140
+ BASE: "http://localhost:8600",
1141
+ VERSION: "0.0.0",
1142
+ WITH_CREDENTIALS: false,
1143
+ CREDENTIALS: "include",
1144
+ TOKEN: void 0,
1145
+ USERNAME: void 0,
1146
+ PASSWORD: void 0,
1147
+ HEADERS: void 0,
1148
+ ENCODE_PATH: void 0
1149
+ };
1150
+ })();