Skip to content

Commit

Permalink
ci: regenerated with OpenAPI Doc v1.0.0, Speakeasy CLI 1.118.0
Browse files Browse the repository at this point in the history
  • Loading branch information
speakeasybot committed Nov 9, 2023
1 parent 7343fd0 commit 0aa5feb
Show file tree
Hide file tree
Showing 209 changed files with 138 additions and 131 deletions.
Empty file modified .devcontainer/README.md
100755 → 100644
Empty file.
Empty file modified .devcontainer/devcontainer.json
100755 → 100644
Empty file.
Empty file modified .devcontainer/setup.sh
100755 → 100644
Empty file.
Empty file modified .eslintrc.yml
100755 → 100644
Empty file.
Empty file modified .gitattributes
100755 → 100644
Empty file.
25 changes: 11 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ To get access to the API and fetch an API key, please sign up for [access](https

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

```typescript
import { Leonardo } from "@leonardo-ai/sdk";

Expand Down Expand Up @@ -131,16 +133,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 { Leonardo } from "@leonardo-ai/sdk";
Expand Down Expand Up @@ -168,11 +169,10 @@ import { Leonardo } from "@leonardo-ai/sdk";


<!-- 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 @@ -183,25 +183,24 @@ const httpClient = axios.create({
headers: {'x-custom-header': 'someValue'}
})


const sdk = new Leonardo({defaultClient: httpClient});
```
<!-- End Custom HTTP Client -->
<!-- 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 | `https://cloud.leonardo.ai/api/rest/v1` | None |

For example:
#### Example

```typescript
import { Leonardo } from "@leonardo-ai/sdk";
Expand All @@ -224,10 +223,9 @@ import { Leonardo } from "@leonardo-ai/sdk";
```


## 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 { Leonardo } from "@leonardo-ai/sdk";
Expand All @@ -252,9 +250,9 @@ import { Leonardo } from "@leonardo-ai/sdk";


<!-- Start Authentication -->
# Authentication
## Authentication

## Per-Client Security Schemes
### Per-Client Security Schemes

This SDK supports the following security scheme globally:

Expand All @@ -263,7 +261,6 @@ This SDK supports the following security scheme globally:
| `bearerAuth` | http | HTTP Bearer |

To authenticate with the API the `bearerAuth` parameter must be set when initializing the SDK client instance. For example:

```typescript
import { Leonardo } from "@leonardo-ai/sdk";
Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -1399,4 +1399,14 @@ Based on:
### Generated
- [typescript v2.1.1] .
### Releases
- [NPM v2.1.1] https://www.npmjs.com/package/@leonardo-ai/sdk/v/2.1.1 - .
- [NPM v2.1.1] https://www.npmjs.com/package/@leonardo-ai/sdk/v/2.1.1 - .

## 2023-11-09 14:02:10
### Changes
Based on:
- OpenAPI Doc v1.0.0 https://api-docs-nine-delta.vercel.app/cloud/openapi.json
- Speakeasy CLI 1.118.0 (2.187.2) https://github.com/speakeasy-api/speakeasy
### Generated
- [typescript v2.1.2] .
### Releases
- [NPM v2.1.2] https://www.npmjs.com/package/@leonardo-ai/sdk/v/2.1.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 { Leonardo } from "@leonardo-ai/sdk";

Expand Down
Empty file modified docs/sdk/models/operations/createdatasetrequestbody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/createdatasetresponse.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/createdatasetresponsebody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/creategenerationrequestbody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/creategenerationresponse.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/creategenerationresponsebody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/createmodelrequestbody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/createmodelresponse.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/createmodelresponsebody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/createvariationnobgrequestbody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/createvariationnobgresponse.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/createvariationnobgresponsebody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/createvariationupscalerequestbody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/createvariationupscaleresponse.md
100755 → 100644
Empty file.
Empty file.
Empty file.
Empty file modified docs/sdk/models/operations/custommodels.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/datasetgenuploadoutput.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/datasetimages.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/datasets.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/datasetuploadoutput.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/deletedatasetbyiddatasets.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/deletedatasetbyidrequest.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/deletedatasetbyidresponse.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/deletedatasetbyidresponsebody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/deletegenerationbyidrequest.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/deletegenerationbyidresponse.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/deletegenerationbyidresponsebody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/deletegenerationstextureidrequest.md
100755 → 100644
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified docs/sdk/models/operations/deleteinitimagebyidrequest.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/deleteinitimagebyidresponse.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/deleteinitimagebyidresponsebody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/deletemodelbyidrequest.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/deletemodelbyidresponse.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/deletemodelbyidresponsebody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/deletemodels3didrequest.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/deletemodels3didrequestbody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/deletemodels3didresponse.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/deletemodels3didresponsebody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/elements.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/generatedimages.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/generatedimagevariationgeneric.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/generationelements.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/generations.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getdatasetbyiddatasets.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getdatasetbyidrequest.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getdatasetbyidresponse.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getdatasetbyidresponsebody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getelementsresponse.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getelementsresponsebody.md
100755 → 100644
Empty file.
Empty file.
Empty file modified docs/sdk/models/operations/getgenerationbyidgenerations.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getgenerationbyidloras.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getgenerationbyidrequest.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getgenerationbyidresponse.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getgenerationbyidresponsebody.md
100755 → 100644
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified docs/sdk/models/operations/getgenerationsbyuseridgenerations.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getgenerationsbyuseridrequest.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getgenerationsbyuseridresponse.md
100755 → 100644
Empty file.
Empty file.
Empty file modified docs/sdk/models/operations/getinitimagebyidinitimages.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getinitimagebyidrequest.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getinitimagebyidresponse.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getinitimagebyidresponsebody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getmodelbyidcustommodels.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getmodelbyidrequest.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getmodelbyidresponse.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getmodelbyidresponsebody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getplatformmodelscustommodels.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getplatformmodelsgeneratedimages.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getplatformmodelsrequest.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getplatformmodelsresponse.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getplatformmodelsresponsebody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getuserselfresponse.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getuserselfresponsebody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getvariationbyidrequest.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getvariationbyidresponse.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/getvariationbyidresponsebody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/initimages.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/initimageuploadoutput.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/loras.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/modelassets.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/modelassettexturegenerations.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/modelassetuploadoutput.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/postgenerationstexturerequestbody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/postgenerationstextureresponse.md
100755 → 100644
Empty file.
Empty file.
Empty file modified docs/sdk/models/operations/postmodels3duploadrequestbody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/postmodels3duploadresponse.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/postmodels3duploadresponsebody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/postvariationsunzoomrequestbody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/postvariationsunzoomresponse.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/postvariationsunzoomresponsebody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/sdgenerationoutput.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/sdtrainingoutput.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/sdunzoomoutput.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/sdupscalejoboutput.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/texturegenerationjoboutput.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/uploaddatasetimagefromgenrequest.md
100755 → 100644
Empty file.
Empty file.
Empty file modified docs/sdk/models/operations/uploaddatasetimagefromgenresponse.md
100755 → 100644
Empty file.
Empty file.
Empty file modified docs/sdk/models/operations/uploaddatasetimagerequest.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/uploaddatasetimagerequestbody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/uploaddatasetimageresponse.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/uploaddatasetimageresponsebody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/uploadinitimagerequestbody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/uploadinitimageresponse.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/uploadinitimageresponsebody.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/userdetails.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/operations/users.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/shared/controlnettype.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/shared/custommodeltype.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/shared/elementinput.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/shared/jobstatus.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/shared/sdgenerationschedulers.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/shared/sdgenerationstyle.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/shared/sdversions.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/shared/security.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/shared/strength.md
100755 → 100644
Empty file.
Empty file modified docs/sdk/models/shared/variationtype.md
100755 → 100644
Empty file.
Empty file modified docs/sdks/dataset/README.md
100755 → 100644
Empty file.
Empty file modified docs/sdks/element/README.md
100755 → 100644
Empty file.
Empty file modified docs/sdks/generation/README.md
100755 → 100644
Empty file.
Empty file modified docs/sdks/initimage/README.md
100755 → 100644
Empty file.
Empty file modified docs/sdks/leonardo/README.md
100755 → 100644
Empty file.
Empty file modified docs/sdks/model/README.md
100755 → 100644
Empty file.
Empty file modified docs/sdks/user/README.md
100755 → 100644
Empty file.
Empty file modified docs/sdks/variation/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,24 +2,26 @@ configVersion: 1.0.0
management:
docChecksum: 5c46d09a773b28588fedd4bb31a1647c
docVersion: v1.0.0
speakeasyVersion: 1.116.0
generationVersion: 2.185.0
speakeasyVersion: 1.118.0
generationVersion: 2.187.2
generation:
comments: {}
devContainers:
enabled: true
schemaPath: https://api-docs-nine-delta.vercel.app/cloud/openapi.json
sdkClassName: Leonardo
repoURL: https://github.com/Leonardo-Interactive/leonardo-ts-sdk.git
usageSnippets:
optionalPropertyRendering: withExample
features:
typescript:
core: 3.1.2
core: 3.1.3
devContainers: 2.88.0
flattening: 2.81.1
globalSecurity: 2.82.0
globalServerURLs: 2.82.0
typescript:
version: 2.1.1
version: 2.1.2
author: leonardoai
clientServerStatusCodesAsErrors: false
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": "@leonardo-ai/sdk",
"version": "2.1.1",
"version": "2.1.2",
"author": "leonardoai",
"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.
40 changes: 20 additions & 20 deletions src/sdk/dataset.ts
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -74,28 +74,28 @@ export class Dataset {
...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.CreateDatasetResponse = new operations.CreateDatasetResponse({
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.object = utils.objectToClass(
JSON.parse(decodedRes),
operations.CreateDatasetResponseBody
);
} else {
throw new errors.SDKError(
"unknown content-type received: " + contentType,
"unknown content-type received: " + responseContentType,
httpRes.status,
decodedRes,
httpRes
Expand Down Expand Up @@ -148,28 +148,28 @@ export class Dataset {
...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.DeleteDatasetByIdResponse = new operations.DeleteDatasetByIdResponse({
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.object = utils.objectToClass(
JSON.parse(decodedRes),
operations.DeleteDatasetByIdResponseBody
);
} else {
throw new errors.SDKError(
"unknown content-type received: " + contentType,
"unknown content-type received: " + responseContentType,
httpRes.status,
decodedRes,
httpRes
Expand Down Expand Up @@ -222,28 +222,28 @@ export class Dataset {
...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.GetDatasetByIdResponse = new operations.GetDatasetByIdResponse({
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.object = utils.objectToClass(
JSON.parse(decodedRes),
operations.GetDatasetByIdResponseBody
);
} else {
throw new errors.SDKError(
"unknown content-type received: " + contentType,
"unknown content-type received: " + responseContentType,
httpRes.status,
decodedRes,
httpRes
Expand Down Expand Up @@ -318,7 +318,7 @@ export class Dataset {
...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}`);
Expand All @@ -327,20 +327,20 @@ export class Dataset {
const res: operations.UploadDatasetImageResponse =
new operations.UploadDatasetImageResponse({
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.object = utils.objectToClass(
JSON.parse(decodedRes),
operations.UploadDatasetImageResponseBody
);
} else {
throw new errors.SDKError(
"unknown content-type received: " + contentType,
"unknown content-type received: " + responseContentType,
httpRes.status,
decodedRes,
httpRes
Expand Down Expand Up @@ -415,7 +415,7 @@ export class Dataset {
...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}`);
Expand All @@ -424,20 +424,20 @@ export class Dataset {
const res: operations.UploadDatasetImageFromGenResponse =
new operations.UploadDatasetImageFromGenResponse({
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.object = utils.objectToClass(
JSON.parse(decodedRes),
operations.UploadDatasetImageFromGenResponseBody
);
} else {
throw new errors.SDKError(
"unknown content-type received: " + contentType,
"unknown content-type received: " + responseContentType,
httpRes.status,
decodedRes,
httpRes
Expand Down
8 changes: 4 additions & 4 deletions src/sdk/element.ts
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,28 @@ export class Element {
...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.GetElementsResponse = new operations.GetElementsResponse({
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.object = utils.objectToClass(
JSON.parse(decodedRes),
operations.GetElementsResponseBody
);
} else {
throw new errors.SDKError(
"unknown content-type received: " + contentType,
"unknown content-type received: " + responseContentType,
httpRes.status,
decodedRes,
httpRes
Expand Down
Loading

0 comments on commit 0aa5feb

Please sign in to comment.