diff --git a/apps/docs/api-reference/openapi.json b/apps/docs/api-reference/openapi.json index 137804a..a665b73 100644 --- a/apps/docs/api-reference/openapi.json +++ b/apps/docs/api-reference/openapi.json @@ -340,7 +340,18 @@ "type": "string" }, "subject": { - "type": "string" + "type": "string", + "description": "Optional when templateId is provided" + }, + "templateId": { + "type": "string", + "description": "ID of a template from the dashboard" + }, + "variables": { + "type": "object", + "additionalProperties": { + "type": "string" + } }, "replyTo": { "anyOf": [ @@ -412,8 +423,7 @@ }, "required": [ "to", - "from", - "subject" + "from" ] } } diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 9f6bde8..a5d1637 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "unsend", - "version": "1.3.0", + "version": "1.4.0", "description": "", "main": "./dist/index.js", "module": "./dist/index.mjs", diff --git a/packages/sdk/types/schema.d.ts b/packages/sdk/types/schema.d.ts index af95744..1912aef 100644 --- a/packages/sdk/types/schema.d.ts +++ b/packages/sdk/types/schema.d.ts @@ -12,35 +12,35 @@ export interface paths { 200: { content: { "application/json": ({ - /** - * @description The ID of the domain - * @example 1 - */ - id: number; - /** - * @description The name of the domain - * @example example.com - */ - name: string; - /** - * @description The ID of the team - * @example 1 - */ - teamId: number; - /** @enum {string} */ - status: "NOT_STARTED" | "PENDING" | "SUCCESS" | "FAILED" | "TEMPORARY_FAILURE"; - /** @default us-east-1 */ - region?: string; - /** @default false */ - clickTracking?: boolean; - /** @default false */ - openTracking?: boolean; - publicKey: string; - dkimStatus?: string | null; - spfDetails?: string | null; - createdAt: string; - updatedAt: string; - })[]; + /** + * @description The ID of the domain + * @example 1 + */ + id: number; + /** + * @description The name of the domain + * @example example.com + */ + name: string; + /** + * @description The ID of the team + * @example 1 + */ + teamId: number; + /** @enum {string} */ + status: "NOT_STARTED" | "PENDING" | "SUCCESS" | "FAILED" | "TEMPORARY_FAILURE"; + /** @default us-east-1 */ + region?: string; + /** @default false */ + clickTracking?: boolean; + /** @default false */ + openTracking?: boolean; + publicKey: string; + dkimStatus?: string | null; + spfDetails?: string | null; + createdAt: string; + updatedAt: string; + })[]; }; }; }; @@ -71,12 +71,12 @@ export interface paths { createdAt: string; updatedAt: string; emailEvents: ({ - emailId: string; - /** @enum {string} */ - status: "SCHEDULED" | "QUEUED" | "SENT" | "DELIVERY_DELAYED" | "BOUNCED" | "REJECTED" | "RENDERING_FAILURE" | "DELIVERED" | "OPENED" | "CLICKED" | "COMPLAINED" | "FAILED" | "CANCELLED"; - createdAt: string; - data?: unknown; - })[]; + emailId: string; + /** @enum {string} */ + status: "SCHEDULED" | "QUEUED" | "SENT" | "DELIVERY_DELAYED" | "BOUNCED" | "REJECTED" | "RENDERING_FAILURE" | "DELIVERED" | "OPENED" | "CLICKED" | "COMPLAINED" | "FAILED" | "CANCELLED"; + createdAt: string; + data?: unknown; + })[]; }; }; }; @@ -115,16 +115,22 @@ export interface paths { "application/json": { to: string | string[]; from: string; - subject: string; + /** @description Optional when templateId is provided */ + subject?: string; + /** @description ID of a template from the dashboard */ + templateId?: string; + variables?: { + [key: string]: string; + }; replyTo?: string | string[]; cc?: string | string[]; bcc?: string | string[]; text?: string; html?: string; attachments?: { - filename: string; - content: string; - }[]; + filename: string; + content: string; + }[]; /** Format: date-time */ scheduledAt?: string; }; @@ -162,6 +168,40 @@ export interface paths { }; }; "/v1/contactBooks/{contactBookId}/contacts": { + get: { + parameters: { + query?: { + emails?: string; + page?: number; + limit?: number; + ids?: string; + }; + path: { + contactBookId: string; + }; + }; + responses: { + /** @description Retrieve multiple contacts */ + 200: { + content: { + "application/json": ({ + id: string; + firstName?: string | null; + lastName?: string | null; + email: string; + /** @default true */ + subscribed?: boolean; + properties: { + [key: string]: string; + }; + contactBookId: string; + createdAt: string; + updatedAt: string; + })[]; + }; + }; + }; + }; post: { parameters: { path: { @@ -192,7 +232,6 @@ export interface paths { }; }; }; - }; "/v1/contactBooks/{contactBookId}/contacts/{contactId}": { get: { @@ -224,41 +263,10 @@ export interface paths { }; }; }; - patch: { - parameters: { - path: { - contactBookId: string; - contactId: string; - }; - }; - requestBody: { - content: { - "application/json": { - firstName?: string; - lastName?: string; - properties?: { - [key: string]: string; - }; - subscribed?: boolean; - }; - }; - }; - responses: { - /** @description Retrieve the user */ - 200: { - content: { - "application/json": { - contactId?: string; - }; - }; - }; - }; - }; put: { parameters: { path: { contactBookId: string; - contactId: string; }; }; requestBody: { @@ -303,6 +311,36 @@ export interface paths { }; }; }; + patch: { + parameters: { + path: { + contactBookId: string; + contactId: string; + }; + }; + requestBody: { + content: { + "application/json": { + firstName?: string; + lastName?: string; + properties?: { + [key: string]: string; + }; + subscribed?: boolean; + }; + }; + }; + responses: { + /** @description Retrieve the user */ + 200: { + content: { + "application/json": { + contactId?: string; + }; + }; + }; + }; + }; }; }