Skip to content

Commit

Permalink
SDK regeneration
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Dec 15, 2023
1 parent 5fd5d50 commit 5259476
Show file tree
Hide file tree
Showing 87 changed files with 1,345 additions and 240 deletions.
10 changes: 6 additions & 4 deletions 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",
Expand All @@ -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"
Expand Down
13 changes: 10 additions & 3 deletions src/Client.ts
Expand Up @@ -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";
Expand All @@ -25,7 +26,7 @@ import { UserPreferences } from "./api/resources/userPreferences/client/Client";
export declare namespace CourierClient {
interface Options {
environment?: core.Supplier<environments.CourierEnvironment | string>;
authorizationToken: core.Supplier<core.BearerToken | undefined>;
authorizationToken?: core.Supplier<core.BearerToken | undefined>;
}

interface RequestOptions {
Expand All @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
24 changes: 12 additions & 12 deletions src/api/resources/audiences/client/Client.ts
Expand Up @@ -11,7 +11,7 @@ import * as errors from "../../../../errors";
export declare namespace Audiences {
interface Options {
environment?: core.Supplier<environments.CourierEnvironment | string>;
authorizationToken: core.Supplier<core.BearerToken | undefined>;
authorizationToken?: core.Supplier<core.BearerToken | undefined>;
}

interface RequestOptions {
Expand All @@ -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.
Expand All @@ -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,
Expand Down Expand Up @@ -74,9 +74,9 @@ export class Audiences {
*/
public async update(
audienceId: string,
request: Courier.AudienceRequest,
request: Courier.AudienceUpdateParams = {},
requestOptions?: Audiences.RequestOptions
): Promise<Courier.Audience> {
): Promise<Courier.AudienceUpdateResponse> {
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production,
Expand All @@ -87,15 +87,15 @@ 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,
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
});
if (_response.ok) {
return _response.body as Courier.Audience;
return _response.body as Courier.AudienceUpdateResponse;
}

if (_response.error.reason === "status-code") {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -172,7 +172,7 @@ export class Audiences {
*/
public async listMembers(
audienceId: string,
request: Courier.ListAudienceMembersRequest = {},
request: Courier.AudienceMembersListParams = {},
requestOptions?: Audiences.RequestOptions
): Promise<Courier.AudienceMemberListResponse> {
const { cursor } = request;
Expand All @@ -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,
Expand Down Expand Up @@ -234,7 +234,7 @@ export class Audiences {
* @throws {@link Courier.BadRequestError}
*/
public async listAudiences(
request: Courier.ListAudiencesRequest = {},
request: Courier.AudiencesListParams = {},
requestOptions?: Audiences.RequestOptions
): Promise<Courier.AudienceListResponse> {
const { cursor } = request;
Expand All @@ -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,
Expand Down
Expand Up @@ -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
*
Expand Down
Expand Up @@ -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 */
Expand Down
Expand Up @@ -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
*
Expand Down
5 changes: 3 additions & 2 deletions 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";
Expand Up @@ -4,6 +4,6 @@

import * as Courier from "../../..";

export interface AudiencePutResponse {
export interface AudienceUpdateResponse {
audience: Courier.Audience;
}
3 changes: 1 addition & 2 deletions src/api/resources/audiences/types/index.ts
@@ -1,4 +1,3 @@
export * from "./AudienceRequest";
export * from "./Filter";
export * from "./Operator";
export * from "./BaseFilterConfig";
Expand All @@ -12,4 +11,4 @@ export * from "./AudienceMember";
export * from "./AudienceListResponse";
export * from "./AudienceMemberGetResponse";
export * from "./AudienceMemberListResponse";
export * from "./AudiencePutResponse";
export * from "./AudienceUpdateResponse";
8 changes: 4 additions & 4 deletions src/api/resources/auditEvents/client/Client.ts
Expand Up @@ -11,7 +11,7 @@ import * as errors from "../../../../errors";
export declare namespace AuditEvents {
interface Options {
environment?: core.Supplier<environments.CourierEnvironment | string>;
authorizationToken: core.Supplier<core.BearerToken | undefined>;
authorizationToken?: core.Supplier<core.BearerToken | undefined>;
}

interface RequestOptions {
Expand All @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/api/resources/authTokens/client/Client.ts
Expand Up @@ -11,7 +11,7 @@ import * as errors from "../../../../errors";
export declare namespace AuthTokens {
interface Options {
environment?: core.Supplier<environments.CourierEnvironment | string>;
authorizationToken: core.Supplier<core.BearerToken | undefined>;
authorizationToken?: core.Supplier<core.BearerToken | undefined>;
}

interface RequestOptions {
Expand All @@ -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.
Expand All @@ -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
Expand Down
16 changes: 9 additions & 7 deletions src/api/resources/automations/client/Client.ts
Expand Up @@ -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<environments.CourierEnvironment | string>;
authorizationToken: core.Supplier<core.BearerToken | undefined>;
authorizationToken?: core.Supplier<core.BearerToken | undefined>;
}

interface RequestOptions {
Expand All @@ -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<void> {
): Promise<Courier.AutomationInvokeResponse> {
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.CourierEnvironment.Production,
Expand All @@ -45,19 +46,20 @@ 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
? requestOptions?.idempotencyExpiry.toString()
: 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") {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5259476

Please sign in to comment.