Skip to content

Commit

Permalink
ci: regenerated with OpenAPI Doc 1.0.0, Speakeasy CLI 1.118.3
Browse files Browse the repository at this point in the history
  • Loading branch information
speakeasybot committed Nov 10, 2023
1 parent 85b4473 commit ce2aef9
Show file tree
Hide file tree
Showing 43 changed files with 46 additions and 40 deletions.
Empty file modified .eslintrc.yml
100755 → 100644
Empty file.
Empty file modified .gitattributes
100755 → 100644
Empty file.
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ yarn add https://github.com/speakeasy-sdks/petstore-typescript-sdk

## SDK Example Usage
<!-- Start SDK Example Usage -->
### Example

```typescript
import { SwaggerPetstore } from "Swagger-Petstore";

Expand Down Expand Up @@ -68,16 +70,15 @@ Here's an example of one such pagination call:


<!-- Start Error Handling -->
# Error Handling
## Error Handling

Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an error. If Error objects are specified in your OpenAPI Spec, the SDK will throw the appropriate Error type.

| Error Object | Status Code | Content Type |
| --------------- | --------------- | --------------- |
| errors.SDKError | 400-600 | */* |


## Example
Example

```typescript
import { SwaggerPetstore } from "Swagger-Petstore";
Expand All @@ -101,17 +102,17 @@ import { SwaggerPetstore } from "Swagger-Petstore";


<!-- Start Server Selection -->
# Server Selection
## Server Selection

## Select Server by Index
### Select Server by Index

You can override the default server globally by passing a server index to the `serverIdx: number` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:

| # | Server | Variables |
| - | ------ | --------- |
| 0 | `http://petstore.swagger.io/v1` | None |

For example:
#### Example

```typescript
import { SwaggerPetstore } from "Swagger-Petstore";
Expand All @@ -131,10 +132,9 @@ import { SwaggerPetstore } from "Swagger-Petstore";
```


## Override Server URL Per-Client
### Override Server URL Per-Client

The default server can also be overridden globally by passing a URL to the `serverURL: str` optional parameter when initializing the SDK client instance. For example:

```typescript
import { SwaggerPetstore } from "Swagger-Petstore";

Expand All @@ -156,11 +156,10 @@ import { SwaggerPetstore } from "Swagger-Petstore";


<!-- Start Custom HTTP Client -->
# Custom HTTP Client
## Custom HTTP Client

The Typescript SDK makes API calls using the (axios)[https://axios-http.com/docs/intro] HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with a custom `AxiosInstance` object.


For example, you could specify a header for every request that your sdk makes as follows:

```typescript
Expand All @@ -171,7 +170,6 @@ const httpClient = axios.create({
headers: {'x-custom-header': 'someValue'}
})


const sdk = new SwaggerPetstore({defaultClient: httpClient});
```
<!-- End Custom HTTP Client -->
Expand Down
10 changes: 9 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,12 @@ Based on:
- OpenAPI Doc 1.0.0
- Speakeasy CLI 1.116.0 (2.185.0) https://github.com/speakeasy-api/speakeasy
### Generated
- [typescript v0.4.1] .
- [typescript v0.4.1] .

## 2023-11-10 01:09:18
### Changes
Based on:
- OpenAPI Doc 1.0.0
- Speakeasy CLI 1.118.3 (2.187.7) https://github.com/speakeasy-api/speakeasy
### Generated
- [typescript v0.4.2] .
2 changes: 0 additions & 2 deletions USAGE.md
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<!-- Start SDK Example Usage -->


```typescript
import { SwaggerPetstore } from "Swagger-Petstore";

Expand Down
Empty file modified docs/sdk/models/operations/createpetsresponse.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/listpetsrequest.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/listpetsresponse.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/showpetbyidrequest.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/showpetbyidresponse.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/shared/errort.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/shared/pet.md
100755 → 100644
Empty file.
Empty file modified docs/sdks/pets/README.md
100755 → 100644
Empty file.
Empty file modified docs/sdks/swaggerpetstore/README.md
100755 → 100644
Empty file.
10 changes: 6 additions & 4 deletions gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@ configVersion: 1.0.0
management:
docChecksum: 2516596125ef223fbbef6c434d22eaac
docVersion: 1.0.0
speakeasyVersion: 1.116.0
generationVersion: 2.185.0
speakeasyVersion: 1.118.3
generationVersion: 2.187.7
generation:
comments: {}
sdkClassName: Swagger-Petstore
repoURL: https://github.com/speakeasy-sdks/petstore-typescript-sdk.git
usageSnippets:
optionalPropertyRendering: withExample
features:
typescript:
core: 3.1.2
core: 3.1.3
globalServerURLs: 2.82.0
typescript:
version: 0.4.1
version: 0.4.2
author: demo
clientServerStatusCodesAsErrors: true
flattenGlobalSecurity: true
Expand Down
Empty file modified jest.config.js
100755 → 100644
Empty file.
4 changes: 2 additions & 2 deletions package-lock.json
100755 → 100644

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
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Swagger-Petstore",
"version": "0.4.1",
"version": "0.4.2",
"author": "demo",
"scripts": {
"prepare": "tsc --build",
Expand Down
Empty file modified src/index.ts
100755 → 100644
Empty file.
Empty file modified src/internal/utils/contenttype.ts
100755 → 100644
Empty file.
Empty file modified src/internal/utils/headers.ts
100755 → 100644
Empty file.
Empty file modified src/internal/utils/index.ts
100755 → 100644
Empty file.
Empty file modified src/internal/utils/pathparams.ts
100755 → 100644
Empty file.
Empty file modified src/internal/utils/queryparams.ts
100755 → 100644
Empty file.
Empty file modified src/internal/utils/requestbody.ts
100755 → 100644
Empty file.
Empty file modified src/internal/utils/retries.ts
100755 → 100644
Empty file.
Empty file modified src/internal/utils/security.ts
100755 → 100644
Empty file.
Empty file modified src/internal/utils/utils.ts
100755 → 100644
Empty file.
Empty file modified src/sdk/index.ts
100755 → 100644
Empty file.
Empty file modified src/sdk/models/errors/index.ts
100755 → 100644
Empty file.
Empty file modified src/sdk/models/errors/sdkerror.ts
100755 → 100644
Empty file.
Empty file modified src/sdk/models/operations/createpets.ts
100755 → 100644
Empty file.
Empty file modified src/sdk/models/operations/index.ts
100755 → 100644
Empty file.
Empty file modified src/sdk/models/operations/listpets.ts
100755 → 100644
Empty file.
Empty file modified src/sdk/models/operations/showpetbyid.ts
100755 → 100644
Empty file.
Empty file modified src/sdk/models/shared/error.ts
100755 → 100644
Empty file.
Empty file modified src/sdk/models/shared/index.ts
100755 → 100644
Empty file.
Empty file modified src/sdk/models/shared/pet.ts
100755 → 100644
Empty file.
32 changes: 16 additions & 16 deletions src/sdk/pets.ts
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ export class Pets {
...config,
});

const contentType: string = httpRes?.headers?.["content-type"] ?? "";
const responseContentType: string = httpRes?.headers?.["content-type"] ?? "";

if (httpRes?.status == null) {
throw new Error(`status code not found in response: ${httpRes}`);
}

const res: operations.CreatePetsResponse = new operations.CreatePetsResponse({
statusCode: httpRes.status,
contentType: contentType,
contentType: responseContentType,
rawResponse: httpRes,
});
const decodedRes = new TextDecoder().decode(httpRes?.data);
Expand All @@ -64,11 +64,11 @@ export class Pets {
httpRes
);
default:
if (utils.matchContentType(contentType, `application/json`)) {
if (utils.matchContentType(responseContentType, `application/json`)) {
res.error = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorT);
} else {
throw new errors.SDKError(
"unknown content-type received: " + contentType,
"unknown content-type received: " + responseContentType,
httpRes.status,
decodedRes,
httpRes
Expand Down Expand Up @@ -112,22 +112,22 @@ export class Pets {
...config,
});

const contentType: string = httpRes?.headers?.["content-type"] ?? "";
const responseContentType: string = httpRes?.headers?.["content-type"] ?? "";

if (httpRes?.status == null) {
throw new Error(`status code not found in response: ${httpRes}`);
}

const res: operations.ListPetsResponse = new operations.ListPetsResponse({
statusCode: httpRes.status,
contentType: contentType,
contentType: responseContentType,
rawResponse: httpRes,
headers: utils.getHeadersFromResponse(httpRes.headers),
});
const decodedRes = new TextDecoder().decode(httpRes?.data);
switch (true) {
case httpRes?.status == 200:
if (utils.matchContentType(contentType, `application/json`)) {
if (utils.matchContentType(responseContentType, `application/json`)) {
res.pets = [];
const resFieldDepth: number = utils.getResFieldDepth(res);
res.pets = utils.objectToClass(
Expand All @@ -137,7 +137,7 @@ export class Pets {
);
} else {
throw new errors.SDKError(
"unknown content-type received: " + contentType,
"unknown content-type received: " + responseContentType,
httpRes.status,
decodedRes,
httpRes
Expand All @@ -153,11 +153,11 @@ export class Pets {
httpRes
);
default:
if (utils.matchContentType(contentType, `application/json`)) {
if (utils.matchContentType(responseContentType, `application/json`)) {
res.error = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorT);
} else {
throw new errors.SDKError(
"unknown content-type received: " + contentType,
"unknown content-type received: " + responseContentType,
httpRes.status,
decodedRes,
httpRes
Expand Down Expand Up @@ -200,25 +200,25 @@ export class Pets {
...config,
});

const contentType: string = httpRes?.headers?.["content-type"] ?? "";
const responseContentType: string = httpRes?.headers?.["content-type"] ?? "";

if (httpRes?.status == null) {
throw new Error(`status code not found in response: ${httpRes}`);
}

const res: operations.ShowPetByIdResponse = new operations.ShowPetByIdResponse({
statusCode: httpRes.status,
contentType: contentType,
contentType: responseContentType,
rawResponse: httpRes,
});
const decodedRes = new TextDecoder().decode(httpRes?.data);
switch (true) {
case httpRes?.status == 200:
if (utils.matchContentType(contentType, `application/json`)) {
if (utils.matchContentType(responseContentType, `application/json`)) {
res.pet = utils.objectToClass(JSON.parse(decodedRes), shared.Pet);
} else {
throw new errors.SDKError(
"unknown content-type received: " + contentType,
"unknown content-type received: " + responseContentType,
httpRes.status,
decodedRes,
httpRes
Expand All @@ -234,11 +234,11 @@ export class Pets {
httpRes
);
default:
if (utils.matchContentType(contentType, `application/json`)) {
if (utils.matchContentType(responseContentType, `application/json`)) {
res.error = utils.objectToClass(JSON.parse(decodedRes), shared.ErrorT);
} else {
throw new errors.SDKError(
"unknown content-type received: " + contentType,
"unknown content-type received: " + responseContentType,
httpRes.status,
decodedRes,
httpRes
Expand Down
6 changes: 3 additions & 3 deletions src/sdk/sdk.ts
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ export class SDKConfiguration {
serverDefaults: any;
language = "typescript";
openapiDocVersion = "1.0.0";
sdkVersion = "0.4.1";
genVersion = "2.185.0";
userAgent = "speakeasy-sdk/typescript 0.4.1 2.185.0 1.0.0 Swagger-Petstore";
sdkVersion = "0.4.2";
genVersion = "2.187.7";
userAgent = "speakeasy-sdk/typescript 0.4.2 2.187.7 1.0.0 Swagger-Petstore";
retryConfig?: utils.RetryConfig;
public constructor(init?: Partial<SDKConfiguration>) {
Object.assign(this, init);
Expand Down
Empty file modified src/sdk/types/index.ts
100755 → 100644
Empty file.
Empty file modified src/sdk/types/rfcdate.ts
100755 → 100644
Empty file.
Empty file modified tsconfig.json
100755 → 100644
Empty file.

0 comments on commit ce2aef9

Please sign in to comment.