Skip to content

Commit

Permalink
Merge pull request #54 from ryan-timothy-albert/speakeasy-sdk-regen-1…
Browse files Browse the repository at this point in the history
…734377680

chore: 🐝 Update SDK - Generate PETSTORE 5.2.0-alpha.4
  • Loading branch information
ryan-timothy-albert authored Dec 16, 2024
2 parents eb0e56f + 090e8a9 commit 098ca88
Show file tree
Hide file tree
Showing 30 changed files with 74 additions and 47 deletions.
12 changes: 6 additions & 6 deletions .speakeasy/gen.lock
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
lockVersion: 2.0.0
id: ede0e8e6-5a63-4cc3-bd29-551cf1036a60
management:
docChecksum: 60d27c46481b9d9f9618b01182214273
docChecksum: 507ce959f2b1b52532ffcbaef25cbd3c
docVersion: 4.0.0
speakeasyVersion: 1.454.0
generationVersion: 2.477.0
releaseVersion: 5.2.0-alpha.3
configChecksum: 2ca1feb8f638dc37fe2c80ab026067e7
speakeasyVersion: 1.455.7
generationVersion: 2.480.1
releaseVersion: 5.2.0-alpha.4
configChecksum: 1773e82e2fde2ac70734438bf70aebcd
repoURL: https://github.com/ryan-timothy-albert/simple-ts-sdk.git
installationURL: https://github.com/ryan-timothy-albert/simple-ts-sdk
published: true
features:
typescript:
additionalDependencies: 0.1.0
constsAndDefaults: 0.1.11
core: 3.18.9
core: 3.18.11
defaultEnabledRetries: 0.1.0
devContainers: 2.90.0
enumUnions: 0.1.0
Expand Down
2 changes: 1 addition & 1 deletion .speakeasy/gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ generation:
oAuth2ClientCredentialsEnabled: true
oAuth2PasswordEnabled: false
typescript:
version: 5.2.0-alpha.3
version: 5.2.0-alpha.4
additionalDependencies:
dependencies: {}
devDependencies: {}
Expand Down
16 changes: 8 additions & 8 deletions .speakeasy/workflow.lock
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
speakeasyVersion: 1.454.0
speakeasyVersion: 1.455.7
sources:
petstore-oas:
sourceNamespace: petstore-oas
sourceRevisionDigest: sha256:2f8622bc49b53a4b02bf1d1a3fae05c7b1009f370dd340e8ec8d0244d854f300
sourceBlobDigest: sha256:f02c4f38e98b5b0d5cbcb1cfb791c984d70a54ced9305986b23dadad78683d80
sourceRevisionDigest: sha256:a86050db0f12fc18827e67c7dbd2527f59004ea80052d5774f8020640ac29ea3
sourceBlobDigest: sha256:96cc6fae3e7a587d1440a68ab7d0ec805f37c12baa238e0aaefe4fd7e4e755a2
tags:
- latest
- speakeasy-sdk-regen-1733934520
- speakeasy-sdk-regen-1734377680
- 4.0.0
targets:
petstore:
source: petstore-oas
sourceNamespace: petstore-oas
sourceRevisionDigest: sha256:2f8622bc49b53a4b02bf1d1a3fae05c7b1009f370dd340e8ec8d0244d854f300
sourceBlobDigest: sha256:f02c4f38e98b5b0d5cbcb1cfb791c984d70a54ced9305986b23dadad78683d80
sourceRevisionDigest: sha256:a86050db0f12fc18827e67c7dbd2527f59004ea80052d5774f8020640ac29ea3
sourceBlobDigest: sha256:96cc6fae3e7a587d1440a68ab7d0ec805f37c12baa238e0aaefe4fd7e4e755a2
codeSamplesNamespace: petstore-oas-typescript-code-samples
codeSamplesRevisionDigest: sha256:95d9accf719cd21101e9a13d416365972e07d3db9a5f61986fe1d7f5cc419956
codeSamplesRevisionDigest: sha256:96db5b1e15a86c97a0bc6cb251f727900d702abf838befe3a0e576571c5e75bd
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
sources:
petstore-oas:
inputs:
- location: openapi.yaml
- location: openapi.json
registry:
location: registry.speakeasyapi.dev/ryan-local/ryan-telemetry/petstore-oas
targets:
Expand Down
32 changes: 17 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,19 +325,7 @@ run();
<!-- Start Error Handling [errors] -->
## Error Handling

All SDK methods return a response object or throw an error. By default, an API error will throw a `errors.SDKError`.

If a HTTP request fails, an operation my also throw an error from the `models/errors/httpclienterrors.ts` module:

| HTTP Client Error | Description |
| ---------------------------------------------------- | ---------------------------------------------------- |
| RequestAbortedError | HTTP request was aborted by the client |
| RequestTimeoutError | HTTP request timed out due to an AbortSignal signal |
| ConnectionError | HTTP client was unable to make a request to a server |
| InvalidRequestError | Any input used to create a request is invalid |
| UnexpectedClientError | Unrecognised or unexpected error |

In addition, when custom error responses are specified for an operation, the SDK may throw their associated Error type. You can refer to respective *Errors* tables in SDK docs for more details on possible error types for each operation. For example, the `sit` method may throw the following errors:
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 `sit` method may throw the following errors:

| Error Type | Status Code | Content Type |
| --------------------------- | ----------- | ---------------- |
Expand All @@ -346,6 +334,8 @@ In addition, when custom error responses are specified for an operation, the SDK
| errors.ApiErrorNotFound | 404 | application/json |
| errors.SDKError | 4XX, 5XX | \*/\* |

If the method throws an error and it is not captured by the known errors, it will default to throwing a `SDKError`.

```typescript
import { Petstore } from "ryan-simple-test-act";
import {
Expand Down Expand Up @@ -379,8 +369,9 @@ async function run() {
console.log(result);
} catch (err) {
switch (true) {
// The server response does not match the expected SDK schema
case (err instanceof SDKValidationError): {
// Validation errors can be pretty-printed
// Pretty-print will provide a human-readable multi-line error message
console.error(err.pretty());
// Raw value may also be inspected
console.error(err.rawValue);
Expand All @@ -402,6 +393,7 @@ async function run() {
return;
}
default: {
// Other errors such as network errors, see HTTPClientErrors for more details
throw err;
}
}
Expand All @@ -412,7 +404,17 @@ run();

```

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 string since validation errors can list many issues and the plain error string may be difficult read when debugging.
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.

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:

| HTTP Client Error | Description |
| ---------------------------------------------------- | ---------------------------------------------------- |
| RequestAbortedError | HTTP request was aborted by the client |
| RequestTimeoutError | HTTP request timed out due to an AbortSignal signal |
| ConnectionError | HTTP client was unable to make a request to a server |
| InvalidRequestError | Any input used to create a request is invalid |
| UnexpectedClientError | Unrecognised or unexpected error |
<!-- End Error Handling [errors] -->

<!-- Start Server Selection [server] -->
Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -462,4 +462,14 @@ Based on:
### Generated
- [typescript v5.2.0-alpha.3] .
### Releases
- [NPM v5.2.0-alpha.3] https://www.npmjs.com/package/ryan-simple-test-act/v/5.2.0-alpha.3 - .
- [NPM v5.2.0-alpha.3] https://www.npmjs.com/package/ryan-simple-test-act/v/5.2.0-alpha.3 - .

## 2024-12-16 19:34:37
### Changes
Based on:
- OpenAPI Doc
- Speakeasy CLI 1.455.7 (2.480.1) https://github.com/speakeasy-api/speakeasy
### Generated
- [typescript v5.2.0-alpha.4] .
### Releases
- [NPM v5.2.0-alpha.4] https://www.npmjs.com/package/ryan-simple-test-act/v/5.2.0-alpha.4 - .
2 changes: 0 additions & 2 deletions docs/models/errors/apierrorinvalidinput.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# ApiErrorInvalidInput

Not Found error

## Example Usage

```typescript
Expand Down
2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{
"name": "ryan-simple-test-act",
"version": "5.2.0-alpha.3",
"version": "5.2.0-alpha.4",
"exports": {
".": "./src/index.ts",
"./models/errors": "./src/models/errors/index.ts",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ryan-simple-test-act",
"version": "5.2.0-alpha.3",
"version": "5.2.0-alpha.4",
"author": "ryan-timothy-albert",
"main": "./index.js",
"sideEffects": false,
Expand Down
1 change: 1 addition & 0 deletions src/funcs/petDeletePet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export async function petDeletePet(
const requestRes = client._createRequest(context, {
security: requestSecurity,
method: "DELETE",
baseURL: options?.serverURL,
path: path,
headers: headers,
body: body,
Expand Down
1 change: 1 addition & 0 deletions src/funcs/petFindPetsByStatusTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export async function petFindPetsByStatusTypes(
const requestRes = client._createRequest(context, {
security: requestSecurity,
method: "GET",
baseURL: options?.serverURL,
path: path,
headers: headers,
query: query,
Expand Down
1 change: 1 addition & 0 deletions src/funcs/petFindPetsByTags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export async function petFindPetsByTags(
const requestRes = client._createRequest(context, {
security: requestSecurity,
method: "GET",
baseURL: options?.serverURL,
path: path,
headers: headers,
query: query,
Expand Down
1 change: 1 addition & 0 deletions src/funcs/petGetPetByIDS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export async function petGetPetByIDS(
const requestRes = client._createRequest(context, {
security: requestSecurity,
method: "GET",
baseURL: options?.serverURL,
path: path,
headers: headers,
body: body,
Expand Down
1 change: 1 addition & 0 deletions src/funcs/petMyPet123.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export async function petMyPet123(
const requestRes = client._createRequest(context, {
security: requestSecurity,
method: "POST",
baseURL: options?.serverURL,
path: path,
headers: headers,
body: body,
Expand Down
1 change: 1 addition & 0 deletions src/funcs/petSit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export async function petSit(
const requestRes = client._createRequest(context, {
security: requestSecurity,
method: "PUT",
baseURL: options?.serverURL,
path: path,
headers: headers,
body: body,
Expand Down
1 change: 1 addition & 0 deletions src/funcs/petUploadFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export async function petUploadFile(
const requestRes = client._createRequest(context, {
security: requestSecurity,
method: "POST",
baseURL: options?.serverURL,
path: path,
headers: headers,
query: query,
Expand Down
1 change: 1 addition & 0 deletions src/funcs/storeDeleteOrder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export async function storeDeleteOrder(
const requestRes = client._createRequest(context, {
security: requestSecurity,
method: "DELETE",
baseURL: options?.serverURL,
path: path,
headers: headers,
body: body,
Expand Down
1 change: 1 addition & 0 deletions src/funcs/storeGetInventory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export async function storeGetInventory(
const requestRes = client._createRequest(context, {
security: requestSecurity,
method: "GET",
baseURL: options?.serverURL,
path: path,
headers: headers,
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
Expand Down
1 change: 1 addition & 0 deletions src/funcs/storeGetOrderById.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export async function storeGetOrderById(
const requestRes = client._createRequest(context, {
security: requestSecurity,
method: "GET",
baseURL: options?.serverURL,
path: path,
headers: headers,
body: body,
Expand Down
1 change: 1 addition & 0 deletions src/funcs/storePlaceOrder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export async function storePlaceOrder(
const requestRes = client._createRequest(context, {
security: requestSecurity,
method: "POST",
baseURL: options?.serverURL,
path: path,
headers: headers,
body: body,
Expand Down
1 change: 1 addition & 0 deletions src/funcs/userCreateUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export async function userCreateUser(
const requestRes = client._createRequest(context, {
security: requestSecurity,
method: "POST",
baseURL: options?.serverURL,
path: path,
headers: headers,
body: body,
Expand Down
1 change: 1 addition & 0 deletions src/funcs/userCreateUsersWithListInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export async function userCreateUsersWithListInput(
const requestRes = client._createRequest(context, {
security: requestSecurity,
method: "POST",
baseURL: options?.serverURL,
path: path,
headers: headers,
body: body,
Expand Down
1 change: 1 addition & 0 deletions src/funcs/userDeleteUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export async function userDeleteUser(
const requestRes = client._createRequest(context, {
security: requestSecurity,
method: "DELETE",
baseURL: options?.serverURL,
path: path,
headers: headers,
body: body,
Expand Down
1 change: 1 addition & 0 deletions src/funcs/userGetUserByName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export async function userGetUserByName(
const requestRes = client._createRequest(context, {
security: requestSecurity,
method: "GET",
baseURL: options?.serverURL,
path: path,
headers: headers,
body: body,
Expand Down
1 change: 1 addition & 0 deletions src/funcs/userLoginUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export async function userLoginUser(
const requestRes = client._createRequest(context, {
security: requestSecurity,
method: "GET",
baseURL: options?.serverURL,
path: path,
headers: headers,
query: query,
Expand Down
1 change: 1 addition & 0 deletions src/funcs/userLogoutUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export async function userLogoutUser(
const requestRes = client._createRequest(context, {
security: requestSecurity,
method: "GET",
baseURL: options?.serverURL,
path: path,
headers: headers,
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
Expand Down
1 change: 1 addition & 0 deletions src/funcs/userUpdateUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export async function userUpdateUser(
const requestRes = client._createRequest(context, {
security: requestSecurity,
method: "PUT",
baseURL: options?.serverURL,
path: path,
headers: headers,
body: body,
Expand Down
6 changes: 3 additions & 3 deletions src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
export const SDK_METADATA = {
language: "typescript",
openapiDocVersion: "4.0.0",
sdkVersion: "5.2.0-alpha.3",
genVersion: "2.477.0",
sdkVersion: "5.2.0-alpha.4",
genVersion: "2.480.1",
userAgent:
"speakeasy-sdk/typescript 5.2.0-alpha.3 2.477.0 4.0.0 ryan-simple-test-act",
"speakeasy-sdk/typescript 5.2.0-alpha.4 2.480.1 4.0.0 ryan-simple-test-act",
} as const;
7 changes: 6 additions & 1 deletion src/lib/sdks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ export type RequestOptions = {
* Specifies the status codes which should be retried using the given retry policy.
*/
retryCodes?: string[];
/**
* Overrides the base server URL that will be used by an operation.
*/
serverURL?: string | URL;
/**
* Sets various request options on the `fetch` call made by an SDK method.
*
Expand All @@ -52,7 +56,7 @@ export type RequestOptions = {
type RequestConfig = {
method: string;
path: string;
baseURL?: string | URL;
baseURL?: string | URL | undefined;
query?: string;
body?: RequestInit["body"];
headers?: HeadersInit;
Expand Down Expand Up @@ -119,6 +123,7 @@ export class ClientSDK {
const inputURL = new URL(path, reqURL);

if (path) {
reqURL.pathname += reqURL.pathname.endsWith("/") ? "" : "/";
reqURL.pathname += inputURL.pathname.replace(/^\/+/, "");
}

Expand Down
Loading

0 comments on commit 098ca88

Please sign in to comment.