From 8c424f94169b178932d20753bcae4d09121c3f69 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Mon, 15 Jul 2024 10:56:59 +0000 Subject: [PATCH] ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.335.0 --- .speakeasy/workflow.lock | 10 +- platform/.speakeasy/gen.lock | 9 +- platform/RELEASES.md | 10 +- platform/gen.yaml | 2 +- platform/jsr.json | 2 +- platform/package-lock.json | 4 +- platform/package.json | 2 +- platform/src/lib/config.ts | 6 +- platform/src/lib/sdks.ts | 52 +++-- platform/src/sdk/companies.ts | 202 +++++++--------- platform/src/sdk/connectionmanagement.ts | 39 ++-- platform/src/sdk/connections.ts | 240 ++++++++----------- platform/src/sdk/corssettings.ts | 79 +++---- platform/src/sdk/customdatatype.ts | 188 ++++++--------- platform/src/sdk/groups.ts | 155 +++++-------- platform/src/sdk/integrations.ts | 115 ++++----- platform/src/sdk/pushdata.ts | 126 ++++------ platform/src/sdk/refreshdata.ts | 202 +++++++--------- platform/src/sdk/settings.ts | 284 +++++++++-------------- platform/src/sdk/supplementaldata.ts | 77 +++--- platform/src/sdk/webhooks.ts | 242 ++++++++----------- 21 files changed, 844 insertions(+), 1202 deletions(-) diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 6a3762872..ddd7f65f9 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,9 +1,9 @@ -speakeasyVersion: 1.331.2 +speakeasyVersion: 1.335.0 sources: platform-source: sourceNamespace: platform-source - sourceRevisionDigest: sha256:14df481219fad245cca40b9bc118b435d81cf76644db91eb6cd141e1ae052504 - sourceBlobDigest: sha256:5d647abdc8820166576203f4baf8ce52892bd5e7a527a4d2ddeeb588ec287226 + sourceRevisionDigest: sha256:1f88ea09cba05cb945981f0185460998a8c63dbd279d10d572fba8649dec3760 + sourceBlobDigest: sha256:8461db5b6c843570b6ff727124765eb954df06da28d53266341141ed64997942 tags: - latest - main @@ -11,8 +11,8 @@ targets: platform-library: source: platform-source sourceNamespace: platform-source - sourceRevisionDigest: sha256:14df481219fad245cca40b9bc118b435d81cf76644db91eb6cd141e1ae052504 - sourceBlobDigest: sha256:5d647abdc8820166576203f4baf8ce52892bd5e7a527a4d2ddeeb588ec287226 + sourceRevisionDigest: sha256:1f88ea09cba05cb945981f0185460998a8c63dbd279d10d572fba8649dec3760 + sourceBlobDigest: sha256:8461db5b6c843570b6ff727124765eb954df06da28d53266341141ed64997942 outLocation: ./platform workflow: workflowVersion: 1.0.0 diff --git a/platform/.speakeasy/gen.lock b/platform/.speakeasy/gen.lock index 6d53a9cd8..ec7266ebc 100755 --- a/platform/.speakeasy/gen.lock +++ b/platform/.speakeasy/gen.lock @@ -3,10 +3,10 @@ id: 6a970e30-8d0a-42f0-a8ce-621dfe880a1d management: docChecksum: ced98ff1180e32d5026f7d960a49babc docVersion: 3.0.0 - speakeasyVersion: 1.331.2 - generationVersion: 2.366.1 - releaseVersion: 3.0.2 - configChecksum: b24049153b9330a7ac090f5c5932bd8b + speakeasyVersion: 1.335.0 + generationVersion: 2.370.2 + releaseVersion: 3.1.0 + configChecksum: 59c10bbb42aaf2478116ff0936eb9226 repoURL: https://github.com/codatio/client-sdk-typescript.git repoSubDirectory: platform installationURL: https://gitpkg.now.sh/codatio/client-sdk-typescript/platform @@ -16,6 +16,7 @@ features: additionalDependencies: 0.1.0 constsAndDefaults: 0.1.5 core: 3.11.6 + defaultEnabledRetries: 0.1.0 deprecations: 2.81.1 examples: 2.81.4 globalSecurity: 2.82.9 diff --git a/platform/RELEASES.md b/platform/RELEASES.md index ae24d0db0..f47808a16 100644 --- a/platform/RELEASES.md +++ b/platform/RELEASES.md @@ -132,4 +132,12 @@ Based on: - OpenAPI Doc - Speakeasy CLI 1.331.2 (2.366.1) https://github.com/speakeasy-api/speakeasy ### Generated -- [typescript v3.0.2] ./platform \ No newline at end of file +- [typescript v3.0.2] ./platform + +## 2024-07-15 10:55:54 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.335.0 (2.370.2) https://github.com/speakeasy-api/speakeasy +### Generated +- [typescript v3.1.0] ./platform \ No newline at end of file diff --git a/platform/gen.yaml b/platform/gen.yaml index 72e1a75d7..10ff481c0 100644 --- a/platform/gen.yaml +++ b/platform/gen.yaml @@ -12,7 +12,7 @@ generation: auth: oAuth2ClientCredentialsEnabled: false typescript: - version: 3.0.2 + version: 3.1.0 additionalDependencies: dependencies: {} devDependencies: {} diff --git a/platform/jsr.json b/platform/jsr.json index a57d5129c..60d63efd7 100644 --- a/platform/jsr.json +++ b/platform/jsr.json @@ -2,7 +2,7 @@ { "name": "@codat/platform", - "version": "3.0.2", + "version": "3.1.0", "exports": { ".": "./src/index.ts", "./sdk/models/errors": "./src/sdk/models/errors/index.ts", diff --git a/platform/package-lock.json b/platform/package-lock.json index 4ae4ad57b..4bc5f109c 100644 --- a/platform/package-lock.json +++ b/platform/package-lock.json @@ -1,12 +1,12 @@ { "name": "@codat/platform", - "version": "3.0.2", + "version": "3.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@codat/platform", - "version": "3.0.2", + "version": "3.1.0", "devDependencies": { "@typescript-eslint/eslint-plugin": "^7.7.1", "@typescript-eslint/parser": "^7.7.1", diff --git a/platform/package.json b/platform/package.json index 31cb2af6c..f67c08869 100644 --- a/platform/package.json +++ b/platform/package.json @@ -1,6 +1,6 @@ { "name": "@codat/platform", - "version": "3.0.2", + "version": "3.1.0", "author": "Codat", "main": "./index.js", "sideEffects": false, diff --git a/platform/src/lib/config.ts b/platform/src/lib/config.ts index f7f20d4fa..c8df70544 100644 --- a/platform/src/lib/config.ts +++ b/platform/src/lib/config.ts @@ -55,7 +55,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", openapiDocVersion: "3.0.0", - sdkVersion: "3.0.2", - genVersion: "2.366.1", - userAgent: "speakeasy-sdk/typescript 3.0.2 2.366.1 3.0.0 @codat/platform", + sdkVersion: "3.1.0", + genVersion: "2.370.2", + userAgent: "speakeasy-sdk/typescript 3.1.0 2.370.2 3.0.0 @codat/platform", } as const; diff --git a/platform/src/lib/sdks.ts b/platform/src/lib/sdks.ts index de2948755..6e43e8eb6 100644 --- a/platform/src/lib/sdks.ts +++ b/platform/src/lib/sdks.ts @@ -4,6 +4,7 @@ import { ResponseMatcher, HTTPClient, matchStatusCode } from "./http.js"; import { SecurityState, resolveSecurity, resolveGlobalSecurity } from "./security.js"; +import { retry, RetryConfig } from "./retries.js"; import { pathToFunc } from "./url.js"; import { encodeForm } from "./encodings.js"; import { stringToBase64 } from "./base64.js"; @@ -17,6 +18,14 @@ export type RequestOptions = { * `fetchOptions.signal` is set then it will take precedence over this option. */ timeoutMs?: number; + /** + * Set or override a retry policy on HTTP calls. + */ + retries?: RetryConfig; + /** + * Specifies the status codes which should be retried using the given retry policy. + */ + retryCodes?: string[]; /** * Sets various request options on the `fetch` call made by an SDK method. * @@ -154,27 +163,40 @@ export class ClientSDK { } protected async do$( - req: Request, + request: Request, options: { context: HookContext; errorCodes: number | string | (number | string)[]; + retryConfig?: RetryConfig | undefined; + retryCodes?: string[] | undefined; } ): Promise { const { context, errorCodes } = options; - - let response = await this.client.request(await this.hooks$.beforeRequest(context, req)); - - if (matchStatusCode(response, errorCodes)) { - const result = await this.hooks$.afterError(context, response, null); - if (result.error) { - throw result.error; - } - response = result.response || response; - } else { - response = await this.hooks$.afterSuccess(context, response); - } - - return response; + const retryConfig = options.retryConfig || { strategy: "none" }; + const retryCodes = options.retryCodes || []; + + return retry( + async () => { + const req = request.clone(); + + let response = await this.client.request( + await this.hooks$.beforeRequest(context, req) + ); + + if (matchStatusCode(response, errorCodes)) { + const result = await this.hooks$.afterError(context, response, null); + if (result.error) { + throw result.error; + } + response = result.response || response; + } else { + response = await this.hooks$.afterSuccess(context, response); + } + + return response; + }, + { config: retryConfig, statusCodes: retryCodes } + ); } protected matcher(): ResponseMatcher { diff --git a/platform/src/sdk/companies.ts b/platform/src/sdk/companies.ts index 92beb693c..990150773 100644 --- a/platform/src/sdk/companies.ts +++ b/platform/src/sdk/companies.ts @@ -10,7 +10,6 @@ import { encodeSimple as encodeSimple$, } from "../lib/encodings.js"; import { HTTPClient } from "../lib/http.js"; -import * as retries$ from "../lib/retries.js"; import * as schemas$ from "../lib/schemas.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as errors from "./models/errors/index.js"; @@ -56,7 +55,7 @@ export class Companies extends ClientSDK { */ async list( request?: operations.ListCompaniesRequest | undefined, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = typeof request === "undefined" ? {} : request; @@ -109,39 +108,22 @@ export class Companies extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["400", "401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: [ - "400", - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -171,7 +153,7 @@ export class Companies extends ClientSDK { */ async create( request?: shared.CompanyRequestBody | undefined, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -221,28 +203,22 @@ export class Companies extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["400", "401", "402", "403", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["400", "401", "402", "403", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -271,7 +247,7 @@ export class Companies extends ClientSDK { */ async get( request: operations.GetCompanyRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -325,28 +301,22 @@ export class Companies extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -375,7 +345,7 @@ export class Companies extends ClientSDK { */ async delete( request: operations.DeleteCompanyRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -429,28 +399,22 @@ export class Companies extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -479,7 +443,7 @@ export class Companies extends ClientSDK { */ async update( request: operations.UpdateCompanyRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -534,28 +498,22 @@ export class Companies extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, diff --git a/platform/src/sdk/connectionmanagement.ts b/platform/src/sdk/connectionmanagement.ts index 8e124dee9..e78a85b42 100644 --- a/platform/src/sdk/connectionmanagement.ts +++ b/platform/src/sdk/connectionmanagement.ts @@ -6,7 +6,6 @@ import { SDKHooks } from "../hooks/hooks.js"; import { SDKOptions, serverURLFromOptions } from "../lib/config.js"; import { encodeSimple as encodeSimple$ } from "../lib/encodings.js"; import { HTTPClient } from "../lib/http.js"; -import * as retries$ from "../lib/retries.js"; import * as schemas$ from "../lib/schemas.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import { CorsSettings } from "./corssettings.js"; @@ -56,7 +55,7 @@ export class ConnectionManagement extends ClientSDK { */ async getAccessToken( request: operations.GetConnectionManagementAccessTokenRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -113,28 +112,22 @@ export class ConnectionManagement extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, diff --git a/platform/src/sdk/connections.ts b/platform/src/sdk/connections.ts index 15cbc6d19..bac88e370 100644 --- a/platform/src/sdk/connections.ts +++ b/platform/src/sdk/connections.ts @@ -10,7 +10,6 @@ import { encodeSimple as encodeSimple$, } from "../lib/encodings.js"; import { HTTPClient } from "../lib/http.js"; -import * as retries$ from "../lib/retries.js"; import * as schemas$ from "../lib/schemas.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as errors from "./models/errors/index.js"; @@ -53,7 +52,7 @@ export class Connections extends ClientSDK { */ async list( request: operations.ListConnectionsRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -112,39 +111,22 @@ export class Connections extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["400", "401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: [ - "400", - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -171,7 +153,7 @@ export class Connections extends ClientSDK { */ async create( request: operations.CreateConnectionRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -226,28 +208,22 @@ export class Connections extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -272,7 +248,7 @@ export class Connections extends ClientSDK { */ async get( request: operations.GetConnectionRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -332,28 +308,22 @@ export class Connections extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -379,7 +349,7 @@ export class Connections extends ClientSDK { */ async delete( request: operations.DeleteConnectionRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -439,28 +409,22 @@ export class Connections extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -485,7 +449,7 @@ export class Connections extends ClientSDK { */ async unlink( request: operations.UnlinkConnectionRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -546,28 +510,22 @@ export class Connections extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -592,7 +550,7 @@ export class Connections extends ClientSDK { */ async updateAuthorization( request: operations.UpdateConnectionAuthorizationRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -654,28 +612,22 @@ export class Connections extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, diff --git a/platform/src/sdk/corssettings.ts b/platform/src/sdk/corssettings.ts index 43e8496f1..84c632dc5 100644 --- a/platform/src/sdk/corssettings.ts +++ b/platform/src/sdk/corssettings.ts @@ -6,7 +6,6 @@ import { SDKHooks } from "../hooks/hooks.js"; import { SDKOptions, serverURLFromOptions } from "../lib/config.js"; import { encodeJSON as encodeJSON$ } from "../lib/encodings.js"; import { HTTPClient } from "../lib/http.js"; -import * as retries$ from "../lib/retries.js"; import * as schemas$ from "../lib/schemas.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as errors from "./models/errors/index.js"; @@ -49,9 +48,7 @@ export class CorsSettings extends ClientSDK { * * The embeddable [Connections SDK](https://docs.codat.io/auth-flow/optimize/connection-management) lets your customers control access to their data by allowing them to manage their existing connections. */ - async get( - options?: RequestOptions & { retries?: retries$.RetryConfig } - ): Promise { + async get(options?: RequestOptions): Promise { const path$ = this.templateURLComponent("/connectionManagement/corsSettings")(); const query$ = ""; @@ -88,28 +85,22 @@ export class CorsSettings extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -138,7 +129,7 @@ export class CorsSettings extends ClientSDK { */ async set( request?: shared.ConnectionManagementAllowedOrigins | undefined, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -189,28 +180,22 @@ export class CorsSettings extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, diff --git a/platform/src/sdk/customdatatype.ts b/platform/src/sdk/customdatatype.ts index c5df830dc..01b999952 100644 --- a/platform/src/sdk/customdatatype.ts +++ b/platform/src/sdk/customdatatype.ts @@ -10,7 +10,6 @@ import { encodeSimple as encodeSimple$, } from "../lib/encodings.js"; import { HTTPClient } from "../lib/http.js"; -import * as retries$ from "../lib/retries.js"; import * as schemas$ from "../lib/schemas.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as errors from "./models/errors/index.js"; @@ -62,7 +61,7 @@ export class CustomDataType extends ClientSDK { */ async configure( request: operations.ConfigureCustomDataTypeRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -124,28 +123,22 @@ export class CustomDataType extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -172,7 +165,7 @@ export class CustomDataType extends ClientSDK { */ async getConfiguration( request: operations.GetCustomDataTypeConfigurationRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -234,28 +227,22 @@ export class CustomDataType extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -280,7 +267,7 @@ export class CustomDataType extends ClientSDK { */ async refresh( request: operations.RefreshCustomDataTypeRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -345,39 +332,22 @@ export class CustomDataType extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "451", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: [ - "401", - "402", - "403", - "404", - "429", - "451", - "4XX", - "500", - "503", - "5XX", - ], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -404,7 +374,7 @@ export class CustomDataType extends ClientSDK { */ async list( request: operations.ListCustomDataTypeRecordsRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -472,40 +442,34 @@ export class CustomDataType extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: [ + "400", + "401", + "402", + "403", + "404", + "429", + "451", + "4XX", + "500", + "503", + "5XX", + ], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: [ - "400", - "401", - "402", - "403", - "404", - "429", - "451", - "4XX", - "500", - "503", - "5XX", - ], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, diff --git a/platform/src/sdk/groups.ts b/platform/src/sdk/groups.ts index 8d1a292e9..994aab1f2 100644 --- a/platform/src/sdk/groups.ts +++ b/platform/src/sdk/groups.ts @@ -6,7 +6,6 @@ import { SDKHooks } from "../hooks/hooks.js"; import { SDKOptions, serverURLFromOptions } from "../lib/config.js"; import { encodeJSON as encodeJSON$, encodeSimple as encodeSimple$ } from "../lib/encodings.js"; import { HTTPClient } from "../lib/http.js"; -import * as retries$ from "../lib/retries.js"; import * as schemas$ from "../lib/schemas.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as errors from "./models/errors/index.js"; @@ -51,7 +50,7 @@ export class Groups extends ClientSDK { */ async addCompany( request: operations.AddCompanyToGroupRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -106,28 +105,22 @@ export class Groups extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -154,7 +147,7 @@ export class Groups extends ClientSDK { */ async removeCompany( request: operations.RemoveCompanyFromGroupRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -214,28 +207,22 @@ export class Groups extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -260,9 +247,7 @@ export class Groups extends ClientSDK { * * [Groups](https://docs.codat.io/platform-api#/schemas/Group) define a set of companies that are organized based on a chosen characteristic and can be managed in the same way. */ - async list( - options?: RequestOptions & { retries?: retries$.RetryConfig } - ): Promise { + async list(options?: RequestOptions): Promise { const path$ = this.templateURLComponent("/groups")(); const query$ = ""; @@ -299,28 +284,22 @@ export class Groups extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -350,7 +329,7 @@ export class Groups extends ClientSDK { */ async create( request?: shared.GroupPrototype | undefined, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -400,28 +379,22 @@ export class Groups extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "409", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "409", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, diff --git a/platform/src/sdk/integrations.ts b/platform/src/sdk/integrations.ts index 04134a708..6d7c7783d 100644 --- a/platform/src/sdk/integrations.ts +++ b/platform/src/sdk/integrations.ts @@ -9,7 +9,6 @@ import { encodeSimple as encodeSimple$, } from "../lib/encodings.js"; import { HTTPClient } from "../lib/http.js"; -import * as retries$ from "../lib/retries.js"; import * as schemas$ from "../lib/schemas.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as errors from "./models/errors/index.js"; @@ -51,7 +50,7 @@ export class Integrations extends ClientSDK { */ async list( request?: operations.ListIntegrationsRequest | undefined, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = typeof request === "undefined" ? {} : request; @@ -104,28 +103,22 @@ export class Integrations extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["400", "401", "402", "403", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["400", "401", "402", "403", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -150,7 +143,7 @@ export class Integrations extends ClientSDK { */ async get( request: operations.GetIntegrationRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -204,28 +197,22 @@ export class Integrations extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -250,7 +237,7 @@ export class Integrations extends ClientSDK { */ async getBranding( request: operations.GetIntegrationsBrandingRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -306,28 +293,22 @@ export class Integrations extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, diff --git a/platform/src/sdk/pushdata.ts b/platform/src/sdk/pushdata.ts index 7f1f3e16f..9052802e6 100644 --- a/platform/src/sdk/pushdata.ts +++ b/platform/src/sdk/pushdata.ts @@ -9,7 +9,6 @@ import { encodeSimple as encodeSimple$, } from "../lib/encodings.js"; import { HTTPClient } from "../lib/http.js"; -import * as retries$ from "../lib/retries.js"; import * as schemas$ from "../lib/schemas.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as errors from "./models/errors/index.js"; @@ -60,7 +59,7 @@ export class PushData extends ClientSDK { */ async getModelOptions( request: operations.GetCreateUpdateModelOptionsByDataTypeRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -127,28 +126,22 @@ export class PushData extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -173,7 +166,7 @@ export class PushData extends ClientSDK { */ async listOperations( request: operations.GetCompanyPushHistoryRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -232,39 +225,22 @@ export class PushData extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["400", "401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: [ - "400", - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -289,7 +265,7 @@ export class PushData extends ClientSDK { */ async getOperation( request: operations.GetPushOperationRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -349,28 +325,22 @@ export class PushData extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, diff --git a/platform/src/sdk/refreshdata.ts b/platform/src/sdk/refreshdata.ts index e53c1d75a..9515c8ce0 100644 --- a/platform/src/sdk/refreshdata.ts +++ b/platform/src/sdk/refreshdata.ts @@ -9,7 +9,6 @@ import { encodeSimple as encodeSimple$, } from "../lib/encodings.js"; import { HTTPClient } from "../lib/http.js"; -import * as retries$ from "../lib/retries.js"; import * as schemas$ from "../lib/schemas.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as errors from "./models/errors/index.js"; @@ -56,7 +55,7 @@ export class RefreshData extends ClientSDK { */ async all( request: operations.RefreshCompanyDataRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -110,28 +109,22 @@ export class RefreshData extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -158,7 +151,7 @@ export class RefreshData extends ClientSDK { */ async byDataType( request: operations.RefreshDataTypeRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -220,28 +213,22 @@ export class RefreshData extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -266,7 +253,7 @@ export class RefreshData extends ClientSDK { */ async get( request: operations.GetCompanyDataStatusRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -320,28 +307,22 @@ export class RefreshData extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -366,7 +347,7 @@ export class RefreshData extends ClientSDK { */ async listPullOperations( request: operations.ListPullOperationsRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -425,39 +406,22 @@ export class RefreshData extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["400", "401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: [ - "400", - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -482,7 +446,7 @@ export class RefreshData extends ClientSDK { */ async getPullOperation( request: operations.GetPullOperationRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -542,28 +506,22 @@ export class RefreshData extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, diff --git a/platform/src/sdk/settings.ts b/platform/src/sdk/settings.ts index f9fcefab1..24f81610a 100644 --- a/platform/src/sdk/settings.ts +++ b/platform/src/sdk/settings.ts @@ -6,7 +6,6 @@ import { SDKHooks } from "../hooks/hooks.js"; import { SDKOptions, serverURLFromOptions } from "../lib/config.js"; import { encodeJSON as encodeJSON$, encodeSimple as encodeSimple$ } from "../lib/encodings.js"; import { HTTPClient } from "../lib/http.js"; -import * as retries$ from "../lib/retries.js"; import * as schemas$ from "../lib/schemas.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as errors from "./models/errors/index.js"; @@ -47,9 +46,7 @@ export class Settings extends ClientSDK { * @remarks * Fetch your Codat profile. */ - async getProfile( - options?: RequestOptions & { retries?: retries$.RetryConfig } - ): Promise { + async getProfile(options?: RequestOptions): Promise { const path$ = this.templateURLComponent("/profile")(); const query$ = ""; @@ -86,28 +83,22 @@ export class Settings extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -130,7 +121,7 @@ export class Settings extends ClientSDK { */ async updateProfile( request?: shared.Profile | undefined, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -180,28 +171,22 @@ export class Settings extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -222,9 +207,7 @@ export class Settings extends ClientSDK { * @remarks * Retrieve the [sync settings](https://docs.codat.io/knowledge-base/advanced-sync-settings) for your client. This includes how often data types should be queued to be updated, and how much history should be fetched. */ - async getSyncSettings( - options?: RequestOptions & { retries?: retries$.RetryConfig } - ): Promise { + async getSyncSettings(options?: RequestOptions): Promise { const path$ = this.templateURLComponent("/profile/syncSettings")(); const query$ = ""; @@ -261,28 +244,22 @@ export class Settings extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -305,7 +282,7 @@ export class Settings extends ClientSDK { */ async updateSyncSettings( request?: operations.UpdateProfileSyncSettingsRequestBody | undefined, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -358,28 +335,22 @@ export class Settings extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -404,9 +375,7 @@ export class Settings extends ClientSDK { * * You can [read more](https://docs.codat.io/using-the-api/authentication) about authentication at Codat and managing API keys via the Portal UI or API. */ - async listApiKeys( - options?: RequestOptions & { retries?: retries$.RetryConfig } - ): Promise { + async listApiKeys(options?: RequestOptions): Promise { const path$ = this.templateURLComponent("/apiKeys")(); const query$ = ""; @@ -443,28 +412,22 @@ export class Settings extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -497,7 +460,7 @@ export class Settings extends ClientSDK { */ async createApiKey( request?: shared.CreateApiKey | undefined, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -547,39 +510,22 @@ export class Settings extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["400", "401", "402", "403", "409", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: [ - "400", - "401", - "402", - "403", - "409", - "429", - "4XX", - "500", - "503", - "5XX", - ], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -613,7 +559,7 @@ export class Settings extends ClientSDK { */ async deleteApiKey( request: operations.DeleteApiKeyRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -667,28 +613,22 @@ export class Settings extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, diff --git a/platform/src/sdk/supplementaldata.ts b/platform/src/sdk/supplementaldata.ts index 41e7bc3c2..01e38b4ba 100644 --- a/platform/src/sdk/supplementaldata.ts +++ b/platform/src/sdk/supplementaldata.ts @@ -6,7 +6,6 @@ import { SDKHooks } from "../hooks/hooks.js"; import { SDKOptions, serverURLFromOptions } from "../lib/config.js"; import { encodeJSON as encodeJSON$, encodeSimple as encodeSimple$ } from "../lib/encodings.js"; import { HTTPClient } from "../lib/http.js"; -import * as retries$ from "../lib/retries.js"; import * as schemas$ from "../lib/schemas.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as errors from "./models/errors/index.js"; @@ -54,7 +53,7 @@ export class SupplementalData extends ClientSDK { */ async configure( request: operations.ConfigureSupplementalDataRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -117,28 +116,22 @@ export class SupplementalData extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -165,7 +158,7 @@ export class SupplementalData extends ClientSDK { */ async getConfiguration( request: operations.GetSupplementalDataConfigurationRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -226,28 +219,22 @@ export class SupplementalData extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, diff --git a/platform/src/sdk/webhooks.ts b/platform/src/sdk/webhooks.ts index 473978cc1..2f6c94700 100644 --- a/platform/src/sdk/webhooks.ts +++ b/platform/src/sdk/webhooks.ts @@ -10,7 +10,6 @@ import { encodeSimple as encodeSimple$, } from "../lib/encodings.js"; import { HTTPClient } from "../lib/http.js"; -import * as retries$ from "../lib/retries.js"; import * as schemas$ from "../lib/schemas.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as errors from "./models/errors/index.js"; @@ -55,7 +54,7 @@ export class Webhooks extends ClientSDK { */ async list( request?: operations.ListRulesRequest | undefined, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = typeof request === "undefined" ? {} : request; @@ -108,39 +107,22 @@ export class Webhooks extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["400", "401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: [ - "400", - "401", - "402", - "403", - "404", - "429", - "4XX", - "500", - "503", - "5XX", - ], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -167,7 +149,7 @@ export class Webhooks extends ClientSDK { */ async create( request?: shared.CreateRule | undefined, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -217,28 +199,22 @@ export class Webhooks extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -263,7 +239,7 @@ export class Webhooks extends ClientSDK { */ async get( request: operations.GetWebhookRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -317,28 +293,22 @@ export class Webhooks extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -363,9 +333,7 @@ export class Webhooks extends ClientSDK { * * [Webhook consumer](https://docs.codat.io/platform-api#/schemas/WebhookConsumer) is an HTTP endpoint that you configure to subscribe to specific events. See our documentation for more details on [Codat's webhook service](https://docs.codat.io/using-the-api/webhooks/overview). */ - async listConsumers( - options?: RequestOptions & { retries?: retries$.RetryConfig } - ): Promise { + async listConsumers(options?: RequestOptions): Promise { const path$ = this.templateURLComponent("/webhooks")(); const query$ = ""; @@ -402,28 +370,22 @@ export class Webhooks extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["400", "401", "402", "403", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["400", "401", "402", "403", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -453,7 +415,7 @@ export class Webhooks extends ClientSDK { */ async createConsumer( request?: shared.WebhookConsumerPrototype | undefined, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -503,28 +465,22 @@ export class Webhooks extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["400", "401", "402", "403", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["400", "401", "402", "403", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ }, @@ -551,7 +507,7 @@ export class Webhooks extends ClientSDK { */ async deleteConsumer( request: operations.DeleteWebhookConsumerRequest, - options?: RequestOptions & { retries?: retries$.RetryConfig } + options?: RequestOptions ): Promise { const input$ = request; @@ -605,28 +561,22 @@ export class Webhooks extends ClientSDK { options ); - const retryConfig = options?.retries || - this.options$.retryConfig || { - strategy: "backoff", - backoff: { - initialInterval: 500, - maxInterval: 60000, - exponent: 1.5, - maxElapsedTime: 3600000, + const response = await this.do$(request$, { + context, + errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], + retryConfig: options?.retries || + this.options$.retryConfig || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, }, - retryConnectionErrors: true, - }; - - const response = await retries$.retry( - () => { - const cloned = request$.clone(); - return this.do$(cloned, { - context, - errorCodes: ["401", "402", "403", "404", "429", "4XX", "500", "503", "5XX"], - }); - }, - { config: retryConfig, statusCodes: ["408", "429", "5XX"] } - ); + retryCodes: options?.retryCodes || ["408", "429", "5XX"], + }); const responseFields$ = { HttpMeta: { Response: response, Request: request$ },