@unified-api/typescript-sdk 2.86.0 → 2.86.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.
Files changed (165) hide show
  1. package/FUNCTIONS.md +2 -2
  2. package/README.md +18 -12
  3. package/dist/commonjs/funcs/ucCreateUcCall.d.ts +18 -0
  4. package/dist/commonjs/funcs/ucCreateUcCall.d.ts.map +1 -0
  5. package/dist/commonjs/funcs/ucCreateUcCall.js +126 -0
  6. package/dist/commonjs/funcs/ucCreateUcCall.js.map +1 -0
  7. package/dist/commonjs/funcs/ucPatchUcCall.d.ts +18 -0
  8. package/dist/commonjs/funcs/ucPatchUcCall.d.ts.map +1 -0
  9. package/dist/commonjs/funcs/ucPatchUcCall.js +130 -0
  10. package/dist/commonjs/funcs/ucPatchUcCall.js.map +1 -0
  11. package/dist/commonjs/funcs/ucUpdateUcCall.d.ts +18 -0
  12. package/dist/commonjs/funcs/ucUpdateUcCall.d.ts.map +1 -0
  13. package/dist/commonjs/funcs/ucUpdateUcCall.js +130 -0
  14. package/dist/commonjs/funcs/ucUpdateUcCall.js.map +1 -0
  15. package/dist/commonjs/lib/config.d.ts +3 -3
  16. package/dist/commonjs/lib/config.js +3 -3
  17. package/dist/commonjs/lib/config.js.map +1 -1
  18. package/dist/commonjs/sdk/call.d.ts +21 -0
  19. package/dist/commonjs/sdk/call.d.ts.map +1 -1
  20. package/dist/commonjs/sdk/call.js +30 -0
  21. package/dist/commonjs/sdk/call.js.map +1 -1
  22. package/dist/commonjs/sdk/models/operations/createuccall.d.ts +57 -0
  23. package/dist/commonjs/sdk/models/operations/createuccall.d.ts.map +1 -0
  24. package/dist/commonjs/sdk/models/operations/createuccall.js +86 -0
  25. package/dist/commonjs/sdk/models/operations/createuccall.js.map +1 -0
  26. package/dist/commonjs/sdk/models/operations/getuccall.d.ts +7 -0
  27. package/dist/commonjs/sdk/models/operations/getuccall.d.ts.map +1 -1
  28. package/dist/commonjs/sdk/models/operations/getuccall.js +7 -0
  29. package/dist/commonjs/sdk/models/operations/getuccall.js.map +1 -1
  30. package/dist/commonjs/sdk/models/operations/index.d.ts +3 -0
  31. package/dist/commonjs/sdk/models/operations/index.d.ts.map +1 -1
  32. package/dist/commonjs/sdk/models/operations/index.js +3 -0
  33. package/dist/commonjs/sdk/models/operations/index.js.map +1 -1
  34. package/dist/commonjs/sdk/models/operations/listuccalls.d.ts +7 -0
  35. package/dist/commonjs/sdk/models/operations/listuccalls.d.ts.map +1 -1
  36. package/dist/commonjs/sdk/models/operations/listuccalls.js +7 -0
  37. package/dist/commonjs/sdk/models/operations/listuccalls.js.map +1 -1
  38. package/dist/commonjs/sdk/models/operations/patchuccall.d.ts +62 -0
  39. package/dist/commonjs/sdk/models/operations/patchuccall.d.ts.map +1 -0
  40. package/dist/commonjs/sdk/models/operations/patchuccall.js +87 -0
  41. package/dist/commonjs/sdk/models/operations/patchuccall.js.map +1 -0
  42. package/dist/commonjs/sdk/models/operations/updateuccall.d.ts +62 -0
  43. package/dist/commonjs/sdk/models/operations/updateuccall.d.ts.map +1 -0
  44. package/dist/commonjs/sdk/models/operations/updateuccall.js +87 -0
  45. package/dist/commonjs/sdk/models/operations/updateuccall.js.map +1 -0
  46. package/dist/commonjs/sdk/models/shared/index.d.ts +2 -0
  47. package/dist/commonjs/sdk/models/shared/index.d.ts.map +1 -1
  48. package/dist/commonjs/sdk/models/shared/index.js +2 -0
  49. package/dist/commonjs/sdk/models/shared/index.js.map +1 -1
  50. package/dist/commonjs/sdk/models/shared/propertyconnectionpermissions.d.ts +1 -0
  51. package/dist/commonjs/sdk/models/shared/propertyconnectionpermissions.d.ts.map +1 -1
  52. package/dist/commonjs/sdk/models/shared/propertyconnectionpermissions.js +1 -0
  53. package/dist/commonjs/sdk/models/shared/propertyconnectionpermissions.js.map +1 -1
  54. package/dist/commonjs/sdk/models/shared/propertyuccallinstructiontelephone.d.ts +35 -0
  55. package/dist/commonjs/sdk/models/shared/propertyuccallinstructiontelephone.d.ts.map +1 -0
  56. package/dist/commonjs/sdk/models/shared/propertyuccallinstructiontelephone.js +72 -0
  57. package/dist/commonjs/sdk/models/shared/propertyuccallinstructiontelephone.js.map +1 -0
  58. package/dist/commonjs/sdk/models/shared/propertyuccalltelephone.d.ts +10 -0
  59. package/dist/commonjs/sdk/models/shared/propertyuccalltelephone.d.ts.map +1 -1
  60. package/dist/commonjs/sdk/models/shared/propertyuccalltelephone.js +12 -1
  61. package/dist/commonjs/sdk/models/shared/propertyuccalltelephone.js.map +1 -1
  62. package/dist/commonjs/sdk/models/shared/uccall.d.ts +87 -3
  63. package/dist/commonjs/sdk/models/shared/uccall.d.ts.map +1 -1
  64. package/dist/commonjs/sdk/models/shared/uccall.js +81 -1
  65. package/dist/commonjs/sdk/models/shared/uccall.js.map +1 -1
  66. package/dist/commonjs/sdk/models/shared/uccallinstruction.d.ts +71 -0
  67. package/dist/commonjs/sdk/models/shared/uccallinstruction.d.ts.map +1 -0
  68. package/dist/commonjs/sdk/models/shared/uccallinstruction.js +102 -0
  69. package/dist/commonjs/sdk/models/shared/uccallinstruction.js.map +1 -0
  70. package/dist/commonjs/sdk/uc.d.ts +21 -0
  71. package/dist/commonjs/sdk/uc.d.ts.map +1 -1
  72. package/dist/commonjs/sdk/uc.js +30 -0
  73. package/dist/commonjs/sdk/uc.js.map +1 -1
  74. package/dist/esm/funcs/ucCreateUcCall.d.ts +18 -0
  75. package/dist/esm/funcs/ucCreateUcCall.d.ts.map +1 -0
  76. package/dist/esm/funcs/ucCreateUcCall.js +90 -0
  77. package/dist/esm/funcs/ucCreateUcCall.js.map +1 -0
  78. package/dist/esm/funcs/ucPatchUcCall.d.ts +18 -0
  79. package/dist/esm/funcs/ucPatchUcCall.d.ts.map +1 -0
  80. package/dist/esm/funcs/ucPatchUcCall.js +94 -0
  81. package/dist/esm/funcs/ucPatchUcCall.js.map +1 -0
  82. package/dist/esm/funcs/ucUpdateUcCall.d.ts +18 -0
  83. package/dist/esm/funcs/ucUpdateUcCall.d.ts.map +1 -0
  84. package/dist/esm/funcs/ucUpdateUcCall.js +94 -0
  85. package/dist/esm/funcs/ucUpdateUcCall.js.map +1 -0
  86. package/dist/esm/lib/config.d.ts +3 -3
  87. package/dist/esm/lib/config.js +3 -3
  88. package/dist/esm/lib/config.js.map +1 -1
  89. package/dist/esm/sdk/call.d.ts +21 -0
  90. package/dist/esm/sdk/call.d.ts.map +1 -1
  91. package/dist/esm/sdk/call.js +30 -0
  92. package/dist/esm/sdk/call.js.map +1 -1
  93. package/dist/esm/sdk/models/operations/createuccall.d.ts +57 -0
  94. package/dist/esm/sdk/models/operations/createuccall.d.ts.map +1 -0
  95. package/dist/esm/sdk/models/operations/createuccall.js +49 -0
  96. package/dist/esm/sdk/models/operations/createuccall.js.map +1 -0
  97. package/dist/esm/sdk/models/operations/getuccall.d.ts +7 -0
  98. package/dist/esm/sdk/models/operations/getuccall.d.ts.map +1 -1
  99. package/dist/esm/sdk/models/operations/getuccall.js +7 -0
  100. package/dist/esm/sdk/models/operations/getuccall.js.map +1 -1
  101. package/dist/esm/sdk/models/operations/index.d.ts +3 -0
  102. package/dist/esm/sdk/models/operations/index.d.ts.map +1 -1
  103. package/dist/esm/sdk/models/operations/index.js +3 -0
  104. package/dist/esm/sdk/models/operations/index.js.map +1 -1
  105. package/dist/esm/sdk/models/operations/listuccalls.d.ts +7 -0
  106. package/dist/esm/sdk/models/operations/listuccalls.d.ts.map +1 -1
  107. package/dist/esm/sdk/models/operations/listuccalls.js +7 -0
  108. package/dist/esm/sdk/models/operations/listuccalls.js.map +1 -1
  109. package/dist/esm/sdk/models/operations/patchuccall.d.ts +62 -0
  110. package/dist/esm/sdk/models/operations/patchuccall.d.ts.map +1 -0
  111. package/dist/esm/sdk/models/operations/patchuccall.js +50 -0
  112. package/dist/esm/sdk/models/operations/patchuccall.js.map +1 -0
  113. package/dist/esm/sdk/models/operations/updateuccall.d.ts +62 -0
  114. package/dist/esm/sdk/models/operations/updateuccall.d.ts.map +1 -0
  115. package/dist/esm/sdk/models/operations/updateuccall.js +50 -0
  116. package/dist/esm/sdk/models/operations/updateuccall.js.map +1 -0
  117. package/dist/esm/sdk/models/shared/index.d.ts +2 -0
  118. package/dist/esm/sdk/models/shared/index.d.ts.map +1 -1
  119. package/dist/esm/sdk/models/shared/index.js +2 -0
  120. package/dist/esm/sdk/models/shared/index.js.map +1 -1
  121. package/dist/esm/sdk/models/shared/propertyconnectionpermissions.d.ts +1 -0
  122. package/dist/esm/sdk/models/shared/propertyconnectionpermissions.d.ts.map +1 -1
  123. package/dist/esm/sdk/models/shared/propertyconnectionpermissions.js +1 -0
  124. package/dist/esm/sdk/models/shared/propertyconnectionpermissions.js.map +1 -1
  125. package/dist/esm/sdk/models/shared/propertyuccallinstructiontelephone.d.ts +35 -0
  126. package/dist/esm/sdk/models/shared/propertyuccallinstructiontelephone.d.ts.map +1 -0
  127. package/dist/esm/sdk/models/shared/propertyuccallinstructiontelephone.js +34 -0
  128. package/dist/esm/sdk/models/shared/propertyuccallinstructiontelephone.js.map +1 -0
  129. package/dist/esm/sdk/models/shared/propertyuccalltelephone.d.ts +10 -0
  130. package/dist/esm/sdk/models/shared/propertyuccalltelephone.d.ts.map +1 -1
  131. package/dist/esm/sdk/models/shared/propertyuccalltelephone.js +10 -0
  132. package/dist/esm/sdk/models/shared/propertyuccalltelephone.js.map +1 -1
  133. package/dist/esm/sdk/models/shared/uccall.d.ts +87 -3
  134. package/dist/esm/sdk/models/shared/uccall.d.ts.map +1 -1
  135. package/dist/esm/sdk/models/shared/uccall.js +82 -3
  136. package/dist/esm/sdk/models/shared/uccall.js.map +1 -1
  137. package/dist/esm/sdk/models/shared/uccallinstruction.d.ts +71 -0
  138. package/dist/esm/sdk/models/shared/uccallinstruction.d.ts.map +1 -0
  139. package/dist/esm/sdk/models/shared/uccallinstruction.js +64 -0
  140. package/dist/esm/sdk/models/shared/uccallinstruction.js.map +1 -0
  141. package/dist/esm/sdk/uc.d.ts +21 -0
  142. package/dist/esm/sdk/uc.d.ts.map +1 -1
  143. package/dist/esm/sdk/uc.js +30 -0
  144. package/dist/esm/sdk/uc.js.map +1 -1
  145. package/examples/accountingCreateAccountingAccount.example.ts +2 -2
  146. package/jsr.json +1 -1
  147. package/package.json +1 -1
  148. package/src/funcs/ucCreateUcCall.ts +174 -0
  149. package/src/funcs/ucPatchUcCall.ts +178 -0
  150. package/src/funcs/ucUpdateUcCall.ts +178 -0
  151. package/src/lib/config.ts +3 -3
  152. package/src/sdk/call.ts +54 -0
  153. package/src/sdk/models/operations/createuccall.ts +91 -0
  154. package/src/sdk/models/operations/getuccall.ts +7 -0
  155. package/src/sdk/models/operations/index.ts +3 -0
  156. package/src/sdk/models/operations/listuccalls.ts +7 -0
  157. package/src/sdk/models/operations/patchuccall.ts +97 -0
  158. package/src/sdk/models/operations/updateuccall.ts +97 -0
  159. package/src/sdk/models/shared/index.ts +2 -0
  160. package/src/sdk/models/shared/propertyconnectionpermissions.ts +1 -0
  161. package/src/sdk/models/shared/propertyuccallinstructiontelephone.ts +87 -0
  162. package/src/sdk/models/shared/propertyuccalltelephone.ts +28 -0
  163. package/src/sdk/models/shared/uccall.ts +175 -2
  164. package/src/sdk/models/shared/uccallinstruction.ts +152 -0
  165. package/src/sdk/uc.ts +54 -0
@@ -0,0 +1,174 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { UnifiedToCore } from "../core.js";
6
+ import { encodeFormQuery, encodeJSON, encodeSimple } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.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 * as shared from "../sdk/models/shared/index.js";
26
+ import { APICall, APIPromise } from "../sdk/types/async.js";
27
+ import { Result } from "../sdk/types/fp.js";
28
+
29
+ /**
30
+ * Create a call
31
+ *
32
+ * @remarks
33
+ * Creates a UcCall. Provide the unified UcCall fields in the request body; they are mapped to the provider's API. Returns the created UcCall.
34
+ */
35
+ export function ucCreateUcCall(
36
+ client: UnifiedToCore,
37
+ request: operations.CreateUcCallRequest,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ shared.UcCall,
42
+ | UnifiedToError
43
+ | ResponseValidationError
44
+ | ConnectionError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | InvalidRequestError
48
+ | UnexpectedClientError
49
+ | SDKValidationError
50
+ >
51
+ > {
52
+ return new APIPromise($do(
53
+ client,
54
+ request,
55
+ options,
56
+ ));
57
+ }
58
+
59
+ async function $do(
60
+ client: UnifiedToCore,
61
+ request: operations.CreateUcCallRequest,
62
+ options?: RequestOptions,
63
+ ): Promise<
64
+ [
65
+ Result<
66
+ shared.UcCall,
67
+ | UnifiedToError
68
+ | ResponseValidationError
69
+ | ConnectionError
70
+ | RequestAbortedError
71
+ | RequestTimeoutError
72
+ | InvalidRequestError
73
+ | UnexpectedClientError
74
+ | SDKValidationError
75
+ >,
76
+ APICall,
77
+ ]
78
+ > {
79
+ const parsed = safeParse(
80
+ request,
81
+ (value) => operations.CreateUcCallRequest$outboundSchema.parse(value),
82
+ "Input validation failed",
83
+ );
84
+ if (!parsed.ok) {
85
+ return [parsed, { status: "invalid" }];
86
+ }
87
+ const payload = parsed.value;
88
+ const body = encodeJSON("body", payload.UcCall, { explode: true });
89
+
90
+ const pathParams = {
91
+ connection_id: encodeSimple("connection_id", payload.connection_id, {
92
+ explode: false,
93
+ charEncoding: "percent",
94
+ }),
95
+ };
96
+ const path = pathToFunc("/uc/{connection_id}/call")(pathParams);
97
+
98
+ const query = encodeFormQuery({
99
+ "fields": payload.fields,
100
+ "raw": payload.raw,
101
+ });
102
+
103
+ const headers = new Headers(compactMap({
104
+ "Content-Type": "application/json",
105
+ Accept: "application/json",
106
+ }));
107
+
108
+ const securityInput = await extractSecurity(client._options.security);
109
+ const requestSecurity = resolveGlobalSecurity(securityInput);
110
+
111
+ const context = {
112
+ options: client._options,
113
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
114
+ operationID: "createUcCall",
115
+ oAuth2Scopes: null,
116
+
117
+ resolvedSecurity: requestSecurity,
118
+
119
+ securitySource: client._options.security,
120
+ retryConfig: options?.retries
121
+ || client._options.retryConfig
122
+ || { strategy: "none" },
123
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
124
+ };
125
+
126
+ const requestRes = client._createRequest(context, {
127
+ security: requestSecurity,
128
+ method: "POST",
129
+ baseURL: options?.serverURL,
130
+ path: path,
131
+ headers: headers,
132
+ query: query,
133
+ body: body,
134
+ userAgent: client._options.userAgent,
135
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
136
+ }, options);
137
+ if (!requestRes.ok) {
138
+ return [requestRes, { status: "invalid" }];
139
+ }
140
+ const req = requestRes.value;
141
+
142
+ const doResult = await client._do(req, {
143
+ context,
144
+ isErrorStatusCode: (statusCode: number) =>
145
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
146
+ retryConfig: context.retryConfig,
147
+ retryCodes: context.retryCodes,
148
+ });
149
+ if (!doResult.ok) {
150
+ return [doResult, { status: "request-error", request: req }];
151
+ }
152
+ const response = doResult.value;
153
+
154
+ const [result] = await M.match<
155
+ shared.UcCall,
156
+ | UnifiedToError
157
+ | ResponseValidationError
158
+ | ConnectionError
159
+ | RequestAbortedError
160
+ | RequestTimeoutError
161
+ | InvalidRequestError
162
+ | UnexpectedClientError
163
+ | SDKValidationError
164
+ >(
165
+ M.json(200, shared.UcCall$inboundSchema),
166
+ M.fail("4XX"),
167
+ M.fail("5XX"),
168
+ )(response, req);
169
+ if (!result.ok) {
170
+ return [result, { status: "complete", request: req, response }];
171
+ }
172
+
173
+ return [result, { status: "complete", request: req, response }];
174
+ }
@@ -0,0 +1,178 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { UnifiedToCore } from "../core.js";
6
+ import { encodeFormQuery, encodeJSON, encodeSimple } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.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 * as shared from "../sdk/models/shared/index.js";
26
+ import { APICall, APIPromise } from "../sdk/types/async.js";
27
+ import { Result } from "../sdk/types/fp.js";
28
+
29
+ /**
30
+ * Update a call
31
+ *
32
+ * @remarks
33
+ * Updates the UcCall identified by `id`. Provide the unified UcCall fields to change in the request body.
34
+ */
35
+ export function ucPatchUcCall(
36
+ client: UnifiedToCore,
37
+ request: operations.PatchUcCallRequest,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ shared.UcCall,
42
+ | UnifiedToError
43
+ | ResponseValidationError
44
+ | ConnectionError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | InvalidRequestError
48
+ | UnexpectedClientError
49
+ | SDKValidationError
50
+ >
51
+ > {
52
+ return new APIPromise($do(
53
+ client,
54
+ request,
55
+ options,
56
+ ));
57
+ }
58
+
59
+ async function $do(
60
+ client: UnifiedToCore,
61
+ request: operations.PatchUcCallRequest,
62
+ options?: RequestOptions,
63
+ ): Promise<
64
+ [
65
+ Result<
66
+ shared.UcCall,
67
+ | UnifiedToError
68
+ | ResponseValidationError
69
+ | ConnectionError
70
+ | RequestAbortedError
71
+ | RequestTimeoutError
72
+ | InvalidRequestError
73
+ | UnexpectedClientError
74
+ | SDKValidationError
75
+ >,
76
+ APICall,
77
+ ]
78
+ > {
79
+ const parsed = safeParse(
80
+ request,
81
+ (value) => operations.PatchUcCallRequest$outboundSchema.parse(value),
82
+ "Input validation failed",
83
+ );
84
+ if (!parsed.ok) {
85
+ return [parsed, { status: "invalid" }];
86
+ }
87
+ const payload = parsed.value;
88
+ const body = encodeJSON("body", payload.UcCall, { explode: true });
89
+
90
+ const pathParams = {
91
+ connection_id: encodeSimple("connection_id", payload.connection_id, {
92
+ explode: false,
93
+ charEncoding: "percent",
94
+ }),
95
+ id: encodeSimple("id", payload.id, {
96
+ explode: false,
97
+ charEncoding: "percent",
98
+ }),
99
+ };
100
+ const path = pathToFunc("/uc/{connection_id}/call/{id}")(pathParams);
101
+
102
+ const query = encodeFormQuery({
103
+ "fields": payload.fields,
104
+ "raw": payload.raw,
105
+ });
106
+
107
+ const headers = new Headers(compactMap({
108
+ "Content-Type": "application/json",
109
+ Accept: "application/json",
110
+ }));
111
+
112
+ const securityInput = await extractSecurity(client._options.security);
113
+ const requestSecurity = resolveGlobalSecurity(securityInput);
114
+
115
+ const context = {
116
+ options: client._options,
117
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
118
+ operationID: "patchUcCall",
119
+ oAuth2Scopes: null,
120
+
121
+ resolvedSecurity: requestSecurity,
122
+
123
+ securitySource: client._options.security,
124
+ retryConfig: options?.retries
125
+ || client._options.retryConfig
126
+ || { strategy: "none" },
127
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
128
+ };
129
+
130
+ const requestRes = client._createRequest(context, {
131
+ security: requestSecurity,
132
+ method: "PATCH",
133
+ baseURL: options?.serverURL,
134
+ path: path,
135
+ headers: headers,
136
+ query: query,
137
+ body: body,
138
+ userAgent: client._options.userAgent,
139
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
140
+ }, options);
141
+ if (!requestRes.ok) {
142
+ return [requestRes, { status: "invalid" }];
143
+ }
144
+ const req = requestRes.value;
145
+
146
+ const doResult = await client._do(req, {
147
+ context,
148
+ isErrorStatusCode: (statusCode: number) =>
149
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
150
+ retryConfig: context.retryConfig,
151
+ retryCodes: context.retryCodes,
152
+ });
153
+ if (!doResult.ok) {
154
+ return [doResult, { status: "request-error", request: req }];
155
+ }
156
+ const response = doResult.value;
157
+
158
+ const [result] = await M.match<
159
+ shared.UcCall,
160
+ | UnifiedToError
161
+ | ResponseValidationError
162
+ | ConnectionError
163
+ | RequestAbortedError
164
+ | RequestTimeoutError
165
+ | InvalidRequestError
166
+ | UnexpectedClientError
167
+ | SDKValidationError
168
+ >(
169
+ M.json(200, shared.UcCall$inboundSchema),
170
+ M.fail("4XX"),
171
+ M.fail("5XX"),
172
+ )(response, req);
173
+ if (!result.ok) {
174
+ return [result, { status: "complete", request: req, response }];
175
+ }
176
+
177
+ return [result, { status: "complete", request: req, response }];
178
+ }
@@ -0,0 +1,178 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { UnifiedToCore } from "../core.js";
6
+ import { encodeFormQuery, encodeJSON, encodeSimple } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.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 * as shared from "../sdk/models/shared/index.js";
26
+ import { APICall, APIPromise } from "../sdk/types/async.js";
27
+ import { Result } from "../sdk/types/fp.js";
28
+
29
+ /**
30
+ * Update a call
31
+ *
32
+ * @remarks
33
+ * Updates the UcCall identified by `id`. Provide the unified UcCall fields to change in the request body.
34
+ */
35
+ export function ucUpdateUcCall(
36
+ client: UnifiedToCore,
37
+ request: operations.UpdateUcCallRequest,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ shared.UcCall,
42
+ | UnifiedToError
43
+ | ResponseValidationError
44
+ | ConnectionError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | InvalidRequestError
48
+ | UnexpectedClientError
49
+ | SDKValidationError
50
+ >
51
+ > {
52
+ return new APIPromise($do(
53
+ client,
54
+ request,
55
+ options,
56
+ ));
57
+ }
58
+
59
+ async function $do(
60
+ client: UnifiedToCore,
61
+ request: operations.UpdateUcCallRequest,
62
+ options?: RequestOptions,
63
+ ): Promise<
64
+ [
65
+ Result<
66
+ shared.UcCall,
67
+ | UnifiedToError
68
+ | ResponseValidationError
69
+ | ConnectionError
70
+ | RequestAbortedError
71
+ | RequestTimeoutError
72
+ | InvalidRequestError
73
+ | UnexpectedClientError
74
+ | SDKValidationError
75
+ >,
76
+ APICall,
77
+ ]
78
+ > {
79
+ const parsed = safeParse(
80
+ request,
81
+ (value) => operations.UpdateUcCallRequest$outboundSchema.parse(value),
82
+ "Input validation failed",
83
+ );
84
+ if (!parsed.ok) {
85
+ return [parsed, { status: "invalid" }];
86
+ }
87
+ const payload = parsed.value;
88
+ const body = encodeJSON("body", payload.UcCall, { explode: true });
89
+
90
+ const pathParams = {
91
+ connection_id: encodeSimple("connection_id", payload.connection_id, {
92
+ explode: false,
93
+ charEncoding: "percent",
94
+ }),
95
+ id: encodeSimple("id", payload.id, {
96
+ explode: false,
97
+ charEncoding: "percent",
98
+ }),
99
+ };
100
+ const path = pathToFunc("/uc/{connection_id}/call/{id}")(pathParams);
101
+
102
+ const query = encodeFormQuery({
103
+ "fields": payload.fields,
104
+ "raw": payload.raw,
105
+ });
106
+
107
+ const headers = new Headers(compactMap({
108
+ "Content-Type": "application/json",
109
+ Accept: "application/json",
110
+ }));
111
+
112
+ const securityInput = await extractSecurity(client._options.security);
113
+ const requestSecurity = resolveGlobalSecurity(securityInput);
114
+
115
+ const context = {
116
+ options: client._options,
117
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
118
+ operationID: "updateUcCall",
119
+ oAuth2Scopes: null,
120
+
121
+ resolvedSecurity: requestSecurity,
122
+
123
+ securitySource: client._options.security,
124
+ retryConfig: options?.retries
125
+ || client._options.retryConfig
126
+ || { strategy: "none" },
127
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
128
+ };
129
+
130
+ const requestRes = client._createRequest(context, {
131
+ security: requestSecurity,
132
+ method: "PUT",
133
+ baseURL: options?.serverURL,
134
+ path: path,
135
+ headers: headers,
136
+ query: query,
137
+ body: body,
138
+ userAgent: client._options.userAgent,
139
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
140
+ }, options);
141
+ if (!requestRes.ok) {
142
+ return [requestRes, { status: "invalid" }];
143
+ }
144
+ const req = requestRes.value;
145
+
146
+ const doResult = await client._do(req, {
147
+ context,
148
+ isErrorStatusCode: (statusCode: number) =>
149
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
150
+ retryConfig: context.retryConfig,
151
+ retryCodes: context.retryCodes,
152
+ });
153
+ if (!doResult.ok) {
154
+ return [doResult, { status: "request-error", request: req }];
155
+ }
156
+ const response = doResult.value;
157
+
158
+ const [result] = await M.match<
159
+ shared.UcCall,
160
+ | UnifiedToError
161
+ | ResponseValidationError
162
+ | ConnectionError
163
+ | RequestAbortedError
164
+ | RequestTimeoutError
165
+ | InvalidRequestError
166
+ | UnexpectedClientError
167
+ | SDKValidationError
168
+ >(
169
+ M.json(200, shared.UcCall$inboundSchema),
170
+ M.fail("4XX"),
171
+ M.fail("5XX"),
172
+ )(response, req);
173
+ if (!result.ok) {
174
+ return [result, { status: "complete", request: req, response }];
175
+ }
176
+
177
+ return [result, { status: "complete", request: req, response }];
178
+ }
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.86.0",
77
- genVersion: "2.950.2",
76
+ sdkVersion: "2.86.2",
77
+ genVersion: "2.950.13",
78
78
  userAgent:
79
- "speakeasy-sdk/typescript 2.86.0 2.950.2 1.0 @unified-api/typescript-sdk",
79
+ "speakeasy-sdk/typescript 2.86.2 2.950.13 1.0 @unified-api/typescript-sdk",
80
80
  } as const;
package/src/sdk/call.ts CHANGED
@@ -2,14 +2,34 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
+ import { ucCreateUcCall } from "../funcs/ucCreateUcCall.js";
5
6
  import { ucGetUcCall } from "../funcs/ucGetUcCall.js";
6
7
  import { ucListUcCalls } from "../funcs/ucListUcCalls.js";
8
+ import { ucPatchUcCall } from "../funcs/ucPatchUcCall.js";
9
+ import { ucUpdateUcCall } from "../funcs/ucUpdateUcCall.js";
7
10
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
8
11
  import * as operations from "./models/operations/index.js";
9
12
  import * as shared from "./models/shared/index.js";
10
13
  import { unwrapAsync } from "./types/fp.js";
11
14
 
12
15
  export class Call extends ClientSDK {
16
+ /**
17
+ * Create a call
18
+ *
19
+ * @remarks
20
+ * Creates a UcCall. Provide the unified UcCall fields in the request body; they are mapped to the provider's API. Returns the created UcCall.
21
+ */
22
+ async createUcCall(
23
+ request: operations.CreateUcCallRequest,
24
+ options?: RequestOptions,
25
+ ): Promise<shared.UcCall> {
26
+ return unwrapAsync(ucCreateUcCall(
27
+ this,
28
+ request,
29
+ options,
30
+ ));
31
+ }
32
+
13
33
  /**
14
34
  * Retrieve a call
15
35
  *
@@ -43,4 +63,38 @@ export class Call extends ClientSDK {
43
63
  options,
44
64
  ));
45
65
  }
66
+
67
+ /**
68
+ * Update a call
69
+ *
70
+ * @remarks
71
+ * Updates the UcCall identified by `id`. Provide the unified UcCall fields to change in the request body.
72
+ */
73
+ async patchUcCall(
74
+ request: operations.PatchUcCallRequest,
75
+ options?: RequestOptions,
76
+ ): Promise<shared.UcCall> {
77
+ return unwrapAsync(ucPatchUcCall(
78
+ this,
79
+ request,
80
+ options,
81
+ ));
82
+ }
83
+
84
+ /**
85
+ * Update a call
86
+ *
87
+ * @remarks
88
+ * Updates the UcCall identified by `id`. Provide the unified UcCall fields to change in the request body.
89
+ */
90
+ async updateUcCall(
91
+ request: operations.UpdateUcCallRequest,
92
+ options?: RequestOptions,
93
+ ): Promise<shared.UcCall> {
94
+ return unwrapAsync(ucUpdateUcCall(
95
+ this,
96
+ request,
97
+ options,
98
+ ));
99
+ }
46
100
  }
@@ -0,0 +1,91 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../../lib/primitives.js";
7
+ import { ClosedEnum } from "../../types/enums.js";
8
+ import * as shared from "../shared/index.js";
9
+
10
+ export const CreateUcCallQueryParamFields = {
11
+ Id: "id",
12
+ CreatedAt: "created_at",
13
+ UpdatedAt: "updated_at",
14
+ ContactId: "contact_id",
15
+ Telephone: "telephone",
16
+ StartAt: "start_at",
17
+ EndAt: "end_at",
18
+ UserId: "user_id",
19
+ Contacts: "contacts",
20
+ IsPrivate: "is_private",
21
+ UserName: "user_name",
22
+ UserPhone: "user_phone",
23
+ Type: "type",
24
+ Metadata: "metadata",
25
+ Raw: "raw",
26
+ ConversationIdentifier: "conversation_identifier",
27
+ Status: "status",
28
+ AnswerAt: "answer_at",
29
+ DurationSeconds: "duration_seconds",
30
+ CostAmount: "cost_amount",
31
+ Currency: "currency",
32
+ ParentId: "parent_id",
33
+ Instructions: "instructions",
34
+ } as const;
35
+ export type CreateUcCallQueryParamFields = ClosedEnum<
36
+ typeof CreateUcCallQueryParamFields
37
+ >;
38
+
39
+ export type CreateUcCallRequest = {
40
+ ucCall: shared.UcCall;
41
+ /**
42
+ * ID of the connection
43
+ */
44
+ connectionId: string;
45
+ /**
46
+ * Fields to return
47
+ */
48
+ fields?: Array<CreateUcCallQueryParamFields> | undefined;
49
+ /**
50
+ * Raw parameters to include in the 3rd-party request. Encoded as a URL component. eg. raw parameters: foo=bar&zoo=bar -> raw=foo%3Dbar%26zoo%3Dbar
51
+ */
52
+ raw?: string | undefined;
53
+ };
54
+
55
+ /** @internal */
56
+ export const CreateUcCallQueryParamFields$outboundSchema: z.ZodNativeEnum<
57
+ typeof CreateUcCallQueryParamFields
58
+ > = z.nativeEnum(CreateUcCallQueryParamFields);
59
+
60
+ /** @internal */
61
+ export type CreateUcCallRequest$Outbound = {
62
+ UcCall: shared.UcCall$Outbound;
63
+ connection_id: string;
64
+ fields?: Array<string> | undefined;
65
+ raw?: string | undefined;
66
+ };
67
+
68
+ /** @internal */
69
+ export const CreateUcCallRequest$outboundSchema: z.ZodType<
70
+ CreateUcCallRequest$Outbound,
71
+ z.ZodTypeDef,
72
+ CreateUcCallRequest
73
+ > = z.object({
74
+ ucCall: shared.UcCall$outboundSchema,
75
+ connectionId: z.string(),
76
+ fields: z.array(CreateUcCallQueryParamFields$outboundSchema).optional(),
77
+ raw: z.string().optional(),
78
+ }).transform((v) => {
79
+ return remap$(v, {
80
+ ucCall: "UcCall",
81
+ connectionId: "connection_id",
82
+ });
83
+ });
84
+
85
+ export function createUcCallRequestToJSON(
86
+ createUcCallRequest: CreateUcCallRequest,
87
+ ): string {
88
+ return JSON.stringify(
89
+ CreateUcCallRequest$outboundSchema.parse(createUcCallRequest),
90
+ );
91
+ }