From c8c6500182176ce3706350b3d10ea47dd0c75f5d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 22 Apr 2026 13:53:54 +0000 Subject: [PATCH 01/13] chore(internal): more robust bootstrap script --- scripts/bootstrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/bootstrap b/scripts/bootstrap index 2bb3c94..3a8293a 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -4,7 +4,7 @@ set -e cd "$(dirname "$0")/.." -if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then +if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "${SKIP_BREW:-}" != "1" ] && [ -t 0 ]; then brew bundle check >/dev/null 2>&1 || { echo -n "==> Install Homebrew dependencies? (y/N): " read -r response From 0e9df3511c18468aa53b59d868a24f7d541a09d1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 24 Apr 2026 15:52:18 +0000 Subject: [PATCH 02/13] chore(formatter): run prettier and eslint separately --- eslint.config.mjs | 3 - package.json | 1 - pnpm-lock.yaml | 51 -- scripts/fast-format | 6 +- scripts/format | 3 +- scripts/lint | 3 + src/api-promise.ts | 2 +- src/client.ts | 255 ++----- src/core/api-promise.ts | 9 +- src/core/error.ts | 46 +- src/core/pagination.ts | 24 +- src/error.ts | 2 +- src/index.ts | 16 +- src/internal/builtin-types.ts | 23 +- src/internal/detect-platform.ts | 6 +- src/internal/errors.ts | 14 +- src/internal/headers.ts | 4 +- src/internal/parse.ts | 12 +- src/internal/qs/utils.ts | 5 +- src/internal/request-options.ts | 6 +- src/internal/shim-types.ts | 4 +- src/internal/shims.ts | 4 +- src/internal/to-file.ts | 14 +- src/internal/types.ts | 50 +- src/internal/utils/log.ts | 38 +- src/internal/utils/query.ts | 2 +- src/internal/utils/uuid.ts | 8 +- src/pagination.ts | 2 +- src/resource.ts | 2 +- src/resources/address-verification.ts | 31 +- src/resources/index.ts | 20 +- src/resources/intl-address-verification.ts | 19 +- src/resources/print-mail/bank-accounts.ts | 21 +- src/resources/print-mail/campaigns.ts | 29 +- src/resources/print-mail/cheques.ts | 67 +- src/resources/print-mail/contacts.ts | 17 +- src/resources/print-mail/index.ts | 134 +--- src/resources/print-mail/letters.ts | 102 +-- .../print-mail/mailing-list-imports.ts | 45 +- src/resources/print-mail/mailing-lists.ts | 31 +- .../print-mail/order-profiles/cheques.ts | 150 +--- .../print-mail/order-profiles/index.ts | 50 +- .../print-mail/order-profiles/letters.ts | 120 +--- .../order-profiles/order-profiles.ts | 56 +- .../print-mail/order-profiles/postcards.ts | 122 +--- .../print-mail/order-profiles/self-mailers.ts | 129 +--- src/resources/print-mail/postcards.ts | 127 +--- src/resources/print-mail/print-mail.ts | 168 +---- src/resources/print-mail/reports/exports.ts | 18 +- src/resources/print-mail/reports/index.ts | 21 +- src/resources/print-mail/reports/reports.ts | 21 +- src/resources/print-mail/reports/samples.ts | 2 +- src/resources/print-mail/self-mailers.ts | 132 +--- src/resources/print-mail/sub-organizations.ts | 28 +- src/resources/print-mail/templates.ts | 9 +- src/uploads.ts | 2 +- src/version.ts | 2 +- .../address-verification.test.ts | 12 +- .../intl-address-verification.test.ts | 44 +- .../print-mail/bank-accounts.test.ts | 55 +- .../print-mail/campaigns.test.ts | 41 +- .../api-resources/print-mail/cheques.test.ts | 101 ++- .../api-resources/print-mail/contacts.test.ts | 61 +- .../api-resources/print-mail/letters.test.ts | 175 +++-- .../print-mail/mailing-list-imports.test.ts | 87 ++- .../print-mail/mailing-lists.test.ts | 19 +- .../print-mail/order-profiles/cheques.test.ts | 95 ++- .../print-mail/order-profiles/letters.test.ts | 61 +- .../order-profiles/postcards.test.ts | 49 +- .../order-profiles/self-mailers.test.ts | 73 +- .../print-mail/postcards.test.ts | 127 ++-- .../print-mail/reports/exports.test.ts | 2 +- .../print-mail/reports/reports.test.ts | 39 +- .../print-mail/reports/samples.test.ts | 2 +- .../print-mail/self-mailers.test.ts | 137 ++-- .../print-mail/sub-organizations.test.ts | 63 +- .../print-mail/templates.test.ts | 19 +- tests/index.test.ts | 658 ++++++++---------- tests/qs/utils.test.ts | 2 +- tests/stringifyQuery.test.ts | 32 +- 80 files changed, 1327 insertions(+), 2915 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 47bba68..a8cadf1 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,7 +1,6 @@ // @ts-check import tseslint from 'typescript-eslint'; import unusedImports from 'eslint-plugin-unused-imports'; -import prettier from 'eslint-plugin-prettier'; export default tseslint.config( { @@ -14,11 +13,9 @@ export default tseslint.config( plugins: { '@typescript-eslint': tseslint.plugin, 'unused-imports': unusedImports, - prettier, }, rules: { 'no-unused-vars': 'off', - 'prettier/prettier': 'error', 'unused-imports/no-unused-imports': 'error', 'no-restricted-imports': [ 'error', diff --git a/package.json b/package.json index 4a2d3e2..5e88922 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,6 @@ "@typescript-eslint/eslint-plugin": "8.31.1", "@typescript-eslint/parser": "8.31.1", "eslint": "^9.39.1", - "eslint-plugin-prettier": "^5.4.1", "eslint-plugin-unused-imports": "^4.1.4", "iconv-lite": "^0.6.3", "jest": "^29.4.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c2b6b50..2fbf116 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -35,9 +35,6 @@ importers: eslint: specifier: ^9.39.1 version: 9.39.1 - eslint-plugin-prettier: - specifier: ^5.4.1 - version: 5.4.1(eslint@9.39.1)(prettier@3.1.1) eslint-plugin-unused-imports: specifier: ^4.1.4 version: 4.1.4(@typescript-eslint/eslint-plugin@8.31.1(@typescript-eslint/parser@8.31.1(eslint@9.39.1)(typescript@5.8.3))(eslint@9.39.1)(typescript@5.8.3))(eslint@9.39.1) @@ -442,10 +439,6 @@ packages: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} - '@pkgr/core@0.2.4': - resolution: {integrity: sha512-ROFF39F6ZrnzSUEmQQZUar0Jt4xVoP9WnDRdWwF4NNcXs3xBTLgBUDoOwW141y1jP+S8nahIbdxbFC7IShw9Iw==} - engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} - '@sinclair/typebox@0.27.8': resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} @@ -936,20 +929,6 @@ packages: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} - eslint-plugin-prettier@5.4.1: - resolution: {integrity: sha512-9dF+KuU/Ilkq27A8idRP7N2DH8iUR6qXcjF3FR2wETY21PZdBrIjwCau8oboyGj9b7etWmTGEeM8e7oOed6ZWg==} - engines: {node: ^14.18.0 || >=16.0.0} - peerDependencies: - '@types/eslint': '>=8.0.0' - eslint: '>=8.0.0' - eslint-config-prettier: '>= 7.0.0 <10.0.0 || >=10.1.0' - prettier: '>=3.0.0' - peerDependenciesMeta: - '@types/eslint': - optional: true - eslint-config-prettier: - optional: true - eslint-plugin-unused-imports@4.1.4: resolution: {integrity: sha512-YptD6IzQjDardkl0POxnnRBhU1OEePMV0nd6siHaRBbd+lyh6NAhFEobiznKU7kTsSsDeSD62Pe7kAM1b7dAZQ==} peerDependencies: @@ -1025,9 +1004,6 @@ packages: fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} - fast-diff@1.3.0: - resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==} - fast-glob@3.3.2: resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} engines: {node: '>=8.6.0'} @@ -1631,10 +1607,6 @@ packages: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} - prettier-linter-helpers@1.0.0: - resolution: {integrity: sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==} - engines: {node: '>=6.0.0'} - prettier@3.1.1: resolution: {integrity: sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==} engines: {node: '>=14'} @@ -1815,10 +1787,6 @@ packages: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} - synckit@0.11.8: - resolution: {integrity: sha512-+XZ+r1XGIJGeQk3VvXhT6xx/VpbHsRzsTkGgF6E5RX9TTXD0118l87puaEBZ566FhqblC6U0d4XnubznJDm30A==} - engines: {node: ^14.18.0 || >=16.0.0} - test-exclude@6.0.0: resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==} engines: {node: '>=8'} @@ -2524,8 +2492,6 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.17.1 - '@pkgr/core@0.2.4': {} - '@sinclair/typebox@0.27.8': {} '@sindresorhus/is@4.6.0': {} @@ -3007,13 +2973,6 @@ snapshots: escape-string-regexp@4.0.0: {} - eslint-plugin-prettier@5.4.1(eslint@9.39.1)(prettier@3.1.1): - dependencies: - eslint: 9.39.1 - prettier: 3.1.1 - prettier-linter-helpers: 1.0.0 - synckit: 0.11.8 - eslint-plugin-unused-imports@4.1.4(@typescript-eslint/eslint-plugin@8.31.1(@typescript-eslint/parser@8.31.1(eslint@9.39.1)(typescript@5.8.3))(eslint@9.39.1)(typescript@5.8.3))(eslint@9.39.1): dependencies: eslint: 9.39.1 @@ -3114,8 +3073,6 @@ snapshots: fast-deep-equal@3.1.3: {} - fast-diff@1.3.0: {} - fast-glob@3.3.2: dependencies: '@nodelib/fs.stat': 2.0.5 @@ -3861,10 +3818,6 @@ snapshots: prelude-ls@1.2.1: {} - prettier-linter-helpers@1.0.0: - dependencies: - fast-diff: 1.3.0 - prettier@3.1.1: {} pretty-format@29.7.0: @@ -4013,10 +3966,6 @@ snapshots: supports-preserve-symlinks-flag@1.0.0: {} - synckit@0.11.8: - dependencies: - '@pkgr/core': 0.2.4 - test-exclude@6.0.0: dependencies: '@istanbuljs/schema': 0.1.3 diff --git a/scripts/fast-format b/scripts/fast-format index 53721ac..e172313 100755 --- a/scripts/fast-format +++ b/scripts/fast-format @@ -31,10 +31,8 @@ if ! [ -z "$ESLINT_FILES" ]; then fi echo "==> Running prettier --write" -# format things eslint didn't -PRETTIER_FILES="$(grep '\.\(js\|json\)$' "$FILE_LIST" || true)" +PRETTIER_FILES="$(grep '\.\([mc]?tsx?\|[mc]?jsx?\|json\)$' "$FILE_LIST" || true)" if ! [ -z "$PRETTIER_FILES" ]; then echo "$PRETTIER_FILES" | xargs ./node_modules/.bin/prettier \ - --write --cache --cache-strategy metadata --no-error-on-unmatched-pattern \ - '!**/dist' '!**/*.ts' '!**/*.mts' '!**/*.cts' '!**/*.js' '!**/*.mjs' '!**/*.cjs' + --write --cache --cache-strategy metadata --no-error-on-unmatched-pattern fi diff --git a/scripts/format b/scripts/format index 7a75640..b1b2c17 100755 --- a/scripts/format +++ b/scripts/format @@ -8,5 +8,4 @@ echo "==> Running eslint --fix" ./node_modules/.bin/eslint --fix . echo "==> Running prettier --write" -# format things eslint didn't -./node_modules/.bin/prettier --write --cache --cache-strategy metadata . '!**/dist' '!**/*.ts' '!**/*.mts' '!**/*.cts' '!**/*.js' '!**/*.mjs' '!**/*.cjs' +./node_modules/.bin/prettier --write --cache --cache-strategy metadata . diff --git a/scripts/lint b/scripts/lint index 3ffb78a..1f53254 100755 --- a/scripts/lint +++ b/scripts/lint @@ -4,6 +4,9 @@ set -e cd "$(dirname "$0")/.." +echo "==> Running prettier --check" +./node_modules/.bin/prettier --check . + echo "==> Running eslint" ./node_modules/.bin/eslint . diff --git a/src/api-promise.ts b/src/api-promise.ts index 8c775ee..4e70128 100644 --- a/src/api-promise.ts +++ b/src/api-promise.ts @@ -1,2 +1,2 @@ /** @deprecated Import from ./core/api-promise instead */ -export * from './core/api-promise'; +export * from "./core/api-promise" \ No newline at end of file diff --git a/src/client.ts b/src/client.ts index becfa4d..9d89ff7 100644 --- a/src/client.ts +++ b/src/client.ts @@ -19,34 +19,14 @@ import { AbstractPage, type SkipLimitParams, SkipLimitResponse } from './core/pa import * as Uploads from './core/uploads'; import * as API from './resources/index'; import { APIPromise } from './core/api-promise'; -import { - AddressVerification, - AddressVerificationVerifyParams, - AddressVerificationVerifyResponse, - Errors as AddressVerificationAPIErrors, - Status, -} from './resources/address-verification'; -import { - IntlAddressVerification, - IntlAddressVerificationVerifyParams, - IntlAddressVerificationVerifyResponse, -} from './resources/intl-address-verification'; -import { - ContactCreateWithCompanyName, - ContactCreateWithFirstName, - PrintMail, -} from './resources/print-mail/print-mail'; +import { AddressVerification, AddressVerificationVerifyParams, AddressVerificationVerifyResponse, Errors as AddressVerificationAPIErrors, Status } from './resources/address-verification'; +import { IntlAddressVerification, IntlAddressVerificationVerifyParams, IntlAddressVerificationVerifyResponse } from './resources/intl-address-verification'; +import { ContactCreateWithCompanyName, ContactCreateWithFirstName, PrintMail } from './resources/print-mail/print-mail'; import { type Fetch } from './internal/builtin-types'; import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers'; import { FinalRequestOptions, RequestOptions } from './internal/request-options'; import { readEnv } from './internal/utils/env'; -import { - type LogLevel, - type Logger, - formatRequestDetails, - loggerFor, - parseLogLevel, -} from './internal/utils/log'; +import { type LogLevel, type Logger, formatRequestDetails, loggerFor, parseLogLevel } from './internal/utils/log'; import { isEmptyObj } from './internal/utils/values'; export interface ClientOptions { @@ -130,7 +110,7 @@ export interface ClientOptions { } /** - * API Client for interfacing with the PostGrid API. + * API Client for interfacing with the PostGrid API. */ export class PostGrid { addressVerificationAPIKey: string | null; @@ -167,6 +147,7 @@ export class PostGrid { printMailAPIKey = readEnv('POSTGRID_PRINT_MAIL_API_KEY') ?? null, ...opts }: ClientOptions = {}) { + const options: ClientOptions = { addressVerificationAPIKey, printMailAPIKey, @@ -180,10 +161,7 @@ export class PostGrid { const defaultLogLevel = 'warn'; // Set default logLevel early so that we can log a warning in parseLogLevel. this.logLevel = defaultLogLevel; - this.logLevel = - parseLogLevel(options.logLevel, 'ClientOptions.logLevel', this) ?? - parseLogLevel(readEnv('POSTGRID_LOG'), "process.env['POSTGRID_LOG']", this) ?? - defaultLogLevel; + this.logLevel = parseLogLevel(options.logLevel, 'ClientOptions.logLevel', this) ?? parseLogLevel(readEnv('POSTGRID_LOG'), 'process.env[\'POSTGRID_LOG\']', this) ?? defaultLogLevel; this.fetchOptions = options.fetchOptions; this.maxRetries = options.maxRetries ?? 2; this.fetch = options.fetch ?? Shims.getDefaultFetch(); @@ -210,7 +188,7 @@ export class PostGrid { fetchOptions: this.fetchOptions, addressVerificationAPIKey: this.addressVerificationAPIKey, printMailAPIKey: this.printMailAPIKey, - ...options, + ...options }); return client; } @@ -223,7 +201,7 @@ export class PostGrid { } protected defaultQuery(): Record | undefined { - return this._options.defaultQuery; + return this._options.defaultQuery } protected validateHeaders({ values, nulls }: NullableHeaders) { @@ -241,21 +219,14 @@ export class PostGrid { return; } - throw new Error( - 'Could not resolve authentication method. Expected either addressVerificationAPIKey or printMailAPIKey to be set. Or for one of the "X-API-Key" or "X-API-Key" headers to be explicitly omitted', - ); + throw new Error('Could not resolve authentication method. Expected either addressVerificationAPIKey or printMailAPIKey to be set. Or for one of the "X-API-Key" or "X-API-Key" headers to be explicitly omitted') } protected async authHeaders(opts: FinalRequestOptions): Promise { - return buildHeaders([ - await this.addressVerificationAPIKeyAuth(opts), - await this.printMailAPIKeyAuth(opts), - ]); + return buildHeaders([await this.addressVerificationAPIKeyAuth(opts), await this.printMailAPIKeyAuth(opts)]); } - protected async addressVerificationAPIKeyAuth( - opts: FinalRequestOptions, - ): Promise { + protected async addressVerificationAPIKeyAuth(opts: FinalRequestOptions): Promise { if (this.addressVerificationAPIKey == null) { return undefined; } @@ -290,11 +261,7 @@ export class PostGrid { return Errors.APIError.generate(status, error, message, headers); } - buildURL( - path: string, - query: Record | null | undefined, - defaultBaseURL?: string | undefined, - ): string { + buildURL(path: string, query: Record | null | undefined, defaultBaseURL?: string | undefined): string { const baseURL = (!this.#baseURLOverridden() && defaultBaseURL) || this.baseURL; const url = isAbsoluteURL(path) ? @@ -394,9 +361,7 @@ export class PostGrid { await this.prepareOptions(options); - const { req, url, timeout } = await this.buildRequest(options, { - retryCount: maxRetries - retriesRemaining, - }); + const { req, url, timeout } = await this.buildRequest(options, { retryCount: maxRetries - retriesRemaining }); await this.prepareRequest(req, { url, options }); @@ -405,16 +370,7 @@ export class PostGrid { const retryLogStr = retryOfRequestLogID === undefined ? '' : `, retryOf: ${retryOfRequestLogID}`; const startTime = Date.now(); - loggerFor(this).debug( - `[${requestLogID}] sending request`, - formatRequestDetails({ - retryOfRequestLogID, - method: options.method, - url, - options, - headers: req.headers, - }), - ); + loggerFor(this).debug(`[${requestLogID}] sending request`, formatRequestDetails({ retryOfRequestLogID, method: options.method, url, options, headers: req.headers })); if (options.signal?.aborted) { throw new Errors.APIUserAbortError(); @@ -433,45 +389,21 @@ export class PostGrid { // deno throws "TypeError: error sending request for url (https://example/): client error (Connect): tcp connect error: Operation timed out (os error 60): Operation timed out (os error 60)" // undici throws "TypeError: fetch failed" with cause "ConnectTimeoutError: Connect Timeout Error (attempted address: example:443, timeout: 1ms)" // others do not provide enough information to distinguish timeouts from other connection errors - const isTimeout = - isAbortError(response) || - /timed? ?out/i.test(String(response) + ('cause' in response ? String(response.cause) : '')); + const isTimeout = isAbortError(response) || /timed? ?out/i.test(String(response) + ('cause' in response ? String(response.cause) : '')) if (retriesRemaining) { - loggerFor(this).info( - `[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - ${retryMessage}`, - ); - loggerFor(this).debug( - `[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (${retryMessage})`, - formatRequestDetails({ - retryOfRequestLogID, - url, - durationMs: headersTime - startTime, - message: response.message, - }), - ); + loggerFor(this).info(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - ${retryMessage}`) + loggerFor(this).debug(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (${retryMessage})`, formatRequestDetails({ retryOfRequestLogID, url, durationMs: headersTime - startTime, message: response.message })); return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID); } - loggerFor(this).info( - `[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - error; no more retries left`, - ); - loggerFor(this).debug( - `[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (error; no more retries left)`, - formatRequestDetails({ - retryOfRequestLogID, - url, - durationMs: headersTime - startTime, - message: response.message, - }), - ); + loggerFor(this).info(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - error; no more retries left`) + loggerFor(this).debug(`[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (error; no more retries left)`, formatRequestDetails({ retryOfRequestLogID, url, durationMs: headersTime - startTime, message: response.message })); if (isTimeout) { throw new Errors.APIConnectionTimeoutError(); } throw new Errors.APIConnectionError({ cause: response }); } - const responseInfo = `[${requestLogID}${retryLogStr}] ${req.method} ${url} ${ - response.ok ? 'succeeded' : 'failed' - } with status ${response.status} in ${headersTime - startTime}ms`; + const responseInfo = `[${requestLogID}${retryLogStr}] ${req.method} ${url} ${response.ok ? 'succeeded' : 'failed'} with status ${response.status} in ${headersTime - startTime}ms`; if (!response.ok) { const shouldRetry = await this.shouldRetry(response); @@ -480,60 +412,27 @@ export class PostGrid { // We don't need the body of this response. await Shims.CancelReadableStream(response.body); - loggerFor(this).info(`${responseInfo} - ${retryMessage}`); - loggerFor(this).debug( - `[${requestLogID}] response error (${retryMessage})`, - formatRequestDetails({ - retryOfRequestLogID, - url: response.url, - status: response.status, - headers: response.headers, - durationMs: headersTime - startTime, - }), - ); - return this.retryRequest( - options, - retriesRemaining, - retryOfRequestLogID ?? requestLogID, - response.headers, - ); + loggerFor(this).info(`${responseInfo} - ${retryMessage}`) + loggerFor(this).debug(`[${requestLogID}] response error (${retryMessage})`, formatRequestDetails({ retryOfRequestLogID, url: response.url, status: response.status, headers: response.headers, durationMs: headersTime - startTime })); + return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID, response.headers); } const retryMessage = shouldRetry ? `error; no more retries left` : `error; not retryable`; - loggerFor(this).info(`${responseInfo} - ${retryMessage}`); + loggerFor(this).info(`${responseInfo} - ${retryMessage}`) const errText = await response.text().catch((err: any) => castToError(err).message); const errJSON = safeJSON(errText) as any; const errMessage = errJSON ? undefined : errText; - loggerFor(this).debug( - `[${requestLogID}] response error (${retryMessage})`, - formatRequestDetails({ - retryOfRequestLogID, - url: response.url, - status: response.status, - headers: response.headers, - message: errMessage, - durationMs: Date.now() - startTime, - }), - ); + loggerFor(this).debug(`[${requestLogID}] response error (${retryMessage})`, formatRequestDetails({ retryOfRequestLogID, url: response.url, status: response.status, headers: response.headers, message: errMessage, durationMs: Date.now() - startTime })); const err = this.makeStatusError(response.status, errJSON, errMessage, response.headers); throw err; } - loggerFor(this).info(responseInfo); - loggerFor(this).debug( - `[${requestLogID}] response start`, - formatRequestDetails({ - retryOfRequestLogID, - url: response.url, - status: response.status, - headers: response.headers, - durationMs: headersTime - startTime, - }), - ); + loggerFor(this).info(responseInfo) + loggerFor(this).debug(`[${requestLogID}] response start`, formatRequestDetails({ retryOfRequestLogID, url: response.url, status: response.status, headers: response.headers, durationMs: headersTime - startTime })); return { response, options, controller, requestLogID, retryOfRequestLogID, startTime }; } @@ -551,10 +450,7 @@ export class PostGrid { ); } - requestAPIList< - Item = unknown, - PageClass extends Pagination.AbstractPage = Pagination.AbstractPage, - >( + requestAPIList = Pagination.AbstractPage>( Page: new (...args: ConstructorParameters) => PageClass, options: PromiseOrValue, ): Pagination.PagePromise { @@ -574,9 +470,7 @@ export class PostGrid { const timeout = setTimeout(abort, ms); - const isReadableBody = - ((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) || - (typeof options.body === 'object' && options.body !== null && Symbol.asyncIterator in options.body); + const isReadableBody = ((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) || (typeof options.body === "object" && options.body !== null && Symbol.asyncIterator in options.body); const fetchOptions: RequestInit = { signal: controller.signal as any, @@ -591,6 +485,7 @@ export class PostGrid { } try { + // use undefined this binding; fetch errors if bound to something else in browser/cloudflare return await this.fetch.call(undefined, url, fetchOptions); } finally { @@ -691,12 +586,11 @@ export class PostGrid { const req: FinalizedRequestInit = { method, headers: reqHeaders, - ...(options.signal && { signal: options.signal }), - ...((globalThis as any).ReadableStream && - body instanceof (globalThis as any).ReadableStream && { duplex: 'half' }), + ...(options.signal && { signal: options.signal}), + ...((globalThis as any).ReadableStream && body instanceof (globalThis as any).ReadableStream && { duplex: "half" }), ...(body && { body }), - ...((this.fetchOptions as any) ?? {}), - ...((options.fetchOptions as any) ?? {}), + ...(this.fetchOptions as any ?? {}), + ...(options.fetchOptions as any ?? {}), }; return { req, url, timeout: options.timeout }; @@ -721,17 +615,15 @@ export class PostGrid { const headers = buildHeaders([ idempotencyHeaders, - { - Accept: 'application/json', - 'User-Agent': this.getUserAgent(), - 'X-Stainless-Retry-Count': String(retryCount), - ...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}), - ...getPlatformHeaders(), - }, + {Accept: 'application/json', + 'User-Agent': this.getUserAgent(), + 'X-Stainless-Retry-Count': String(retryCount), + ...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}), + ...getPlatformHeaders()}, await this.authHeaders(options), this._options.defaultHeaders, bodyHeaders, - options.headers, + options.headers ]); this.validateHeaders(headers); @@ -758,9 +650,11 @@ export class PostGrid { ArrayBuffer.isView(body) || body instanceof ArrayBuffer || body instanceof DataView || - (typeof body === 'string' && + ( + typeof body === 'string' && // Preserve legacy string encoding behavior for now - headers.values.has('content-type')) || + headers.values.has('content-type') + ) || // `Blob` is superset of `File` ((globalThis as any).Blob && body instanceof (globalThis as any).Blob) || // `FormData` -> `multipart/form-data` @@ -791,7 +685,7 @@ export class PostGrid { } static PostGrid = this; - static DEFAULT_TIMEOUT = 60000; // 1 minute + static DEFAULT_TIMEOUT = 60000 // 1 minute static PostGridError = Errors.PostGridError; static APIError = Errors.APIError; @@ -816,7 +710,7 @@ export class PostGrid { * supporting both structured and freeform inputs. * * Note that this uses a different set of lookups than our international API. - * + * */ addressVerification: API.AddressVerification = new API.AddressVerification(this); /** @@ -824,7 +718,7 @@ export class PostGrid { * * Provides endpoints to verify and standardize international addresses, * supporting both structured and freeform inputs. - * + * */ intlAddressVerification: API.IntlAddressVerification = new API.IntlAddressVerification(this); printMail: API.PrintMail = new API.PrintMail(this); @@ -835,28 +729,31 @@ PostGrid.IntlAddressVerification = IntlAddressVerification; PostGrid.PrintMail = PrintMail; export declare namespace PostGrid { - export type RequestOptions = Opts.RequestOptions; - - export import SkipLimit = Pagination.SkipLimit; - export { type SkipLimitParams as SkipLimitParams, type SkipLimitResponse as SkipLimitResponse }; - - export { - AddressVerification as AddressVerification, - type AddressVerificationAPIErrors as Errors, - type Status as Status, - type AddressVerificationVerifyResponse as AddressVerificationVerifyResponse, - type AddressVerificationVerifyParams as AddressVerificationVerifyParams, - }; - - export { - IntlAddressVerification as IntlAddressVerification, - type IntlAddressVerificationVerifyResponse as IntlAddressVerificationVerifyResponse, - type IntlAddressVerificationVerifyParams as IntlAddressVerificationVerifyParams, - }; - - export { - PrintMail as PrintMail, - type ContactCreateWithCompanyName as ContactCreateWithCompanyName, - type ContactCreateWithFirstName as ContactCreateWithFirstName, - }; -} + export type RequestOptions = Opts.RequestOptions; + + export import SkipLimit = Pagination.SkipLimit; +export { + type SkipLimitParams as SkipLimitParams, + type SkipLimitResponse as SkipLimitResponse +}; + +export { + AddressVerification as AddressVerification, + type AddressVerificationAPIErrors as Errors, + type Status as Status, + type AddressVerificationVerifyResponse as AddressVerificationVerifyResponse, + type AddressVerificationVerifyParams as AddressVerificationVerifyParams +}; + +export { + IntlAddressVerification as IntlAddressVerification, + type IntlAddressVerificationVerifyResponse as IntlAddressVerificationVerifyResponse, + type IntlAddressVerificationVerifyParams as IntlAddressVerificationVerifyParams +}; + +export { + PrintMail as PrintMail, + type ContactCreateWithCompanyName as ContactCreateWithCompanyName, + type ContactCreateWithFirstName as ContactCreateWithFirstName +}; + } diff --git a/src/core/api-promise.ts b/src/core/api-promise.ts index 84e7a4b..ae87efc 100644 --- a/src/core/api-promise.ts +++ b/src/core/api-promise.ts @@ -16,10 +16,7 @@ export class APIPromise extends Promise { constructor( client: PostGrid, private responsePromise: Promise, - private parseResponse: ( - client: PostGrid, - props: APIResponseProps, - ) => PromiseOrValue = defaultParseResponse, + private parseResponse: (client: PostGrid, props: APIResponseProps) => PromiseOrValue = defaultParseResponse, ) { super((resolve) => { // this is maybe a bit weird but this has to be a no-op to not implicitly @@ -31,9 +28,7 @@ export class APIPromise extends Promise { } _thenUnwrap(transform: (data: T, props: APIResponseProps) => U): APIPromise { - return new APIPromise(this.#client, this.responsePromise, async (client, props) => - transform(await this.parseResponse(client, props), props), - ); + return new APIPromise(this.#client, this.responsePromise, async (client, props) => transform(await this.parseResponse(client, props), props)); } /** diff --git a/src/core/error.ts b/src/core/error.ts index b564484..0b81ffd 100644 --- a/src/core/error.ts +++ b/src/core/error.ts @@ -2,13 +2,10 @@ import { castToError } from '../internal/errors'; -export class PostGridError extends Error {} +export class PostGridError extends Error { +} -export class APIError< - TStatus extends number | undefined = number | undefined, - THeaders extends Headers | undefined = Headers | undefined, - TError extends Object | undefined = Object | undefined, -> extends PostGridError { +export class APIError extends PostGridError { /** HTTP status for the response that caused the error */ readonly status: TStatus; /** HTTP headers for the response that caused the error */ @@ -16,6 +13,9 @@ export class APIError< /** JSON body of the response that caused the error */ readonly error: TError; + + ; + constructor(status: TStatus, error: TError, message: string | undefined, headers: THeaders) { super(`${APIError.makeMessage(status, error, message)}`); this.status = status; @@ -26,8 +26,7 @@ export class APIError< private static makeMessage(status: number | undefined, error: any, message: string | undefined) { const msg = error?.message ? - typeof error.message === 'string' ? - error.message + typeof error.message === 'string' ? error.message : JSON.stringify(error.message) : error ? JSON.stringify(error) : message; @@ -44,12 +43,7 @@ export class APIError< return '(no status code or body)'; } - static generate( - status: number | undefined, - errorResponse: Object | undefined, - message: string | undefined, - headers: Headers | undefined, - ): APIError { + static generate(status: number | undefined, errorResponse: Object | undefined, message: string | undefined, headers: Headers | undefined): APIError { if (!status || !headers) { return new APIConnectionError({ message, cause: castToError(errorResponse) }); } @@ -113,18 +107,26 @@ export class APIConnectionTimeoutError extends APIConnectionError { } } -export class BadRequestError extends APIError<400, Headers> {} +export class BadRequestError extends APIError<400, Headers> { +} -export class AuthenticationError extends APIError<401, Headers> {} +export class AuthenticationError extends APIError<401, Headers> { +} -export class PermissionDeniedError extends APIError<403, Headers> {} +export class PermissionDeniedError extends APIError<403, Headers> { +} -export class NotFoundError extends APIError<404, Headers> {} +export class NotFoundError extends APIError<404, Headers> { +} -export class ConflictError extends APIError<409, Headers> {} +export class ConflictError extends APIError<409, Headers> { +} -export class UnprocessableEntityError extends APIError<422, Headers> {} +export class UnprocessableEntityError extends APIError<422, Headers> { +} -export class RateLimitError extends APIError<429, Headers> {} +export class RateLimitError extends APIError<429, Headers> { +} -export class InternalServerError extends APIError {} +export class InternalServerError extends APIError { +} diff --git a/src/core/pagination.ts b/src/core/pagination.ts index efb86dd..f8aeb39 100644 --- a/src/core/pagination.ts +++ b/src/core/pagination.ts @@ -87,8 +87,7 @@ export class PagePromise< super( client, request, - async (client, props) => - new Page(client, props.response, await defaultParseResponse(client, props), props.options), + async (client, props) => new Page(client, props.response, await defaultParseResponse(client, props), props.options) ); } @@ -130,12 +129,7 @@ export class SkipLimit extends AbstractPage implements SkipLimitResp totalCount: number; - constructor( - client: PostGrid, - response: Response, - body: SkipLimitResponse, - options: FinalRequestOptions, - ) { + constructor(client: PostGrid, response: Response, body: SkipLimitResponse, options: FinalRequestOptions) { super(client, response, body, options); this.data = body.data || []; @@ -158,14 +152,14 @@ export class SkipLimit extends AbstractPage implements SkipLimitResp if (currentCount < totalCount) { return { - ...this.options, - query: { - ...maybeObj(this.options.query), - skip: currentCount, - }, - }; + ...this.options, + query: { + ...maybeObj(this.options.query), + skip: currentCount, + }, + }; } - return null; + return null } } diff --git a/src/error.ts b/src/error.ts index fc55f46..d0832d3 100644 --- a/src/error.ts +++ b/src/error.ts @@ -1,2 +1,2 @@ /** @deprecated Import from ./core/error instead */ -export * from './core/error'; +export * from "./core/error" \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index cb60a0d..bf209a4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,18 +6,4 @@ export { type Uploadable, toFile } from './core/uploads'; export { APIPromise } from './core/api-promise'; export { PostGrid, type ClientOptions } from './client'; export { PagePromise } from './core/pagination'; -export { - PostGridError, - APIError, - APIConnectionError, - APIConnectionTimeoutError, - APIUserAbortError, - NotFoundError, - ConflictError, - RateLimitError, - BadRequestError, - AuthenticationError, - InternalServerError, - PermissionDeniedError, - UnprocessableEntityError, -} from './core/error'; +export { PostGridError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError } from './core/error'; diff --git a/src/internal/builtin-types.ts b/src/internal/builtin-types.ts index c23d3bd..6059d5d 100644 --- a/src/internal/builtin-types.ts +++ b/src/internal/builtin-types.ts @@ -1,20 +1,23 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export type Fetch = (input: string | URL | Request, init?: RequestInit) => Promise; +export type Fetch = ( + input: string | URL | Request, + init?: RequestInit, +) => Promise /** * An alias to the builtin `RequestInit` type so we can * easily alias it in import statements if there are name clashes. - * - * https://developer.mozilla.org/docs/Web/API/RequestInit + * + * https://developer.mozilla.org/docs/Web/API/RequestInit */ type _RequestInit = RequestInit; /** * An alias to the builtin `Response` type so we can * easily alias it in import statements if there are name clashes. - * - * https://developer.mozilla.org/docs/Web/API/Response + * + * https://developer.mozilla.org/docs/Web/API/Response */ type _Response = Response; @@ -51,15 +54,7 @@ type _Array = Array; */ type _Record = Record; -export type { - _Array as Array, - _BodyInit as BodyInit, - _HeadersInit as HeadersInit, - _Record as Record, - _RequestInfo as RequestInfo, - _RequestInit as RequestInit, - _Response as Response, -}; +export type { _Array as Array, _BodyInit as BodyInit, _HeadersInit as HeadersInit, _Record as Record, _RequestInfo as RequestInfo, _RequestInit as RequestInit, _Response as Response }; /** * A copy of the builtin `EndingType` type as it isn't fully supported in certain diff --git a/src/internal/detect-platform.ts b/src/internal/detect-platform.ts index e82d95c..394ede8 100644 --- a/src/internal/detect-platform.ts +++ b/src/internal/detect-platform.ts @@ -25,11 +25,7 @@ function getDetectedPlatform(): DetectedPlatform { if (typeof EdgeRuntime !== 'undefined') { return 'edge'; } - if ( - Object.prototype.toString.call( - typeof (globalThis as any).process !== 'undefined' ? (globalThis as any).process : 0, - ) === '[object process]' - ) { + if (Object.prototype.toString.call(typeof (globalThis as any).process !== 'undefined' ? (globalThis as any).process : 0) === '[object process]') { return 'node'; } return 'unknown'; diff --git a/src/internal/errors.ts b/src/internal/errors.ts index 82c7b14..c14a742 100644 --- a/src/internal/errors.ts +++ b/src/internal/errors.ts @@ -2,12 +2,12 @@ export function isAbortError(err: unknown) { return ( - typeof err === 'object' && - err !== null && - // Spec-compliant fetch implementations - (('name' in err && (err as any).name === 'AbortError') || + typeof err === 'object' && err !== null && ( + // Spec-compliant fetch implementations + ('name' in err && (err as any).name === 'AbortError') || // Expo fetch - ('message' in err && String((err as any).message).includes('FetchRequestCanceledException'))) + ('message' in err && String((err as any).message).includes('FetchRequestCanceledException')) + ) ); } @@ -24,10 +24,10 @@ export const castToError = (err: any): Error => { if (err.name) error.name = err.name; return error; } - } catch {} + } catch { } try { return new Error(JSON.stringify(err)); - } catch {} + } catch { } } return new Error(err); }; diff --git a/src/internal/headers.ts b/src/internal/headers.ts index c724a9d..fa2ea2b 100644 --- a/src/internal/headers.ts +++ b/src/internal/headers.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { isReadonlyArray } from './utils/values'; +import { isReadonlyArray } from "./utils/values"; type HeaderValue = string | undefined | null; export type HeadersLike = @@ -51,7 +51,7 @@ function* iterateHeaders(headers: HeadersLike): IterableIterator(client: PostGrid, props: APIResponseProps): Promise { const { response, requestLogID, retryOfRequestLogID, startTime } = props; const body = await (async () => { + // fetch refuses to read the body when the status code is 204. if (response.status === 204) { return null as T; @@ -42,15 +43,6 @@ export async function defaultParseResponse(client: PostGrid, props: APIRespon const text = await response.text(); return text as unknown as T; })(); - loggerFor(client).debug( - `[${requestLogID}] response parsed`, - formatRequestDetails({ - retryOfRequestLogID, - url: response.url, - status: response.status, - body, - durationMs: Date.now() - startTime, - }), - ); + loggerFor(client).debug(`[${requestLogID}] response parsed`, formatRequestDetails({ retryOfRequestLogID, url: response.url, status: response.status, body, durationMs: Date.now() - startTime })); return body; } diff --git a/src/internal/qs/utils.ts b/src/internal/qs/utils.ts index 4cd5657..f21d955 100644 --- a/src/internal/qs/utils.ts +++ b/src/internal/qs/utils.ts @@ -62,7 +62,10 @@ export function merge( if (isArray(target)) { target.push(source); } else if (target && typeof target === 'object') { - if ((options && (options.plainObjects || options.allowPrototypes)) || !has(Object.prototype, source)) { + if ( + (options && (options.plainObjects || options.allowPrototypes)) || + !has(Object.prototype, source) + ) { target[source] = true; } } else { diff --git a/src/internal/request-options.ts b/src/internal/request-options.ts index 2aabf9a..a8558b2 100644 --- a/src/internal/request-options.ts +++ b/src/internal/request-options.ts @@ -76,10 +76,14 @@ export type RequestOptions = { defaultBaseURL?: string | undefined; __binaryResponse?: boolean | undefined; + }; export type EncodedContent = { bodyHeaders: HeadersLike; body: BodyInit }; -export type RequestEncoder = (request: { headers: NullableHeaders; body: unknown }) => EncodedContent; +export type RequestEncoder = (request: { + headers: NullableHeaders; + body: unknown; +}) => EncodedContent; export const FallbackEncoder: RequestEncoder = ({ headers, body }) => { return { diff --git a/src/internal/shim-types.ts b/src/internal/shim-types.ts index 8ddf7b0..accbf57 100644 --- a/src/internal/shim-types.ts +++ b/src/internal/shim-types.ts @@ -19,8 +19,8 @@ type _ConditionalNodeReadableStream = typeof globalThis extends { ReadableStream: any } ? never : _NodeReadableStream; type _ReadableStream = NeverToAny< - | ([0] extends [1 & _DOMReadableStream] ? never : _DOMReadableStream) - | ([0] extends [1 & _ConditionalNodeReadableStream] ? never : _ConditionalNodeReadableStream) + ([0] extends [1 & _DOMReadableStream] ? never : _DOMReadableStream) | + ([0] extends [1 & _ConditionalNodeReadableStream] ? never : _ConditionalNodeReadableStream) >; export type { _ReadableStream as ReadableStream }; diff --git a/src/internal/shims.ts b/src/internal/shims.ts index 24b3e36..3dd4c88 100644 --- a/src/internal/shims.ts +++ b/src/internal/shims.ts @@ -27,9 +27,7 @@ export function makeReadableStream(...args: ReadableStreamArgs): ReadableStream if (typeof ReadableStream === 'undefined') { // Note: All of the platforms / runtimes we officially support already define // `ReadableStream` as a global, so this should only ever be hit on unsupported runtimes. - throw new Error( - '`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`', - ); + throw new Error('`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`'); } return new ReadableStream(...args); diff --git a/src/internal/to-file.ts b/src/internal/to-file.ts index 30eada3..c72a2b4 100644 --- a/src/internal/to-file.ts +++ b/src/internal/to-file.ts @@ -1,4 +1,4 @@ -import { BlobPart, getName, makeFile, isAsyncIterable } from './uploads'; +import { BlobPart, getName, makeFile, isAsyncIterable } from "./uploads"; import type { FilePropertyBag } from './builtin-types'; import { checkFileSupport } from './uploads'; @@ -65,11 +65,8 @@ const isResponseLike = (value: any): value is ResponseLike => typeof value.url === 'string' && typeof value.blob === 'function'; -export type ToFileInput = - | FileLike - | ResponseLike - | Exclude - | AsyncIterable; +export type ToFileInput = FileLike | ResponseLike | Exclude | AsyncIterable; + /** * Helper for creating a {@link File} to pass to an SDK upload method from a variety of different data formats @@ -119,7 +116,9 @@ export async function toFile( return makeFile(parts, name, options); } -async function getBytes(value: BlobLikePart | AsyncIterable): Promise> { +async function getBytes( + value: BlobLikePart | AsyncIterable, +): Promise> { let parts: Array = []; if ( typeof value === 'string' || @@ -152,3 +151,4 @@ function propsForError(value: unknown): string { const props = Object.getOwnPropertyNames(value); return `; props: [${props.map((p) => `"${p}"`).join(', ')}]`; } + diff --git a/src/internal/types.ts b/src/internal/types.ts index b668dfc..c45fee3 100644 --- a/src/internal/types.ts +++ b/src/internal/types.ts @@ -7,40 +7,34 @@ export type KeysEnum = { [P in keyof Required]: true }; export type FinalizedRequestInit = RequestInit & { headers: Headers }; -type NotAny = [0] extends [1 & T] ? never : T; +type NotAny = [0] extends [(1 & T)] ? never : T; /** * Some environments overload the global fetch function, and Parameters only gets the last signature. */ -type OverloadedParameters = - T extends ( - { +type OverloadedParameters = T extends { + (...args: infer A): unknown; + (...args: infer B): unknown; + (...args: infer C): unknown; + (...args: infer D): unknown; +} + ? A | B | C | D + : T extends { (...args: infer A): unknown; (...args: infer B): unknown; (...args: infer C): unknown; - (...args: infer D): unknown; } - ) ? - A | B | C | D - : T extends ( - { - (...args: infer A): unknown; - (...args: infer B): unknown; - (...args: infer C): unknown; - } - ) ? - A | B | C - : T extends ( - { + ? A | B | C + : T extends { (...args: infer A): unknown; (...args: infer B): unknown; } - ) ? - A | B - : T extends (...args: infer A) => unknown ? A + ? A | B + : T extends (...args: infer A) => unknown + ? A : never; -/* eslint-disable */ + /** * These imports attempt to get types from a parent package's dependencies. * Unresolved bare specifiers can trigger [automatic type acquisition][1] in some projects, which @@ -63,19 +57,19 @@ type OverloadedParameters = * * [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition */ -/** @ts-ignore For users with \@types/node */ +/** @ts-ignore For users with \@types/node */ /* prettier-ignore */ type UndiciTypesRequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; -/** @ts-ignore For users with undici */ +/** @ts-ignore For users with undici */ /* prettier-ignore */ type UndiciRequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; -/** @ts-ignore For users with \@types/bun */ +/** @ts-ignore For users with \@types/bun */ /* prettier-ignore */ type BunRequestInit = globalThis.FetchRequestInit; -/** @ts-ignore For users with node-fetch@2 */ +/** @ts-ignore For users with node-fetch@2 */ /* prettier-ignore */ type NodeFetch2RequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; -/** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */ +/** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */ /* prettier-ignore */ type NodeFetch3RequestInit = NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny | NotAny; -/** @ts-ignore For users who use Deno */ +/** @ts-ignore For users who use Deno */ /* prettier-ignore */ type FetchRequestInit = NonNullable[1]>; -/* eslint-enable */ + type RequestInits = | NotAny diff --git a/src/internal/utils/log.ts b/src/internal/utils/log.ts index bb04026..dc5123e 100644 --- a/src/internal/utils/log.ts +++ b/src/internal/utils/log.ts @@ -4,7 +4,7 @@ import { hasOwn } from './values'; import { type PostGrid } from '../../client'; import { RequestOptions } from '../request-options'; -type LogFn = (message: string, ...rest: unknown[]) => void; +type LogFn = (message: string, ...rest: unknown[]) => void export type Logger = { error: LogFn; warn: LogFn; @@ -21,22 +21,14 @@ const levelNumbers = { debug: 500, }; -export const parseLogLevel = ( - maybeLevel: string | undefined, - sourceName: string, - client: PostGrid, -): LogLevel | undefined => { +export const parseLogLevel = (maybeLevel: string | undefined, sourceName: string, client: PostGrid): LogLevel | undefined => { if (!maybeLevel) { return undefined; } if (hasOwn(levelNumbers, maybeLevel)) { return maybeLevel; - } - loggerFor(client).warn( - `${sourceName} was set to ${JSON.stringify(maybeLevel)}, expected one of ${JSON.stringify( - Object.keys(levelNumbers), - )}`, - ); + }; + loggerFor(client).warn(`${sourceName} was set to ${JSON.stringify(maybeLevel)}, expected one of ${JSON.stringify(Object.keys(levelNumbers))}`); return undefined; }; @@ -97,25 +89,11 @@ export const formatRequestDetails = (details: { body?: unknown; }) => { if (details.options) { - details.options = { ...details.options }; + details.options = {...details.options}; delete details.options['headers']; // redundant + leaks internals } if (details.headers) { - details.headers = Object.fromEntries( - (details.headers instanceof Headers ? [...details.headers] : Object.entries(details.headers)).map( - ([name, value]) => [ - name, - ( - name.toLowerCase() === 'x-api-key' || - name.toLowerCase() === 'authorization' || - name.toLowerCase() === 'cookie' || - name.toLowerCase() === 'set-cookie' - ) ? - '***' - : value, - ], - ), - ); + details.headers = Object.fromEntries((details.headers instanceof Headers ? [...details.headers] : Object.entries(details.headers)).map(([name, value]) => [name, name.toLowerCase() === 'x-api-key' || name.toLowerCase() === 'authorization' || name.toLowerCase() === 'cookie' || name.toLowerCase() === 'set-cookie' ? '***' : value])) } if ('retryOfRequestLogID' in details) { if (details.retryOfRequestLogID) { @@ -123,5 +101,5 @@ export const formatRequestDetails = (details: { } delete details.retryOfRequestLogID; } - return details; -}; + return details +} diff --git a/src/internal/utils/query.ts b/src/internal/utils/query.ts index 0139cac..06e72d9 100644 --- a/src/internal/utils/query.ts +++ b/src/internal/utils/query.ts @@ -3,5 +3,5 @@ import * as qs from '../qs/stringify'; export function stringifyQuery(query: object | Record) { - return qs.stringify(query, { arrayFormat: 'comma' }); + return qs.stringify(query, { arrayFormat: 'comma' }) } diff --git a/src/internal/utils/uuid.ts b/src/internal/utils/uuid.ts index b0e53aa..53708ba 100644 --- a/src/internal/utils/uuid.ts +++ b/src/internal/utils/uuid.ts @@ -10,8 +10,10 @@ export let uuid4 = function () { return crypto.randomUUID(); } const u8 = new Uint8Array(1); - const randomByte = crypto ? () => crypto.getRandomValues(u8)[0]! : () => (Math.random() * 0xff) & 0xff; - return '10000000-1000-4000-8000-100000000000'.replace(/[018]/g, (c) => + const randomByte = crypto + ? () => crypto.getRandomValues(u8)[0]! + : () => (Math.random() * 0xff) & 0xff; + return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c) => (+c ^ (randomByte() & (15 >> (+c / 4)))).toString(16), ); -}; +} diff --git a/src/pagination.ts b/src/pagination.ts index 90bf015..e1e5d09 100644 --- a/src/pagination.ts +++ b/src/pagination.ts @@ -1,2 +1,2 @@ /** @deprecated Import from ./core/pagination instead */ -export * from './core/pagination'; +export * from "./core/pagination" \ No newline at end of file diff --git a/src/resource.ts b/src/resource.ts index 363e351..57a27a9 100644 --- a/src/resource.ts +++ b/src/resource.ts @@ -1,2 +1,2 @@ /** @deprecated Import from ./core/resource instead */ -export * from './core/resource'; +export * from "./core/resource" \ No newline at end of file diff --git a/src/resources/address-verification.ts b/src/resources/address-verification.ts index 054782f..171f1c9 100644 --- a/src/resources/address-verification.ts +++ b/src/resources/address-verification.ts @@ -33,16 +33,9 @@ export class AddressVerification extends APIResource { * }); * ``` */ - verify( - params: AddressVerificationVerifyParams, - options?: RequestOptions, - ): APIPromise { - const { geocode, includeDetails, properCase, ...body } = params; - return this._client.post('/v1/addver/verifications', { - query: { geocode, includeDetails, properCase }, - body, - ...options, - }); + verify(params: AddressVerificationVerifyParams, options?: RequestOptions): APIPromise { + const { geocode, includeDetails, properCase, ...body } = params + return this._client.post('/v1/addver/verifications', { query: { geocode, includeDetails, properCase }, body, ...options }); } } @@ -79,7 +72,7 @@ export interface Errors { /** * The verification status of an address. */ -export type Status = 'verified' | 'corrected' | 'failed'; +export type Status = 'verified' | 'corrected' | 'failed' export interface AddressVerificationVerifyResponse { data: AddressVerificationVerifyResponse.Data; @@ -422,15 +415,7 @@ export namespace AddressVerificationVerifyResponse { * A string representing the * [accuracy type](https://avdocs.postgrid.com/#accuracy-type) */ - accuracyType: - | 'rooftop' - | 'point' - | 'range_interpolation' - | 'nearest_rooftop_match' - | 'intersection' - | 'street_center' - | 'place' - | 'state'; + accuracyType: 'rooftop' | 'point' | 'range_interpolation' | 'nearest_rooftop_match' | 'intersection' | 'street_center' | 'place' | 'state'; /** * Object that contains `lat`, `lng` properties with number values @@ -451,9 +436,7 @@ export namespace AddressVerificationVerifyResponse { } } -export type AddressVerificationVerifyParams = - | AddressVerificationVerifyParams.StandardFreeformAddressInput - | AddressVerificationVerifyParams.StandardStructuredAddressInput; +export type AddressVerificationVerifyParams = AddressVerificationVerifyParams.StandardFreeformAddressInput | AddressVerificationVerifyParams.StandardStructuredAddressInput export declare namespace AddressVerificationVerifyParams { export interface StandardFreeformAddressInput { @@ -545,6 +528,6 @@ export declare namespace AddressVerification { type Errors as Errors, type Status as Status, type AddressVerificationVerifyResponse as AddressVerificationVerifyResponse, - type AddressVerificationVerifyParams as AddressVerificationVerifyParams, + type AddressVerificationVerifyParams as AddressVerificationVerifyParams }; } diff --git a/src/resources/index.ts b/src/resources/index.ts index 505e682..acba9e7 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -1,19 +1,5 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { - AddressVerification, - type Errors, - type Status, - type AddressVerificationVerifyResponse, - type AddressVerificationVerifyParams, -} from './address-verification'; -export { - IntlAddressVerification, - type IntlAddressVerificationVerifyResponse, - type IntlAddressVerificationVerifyParams, -} from './intl-address-verification'; -export { - PrintMail, - type ContactCreateWithCompanyName, - type ContactCreateWithFirstName, -} from './print-mail/print-mail'; +export { AddressVerification, type Errors, type Status, type AddressVerificationVerifyResponse, type AddressVerificationVerifyParams } from './address-verification';; +export { IntlAddressVerification, type IntlAddressVerificationVerifyResponse, type IntlAddressVerificationVerifyParams } from './intl-address-verification';; +export { PrintMail, type ContactCreateWithCompanyName, type ContactCreateWithFirstName } from './print-mail/print-mail';; diff --git a/src/resources/intl-address-verification.ts b/src/resources/intl-address-verification.ts index b97fd1e..f421de5 100644 --- a/src/resources/intl-address-verification.ts +++ b/src/resources/intl-address-verification.ts @@ -28,16 +28,9 @@ export class IntlAddressVerification extends APIResource { * }); * ``` */ - verify( - params: IntlAddressVerificationVerifyParams, - options?: RequestOptions, - ): APIPromise { - const { geoData, includeDetails, properCase, ...body } = params; - return this._client.post('/v1/intl_addver/verifications', { - query: { geoData, includeDetails, properCase }, - body, - ...options, - }); + verify(params: IntlAddressVerificationVerifyParams, options?: RequestOptions): APIPromise { + const { geoData, includeDetails, properCase, ...body } = params + return this._client.post('/v1/intl_addver/verifications', { query: { geoData, includeDetails, properCase }, body, ...options }); } } @@ -383,9 +376,7 @@ export namespace IntlAddressVerificationVerifyResponse { } } -export type IntlAddressVerificationVerifyParams = - | IntlAddressVerificationVerifyParams.StructuredAddressInput - | IntlAddressVerificationVerifyParams.FreeformAddressInput; +export type IntlAddressVerificationVerifyParams = IntlAddressVerificationVerifyParams.StructuredAddressInput | IntlAddressVerificationVerifyParams.FreeformAddressInput export declare namespace IntlAddressVerificationVerifyParams { export interface StructuredAddressInput { @@ -480,6 +471,6 @@ export declare namespace IntlAddressVerificationVerifyParams { export declare namespace IntlAddressVerification { export { type IntlAddressVerificationVerifyResponse as IntlAddressVerificationVerifyResponse, - type IntlAddressVerificationVerifyParams as IntlAddressVerificationVerifyParams, + type IntlAddressVerificationVerifyParams as IntlAddressVerificationVerifyParams }; } diff --git a/src/resources/print-mail/bank-accounts.ts b/src/resources/print-mail/bank-accounts.ts index 7d49120..d775f02 100644 --- a/src/resources/print-mail/bank-accounts.ts +++ b/src/resources/print-mail/bank-accounts.ts @@ -58,14 +58,8 @@ export class BankAccounts extends APIResource { * } * ``` */ - list( - query: BankAccountListParams | null | undefined = {}, - options?: RequestOptions, - ): PagePromise { - return this._client.getAPIList('/print-mail/v1/bank_accounts', SkipLimit, { - query, - ...options, - }); + list(query: BankAccountListParams | null | undefined = {}, options?: RequestOptions): PagePromise { + return this._client.getAPIList('/print-mail/v1/bank_accounts', SkipLimit, { query, ...options }); } /** @@ -82,7 +76,7 @@ export class BankAccounts extends APIResource { } } -export type BankAccountsSkipLimit = SkipLimit; +export type BankAccountsSkipLimit = SkipLimit export interface BankAccount { /** @@ -184,7 +178,7 @@ export interface BankAccount { * Countries typically have different bank account formats and standards. These are * the countries which PostGrid's bank accounts API supports. */ -export type BankAccountCountryCode = 'CA' | 'US'; +export type BankAccountCountryCode = 'CA' | 'US' export interface BankAccountDeleteResponse { /** @@ -200,10 +194,7 @@ export interface BankAccountDeleteResponse { object: 'bank_account'; } -export type BankAccountCreateParams = - | BankAccountCreateParams.BankAccountCreateSignatureText - | BankAccountCreateParams.BankAccountCreateSignatureImageURL - | BankAccountCreateParams.BankAccountCreateSignatureImageFile; +export type BankAccountCreateParams = BankAccountCreateParams.BankAccountCreateSignatureText | BankAccountCreateParams.BankAccountCreateSignatureImageURL | BankAccountCreateParams.BankAccountCreateSignatureImageFile export declare namespace BankAccountCreateParams { export interface BankAccountCreateSignatureText { @@ -419,6 +410,6 @@ export declare namespace BankAccounts { type BankAccountDeleteResponse as BankAccountDeleteResponse, type BankAccountsSkipLimit as BankAccountsSkipLimit, type BankAccountCreateParams as BankAccountCreateParams, - type BankAccountListParams as BankAccountListParams, + type BankAccountListParams as BankAccountListParams }; } diff --git a/src/resources/print-mail/campaigns.ts b/src/resources/print-mail/campaigns.ts index 09ed25e..bfca9c6 100644 --- a/src/resources/print-mail/campaigns.ts +++ b/src/resources/print-mail/campaigns.ts @@ -27,15 +27,8 @@ export class Campaigns extends APIResource { * ``` */ create(params: CampaignCreateParams, options?: RequestOptions): APIPromise { - const { 'idempotency-key': idempotencyKey, ...body } = params; - return this._client.post('/print-mail/v1/campaigns', { - body, - ...options, - headers: buildHeaders([ - { ...(idempotencyKey != null ? { 'idempotency-key': idempotencyKey } : undefined) }, - options?.headers, - ]), - }); + const { 'idempotency-key': idempotencyKey, ...body } = params + return this._client.post('/print-mail/v1/campaigns', { body, ...options, headers: buildHeaders([{...(idempotencyKey != null ? { 'idempotency-key': idempotencyKey } : undefined)}, options?.headers]) }); } /** @@ -84,10 +77,7 @@ export class Campaigns extends APIResource { * } * ``` */ - list( - query: CampaignListParams | null | undefined = {}, - options?: RequestOptions, - ): PagePromise { + list(query: CampaignListParams | null | undefined = {}, options?: RequestOptions): PagePromise { return this._client.getAPIList('/print-mail/v1/campaigns', SkipLimit, { query, ...options }); } @@ -128,7 +118,7 @@ export class Campaigns extends APIResource { } } -export type CampaignsSkipLimit = SkipLimit; +export type CampaignsSkipLimit = SkipLimit /** * Represents a bulk mail campaign. @@ -162,14 +152,7 @@ export interface Campaign { /** * Status of the campaign lifecycle. */ - status: - | 'drafting' - | 'changes_required' - | 'creating_orders' - | 'draft' - | 'ready' - | 'printing' - | 'processed_for_delivery'; + status: 'drafting' | 'changes_required' | 'creating_orders' | 'draft' | 'ready' | 'printing' | 'processed_for_delivery'; /** * The UTC time at which this resource was last updated. @@ -394,6 +377,6 @@ export declare namespace Campaigns { type CampaignCreateParams as CampaignCreateParams, type CampaignUpdateParams as CampaignUpdateParams, type CampaignListParams as CampaignListParams, - type CampaignSendParams as CampaignSendParams, + type CampaignSendParams as CampaignSendParams }; } diff --git a/src/resources/print-mail/cheques.ts b/src/resources/print-mail/cheques.ts index ea88c38..f5277ab 100644 --- a/src/resources/print-mail/cheques.ts +++ b/src/resources/print-mail/cheques.ts @@ -76,10 +76,7 @@ export class Cheques extends APIResource { * } * ``` */ - list( - query: ChequeListParams | null | undefined = {}, - options?: RequestOptions, - ): PagePromise { + list(query: ChequeListParams | null | undefined = {}, options?: RequestOptions): PagePromise { return this._client.getAPIList('/print-mail/v1/cheques', SkipLimit, { query, ...options }); } @@ -133,7 +130,7 @@ export class Cheques extends APIResource { } } -export type ChequesSkipLimit = SkipLimit; +export type ChequesSkipLimit = SkipLimit export interface Cheque { /** @@ -177,33 +174,7 @@ export interface Cheque { * The mailing class of this order. This determines the speed and cost of delivery. * See `OrderMailingClass` for more details. */ - mailingClass: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * Always `cheque`. @@ -368,7 +339,7 @@ export namespace Cheque { /** * Enum representing the supported cheque sizes. */ -export type ChequeSize = 'us_letter' | 'us_legal'; +export type ChequeSize = 'us_letter' | 'us_legal' export interface DigitalOnly { /** @@ -454,33 +425,7 @@ export interface ChequeCreateParams { * The mailing class of this order. If not provided, automatically set to * `first_class`. */ - mailingClass?: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass?: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * The memo of the cheque. @@ -552,6 +497,6 @@ export declare namespace Cheques { type ChequeRetrieveURLResponse as ChequeRetrieveURLResponse, type ChequesSkipLimit as ChequesSkipLimit, type ChequeCreateParams as ChequeCreateParams, - type ChequeListParams as ChequeListParams, + type ChequeListParams as ChequeListParams }; } diff --git a/src/resources/print-mail/contacts.ts b/src/resources/print-mail/contacts.ts index 4989b47..84dafcb 100644 --- a/src/resources/print-mail/contacts.ts +++ b/src/resources/print-mail/contacts.ts @@ -62,10 +62,7 @@ export class Contacts extends APIResource { * } * ``` */ - list( - query: ContactListParams | null | undefined = {}, - options?: RequestOptions, - ): PagePromise { + list(query: ContactListParams | null | undefined = {}, options?: RequestOptions): PagePromise { return this._client.getAPIList('/print-mail/v1/contacts', SkipLimit, { query, ...options }); } @@ -85,7 +82,7 @@ export class Contacts extends APIResource { } } -export type ContactsSkipLimit = SkipLimit; +export type ContactsSkipLimit = SkipLimit export interface Contact { /** @@ -208,9 +205,7 @@ export interface Contact { skipVerification?: boolean; } -export type ContactCreate = - | PrintMailAPI.ContactCreateWithFirstName - | PrintMailAPI.ContactCreateWithCompanyName; +export type ContactCreate = PrintMailAPI.ContactCreateWithFirstName | PrintMailAPI.ContactCreateWithCompanyName export interface ContactDeleteResponse { /** @@ -226,9 +221,7 @@ export interface ContactDeleteResponse { object: 'contact'; } -export type ContactCreateParams = - | ContactCreateParams.ContactCreateWithFirstName - | ContactCreateParams.ContactCreateWithCompanyName; +export type ContactCreateParams = ContactCreateParams.ContactCreateWithFirstName | ContactCreateParams.ContactCreateWithCompanyName export declare namespace ContactCreateParams { export interface ContactCreateWithFirstName { @@ -414,6 +407,6 @@ export declare namespace Contacts { type ContactDeleteResponse as ContactDeleteResponse, type ContactsSkipLimit as ContactsSkipLimit, type ContactCreateParams as ContactCreateParams, - type ContactListParams as ContactListParams, + type ContactListParams as ContactListParams }; } diff --git a/src/resources/print-mail/index.ts b/src/resources/print-mail/index.ts index 851c26b..8805d50 100644 --- a/src/resources/print-mail/index.ts +++ b/src/resources/print-mail/index.ts @@ -1,122 +1,16 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { - BankAccounts, - type BankAccount, - type BankAccountCountryCode, - type BankAccountDeleteResponse, - type BankAccountCreateParams, - type BankAccountListParams, - type BankAccountsSkipLimit, -} from './bank-accounts'; -export { - Campaigns, - type Campaign, - type CampaignDeleteResponse, - type CampaignCreateParams, - type CampaignUpdateParams, - type CampaignListParams, - type CampaignSendParams, - type CampaignsSkipLimit, -} from './campaigns'; -export { - Cheques, - type Cheque, - type ChequeSize, - type DigitalOnly, - type ChequeRetrieveURLResponse, - type ChequeCreateParams, - type ChequeListParams, - type ChequesSkipLimit, -} from './cheques'; -export { - Contacts, - type Contact, - type ContactCreate, - type ContactDeleteResponse, - type ContactCreateParams, - type ContactListParams, - type ContactsSkipLimit, -} from './contacts'; -export { - Letters, - type AddressPlacement, - type AttachedPdf, - type Letter, - type LetterSize, - type PlasticCard, - type LetterRetrieveURLResponse, - type LetterCreateParams, - type LetterListParams, - type LettersSkipLimit, -} from './letters'; -export { - MailingListImports, - type FileType, - type MailingListImportResponse, - type VerificationStatusCount, - type MailingListImportDeleteResponse, - type MailingListImportCreateParams, - type MailingListImportUpdateParams, - type MailingListImportListParams, - type MailingListImportResponsesSkipLimit, -} from './mailing-list-imports'; -export { - MailingLists, - type MailingList, - type MailingListUpdate, - type MailingListDeleteResponse, - type MailingListCreateParams, - type MailingListUpdateParams, - type MailingListListParams, - type MailingListJobsParams, - type MailingListsSkipLimit, -} from './mailing-lists'; -export { OrderProfiles } from './order-profiles/index'; -export { - Postcards, - type Postcard, - type PostcardRetrieveURLResponse, - type PostcardCreateParams, - type PostcardListParams, - type PostcardsSkipLimit, -} from './postcards'; -export { PrintMail, type ContactCreateWithCompanyName, type ContactCreateWithFirstName } from './print-mail'; -export { - Reports, - type DeletedResponse, - type Report, - type ReportCreateParams, - type ReportUpdateParams, - type ReportListParams, - type ReportSampleParams, - type ReportsSkipLimit, -} from './reports/index'; -export { - SelfMailers, - type SelfMailer, - type SelfMailerRetrieveURLResponse, - type SelfMailerCreateParams, - type SelfMailerListParams, - type SelfMailersSkipLimit, -} from './self-mailers'; -export { - SubOrganizations, - type EmailPreferences, - type SubOrganization, - type SubOrganizationUpdateResponse, - type SubOrganizationRetrieveUsersResponse, - type SubOrganizationUpdateParams, - type SubOrganizationListParams, - type SubOrganizationRetrieveUsersParams, - type SubOrganizationsSkipLimit, -} from './sub-organizations'; -export { - Templates, - type Template, - type TemplateDeleteResponse, - type TemplateCreateParams, - type TemplateUpdateParams, - type TemplateListParams, - type TemplatesSkipLimit, -} from './templates'; +export { BankAccounts, type BankAccount, type BankAccountCountryCode, type BankAccountDeleteResponse, type BankAccountCreateParams, type BankAccountListParams, type BankAccountsSkipLimit } from './bank-accounts';; +export { Campaigns, type Campaign, type CampaignDeleteResponse, type CampaignCreateParams, type CampaignUpdateParams, type CampaignListParams, type CampaignSendParams, type CampaignsSkipLimit } from './campaigns';; +export { Cheques, type Cheque, type ChequeSize, type DigitalOnly, type ChequeRetrieveURLResponse, type ChequeCreateParams, type ChequeListParams, type ChequesSkipLimit } from './cheques';; +export { Contacts, type Contact, type ContactCreate, type ContactDeleteResponse, type ContactCreateParams, type ContactListParams, type ContactsSkipLimit } from './contacts';; +export { Letters, type AddressPlacement, type AttachedPdf, type Letter, type LetterSize, type PlasticCard, type LetterRetrieveURLResponse, type LetterCreateParams, type LetterListParams, type LettersSkipLimit } from './letters';; +export { MailingListImports, type FileType, type MailingListImportResponse, type VerificationStatusCount, type MailingListImportDeleteResponse, type MailingListImportCreateParams, type MailingListImportUpdateParams, type MailingListImportListParams, type MailingListImportResponsesSkipLimit } from './mailing-list-imports';; +export { MailingLists, type MailingList, type MailingListUpdate, type MailingListDeleteResponse, type MailingListCreateParams, type MailingListUpdateParams, type MailingListListParams, type MailingListJobsParams, type MailingListsSkipLimit } from './mailing-lists';; +export { OrderProfiles } from './order-profiles/index';; +export { Postcards, type Postcard, type PostcardRetrieveURLResponse, type PostcardCreateParams, type PostcardListParams, type PostcardsSkipLimit } from './postcards';; +export { PrintMail, type ContactCreateWithCompanyName, type ContactCreateWithFirstName } from './print-mail';; +export { Reports, type DeletedResponse, type Report, type ReportCreateParams, type ReportUpdateParams, type ReportListParams, type ReportSampleParams, type ReportsSkipLimit } from './reports/index';; +export { SelfMailers, type SelfMailer, type SelfMailerRetrieveURLResponse, type SelfMailerCreateParams, type SelfMailerListParams, type SelfMailersSkipLimit } from './self-mailers';; +export { SubOrganizations, type EmailPreferences, type SubOrganization, type SubOrganizationUpdateResponse, type SubOrganizationRetrieveUsersResponse, type SubOrganizationUpdateParams, type SubOrganizationListParams, type SubOrganizationRetrieveUsersParams, type SubOrganizationsSkipLimit } from './sub-organizations';; +export { Templates, type Template, type TemplateDeleteResponse, type TemplateCreateParams, type TemplateUpdateParams, type TemplateListParams, type TemplatesSkipLimit } from './templates';; diff --git a/src/resources/print-mail/letters.ts b/src/resources/print-mail/letters.ts index 9fc64c0..eb2a000 100644 --- a/src/resources/print-mail/letters.ts +++ b/src/resources/print-mail/letters.ts @@ -55,10 +55,7 @@ export class Letters extends APIResource { * } * ``` */ - list( - query: LetterListParams | null | undefined = {}, - options?: RequestOptions, - ): PagePromise { + list(query: LetterListParams | null | undefined = {}, options?: RequestOptions): PagePromise { return this._client.getAPIList('/print-mail/v1/letters', SkipLimit, { query, ...options }); } @@ -94,12 +91,12 @@ export class Letters extends APIResource { } } -export type LettersSkipLimit = SkipLimit; +export type LettersSkipLimit = SkipLimit /** * Enum representing the placement of the address on the letter. */ -export type AddressPlacement = 'top_first_page' | 'insert_blank_page'; +export type AddressPlacement = 'top_first_page' | 'insert_blank_page' /** * Model representing an attached PDF. @@ -161,33 +158,7 @@ export interface Letter { * The mailing class of this order. This determines the speed and cost of delivery. * See `OrderMailingClass` for more details. */ - mailingClass: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * Always `letter`. @@ -354,7 +325,7 @@ export namespace Letter { /** * Enum representing the supported letter sizes. */ -export type LetterSize = 'us_letter' | 'a4'; +export type LetterSize = 'us_letter' | 'a4' /** * Model representing a plastic card. @@ -446,10 +417,7 @@ export interface LetterRetrieveURLResponse { url: string; } -export type LetterCreateParams = - | LetterCreateParams.LetterCreateWithHTML - | LetterCreateParams.LetterCreateWithTemplate - | LetterCreateParams.LetterCreateWithPdf; +export type LetterCreateParams = LetterCreateParams.LetterCreateWithHTML | LetterCreateParams.LetterCreateWithTemplate | LetterCreateParams.LetterCreateWithPdf export declare namespace LetterCreateParams { export interface LetterCreateWithHTML { @@ -509,33 +477,7 @@ export declare namespace LetterCreateParams { * The mailing class of this order. If not provided, automatically set to * `first_class`. */ - mailingClass?: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass?: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * These will be merged with the variables in the template or HTML you create this @@ -642,33 +584,7 @@ export declare namespace LetterCreateParams { * The mailing class of this order. If not provided, automatically set to * `first_class`. */ - mailingClass?: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass?: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * These will be merged with the variables in the template or HTML you create this @@ -733,6 +649,6 @@ export declare namespace Letters { type LetterRetrieveURLResponse as LetterRetrieveURLResponse, type LettersSkipLimit as LettersSkipLimit, type LetterCreateParams as LetterCreateParams, - type LetterListParams as LetterListParams, + type LetterListParams as LetterListParams }; } diff --git a/src/resources/print-mail/mailing-list-imports.ts b/src/resources/print-mail/mailing-list-imports.ts index 3555f82..3693c2c 100644 --- a/src/resources/print-mail/mailing-list-imports.ts +++ b/src/resources/print-mail/mailing-list-imports.ts @@ -39,19 +39,9 @@ export class MailingListImports extends APIResource { * }); * ``` */ - create( - params: MailingListImportCreateParams, - options?: RequestOptions, - ): APIPromise { - const { 'idempotency-key': idempotencyKey, ...body } = params; - return this._client.post('/print-mail/v1/mailing_list_imports', { - body, - ...options, - headers: buildHeaders([ - { ...(idempotencyKey != null ? { 'idempotency-key': idempotencyKey } : undefined) }, - options?.headers, - ]), - }); + create(params: MailingListImportCreateParams, options?: RequestOptions): APIPromise { + const { 'idempotency-key': idempotencyKey, ...body } = params + return this._client.post('/print-mail/v1/mailing_list_imports', { body, ...options, headers: buildHeaders([{...(idempotencyKey != null ? { 'idempotency-key': idempotencyKey } : undefined)}, options?.headers]) }); } /** @@ -79,11 +69,7 @@ export class MailingListImports extends APIResource { * }); * ``` */ - update( - id: string, - body: MailingListImportUpdateParams, - options?: RequestOptions, - ): APIPromise { + update(id: string, body: MailingListImportUpdateParams, options?: RequestOptions): APIPromise { return this._client.post(path`/print-mail/v1/mailing_list_imports/${id}`, { body, ...options }); } @@ -101,15 +87,8 @@ export class MailingListImports extends APIResource { * } * ``` */ - list( - query: MailingListImportListParams | null | undefined = {}, - options?: RequestOptions, - ): PagePromise { - return this._client.getAPIList( - '/print-mail/v1/mailing_list_imports', - SkipLimit, - { query, ...options }, - ); + list(query: MailingListImportListParams | null | undefined = {}, options?: RequestOptions): PagePromise { + return this._client.getAPIList('/print-mail/v1/mailing_list_imports', SkipLimit, { query, ...options }); } /** @@ -129,12 +108,12 @@ export class MailingListImports extends APIResource { } } -export type MailingListImportResponsesSkipLimit = SkipLimit; +export type MailingListImportResponsesSkipLimit = SkipLimit /** * Type of file supported for mailing list imports. */ -export type FileType = 'csv'; +export type FileType = 'csv' /** * Read-only view of a MailingListImport @@ -237,11 +216,7 @@ export namespace MailingListImportResponse { /** * Type of error encountered during import processing. */ - type: - | 'no_valid_contacts_error' - | 'multiple_countries_error' - | 'invalid_contact_count_error' - | 'internal_service_error'; + type: 'no_valid_contacts_error' | 'multiple_countries_error' | 'invalid_contact_count_error' | 'internal_service_error'; } /** @@ -422,6 +397,6 @@ export declare namespace MailingListImports { type MailingListImportResponsesSkipLimit as MailingListImportResponsesSkipLimit, type MailingListImportCreateParams as MailingListImportCreateParams, type MailingListImportUpdateParams as MailingListImportUpdateParams, - type MailingListImportListParams as MailingListImportListParams, + type MailingListImportListParams as MailingListImportListParams }; } diff --git a/src/resources/print-mail/mailing-lists.ts b/src/resources/print-mail/mailing-lists.ts index a2bc516..b805440 100644 --- a/src/resources/print-mail/mailing-lists.ts +++ b/src/resources/print-mail/mailing-lists.ts @@ -21,15 +21,8 @@ export class MailingLists extends APIResource { * ``` */ create(params: MailingListCreateParams, options?: RequestOptions): APIPromise { - const { 'idempotency-key': idempotencyKey, ...body } = params; - return this._client.post('/print-mail/v1/mailing_lists', { - body, - ...options, - headers: buildHeaders([ - { ...(idempotencyKey != null ? { 'idempotency-key': idempotencyKey } : undefined) }, - options?.headers, - ]), - }); + const { 'idempotency-key': idempotencyKey, ...body } = params + return this._client.post('/print-mail/v1/mailing_lists', { body, ...options, headers: buildHeaders([{...(idempotencyKey != null ? { 'idempotency-key': idempotencyKey } : undefined)}, options?.headers]) }); } /** @@ -74,14 +67,8 @@ export class MailingLists extends APIResource { * } * ``` */ - list( - query: MailingListListParams | null | undefined = {}, - options?: RequestOptions, - ): PagePromise { - return this._client.getAPIList('/print-mail/v1/mailing_lists', SkipLimit, { - query, - ...options, - }); + list(query: MailingListListParams | null | undefined = {}, options?: RequestOptions): PagePromise { + return this._client.getAPIList('/print-mail/v1/mailing_lists', SkipLimit, { query, ...options }); } /** @@ -129,7 +116,7 @@ export class MailingLists extends APIResource { } } -export type MailingListsSkipLimit = SkipLimit; +export type MailingListsSkipLimit = SkipLimit /** * Represents a mailing list. @@ -190,11 +177,7 @@ export namespace MailingList { /** * Type of error encountered during mailing list processing. */ - type: - | 'mailing_list_imports_not_found_error' - | 'download_file_error' - | 'operational_error' - | 'internal_service_error'; + type: 'mailing_list_imports_not_found_error' | 'download_file_error' | 'operational_error' | 'internal_service_error'; } } @@ -300,6 +283,6 @@ export declare namespace MailingLists { type MailingListCreateParams as MailingListCreateParams, type MailingListUpdateParams as MailingListUpdateParams, type MailingListListParams as MailingListListParams, - type MailingListJobsParams as MailingListJobsParams, + type MailingListJobsParams as MailingListJobsParams }; } diff --git a/src/resources/print-mail/order-profiles/cheques.ts b/src/resources/print-mail/order-profiles/cheques.ts index 29c1003..513dde1 100644 --- a/src/resources/print-mail/order-profiles/cheques.ts +++ b/src/resources/print-mail/order-profiles/cheques.ts @@ -31,12 +31,8 @@ export class Cheques extends APIResource { * ``` */ create(params: ChequeCreateParams, options?: RequestOptions): APIPromise { - const { expand, ...body } = params; - return this._client.post('/print-mail/v1/order_profiles/cheques', { - query: { expand }, - body, - ...options, - }); + const { expand, ...body } = params + return this._client.post('/print-mail/v1/order_profiles/cheques', { query: { expand }, body, ...options }); } /** @@ -50,11 +46,7 @@ export class Cheques extends APIResource { * ); * ``` */ - retrieve( - id: string, - query: ChequeRetrieveParams | null | undefined = {}, - options?: RequestOptions, - ): APIPromise { + retrieve(id: string, query: ChequeRetrieveParams | null | undefined = {}, options?: RequestOptions): APIPromise { return this._client.get(path`/print-mail/v1/order_profiles/cheques/${id}`, { query, ...options }); } @@ -72,12 +64,8 @@ export class Cheques extends APIResource { * ``` */ update(id: string, params: ChequeUpdateParams, options?: RequestOptions): APIPromise { - const { expand, ...body } = params; - return this._client.post(path`/print-mail/v1/order_profiles/cheques/${id}`, { - query: { expand }, - body, - ...options, - }); + const { expand, ...body } = params + return this._client.post(path`/print-mail/v1/order_profiles/cheques/${id}`, { query: { expand }, body, ...options }); } /** @@ -91,14 +79,8 @@ export class Cheques extends APIResource { * } * ``` */ - list( - query: ChequeListParams | null | undefined = {}, - options?: RequestOptions, - ): PagePromise { - return this._client.getAPIList('/print-mail/v1/order_profiles/cheques', SkipLimit, { - query, - ...options, - }); + list(query: ChequeListParams | null | undefined = {}, options?: RequestOptions): PagePromise { + return this._client.getAPIList('/print-mail/v1/order_profiles/cheques', SkipLimit, { query, ...options }); } /** @@ -115,7 +97,7 @@ export class Cheques extends APIResource { } } -export type ChequeListResponsesSkipLimit = SkipLimit; +export type ChequeListResponsesSkipLimit = SkipLimit export interface ChequeProfile { /** @@ -184,33 +166,7 @@ export interface ChequeProfile { * Mailing class. Generally must be first class (or equivalent for destination * country) for cheques. */ - mailingClass?: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass?: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * Memo line text for the cheque. Set to `null` to remove during update. @@ -236,7 +192,7 @@ export interface ChequeProfile { /** * Enum representing the supported currency codes. */ -export type CurrencyCode = 'CAD' | 'USD'; +export type CurrencyCode = 'CAD' | 'USD' export interface ChequeListResponse { /** @@ -300,33 +256,7 @@ export interface ChequeListResponse { * Mailing class. Generally must be first class (or equivalent for destination * country) for cheques. */ - mailingClass?: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass?: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * Memo line text for the cheque. Set to `null` to remove during update. @@ -412,33 +342,7 @@ export interface ChequeCreateParams { * Body param: Mailing class. Generally must be first class (or equivalent for * destination country) for cheques. */ - mailingClass?: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass?: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * Body param: Memo line text for the cheque. Set to `null` to remove during @@ -519,33 +423,7 @@ export interface ChequeUpdateParams { * Body param: Mailing class. Generally must be first class (or equivalent for * destination country) for cheques. */ - mailingClass?: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass?: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * Body param: Memo line text for the cheque. Set to `null` to remove during @@ -591,6 +469,6 @@ export declare namespace Cheques { type ChequeCreateParams as ChequeCreateParams, type ChequeRetrieveParams as ChequeRetrieveParams, type ChequeUpdateParams as ChequeUpdateParams, - type ChequeListParams as ChequeListParams, + type ChequeListParams as ChequeListParams }; } diff --git a/src/resources/print-mail/order-profiles/index.ts b/src/resources/print-mail/order-profiles/index.ts index 13d31b8..a71a0f4 100644 --- a/src/resources/print-mail/order-profiles/index.ts +++ b/src/resources/print-mail/order-profiles/index.ts @@ -1,47 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { - Cheques, - type ChequeProfile, - type CurrencyCode, - type ChequeListResponse, - type ChequeDeleteResponse, - type ChequeCreateParams, - type ChequeRetrieveParams, - type ChequeUpdateParams, - type ChequeListParams, - type ChequeListResponsesSkipLimit, -} from './cheques'; -export { - Letters, - type LetterProfile, - type LetterDeleteResponse, - type LetterCreateParams, - type LetterRetrieveParams, - type LetterUpdateParams, - type LetterListParams, - type LetterProfilesSkipLimit, -} from './letters'; -export { OrderProfiles } from './order-profiles'; -export { - Postcards, - type PostcardProfile, - type PostcardSize, - type PostcardDeleteResponse, - type PostcardCreateParams, - type PostcardRetrieveParams, - type PostcardUpdateParams, - type PostcardListParams, - type PostcardProfilesSkipLimit, -} from './postcards'; -export { - SelfMailers, - type SelfMailerProfile, - type SelfMailerSize, - type SelfMailerDeleteResponse, - type SelfMailerCreateParams, - type SelfMailerRetrieveParams, - type SelfMailerUpdateParams, - type SelfMailerListParams, - type SelfMailerProfilesSkipLimit, -} from './self-mailers'; +export { Cheques, type ChequeProfile, type CurrencyCode, type ChequeListResponse, type ChequeDeleteResponse, type ChequeCreateParams, type ChequeRetrieveParams, type ChequeUpdateParams, type ChequeListParams, type ChequeListResponsesSkipLimit } from './cheques';; +export { Letters, type LetterProfile, type LetterDeleteResponse, type LetterCreateParams, type LetterRetrieveParams, type LetterUpdateParams, type LetterListParams, type LetterProfilesSkipLimit } from './letters';; +export { OrderProfiles } from './order-profiles';; +export { Postcards, type PostcardProfile, type PostcardSize, type PostcardDeleteResponse, type PostcardCreateParams, type PostcardRetrieveParams, type PostcardUpdateParams, type PostcardListParams, type PostcardProfilesSkipLimit } from './postcards';; +export { SelfMailers, type SelfMailerProfile, type SelfMailerSize, type SelfMailerDeleteResponse, type SelfMailerCreateParams, type SelfMailerRetrieveParams, type SelfMailerUpdateParams, type SelfMailerListParams, type SelfMailerProfilesSkipLimit } from './self-mailers';; diff --git a/src/resources/print-mail/order-profiles/letters.ts b/src/resources/print-mail/order-profiles/letters.ts index b4838a0..f5bf907 100644 --- a/src/resources/print-mail/order-profiles/letters.ts +++ b/src/resources/print-mail/order-profiles/letters.ts @@ -35,12 +35,8 @@ export class Letters extends APIResource { * ``` */ create(params: LetterCreateParams, options?: RequestOptions): APIPromise { - const { expand, ...body } = params; - return this._client.post('/print-mail/v1/order_profiles/letters', { - query: { expand }, - body, - ...options, - }); + const { expand, ...body } = params + return this._client.post('/print-mail/v1/order_profiles/letters', { query: { expand }, body, ...options }); } /** @@ -54,11 +50,7 @@ export class Letters extends APIResource { * ); * ``` */ - retrieve( - id: string, - query: LetterRetrieveParams | null | undefined = {}, - options?: RequestOptions, - ): APIPromise { + retrieve(id: string, query: LetterRetrieveParams | null | undefined = {}, options?: RequestOptions): APIPromise { return this._client.get(path`/print-mail/v1/order_profiles/letters/${id}`, { query, ...options }); } @@ -77,12 +69,8 @@ export class Letters extends APIResource { * ``` */ update(id: string, params: LetterUpdateParams, options?: RequestOptions): APIPromise { - const { expand, ...body } = params; - return this._client.post(path`/print-mail/v1/order_profiles/letters/${id}`, { - query: { expand }, - body, - ...options, - }); + const { expand, ...body } = params + return this._client.post(path`/print-mail/v1/order_profiles/letters/${id}`, { query: { expand }, body, ...options }); } /** @@ -97,14 +85,8 @@ export class Letters extends APIResource { * } * ``` */ - list( - query: LetterListParams | null | undefined = {}, - options?: RequestOptions, - ): PagePromise { - return this._client.getAPIList('/print-mail/v1/order_profiles/letters', SkipLimit, { - query, - ...options, - }); + list(query: LetterListParams | null | undefined = {}, options?: RequestOptions): PagePromise { + return this._client.getAPIList('/print-mail/v1/order_profiles/letters', SkipLimit, { query, ...options }); } /** @@ -122,7 +104,7 @@ export class Letters extends APIResource { } } -export type LetterProfilesSkipLimit = SkipLimit; +export type LetterProfilesSkipLimit = SkipLimit export interface LetterProfile { /** @@ -188,33 +170,7 @@ export interface LetterProfile { /** * Mailing class. */ - mailingClass?: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass?: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * Default merge variables for orders created using this profile. @@ -302,33 +258,7 @@ export interface LetterCreateParams { /** * Body param: Mailing class. */ - mailingClass?: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass?: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * Body param: Default merge variables for orders created using this profile. @@ -411,33 +341,7 @@ export interface LetterUpdateParams { /** * Body param: Mailing class. */ - mailingClass?: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass?: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * Body param: Default merge variables for orders created using this profile. @@ -491,6 +395,6 @@ export declare namespace Letters { type LetterCreateParams as LetterCreateParams, type LetterRetrieveParams as LetterRetrieveParams, type LetterUpdateParams as LetterUpdateParams, - type LetterListParams as LetterListParams, + type LetterListParams as LetterListParams }; } diff --git a/src/resources/print-mail/order-profiles/order-profiles.ts b/src/resources/print-mail/order-profiles/order-profiles.ts index d26b600..6817a3d 100644 --- a/src/resources/print-mail/order-profiles/order-profiles.ts +++ b/src/resources/print-mail/order-profiles/order-profiles.ts @@ -2,53 +2,13 @@ import { APIResource } from '../../../core/resource'; import * as ChequesAPI from './cheques'; -import { - ChequeCreateParams, - ChequeDeleteResponse, - ChequeListParams, - ChequeListResponse, - ChequeListResponsesSkipLimit, - ChequeProfile, - ChequeRetrieveParams, - ChequeUpdateParams, - Cheques, - CurrencyCode, -} from './cheques'; +import { ChequeCreateParams, ChequeDeleteResponse, ChequeListParams, ChequeListResponse, ChequeListResponsesSkipLimit, ChequeProfile, ChequeRetrieveParams, ChequeUpdateParams, Cheques, CurrencyCode } from './cheques'; import * as LettersAPI from './letters'; -import { - LetterCreateParams, - LetterDeleteResponse, - LetterListParams, - LetterProfile, - LetterProfilesSkipLimit, - LetterRetrieveParams, - LetterUpdateParams, - Letters, -} from './letters'; +import { LetterCreateParams, LetterDeleteResponse, LetterListParams, LetterProfile, LetterProfilesSkipLimit, LetterRetrieveParams, LetterUpdateParams, Letters } from './letters'; import * as PostcardsAPI from './postcards'; -import { - PostcardCreateParams, - PostcardDeleteResponse, - PostcardListParams, - PostcardProfile, - PostcardProfilesSkipLimit, - PostcardRetrieveParams, - PostcardSize, - PostcardUpdateParams, - Postcards, -} from './postcards'; +import { PostcardCreateParams, PostcardDeleteResponse, PostcardListParams, PostcardProfile, PostcardProfilesSkipLimit, PostcardRetrieveParams, PostcardSize, PostcardUpdateParams, Postcards } from './postcards'; import * as SelfMailersAPI from './self-mailers'; -import { - SelfMailerCreateParams, - SelfMailerDeleteResponse, - SelfMailerListParams, - SelfMailerProfile, - SelfMailerProfilesSkipLimit, - SelfMailerRetrieveParams, - SelfMailerSize, - SelfMailerUpdateParams, - SelfMailers, -} from './self-mailers'; +import { SelfMailerCreateParams, SelfMailerDeleteResponse, SelfMailerListParams, SelfMailerProfile, SelfMailerProfilesSkipLimit, SelfMailerRetrieveParams, SelfMailerSize, SelfMailerUpdateParams, SelfMailers } from './self-mailers'; export class OrderProfiles extends APIResource { cheques: ChequesAPI.Cheques = new ChequesAPI.Cheques(this._client); @@ -73,7 +33,7 @@ export declare namespace OrderProfiles { type ChequeCreateParams as ChequeCreateParams, type ChequeRetrieveParams as ChequeRetrieveParams, type ChequeUpdateParams as ChequeUpdateParams, - type ChequeListParams as ChequeListParams, + type ChequeListParams as ChequeListParams }; export { @@ -84,7 +44,7 @@ export declare namespace OrderProfiles { type LetterCreateParams as LetterCreateParams, type LetterRetrieveParams as LetterRetrieveParams, type LetterUpdateParams as LetterUpdateParams, - type LetterListParams as LetterListParams, + type LetterListParams as LetterListParams }; export { @@ -96,7 +56,7 @@ export declare namespace OrderProfiles { type PostcardCreateParams as PostcardCreateParams, type PostcardRetrieveParams as PostcardRetrieveParams, type PostcardUpdateParams as PostcardUpdateParams, - type PostcardListParams as PostcardListParams, + type PostcardListParams as PostcardListParams }; export { @@ -108,6 +68,6 @@ export declare namespace OrderProfiles { type SelfMailerCreateParams as SelfMailerCreateParams, type SelfMailerRetrieveParams as SelfMailerRetrieveParams, type SelfMailerUpdateParams as SelfMailerUpdateParams, - type SelfMailerListParams as SelfMailerListParams, + type SelfMailerListParams as SelfMailerListParams }; } diff --git a/src/resources/print-mail/order-profiles/postcards.ts b/src/resources/print-mail/order-profiles/postcards.ts index 0c46d93..c089ed6 100644 --- a/src/resources/print-mail/order-profiles/postcards.ts +++ b/src/resources/print-mail/order-profiles/postcards.ts @@ -28,12 +28,8 @@ export class Postcards extends APIResource { * ``` */ create(params: PostcardCreateParams, options?: RequestOptions): APIPromise { - const { expand, ...body } = params; - return this._client.post('/print-mail/v1/order_profiles/postcards', { - query: { expand }, - body, - ...options, - }); + const { expand, ...body } = params + return this._client.post('/print-mail/v1/order_profiles/postcards', { query: { expand }, body, ...options }); } /** @@ -47,11 +43,7 @@ export class Postcards extends APIResource { * ); * ``` */ - retrieve( - id: string, - query: PostcardRetrieveParams | null | undefined = {}, - options?: RequestOptions, - ): APIPromise { + retrieve(id: string, query: PostcardRetrieveParams | null | undefined = {}, options?: RequestOptions): APIPromise { return this._client.get(path`/print-mail/v1/order_profiles/postcards/${id}`, { query, ...options }); } @@ -68,12 +60,8 @@ export class Postcards extends APIResource { * ``` */ update(id: string, params: PostcardUpdateParams, options?: RequestOptions): APIPromise { - const { expand, ...body } = params; - return this._client.post(path`/print-mail/v1/order_profiles/postcards/${id}`, { - query: { expand }, - body, - ...options, - }); + const { expand, ...body } = params + return this._client.post(path`/print-mail/v1/order_profiles/postcards/${id}`, { query: { expand }, body, ...options }); } /** @@ -87,14 +75,8 @@ export class Postcards extends APIResource { * } * ``` */ - list( - query: PostcardListParams | null | undefined = {}, - options?: RequestOptions, - ): PagePromise { - return this._client.getAPIList('/print-mail/v1/order_profiles/postcards', SkipLimit, { - query, - ...options, - }); + list(query: PostcardListParams | null | undefined = {}, options?: RequestOptions): PagePromise { + return this._client.getAPIList('/print-mail/v1/order_profiles/postcards', SkipLimit, { query, ...options }); } /** @@ -113,7 +95,7 @@ export class Postcards extends APIResource { } } -export type PostcardProfilesSkipLimit = SkipLimit; +export type PostcardProfilesSkipLimit = SkipLimit export interface PostcardProfile { /** @@ -165,33 +147,7 @@ export interface PostcardProfile { * Mailing class (cannot include extra services like `certified` or `registered` * for postcards, though). */ - mailingClass?: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass?: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * Default merge variables for orders created using this profile. @@ -212,7 +168,7 @@ export interface PostcardProfile { /** * Enum representing the supported postcard sizes. */ -export type PostcardSize = '6x4' | '9x6' | '11x6'; +export type PostcardSize = '6x4' | '9x6' | '11x6' export interface PostcardDeleteResponse { /** @@ -261,33 +217,7 @@ export interface PostcardCreateParams { * Body param: Mailing class (cannot include extra services like `certified` or * `registered` for postcards, though). */ - mailingClass?: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass?: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * Body param: Default merge variables for orders created using this profile. @@ -341,33 +271,7 @@ export interface PostcardUpdateParams { * Body param: Mailing class (cannot include extra services like `certified` or * `registered` for postcards, though). */ - mailingClass?: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass?: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * Body param: Default merge variables for orders created using this profile. @@ -406,6 +310,6 @@ export declare namespace Postcards { type PostcardCreateParams as PostcardCreateParams, type PostcardRetrieveParams as PostcardRetrieveParams, type PostcardUpdateParams as PostcardUpdateParams, - type PostcardListParams as PostcardListParams, + type PostcardListParams as PostcardListParams }; } diff --git a/src/resources/print-mail/order-profiles/self-mailers.ts b/src/resources/print-mail/order-profiles/self-mailers.ts index 1a787bb..ef6034f 100644 --- a/src/resources/print-mail/order-profiles/self-mailers.ts +++ b/src/resources/print-mail/order-profiles/self-mailers.ts @@ -28,12 +28,8 @@ export class SelfMailers extends APIResource { * ``` */ create(params: SelfMailerCreateParams, options?: RequestOptions): APIPromise { - const { expand, ...body } = params; - return this._client.post('/print-mail/v1/order_profiles/self_mailers', { - query: { expand }, - body, - ...options, - }); + const { expand, ...body } = params + return this._client.post('/print-mail/v1/order_profiles/self_mailers', { query: { expand }, body, ...options }); } /** @@ -47,11 +43,7 @@ export class SelfMailers extends APIResource { * ); * ``` */ - retrieve( - id: string, - query: SelfMailerRetrieveParams | null | undefined = {}, - options?: RequestOptions, - ): APIPromise { + retrieve(id: string, query: SelfMailerRetrieveParams | null | undefined = {}, options?: RequestOptions): APIPromise { return this._client.get(path`/print-mail/v1/order_profiles/self_mailers/${id}`, { query, ...options }); } @@ -68,17 +60,9 @@ export class SelfMailers extends APIResource { * ); * ``` */ - update( - id: string, - params: SelfMailerUpdateParams, - options?: RequestOptions, - ): APIPromise { - const { expand, ...body } = params; - return this._client.post(path`/print-mail/v1/order_profiles/self_mailers/${id}`, { - query: { expand }, - body, - ...options, - }); + update(id: string, params: SelfMailerUpdateParams, options?: RequestOptions): APIPromise { + const { expand, ...body } = params + return this._client.post(path`/print-mail/v1/order_profiles/self_mailers/${id}`, { query: { expand }, body, ...options }); } /** @@ -92,15 +76,8 @@ export class SelfMailers extends APIResource { * } * ``` */ - list( - query: SelfMailerListParams | null | undefined = {}, - options?: RequestOptions, - ): PagePromise { - return this._client.getAPIList( - '/print-mail/v1/order_profiles/self_mailers', - SkipLimit, - { query, ...options }, - ); + list(query: SelfMailerListParams | null | undefined = {}, options?: RequestOptions): PagePromise { + return this._client.getAPIList('/print-mail/v1/order_profiles/self_mailers', SkipLimit, { query, ...options }); } /** @@ -119,7 +96,7 @@ export class SelfMailers extends APIResource { } } -export type SelfMailerProfilesSkipLimit = SkipLimit; +export type SelfMailerProfilesSkipLimit = SkipLimit /** * Represents a Self-Mailer Profile resource. @@ -168,33 +145,7 @@ export interface SelfMailerProfile { /** * Mailing class (cannot include extra services for self-mailers). */ - mailingClass?: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass?: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * Default merge variables for orders created using this profile. @@ -220,7 +171,7 @@ export interface SelfMailerProfile { /** * Enum representing the supported self-mailer sizes. */ -export type SelfMailerSize = '8.5x11_bifold' | '8.5x11_trifold' | '9.5x16_trifold'; +export type SelfMailerSize = '8.5x11_bifold' | '8.5x11_trifold' | '9.5x16_trifold' export interface SelfMailerDeleteResponse { /** @@ -262,33 +213,7 @@ export interface SelfMailerCreateParams { /** * Body param: Mailing class (cannot include extra services for self-mailers). */ - mailingClass?: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass?: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * Body param: Default merge variables for orders created using this profile. @@ -346,33 +271,7 @@ export interface SelfMailerUpdateParams { /** * Body param: Mailing class (cannot include extra services for self-mailers). */ - mailingClass?: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass?: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * Body param: Default merge variables for orders created using this profile. @@ -417,6 +316,6 @@ export declare namespace SelfMailers { type SelfMailerCreateParams as SelfMailerCreateParams, type SelfMailerRetrieveParams as SelfMailerRetrieveParams, type SelfMailerUpdateParams as SelfMailerUpdateParams, - type SelfMailerListParams as SelfMailerListParams, + type SelfMailerListParams as SelfMailerListParams }; } diff --git a/src/resources/print-mail/postcards.ts b/src/resources/print-mail/postcards.ts index 64ea80a..4dff05c 100644 --- a/src/resources/print-mail/postcards.ts +++ b/src/resources/print-mail/postcards.ts @@ -59,10 +59,7 @@ export class Postcards extends APIResource { * } * ``` */ - list( - query: PostcardListParams | null | undefined = {}, - options?: RequestOptions, - ): PagePromise { + list(query: PostcardListParams | null | undefined = {}, options?: RequestOptions): PagePromise { return this._client.getAPIList('/print-mail/v1/postcards', SkipLimit, { query, ...options }); } @@ -99,7 +96,7 @@ export class Postcards extends APIResource { } } -export type PostcardsSkipLimit = SkipLimit; +export type PostcardsSkipLimit = SkipLimit export interface Postcard { /** @@ -121,33 +118,7 @@ export interface Postcard { * The mailing class of this order. This determines the speed and cost of delivery. * See `OrderMailingClass` for more details. */ - mailingClass: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * Always `postcard`. @@ -287,11 +258,7 @@ export interface PostcardRetrieveURLResponse { url: string; } -export type PostcardCreateParams = - | PostcardCreateParams.PostcardCreateWithHTML - | PostcardCreateParams.PostcardCreateWithTemplate - | PostcardCreateParams.PostcardCreateWithPdfurl - | PostcardCreateParams.PostcardCreateWithPdfFile; +export type PostcardCreateParams = PostcardCreateParams.PostcardCreateWithHTML | PostcardCreateParams.PostcardCreateWithTemplate | PostcardCreateParams.PostcardCreateWithPdfurl | PostcardCreateParams.PostcardCreateWithPdfFile export declare namespace PostcardCreateParams { export interface PostcardCreateWithHTML { @@ -337,33 +304,7 @@ export declare namespace PostcardCreateParams { * The mailing class of this order. If not provided, automatically set to * `first_class`. */ - mailingClass?: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass?: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * These will be merged with the variables in the template or HTML you create this @@ -436,33 +377,7 @@ export declare namespace PostcardCreateParams { * The mailing class of this order. If not provided, automatically set to * `first_class`. */ - mailingClass?: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass?: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * These will be merged with the variables in the template or HTML you create this @@ -521,33 +436,7 @@ export declare namespace PostcardCreateParams { * The mailing class of this order. If not provided, automatically set to * `first_class`. */ - mailingClass?: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass?: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * These will be merged with the variables in the template or HTML you create this @@ -587,6 +476,6 @@ export declare namespace Postcards { type PostcardRetrieveURLResponse as PostcardRetrieveURLResponse, type PostcardsSkipLimit as PostcardsSkipLimit, type PostcardCreateParams as PostcardCreateParams, - type PostcardListParams as PostcardListParams, + type PostcardListParams as PostcardListParams }; } diff --git a/src/resources/print-mail/print-mail.ts b/src/resources/print-mail/print-mail.ts index 7f60ffd..b4d11da 100644 --- a/src/resources/print-mail/print-mail.ts +++ b/src/resources/print-mail/print-mail.ts @@ -2,137 +2,31 @@ import { APIResource } from '../../core/resource'; import * as BankAccountsAPI from './bank-accounts'; -import { - BankAccount, - BankAccountCountryCode, - BankAccountCreateParams, - BankAccountDeleteResponse, - BankAccountListParams, - BankAccounts, - BankAccountsSkipLimit, -} from './bank-accounts'; +import { BankAccount, BankAccountCountryCode, BankAccountCreateParams, BankAccountDeleteResponse, BankAccountListParams, BankAccounts, BankAccountsSkipLimit } from './bank-accounts'; import * as CampaignsAPI from './campaigns'; -import { - Campaign, - CampaignCreateParams, - CampaignDeleteResponse, - CampaignListParams, - CampaignSendParams, - CampaignUpdateParams, - Campaigns, - CampaignsSkipLimit, -} from './campaigns'; +import { Campaign, CampaignCreateParams, CampaignDeleteResponse, CampaignListParams, CampaignSendParams, CampaignUpdateParams, Campaigns, CampaignsSkipLimit } from './campaigns'; import * as ChequesAPI from './cheques'; -import { - Cheque, - ChequeCreateParams, - ChequeListParams, - ChequeRetrieveURLResponse, - ChequeSize, - Cheques, - ChequesSkipLimit, - DigitalOnly, -} from './cheques'; +import { Cheque, ChequeCreateParams, ChequeListParams, ChequeRetrieveURLResponse, ChequeSize, Cheques, ChequesSkipLimit, DigitalOnly } from './cheques'; import * as ContactsAPI from './contacts'; -import { - Contact, - ContactCreate, - ContactCreateParams, - ContactDeleteResponse, - ContactListParams, - Contacts, - ContactsSkipLimit, -} from './contacts'; +import { Contact, ContactCreate, ContactCreateParams, ContactDeleteResponse, ContactListParams, Contacts, ContactsSkipLimit } from './contacts'; import * as LettersAPI from './letters'; -import { - AddressPlacement, - AttachedPdf, - Letter, - LetterCreateParams, - LetterListParams, - LetterRetrieveURLResponse, - LetterSize, - Letters, - LettersSkipLimit, - PlasticCard, -} from './letters'; +import { AddressPlacement, AttachedPdf, Letter, LetterCreateParams, LetterListParams, LetterRetrieveURLResponse, LetterSize, Letters, LettersSkipLimit, PlasticCard } from './letters'; import * as MailingListImportsAPI from './mailing-list-imports'; -import { - FileType, - MailingListImportCreateParams, - MailingListImportDeleteResponse, - MailingListImportListParams, - MailingListImportResponse, - MailingListImportResponsesSkipLimit, - MailingListImportUpdateParams, - MailingListImports, - VerificationStatusCount, -} from './mailing-list-imports'; +import { FileType, MailingListImportCreateParams, MailingListImportDeleteResponse, MailingListImportListParams, MailingListImportResponse, MailingListImportResponsesSkipLimit, MailingListImportUpdateParams, MailingListImports, VerificationStatusCount } from './mailing-list-imports'; import * as MailingListsAPI from './mailing-lists'; -import { - MailingList, - MailingListCreateParams, - MailingListDeleteResponse, - MailingListJobsParams, - MailingListListParams, - MailingListUpdate, - MailingListUpdateParams, - MailingLists, - MailingListsSkipLimit, -} from './mailing-lists'; +import { MailingList, MailingListCreateParams, MailingListDeleteResponse, MailingListJobsParams, MailingListListParams, MailingListUpdate, MailingListUpdateParams, MailingLists, MailingListsSkipLimit } from './mailing-lists'; import * as PostcardsAPI from './postcards'; -import { - Postcard, - PostcardCreateParams, - PostcardListParams, - PostcardRetrieveURLResponse, - Postcards, - PostcardsSkipLimit, -} from './postcards'; +import { Postcard, PostcardCreateParams, PostcardListParams, PostcardRetrieveURLResponse, Postcards, PostcardsSkipLimit } from './postcards'; import * as SelfMailersAPI from './self-mailers'; -import { - SelfMailer, - SelfMailerCreateParams, - SelfMailerListParams, - SelfMailerRetrieveURLResponse, - SelfMailers, - SelfMailersSkipLimit, -} from './self-mailers'; +import { SelfMailer, SelfMailerCreateParams, SelfMailerListParams, SelfMailerRetrieveURLResponse, SelfMailers, SelfMailersSkipLimit } from './self-mailers'; import * as SubOrganizationsAPI from './sub-organizations'; -import { - EmailPreferences, - SubOrganization, - SubOrganizationListParams, - SubOrganizationRetrieveUsersParams, - SubOrganizationRetrieveUsersResponse, - SubOrganizationUpdateParams, - SubOrganizationUpdateResponse, - SubOrganizations, - SubOrganizationsSkipLimit, -} from './sub-organizations'; +import { EmailPreferences, SubOrganization, SubOrganizationListParams, SubOrganizationRetrieveUsersParams, SubOrganizationRetrieveUsersResponse, SubOrganizationUpdateParams, SubOrganizationUpdateResponse, SubOrganizations, SubOrganizationsSkipLimit } from './sub-organizations'; import * as TemplatesAPI from './templates'; -import { - Template, - TemplateCreateParams, - TemplateDeleteResponse, - TemplateListParams, - TemplateUpdateParams, - Templates, - TemplatesSkipLimit, -} from './templates'; +import { Template, TemplateCreateParams, TemplateDeleteResponse, TemplateListParams, TemplateUpdateParams, Templates, TemplatesSkipLimit } from './templates'; import * as OrderProfilesAPI from './order-profiles/order-profiles'; import { OrderProfiles } from './order-profiles/order-profiles'; import * as ReportsAPI from './reports/reports'; -import { - DeletedResponse, - Report, - ReportCreateParams, - ReportListParams, - ReportSampleParams, - ReportUpdateParams, - Reports, - ReportsSkipLimit, -} from './reports/reports'; +import { DeletedResponse, Report, ReportCreateParams, ReportListParams, ReportSampleParams, ReportUpdateParams, Reports, ReportsSkipLimit } from './reports/reports'; export class PrintMail extends APIResource { bankAccounts: BankAccountsAPI.BankAccounts = new BankAccountsAPI.BankAccounts(this._client); @@ -140,17 +34,13 @@ export class PrintMail extends APIResource { cheques: ChequesAPI.Cheques = new ChequesAPI.Cheques(this._client); contacts: ContactsAPI.Contacts = new ContactsAPI.Contacts(this._client); letters: LettersAPI.Letters = new LettersAPI.Letters(this._client); - mailingListImports: MailingListImportsAPI.MailingListImports = new MailingListImportsAPI.MailingListImports( - this._client, - ); + mailingListImports: MailingListImportsAPI.MailingListImports = new MailingListImportsAPI.MailingListImports(this._client); mailingLists: MailingListsAPI.MailingLists = new MailingListsAPI.MailingLists(this._client); orderProfiles: OrderProfilesAPI.OrderProfiles = new OrderProfilesAPI.OrderProfiles(this._client); postcards: PostcardsAPI.Postcards = new PostcardsAPI.Postcards(this._client); reports: ReportsAPI.Reports = new ReportsAPI.Reports(this._client); selfMailers: SelfMailersAPI.SelfMailers = new SelfMailersAPI.SelfMailers(this._client); - subOrganizations: SubOrganizationsAPI.SubOrganizations = new SubOrganizationsAPI.SubOrganizations( - this._client, - ); + subOrganizations: SubOrganizationsAPI.SubOrganizations = new SubOrganizationsAPI.SubOrganizations(this._client); templates: TemplatesAPI.Templates = new TemplatesAPI.Templates(this._client); } @@ -335,7 +225,7 @@ PrintMail.Templates = Templates; export declare namespace PrintMail { export { type ContactCreateWithCompanyName as ContactCreateWithCompanyName, - type ContactCreateWithFirstName as ContactCreateWithFirstName, + type ContactCreateWithFirstName as ContactCreateWithFirstName }; export { @@ -345,7 +235,7 @@ export declare namespace PrintMail { type BankAccountDeleteResponse as BankAccountDeleteResponse, type BankAccountsSkipLimit as BankAccountsSkipLimit, type BankAccountCreateParams as BankAccountCreateParams, - type BankAccountListParams as BankAccountListParams, + type BankAccountListParams as BankAccountListParams }; export { @@ -356,7 +246,7 @@ export declare namespace PrintMail { type CampaignCreateParams as CampaignCreateParams, type CampaignUpdateParams as CampaignUpdateParams, type CampaignListParams as CampaignListParams, - type CampaignSendParams as CampaignSendParams, + type CampaignSendParams as CampaignSendParams }; export { @@ -367,7 +257,7 @@ export declare namespace PrintMail { type ChequeRetrieveURLResponse as ChequeRetrieveURLResponse, type ChequesSkipLimit as ChequesSkipLimit, type ChequeCreateParams as ChequeCreateParams, - type ChequeListParams as ChequeListParams, + type ChequeListParams as ChequeListParams }; export { @@ -377,7 +267,7 @@ export declare namespace PrintMail { type ContactDeleteResponse as ContactDeleteResponse, type ContactsSkipLimit as ContactsSkipLimit, type ContactCreateParams as ContactCreateParams, - type ContactListParams as ContactListParams, + type ContactListParams as ContactListParams }; export { @@ -390,7 +280,7 @@ export declare namespace PrintMail { type LetterRetrieveURLResponse as LetterRetrieveURLResponse, type LettersSkipLimit as LettersSkipLimit, type LetterCreateParams as LetterCreateParams, - type LetterListParams as LetterListParams, + type LetterListParams as LetterListParams }; export { @@ -402,7 +292,7 @@ export declare namespace PrintMail { type MailingListImportResponsesSkipLimit as MailingListImportResponsesSkipLimit, type MailingListImportCreateParams as MailingListImportCreateParams, type MailingListImportUpdateParams as MailingListImportUpdateParams, - type MailingListImportListParams as MailingListImportListParams, + type MailingListImportListParams as MailingListImportListParams }; export { @@ -414,10 +304,12 @@ export declare namespace PrintMail { type MailingListCreateParams as MailingListCreateParams, type MailingListUpdateParams as MailingListUpdateParams, type MailingListListParams as MailingListListParams, - type MailingListJobsParams as MailingListJobsParams, + type MailingListJobsParams as MailingListJobsParams }; - export { OrderProfiles as OrderProfiles }; + export { + OrderProfiles as OrderProfiles + }; export { Postcards as Postcards, @@ -425,7 +317,7 @@ export declare namespace PrintMail { type PostcardRetrieveURLResponse as PostcardRetrieveURLResponse, type PostcardsSkipLimit as PostcardsSkipLimit, type PostcardCreateParams as PostcardCreateParams, - type PostcardListParams as PostcardListParams, + type PostcardListParams as PostcardListParams }; export { @@ -436,7 +328,7 @@ export declare namespace PrintMail { type ReportCreateParams as ReportCreateParams, type ReportUpdateParams as ReportUpdateParams, type ReportListParams as ReportListParams, - type ReportSampleParams as ReportSampleParams, + type ReportSampleParams as ReportSampleParams }; export { @@ -445,7 +337,7 @@ export declare namespace PrintMail { type SelfMailerRetrieveURLResponse as SelfMailerRetrieveURLResponse, type SelfMailersSkipLimit as SelfMailersSkipLimit, type SelfMailerCreateParams as SelfMailerCreateParams, - type SelfMailerListParams as SelfMailerListParams, + type SelfMailerListParams as SelfMailerListParams }; export { @@ -457,7 +349,7 @@ export declare namespace PrintMail { type SubOrganizationsSkipLimit as SubOrganizationsSkipLimit, type SubOrganizationUpdateParams as SubOrganizationUpdateParams, type SubOrganizationListParams as SubOrganizationListParams, - type SubOrganizationRetrieveUsersParams as SubOrganizationRetrieveUsersParams, + type SubOrganizationRetrieveUsersParams as SubOrganizationRetrieveUsersParams }; export { @@ -467,6 +359,6 @@ export declare namespace PrintMail { type TemplatesSkipLimit as TemplatesSkipLimit, type TemplateCreateParams as TemplateCreateParams, type TemplateUpdateParams as TemplateUpdateParams, - type TemplateListParams as TemplateListParams, + type TemplateListParams as TemplateListParams }; } diff --git a/src/resources/print-mail/reports/exports.ts b/src/resources/print-mail/reports/exports.ts index a80aef3..e31705a 100644 --- a/src/resources/print-mail/reports/exports.ts +++ b/src/resources/print-mail/reports/exports.ts @@ -49,12 +49,8 @@ export class Exports extends APIResource { * ); * ``` */ - retrieve( - exportID: string, - params: ExportRetrieveParams, - options?: RequestOptions, - ): APIPromise { - const { reportID } = params; + retrieve(exportID: string, params: ExportRetrieveParams, options?: RequestOptions): APIPromise { + const { reportID } = params return this._client.get(path`/print-mail/v1/reports/${reportID}/exports/${exportID}`, options); } @@ -72,12 +68,8 @@ export class Exports extends APIResource { * ); * ``` */ - delete( - exportID: string, - params: ExportDeleteParams, - options?: RequestOptions, - ): APIPromise { - const { reportID } = params; + delete(exportID: string, params: ExportDeleteParams, options?: RequestOptions): APIPromise { + const { reportID } = params return this._client.delete(path`/print-mail/v1/reports/${reportID}/exports/${exportID}`, options); } } @@ -211,6 +203,6 @@ export declare namespace Exports { type ReportExport as ReportExport, type ExportCreateParams as ExportCreateParams, type ExportRetrieveParams as ExportRetrieveParams, - type ExportDeleteParams as ExportDeleteParams, + type ExportDeleteParams as ExportDeleteParams }; } diff --git a/src/resources/print-mail/reports/index.ts b/src/resources/print-mail/reports/index.ts index 023854e..b44254b 100644 --- a/src/resources/print-mail/reports/index.ts +++ b/src/resources/print-mail/reports/index.ts @@ -1,20 +1,5 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { - Exports, - type ReportExport, - type ExportCreateParams, - type ExportRetrieveParams, - type ExportDeleteParams, -} from './exports'; -export { - Reports, - type DeletedResponse, - type Report, - type ReportCreateParams, - type ReportUpdateParams, - type ReportListParams, - type ReportSampleParams, - type ReportsSkipLimit, -} from './reports'; -export { Samples, type ReportSample, type ReportSampleCreateBase, type SampleCreateParams } from './samples'; +export { Exports, type ReportExport, type ExportCreateParams, type ExportRetrieveParams, type ExportDeleteParams } from './exports';; +export { Reports, type DeletedResponse, type Report, type ReportCreateParams, type ReportUpdateParams, type ReportListParams, type ReportSampleParams, type ReportsSkipLimit } from './reports';; +export { Samples, type ReportSample, type ReportSampleCreateBase, type SampleCreateParams } from './samples';; diff --git a/src/resources/print-mail/reports/reports.ts b/src/resources/print-mail/reports/reports.ts index 44d75b4..b6bcc25 100644 --- a/src/resources/print-mail/reports/reports.ts +++ b/src/resources/print-mail/reports/reports.ts @@ -2,13 +2,7 @@ import { APIResource } from '../../../core/resource'; import * as ExportsAPI from './exports'; -import { - ExportCreateParams, - ExportDeleteParams, - ExportRetrieveParams, - Exports, - ReportExport, -} from './exports'; +import { ExportCreateParams, ExportDeleteParams, ExportRetrieveParams, Exports, ReportExport } from './exports'; import * as SamplesAPI from './samples'; import { ReportSample, ReportSampleCreateBase, SampleCreateParams, Samples } from './samples'; import { APIPromise } from '../../../core/api-promise'; @@ -88,10 +82,7 @@ export class Reports extends APIResource { * } * ``` */ - list( - query: ReportListParams | null | undefined = {}, - options?: RequestOptions, - ): PagePromise { + list(query: ReportListParams | null | undefined = {}, options?: RequestOptions): PagePromise { return this._client.getAPIList('/print-mail/v1/reports', SkipLimit, { query, ...options }); } @@ -128,7 +119,7 @@ export class Reports extends APIResource { } } -export type ReportsSkipLimit = SkipLimit; +export type ReportsSkipLimit = SkipLimit /** * Generic response for delete operations. @@ -264,14 +255,14 @@ export declare namespace Reports { type ReportCreateParams as ReportCreateParams, type ReportUpdateParams as ReportUpdateParams, type ReportListParams as ReportListParams, - type ReportSampleParams as ReportSampleParams, + type ReportSampleParams as ReportSampleParams }; export { Samples as Samples, type ReportSample as ReportSample, type ReportSampleCreateBase as ReportSampleCreateBase, - type SampleCreateParams as SampleCreateParams, + type SampleCreateParams as SampleCreateParams }; export { @@ -279,6 +270,6 @@ export declare namespace Reports { type ReportExport as ReportExport, type ExportCreateParams as ExportCreateParams, type ExportRetrieveParams as ExportRetrieveParams, - type ExportDeleteParams as ExportDeleteParams, + type ExportDeleteParams as ExportDeleteParams }; } diff --git a/src/resources/print-mail/reports/samples.ts b/src/resources/print-mail/reports/samples.ts index 71df1d4..90abe75 100644 --- a/src/resources/print-mail/reports/samples.ts +++ b/src/resources/print-mail/reports/samples.ts @@ -86,6 +86,6 @@ export declare namespace Samples { export { type ReportSample as ReportSample, type ReportSampleCreateBase as ReportSampleCreateBase, - type SampleCreateParams as SampleCreateParams, + type SampleCreateParams as SampleCreateParams }; } diff --git a/src/resources/print-mail/self-mailers.ts b/src/resources/print-mail/self-mailers.ts index faccc37..daa1ec1 100644 --- a/src/resources/print-mail/self-mailers.ts +++ b/src/resources/print-mail/self-mailers.ts @@ -59,14 +59,8 @@ export class SelfMailers extends APIResource { * } * ``` */ - list( - query: SelfMailerListParams | null | undefined = {}, - options?: RequestOptions, - ): PagePromise { - return this._client.getAPIList('/print-mail/v1/self_mailers', SkipLimit, { - query, - ...options, - }); + list(query: SelfMailerListParams | null | undefined = {}, options?: RequestOptions): PagePromise { + return this._client.getAPIList('/print-mail/v1/self_mailers', SkipLimit, { query, ...options }); } /** @@ -101,7 +95,7 @@ export class SelfMailers extends APIResource { } } -export type SelfMailersSkipLimit = SkipLimit; +export type SelfMailersSkipLimit = SkipLimit export interface SelfMailer { /** @@ -128,33 +122,7 @@ export interface SelfMailer { * The mailing class of this order. This determines the speed and cost of delivery. * See `OrderMailingClass` for more details. */ - mailingClass: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * Always `self_mailer`. @@ -289,11 +257,7 @@ export interface SelfMailerRetrieveURLResponse { url: string; } -export type SelfMailerCreateParams = - | SelfMailerCreateParams.SelfMailerCreateWithHTML - | SelfMailerCreateParams.SelfMailerCreateWithTemplate - | SelfMailerCreateParams.SelfMailerCreateWithPdfurl - | SelfMailerCreateParams.SelfMailerCreateWithPdfFile; +export type SelfMailerCreateParams = SelfMailerCreateParams.SelfMailerCreateWithHTML | SelfMailerCreateParams.SelfMailerCreateWithTemplate | SelfMailerCreateParams.SelfMailerCreateWithPdfurl | SelfMailerCreateParams.SelfMailerCreateWithPdfFile export declare namespace SelfMailerCreateParams { export interface SelfMailerCreateWithHTML { @@ -338,33 +302,7 @@ export declare namespace SelfMailerCreateParams { * The mailing class of this order. If not provided, automatically set to * `first_class`. */ - mailingClass?: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass?: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * These will be merged with the variables in the template or HTML you create this @@ -437,33 +375,7 @@ export declare namespace SelfMailerCreateParams { * The mailing class of this order. If not provided, automatically set to * `first_class`. */ - mailingClass?: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass?: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * These will be merged with the variables in the template or HTML you create this @@ -521,33 +433,7 @@ export declare namespace SelfMailerCreateParams { * The mailing class of this order. If not provided, automatically set to * `first_class`. */ - mailingClass?: - | 'first_class' - | 'standard_class' - | 'express' - | 'certified' - | 'certified_return_receipt' - | 'registered' - | 'usps_first_class' - | 'usps_standard_class' - | 'usps_eddm' - | 'usps_express_2_day' - | 'usps_express_3_day' - | 'usps_first_class_certified' - | 'usps_first_class_certified_return_receipt' - | 'usps_first_class_registered' - | 'usps_express_3_day_signature_confirmation' - | 'usps_express_3_day_certified' - | 'usps_express_3_day_certified_return_receipt' - | 'ca_post_lettermail' - | 'ca_post_personalized' - | 'ca_post_neighbourhood_mail' - | 'ups_express_overnight' - | 'ups_express_2_day' - | 'ups_express_3_day' - | 'royal_mail_first_class' - | 'royal_mail_second_class' - | 'au_post_second_class'; + mailingClass?: 'first_class' | 'standard_class' | 'express' | 'certified' | 'certified_return_receipt' | 'registered' | 'usps_first_class' | 'usps_standard_class' | 'usps_eddm' | 'usps_express_2_day' | 'usps_express_3_day' | 'usps_first_class_certified' | 'usps_first_class_certified_return_receipt' | 'usps_first_class_registered' | 'usps_express_3_day_signature_confirmation' | 'usps_express_3_day_certified' | 'usps_express_3_day_certified_return_receipt' | 'ca_post_lettermail' | 'ca_post_personalized' | 'ca_post_neighbourhood_mail' | 'ups_express_overnight' | 'ups_express_2_day' | 'ups_express_3_day' | 'royal_mail_first_class' | 'royal_mail_second_class' | 'au_post_second_class'; /** * These will be merged with the variables in the template or HTML you create this @@ -587,6 +473,6 @@ export declare namespace SelfMailers { type SelfMailerRetrieveURLResponse as SelfMailerRetrieveURLResponse, type SelfMailersSkipLimit as SelfMailersSkipLimit, type SelfMailerCreateParams as SelfMailerCreateParams, - type SelfMailerListParams as SelfMailerListParams, + type SelfMailerListParams as SelfMailerListParams }; } diff --git a/src/resources/print-mail/sub-organizations.ts b/src/resources/print-mail/sub-organizations.ts index 0cd6ad6..5c9510c 100644 --- a/src/resources/print-mail/sub-organizations.ts +++ b/src/resources/print-mail/sub-organizations.ts @@ -51,10 +51,7 @@ export class SubOrganizations extends APIResource { * }); * ``` */ - update( - body: SubOrganizationUpdateParams, - options?: RequestOptions, - ): APIPromise { + update(body: SubOrganizationUpdateParams, options?: RequestOptions): APIPromise { return this._client.post('/print-mail/v1/sub_organizations', { body, ...options }); } @@ -69,14 +66,8 @@ export class SubOrganizations extends APIResource { * } * ``` */ - list( - query: SubOrganizationListParams | null | undefined = {}, - options?: RequestOptions, - ): PagePromise { - return this._client.getAPIList('/print-mail/v1/sub_organizations', SkipLimit, { - query, - ...options, - }); + list(query: SubOrganizationListParams | null | undefined = {}, options?: RequestOptions): PagePromise { + return this._client.getAPIList('/print-mail/v1/sub_organizations', SkipLimit, { query, ...options }); } /** @@ -90,16 +81,12 @@ export class SubOrganizations extends APIResource { * ); * ``` */ - retrieveUsers( - id: string, - query: SubOrganizationRetrieveUsersParams | null | undefined = {}, - options?: RequestOptions, - ): APIPromise { + retrieveUsers(id: string, query: SubOrganizationRetrieveUsersParams | null | undefined = {}, options?: RequestOptions): APIPromise { return this._client.get(path`/print-mail/v1/sub_organizations/${id}/users`, { query, ...options }); } } -export type SubOrganizationsSkipLimit = SkipLimit; +export type SubOrganizationsSkipLimit = SkipLimit /** * A set of preferences for how a user should receive emails. @@ -260,8 +247,7 @@ export namespace SubOrganizationUpdateResponse { } } -export type SubOrganizationRetrieveUsersResponse = - Array; +export type SubOrganizationRetrieveUsersResponse = Array export namespace SubOrganizationRetrieveUsersResponse { /** @@ -393,6 +379,6 @@ export declare namespace SubOrganizations { type SubOrganizationsSkipLimit as SubOrganizationsSkipLimit, type SubOrganizationUpdateParams as SubOrganizationUpdateParams, type SubOrganizationListParams as SubOrganizationListParams, - type SubOrganizationRetrieveUsersParams as SubOrganizationRetrieveUsersParams, + type SubOrganizationRetrieveUsersParams as SubOrganizationRetrieveUsersParams }; } diff --git a/src/resources/print-mail/templates.ts b/src/resources/print-mail/templates.ts index a6fdf40..d732afa 100644 --- a/src/resources/print-mail/templates.ts +++ b/src/resources/print-mail/templates.ts @@ -66,10 +66,7 @@ export class Templates extends APIResource { * } * ``` */ - list( - query: TemplateListParams | null | undefined = {}, - options?: RequestOptions, - ): PagePromise { + list(query: TemplateListParams | null | undefined = {}, options?: RequestOptions): PagePromise { return this._client.getAPIList('/print-mail/v1/templates', SkipLimit