delivrie 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Delivrie = exports.VERSION = void 0;
4
4
  const webhooks_js_1 = require("./webhooks.cjs");
5
- exports.VERSION = "0.1.0";
5
+ exports.VERSION = "0.1.1";
6
6
  const DEFAULT_BASE_URL = "https://delivrie.io/api";
7
7
  const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
8
8
  const enc = encodeURIComponent;
@@ -101,6 +101,7 @@ class Delivrie {
101
101
  /** Send now, or schedule with `scheduled_at`. */
102
102
  send: (id, params = {}) => this.request("POST", `/broadcasts/${enc(id)}/send`, params.scheduled_at === undefined ? {} : { scheduled_at: params.scheduled_at instanceof Date ? params.scheduled_at.toISOString() : params.scheduled_at }),
103
103
  cancel: (id) => this.request("POST", `/broadcasts/${enc(id)}/cancel`),
104
+ /** How many contacts the broadcast will reach. */
104
105
  recipients: (id) => this.request("GET", `/broadcasts/${enc(id)}/recipients`),
105
106
  remove: (id) => this.request("DELETE", `/broadcasts/${enc(id)}`),
106
107
  };
@@ -1,6 +1,6 @@
1
- import type { ApiKey, Automation, Broadcast, Contact, CreateApiKeyRequest, CreateApiKeyResponse, CreateBroadcastRequest, CreateContactRequest, CreateDomainRequest, CreateEmailResponse, CreateTemplateRequest, CreateWebhookRequest, CreateWebhookResponse, Domain, Email, EmailSummary, ForwardEmailRequest, InboxThread, List, ListContactsParams, ListEmailsParams, Log, LogSummary, Metrics, Pagination, ReplyToThreadRequest, RequestOptions, Result, Segment, SendEmailRequest, SendEventRequest, Suppression, Template, Topic, UpdateContactRequest, UpdateDomainRequest, Usage, Webhook, WebhookDelivery, Deleted } from "./types.cjs";
1
+ import type { ApiKey, Automation, Broadcast, Contact, CreateApiKeyRequest, CreateApiKeyResponse, CreateBroadcastRequest, CreateContactRequest, CreateDomainRequest, CreateEmailResponse, CreateTemplateRequest, CreateWebhookRequest, CreateWebhookResponse, Domain, Email, EmailSummary, ForwardEmailRequest, InboxThread, List, ListContactsParams, ListEmailsParams, Log, LogSummary, Metrics, Pagination, ReplyToThreadRequest, RequestOptions, Result, Segment, SendEmailRequest, SendEventRequest, Suppression, Template, Topic, UpdateContactRequest, UpdateDomainRequest, Usage, Webhook, WebhookDelivery, Deleted, BroadcastRecipientCount } from "./types.cjs";
2
2
  import { type VerifyWebhookOptions } from "./webhooks.cjs";
3
- export declare const VERSION = "0.1.0";
3
+ export declare const VERSION = "0.1.1";
4
4
  export interface DelivrieOptions {
5
5
  /** Defaults to `https://delivrie.io/api`. */
6
6
  baseUrl?: string;
@@ -94,7 +94,10 @@ export declare class Delivrie {
94
94
  }>>;
95
95
  /** By id or email address. */
96
96
  get: (idOrEmail: string) => Promise<Result<Contact>>;
97
- update: (idOrEmail: string, params: UpdateContactRequest) => Promise<Result<Contact>>;
97
+ update: (idOrEmail: string, params: UpdateContactRequest) => Promise<Result<{
98
+ object: "contact";
99
+ id: string;
100
+ }>>;
98
101
  list: (params?: ListContactsParams) => Promise<Result<List<Contact>>>;
99
102
  remove: (idOrEmail: string) => Promise<Result<Deleted>>;
100
103
  };
@@ -128,7 +131,8 @@ export declare class Delivrie {
128
131
  scheduled_at?: string | Date;
129
132
  }) => Promise<Result<Broadcast>>;
130
133
  cancel: (id: string) => Promise<Result<Broadcast>>;
131
- recipients: (id: string) => Promise<Result<List<Record<string, unknown>>>>;
134
+ /** How many contacts the broadcast will reach. */
135
+ recipients: (id: string) => Promise<Result<BroadcastRecipientCount>>;
132
136
  remove: (id: string) => Promise<Result<Deleted>>;
133
137
  };
134
138
  readonly templates: {
@@ -49,8 +49,8 @@ export interface TemplateRef {
49
49
  variables?: Record<string, string | number | boolean | null>;
50
50
  }
51
51
  export interface SendEmailRequest {
52
- /** Sender on a verified domain. `"Name <email@domain>"` sets a display name. */
53
- from: string;
52
+ /** Sender on a verified domain. `"Name <email@domain>"` sets a display name. Optional when the template has a default sender. */
53
+ from?: string;
54
54
  /** One address or up to 50. */
55
55
  to: string | string[];
56
56
  /** Required unless you send a template. */
@@ -380,6 +380,14 @@ export interface ReplyToThreadRequest {
380
380
  text?: string;
381
381
  html?: string;
382
382
  }
383
+ export interface BroadcastRecipientCount {
384
+ /** Contacts in the segment. */
385
+ total: number;
386
+ /** Contacts who opted out of the broadcast's topic. */
387
+ topic_opt_out: number;
388
+ /** Contacts it will be sent to, after unsubscribes, topic opt-outs and suppressions. */
389
+ recipients: number;
390
+ }
383
391
  export interface Deleted {
384
392
  object: string;
385
393
  id: string;
@@ -1,6 +1,6 @@
1
- import type { ApiKey, Automation, Broadcast, Contact, CreateApiKeyRequest, CreateApiKeyResponse, CreateBroadcastRequest, CreateContactRequest, CreateDomainRequest, CreateEmailResponse, CreateTemplateRequest, CreateWebhookRequest, CreateWebhookResponse, Domain, Email, EmailSummary, ForwardEmailRequest, InboxThread, List, ListContactsParams, ListEmailsParams, Log, LogSummary, Metrics, Pagination, ReplyToThreadRequest, RequestOptions, Result, Segment, SendEmailRequest, SendEventRequest, Suppression, Template, Topic, UpdateContactRequest, UpdateDomainRequest, Usage, Webhook, WebhookDelivery, Deleted } from "./types.js";
1
+ import type { ApiKey, Automation, Broadcast, Contact, CreateApiKeyRequest, CreateApiKeyResponse, CreateBroadcastRequest, CreateContactRequest, CreateDomainRequest, CreateEmailResponse, CreateTemplateRequest, CreateWebhookRequest, CreateWebhookResponse, Domain, Email, EmailSummary, ForwardEmailRequest, InboxThread, List, ListContactsParams, ListEmailsParams, Log, LogSummary, Metrics, Pagination, ReplyToThreadRequest, RequestOptions, Result, Segment, SendEmailRequest, SendEventRequest, Suppression, Template, Topic, UpdateContactRequest, UpdateDomainRequest, Usage, Webhook, WebhookDelivery, Deleted, BroadcastRecipientCount } from "./types.js";
2
2
  import { type VerifyWebhookOptions } from "./webhooks.js";
3
- export declare const VERSION = "0.1.0";
3
+ export declare const VERSION = "0.1.1";
4
4
  export interface DelivrieOptions {
5
5
  /** Defaults to `https://delivrie.io/api`. */
6
6
  baseUrl?: string;
@@ -94,7 +94,10 @@ export declare class Delivrie {
94
94
  }>>;
95
95
  /** By id or email address. */
96
96
  get: (idOrEmail: string) => Promise<Result<Contact>>;
97
- update: (idOrEmail: string, params: UpdateContactRequest) => Promise<Result<Contact>>;
97
+ update: (idOrEmail: string, params: UpdateContactRequest) => Promise<Result<{
98
+ object: "contact";
99
+ id: string;
100
+ }>>;
98
101
  list: (params?: ListContactsParams) => Promise<Result<List<Contact>>>;
99
102
  remove: (idOrEmail: string) => Promise<Result<Deleted>>;
100
103
  };
@@ -128,7 +131,8 @@ export declare class Delivrie {
128
131
  scheduled_at?: string | Date;
129
132
  }) => Promise<Result<Broadcast>>;
130
133
  cancel: (id: string) => Promise<Result<Broadcast>>;
131
- recipients: (id: string) => Promise<Result<List<Record<string, unknown>>>>;
134
+ /** How many contacts the broadcast will reach. */
135
+ recipients: (id: string) => Promise<Result<BroadcastRecipientCount>>;
132
136
  remove: (id: string) => Promise<Result<Deleted>>;
133
137
  };
134
138
  readonly templates: {
@@ -1,5 +1,5 @@
1
1
  import { verifyWebhook } from "./webhooks.js";
2
- export const VERSION = "0.1.0";
2
+ export const VERSION = "0.1.1";
3
3
  const DEFAULT_BASE_URL = "https://delivrie.io/api";
4
4
  const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
5
5
  const enc = encodeURIComponent;
@@ -98,6 +98,7 @@ export class Delivrie {
98
98
  /** Send now, or schedule with `scheduled_at`. */
99
99
  send: (id, params = {}) => this.request("POST", `/broadcasts/${enc(id)}/send`, params.scheduled_at === undefined ? {} : { scheduled_at: params.scheduled_at instanceof Date ? params.scheduled_at.toISOString() : params.scheduled_at }),
100
100
  cancel: (id) => this.request("POST", `/broadcasts/${enc(id)}/cancel`),
101
+ /** How many contacts the broadcast will reach. */
101
102
  recipients: (id) => this.request("GET", `/broadcasts/${enc(id)}/recipients`),
102
103
  remove: (id) => this.request("DELETE", `/broadcasts/${enc(id)}`),
103
104
  };
@@ -49,8 +49,8 @@ export interface TemplateRef {
49
49
  variables?: Record<string, string | number | boolean | null>;
50
50
  }
51
51
  export interface SendEmailRequest {
52
- /** Sender on a verified domain. `"Name <email@domain>"` sets a display name. */
53
- from: string;
52
+ /** Sender on a verified domain. `"Name <email@domain>"` sets a display name. Optional when the template has a default sender. */
53
+ from?: string;
54
54
  /** One address or up to 50. */
55
55
  to: string | string[];
56
56
  /** Required unless you send a template. */
@@ -380,6 +380,14 @@ export interface ReplyToThreadRequest {
380
380
  text?: string;
381
381
  html?: string;
382
382
  }
383
+ export interface BroadcastRecipientCount {
384
+ /** Contacts in the segment. */
385
+ total: number;
386
+ /** Contacts who opted out of the broadcast's topic. */
387
+ topic_opt_out: number;
388
+ /** Contacts it will be sent to, after unsubscribes, topic opt-outs and suppressions. */
389
+ recipients: number;
390
+ }
383
391
  export interface Deleted {
384
392
  object: string;
385
393
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "delivrie",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Official Node.js and TypeScript SDK for the Delivrie email API: send transactional email, manage domains, contacts, broadcasts and templates, and verify webhooks.",
5
5
  "keywords": ["delivrie", "email", "email-api", "transactional-email", "smtp", "resend-alternative", "webhooks", "nigeria", "naira"],
6
6
  "homepage": "https://delivrie.io/docs/sdks",