From 5259476184e39099a8bfa83e1bb49f7d30641f8e Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 13:19:22 +0000 Subject: [PATCH] SDK regeneration --- package.json | 10 +- src/Client.ts | 13 +- src/api/resources/audiences/client/Client.ts | 24 +- ...equest.ts => AudienceMembersListParams.ts} | 2 +- .../requests/AudienceUpdateParams.ts} | 6 +- ...encesRequest.ts => AudiencesListParams.ts} | 2 +- .../audiences/client/requests/index.ts | 5 +- ...tResponse.ts => AudienceUpdateResponse.ts} | 2 +- src/api/resources/audiences/types/index.ts | 3 +- .../resources/auditEvents/client/Client.ts | 8 +- src/api/resources/authTokens/client/Client.ts | 6 +- .../resources/automations/client/Client.ts | 16 +- src/api/resources/brands/client/Client.ts | 63 ++- .../requests/BrandUpdateParameters.ts} | 7 +- .../resources/brands/client/requests/index.ts | 1 + src/api/resources/brands/types/index.ts | 1 - src/api/resources/bulk/client/Client.ts | 23 +- src/api/resources/bulk/client/index.ts | 2 +- .../requests}/BulkCreateJobParams.ts | 2 +- .../resources/bulk/client/requests/index.ts | 1 + .../bulk/types/BulkIngestUsersParams.ts | 1 - .../bulk/types/InboundBulkContentMessage.ts | 19 + .../bulk/types/InboundBulkMessage.ts | 4 +- .../bulk/types/InboundBulkMessageApiV1.ts | 14 - .../bulk/types/InboundBulkMessageApiV2.ts | 5 - .../bulk/types/InboundBulkMessageV1.ts | 27 ++ .../bulk/types/InboundBulkMessageV2.ts | 18 + .../bulk/types/InboundBulkTemplateMessage.ts | 14 + src/api/resources/bulk/types/index.ts | 8 +- src/api/resources/index.ts | 6 + src/api/resources/lists/client/Client.ts | 120 ++++- .../requests/SubscribeUserToListRequest.ts | 2 - src/api/resources/messages/client/Client.ts | 18 +- .../client/requests/ListMessagesRequest.ts | 2 +- .../resources/notifications/client/Client.ts | 420 ++++++++++++++++++ .../resources/notifications/client/index.ts | 1 + ...NotificationDraftUpdateVariationsParams.ts | 10 + .../requests/NotificationListParams.ts} | 4 +- .../NotificationUpdateVariationsParams.ts | 10 + .../requests/SubmissionChecksReplaceParams.ts | 9 + .../notifications/client/requests/index.ts | 4 + src/api/resources/notifications/index.ts | 2 + .../notifications/types/BaseCheck.ts | 11 + .../notifications/types/BlockType.ts | 26 ++ .../resources/notifications/types/Check.ts | 9 + .../notifications/types/CheckStatus.ts | 11 + .../notifications/types/MessageRouting.ts | 10 + .../types/MessageRoutingChannel.ts | 7 + .../types/MessageRoutingMethod.ts | 10 + .../notifications/types/Notification.ts | 11 + .../notifications/types/NotificationBlock.ts | 15 + .../types/NotificationChannel.ts | 13 + .../types/NotificationChannelContent.ts | 8 + .../types/NotificationContent.ts | 7 + .../types/NotificationContentHierarchy.ts | 8 + .../types/NotificationGetContentResponse.ts | 11 + .../types/NotificationListResponse.ts | 10 + .../types/SubmissionChecksGetResponse.ts | 9 + .../types/SubmissionChecksReplaceResponse.ts | 9 + .../resources/notifications/types/index.ts | 17 + src/api/resources/profiles/client/Client.ts | 18 +- src/api/resources/send/types/BaseMessage.ts | 2 - .../resources/send/types/ContentMessage.ts | 2 + .../resources/send/types/TemplateMessage.ts | 2 + src/api/resources/templates/client/Client.ts | 6 +- src/api/resources/tenants/client/Client.ts | 149 ++++++- src/api/resources/tenants/client/index.ts | 2 +- .../requests/TenantCreateOrReplaceParams.ts} | 14 +- .../tenants/client/requests/index.ts | 1 + ...teOrReplaceTenantResponse.ts => Tenant.ts} | 6 +- .../tenants/types/TenantListResponse.ts | 24 + src/api/resources/tenants/types/index.ts | 4 +- .../tokenManagement/client/Client.ts | 14 +- .../resources/translations/client/Client.ts | 8 +- .../userPreferences/client/Client.ts | 30 +- .../resources/userPreferences/client/index.ts | 2 +- .../requests/UserPreferencesUpdateParams.ts} | 6 +- .../userPreferences/client/requests/index.ts | 1 + .../types/UserPreferencesGetResponse.ts | 9 + ...nces.ts => UserPreferencesListResponse.ts} | 2 +- ...se.ts => UserPreferencesUpdateResponse.ts} | 2 +- .../resources/userPreferences/types/index.ts | 6 +- src/core/fetcher/APIResponse.ts | 1 + src/core/fetcher/Fetcher.ts | 88 ++-- src/core/fetcher/getHeader.ts | 8 + src/core/fetcher/index.ts | 1 + yarn.lock | 60 ++- 87 files changed, 1345 insertions(+), 240 deletions(-) rename src/api/resources/audiences/client/requests/{ListAudienceMembersRequest.ts => AudienceMembersListParams.ts} (80%) rename src/api/resources/audiences/{types/AudienceRequest.ts => client/requests/AudienceUpdateParams.ts} (60%) rename src/api/resources/audiences/client/requests/{ListAudiencesRequest.ts => AudiencesListParams.ts} (83%) rename src/api/resources/audiences/types/{AudiencePutResponse.ts => AudienceUpdateResponse.ts} (77%) rename src/api/resources/brands/{types/BrandPutParameters.ts => client/requests/BrandUpdateParameters.ts} (56%) rename src/api/resources/bulk/{types => client/requests}/BulkCreateJobParams.ts (79%) create mode 100644 src/api/resources/bulk/client/requests/index.ts create mode 100644 src/api/resources/bulk/types/InboundBulkContentMessage.ts delete mode 100644 src/api/resources/bulk/types/InboundBulkMessageApiV1.ts delete mode 100644 src/api/resources/bulk/types/InboundBulkMessageApiV2.ts create mode 100644 src/api/resources/bulk/types/InboundBulkMessageV1.ts create mode 100644 src/api/resources/bulk/types/InboundBulkMessageV2.ts create mode 100644 src/api/resources/bulk/types/InboundBulkTemplateMessage.ts create mode 100644 src/api/resources/notifications/client/Client.ts create mode 100644 src/api/resources/notifications/client/index.ts create mode 100644 src/api/resources/notifications/client/requests/NotificationDraftUpdateVariationsParams.ts rename src/api/resources/{bulk/types/BulkRunJobParams.ts => notifications/client/requests/NotificationListParams.ts} (54%) create mode 100644 src/api/resources/notifications/client/requests/NotificationUpdateVariationsParams.ts create mode 100644 src/api/resources/notifications/client/requests/SubmissionChecksReplaceParams.ts create mode 100644 src/api/resources/notifications/client/requests/index.ts create mode 100644 src/api/resources/notifications/index.ts create mode 100644 src/api/resources/notifications/types/BaseCheck.ts create mode 100644 src/api/resources/notifications/types/BlockType.ts create mode 100644 src/api/resources/notifications/types/Check.ts create mode 100644 src/api/resources/notifications/types/CheckStatus.ts create mode 100644 src/api/resources/notifications/types/MessageRouting.ts create mode 100644 src/api/resources/notifications/types/MessageRoutingChannel.ts create mode 100644 src/api/resources/notifications/types/MessageRoutingMethod.ts create mode 100644 src/api/resources/notifications/types/Notification.ts create mode 100644 src/api/resources/notifications/types/NotificationBlock.ts create mode 100644 src/api/resources/notifications/types/NotificationChannel.ts create mode 100644 src/api/resources/notifications/types/NotificationChannelContent.ts create mode 100644 src/api/resources/notifications/types/NotificationContent.ts create mode 100644 src/api/resources/notifications/types/NotificationContentHierarchy.ts create mode 100644 src/api/resources/notifications/types/NotificationGetContentResponse.ts create mode 100644 src/api/resources/notifications/types/NotificationListResponse.ts create mode 100644 src/api/resources/notifications/types/SubmissionChecksGetResponse.ts create mode 100644 src/api/resources/notifications/types/SubmissionChecksReplaceResponse.ts create mode 100644 src/api/resources/notifications/types/index.ts rename src/api/resources/tenants/{types/CreateOrReplaceTenantRequest.ts => client/requests/TenantCreateOrReplaceParams.ts} (61%) create mode 100644 src/api/resources/tenants/client/requests/index.ts rename src/api/resources/tenants/types/{CreateOrReplaceTenantResponse.ts => Tenant.ts} (88%) create mode 100644 src/api/resources/tenants/types/TenantListResponse.ts rename src/api/resources/userPreferences/{types/UpdateSubscriptionTopicRequest.ts => client/requests/UserPreferencesUpdateParams.ts} (66%) create mode 100644 src/api/resources/userPreferences/client/requests/index.ts create mode 100644 src/api/resources/userPreferences/types/UserPreferencesGetResponse.ts rename src/api/resources/userPreferences/types/{UserPreferences.ts => UserPreferencesListResponse.ts} (83%) rename src/api/resources/userPreferences/types/{UpdateSubscriptionTopicResponse.ts => UserPreferencesUpdateResponse.ts} (65%) create mode 100644 src/core/fetcher/getHeader.ts diff --git a/package.json b/package.json index 988d197..2dcea00 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@trycourier/courier", - "version": "6.0.1", + "version": "6.0.2", "private": false, "repository": "https://github.com/trycourier/courier-node", "main": "./index.js", @@ -12,13 +12,15 @@ }, "dependencies": { "url-join": "4.0.1", - "@types/url-join": "4.0.1", - "axios": "0.27.2", + "form-data": "4.0.0", + "node-fetch": "2.7.0", "qs": "6.11.2", - "@types/qs": "6.9.8", "js-base64": "3.7.2" }, "devDependencies": { + "@types/url-join": "4.0.1", + "@types/qs": "6.9.8", + "@types/node-fetch": "2.6.9", "@types/node": "17.0.33", "prettier": "2.7.1", "typescript": "4.6.4" diff --git a/src/Client.ts b/src/Client.ts index e9ff8a9..2c60935 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -15,6 +15,7 @@ import { Brands } from "./api/resources/brands/client/Client"; import { Bulk } from "./api/resources/bulk/client/Client"; import { Lists } from "./api/resources/lists/client/Client"; import { Messages } from "./api/resources/messages/client/Client"; +import { Notifications } from "./api/resources/notifications/client/Client"; import { Profiles } from "./api/resources/profiles/client/Client"; import { Templates } from "./api/resources/templates/client/Client"; import { Tenants } from "./api/resources/tenants/client/Client"; @@ -25,7 +26,7 @@ import { UserPreferences } from "./api/resources/userPreferences/client/Client"; export declare namespace CourierClient { interface Options { environment?: core.Supplier; - authorizationToken: core.Supplier; + authorizationToken?: core.Supplier; } interface RequestOptions { @@ -40,7 +41,7 @@ export declare namespace CourierClient { } export class CourierClient { - constructor(protected readonly _options: CourierClient.Options) {} + constructor(protected readonly _options: CourierClient.Options = {}) {} /** * Use the send API to send a message to one or more recipients. @@ -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": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", "Idempotency-Key": requestOptions?.idempotencyKey != null ? requestOptions?.idempotencyKey : undefined, "X-Idempotency-Expiration": requestOptions?.idempotencyExpiry != null @@ -145,6 +146,12 @@ export class CourierClient { return (this._messages ??= new Messages(this._options)); } + protected _notifications: Notifications | undefined; + + public get notifications(): Notifications { + return (this._notifications ??= new Notifications(this._options)); + } + protected _profiles: Profiles | undefined; public get profiles(): Profiles { diff --git a/src/api/resources/audiences/client/Client.ts b/src/api/resources/audiences/client/Client.ts index 814ff7d..cc0dc07 100644 --- a/src/api/resources/audiences/client/Client.ts +++ b/src/api/resources/audiences/client/Client.ts @@ -11,7 +11,7 @@ import * as errors from "../../../../errors"; export declare namespace Audiences { interface Options { environment?: core.Supplier; - authorizationToken: core.Supplier; + authorizationToken?: core.Supplier; } interface RequestOptions { @@ -21,7 +21,7 @@ export declare namespace Audiences { } export class Audiences { - constructor(protected readonly _options: Audiences.Options) {} + constructor(protected readonly _options: Audiences.Options = {}) {} /** * Returns the specified audience by id. @@ -37,7 +37,7 @@ export class Audiences { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -74,9 +74,9 @@ export class Audiences { */ public async update( audienceId: string, - request: Courier.AudienceRequest, + request: Courier.AudienceUpdateParams = {}, requestOptions?: Audiences.RequestOptions - ): Promise { + ): Promise { const _response = await core.fetcher({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, @@ -87,7 +87,7 @@ export class Audiences { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", body: request, @@ -95,7 +95,7 @@ export class Audiences { maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { - return _response.body as Courier.Audience; + return _response.body as Courier.AudienceUpdateResponse; } if (_response.error.reason === "status-code") { @@ -134,7 +134,7 @@ export class Audiences { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -172,7 +172,7 @@ export class Audiences { */ public async listMembers( audienceId: string, - request: Courier.ListAudienceMembersRequest = {}, + request: Courier.AudienceMembersListParams = {}, requestOptions?: Audiences.RequestOptions ): Promise { const { cursor } = request; @@ -191,7 +191,7 @@ export class Audiences { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", queryParameters: _queryParams, @@ -234,7 +234,7 @@ export class Audiences { * @throws {@link Courier.BadRequestError} */ public async listAudiences( - request: Courier.ListAudiencesRequest = {}, + request: Courier.AudiencesListParams = {}, requestOptions?: Audiences.RequestOptions ): Promise { const { cursor } = request; @@ -253,7 +253,7 @@ export class Audiences { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", queryParameters: _queryParams, diff --git a/src/api/resources/audiences/client/requests/ListAudienceMembersRequest.ts b/src/api/resources/audiences/client/requests/AudienceMembersListParams.ts similarity index 80% rename from src/api/resources/audiences/client/requests/ListAudienceMembersRequest.ts rename to src/api/resources/audiences/client/requests/AudienceMembersListParams.ts index 7517e06..aec68fe 100644 --- a/src/api/resources/audiences/client/requests/ListAudienceMembersRequest.ts +++ b/src/api/resources/audiences/client/requests/AudienceMembersListParams.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -export interface ListAudienceMembersRequest { +export interface AudienceMembersListParams { /** * A unique identifier that allows for fetching the next set of members * diff --git a/src/api/resources/audiences/types/AudienceRequest.ts b/src/api/resources/audiences/client/requests/AudienceUpdateParams.ts similarity index 60% rename from src/api/resources/audiences/types/AudienceRequest.ts rename to src/api/resources/audiences/client/requests/AudienceUpdateParams.ts index d073828..1c6e754 100644 --- a/src/api/resources/audiences/types/AudienceRequest.ts +++ b/src/api/resources/audiences/client/requests/AudienceUpdateParams.ts @@ -2,11 +2,9 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Courier from "../../.."; +import * as Courier from "../../../.."; -export interface AudienceRequest { - /** A unique identifier representing the audience_id */ - id?: string; +export interface AudienceUpdateParams { /** The name of the audience */ name?: string; /** A description of the audience */ diff --git a/src/api/resources/audiences/client/requests/ListAudiencesRequest.ts b/src/api/resources/audiences/client/requests/AudiencesListParams.ts similarity index 83% rename from src/api/resources/audiences/client/requests/ListAudiencesRequest.ts rename to src/api/resources/audiences/client/requests/AudiencesListParams.ts index 636d353..e30caa4 100644 --- a/src/api/resources/audiences/client/requests/ListAudiencesRequest.ts +++ b/src/api/resources/audiences/client/requests/AudiencesListParams.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -export interface ListAudiencesRequest { +export interface AudiencesListParams { /** * A unique identifier that allows for fetching the next set of audiences * diff --git a/src/api/resources/audiences/client/requests/index.ts b/src/api/resources/audiences/client/requests/index.ts index b519c33..d56ca2e 100644 --- a/src/api/resources/audiences/client/requests/index.ts +++ b/src/api/resources/audiences/client/requests/index.ts @@ -1,2 +1,3 @@ -export { ListAudienceMembersRequest } from "./ListAudienceMembersRequest"; -export { ListAudiencesRequest } from "./ListAudiencesRequest"; +export { AudienceUpdateParams } from "./AudienceUpdateParams"; +export { AudienceMembersListParams } from "./AudienceMembersListParams"; +export { AudiencesListParams } from "./AudiencesListParams"; diff --git a/src/api/resources/audiences/types/AudiencePutResponse.ts b/src/api/resources/audiences/types/AudienceUpdateResponse.ts similarity index 77% rename from src/api/resources/audiences/types/AudiencePutResponse.ts rename to src/api/resources/audiences/types/AudienceUpdateResponse.ts index a6f9e00..1dd6c72 100644 --- a/src/api/resources/audiences/types/AudiencePutResponse.ts +++ b/src/api/resources/audiences/types/AudienceUpdateResponse.ts @@ -4,6 +4,6 @@ import * as Courier from "../../.."; -export interface AudiencePutResponse { +export interface AudienceUpdateResponse { audience: Courier.Audience; } diff --git a/src/api/resources/audiences/types/index.ts b/src/api/resources/audiences/types/index.ts index 64f2753..1401956 100644 --- a/src/api/resources/audiences/types/index.ts +++ b/src/api/resources/audiences/types/index.ts @@ -1,4 +1,3 @@ -export * from "./AudienceRequest"; export * from "./Filter"; export * from "./Operator"; export * from "./BaseFilterConfig"; @@ -12,4 +11,4 @@ export * from "./AudienceMember"; export * from "./AudienceListResponse"; export * from "./AudienceMemberGetResponse"; export * from "./AudienceMemberListResponse"; -export * from "./AudiencePutResponse"; +export * from "./AudienceUpdateResponse"; diff --git a/src/api/resources/auditEvents/client/Client.ts b/src/api/resources/auditEvents/client/Client.ts index 21fd945..3bfe617 100644 --- a/src/api/resources/auditEvents/client/Client.ts +++ b/src/api/resources/auditEvents/client/Client.ts @@ -11,7 +11,7 @@ import * as errors from "../../../../errors"; export declare namespace AuditEvents { interface Options { environment?: core.Supplier; - authorizationToken: core.Supplier; + authorizationToken?: core.Supplier; } interface RequestOptions { @@ -21,7 +21,7 @@ export declare namespace AuditEvents { } export class AuditEvents { - constructor(protected readonly _options: AuditEvents.Options) {} + constructor(protected readonly _options: AuditEvents.Options = {}) {} /** * Fetch the list of audit events @@ -46,7 +46,7 @@ export class AuditEvents { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", queryParameters: _queryParams, @@ -93,7 +93,7 @@ export class AuditEvents { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, 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 3f2ce00..ad49636 100644 --- a/src/api/resources/authTokens/client/Client.ts +++ b/src/api/resources/authTokens/client/Client.ts @@ -11,7 +11,7 @@ import * as errors from "../../../../errors"; export declare namespace AuthTokens { interface Options { environment?: core.Supplier; - authorizationToken: core.Supplier; + authorizationToken?: core.Supplier; } interface RequestOptions { @@ -26,7 +26,7 @@ export declare namespace AuthTokens { } export class AuthTokens { - constructor(protected readonly _options: AuthTokens.Options) {} + constructor(protected readonly _options: AuthTokens.Options = {}) {} /** * Returns a new access token. @@ -45,7 +45,7 @@ export class AuthTokens { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", "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 f2f4542..efd58dd 100644 --- a/src/api/resources/automations/client/Client.ts +++ b/src/api/resources/automations/client/Client.ts @@ -4,14 +4,14 @@ import * as environments from "../../../../environments"; import * as core from "../../../../core"; +import * as Courier from "../../.."; import urlJoin from "url-join"; import * as errors from "../../../../errors"; -import * as Courier from "../../.."; export declare namespace Automations { interface Options { environment?: core.Supplier; - authorizationToken: core.Supplier; + authorizationToken?: core.Supplier; } interface RequestOptions { @@ -26,15 +26,16 @@ export declare namespace Automations { } export class Automations { - constructor(protected readonly _options: Automations.Options) {} + constructor(protected readonly _options: Automations.Options = {}) {} /** * Invoke an automation run from an automation template. */ public async invokeAutomationTemplate( templateId: string, + request: Courier.AutomationInvokeParams, requestOptions?: Automations.IdempotentRequestOptions - ): Promise { + ): Promise { const _response = await core.fetcher({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, @@ -45,7 +46,7 @@ export class Automations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", "Idempotency-Key": requestOptions?.idempotencyKey != null ? requestOptions?.idempotencyKey : undefined, "X-Idempotency-Expiration": requestOptions?.idempotencyExpiry != null @@ -53,11 +54,12 @@ export class Automations { : undefined, }, contentType: "application/json", + body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { - return; + return _response.body as Courier.AutomationInvokeResponse; } if (_response.error.reason === "status-code") { @@ -99,7 +101,7 @@ export class Automations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", "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 5384aa4..92ed99b 100644 --- a/src/api/resources/brands/client/Client.ts +++ b/src/api/resources/brands/client/Client.ts @@ -11,7 +11,7 @@ import * as errors from "../../../../errors"; export declare namespace Brands { interface Options { environment?: core.Supplier; - authorizationToken: core.Supplier; + authorizationToken?: core.Supplier; } interface RequestOptions { @@ -26,7 +26,7 @@ export declare namespace Brands { } export class Brands { - constructor(protected readonly _options: Brands.Options) {} + constructor(protected readonly _options: Brands.Options = {}) {} /** * @throws {@link Courier.BadRequestError} @@ -47,7 +47,7 @@ export class Brands { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", "Idempotency-Key": requestOptions?.idempotencyKey != null ? requestOptions?.idempotencyKey : undefined, "X-Idempotency-Expiration": requestOptions?.idempotencyExpiry != null @@ -108,7 +108,7 @@ export class Brands { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -163,7 +163,7 @@ export class Brands { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", queryParameters: _queryParams, @@ -211,7 +211,7 @@ export class Brands { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -248,6 +248,57 @@ export class Brands { } } + /** + * Replace an existing brand with the supplied values. + */ + public async replace( + brandId: string, + request: Courier.BrandUpdateParameters, + requestOptions?: Brands.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, + `/brands/${brandId}` + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "@trycourier/courier", + "X-Fern-SDK-Version": "6.0.2", + }, + contentType: "application/json", + body: request, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return _response.body as Courier.Brand; + } + + 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, + }); + } + } + protected async _getAuthorizationHeader() { const bearer = (await core.Supplier.get(this._options.authorizationToken)) ?? process.env["COURIER_AUTH_TOKEN"]; if (bearer == null) { diff --git a/src/api/resources/brands/types/BrandPutParameters.ts b/src/api/resources/brands/client/requests/BrandUpdateParameters.ts similarity index 56% rename from src/api/resources/brands/types/BrandPutParameters.ts rename to src/api/resources/brands/client/requests/BrandUpdateParameters.ts index 7248b84..6bce267 100644 --- a/src/api/resources/brands/types/BrandPutParameters.ts +++ b/src/api/resources/brands/client/requests/BrandUpdateParameters.ts @@ -2,12 +2,11 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Courier from "../../.."; +import * as Courier from "../../../.."; -export interface BrandPutParameters { - id: string; +export interface BrandUpdateParameters { /** The name of the brand. */ name: string; - settings: Courier.BrandSettings; + settings?: Courier.BrandSettings; snippets?: Courier.BrandSnippets; } diff --git a/src/api/resources/brands/client/requests/index.ts b/src/api/resources/brands/client/requests/index.ts index fec68a2..a01231b 100644 --- a/src/api/resources/brands/client/requests/index.ts +++ b/src/api/resources/brands/client/requests/index.ts @@ -1 +1,2 @@ export { ListBrandsRequest } from "./ListBrandsRequest"; +export { BrandUpdateParameters } from "./BrandUpdateParameters"; diff --git a/src/api/resources/brands/types/index.ts b/src/api/resources/brands/types/index.ts index c89128c..7d2c1a6 100644 --- a/src/api/resources/brands/types/index.ts +++ b/src/api/resources/brands/types/index.ts @@ -1,6 +1,5 @@ export * from "./Brand"; export * from "./BrandParameters"; -export * from "./BrandPutParameters"; export * from "./BrandGetAllResponse"; export * from "./BrandsResponse"; export * from "./BrandSnippet"; diff --git a/src/api/resources/bulk/client/Client.ts b/src/api/resources/bulk/client/Client.ts index 51a6c65..f28ed28 100644 --- a/src/api/resources/bulk/client/Client.ts +++ b/src/api/resources/bulk/client/Client.ts @@ -11,7 +11,7 @@ import * as errors from "../../../../errors"; export declare namespace Bulk { interface Options { environment?: core.Supplier; - authorizationToken: core.Supplier; + authorizationToken?: core.Supplier; } interface RequestOptions { @@ -26,12 +26,12 @@ export declare namespace Bulk { } export class Bulk { - constructor(protected readonly _options: Bulk.Options) {} + constructor(protected readonly _options: Bulk.Options = {}) {} /** * @throws {@link Courier.BadRequestError} */ - public async create( + public async createJob( request: Courier.BulkCreateJobParams, requestOptions?: Bulk.IdempotentRequestOptions ): Promise { @@ -45,7 +45,7 @@ export class Bulk { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", "Idempotency-Key": requestOptions?.idempotencyKey != null ? requestOptions?.idempotencyKey : undefined, "X-Idempotency-Expiration": requestOptions?.idempotencyExpiry != null @@ -106,7 +106,7 @@ export class Bulk { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", "Idempotency-Key": requestOptions?.idempotencyKey != null ? requestOptions?.idempotencyKey : undefined, "X-Idempotency-Expiration": requestOptions?.idempotencyExpiry != null @@ -148,11 +148,7 @@ export class Bulk { * Run a bulk job * @throws {@link Courier.BadRequestError} */ - public async runJob( - jobId: string, - request: Courier.BulkRunJobParams, - requestOptions?: Bulk.IdempotentRequestOptions - ): Promise { + public async runJob(jobId: string, requestOptions?: Bulk.IdempotentRequestOptions): Promise { const _response = await core.fetcher({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, @@ -163,7 +159,7 @@ export class Bulk { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", "Idempotency-Key": requestOptions?.idempotencyKey != null ? requestOptions?.idempotencyKey : undefined, "X-Idempotency-Expiration": requestOptions?.idempotencyExpiry != null @@ -171,7 +167,6 @@ export class Bulk { : undefined, }, contentType: "application/json", - body: request, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, }); @@ -221,7 +216,7 @@ export class Bulk { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -276,7 +271,7 @@ export class Bulk { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, diff --git a/src/api/resources/bulk/client/index.ts b/src/api/resources/bulk/client/index.ts index cb0ff5c..415726b 100644 --- a/src/api/resources/bulk/client/index.ts +++ b/src/api/resources/bulk/client/index.ts @@ -1 +1 @@ -export {}; +export * from "./requests"; diff --git a/src/api/resources/bulk/types/BulkCreateJobParams.ts b/src/api/resources/bulk/client/requests/BulkCreateJobParams.ts similarity index 79% rename from src/api/resources/bulk/types/BulkCreateJobParams.ts rename to src/api/resources/bulk/client/requests/BulkCreateJobParams.ts index 9d088d5..54c70c2 100644 --- a/src/api/resources/bulk/types/BulkCreateJobParams.ts +++ b/src/api/resources/bulk/client/requests/BulkCreateJobParams.ts @@ -2,7 +2,7 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Courier from "../../.."; +import * as Courier from "../../../.."; export interface BulkCreateJobParams { message: Courier.InboundBulkMessage; diff --git a/src/api/resources/bulk/client/requests/index.ts b/src/api/resources/bulk/client/requests/index.ts new file mode 100644 index 0000000..52af27f --- /dev/null +++ b/src/api/resources/bulk/client/requests/index.ts @@ -0,0 +1 @@ +export { BulkCreateJobParams } from "./BulkCreateJobParams"; diff --git a/src/api/resources/bulk/types/BulkIngestUsersParams.ts b/src/api/resources/bulk/types/BulkIngestUsersParams.ts index da12ba9..0b5578f 100644 --- a/src/api/resources/bulk/types/BulkIngestUsersParams.ts +++ b/src/api/resources/bulk/types/BulkIngestUsersParams.ts @@ -5,6 +5,5 @@ import * as Courier from "../../.."; export interface BulkIngestUsersParams { - jobId: string; users: Courier.InboundBulkMessageUser[]; } diff --git a/src/api/resources/bulk/types/InboundBulkContentMessage.ts b/src/api/resources/bulk/types/InboundBulkContentMessage.ts new file mode 100644 index 0000000..fe7b6d7 --- /dev/null +++ b/src/api/resources/bulk/types/InboundBulkContentMessage.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Courier from "../../.."; + +/** + * The message property has the following primary top-level properties. They define the destination and content of the message. + * Additional advanced configuration fields [are defined below](https://www.courier.com/docs/reference/send/message/#other-message-properties). + * + */ +export interface InboundBulkContentMessage extends Courier.BaseMessage { + /** + * Describes the content of the message in a way that will work for email, push, + * chat, or any channel. Either this or template must be specified. + * + */ + content: Courier.Content; +} diff --git a/src/api/resources/bulk/types/InboundBulkMessage.ts b/src/api/resources/bulk/types/InboundBulkMessage.ts index 49ee6ea..3676e13 100644 --- a/src/api/resources/bulk/types/InboundBulkMessage.ts +++ b/src/api/resources/bulk/types/InboundBulkMessage.ts @@ -4,6 +4,6 @@ import * as Courier from "../../.."; -export interface InboundBulkMessage extends Courier.InboundBulkMessageApiV1 { - message?: Courier.InboundBulkMessageApiV2 | undefined; +export interface InboundBulkMessage extends Courier.InboundBulkMessageV1 { + message?: Courier.InboundBulkMessageV2; } diff --git a/src/api/resources/bulk/types/InboundBulkMessageApiV1.ts b/src/api/resources/bulk/types/InboundBulkMessageApiV1.ts deleted file mode 100644 index bd83664..0000000 --- a/src/api/resources/bulk/types/InboundBulkMessageApiV1.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export interface InboundBulkMessageApiV1 { - /** A unique identifier that represents the brand that should be used for rendering the notification. */ - brand?: string; - /** JSON that includes any data you want to pass to a message template. The data will populate the corresponding template variables. */ - data?: any; - event: string; - locale?: string; - /** JSON that is merged into the request sent by Courier to the provider to override properties or to gain access to features in the provider API that are not natively supported by Courier. */ - override?: any; -} diff --git a/src/api/resources/bulk/types/InboundBulkMessageApiV2.ts b/src/api/resources/bulk/types/InboundBulkMessageApiV2.ts deleted file mode 100644 index 1b8e7e1..0000000 --- a/src/api/resources/bulk/types/InboundBulkMessageApiV2.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -export type InboundBulkMessageApiV2 = any; diff --git a/src/api/resources/bulk/types/InboundBulkMessageV1.ts b/src/api/resources/bulk/types/InboundBulkMessageV1.ts new file mode 100644 index 0000000..c523e93 --- /dev/null +++ b/src/api/resources/bulk/types/InboundBulkMessageV1.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface InboundBulkMessageV1 { + /** + * A unique identifier that represents the brand that should be used + * for rendering the notification. + * + */ + brand?: string; + /** + * JSON that includes any data you want to pass to a message template. + * The data will populate the corresponding template variables. + * + */ + data?: Record; + event?: string; + locale?: Record; + /** + * JSON that is merged into the request sent by Courier to the provider + * to override properties or to gain access to features in the provider + * API that are not natively supported by Courier. + * + */ + override?: any; +} diff --git a/src/api/resources/bulk/types/InboundBulkMessageV2.ts b/src/api/resources/bulk/types/InboundBulkMessageV2.ts new file mode 100644 index 0000000..b3b662f --- /dev/null +++ b/src/api/resources/bulk/types/InboundBulkMessageV2.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Courier from "../../.."; + +export type InboundBulkMessageV2 = + /** + * Describes the content of the message in a way that will + * work for email, push, chat, or any channel. + * */ + | Courier.InboundBulkTemplateMessage + /** + * A template for a type of message that can be sent more than once. + * For example, you might create an "Appointment Reminder" Notification or + * “Reset Password” Notifications. + * */ + | Courier.InboundBulkContentMessage; diff --git a/src/api/resources/bulk/types/InboundBulkTemplateMessage.ts b/src/api/resources/bulk/types/InboundBulkTemplateMessage.ts new file mode 100644 index 0000000..c0a8593 --- /dev/null +++ b/src/api/resources/bulk/types/InboundBulkTemplateMessage.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Courier from "../../.."; + +export interface InboundBulkTemplateMessage extends Courier.BaseMessage { + /** + * The id of the notification template to be rendered and sent to the recipient(s). + * This field or the content field must be supplied. + * + */ + template: string; +} diff --git a/src/api/resources/bulk/types/index.ts b/src/api/resources/bulk/types/index.ts index d72a9dd..522ecfb 100644 --- a/src/api/resources/bulk/types/index.ts +++ b/src/api/resources/bulk/types/index.ts @@ -1,13 +1,13 @@ -export * from "./InboundBulkMessageApiV1"; -export * from "./InboundBulkMessageApiV2"; +export * from "./InboundBulkMessageV1"; export * from "./InboundBulkMessage"; -export * from "./BulkCreateJobParams"; +export * from "./InboundBulkMessageV2"; +export * from "./InboundBulkTemplateMessage"; +export * from "./InboundBulkContentMessage"; export * from "./BulkCreateJobResponse"; export * from "./InboundBulkMessageUser"; export * from "./BulkIngestUsersParams"; export * from "./BulkIngestError"; export * from "./BulkIngestUsersResponse"; -export * from "./BulkRunJobParams"; export * from "./BulkGetJobParams"; export * from "./BulkJobStatus"; export * from "./BulkJobUserStatus"; diff --git a/src/api/resources/index.ts b/src/api/resources/index.ts index 7c09742..7d191a3 100644 --- a/src/api/resources/index.ts +++ b/src/api/resources/index.ts @@ -16,6 +16,8 @@ export * as lists from "./lists"; export * from "./lists/types"; export * as messages from "./messages"; export * from "./messages/types"; +export * as notifications from "./notifications"; +export * from "./notifications/types"; export * as profiles from "./profiles"; export * from "./profiles/types"; export * as send from "./send"; @@ -33,7 +35,11 @@ export * as translations from "./translations"; export * from "./audiences/client/requests"; export * from "./auditEvents/client/requests"; export * from "./brands/client/requests"; +export * from "./bulk/client/requests"; export * from "./lists/client/requests"; export * from "./messages/client/requests"; +export * from "./notifications/client/requests"; export * from "./profiles/client/requests"; export * from "./templates/client/requests"; +export * from "./tenants/client/requests"; +export * from "./userPreferences/client/requests"; diff --git a/src/api/resources/lists/client/Client.ts b/src/api/resources/lists/client/Client.ts index b4d143a..10a1e7c 100644 --- a/src/api/resources/lists/client/Client.ts +++ b/src/api/resources/lists/client/Client.ts @@ -11,7 +11,7 @@ import * as errors from "../../../../errors"; export declare namespace Lists { interface Options { environment?: core.Supplier; - authorizationToken: core.Supplier; + authorizationToken?: core.Supplier; } interface RequestOptions { @@ -26,7 +26,7 @@ export declare namespace Lists { } export class Lists { - constructor(protected readonly _options: Lists.Options) {} + constructor(protected readonly _options: Lists.Options = {}) {} /** * Returns all of the lists, with the ability to filter based on a pattern. @@ -56,7 +56,7 @@ export class Lists { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", queryParameters: _queryParams, @@ -123,7 +123,7 @@ export class Lists { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", queryParameters: _queryParams, @@ -179,7 +179,7 @@ export class Lists { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", body: request, @@ -212,11 +212,103 @@ export class Lists { } } + /** + * Delete a list by list ID. + */ + public async delete(listId: string, requestOptions?: Lists.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, + `/lists/${listId}` + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "@trycourier/courier", + "X-Fern-SDK-Version": "6.0.2", + }, + 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, + }); + } + } + + /** + * Restore a previously deleted list. + */ + public async restore(listId: string, requestOptions?: Lists.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, + `/lists/${listId}/restore` + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "@trycourier/courier", + "X-Fern-SDK-Version": "6.0.2", + }, + 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, + }); + } + } + /** * Get the list's subscriptions. * @throws {@link Courier.NotFoundError} */ - public async getSubscriptions( + public async getSubscribers( listId: string, request: Courier.GetSubscriptionForListRequest = {}, requestOptions?: Lists.RequestOptions @@ -237,7 +329,7 @@ export class Lists { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", queryParameters: _queryParams, @@ -279,7 +371,7 @@ export class Lists { * Subscribes the users to the list, overwriting existing subscriptions. If the list does not exist, it will be automatically created. * @throws {@link Courier.BadRequestError} */ - public async putSubscriptions( + public async updateSubscribers( listId: string, request: Courier.PutSubscriptionsRecipient[], requestOptions?: Lists.RequestOptions @@ -294,7 +386,7 @@ export class Lists { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", body: request, @@ -336,7 +428,7 @@ export class Lists { * Subscribes additional users to the list, without modifying existing subscriptions. If the list does not exist, it will be automatically created. * @throws {@link Courier.BadRequestError} */ - public async postSubscriptions( + public async addSubscribers( listId: string, request: Courier.PutSubscriptionsRecipient[], requestOptions?: Lists.IdempotentRequestOptions @@ -351,7 +443,7 @@ export class Lists { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", "Idempotency-Key": requestOptions?.idempotencyKey != null ? requestOptions?.idempotencyKey : undefined, "X-Idempotency-Expiration": requestOptions?.idempotencyExpiry != null @@ -400,7 +492,7 @@ export class Lists { public async subscribe( listId: string, userId: string, - request: Courier.SubscribeUserToListRequest, + request: Courier.SubscribeUserToListRequest = {}, requestOptions?: Lists.RequestOptions ): Promise { const _response = await core.fetcher({ @@ -413,7 +505,7 @@ export class Lists { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", body: request, @@ -461,7 +553,7 @@ export class Lists { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, diff --git a/src/api/resources/lists/client/requests/SubscribeUserToListRequest.ts b/src/api/resources/lists/client/requests/SubscribeUserToListRequest.ts index e5b6cb8..d0aea15 100644 --- a/src/api/resources/lists/client/requests/SubscribeUserToListRequest.ts +++ b/src/api/resources/lists/client/requests/SubscribeUserToListRequest.ts @@ -5,7 +5,5 @@ import * as Courier from "../../../.."; export interface SubscribeUserToListRequest { - listId: string; - recipientId: string; preferences?: Courier.RecipientPreferences; } diff --git a/src/api/resources/messages/client/Client.ts b/src/api/resources/messages/client/Client.ts index 711c07a..a6c4915 100644 --- a/src/api/resources/messages/client/Client.ts +++ b/src/api/resources/messages/client/Client.ts @@ -11,7 +11,7 @@ import * as errors from "../../../../errors"; export declare namespace Messages { interface Options { environment?: core.Supplier; - authorizationToken: core.Supplier; + authorizationToken?: core.Supplier; } interface RequestOptions { @@ -26,7 +26,7 @@ export declare namespace Messages { } export class Messages { - constructor(protected readonly _options: Messages.Options) {} + constructor(protected readonly _options: Messages.Options = {}) {} /** * Fetch the statuses of messages you've previously sent. @@ -45,7 +45,7 @@ export class Messages { recipient, status, tags, - enqueuedAfter, + enqueued_after: enqueuedAfter, traceId, } = request; const _queryParams: Record = {}; @@ -103,7 +103,7 @@ export class Messages { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", queryParameters: _queryParams, @@ -152,7 +152,7 @@ export class Messages { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -208,7 +208,7 @@ export class Messages { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", "Idempotency-Key": requestOptions?.idempotencyKey != null ? requestOptions?.idempotencyKey : undefined, "X-Idempotency-Expiration": requestOptions?.idempotencyExpiry != null @@ -271,7 +271,7 @@ export class Messages { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", queryParameters: _queryParams, @@ -329,7 +329,7 @@ export class Messages { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -379,7 +379,7 @@ export class Messages { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, diff --git a/src/api/resources/messages/client/requests/ListMessagesRequest.ts b/src/api/resources/messages/client/requests/ListMessagesRequest.ts index eafec40..a2aa377 100644 --- a/src/api/resources/messages/client/requests/ListMessagesRequest.ts +++ b/src/api/resources/messages/client/requests/ListMessagesRequest.ts @@ -42,7 +42,7 @@ export interface ListMessagesRequest { /** * The enqueued datetime of a message to filter out messages received before. */ - enqueuedAfter?: string; + enqueued_after?: string; /** * The unique identifier used to trace the requests */ diff --git a/src/api/resources/notifications/client/Client.ts b/src/api/resources/notifications/client/Client.ts new file mode 100644 index 0000000..417fef3 --- /dev/null +++ b/src/api/resources/notifications/client/Client.ts @@ -0,0 +1,420 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Courier from "../../.."; +import urlJoin from "url-join"; +import * as errors from "../../../../errors"; + +export declare namespace Notifications { + interface Options { + environment?: core.Supplier; + authorizationToken?: core.Supplier; + } + + interface RequestOptions { + timeoutInSeconds?: number; + maxRetries?: number; + } +} + +export class Notifications { + constructor(protected readonly _options: Notifications.Options = {}) {} + + public async list( + request: Courier.NotificationListParams = {}, + requestOptions?: Notifications.RequestOptions + ): Promise { + const { cursor } = request; + const _queryParams: Record = {}; + if (cursor != null) { + _queryParams["cursor"] = cursor; + } + + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, + "/notifications" + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "@trycourier/courier", + "X-Fern-SDK-Version": "6.0.2", + }, + contentType: "application/json", + queryParameters: _queryParams, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return _response.body as Courier.NotificationListResponse; + } + + 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, + }); + } + } + + public async getContent( + id: string, + requestOptions?: Notifications.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, + `/notifications/${id}/content` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "@trycourier/courier", + "X-Fern-SDK-Version": "6.0.2", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return _response.body as Courier.NotificationGetContentResponse; + } + + 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, + }); + } + } + + public async getDraftContent( + id: string, + requestOptions?: Notifications.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, + `/notifications/${id}/draft/content` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "@trycourier/courier", + "X-Fern-SDK-Version": "6.0.2", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return _response.body as Courier.NotificationGetContentResponse; + } + + 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, + }); + } + } + + public async updateVariations( + id: string, + request: Courier.NotificationUpdateVariationsParams = {}, + requestOptions?: Notifications.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, + `/notifications/${id}/variations` + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "@trycourier/courier", + "X-Fern-SDK-Version": "6.0.2", + }, + contentType: "application/json", + body: request, + 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, + }); + } + } + + public async updateDraftVariations( + id: string, + request: Courier.NotificationDraftUpdateVariationsParams = {}, + requestOptions?: Notifications.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, + `/notifications/${id}/draft/variations` + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "@trycourier/courier", + "X-Fern-SDK-Version": "6.0.2", + }, + contentType: "application/json", + body: request, + 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, + }); + } + } + + public async getSubmissionChecks( + id: string, + submissionId: string, + requestOptions?: Notifications.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, + `/notifications/${id}/${submissionId}/checks` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "@trycourier/courier", + "X-Fern-SDK-Version": "6.0.2", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return _response.body as Courier.SubmissionChecksGetResponse; + } + + 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, + }); + } + } + + public async replaceSubmissionChecks( + id: string, + submissionId: string, + request: Courier.SubmissionChecksReplaceParams, + requestOptions?: Notifications.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, + `/notifications/${id}/${submissionId}/checks` + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "@trycourier/courier", + "X-Fern-SDK-Version": "6.0.2", + }, + contentType: "application/json", + body: request, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return _response.body as Courier.SubmissionChecksReplaceResponse; + } + + 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, + }); + } + } + + public async cancelSubmission( + id: string, + submissionId: string, + requestOptions?: Notifications.RequestOptions + ): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, + `/notifications/${id}/${submissionId}/checks` + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "@trycourier/courier", + "X-Fern-SDK-Version": "6.0.2", + }, + 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, + }); + } + } + + protected async _getAuthorizationHeader() { + const bearer = (await core.Supplier.get(this._options.authorizationToken)) ?? process.env["COURIER_AUTH_TOKEN"]; + if (bearer == null) { + throw new errors.CourierError({ + message: "Please specify COURIER_AUTH_TOKEN when instantiating the client.", + }); + } + + return `Bearer ${bearer}`; + } +} diff --git a/src/api/resources/notifications/client/index.ts b/src/api/resources/notifications/client/index.ts new file mode 100644 index 0000000..415726b --- /dev/null +++ b/src/api/resources/notifications/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/notifications/client/requests/NotificationDraftUpdateVariationsParams.ts b/src/api/resources/notifications/client/requests/NotificationDraftUpdateVariationsParams.ts new file mode 100644 index 0000000..2241750 --- /dev/null +++ b/src/api/resources/notifications/client/requests/NotificationDraftUpdateVariationsParams.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Courier from "../../../.."; + +export interface NotificationDraftUpdateVariationsParams { + blocks?: Courier.NotificationBlock[]; + channels?: Courier.NotificationChannel[]; +} diff --git a/src/api/resources/bulk/types/BulkRunJobParams.ts b/src/api/resources/notifications/client/requests/NotificationListParams.ts similarity index 54% rename from src/api/resources/bulk/types/BulkRunJobParams.ts rename to src/api/resources/notifications/client/requests/NotificationListParams.ts index ecbe816..70e3736 100644 --- a/src/api/resources/bulk/types/BulkRunJobParams.ts +++ b/src/api/resources/notifications/client/requests/NotificationListParams.ts @@ -2,6 +2,6 @@ * This file was auto-generated by Fern from our API Definition. */ -export interface BulkRunJobParams { - jobId: string; +export interface NotificationListParams { + cursor?: string; } diff --git a/src/api/resources/notifications/client/requests/NotificationUpdateVariationsParams.ts b/src/api/resources/notifications/client/requests/NotificationUpdateVariationsParams.ts new file mode 100644 index 0000000..4d8e370 --- /dev/null +++ b/src/api/resources/notifications/client/requests/NotificationUpdateVariationsParams.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Courier from "../../../.."; + +export interface NotificationUpdateVariationsParams { + blocks?: Courier.NotificationBlock[]; + channels?: Courier.NotificationChannel[]; +} diff --git a/src/api/resources/notifications/client/requests/SubmissionChecksReplaceParams.ts b/src/api/resources/notifications/client/requests/SubmissionChecksReplaceParams.ts new file mode 100644 index 0000000..a999426 --- /dev/null +++ b/src/api/resources/notifications/client/requests/SubmissionChecksReplaceParams.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Courier from "../../../.."; + +export interface SubmissionChecksReplaceParams { + checks: Courier.BaseCheck[]; +} diff --git a/src/api/resources/notifications/client/requests/index.ts b/src/api/resources/notifications/client/requests/index.ts new file mode 100644 index 0000000..2da9ac0 --- /dev/null +++ b/src/api/resources/notifications/client/requests/index.ts @@ -0,0 +1,4 @@ +export { NotificationListParams } from "./NotificationListParams"; +export { NotificationUpdateVariationsParams } from "./NotificationUpdateVariationsParams"; +export { NotificationDraftUpdateVariationsParams } from "./NotificationDraftUpdateVariationsParams"; +export { SubmissionChecksReplaceParams } from "./SubmissionChecksReplaceParams"; diff --git a/src/api/resources/notifications/index.ts b/src/api/resources/notifications/index.ts new file mode 100644 index 0000000..c9240f8 --- /dev/null +++ b/src/api/resources/notifications/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/notifications/types/BaseCheck.ts b/src/api/resources/notifications/types/BaseCheck.ts new file mode 100644 index 0000000..fe27ba4 --- /dev/null +++ b/src/api/resources/notifications/types/BaseCheck.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Courier from "../../.."; + +export interface BaseCheck { + id: string; + status: Courier.CheckStatus; + type: "custom"; +} diff --git a/src/api/resources/notifications/types/BlockType.ts b/src/api/resources/notifications/types/BlockType.ts new file mode 100644 index 0000000..f4edcf1 --- /dev/null +++ b/src/api/resources/notifications/types/BlockType.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type BlockType = + | "action" + | "divider" + | "image" + | "jsonnet" + | "list" + | "markdown" + | "quote" + | "template" + | "text"; + +export const BlockType = { + Action: "action", + Divider: "divider", + Image: "image", + Jsonnet: "jsonnet", + List: "list", + Markdown: "markdown", + Quote: "quote", + Template: "template", + Text: "text", +} as const; diff --git a/src/api/resources/notifications/types/Check.ts b/src/api/resources/notifications/types/Check.ts new file mode 100644 index 0000000..8aa133a --- /dev/null +++ b/src/api/resources/notifications/types/Check.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Courier from "../../.."; + +export interface Check extends Courier.BaseCheck { + updated: number; +} diff --git a/src/api/resources/notifications/types/CheckStatus.ts b/src/api/resources/notifications/types/CheckStatus.ts new file mode 100644 index 0000000..ac6f583 --- /dev/null +++ b/src/api/resources/notifications/types/CheckStatus.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type CheckStatus = "RESOLVED" | "FAILED" | "PENDING"; + +export const CheckStatus = { + Resolved: "RESOLVED", + Failed: "FAILED", + Pending: "PENDING", +} as const; diff --git a/src/api/resources/notifications/types/MessageRouting.ts b/src/api/resources/notifications/types/MessageRouting.ts new file mode 100644 index 0000000..9922aef --- /dev/null +++ b/src/api/resources/notifications/types/MessageRouting.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Courier from "../../.."; + +export interface MessageRouting { + method: Courier.MessageRoutingMethod; + channels: Courier.MessageRoutingChannel[]; +} diff --git a/src/api/resources/notifications/types/MessageRoutingChannel.ts b/src/api/resources/notifications/types/MessageRoutingChannel.ts new file mode 100644 index 0000000..34a2d55 --- /dev/null +++ b/src/api/resources/notifications/types/MessageRoutingChannel.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Courier from "../../.."; + +export type MessageRoutingChannel = string | Courier.MessageRouting; diff --git a/src/api/resources/notifications/types/MessageRoutingMethod.ts b/src/api/resources/notifications/types/MessageRoutingMethod.ts new file mode 100644 index 0000000..77d165d --- /dev/null +++ b/src/api/resources/notifications/types/MessageRoutingMethod.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type MessageRoutingMethod = "all" | "single"; + +export const MessageRoutingMethod = { + All: "all", + Single: "single", +} as const; diff --git a/src/api/resources/notifications/types/Notification.ts b/src/api/resources/notifications/types/Notification.ts new file mode 100644 index 0000000..c5bbdc4 --- /dev/null +++ b/src/api/resources/notifications/types/Notification.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Courier from "../../.."; + +export interface Notification { + created_at: number; + id: string; + routing: Courier.MessageRouting; +} diff --git a/src/api/resources/notifications/types/NotificationBlock.ts b/src/api/resources/notifications/types/NotificationBlock.ts new file mode 100644 index 0000000..06247e2 --- /dev/null +++ b/src/api/resources/notifications/types/NotificationBlock.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Courier from "../../.."; + +export interface NotificationBlock { + alias?: string; + context?: string; + id: string; + type: Courier.BlockType; + content?: Courier.NotificationContent; + locales?: Record; + checksum?: string; +} diff --git a/src/api/resources/notifications/types/NotificationChannel.ts b/src/api/resources/notifications/types/NotificationChannel.ts new file mode 100644 index 0000000..3ee8126 --- /dev/null +++ b/src/api/resources/notifications/types/NotificationChannel.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Courier from "../../.."; + +export interface NotificationChannel { + id: string; + type?: string; + content?: Courier.NotificationChannelContent; + locales?: Record; + checksum?: string; +} diff --git a/src/api/resources/notifications/types/NotificationChannelContent.ts b/src/api/resources/notifications/types/NotificationChannelContent.ts new file mode 100644 index 0000000..6cc5826 --- /dev/null +++ b/src/api/resources/notifications/types/NotificationChannelContent.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface NotificationChannelContent { + subject?: string; + title?: string; +} diff --git a/src/api/resources/notifications/types/NotificationContent.ts b/src/api/resources/notifications/types/NotificationContent.ts new file mode 100644 index 0000000..a880e3c --- /dev/null +++ b/src/api/resources/notifications/types/NotificationContent.ts @@ -0,0 +1,7 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Courier from "../../.."; + +export type NotificationContent = string | Courier.NotificationContentHierarchy; diff --git a/src/api/resources/notifications/types/NotificationContentHierarchy.ts b/src/api/resources/notifications/types/NotificationContentHierarchy.ts new file mode 100644 index 0000000..f59ed65 --- /dev/null +++ b/src/api/resources/notifications/types/NotificationContentHierarchy.ts @@ -0,0 +1,8 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface NotificationContentHierarchy { + parent?: string; + children?: string; +} diff --git a/src/api/resources/notifications/types/NotificationGetContentResponse.ts b/src/api/resources/notifications/types/NotificationGetContentResponse.ts new file mode 100644 index 0000000..a283099 --- /dev/null +++ b/src/api/resources/notifications/types/NotificationGetContentResponse.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Courier from "../../.."; + +export interface NotificationGetContentResponse { + blocks?: Courier.NotificationBlock[]; + channels?: Courier.NotificationChannel[]; + checksum?: string; +} diff --git a/src/api/resources/notifications/types/NotificationListResponse.ts b/src/api/resources/notifications/types/NotificationListResponse.ts new file mode 100644 index 0000000..89fd1f0 --- /dev/null +++ b/src/api/resources/notifications/types/NotificationListResponse.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Courier from "../../.."; + +export interface NotificationListResponse { + paging: Courier.Paging; + results: Courier.Notification[]; +} diff --git a/src/api/resources/notifications/types/SubmissionChecksGetResponse.ts b/src/api/resources/notifications/types/SubmissionChecksGetResponse.ts new file mode 100644 index 0000000..8ed4c26 --- /dev/null +++ b/src/api/resources/notifications/types/SubmissionChecksGetResponse.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Courier from "../../.."; + +export interface SubmissionChecksGetResponse { + checks: Courier.Check[]; +} diff --git a/src/api/resources/notifications/types/SubmissionChecksReplaceResponse.ts b/src/api/resources/notifications/types/SubmissionChecksReplaceResponse.ts new file mode 100644 index 0000000..f348ba3 --- /dev/null +++ b/src/api/resources/notifications/types/SubmissionChecksReplaceResponse.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Courier from "../../.."; + +export interface SubmissionChecksReplaceResponse { + checks: Courier.Check[]; +} diff --git a/src/api/resources/notifications/types/index.ts b/src/api/resources/notifications/types/index.ts new file mode 100644 index 0000000..65cc9a1 --- /dev/null +++ b/src/api/resources/notifications/types/index.ts @@ -0,0 +1,17 @@ +export * from "./NotificationListResponse"; +export * from "./NotificationGetContentResponse"; +export * from "./Notification"; +export * from "./MessageRouting"; +export * from "./MessageRoutingMethod"; +export * from "./MessageRoutingChannel"; +export * from "./NotificationBlock"; +export * from "./NotificationContent"; +export * from "./NotificationContentHierarchy"; +export * from "./BlockType"; +export * from "./NotificationChannel"; +export * from "./NotificationChannelContent"; +export * from "./BaseCheck"; +export * from "./Check"; +export * from "./CheckStatus"; +export * from "./SubmissionChecksGetResponse"; +export * from "./SubmissionChecksReplaceResponse"; diff --git a/src/api/resources/profiles/client/Client.ts b/src/api/resources/profiles/client/Client.ts index 36254d9..add871c 100644 --- a/src/api/resources/profiles/client/Client.ts +++ b/src/api/resources/profiles/client/Client.ts @@ -11,7 +11,7 @@ import * as errors from "../../../../errors"; export declare namespace Profiles { interface Options { environment?: core.Supplier; - authorizationToken: core.Supplier; + authorizationToken?: core.Supplier; } interface RequestOptions { @@ -26,7 +26,7 @@ export declare namespace Profiles { } export class Profiles { - constructor(protected readonly _options: Profiles.Options) {} + constructor(protected readonly _options: Profiles.Options = {}) {} /** * Returns the specified user profile. @@ -43,7 +43,7 @@ export class Profiles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -99,7 +99,7 @@ export class Profiles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", "Idempotency-Key": requestOptions?.idempotencyKey != null ? requestOptions?.idempotencyKey : undefined, "X-Idempotency-Expiration": requestOptions?.idempotencyExpiry != null @@ -165,7 +165,7 @@ export class Profiles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", body: request, @@ -218,7 +218,7 @@ export class Profiles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -280,7 +280,7 @@ export class Profiles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", queryParameters: _queryParams, @@ -337,7 +337,7 @@ export class Profiles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", "Idempotency-Key": requestOptions?.idempotencyKey != null ? requestOptions?.idempotencyKey : undefined, "X-Idempotency-Expiration": requestOptions?.idempotencyExpiry != null @@ -398,7 +398,7 @@ export class Profiles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, diff --git a/src/api/resources/send/types/BaseMessage.ts b/src/api/resources/send/types/BaseMessage.ts index f39c59e..fb61acb 100644 --- a/src/api/resources/send/types/BaseMessage.ts +++ b/src/api/resources/send/types/BaseMessage.ts @@ -5,8 +5,6 @@ import * as Courier from "../../.."; export interface BaseMessage { - /** The recipient or a list of recipients of the message */ - to: Courier.MessageRecipient; /** * An arbitrary object that includes any data you want to pass to the message. * The data will populate the corresponding template or elements variables. diff --git a/src/api/resources/send/types/ContentMessage.ts b/src/api/resources/send/types/ContentMessage.ts index ce8e9b6..5ee085a 100644 --- a/src/api/resources/send/types/ContentMessage.ts +++ b/src/api/resources/send/types/ContentMessage.ts @@ -16,4 +16,6 @@ export interface ContentMessage extends Courier.BaseMessage { * */ content: Courier.Content; + /** The recipient or a list of recipients of the message */ + to: Courier.MessageRecipient; } diff --git a/src/api/resources/send/types/TemplateMessage.ts b/src/api/resources/send/types/TemplateMessage.ts index 71552ad..bbab060 100644 --- a/src/api/resources/send/types/TemplateMessage.ts +++ b/src/api/resources/send/types/TemplateMessage.ts @@ -11,4 +11,6 @@ export interface TemplateMessage extends Courier.BaseMessage { * */ template: string; + /** The recipient or a list of recipients of the message */ + to: Courier.MessageRecipient; } diff --git a/src/api/resources/templates/client/Client.ts b/src/api/resources/templates/client/Client.ts index 9686283..805b164 100644 --- a/src/api/resources/templates/client/Client.ts +++ b/src/api/resources/templates/client/Client.ts @@ -11,7 +11,7 @@ import * as errors from "../../../../errors"; export declare namespace Templates { interface Options { environment?: core.Supplier; - authorizationToken: core.Supplier; + authorizationToken?: core.Supplier; } interface RequestOptions { @@ -21,7 +21,7 @@ export declare namespace Templates { } export class Templates { - constructor(protected readonly _options: Templates.Options) {} + constructor(protected readonly _options: Templates.Options = {}) {} /** * Returns a list of notification templates @@ -46,7 +46,7 @@ export class Templates { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", queryParameters: _queryParams, diff --git a/src/api/resources/tenants/client/Client.ts b/src/api/resources/tenants/client/Client.ts index 9504bcb..acf8a92 100644 --- a/src/api/resources/tenants/client/Client.ts +++ b/src/api/resources/tenants/client/Client.ts @@ -11,7 +11,7 @@ import * as errors from "../../../../errors"; export declare namespace Tenants { interface Options { environment?: core.Supplier; - authorizationToken: core.Supplier; + authorizationToken?: core.Supplier; } interface RequestOptions { @@ -21,16 +21,16 @@ export declare namespace Tenants { } export class Tenants { - constructor(protected readonly _options: Tenants.Options) {} + constructor(protected readonly _options: Tenants.Options = {}) {} /** * @throws {@link Courier.BadRequestError} */ public async createOrReplace( tenantId: string, - request: Courier.CreateOrReplaceTenantRequest, + request: Courier.TenantCreateOrReplaceParams, requestOptions?: Tenants.RequestOptions - ): Promise { + ): Promise { const _response = await core.fetcher({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, @@ -41,7 +41,7 @@ export class Tenants { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", body: request, @@ -49,7 +49,7 @@ export class Tenants { maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { - return _response.body as Courier.CreateOrReplaceTenantResponse; + return _response.body as Courier.Tenant; } if (_response.error.reason === "status-code") { @@ -79,6 +79,143 @@ export class Tenants { } } + /** + * @throws {@link Courier.BadRequestError} + */ + public async get(tenantId: string, requestOptions?: Tenants.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, + `/tenants/${tenantId}` + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "@trycourier/courier", + "X-Fern-SDK-Version": "6.0.2", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return _response.body as Courier.Tenant; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Courier.BadRequestError(_response.error.body as Courier.BadRequest); + default: + 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, + }); + } + } + + public async list(requestOptions?: Tenants.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, + "/tenants" + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "@trycourier/courier", + "X-Fern-SDK-Version": "6.0.2", + }, + contentType: "application/json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return _response.body as Courier.TenantListResponse; + } + + 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, + }); + } + } + + public async delete(tenantId: string, requestOptions?: Tenants.RequestOptions): Promise { + const _response = await core.fetcher({ + url: urlJoin( + (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, + `/tenants/${tenantId}` + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "@trycourier/courier", + "X-Fern-SDK-Version": "6.0.2", + }, + 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, + }); + } + } + protected async _getAuthorizationHeader() { const bearer = (await core.Supplier.get(this._options.authorizationToken)) ?? process.env["COURIER_AUTH_TOKEN"]; if (bearer == null) { diff --git a/src/api/resources/tenants/client/index.ts b/src/api/resources/tenants/client/index.ts index cb0ff5c..415726b 100644 --- a/src/api/resources/tenants/client/index.ts +++ b/src/api/resources/tenants/client/index.ts @@ -1 +1 @@ -export {}; +export * from "./requests"; diff --git a/src/api/resources/tenants/types/CreateOrReplaceTenantRequest.ts b/src/api/resources/tenants/client/requests/TenantCreateOrReplaceParams.ts similarity index 61% rename from src/api/resources/tenants/types/CreateOrReplaceTenantRequest.ts rename to src/api/resources/tenants/client/requests/TenantCreateOrReplaceParams.ts index 744834e..c924ec8 100644 --- a/src/api/resources/tenants/types/CreateOrReplaceTenantRequest.ts +++ b/src/api/resources/tenants/client/requests/TenantCreateOrReplaceParams.ts @@ -2,19 +2,19 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Courier from "../../.."; +import * as Courier from "../../../.."; -export interface CreateOrReplaceTenantRequest { +export interface TenantCreateOrReplaceParams { /** Name of the tenant. */ name: string; /** Tenant's parent id (if any). */ - parent_tenant_id: string; + parent_tenant_id?: string; /** Defines the preferences used for the tenant when the user hasn't specified their own. */ - default_preferences: Courier.DefaultPreferences; + default_preferences?: Courier.DefaultPreferences; /** Arbitrary properties accessible to a template. */ - properties: (Courier.TemplateProperty | undefined)[]; + properties?: (Courier.TemplateProperty | undefined)[]; /** A user profile object merged with user profile on send. */ - user_profile?: any; + user_profile?: Record; /** Brand to be used for the account when one is not specified by the send call. */ - brand_id: string; + brand_id?: string; } diff --git a/src/api/resources/tenants/client/requests/index.ts b/src/api/resources/tenants/client/requests/index.ts new file mode 100644 index 0000000..18d1a4e --- /dev/null +++ b/src/api/resources/tenants/client/requests/index.ts @@ -0,0 +1 @@ +export { TenantCreateOrReplaceParams } from "./TenantCreateOrReplaceParams"; diff --git a/src/api/resources/tenants/types/CreateOrReplaceTenantResponse.ts b/src/api/resources/tenants/types/Tenant.ts similarity index 88% rename from src/api/resources/tenants/types/CreateOrReplaceTenantResponse.ts rename to src/api/resources/tenants/types/Tenant.ts index 1c1fa9f..406aa62 100644 --- a/src/api/resources/tenants/types/CreateOrReplaceTenantResponse.ts +++ b/src/api/resources/tenants/types/Tenant.ts @@ -4,7 +4,7 @@ import * as Courier from "../../.."; -export interface CreateOrReplaceTenantResponse { +export interface Tenant { /** Id of the tenant. */ id: string; /** Name of the tenant. */ @@ -16,7 +16,7 @@ export interface CreateOrReplaceTenantResponse { /** Arbitrary properties accessible to a template. */ properties?: Courier.TemplateProperty | undefined; /** A user profile object merged with user profile on send. */ - user_profile?: any; + user_profile?: Record; /** Brand to be used for the account when one is not specified by the send call. */ - brand_id: string; + brand_id?: string; } diff --git a/src/api/resources/tenants/types/TenantListResponse.ts b/src/api/resources/tenants/types/TenantListResponse.ts new file mode 100644 index 0000000..fe185d3 --- /dev/null +++ b/src/api/resources/tenants/types/TenantListResponse.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Courier from "../../.."; + +export interface TenantListResponse { + /** A pointer to the next page of results. Defined only whenhas_more is set to true. */ + cursor?: string; + /** Set to true when there are more pages that can be retrieved. */ + has_more: boolean; + /** An array of Tenants */ + items: Courier.Tenant[]; + /** + * A url that may be used to generate fetch the next set of results. + * Defined only whenhas_more is set to true + * + */ + next_url?: string; + /** A url that may be used to generate these results. */ + url: string; + /** Always set to "list". Represents the type of this object. */ + type: "list"; +} diff --git a/src/api/resources/tenants/types/index.ts b/src/api/resources/tenants/types/index.ts index a21cfd7..af52fb2 100644 --- a/src/api/resources/tenants/types/index.ts +++ b/src/api/resources/tenants/types/index.ts @@ -1,6 +1,6 @@ -export * from "./CreateOrReplaceTenantRequest"; export * from "./DefaultPreferences"; export * from "./SubscriptionTopic"; export * from "./SubscriptionTopicStatus"; -export * from "./CreateOrReplaceTenantResponse"; +export * from "./Tenant"; +export * from "./TenantListResponse"; export * from "./TemplateProperty"; diff --git a/src/api/resources/tokenManagement/client/Client.ts b/src/api/resources/tokenManagement/client/Client.ts index d6569ee..3af17b9 100644 --- a/src/api/resources/tokenManagement/client/Client.ts +++ b/src/api/resources/tokenManagement/client/Client.ts @@ -11,7 +11,7 @@ import * as errors from "../../../../errors"; export declare namespace TokenManagement { interface Options { environment?: core.Supplier; - authorizationToken: core.Supplier; + authorizationToken?: core.Supplier; } interface RequestOptions { @@ -21,7 +21,7 @@ export declare namespace TokenManagement { } export class TokenManagement { - constructor(protected readonly _options: TokenManagement.Options) {} + constructor(protected readonly _options: TokenManagement.Options = {}) {} /** * Adds multiple tokens to a user and overwrites matching existing tokens. @@ -38,7 +38,7 @@ export class TokenManagement { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -95,7 +95,7 @@ export class TokenManagement { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", body: request, @@ -153,7 +153,7 @@ export class TokenManagement { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", body: request, @@ -210,7 +210,7 @@ export class TokenManagement { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -265,7 +265,7 @@ export class TokenManagement { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, 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 ff6b70d..197ef90 100644 --- a/src/api/resources/translations/client/Client.ts +++ b/src/api/resources/translations/client/Client.ts @@ -11,7 +11,7 @@ import * as errors from "../../../../errors"; export declare namespace Translations { interface Options { environment?: core.Supplier; - authorizationToken: core.Supplier; + authorizationToken?: core.Supplier; } interface RequestOptions { @@ -21,7 +21,7 @@ export declare namespace Translations { } export class Translations { - constructor(protected readonly _options: Translations.Options) {} + constructor(protected readonly _options: Translations.Options = {}) {} /** * Get translations by locale @@ -38,7 +38,7 @@ export class Translations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, @@ -95,7 +95,7 @@ export class Translations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", body: request, diff --git a/src/api/resources/userPreferences/client/Client.ts b/src/api/resources/userPreferences/client/Client.ts index 7415b6e..acd8d11 100644 --- a/src/api/resources/userPreferences/client/Client.ts +++ b/src/api/resources/userPreferences/client/Client.ts @@ -11,7 +11,7 @@ import * as errors from "../../../../errors"; export declare namespace UserPreferences { interface Options { environment?: core.Supplier; - authorizationToken: core.Supplier; + authorizationToken?: core.Supplier; } interface RequestOptions { @@ -21,16 +21,16 @@ export declare namespace UserPreferences { } export class UserPreferences { - constructor(protected readonly _options: UserPreferences.Options) {} + constructor(protected readonly _options: UserPreferences.Options = {}) {} /** * Fetch all user preferences. * @throws {@link Courier.BadRequestError} */ - public async getPreferences( + public async list( userId: string, requestOptions?: UserPreferences.RequestOptions - ): Promise { + ): Promise { const _response = await core.fetcher({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, @@ -41,14 +41,14 @@ export class UserPreferences { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { - return _response.body as Courier.UserPreferences; + return _response.body as Courier.UserPreferencesListResponse; } if (_response.error.reason === "status-code") { @@ -82,11 +82,11 @@ export class UserPreferences { * Fetch user preferences for a specific subscription topic. * @throws {@link Courier.NotFoundError} */ - public async getSubscriptionTopic( + public async get( userId: string, topicId: string, requestOptions?: UserPreferences.RequestOptions - ): Promise { + ): Promise { const _response = await core.fetcher({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, @@ -97,14 +97,14 @@ export class UserPreferences { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { - return _response.body as Courier.TopicPreference; + return _response.body as Courier.UserPreferencesGetResponse; } if (_response.error.reason === "status-code") { @@ -138,12 +138,12 @@ export class UserPreferences { * Fetch user preferences for a specific subscription topic. * @throws {@link Courier.BadRequestError} */ - public async updateSubscriptionTopic( + public async update( userId: string, topicId: string, - request: Courier.UpdateSubscriptionTopicRequest, + request: Courier.UserPreferencesUpdateParams, requestOptions?: UserPreferences.RequestOptions - ): Promise { + ): Promise { const _response = await core.fetcher({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production, @@ -154,7 +154,7 @@ export class UserPreferences { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", - "X-Fern-SDK-Version": "6.0.1", + "X-Fern-SDK-Version": "6.0.2", }, contentType: "application/json", body: request, @@ -162,7 +162,7 @@ export class UserPreferences { maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { - return _response.body as Courier.UpdateSubscriptionTopicResponse; + return _response.body as Courier.UserPreferencesUpdateResponse; } if (_response.error.reason === "status-code") { diff --git a/src/api/resources/userPreferences/client/index.ts b/src/api/resources/userPreferences/client/index.ts index cb0ff5c..415726b 100644 --- a/src/api/resources/userPreferences/client/index.ts +++ b/src/api/resources/userPreferences/client/index.ts @@ -1 +1 @@ -export {}; +export * from "./requests"; diff --git a/src/api/resources/userPreferences/types/UpdateSubscriptionTopicRequest.ts b/src/api/resources/userPreferences/client/requests/UserPreferencesUpdateParams.ts similarity index 66% rename from src/api/resources/userPreferences/types/UpdateSubscriptionTopicRequest.ts rename to src/api/resources/userPreferences/client/requests/UserPreferencesUpdateParams.ts index 9134552..2bc5fa1 100644 --- a/src/api/resources/userPreferences/types/UpdateSubscriptionTopicRequest.ts +++ b/src/api/resources/userPreferences/client/requests/UserPreferencesUpdateParams.ts @@ -2,10 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Courier from "../../.."; +import * as Courier from "../../../.."; -export interface UpdateSubscriptionTopicRequest { - status?: Courier.PreferenceStatus; +export interface UserPreferencesUpdateParams { + status: Courier.PreferenceStatus; /** Should contain unique items. */ custom_routing?: Courier.ChannelClassification[]; default_status: Courier.PreferenceStatus; diff --git a/src/api/resources/userPreferences/client/requests/index.ts b/src/api/resources/userPreferences/client/requests/index.ts new file mode 100644 index 0000000..b56384d --- /dev/null +++ b/src/api/resources/userPreferences/client/requests/index.ts @@ -0,0 +1 @@ +export { UserPreferencesUpdateParams } from "./UserPreferencesUpdateParams"; diff --git a/src/api/resources/userPreferences/types/UserPreferencesGetResponse.ts b/src/api/resources/userPreferences/types/UserPreferencesGetResponse.ts new file mode 100644 index 0000000..89f3d20 --- /dev/null +++ b/src/api/resources/userPreferences/types/UserPreferencesGetResponse.ts @@ -0,0 +1,9 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Courier from "../../.."; + +export interface UserPreferencesGetResponse { + topic: Courier.TopicPreference; +} diff --git a/src/api/resources/userPreferences/types/UserPreferences.ts b/src/api/resources/userPreferences/types/UserPreferencesListResponse.ts similarity index 83% rename from src/api/resources/userPreferences/types/UserPreferences.ts rename to src/api/resources/userPreferences/types/UserPreferencesListResponse.ts index 2db920f..c3a9f78 100644 --- a/src/api/resources/userPreferences/types/UserPreferences.ts +++ b/src/api/resources/userPreferences/types/UserPreferencesListResponse.ts @@ -4,7 +4,7 @@ import * as Courier from "../../.."; -export interface UserPreferences { +export interface UserPreferencesListResponse { paging: Courier.Paging; /** The Preferences associated with the user_id. */ items: Courier.TopicPreference[]; diff --git a/src/api/resources/userPreferences/types/UpdateSubscriptionTopicResponse.ts b/src/api/resources/userPreferences/types/UserPreferencesUpdateResponse.ts similarity index 65% rename from src/api/resources/userPreferences/types/UpdateSubscriptionTopicResponse.ts rename to src/api/resources/userPreferences/types/UserPreferencesUpdateResponse.ts index b8d09a2..ee0406c 100644 --- a/src/api/resources/userPreferences/types/UpdateSubscriptionTopicResponse.ts +++ b/src/api/resources/userPreferences/types/UserPreferencesUpdateResponse.ts @@ -2,6 +2,6 @@ * This file was auto-generated by Fern from our API Definition. */ -export interface UpdateSubscriptionTopicResponse { +export interface UserPreferencesUpdateResponse { message: string; } diff --git a/src/api/resources/userPreferences/types/index.ts b/src/api/resources/userPreferences/types/index.ts index cebd0c1..55b317b 100644 --- a/src/api/resources/userPreferences/types/index.ts +++ b/src/api/resources/userPreferences/types/index.ts @@ -1,4 +1,4 @@ -export * from "./UserPreferences"; +export * from "./UserPreferencesListResponse"; +export * from "./UserPreferencesGetResponse"; export * from "./TopicPreference"; -export * from "./UpdateSubscriptionTopicRequest"; -export * from "./UpdateSubscriptionTopicResponse"; +export * from "./UserPreferencesUpdateResponse"; diff --git a/src/core/fetcher/APIResponse.ts b/src/core/fetcher/APIResponse.ts index ea838f3..3664d09 100644 --- a/src/core/fetcher/APIResponse.ts +++ b/src/core/fetcher/APIResponse.ts @@ -3,6 +3,7 @@ export type APIResponse = SuccessfulResponse | Failed export interface SuccessfulResponse { ok: true; body: T; + headers?: Record; } export interface FailedResponse { diff --git a/src/core/fetcher/Fetcher.ts b/src/core/fetcher/Fetcher.ts index 96c7004..e25819a 100644 --- a/src/core/fetcher/Fetcher.ts +++ b/src/core/fetcher/Fetcher.ts @@ -1,7 +1,11 @@ -import axios, { AxiosAdapter, AxiosError, AxiosResponse } from "axios"; +import { default as FormData } from "form-data"; import qs from "qs"; import { APIResponse } from "./APIResponse"; +if (typeof window === "undefined") { + global.fetch = require("node-fetch"); +} + export type FetchFunction = (args: Fetcher.Args) => Promise>; export declare namespace Fetcher { @@ -15,9 +19,7 @@ export declare namespace Fetcher { timeoutMs?: number; maxRetries?: number; withCredentials?: boolean; - responseType?: "json" | "blob"; - adapter?: AxiosAdapter; - onUploadProgress?: (event: ProgressEvent) => void; + responseType?: "json" | "blob" | "streaming"; } export type Error = FailedStatusCodeError | NonJsonError | TimeoutError | UnknownError; @@ -62,29 +64,37 @@ async function fetcherImpl(args: Fetcher.Args): Promise => - await axios({ - url: args.url, - params: args.queryParameters, - paramsSerializer: (params) => { - return qs.stringify(params, { arrayFormat: "repeat" }); - }, + const url = + Object.keys(args.queryParameters ?? {}).length > 0 + ? `${args.url}?${qs.stringify(args.queryParameters, { arrayFormat: "repeat" })}` + : args.url; + + let body: BodyInit | undefined = undefined; + if (args.body instanceof FormData) { + // @ts-expect-error + body = args.body; + } else { + body = JSON.stringify(args.body); + } + + const makeRequest = async (): Promise => { + const controller = new AbortController(); + let abortId = undefined; + if (args.timeoutMs != null) { + abortId = setTimeout(() => controller.abort(), args.timeoutMs); + } + const response = await fetch(url, { method: args.method, headers, - data: args.body, - validateStatus: () => true, - transformResponse: (response) => response, - timeout: args.timeoutMs, - transitional: { - clarifyTimeoutError: true, - }, - withCredentials: args.withCredentials, - adapter: args.adapter, - onUploadProgress: args.onUploadProgress, - maxBodyLength: Infinity, - maxContentLength: Infinity, - responseType: args.responseType ?? "json", + body, + signal: controller.signal, + credentials: args.withCredentials ? "same-origin" : undefined, }); + if (abortId != null) { + clearTimeout(abortId); + } + return response; + }; try { let response = await makeRequest(); @@ -97,25 +107,28 @@ async function fetcherImpl(args: Fetcher.Args): Promise= 500 ) { const delay = Math.min(INITIAL_RETRY_DELAY * Math.pow(i, 2), MAX_RETRY_DELAY); - response = await new Promise((resolve) => setTimeout(resolve, delay)); + await new Promise((resolve) => setTimeout(resolve, delay)); + response = await makeRequest(); } else { break; } } let body: unknown; - if (args.responseType === "blob") { - body = response.data; - } else if (response.data != null && response.data.length > 0) { + if (response.body != null && args.responseType === "blob") { + body = await response.blob(); + } else if (response.body != null && args.responseType === "streaming") { + body = response.body; + } else if (response.body != null) { try { - body = JSON.parse(response.data) ?? undefined; - } catch { + body = await response.json(); + } catch (err) { return { ok: false, error: { reason: "non-json", statusCode: response.status, - rawBody: response.data, + rawBody: await response.text(), }, }; } @@ -125,6 +138,7 @@ async function fetcherImpl(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise, header: string): string | undefined { + for (const [headerKey, headerValue] of Object.entries(headers)) { + if (headerKey.toLowerCase() === header.toLowerCase()) { + return headerValue; + } + } + return undefined; +} diff --git a/src/core/fetcher/index.ts b/src/core/fetcher/index.ts index 6becab2..2d658ca 100644 --- a/src/core/fetcher/index.ts +++ b/src/core/fetcher/index.ts @@ -1,4 +1,5 @@ export type { APIResponse } from "./APIResponse"; export { fetcher } from "./Fetcher"; export type { Fetcher, FetchFunction } from "./Fetcher"; +export { getHeader } from "./getHeader"; export { Supplier } from "./Supplier"; diff --git a/yarn.lock b/yarn.lock index fa08e94..c8e69c1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,21 @@ # yarn lockfile v1 +"@types/node-fetch@2.6.9": + version "2.6.9" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.9.tgz#15f529d247f1ede1824f7e7acdaa192d5f28071e" + integrity sha512-bQVlnMLFJ2d35DkPNjEPmd9ueO/rh5EiaZt2bhqiSarPjZIuIV6bPQVqcrEyvNo+AfTrRGVazle1tl597w3gfA== + dependencies: + "@types/node" "*" + form-data "^4.0.0" + +"@types/node@*": + version "20.10.4" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.10.4.tgz#b246fd84d55d5b1b71bf51f964bd514409347198" + integrity sha512-D08YG6rr8X90YB56tSIuBaddy/UXAA9RKJoFvrsnogAum/0pmjkgi4+2nx96A330FmioegBWmEYQ+syqCFaveg== + dependencies: + undici-types "~5.26.4" + "@types/node@17.0.33": version "17.0.33" resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.33.tgz#3c1879b276dc63e73030bb91165e62a4509cd506" @@ -22,14 +37,6 @@ asynckit@^0.4.0: resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== -axios@0.27.2: - version "0.27.2" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972" - integrity sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ== - dependencies: - follow-redirects "^1.14.9" - form-data "^4.0.0" - call-bind@^1.0.0: version "1.0.5" resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.5.tgz#6fa2b7845ce0ea49bf4d8b9ef64727a2c2e2e513" @@ -60,12 +67,7 @@ delayed-stream@~1.0.0: resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== -follow-redirects@^1.14.9: - version "1.15.3" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.3.tgz#fe2f3ef2690afce7e82ed0b44db08165b207123a" - integrity sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q== - -form-data@^4.0.0: +form-data@4.0.0, form-data@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== @@ -137,6 +139,13 @@ mime-types@^2.1.12: dependencies: mime-db "1.52.0" +node-fetch@2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" + integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== + dependencies: + whatwg-url "^5.0.0" + object-inspect@^1.9.0: version "1.13.1" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.1.tgz#b96c6109324ccfef6b12216a956ca4dc2ff94bc2" @@ -173,12 +182,35 @@ side-channel@^1.0.4: get-intrinsic "^1.0.2" object-inspect "^1.9.0" +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== + typescript@4.6.4: version "4.6.4" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.4.tgz#caa78bbc3a59e6a5c510d35703f6a09877ce45e9" integrity sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg== +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== + url-join@4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/url-join/-/url-join-4.0.1.tgz#b642e21a2646808ffa178c4c5fda39844e12cde7" integrity sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA== + +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== + +whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0"