@unified-api/typescript-sdk 2.80.10 → 2.80.11

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 (51) hide show
  1. package/README.md +6 -0
  2. package/examples/package-lock.json +1 -1
  3. package/funcs/unifiedCreateUnifiedEnvironment.d.ts +10 -0
  4. package/funcs/unifiedCreateUnifiedEnvironment.d.ts.map +1 -0
  5. package/funcs/unifiedCreateUnifiedEnvironment.js +107 -0
  6. package/funcs/unifiedCreateUnifiedEnvironment.js.map +1 -0
  7. package/funcs/unifiedListUnifiedEnvironments.d.ts +10 -0
  8. package/funcs/unifiedListUnifiedEnvironments.d.ts.map +1 -0
  9. package/funcs/unifiedListUnifiedEnvironments.js +97 -0
  10. package/funcs/unifiedListUnifiedEnvironments.js.map +1 -0
  11. package/funcs/unifiedRemoveUnifiedEnvironment.d.ts +11 -0
  12. package/funcs/unifiedRemoveUnifiedEnvironment.d.ts.map +1 -0
  13. package/funcs/unifiedRemoveUnifiedEnvironment.js +113 -0
  14. package/funcs/unifiedRemoveUnifiedEnvironment.js.map +1 -0
  15. package/jsr.json +1 -1
  16. package/lib/config.d.ts +3 -3
  17. package/lib/config.js +3 -3
  18. package/lib/encodings.d.ts.map +1 -1
  19. package/lib/encodings.js +3 -1
  20. package/lib/encodings.js.map +1 -1
  21. package/package.json +1 -1
  22. package/sdk/environment.d.ts +8 -0
  23. package/sdk/environment.d.ts.map +1 -0
  24. package/sdk/environment.js +24 -0
  25. package/sdk/environment.js.map +1 -0
  26. package/sdk/models/operations/index.d.ts +1 -0
  27. package/sdk/models/operations/index.d.ts.map +1 -1
  28. package/sdk/models/operations/index.js +1 -0
  29. package/sdk/models/operations/index.js.map +1 -1
  30. package/sdk/models/operations/removeunifiedenvironment.d.ts +12 -0
  31. package/sdk/models/operations/removeunifiedenvironment.d.ts.map +1 -0
  32. package/sdk/models/operations/removeunifiedenvironment.js +49 -0
  33. package/sdk/models/operations/removeunifiedenvironment.js.map +1 -0
  34. package/sdk/sdk.d.ts +3 -0
  35. package/sdk/sdk.d.ts.map +1 -1
  36. package/sdk/sdk.js +4 -0
  37. package/sdk/sdk.js.map +1 -1
  38. package/sdk/unified.d.ts +3 -0
  39. package/sdk/unified.d.ts.map +1 -1
  40. package/sdk/unified.js +12 -0
  41. package/sdk/unified.js.map +1 -1
  42. package/src/funcs/unifiedCreateUnifiedEnvironment.ts +153 -0
  43. package/src/funcs/unifiedListUnifiedEnvironments.ts +135 -0
  44. package/src/funcs/unifiedRemoveUnifiedEnvironment.ts +161 -0
  45. package/src/lib/config.ts +3 -3
  46. package/src/lib/encodings.ts +4 -3
  47. package/src/sdk/environment.ts +43 -0
  48. package/src/sdk/models/operations/index.ts +1 -0
  49. package/src/sdk/models/operations/removeunifiedenvironment.ts +33 -0
  50. package/src/sdk/sdk.ts +6 -0
  51. package/src/sdk/unified.ts +34 -0
@@ -0,0 +1,135 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { UnifiedToCore } from "../core.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { RequestOptions } from "../lib/sdks.js";
10
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
+ import { pathToFunc } from "../lib/url.js";
12
+ import {
13
+ ConnectionError,
14
+ InvalidRequestError,
15
+ RequestAbortedError,
16
+ RequestTimeoutError,
17
+ UnexpectedClientError,
18
+ } from "../sdk/models/errors/httpclienterrors.js";
19
+ import { ResponseValidationError } from "../sdk/models/errors/responsevalidationerror.js";
20
+ import { SDKValidationError } from "../sdk/models/errors/sdkvalidationerror.js";
21
+ import { UnifiedToError } from "../sdk/models/errors/unifiedtoerror.js";
22
+ import { APICall, APIPromise } from "../sdk/types/async.js";
23
+ import { Result } from "../sdk/types/fp.js";
24
+
25
+ export function unifiedListUnifiedEnvironments(
26
+ client: UnifiedToCore,
27
+ options?: RequestOptions,
28
+ ): APIPromise<
29
+ Result<
30
+ Array<string>,
31
+ | UnifiedToError
32
+ | ResponseValidationError
33
+ | ConnectionError
34
+ | RequestAbortedError
35
+ | RequestTimeoutError
36
+ | InvalidRequestError
37
+ | UnexpectedClientError
38
+ | SDKValidationError
39
+ >
40
+ > {
41
+ return new APIPromise($do(
42
+ client,
43
+ options,
44
+ ));
45
+ }
46
+
47
+ async function $do(
48
+ client: UnifiedToCore,
49
+ options?: RequestOptions,
50
+ ): Promise<
51
+ [
52
+ Result<
53
+ Array<string>,
54
+ | UnifiedToError
55
+ | ResponseValidationError
56
+ | ConnectionError
57
+ | RequestAbortedError
58
+ | RequestTimeoutError
59
+ | InvalidRequestError
60
+ | UnexpectedClientError
61
+ | SDKValidationError
62
+ >,
63
+ APICall,
64
+ ]
65
+ > {
66
+ const path = pathToFunc("/unified/environment")();
67
+
68
+ const headers = new Headers(compactMap({
69
+ Accept: "application/json",
70
+ }));
71
+
72
+ const securityInput = await extractSecurity(client._options.security);
73
+ const requestSecurity = resolveGlobalSecurity(securityInput);
74
+
75
+ const context = {
76
+ options: client._options,
77
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
78
+ operationID: "listUnifiedEnvironments",
79
+ oAuth2Scopes: null,
80
+
81
+ resolvedSecurity: requestSecurity,
82
+
83
+ securitySource: client._options.security,
84
+ retryConfig: options?.retries
85
+ || client._options.retryConfig
86
+ || { strategy: "none" },
87
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
88
+ };
89
+
90
+ const requestRes = client._createRequest(context, {
91
+ security: requestSecurity,
92
+ method: "GET",
93
+ baseURL: options?.serverURL,
94
+ path: path,
95
+ headers: headers,
96
+ userAgent: client._options.userAgent,
97
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
98
+ }, options);
99
+ if (!requestRes.ok) {
100
+ return [requestRes, { status: "invalid" }];
101
+ }
102
+ const req = requestRes.value;
103
+
104
+ const doResult = await client._do(req, {
105
+ context,
106
+ errorCodes: ["4XX", "5XX"],
107
+ retryConfig: context.retryConfig,
108
+ retryCodes: context.retryCodes,
109
+ });
110
+ if (!doResult.ok) {
111
+ return [doResult, { status: "request-error", request: req }];
112
+ }
113
+ const response = doResult.value;
114
+
115
+ const [result] = await M.match<
116
+ Array<string>,
117
+ | UnifiedToError
118
+ | ResponseValidationError
119
+ | ConnectionError
120
+ | RequestAbortedError
121
+ | RequestTimeoutError
122
+ | InvalidRequestError
123
+ | UnexpectedClientError
124
+ | SDKValidationError
125
+ >(
126
+ M.json(200, z.array(z.string())),
127
+ M.fail("4XX"),
128
+ M.fail("5XX"),
129
+ )(response, req);
130
+ if (!result.ok) {
131
+ return [result, { status: "complete", request: req, response }];
132
+ }
133
+
134
+ return [result, { status: "complete", request: req, response }];
135
+ }
@@ -0,0 +1,161 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { UnifiedToCore } from "../core.js";
7
+ import { encodeSimple } from "../lib/encodings.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../sdk/models/errors/httpclienterrors.js";
21
+ import { ResponseValidationError } from "../sdk/models/errors/responsevalidationerror.js";
22
+ import { SDKValidationError } from "../sdk/models/errors/sdkvalidationerror.js";
23
+ import { UnifiedToError } from "../sdk/models/errors/unifiedtoerror.js";
24
+ import * as operations from "../sdk/models/operations/index.js";
25
+ import { APICall, APIPromise } from "../sdk/types/async.js";
26
+ import { Result } from "../sdk/types/fp.js";
27
+
28
+ export function unifiedRemoveUnifiedEnvironment(
29
+ client: UnifiedToCore,
30
+ request: operations.RemoveUnifiedEnvironmentRequest,
31
+ options?: RequestOptions,
32
+ ): APIPromise<
33
+ Result<
34
+ Array<string>,
35
+ | UnifiedToError
36
+ | ResponseValidationError
37
+ | ConnectionError
38
+ | RequestAbortedError
39
+ | RequestTimeoutError
40
+ | InvalidRequestError
41
+ | UnexpectedClientError
42
+ | SDKValidationError
43
+ >
44
+ > {
45
+ return new APIPromise($do(
46
+ client,
47
+ request,
48
+ options,
49
+ ));
50
+ }
51
+
52
+ async function $do(
53
+ client: UnifiedToCore,
54
+ request: operations.RemoveUnifiedEnvironmentRequest,
55
+ options?: RequestOptions,
56
+ ): Promise<
57
+ [
58
+ Result<
59
+ Array<string>,
60
+ | UnifiedToError
61
+ | ResponseValidationError
62
+ | ConnectionError
63
+ | RequestAbortedError
64
+ | RequestTimeoutError
65
+ | InvalidRequestError
66
+ | UnexpectedClientError
67
+ | SDKValidationError
68
+ >,
69
+ APICall,
70
+ ]
71
+ > {
72
+ const parsed = safeParse(
73
+ request,
74
+ (value) =>
75
+ operations.RemoveUnifiedEnvironmentRequest$outboundSchema.parse(value),
76
+ "Input validation failed",
77
+ );
78
+ if (!parsed.ok) {
79
+ return [parsed, { status: "invalid" }];
80
+ }
81
+ const payload = parsed.value;
82
+ const body = null;
83
+
84
+ const pathParams = {
85
+ env: encodeSimple("env", payload.env, {
86
+ explode: false,
87
+ charEncoding: "percent",
88
+ }),
89
+ };
90
+
91
+ const path = pathToFunc("/unified/environment/{env}")(pathParams);
92
+
93
+ const headers = new Headers(compactMap({
94
+ Accept: "application/json",
95
+ }));
96
+
97
+ const securityInput = await extractSecurity(client._options.security);
98
+ const requestSecurity = resolveGlobalSecurity(securityInput);
99
+
100
+ const context = {
101
+ options: client._options,
102
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
103
+ operationID: "removeUnifiedEnvironment",
104
+ oAuth2Scopes: null,
105
+
106
+ resolvedSecurity: requestSecurity,
107
+
108
+ securitySource: client._options.security,
109
+ retryConfig: options?.retries
110
+ || client._options.retryConfig
111
+ || { strategy: "none" },
112
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
113
+ };
114
+
115
+ const requestRes = client._createRequest(context, {
116
+ security: requestSecurity,
117
+ method: "DELETE",
118
+ baseURL: options?.serverURL,
119
+ path: path,
120
+ headers: headers,
121
+ body: body,
122
+ userAgent: client._options.userAgent,
123
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
124
+ }, options);
125
+ if (!requestRes.ok) {
126
+ return [requestRes, { status: "invalid" }];
127
+ }
128
+ const req = requestRes.value;
129
+
130
+ const doResult = await client._do(req, {
131
+ context,
132
+ errorCodes: ["4XX", "5XX"],
133
+ retryConfig: context.retryConfig,
134
+ retryCodes: context.retryCodes,
135
+ });
136
+ if (!doResult.ok) {
137
+ return [doResult, { status: "request-error", request: req }];
138
+ }
139
+ const response = doResult.value;
140
+
141
+ const [result] = await M.match<
142
+ Array<string>,
143
+ | UnifiedToError
144
+ | ResponseValidationError
145
+ | ConnectionError
146
+ | RequestAbortedError
147
+ | RequestTimeoutError
148
+ | InvalidRequestError
149
+ | UnexpectedClientError
150
+ | SDKValidationError
151
+ >(
152
+ M.json(200, z.array(z.string())),
153
+ M.fail("4XX"),
154
+ M.fail("5XX"),
155
+ )(response, req);
156
+ if (!result.ok) {
157
+ return [result, { status: "complete", request: req, response }];
158
+ }
159
+
160
+ return [result, { status: "complete", request: req, response }];
161
+ }
package/src/lib/config.ts CHANGED
@@ -73,8 +73,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
73
73
  export const SDK_METADATA = {
74
74
  language: "typescript",
75
75
  openapiDocVersion: "1.0",
76
- sdkVersion: "2.80.10",
77
- genVersion: "2.760.2",
76
+ sdkVersion: "2.80.11",
77
+ genVersion: "2.763.3",
78
78
  userAgent:
79
- "speakeasy-sdk/typescript 2.80.10 2.760.2 1.0 @unified-api/typescript-sdk",
79
+ "speakeasy-sdk/typescript 2.80.11 2.763.3 1.0 @unified-api/typescript-sdk",
80
80
  } as const;
@@ -102,8 +102,9 @@ export function encodeLabel(
102
102
  });
103
103
  encValue = mapped?.join("").slice(1);
104
104
  } else {
105
- const k =
106
- options?.explode && isPlainObject(value) ? `${encodeString(pk)}=` : "";
105
+ const k = options?.explode && isPlainObject(value)
106
+ ? `${encodeString(pk)}=`
107
+ : "";
107
108
  encValue = `${k}${encodeValue(pv)}`;
108
109
  }
109
110
 
@@ -440,7 +441,7 @@ type BulkQueryEncoder = (
440
441
  ) => string;
441
442
 
442
443
  export function queryEncoder(f: QueryEncoder): BulkQueryEncoder {
443
- const bulkEncode = function (
444
+ const bulkEncode = function(
444
445
  values: Record<string, unknown>,
445
446
  options?: QueryEncoderOptions,
446
447
  ): string {
@@ -0,0 +1,43 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { unifiedCreateUnifiedEnvironment } from "../funcs/unifiedCreateUnifiedEnvironment.js";
6
+ import { unifiedListUnifiedEnvironments } from "../funcs/unifiedListUnifiedEnvironments.js";
7
+ import { unifiedRemoveUnifiedEnvironment } from "../funcs/unifiedRemoveUnifiedEnvironment.js";
8
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
9
+ import * as operations from "./models/operations/index.js";
10
+ import { unwrapAsync } from "./types/fp.js";
11
+
12
+ export class Environment extends ClientSDK {
13
+ async createUnifiedEnvironment(
14
+ request: Array<string>,
15
+ options?: RequestOptions,
16
+ ): Promise<Array<string>> {
17
+ return unwrapAsync(unifiedCreateUnifiedEnvironment(
18
+ this,
19
+ request,
20
+ options,
21
+ ));
22
+ }
23
+
24
+ async listUnifiedEnvironments(
25
+ options?: RequestOptions,
26
+ ): Promise<Array<string>> {
27
+ return unwrapAsync(unifiedListUnifiedEnvironments(
28
+ this,
29
+ options,
30
+ ));
31
+ }
32
+
33
+ async removeUnifiedEnvironment(
34
+ request: operations.RemoveUnifiedEnvironmentRequest,
35
+ options?: RequestOptions,
36
+ ): Promise<Array<string>> {
37
+ return unwrapAsync(unifiedRemoveUnifiedEnvironment(
38
+ this,
39
+ request,
40
+ options,
41
+ ));
42
+ }
43
+ }
@@ -447,6 +447,7 @@ export * from "./removeuccomment.js";
447
447
  export * from "./removeuccontact.js";
448
448
  export * from "./removeucrecording.js";
449
449
  export * from "./removeunifiedconnection.js";
450
+ export * from "./removeunifiedenvironment.js";
450
451
  export * from "./removeunifiedwebhook.js";
451
452
  export * from "./removeverificationrequest.js";
452
453
  export * from "./updateaccountingaccount.js";
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+
7
+ export type RemoveUnifiedEnvironmentRequest = {
8
+ env: string;
9
+ };
10
+
11
+ /** @internal */
12
+ export type RemoveUnifiedEnvironmentRequest$Outbound = {
13
+ env: string;
14
+ };
15
+
16
+ /** @internal */
17
+ export const RemoveUnifiedEnvironmentRequest$outboundSchema: z.ZodType<
18
+ RemoveUnifiedEnvironmentRequest$Outbound,
19
+ z.ZodTypeDef,
20
+ RemoveUnifiedEnvironmentRequest
21
+ > = z.object({
22
+ env: z.string(),
23
+ });
24
+
25
+ export function removeUnifiedEnvironmentRequestToJSON(
26
+ removeUnifiedEnvironmentRequest: RemoveUnifiedEnvironmentRequest,
27
+ ): string {
28
+ return JSON.stringify(
29
+ RemoveUnifiedEnvironmentRequest$outboundSchema.parse(
30
+ removeUnifiedEnvironmentRequest,
31
+ ),
32
+ );
33
+ }
package/src/sdk/sdk.ts CHANGED
@@ -42,6 +42,7 @@ import { Document } from "./document.js";
42
42
  import { Embedding } from "./embedding.js";
43
43
  import { Employee } from "./employee.js";
44
44
  import { Enrich } from "./enrich.js";
45
+ import { Environment } from "./environment.js";
45
46
  import { Event } from "./event.js";
46
47
  import { Expense } from "./expense.js";
47
48
  import { FileT } from "./file.js";
@@ -631,6 +632,11 @@ export class UnifiedTo extends ClientSDK {
631
632
  return (this._connection ??= new Connection(this._options));
632
633
  }
633
634
 
635
+ private _environment?: Environment;
636
+ get environment(): Environment {
637
+ return (this._environment ??= new Environment(this._options));
638
+ }
639
+
634
640
  private _integration?: Integration;
635
641
  get integration(): Integration {
636
642
  return (this._integration ??= new Integration(this._options));
@@ -3,6 +3,7 @@
3
3
  */
4
4
 
5
5
  import { unifiedCreateUnifiedConnection } from "../funcs/unifiedCreateUnifiedConnection.js";
6
+ import { unifiedCreateUnifiedEnvironment } from "../funcs/unifiedCreateUnifiedEnvironment.js";
6
7
  import { unifiedCreateUnifiedWebhook } from "../funcs/unifiedCreateUnifiedWebhook.js";
7
8
  import { unifiedGetUnifiedApicall } from "../funcs/unifiedGetUnifiedApicall.js";
8
9
  import { unifiedGetUnifiedConnection } from "../funcs/unifiedGetUnifiedConnection.js";
@@ -11,6 +12,7 @@ import { unifiedGetUnifiedIssue } from "../funcs/unifiedGetUnifiedIssue.js";
11
12
  import { unifiedGetUnifiedWebhook } from "../funcs/unifiedGetUnifiedWebhook.js";
12
13
  import { unifiedListUnifiedApicalls } from "../funcs/unifiedListUnifiedApicalls.js";
13
14
  import { unifiedListUnifiedConnections } from "../funcs/unifiedListUnifiedConnections.js";
15
+ import { unifiedListUnifiedEnvironments } from "../funcs/unifiedListUnifiedEnvironments.js";
14
16
  import { unifiedListUnifiedIntegrations } from "../funcs/unifiedListUnifiedIntegrations.js";
15
17
  import { unifiedListUnifiedIntegrationWorkspaces } from "../funcs/unifiedListUnifiedIntegrationWorkspaces.js";
16
18
  import { unifiedListUnifiedIssues } from "../funcs/unifiedListUnifiedIssues.js";
@@ -19,6 +21,7 @@ import { unifiedPatchUnifiedConnection } from "../funcs/unifiedPatchUnifiedConne
19
21
  import { unifiedPatchUnifiedWebhook } from "../funcs/unifiedPatchUnifiedWebhook.js";
20
22
  import { unifiedPatchUnifiedWebhookTrigger } from "../funcs/unifiedPatchUnifiedWebhookTrigger.js";
21
23
  import { unifiedRemoveUnifiedConnection } from "../funcs/unifiedRemoveUnifiedConnection.js";
24
+ import { unifiedRemoveUnifiedEnvironment } from "../funcs/unifiedRemoveUnifiedEnvironment.js";
22
25
  import { unifiedRemoveUnifiedWebhook } from "../funcs/unifiedRemoveUnifiedWebhook.js";
23
26
  import { unifiedUpdateUnifiedConnection } from "../funcs/unifiedUpdateUnifiedConnection.js";
24
27
  import { unifiedUpdateUnifiedWebhook } from "../funcs/unifiedUpdateUnifiedWebhook.js";
@@ -46,6 +49,17 @@ export class Unified extends ClientSDK {
46
49
  ));
47
50
  }
48
51
 
52
+ async createUnifiedEnvironment(
53
+ request: Array<string>,
54
+ options?: RequestOptions,
55
+ ): Promise<Array<string>> {
56
+ return unwrapAsync(unifiedCreateUnifiedEnvironment(
57
+ this,
58
+ request,
59
+ options,
60
+ ));
61
+ }
62
+
49
63
  /**
50
64
  * Create webhook subscription
51
65
  *
@@ -164,6 +178,15 @@ export class Unified extends ClientSDK {
164
178
  ));
165
179
  }
166
180
 
181
+ async listUnifiedEnvironments(
182
+ options?: RequestOptions,
183
+ ): Promise<Array<string>> {
184
+ return unwrapAsync(unifiedListUnifiedEnvironments(
185
+ this,
186
+ options,
187
+ ));
188
+ }
189
+
167
190
  /**
168
191
  * Returns all activated integrations in a workspace
169
192
  *
@@ -279,6 +302,17 @@ export class Unified extends ClientSDK {
279
302
  ));
280
303
  }
281
304
 
305
+ async removeUnifiedEnvironment(
306
+ request: operations.RemoveUnifiedEnvironmentRequest,
307
+ options?: RequestOptions,
308
+ ): Promise<Array<string>> {
309
+ return unwrapAsync(unifiedRemoveUnifiedEnvironment(
310
+ this,
311
+ request,
312
+ options,
313
+ ));
314
+ }
315
+
282
316
  /**
283
317
  * Remove webhook subscription
284
318
  */