diff --git a/package.json b/package.json index fb39ccd..e22090f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@trycourier/courier", - "version": "v6.0.7", + "version": "v6.0.8", "private": false, "repository": "https://github.com/trycourier/courier-node", "main": "./index.js", diff --git a/src/Client.ts b/src/Client.ts index b1ccc4a..87112f6 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -26,6 +26,7 @@ export declare namespace CourierClient { interface Options { environment?: core.Supplier; authorizationToken?: core.Supplier; + fetcher?: core.FetchFunction; } interface RequestOptions { @@ -49,7 +50,7 @@ export class CourierClient { request: Courier.SendMessageRequest, requestOptions?: CourierClient.IdempotentRequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, "/send" @@ -59,7 +60,7 @@ export class CourierClient { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", "Idempotency-Key": requestOptions?.idempotencyKey != null ? requestOptions?.idempotencyKey : undefined, "X-Idempotency-Expiration": requestOptions?.idempotencyExpiry != null diff --git a/src/api/resources/audiences/client/Client.ts b/src/api/resources/audiences/client/Client.ts index 7bc434d..0c36953 100644 --- a/src/api/resources/audiences/client/Client.ts +++ b/src/api/resources/audiences/client/Client.ts @@ -12,6 +12,7 @@ export declare namespace Audiences { interface Options { environment?: core.Supplier; authorizationToken?: core.Supplier; + fetcher?: core.FetchFunction; } interface RequestOptions { @@ -27,7 +28,7 @@ export class Audiences { * Returns the specified audience by id. */ public async get(audienceId: string, requestOptions?: Audiences.RequestOptions): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/audiences/${audienceId}` @@ -37,7 +38,7 @@ export class Audiences { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -77,7 +78,7 @@ export class Audiences { request: Courier.AudienceUpdateParams = {}, requestOptions?: Audiences.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/audiences/${audienceId}` @@ -87,7 +88,7 @@ export class Audiences { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", body: request, @@ -124,7 +125,7 @@ export class Audiences { * Deletes the specified audience. */ public async delete(audienceId: string, requestOptions?: Audiences.RequestOptions): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/audiences/${audienceId}` @@ -134,7 +135,7 @@ export class Audiences { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -181,7 +182,7 @@ export class Audiences { _queryParams["cursor"] = cursor; } - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/audiences/${audienceId}/members` @@ -191,7 +192,7 @@ export class Audiences { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", queryParameters: _queryParams, @@ -243,7 +244,7 @@ export class Audiences { _queryParams["cursor"] = cursor; } - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, "/audiences" @@ -253,7 +254,7 @@ export class Audiences { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", queryParameters: _queryParams, diff --git a/src/api/resources/auditEvents/client/Client.ts b/src/api/resources/auditEvents/client/Client.ts index c3657c7..5994b50 100644 --- a/src/api/resources/auditEvents/client/Client.ts +++ b/src/api/resources/auditEvents/client/Client.ts @@ -12,6 +12,7 @@ export declare namespace AuditEvents { interface Options { environment?: core.Supplier; authorizationToken?: core.Supplier; + fetcher?: core.FetchFunction; } interface RequestOptions { @@ -36,7 +37,7 @@ export class AuditEvents { _queryParams["cursor"] = cursor; } - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, "/audit-events" @@ -46,7 +47,7 @@ export class AuditEvents { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", queryParameters: _queryParams, @@ -83,7 +84,7 @@ export class AuditEvents { * Fetch a specific audit event by ID. */ public async get(auditEventId: string, requestOptions?: AuditEvents.RequestOptions): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/audit-events/${auditEventId}` @@ -93,7 +94,7 @@ export class AuditEvents { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, diff --git a/src/api/resources/authTokens/client/Client.ts b/src/api/resources/authTokens/client/Client.ts index 39b6a66..7f3e516 100644 --- a/src/api/resources/authTokens/client/Client.ts +++ b/src/api/resources/authTokens/client/Client.ts @@ -12,6 +12,7 @@ export declare namespace AuthTokens { interface Options { environment?: core.Supplier; authorizationToken?: core.Supplier; + fetcher?: core.FetchFunction; } interface RequestOptions { @@ -35,7 +36,7 @@ export class AuthTokens { request: Courier.IssueTokenParams, requestOptions?: AuthTokens.IdempotentRequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, "/auth/issue-token" @@ -45,7 +46,7 @@ export class AuthTokens { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", "Idempotency-Key": requestOptions?.idempotencyKey != null ? requestOptions?.idempotencyKey : undefined, "X-Idempotency-Expiration": requestOptions?.idempotencyExpiry != null diff --git a/src/api/resources/automations/client/Client.ts b/src/api/resources/automations/client/Client.ts index 6ac7e6b..c7a15f4 100644 --- a/src/api/resources/automations/client/Client.ts +++ b/src/api/resources/automations/client/Client.ts @@ -12,6 +12,7 @@ export declare namespace Automations { interface Options { environment?: core.Supplier; authorizationToken?: core.Supplier; + fetcher?: core.FetchFunction; } interface RequestOptions { @@ -36,7 +37,7 @@ export class Automations { request: Courier.AutomationInvokeParams, requestOptions?: Automations.IdempotentRequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/automations/${templateId}/invoke` @@ -46,7 +47,7 @@ export class Automations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", "Idempotency-Key": requestOptions?.idempotencyKey != null ? requestOptions?.idempotencyKey : undefined, "X-Idempotency-Expiration": requestOptions?.idempotencyExpiry != null @@ -91,7 +92,7 @@ export class Automations { request: Courier.AutomationAdHocInvokeParams, requestOptions?: Automations.IdempotentRequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, "/automations/invoke" @@ -101,7 +102,7 @@ export class Automations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", "Idempotency-Key": requestOptions?.idempotencyKey != null ? requestOptions?.idempotencyKey : undefined, "X-Idempotency-Expiration": requestOptions?.idempotencyExpiry != null diff --git a/src/api/resources/brands/client/Client.ts b/src/api/resources/brands/client/Client.ts index 31180ea..2de04c5 100644 --- a/src/api/resources/brands/client/Client.ts +++ b/src/api/resources/brands/client/Client.ts @@ -12,6 +12,7 @@ export declare namespace Brands { interface Options { environment?: core.Supplier; authorizationToken?: core.Supplier; + fetcher?: core.FetchFunction; } interface RequestOptions { @@ -37,7 +38,7 @@ export class Brands { request: Courier.BrandParameters, requestOptions?: Brands.IdempotentRequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, "/brands" @@ -47,7 +48,7 @@ export class Brands { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", "Idempotency-Key": requestOptions?.idempotencyKey != null ? requestOptions?.idempotencyKey : undefined, "X-Idempotency-Expiration": requestOptions?.idempotencyExpiry != null @@ -98,7 +99,7 @@ export class Brands { * Fetch a specific brand by brand ID. */ public async get(brandId: string, requestOptions?: Brands.RequestOptions): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/brands/${brandId}` @@ -108,7 +109,7 @@ export class Brands { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -153,7 +154,7 @@ export class Brands { _queryParams["cursor"] = cursor; } - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, "/brands" @@ -163,7 +164,7 @@ export class Brands { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", queryParameters: _queryParams, @@ -201,7 +202,7 @@ export class Brands { * @throws {@link Courier.ConflictError} */ public async delete(brandId: string, requestOptions?: Brands.RequestOptions): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/brands/${brandId}` @@ -211,7 +212,7 @@ export class Brands { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -256,7 +257,7 @@ export class Brands { request: Courier.BrandUpdateParameters, requestOptions?: Brands.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/brands/${brandId}` @@ -266,7 +267,7 @@ export class Brands { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", body: request, diff --git a/src/api/resources/bulk/client/Client.ts b/src/api/resources/bulk/client/Client.ts index 72adc6b..ce46605 100644 --- a/src/api/resources/bulk/client/Client.ts +++ b/src/api/resources/bulk/client/Client.ts @@ -12,6 +12,7 @@ export declare namespace Bulk { interface Options { environment?: core.Supplier; authorizationToken?: core.Supplier; + fetcher?: core.FetchFunction; } interface RequestOptions { @@ -35,7 +36,7 @@ export class Bulk { request: Courier.BulkCreateJobParams, requestOptions?: Bulk.IdempotentRequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, "/bulk" @@ -45,7 +46,7 @@ export class Bulk { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", "Idempotency-Key": requestOptions?.idempotencyKey != null ? requestOptions?.idempotencyKey : undefined, "X-Idempotency-Expiration": requestOptions?.idempotencyExpiry != null @@ -96,7 +97,7 @@ export class Bulk { request: Courier.BulkIngestUsersParams, requestOptions?: Bulk.IdempotentRequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/bulk/${jobId}` @@ -106,7 +107,7 @@ export class Bulk { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", "Idempotency-Key": requestOptions?.idempotencyKey != null ? requestOptions?.idempotencyKey : undefined, "X-Idempotency-Expiration": requestOptions?.idempotencyExpiry != null @@ -149,7 +150,7 @@ export class Bulk { * @throws {@link Courier.BadRequestError} */ public async runJob(jobId: string, requestOptions?: Bulk.IdempotentRequestOptions): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/bulk/${jobId}/run` @@ -159,7 +160,7 @@ export class Bulk { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", "Idempotency-Key": requestOptions?.idempotencyKey != null ? requestOptions?.idempotencyKey : undefined, "X-Idempotency-Expiration": requestOptions?.idempotencyExpiry != null @@ -206,7 +207,7 @@ export class Bulk { * @throws {@link Courier.BadRequestError} */ public async getJob(jobId: string, requestOptions?: Bulk.RequestOptions): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/bulk/${jobId}` @@ -216,7 +217,7 @@ export class Bulk { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -261,7 +262,7 @@ export class Bulk { jobId: string, requestOptions?: Bulk.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/bulk/${jobId}/users` @@ -271,7 +272,7 @@ export class Bulk { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, diff --git a/src/api/resources/lists/client/Client.ts b/src/api/resources/lists/client/Client.ts index c52e0db..09be6e1 100644 --- a/src/api/resources/lists/client/Client.ts +++ b/src/api/resources/lists/client/Client.ts @@ -12,6 +12,7 @@ export declare namespace Lists { interface Options { environment?: core.Supplier; authorizationToken?: core.Supplier; + fetcher?: core.FetchFunction; } interface RequestOptions { @@ -46,7 +47,7 @@ export class Lists { _queryParams["pattern"] = pattern; } - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, "/lists" @@ -56,7 +57,7 @@ export class Lists { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", queryParameters: _queryParams, @@ -113,7 +114,7 @@ export class Lists { _queryParams["pattern"] = pattern; } - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/lists/${listId}` @@ -123,7 +124,7 @@ export class Lists { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", queryParameters: _queryParams, @@ -169,7 +170,7 @@ export class Lists { request: Courier.ListPutParams, requestOptions?: Lists.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/lists/${listId}` @@ -179,7 +180,7 @@ export class Lists { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", body: request, @@ -216,7 +217,7 @@ export class Lists { * Delete a list by list ID. */ public async delete(listId: string, requestOptions?: Lists.RequestOptions): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/lists/${listId}` @@ -226,7 +227,7 @@ export class Lists { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -262,7 +263,7 @@ export class Lists { * Restore a previously deleted list. */ public async restore(listId: string, requestOptions?: Lists.RequestOptions): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/lists/${listId}/restore` @@ -272,7 +273,7 @@ export class Lists { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -319,7 +320,7 @@ export class Lists { _queryParams["cursor"] = cursor; } - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/lists/${listId}/subscriptions` @@ -329,7 +330,7 @@ export class Lists { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", queryParameters: _queryParams, @@ -376,7 +377,7 @@ export class Lists { request: Courier.PutSubscriptionsRecipient[], requestOptions?: Lists.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/lists/${listId}/subscriptions` @@ -386,7 +387,7 @@ export class Lists { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", body: request, @@ -433,7 +434,7 @@ export class Lists { request: Courier.PutSubscriptionsRecipient[], requestOptions?: Lists.IdempotentRequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/lists/${listId}/subscriptions` @@ -443,7 +444,7 @@ export class Lists { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", "Idempotency-Key": requestOptions?.idempotencyKey != null ? requestOptions?.idempotencyKey : undefined, "X-Idempotency-Expiration": requestOptions?.idempotencyExpiry != null @@ -495,7 +496,7 @@ export class Lists { request: Courier.SubscribeUserToListRequest = {}, requestOptions?: Lists.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/lists/${listId}/subscriptions/${userId}` @@ -505,7 +506,7 @@ export class Lists { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", body: request, @@ -543,7 +544,7 @@ export class Lists { * @throws {@link Courier.NotFoundError} */ public async unsubscribe(listId: string, userId: string, requestOptions?: Lists.RequestOptions): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/lists/${listId}/subscriptions/${userId}` @@ -553,7 +554,7 @@ export class Lists { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, diff --git a/src/api/resources/messages/client/Client.ts b/src/api/resources/messages/client/Client.ts index decd354..0968153 100644 --- a/src/api/resources/messages/client/Client.ts +++ b/src/api/resources/messages/client/Client.ts @@ -12,6 +12,7 @@ export declare namespace Messages { interface Options { environment?: core.Supplier; authorizationToken?: core.Supplier; + fetcher?: core.FetchFunction; } interface RequestOptions { @@ -93,7 +94,7 @@ export class Messages { _queryParams["traceId"] = traceId; } - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, "messages" @@ -103,7 +104,7 @@ export class Messages { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", queryParameters: _queryParams, @@ -142,7 +143,7 @@ export class Messages { * @throws {@link Courier.MessageNotFoundError} */ public async get(messageId: string, requestOptions?: Messages.RequestOptions): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `messages/${messageId}` @@ -152,7 +153,7 @@ export class Messages { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -198,7 +199,7 @@ export class Messages { messageId: string, requestOptions?: Messages.IdempotentRequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `messages/${messageId}/cancel` @@ -208,7 +209,7 @@ export class Messages { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", "Idempotency-Key": requestOptions?.idempotencyKey != null ? requestOptions?.idempotencyKey : undefined, "X-Idempotency-Expiration": requestOptions?.idempotencyExpiry != null @@ -261,7 +262,7 @@ export class Messages { _queryParams["type"] = type_; } - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `messages/${messageId}/history` @@ -271,7 +272,7 @@ export class Messages { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", queryParameters: _queryParams, @@ -319,7 +320,7 @@ export class Messages { messageId: string, requestOptions?: Messages.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `messages/${messageId}/output` @@ -329,7 +330,7 @@ export class Messages { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -369,7 +370,7 @@ export class Messages { } public async archive(requestId: string, requestOptions?: Messages.RequestOptions): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `requests/${requestId}/archive` @@ -379,7 +380,7 @@ export class Messages { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, diff --git a/src/api/resources/notifications/client/Client.ts b/src/api/resources/notifications/client/Client.ts index ab14bbe..4914437 100644 --- a/src/api/resources/notifications/client/Client.ts +++ b/src/api/resources/notifications/client/Client.ts @@ -12,6 +12,7 @@ export declare namespace Notifications { interface Options { environment?: core.Supplier; authorizationToken?: core.Supplier; + fetcher?: core.FetchFunction; } interface RequestOptions { @@ -33,7 +34,7 @@ export class Notifications { _queryParams["cursor"] = cursor; } - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, "/notifications" @@ -43,7 +44,7 @@ export class Notifications { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", queryParameters: _queryParams, @@ -80,7 +81,7 @@ export class Notifications { id: string, requestOptions?: Notifications.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/notifications/${id}/content` @@ -90,7 +91,7 @@ export class Notifications { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -126,7 +127,7 @@ export class Notifications { id: string, requestOptions?: Notifications.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/notifications/${id}/draft/content` @@ -136,7 +137,7 @@ export class Notifications { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -173,7 +174,7 @@ export class Notifications { request: Courier.NotificationUpdateVariationsParams = {}, requestOptions?: Notifications.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/notifications/${id}/variations` @@ -183,7 +184,7 @@ export class Notifications { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", body: request, @@ -221,7 +222,7 @@ export class Notifications { request: Courier.NotificationDraftUpdateVariationsParams = {}, requestOptions?: Notifications.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/notifications/${id}/draft/variations` @@ -231,7 +232,7 @@ export class Notifications { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", body: request, @@ -269,7 +270,7 @@ export class Notifications { submissionId: string, requestOptions?: Notifications.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/notifications/${id}/${submissionId}/checks` @@ -279,7 +280,7 @@ export class Notifications { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -317,7 +318,7 @@ export class Notifications { request: Courier.SubmissionChecksReplaceParams, requestOptions?: Notifications.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/notifications/${id}/${submissionId}/checks` @@ -327,7 +328,7 @@ export class Notifications { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", body: request, @@ -365,7 +366,7 @@ export class Notifications { submissionId: string, requestOptions?: Notifications.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/notifications/${id}/${submissionId}/checks` @@ -375,7 +376,7 @@ export class Notifications { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, diff --git a/src/api/resources/profiles/client/Client.ts b/src/api/resources/profiles/client/Client.ts index 3c64768..83a7c1a 100644 --- a/src/api/resources/profiles/client/Client.ts +++ b/src/api/resources/profiles/client/Client.ts @@ -12,6 +12,7 @@ export declare namespace Profiles { interface Options { environment?: core.Supplier; authorizationToken?: core.Supplier; + fetcher?: core.FetchFunction; } interface RequestOptions { @@ -33,7 +34,7 @@ export class Profiles { * @throws {@link Courier.BadRequestError} */ public async get(userId: string, requestOptions?: Profiles.RequestOptions): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/profiles/${userId}` @@ -43,7 +44,7 @@ export class Profiles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -89,7 +90,7 @@ export class Profiles { request: Courier.MergeProfileRequest, requestOptions?: Profiles.IdempotentRequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/profiles/${userId}` @@ -99,7 +100,7 @@ export class Profiles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", "Idempotency-Key": requestOptions?.idempotencyKey != null ? requestOptions?.idempotencyKey : undefined, "X-Idempotency-Expiration": requestOptions?.idempotencyExpiry != null @@ -154,7 +155,7 @@ export class Profiles { request: Courier.ReplaceProfileRequest, requestOptions?: Profiles.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/profiles/${userId}` @@ -164,7 +165,7 @@ export class Profiles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", body: request, @@ -207,7 +208,7 @@ export class Profiles { * @throws {@link Courier.BadRequestError} */ public async delete(userId: string, requestOptions?: Profiles.RequestOptions): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/profiles/${userId}` @@ -217,7 +218,7 @@ export class Profiles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -269,7 +270,7 @@ export class Profiles { _queryParams["cursor"] = cursor; } - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/profiles/${userId}/lists` @@ -279,7 +280,7 @@ export class Profiles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", queryParameters: _queryParams, @@ -326,7 +327,7 @@ export class Profiles { request: Courier.SubscribeToListsRequest, requestOptions?: Profiles.IdempotentRequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/profiles/${userId}/lists` @@ -336,7 +337,7 @@ export class Profiles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", "Idempotency-Key": requestOptions?.idempotencyKey != null ? requestOptions?.idempotencyKey : undefined, "X-Idempotency-Expiration": requestOptions?.idempotencyExpiry != null @@ -387,7 +388,7 @@ export class Profiles { userId: string, requestOptions?: Profiles.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/profiles/${userId}/lists` @@ -397,7 +398,7 @@ export class Profiles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, diff --git a/src/api/resources/templates/client/Client.ts b/src/api/resources/templates/client/Client.ts index 111fc79..4d6ab57 100644 --- a/src/api/resources/templates/client/Client.ts +++ b/src/api/resources/templates/client/Client.ts @@ -12,6 +12,7 @@ export declare namespace Templates { interface Options { environment?: core.Supplier; authorizationToken?: core.Supplier; + fetcher?: core.FetchFunction; } interface RequestOptions { @@ -36,7 +37,7 @@ export class Templates { _queryParams["cursor"] = cursor; } - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, "/notifications" @@ -46,7 +47,7 @@ export class Templates { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", queryParameters: _queryParams, diff --git a/src/api/resources/tenants/client/Client.ts b/src/api/resources/tenants/client/Client.ts index fda5f84..5ac99eb 100644 --- a/src/api/resources/tenants/client/Client.ts +++ b/src/api/resources/tenants/client/Client.ts @@ -12,6 +12,7 @@ export declare namespace Tenants { interface Options { environment?: core.Supplier; authorizationToken?: core.Supplier; + fetcher?: core.FetchFunction; } interface RequestOptions { @@ -31,7 +32,7 @@ export class Tenants { request: Courier.TenantCreateOrReplaceParams, requestOptions?: Tenants.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/tenants/${tenantId}` @@ -41,7 +42,7 @@ export class Tenants { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", body: request, @@ -83,7 +84,7 @@ export class Tenants { * @throws {@link Courier.BadRequestError} */ public async get(tenantId: string, requestOptions?: Tenants.RequestOptions): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/tenants/${tenantId}` @@ -93,7 +94,7 @@ export class Tenants { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -131,7 +132,7 @@ export class Tenants { } public async list(requestOptions?: Tenants.RequestOptions): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, "/tenants" @@ -141,7 +142,7 @@ export class Tenants { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -174,7 +175,7 @@ export class Tenants { } public async delete(tenantId: string, requestOptions?: Tenants.RequestOptions): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/tenants/${tenantId}` @@ -184,7 +185,7 @@ export class Tenants { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -223,7 +224,7 @@ export class Tenants { tenantId: string, requestOptions?: Tenants.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/tenants/${tenantId}/users` @@ -233,7 +234,7 @@ export class Tenants { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, diff --git a/src/api/resources/translations/client/Client.ts b/src/api/resources/translations/client/Client.ts index f1f8346..8434522 100644 --- a/src/api/resources/translations/client/Client.ts +++ b/src/api/resources/translations/client/Client.ts @@ -12,6 +12,7 @@ export declare namespace Translations { interface Options { environment?: core.Supplier; authorizationToken?: core.Supplier; + fetcher?: core.FetchFunction; } interface RequestOptions { @@ -28,7 +29,7 @@ export class Translations { * @throws {@link Courier.NotFoundError} */ public async get(domain: string, locale: string, requestOptions?: Translations.RequestOptions): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/translations/${domain}/${locale}` @@ -38,7 +39,7 @@ export class Translations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -85,7 +86,7 @@ export class Translations { request: string, requestOptions?: Translations.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/translations/${domain}/${locale}` @@ -95,7 +96,7 @@ export class Translations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", body: request, diff --git a/src/api/resources/users/client/Client.ts b/src/api/resources/users/client/Client.ts index e88bdc1..7cb76be 100644 --- a/src/api/resources/users/client/Client.ts +++ b/src/api/resources/users/client/Client.ts @@ -12,6 +12,7 @@ export declare namespace Users { interface Options { environment?: core.Supplier; authorizationToken?: core.Supplier; + fetcher?: core.FetchFunction; } interface RequestOptions { diff --git a/src/api/resources/users/resources/preferences/client/Client.ts b/src/api/resources/users/resources/preferences/client/Client.ts index 5d548d3..8e6bfe7 100644 --- a/src/api/resources/users/resources/preferences/client/Client.ts +++ b/src/api/resources/users/resources/preferences/client/Client.ts @@ -12,6 +12,7 @@ export declare namespace Preferences { interface Options { environment?: core.Supplier; authorizationToken?: core.Supplier; + fetcher?: core.FetchFunction; } interface RequestOptions { @@ -31,7 +32,7 @@ export class Preferences { userId: string, requestOptions?: Preferences.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/users/${userId}/preferences` @@ -41,7 +42,7 @@ export class Preferences { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -87,7 +88,7 @@ export class Preferences { topicId: string, requestOptions?: Preferences.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/users/${userId}/preferences/${topicId}` @@ -97,7 +98,7 @@ export class Preferences { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -144,7 +145,7 @@ export class Preferences { request: Courier.users.UserPreferencesUpdateParams, requestOptions?: Preferences.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/users/${userId}/preferences/${topicId}` @@ -154,7 +155,7 @@ export class Preferences { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", body: request, diff --git a/src/api/resources/users/resources/tenants/client/Client.ts b/src/api/resources/users/resources/tenants/client/Client.ts index 5de0e5b..69f8617 100644 --- a/src/api/resources/users/resources/tenants/client/Client.ts +++ b/src/api/resources/users/resources/tenants/client/Client.ts @@ -12,6 +12,7 @@ export declare namespace Tenants { interface Options { environment?: core.Supplier; authorizationToken?: core.Supplier; + fetcher?: core.FetchFunction; } interface RequestOptions { @@ -35,7 +36,7 @@ export class Tenants { request: Courier.users.AddUserToMultipleTenantsParams, requestOptions?: Tenants.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `users/${userId}/tenants` @@ -45,7 +46,7 @@ export class Tenants { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", body: request, @@ -91,7 +92,7 @@ export class Tenants { request: Courier.users.AddUserToSingleTenantsParams, requestOptions?: Tenants.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `users/${userId}/tenants/${tenantId}` @@ -101,7 +102,7 @@ export class Tenants { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", body: request, @@ -134,11 +135,57 @@ export class Tenants { } } + /** + * Removes a user from any tenants they may have been associated with. + */ + public async removeAll(userId: string, requestOptions?: Tenants.RequestOptions): Promise { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, + `users/${userId}/tenants` + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "@trycourier/courier", + "X-Fern-SDK-Version": "v6.0.8", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return; + } + + if (_response.error.reason === "status-code") { + throw new errors.CourierError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.CourierError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + }); + case "timeout": + throw new errors.CourierTimeoutError(); + case "unknown": + throw new errors.CourierError({ + message: _response.error.errorMessage, + }); + } + } + /** * Removes a user from the supplied tenant. */ public async remove(userId: string, tenantId: string, requestOptions?: Tenants.RequestOptions): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `users/${userId}/tenants/${tenantId}` @@ -148,7 +195,7 @@ export class Tenants { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -198,7 +245,7 @@ export class Tenants { _queryParams["starting_after"] = startingAfter.toString(); } - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `users/${userId}/tenants` @@ -208,7 +255,7 @@ export class Tenants { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", queryParameters: _queryParams, diff --git a/src/api/resources/users/resources/tokens/client/Client.ts b/src/api/resources/users/resources/tokens/client/Client.ts index 7a9dc37..876dc7d 100644 --- a/src/api/resources/users/resources/tokens/client/Client.ts +++ b/src/api/resources/users/resources/tokens/client/Client.ts @@ -12,6 +12,7 @@ export declare namespace Tokens { interface Options { environment?: core.Supplier; authorizationToken?: core.Supplier; + fetcher?: core.FetchFunction; } interface RequestOptions { @@ -28,7 +29,7 @@ export class Tokens { * @throws {@link Courier.BadRequestError} */ public async addMultiple(userId: string, requestOptions?: Tokens.RequestOptions): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/users/${userId}/tokens` @@ -38,7 +39,7 @@ export class Tokens { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -85,7 +86,7 @@ export class Tokens { request: Courier.users.UserToken, requestOptions?: Tokens.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/users/${userId}/tokens/${token}` @@ -95,7 +96,7 @@ export class Tokens { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", body: request, @@ -143,7 +144,7 @@ export class Tokens { request: Courier.users.PatchUserTokenOpts, requestOptions?: Tokens.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/users/${userId}/tokens/${token}` @@ -153,7 +154,7 @@ export class Tokens { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", body: request, @@ -200,7 +201,7 @@ export class Tokens { token: string, requestOptions?: Tokens.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/users/${userId}/tokens/${token}` @@ -210,7 +211,7 @@ export class Tokens { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -255,7 +256,7 @@ export class Tokens { userId: string, requestOptions?: Tokens.RequestOptions ): Promise { - const _response = await core.fetcher({ + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, `/users/${userId}/tokens` @@ -265,7 +266,7 @@ export class Tokens { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "v6.0.7", + "X-Fern-SDK-Version": "v6.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,