Skip to content

Commit cc09466

Browse files
committed
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.559.0
1 parent 9cfe6da commit cc09466

File tree

1,410 files changed

+14346
-38535
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,410 files changed

+14346
-38535
lines changed

.speakeasy/gen.lock

Lines changed: 613 additions & 16 deletions
Large diffs are not rendered by default.

.speakeasy/gen.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ generation:
2323
generateNewTests: true
2424
skipResponseBodyAssertions: false
2525
typescript:
26-
version: 0.24.1
26+
version: 0.25.0
2727
additionalDependencies:
2828
dependencies: {}
2929
devDependencies: {}
3030
peerDependencies: {}
3131
additionalPackageJSON: {}
3232
author: Speakeasy
33+
baseErrorName: ApideckError
3334
clientServerStatusCodesAsErrors: true
3435
defaultErrorName: APIError
3536
enableCustomCodeRegions: false

.speakeasy/workflow.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
speakeasyVersion: 1.555.0
1+
speakeasyVersion: 1.559.0
22
sources:
33
Apideck-OAS:
44
sourceNamespace: apideck-oas
5-
sourceRevisionDigest: sha256:dfd8bf44ffd797bd01ed1dcb3c44becb2f7199d271108c1c00340fa5e6c9e259
6-
sourceBlobDigest: sha256:56d1ef43c8d49e89407bc967e1cd9b9eeb54029bf17113e1c6914056084805da
5+
sourceRevisionDigest: sha256:bd0b9d7f0319e40714550f4804ac44d6ac7f3ef1346eb26a972d44ce46ac0fba
6+
sourceBlobDigest: sha256:b16d87c11cc9c5bbff0fc829bd6621927e10f79ff8f16a6b6eddd3b1bf56e8a1
77
tags:
88
- latest
9-
- speakeasy-sdk-regen-1748856960
9+
- speakeasy-sdk-regen-1749226423
1010
- 10.17.2
1111
targets:
1212
apideck:
1313
source: Apideck-OAS
1414
sourceNamespace: apideck-oas
15-
sourceRevisionDigest: sha256:dfd8bf44ffd797bd01ed1dcb3c44becb2f7199d271108c1c00340fa5e6c9e259
16-
sourceBlobDigest: sha256:56d1ef43c8d49e89407bc967e1cd9b9eeb54029bf17113e1c6914056084805da
15+
sourceRevisionDigest: sha256:bd0b9d7f0319e40714550f4804ac44d6ac7f3ef1346eb26a972d44ce46ac0fba
16+
sourceBlobDigest: sha256:b16d87c11cc9c5bbff0fc829bd6621927e10f79ff8f16a6b6eddd3b1bf56e8a1
1717
codeSamplesNamespace: apideck-oas-typescript-code-samples
18-
codeSamplesRevisionDigest: sha256:a29b5e75f9bed069b68f15f829ab6db1367bd3b5b8181e73b1393450324b9512
18+
codeSamplesRevisionDigest: sha256:14c55248868d8910ef92a44aac87cbfd4e88eba070457afb5c72608a3585d047
1919
workflow:
2020
workflowVersion: 1.0.0
2121
speakeasyVersion: latest

FUNCTIONS.md

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@ specific category of applications.
2121
```typescript
2222
import { ApideckCore } from "@apideck/unify/core.js";
2323
import { accountingTaxRatesList } from "@apideck/unify/funcs/accountingTaxRatesList.js";
24-
import { SDKValidationError } from "@apideck/unify/models/errors/sdkvalidationerror.js";
2524

2625
// Use `ApideckCore` for best tree-shaking performance.
2726
// You can create one instance of it to use across an application.
2827
const apideck = new ApideckCore({
29-
apiKey: process.env["APIDECK_API_KEY"] ?? "",
3028
consumerId: "test-consumer",
3129
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
30+
apiKey: process.env["APIDECK_API_KEY"] ?? "",
3231
});
3332

3433
async function run() {
@@ -46,30 +45,14 @@ async function run() {
4645
},
4746
fields: "id,updated_at",
4847
});
49-
50-
switch (true) {
51-
case res.ok:
52-
// The success case will be handled outside of the switch block
53-
break;
54-
case res.error instanceof SDKValidationError:
55-
// Pretty-print validation errors.
56-
return console.log(res.error.pretty());
57-
case res.error instanceof Error:
58-
return console.log(res.error);
59-
default:
60-
// TypeScript's type checking will fail on the following line if the above
61-
// cases were not exhaustive.
62-
res.error satisfies never;
63-
throw new Error("Assertion failed: expected error checks to be exhaustive: " + res.error);
64-
}
65-
66-
67-
const { value: result } = res;
68-
69-
for await (const page of result) {
70-
// Handle the page
48+
if (res.ok) {
49+
const { value: result } = res;
50+
for await (const page of result) {
7151
console.log(page);
7252
}
53+
} else {
54+
console.log("accountingTaxRatesList failed:", res.error);
55+
}
7356
}
7457

7558
run();

README.md

Lines changed: 58 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
8989
import { Apideck } from "@apideck/unify";
9090

9191
const apideck = new Apideck({
92-
apiKey: process.env["APIDECK_API_KEY"] ?? "",
9392
consumerId: "test-consumer",
9493
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
94+
apiKey: process.env["APIDECK_API_KEY"] ?? "",
9595
});
9696

9797
async function run() {
@@ -111,7 +111,6 @@ async function run() {
111111
});
112112

113113
for await (const page of result) {
114-
// Handle the page
115114
console.log(page);
116115
}
117116
}
@@ -1011,9 +1010,9 @@ Here's an example of one such pagination call:
10111010
import { Apideck } from "@apideck/unify";
10121011

10131012
const apideck = new Apideck({
1014-
apiKey: process.env["APIDECK_API_KEY"] ?? "",
10151013
consumerId: "test-consumer",
10161014
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1015+
apiKey: process.env["APIDECK_API_KEY"] ?? "",
10171016
});
10181017

10191018
async function run() {
@@ -1033,7 +1032,6 @@ async function run() {
10331032
});
10341033

10351034
for await (const page of result) {
1036-
// Handle the page
10371035
console.log(page);
10381036
}
10391037
}
@@ -1062,9 +1060,9 @@ import { Apideck } from "@apideck/unify";
10621060
import { openAsBlob } from "node:fs";
10631061

10641062
const apideck = new Apideck({
1065-
apiKey: process.env["APIDECK_API_KEY"] ?? "",
10661063
consumerId: "test-consumer",
10671064
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1065+
apiKey: process.env["APIDECK_API_KEY"] ?? "",
10681066
});
10691067

10701068
async function run() {
@@ -1077,7 +1075,6 @@ async function run() {
10771075
requestBody: await openAsBlob("example.file"),
10781076
});
10791077

1080-
// Handle the result
10811078
console.log(result);
10821079
}
10831080

@@ -1096,9 +1093,9 @@ To change the default retry strategy for a single API call, simply provide a ret
10961093
import { Apideck } from "@apideck/unify";
10971094

10981095
const apideck = new Apideck({
1099-
apiKey: process.env["APIDECK_API_KEY"] ?? "",
11001096
consumerId: "test-consumer",
11011097
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1098+
apiKey: process.env["APIDECK_API_KEY"] ?? "",
11021099
});
11031100

11041101
async function run() {
@@ -1129,7 +1126,6 @@ async function run() {
11291126
});
11301127

11311128
for await (const page of result) {
1132-
// Handle the page
11331129
console.log(page);
11341130
}
11351131
}
@@ -1153,9 +1149,9 @@ const apideck = new Apideck({
11531149
},
11541150
retryConnectionErrors: false,
11551151
},
1156-
apiKey: process.env["APIDECK_API_KEY"] ?? "",
11571152
consumerId: "test-consumer",
11581153
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1154+
apiKey: process.env["APIDECK_API_KEY"] ?? "",
11591155
});
11601156

11611157
async function run() {
@@ -1175,7 +1171,6 @@ async function run() {
11751171
});
11761172

11771173
for await (const page of result) {
1178-
// Handle the page
11791174
console.log(page);
11801175
}
11811176
}
@@ -1188,40 +1183,29 @@ run();
11881183
<!-- Start Error Handling [errors] -->
11891184
## Error Handling
11901185

1191-
Some methods specify known errors which can be thrown. All the known errors are enumerated in the `models/errors/errors.ts` module. The known errors for a method are documented under the *Errors* tables in SDK docs. For example, the `list` method may throw the following errors:
1186+
[`ApideckError`](./src/models/errors/apideckerror.ts) is the base class for all HTTP error responses. It has the following properties:
11921187

1193-
| Error Type | Status Code | Content Type |
1194-
| ------------------------------ | ----------- | ---------------- |
1195-
| errors.BadRequestResponse | 400 | application/json |
1196-
| errors.UnauthorizedResponse | 401 | application/json |
1197-
| errors.PaymentRequiredResponse | 402 | application/json |
1198-
| errors.NotFoundResponse | 404 | application/json |
1199-
| errors.UnprocessableResponse | 422 | application/json |
1200-
| errors.APIError | 4XX, 5XX | \*/\* |
1201-
1202-
If the method throws an error and it is not captured by the known errors, it will default to throwing a `APIError`.
1188+
| Property | Type | Description |
1189+
| ------------------------- | ---------- | --------------------------------------------------------------------------------------- |
1190+
| `error.message` | `string` | Error message |
1191+
| `error.httpMeta.response` | `Response` | HTTP response. Access to headers and more. |
1192+
| `error.httpMeta.request` | `Request` | HTTP request. Access to headers and more. |
1193+
| `error.data$` | | Optional. Some errors may contain structured data. [See Error Classes](#error-classes). |
12031194

1195+
### Example
12041196
```typescript
12051197
import { Apideck } from "@apideck/unify";
1206-
import {
1207-
BadRequestResponse,
1208-
NotFoundResponse,
1209-
PaymentRequiredResponse,
1210-
SDKValidationError,
1211-
UnauthorizedResponse,
1212-
UnprocessableResponse,
1213-
} from "@apideck/unify/models/errors";
1198+
import * as errors from "@apideck/unify/models/errors";
12141199

12151200
const apideck = new Apideck({
1216-
apiKey: process.env["APIDECK_API_KEY"] ?? "",
12171201
consumerId: "test-consumer",
12181202
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1203+
apiKey: process.env["APIDECK_API_KEY"] ?? "",
12191204
});
12201205

12211206
async function run() {
1222-
let result;
12231207
try {
1224-
result = await apideck.accounting.taxRates.list({
1208+
const result = await apideck.accounting.taxRates.list({
12251209
serviceId: "salesforce",
12261210
filter: {
12271211
assets: true,
@@ -1237,47 +1221,23 @@ async function run() {
12371221
});
12381222

12391223
for await (const page of result) {
1240-
// Handle the page
12411224
console.log(page);
12421225
}
1243-
} catch (err) {
1244-
switch (true) {
1245-
// The server response does not match the expected SDK schema
1246-
case (err instanceof SDKValidationError): {
1247-
// Pretty-print will provide a human-readable multi-line error message
1248-
console.error(err.pretty());
1249-
// Raw value may also be inspected
1250-
console.error(err.rawValue);
1251-
return;
1252-
}
1253-
case (err instanceof BadRequestResponse): {
1254-
// Handle err.data$: BadRequestResponseData
1255-
console.error(err);
1256-
return;
1257-
}
1258-
case (err instanceof UnauthorizedResponse): {
1259-
// Handle err.data$: UnauthorizedResponseData
1260-
console.error(err);
1261-
return;
1262-
}
1263-
case (err instanceof PaymentRequiredResponse): {
1264-
// Handle err.data$: PaymentRequiredResponseData
1265-
console.error(err);
1266-
return;
1267-
}
1268-
case (err instanceof NotFoundResponse): {
1269-
// Handle err.data$: NotFoundResponseData
1270-
console.error(err);
1271-
return;
1272-
}
1273-
case (err instanceof UnprocessableResponse): {
1274-
// Handle err.data$: UnprocessableResponseData
1275-
console.error(err);
1276-
return;
1277-
}
1278-
default: {
1279-
// Other errors such as network errors, see HTTPClientErrors for more details
1280-
throw err;
1226+
} catch (error) {
1227+
// The base class for HTTP error responses
1228+
if (error instanceof errors.ApideckError) {
1229+
console.log(error.message);
1230+
console.log(error.httpMeta.response.status);
1231+
console.log(error.httpMeta.response.headers);
1232+
console.log(error.httpMeta.request);
1233+
1234+
// Depending on the method different errors may be thrown
1235+
if (error instanceof errors.BadRequestResponse) {
1236+
console.log(error.data$.statusCode); // number
1237+
console.log(error.data$.error); // string
1238+
console.log(error.data$.typeName); // string
1239+
console.log(error.data$.message); // string
1240+
console.log(error.data$.detail); // errors.Detail
12811241
}
12821242
}
12831243
}
@@ -1287,17 +1247,33 @@ run();
12871247

12881248
```
12891249

1290-
Validation errors can also occur when either method arguments or data returned from the server do not match the expected format. The `SDKValidationError` that is thrown as a result will capture the raw value that failed validation in an attribute called `rawValue`. Additionally, a `pretty()` method is available on this error that can be used to log a nicely formatted multi-line string since validation errors can list many issues and the plain error string may be difficult read when debugging.
1250+
### Error Classes
1251+
**Primary errors:**
1252+
* [`ApideckError`](./src/models/errors/apideckerror.ts): The base class for HTTP error responses.
1253+
* [`UnauthorizedResponse`](docs/models/errors/unauthorizedresponse.md): Unauthorized. Status code `401`.
1254+
* [`PaymentRequiredResponse`](docs/models/errors/paymentrequiredresponse.md): Payment Required. Status code `402`.
1255+
* [`NotFoundResponse`](docs/models/errors/notfoundresponse.md): The specified resource was not found. Status code `404`. *
1256+
* [`BadRequestResponse`](docs/models/errors/badrequestresponse.md): Bad Request. Status code `400`. *
1257+
* [`UnprocessableResponse`](docs/models/errors/unprocessableresponse.md): Unprocessable. Status code `422`. *
1258+
1259+
<details><summary>Less common errors (6)</summary>
1260+
1261+
<br />
1262+
1263+
**Network errors:**
1264+
* [`ConnectionError`](./src/models/errors/httpclienterrors.ts): HTTP client was unable to make a request to a server.
1265+
* [`RequestTimeoutError`](./src/models/errors/httpclienterrors.ts): HTTP request timed out due to an AbortSignal signal.
1266+
* [`RequestAbortedError`](./src/models/errors/httpclienterrors.ts): HTTP request was aborted by the client.
1267+
* [`InvalidRequestError`](./src/models/errors/httpclienterrors.ts): Any input used to create a request is invalid.
1268+
* [`UnexpectedClientError`](./src/models/errors/httpclienterrors.ts): Unrecognised or unexpected error.
12911269

1292-
In some rare cases, the SDK can fail to get a response from the server or even make the request due to unexpected circumstances such as network conditions. These types of errors are captured in the `models/errors/httpclienterrors.ts` module:
12931270

1294-
| HTTP Client Error | Description |
1295-
| ---------------------------------------------------- | ---------------------------------------------------- |
1296-
| RequestAbortedError | HTTP request was aborted by the client |
1297-
| RequestTimeoutError | HTTP request timed out due to an AbortSignal signal |
1298-
| ConnectionError | HTTP client was unable to make a request to a server |
1299-
| InvalidRequestError | Any input used to create a request is invalid |
1300-
| UnexpectedClientError | Unrecognised or unexpected error |
1271+
**Inherit from [`ApideckError`](./src/models/errors/apideckerror.ts)**:
1272+
* [`ResponseValidationError`](./src/models/errors/responsevalidationerror.ts): Type mismatch between the data returned from the server and the structure expected by the SDK. See `error.rawValue` for the raw value and `error.pretty()` for a nicely formatted multi-line string.
1273+
1274+
</details>
1275+
1276+
\* Check [the method documentation](#available-resources-and-operations) to see if the error is applicable.
13011277
<!-- End Error Handling [errors] -->
13021278

13031279
<!-- Start Server Selection [server] -->
@@ -1311,9 +1287,9 @@ import { Apideck } from "@apideck/unify";
13111287

13121288
const apideck = new Apideck({
13131289
serverURL: "https://unify.apideck.com",
1314-
apiKey: process.env["APIDECK_API_KEY"] ?? "",
13151290
consumerId: "test-consumer",
13161291
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1292+
apiKey: process.env["APIDECK_API_KEY"] ?? "",
13171293
});
13181294

13191295
async function run() {
@@ -1333,7 +1309,6 @@ async function run() {
13331309
});
13341310

13351311
for await (const page of result) {
1336-
// Handle the page
13371312
console.log(page);
13381313
}
13391314
}
@@ -1350,9 +1325,9 @@ import { Apideck } from "@apideck/unify";
13501325
import { openAsBlob } from "node:fs";
13511326

13521327
const apideck = new Apideck({
1353-
apiKey: process.env["APIDECK_API_KEY"] ?? "",
13541328
consumerId: "test-consumer",
13551329
appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX",
1330+
apiKey: process.env["APIDECK_API_KEY"] ?? "",
13561331
});
13571332

13581333
async function run() {
@@ -1367,7 +1342,6 @@ async function run() {
13671342
serverURL: "https://upload.apideck.com",
13681343
});
13691344

1370-
// Handle the result
13711345
console.log(result);
13721346
}
13731347

@@ -1463,7 +1437,6 @@ async function run() {
14631437
});
14641438

14651439
for await (const page of result) {
1466-
// Handle the page
14671440
console.log(page);
14681441
}
14691442
}

0 commit comments

Comments
 (0)