emailr 1.6.0 → 1.7.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.
package/dist/index.d.mts CHANGED
@@ -407,7 +407,9 @@ interface Webhook {
407
407
  organization_id: string;
408
408
  name: string;
409
409
  url: string;
410
+ type: 'transactional' | 'domain' | 'receiving';
410
411
  events: string[];
412
+ inbox_ids: string[] | null;
411
413
  secret: string;
412
414
  active: boolean;
413
415
  created_by: string | null;
@@ -416,12 +418,8 @@ interface Webhook {
416
418
  interface CreateWebhookRequest {
417
419
  name: string;
418
420
  url: string;
419
- events: string[];
420
- }
421
- interface UpdateWebhookRequest {
422
- name?: string;
423
- url?: string;
424
- events?: string[];
421
+ type: 'transactional' | 'domain' | 'receiving';
422
+ inbox_ids?: string[];
425
423
  }
426
424
  interface WebhookToggleResponse {
427
425
  success: boolean;
@@ -438,10 +436,6 @@ interface WebhookDelivery {
438
436
  delivered_at: string | null;
439
437
  created_at: string;
440
438
  }
441
- interface ListWebhooksParams {
442
- page?: number;
443
- limit?: number;
444
- }
445
439
  interface Broadcast {
446
440
  id: string;
447
441
  organization_id: string;
@@ -644,6 +638,45 @@ interface EmailMetrics {
644
638
  bounced: number;
645
639
  complained: number;
646
640
  }
641
+ interface Topic {
642
+ id: string;
643
+ organization_id: string;
644
+ name: string;
645
+ description: string | null;
646
+ created_at: string;
647
+ updated_at: string;
648
+ }
649
+ interface CreateTopicRequest {
650
+ name: string;
651
+ description?: string;
652
+ }
653
+ interface UpdateTopicRequest {
654
+ name?: string;
655
+ description?: string;
656
+ }
657
+ interface ContactPropertyDefinition {
658
+ id: string;
659
+ organization_id: string;
660
+ name: string;
661
+ type: 'string' | 'number' | 'boolean' | 'date';
662
+ created_at: string;
663
+ updated_at: string;
664
+ }
665
+ interface CreateContactPropertyDefinitionRequest {
666
+ name: string;
667
+ type: 'string' | 'number' | 'boolean' | 'date';
668
+ }
669
+ interface EmailEvent {
670
+ id: string;
671
+ email_id: string;
672
+ event_type: string;
673
+ created_at: string;
674
+ metadata?: Record<string, unknown>;
675
+ }
676
+ interface ListLogsParams {
677
+ email_id?: string;
678
+ event_type?: string;
679
+ }
647
680
 
648
681
  declare class InboxesResource {
649
682
  private readonly http;
@@ -779,6 +812,13 @@ declare class TemplatesResource {
779
812
  * @returns The HTML content as a string
780
813
  */
781
814
  fetch(id: string, options?: FetchTemplateOptions): Promise<string>;
815
+ /**
816
+ * Publish a template, promoting preview_html to html_content
817
+ *
818
+ * @param id - The template ID
819
+ * @returns The published template
820
+ */
821
+ publish(id: string): Promise<Template>;
782
822
  }
783
823
 
784
824
  declare class DomainsResource {
@@ -822,39 +862,21 @@ declare class WebhooksResource {
822
862
  */
823
863
  create(data: CreateWebhookRequest): Promise<Webhook>;
824
864
  /**
825
- * Get webhook by ID
865
+ * List all webhooks
826
866
  */
827
- get(id: string): Promise<Webhook>;
828
- /**
829
- * List webhooks with pagination
830
- */
831
- list(params?: ListWebhooksParams): Promise<PaginatedResponse<Webhook>>;
832
- /**
833
- * Update a webhook
834
- */
835
- update(id: string, data: UpdateWebhookRequest): Promise<Webhook>;
867
+ list(): Promise<Webhook[]>;
836
868
  /**
837
869
  * Delete a webhook
838
870
  */
839
871
  delete(id: string): Promise<SuccessResponse>;
840
872
  /**
841
- * Enable a webhook
842
- */
843
- enable(id: string): Promise<WebhookToggleResponse>;
844
- /**
845
- * Disable a webhook
873
+ * Toggle a webhook's active state (enable/disable)
846
874
  */
847
- disable(id: string): Promise<WebhookToggleResponse>;
875
+ toggle(id: string): Promise<WebhookToggleResponse>;
848
876
  /**
849
877
  * List webhook deliveries
850
878
  */
851
- listDeliveries(id: string): Promise<{
852
- data: WebhookDelivery[];
853
- }>;
854
- /**
855
- * Retry a failed webhook delivery
856
- */
857
- retryDelivery(webhookId: string, deliveryId: string): Promise<SuccessResponse>;
879
+ listDeliveries(id: string): Promise<WebhookDelivery[]>;
858
880
  }
859
881
 
860
882
  declare class BroadcastsResource {
@@ -944,6 +966,16 @@ declare class SegmentsResource {
944
966
  getCount(id: string): Promise<{
945
967
  count: number;
946
968
  }>;
969
+ /**
970
+ * Add a single contact to a manual segment
971
+ */
972
+ addContact(id: string, contactId: string): Promise<SuccessResponse>;
973
+ /**
974
+ * Bulk add contacts to a manual segment
975
+ */
976
+ bulkAddContacts(id: string, contactIds: string[]): Promise<{
977
+ added: number;
978
+ }>;
947
979
  }
948
980
 
949
981
  /**
@@ -1091,6 +1123,55 @@ declare class ThreadsResource {
1091
1123
  }>;
1092
1124
  }
1093
1125
 
1126
+ declare class TopicsResource {
1127
+ private readonly http;
1128
+ constructor(http: HttpClient);
1129
+ /**
1130
+ * List all topics
1131
+ */
1132
+ list(): Promise<{
1133
+ topics: Topic[];
1134
+ }>;
1135
+ /**
1136
+ * Create a new topic
1137
+ */
1138
+ create(data: CreateTopicRequest): Promise<Topic>;
1139
+ /**
1140
+ * Update a topic
1141
+ */
1142
+ update(id: string, data: UpdateTopicRequest): Promise<Topic>;
1143
+ /**
1144
+ * Delete a topic
1145
+ */
1146
+ delete(id: string): Promise<SuccessResponse>;
1147
+ }
1148
+
1149
+ declare class ContactPropertiesResource {
1150
+ private readonly http;
1151
+ constructor(http: HttpClient);
1152
+ /**
1153
+ * List all contact property definitions
1154
+ */
1155
+ list(): Promise<ContactPropertyDefinition[]>;
1156
+ /**
1157
+ * Create a new contact property definition
1158
+ */
1159
+ create(data: CreateContactPropertyDefinitionRequest): Promise<ContactPropertyDefinition>;
1160
+ /**
1161
+ * Delete a contact property definition
1162
+ */
1163
+ delete(id: string): Promise<SuccessResponse>;
1164
+ }
1165
+
1166
+ declare class LogsResource {
1167
+ private readonly http;
1168
+ constructor(http: HttpClient);
1169
+ /**
1170
+ * List email event logs with optional filtering
1171
+ */
1172
+ list(params?: ListLogsParams): Promise<EmailEvent[]>;
1173
+ }
1174
+
1094
1175
  /**
1095
1176
  * Configuration options for the Emailr client
1096
1177
  */
@@ -1186,6 +1267,18 @@ declare class Emailr {
1186
1267
  * Thread and label management
1187
1268
  */
1188
1269
  readonly threads: ThreadsResource;
1270
+ /**
1271
+ * Broadcast topic management
1272
+ */
1273
+ readonly topics: TopicsResource;
1274
+ /**
1275
+ * Contact property definitions
1276
+ */
1277
+ readonly contactProperties: ContactPropertiesResource;
1278
+ /**
1279
+ * Email event logs
1280
+ */
1281
+ readonly logs: LogsResource;
1189
1282
  private readonly http;
1190
1283
  constructor(config: EmailrConfig);
1191
1284
  }
@@ -1233,4 +1326,4 @@ declare class ValidationError extends EmailrError {
1233
1326
  constructor(message: string, details?: Record<string, unknown>, requestId?: string);
1234
1327
  }
1235
1328
 
1236
- export { type AddDomainRequest, type ApiKey, type Attachment, AuthenticationError, type Broadcast, type BulkCreateContactsRequest, type BulkCreateContactsResponse, type Contact, type ContactListResponse, type CreateApiKeyRequest, type CreateBroadcastRequest, type CreateContactRequest, type CreateForwardingRuleRequest, type CreateInboxRequest, type CreateSegmentRequest, type CreateTemplateRequest, type CreateWebhookRequest, type DnsRecord, type DnsVerificationStatus, type Domain, type DomainDnsRecords, type DomainVerificationStatus, type Email, Emailr, Emailr as EmailrClient, type EmailrConfig, EmailrError, type FetchTemplateOptions, type ForwardEmailRequest, type ForwardingRule, type Inbox, type ListApiKeysParams, type ListBroadcastsParams, type ListContactsParams, type ListEmailsParams, type ListInboxesParams, type ListSegmentsParams, type ListTemplatesParams, type ListThreadsParams, type ListWebhooksParams, NetworkError, NotFoundError, type PaginatedResponse, type PushPreviewResponse, RateLimitError, type ReplyTo, type Segment, type SendBroadcastResponse, type SendEmailRequest, type SendEmailResponse, type SuccessResponse, type Template, type Thread, type ThreadDetail, type ThreadDraft, type ThreadDraftRequest, type ThreadMessage, type ThreadReplyRequest, type ThreadReplyResponse, type UpdateBroadcastRequest, type UpdateContactRequest, type UpdateDomainRequest, type UpdateInboxRequest, type UpdateLabelsRequest, type UpdateLabelsResponse, type UpdateSegmentRequest, type UpdateTemplateRequest, type UpdateThreadLabelsResponse, type UpdateWebhookRequest, ValidationError, type Webhook, type WebhookDelivery, type WebhookToggleResponse };
1329
+ export { type AddDomainRequest, type ApiKey, type Attachment, AuthenticationError, type Broadcast, type BulkCreateContactsRequest, type BulkCreateContactsResponse, type Contact, type ContactListResponse, type ContactPropertyDefinition, type CreateApiKeyRequest, type CreateBroadcastRequest, type CreateContactPropertyDefinitionRequest, type CreateContactRequest, type CreateForwardingRuleRequest, type CreateInboxRequest, type CreateSegmentRequest, type CreateTemplateRequest, type CreateTopicRequest, type CreateWebhookRequest, type DnsRecord, type DnsVerificationStatus, type Domain, type DomainDnsRecords, type DomainVerificationStatus, type Email, type EmailEvent, Emailr, Emailr as EmailrClient, type EmailrConfig, EmailrError, type FetchTemplateOptions, type ForwardEmailRequest, type ForwardingRule, type Inbox, type ListApiKeysParams, type ListBroadcastsParams, type ListContactsParams, type ListEmailsParams, type ListInboxesParams, type ListLogsParams, type ListSegmentsParams, type ListTemplatesParams, type ListThreadsParams, NetworkError, NotFoundError, type PaginatedResponse, type PushPreviewResponse, RateLimitError, type ReplyTo, type Segment, type SendBroadcastResponse, type SendEmailRequest, type SendEmailResponse, type SuccessResponse, type Template, type Thread, type ThreadDetail, type ThreadDraft, type ThreadDraftRequest, type ThreadMessage, type ThreadReplyRequest, type ThreadReplyResponse, type Topic, type UpdateBroadcastRequest, type UpdateContactRequest, type UpdateDomainRequest, type UpdateInboxRequest, type UpdateLabelsRequest, type UpdateLabelsResponse, type UpdateSegmentRequest, type UpdateTemplateRequest, type UpdateThreadLabelsResponse, type UpdateTopicRequest, ValidationError, type Webhook, type WebhookDelivery, type WebhookToggleResponse };
package/dist/index.d.ts CHANGED
@@ -407,7 +407,9 @@ interface Webhook {
407
407
  organization_id: string;
408
408
  name: string;
409
409
  url: string;
410
+ type: 'transactional' | 'domain' | 'receiving';
410
411
  events: string[];
412
+ inbox_ids: string[] | null;
411
413
  secret: string;
412
414
  active: boolean;
413
415
  created_by: string | null;
@@ -416,12 +418,8 @@ interface Webhook {
416
418
  interface CreateWebhookRequest {
417
419
  name: string;
418
420
  url: string;
419
- events: string[];
420
- }
421
- interface UpdateWebhookRequest {
422
- name?: string;
423
- url?: string;
424
- events?: string[];
421
+ type: 'transactional' | 'domain' | 'receiving';
422
+ inbox_ids?: string[];
425
423
  }
426
424
  interface WebhookToggleResponse {
427
425
  success: boolean;
@@ -438,10 +436,6 @@ interface WebhookDelivery {
438
436
  delivered_at: string | null;
439
437
  created_at: string;
440
438
  }
441
- interface ListWebhooksParams {
442
- page?: number;
443
- limit?: number;
444
- }
445
439
  interface Broadcast {
446
440
  id: string;
447
441
  organization_id: string;
@@ -644,6 +638,45 @@ interface EmailMetrics {
644
638
  bounced: number;
645
639
  complained: number;
646
640
  }
641
+ interface Topic {
642
+ id: string;
643
+ organization_id: string;
644
+ name: string;
645
+ description: string | null;
646
+ created_at: string;
647
+ updated_at: string;
648
+ }
649
+ interface CreateTopicRequest {
650
+ name: string;
651
+ description?: string;
652
+ }
653
+ interface UpdateTopicRequest {
654
+ name?: string;
655
+ description?: string;
656
+ }
657
+ interface ContactPropertyDefinition {
658
+ id: string;
659
+ organization_id: string;
660
+ name: string;
661
+ type: 'string' | 'number' | 'boolean' | 'date';
662
+ created_at: string;
663
+ updated_at: string;
664
+ }
665
+ interface CreateContactPropertyDefinitionRequest {
666
+ name: string;
667
+ type: 'string' | 'number' | 'boolean' | 'date';
668
+ }
669
+ interface EmailEvent {
670
+ id: string;
671
+ email_id: string;
672
+ event_type: string;
673
+ created_at: string;
674
+ metadata?: Record<string, unknown>;
675
+ }
676
+ interface ListLogsParams {
677
+ email_id?: string;
678
+ event_type?: string;
679
+ }
647
680
 
648
681
  declare class InboxesResource {
649
682
  private readonly http;
@@ -779,6 +812,13 @@ declare class TemplatesResource {
779
812
  * @returns The HTML content as a string
780
813
  */
781
814
  fetch(id: string, options?: FetchTemplateOptions): Promise<string>;
815
+ /**
816
+ * Publish a template, promoting preview_html to html_content
817
+ *
818
+ * @param id - The template ID
819
+ * @returns The published template
820
+ */
821
+ publish(id: string): Promise<Template>;
782
822
  }
783
823
 
784
824
  declare class DomainsResource {
@@ -822,39 +862,21 @@ declare class WebhooksResource {
822
862
  */
823
863
  create(data: CreateWebhookRequest): Promise<Webhook>;
824
864
  /**
825
- * Get webhook by ID
865
+ * List all webhooks
826
866
  */
827
- get(id: string): Promise<Webhook>;
828
- /**
829
- * List webhooks with pagination
830
- */
831
- list(params?: ListWebhooksParams): Promise<PaginatedResponse<Webhook>>;
832
- /**
833
- * Update a webhook
834
- */
835
- update(id: string, data: UpdateWebhookRequest): Promise<Webhook>;
867
+ list(): Promise<Webhook[]>;
836
868
  /**
837
869
  * Delete a webhook
838
870
  */
839
871
  delete(id: string): Promise<SuccessResponse>;
840
872
  /**
841
- * Enable a webhook
842
- */
843
- enable(id: string): Promise<WebhookToggleResponse>;
844
- /**
845
- * Disable a webhook
873
+ * Toggle a webhook's active state (enable/disable)
846
874
  */
847
- disable(id: string): Promise<WebhookToggleResponse>;
875
+ toggle(id: string): Promise<WebhookToggleResponse>;
848
876
  /**
849
877
  * List webhook deliveries
850
878
  */
851
- listDeliveries(id: string): Promise<{
852
- data: WebhookDelivery[];
853
- }>;
854
- /**
855
- * Retry a failed webhook delivery
856
- */
857
- retryDelivery(webhookId: string, deliveryId: string): Promise<SuccessResponse>;
879
+ listDeliveries(id: string): Promise<WebhookDelivery[]>;
858
880
  }
859
881
 
860
882
  declare class BroadcastsResource {
@@ -944,6 +966,16 @@ declare class SegmentsResource {
944
966
  getCount(id: string): Promise<{
945
967
  count: number;
946
968
  }>;
969
+ /**
970
+ * Add a single contact to a manual segment
971
+ */
972
+ addContact(id: string, contactId: string): Promise<SuccessResponse>;
973
+ /**
974
+ * Bulk add contacts to a manual segment
975
+ */
976
+ bulkAddContacts(id: string, contactIds: string[]): Promise<{
977
+ added: number;
978
+ }>;
947
979
  }
948
980
 
949
981
  /**
@@ -1091,6 +1123,55 @@ declare class ThreadsResource {
1091
1123
  }>;
1092
1124
  }
1093
1125
 
1126
+ declare class TopicsResource {
1127
+ private readonly http;
1128
+ constructor(http: HttpClient);
1129
+ /**
1130
+ * List all topics
1131
+ */
1132
+ list(): Promise<{
1133
+ topics: Topic[];
1134
+ }>;
1135
+ /**
1136
+ * Create a new topic
1137
+ */
1138
+ create(data: CreateTopicRequest): Promise<Topic>;
1139
+ /**
1140
+ * Update a topic
1141
+ */
1142
+ update(id: string, data: UpdateTopicRequest): Promise<Topic>;
1143
+ /**
1144
+ * Delete a topic
1145
+ */
1146
+ delete(id: string): Promise<SuccessResponse>;
1147
+ }
1148
+
1149
+ declare class ContactPropertiesResource {
1150
+ private readonly http;
1151
+ constructor(http: HttpClient);
1152
+ /**
1153
+ * List all contact property definitions
1154
+ */
1155
+ list(): Promise<ContactPropertyDefinition[]>;
1156
+ /**
1157
+ * Create a new contact property definition
1158
+ */
1159
+ create(data: CreateContactPropertyDefinitionRequest): Promise<ContactPropertyDefinition>;
1160
+ /**
1161
+ * Delete a contact property definition
1162
+ */
1163
+ delete(id: string): Promise<SuccessResponse>;
1164
+ }
1165
+
1166
+ declare class LogsResource {
1167
+ private readonly http;
1168
+ constructor(http: HttpClient);
1169
+ /**
1170
+ * List email event logs with optional filtering
1171
+ */
1172
+ list(params?: ListLogsParams): Promise<EmailEvent[]>;
1173
+ }
1174
+
1094
1175
  /**
1095
1176
  * Configuration options for the Emailr client
1096
1177
  */
@@ -1186,6 +1267,18 @@ declare class Emailr {
1186
1267
  * Thread and label management
1187
1268
  */
1188
1269
  readonly threads: ThreadsResource;
1270
+ /**
1271
+ * Broadcast topic management
1272
+ */
1273
+ readonly topics: TopicsResource;
1274
+ /**
1275
+ * Contact property definitions
1276
+ */
1277
+ readonly contactProperties: ContactPropertiesResource;
1278
+ /**
1279
+ * Email event logs
1280
+ */
1281
+ readonly logs: LogsResource;
1189
1282
  private readonly http;
1190
1283
  constructor(config: EmailrConfig);
1191
1284
  }
@@ -1233,4 +1326,4 @@ declare class ValidationError extends EmailrError {
1233
1326
  constructor(message: string, details?: Record<string, unknown>, requestId?: string);
1234
1327
  }
1235
1328
 
1236
- export { type AddDomainRequest, type ApiKey, type Attachment, AuthenticationError, type Broadcast, type BulkCreateContactsRequest, type BulkCreateContactsResponse, type Contact, type ContactListResponse, type CreateApiKeyRequest, type CreateBroadcastRequest, type CreateContactRequest, type CreateForwardingRuleRequest, type CreateInboxRequest, type CreateSegmentRequest, type CreateTemplateRequest, type CreateWebhookRequest, type DnsRecord, type DnsVerificationStatus, type Domain, type DomainDnsRecords, type DomainVerificationStatus, type Email, Emailr, Emailr as EmailrClient, type EmailrConfig, EmailrError, type FetchTemplateOptions, type ForwardEmailRequest, type ForwardingRule, type Inbox, type ListApiKeysParams, type ListBroadcastsParams, type ListContactsParams, type ListEmailsParams, type ListInboxesParams, type ListSegmentsParams, type ListTemplatesParams, type ListThreadsParams, type ListWebhooksParams, NetworkError, NotFoundError, type PaginatedResponse, type PushPreviewResponse, RateLimitError, type ReplyTo, type Segment, type SendBroadcastResponse, type SendEmailRequest, type SendEmailResponse, type SuccessResponse, type Template, type Thread, type ThreadDetail, type ThreadDraft, type ThreadDraftRequest, type ThreadMessage, type ThreadReplyRequest, type ThreadReplyResponse, type UpdateBroadcastRequest, type UpdateContactRequest, type UpdateDomainRequest, type UpdateInboxRequest, type UpdateLabelsRequest, type UpdateLabelsResponse, type UpdateSegmentRequest, type UpdateTemplateRequest, type UpdateThreadLabelsResponse, type UpdateWebhookRequest, ValidationError, type Webhook, type WebhookDelivery, type WebhookToggleResponse };
1329
+ export { type AddDomainRequest, type ApiKey, type Attachment, AuthenticationError, type Broadcast, type BulkCreateContactsRequest, type BulkCreateContactsResponse, type Contact, type ContactListResponse, type ContactPropertyDefinition, type CreateApiKeyRequest, type CreateBroadcastRequest, type CreateContactPropertyDefinitionRequest, type CreateContactRequest, type CreateForwardingRuleRequest, type CreateInboxRequest, type CreateSegmentRequest, type CreateTemplateRequest, type CreateTopicRequest, type CreateWebhookRequest, type DnsRecord, type DnsVerificationStatus, type Domain, type DomainDnsRecords, type DomainVerificationStatus, type Email, type EmailEvent, Emailr, Emailr as EmailrClient, type EmailrConfig, EmailrError, type FetchTemplateOptions, type ForwardEmailRequest, type ForwardingRule, type Inbox, type ListApiKeysParams, type ListBroadcastsParams, type ListContactsParams, type ListEmailsParams, type ListInboxesParams, type ListLogsParams, type ListSegmentsParams, type ListTemplatesParams, type ListThreadsParams, NetworkError, NotFoundError, type PaginatedResponse, type PushPreviewResponse, RateLimitError, type ReplyTo, type Segment, type SendBroadcastResponse, type SendEmailRequest, type SendEmailResponse, type SuccessResponse, type Template, type Thread, type ThreadDetail, type ThreadDraft, type ThreadDraftRequest, type ThreadMessage, type ThreadReplyRequest, type ThreadReplyResponse, type Topic, type UpdateBroadcastRequest, type UpdateContactRequest, type UpdateDomainRequest, type UpdateInboxRequest, type UpdateLabelsRequest, type UpdateLabelsResponse, type UpdateSegmentRequest, type UpdateTemplateRequest, type UpdateThreadLabelsResponse, type UpdateTopicRequest, ValidationError, type Webhook, type WebhookDelivery, type WebhookToggleResponse };
package/dist/index.js CHANGED
@@ -383,6 +383,15 @@ var TemplatesResource = class {
383
383
  }
384
384
  return template.html_content ?? "";
385
385
  }
386
+ /**
387
+ * Publish a template, promoting preview_html to html_content
388
+ *
389
+ * @param id - The template ID
390
+ * @returns The published template
391
+ */
392
+ async publish(id) {
393
+ return this.http.post(`/v1/templates/${id}/publish`);
394
+ }
386
395
  };
387
396
 
388
397
  // src/resources/domains.ts
@@ -446,24 +455,10 @@ var WebhooksResource = class {
446
455
  return this.http.post("/v1/webhooks", data);
447
456
  }
448
457
  /**
449
- * Get webhook by ID
450
- */
451
- async get(id) {
452
- return this.http.get(`/v1/webhooks/${id}`);
453
- }
454
- /**
455
- * List webhooks with pagination
456
- */
457
- async list(params) {
458
- return this.http.get("/v1/webhooks", {
459
- params
460
- });
461
- }
462
- /**
463
- * Update a webhook
458
+ * List all webhooks
464
459
  */
465
- async update(id, data) {
466
- return this.http.put(`/v1/webhooks/${id}`, data);
460
+ async list() {
461
+ return this.http.get("/v1/webhooks");
467
462
  }
468
463
  /**
469
464
  * Delete a webhook
@@ -472,16 +467,10 @@ var WebhooksResource = class {
472
467
  return this.http.delete(`/v1/webhooks/${id}`);
473
468
  }
474
469
  /**
475
- * Enable a webhook
476
- */
477
- async enable(id) {
478
- return this.http.post(`/v1/webhooks/${id}/enable`);
479
- }
480
- /**
481
- * Disable a webhook
470
+ * Toggle a webhook's active state (enable/disable)
482
471
  */
483
- async disable(id) {
484
- return this.http.post(`/v1/webhooks/${id}/disable`);
472
+ async toggle(id) {
473
+ return this.http.put(`/v1/webhooks/${id}/toggle`);
485
474
  }
486
475
  /**
487
476
  * List webhook deliveries
@@ -489,12 +478,6 @@ var WebhooksResource = class {
489
478
  async listDeliveries(id) {
490
479
  return this.http.get(`/v1/webhooks/${id}/deliveries`);
491
480
  }
492
- /**
493
- * Retry a failed webhook delivery
494
- */
495
- async retryDelivery(webhookId, deliveryId) {
496
- return this.http.post(`/v1/webhooks/${webhookId}/deliveries/${deliveryId}/retry`);
497
- }
498
481
  };
499
482
 
500
483
  // src/resources/broadcasts.ts
@@ -618,6 +601,18 @@ var SegmentsResource = class {
618
601
  async getCount(id) {
619
602
  return this.http.get(`/v1/segments/${id}/count`);
620
603
  }
604
+ /**
605
+ * Add a single contact to a manual segment
606
+ */
607
+ async addContact(id, contactId) {
608
+ return this.http.post(`/v1/segments/${id}/contacts/${contactId}`);
609
+ }
610
+ /**
611
+ * Bulk add contacts to a manual segment
612
+ */
613
+ async bulkAddContacts(id, contactIds) {
614
+ return this.http.post(`/v1/segments/${id}/contacts/bulk`, { contact_ids: contactIds });
615
+ }
621
616
  };
622
617
 
623
618
  // src/resources/api-keys.ts
@@ -800,6 +795,77 @@ var ThreadsResource = class {
800
795
  }
801
796
  };
802
797
 
798
+ // src/resources/topics.ts
799
+ var TopicsResource = class {
800
+ constructor(http) {
801
+ this.http = http;
802
+ }
803
+ /**
804
+ * List all topics
805
+ */
806
+ async list() {
807
+ return this.http.get("/v1/topics");
808
+ }
809
+ /**
810
+ * Create a new topic
811
+ */
812
+ async create(data) {
813
+ return this.http.post("/v1/topics", data);
814
+ }
815
+ /**
816
+ * Update a topic
817
+ */
818
+ async update(id, data) {
819
+ return this.http.put(`/v1/topics/${id}`, data);
820
+ }
821
+ /**
822
+ * Delete a topic
823
+ */
824
+ async delete(id) {
825
+ return this.http.delete(`/v1/topics/${id}`);
826
+ }
827
+ };
828
+
829
+ // src/resources/contact-properties.ts
830
+ var ContactPropertiesResource = class {
831
+ constructor(http) {
832
+ this.http = http;
833
+ }
834
+ /**
835
+ * List all contact property definitions
836
+ */
837
+ async list() {
838
+ return this.http.get("/v1/contact-properties");
839
+ }
840
+ /**
841
+ * Create a new contact property definition
842
+ */
843
+ async create(data) {
844
+ return this.http.post("/v1/contact-properties", data);
845
+ }
846
+ /**
847
+ * Delete a contact property definition
848
+ */
849
+ async delete(id) {
850
+ return this.http.delete(`/v1/contact-properties/${id}`);
851
+ }
852
+ };
853
+
854
+ // src/resources/logs.ts
855
+ var LogsResource = class {
856
+ constructor(http) {
857
+ this.http = http;
858
+ }
859
+ /**
860
+ * List email event logs with optional filtering
861
+ */
862
+ async list(params) {
863
+ return this.http.get("/v1/logs", {
864
+ params
865
+ });
866
+ }
867
+ };
868
+
803
869
  // src/client.ts
804
870
  var Emailr = class {
805
871
  constructor(config) {
@@ -825,6 +891,9 @@ var Emailr = class {
825
891
  this.forwardingRules = new ForwardingRulesResource(this.http);
826
892
  this.inboxes = new InboxesResource(this.http);
827
893
  this.threads = new ThreadsResource(this.http);
894
+ this.topics = new TopicsResource(this.http);
895
+ this.contactProperties = new ContactPropertiesResource(this.http);
896
+ this.logs = new LogsResource(this.http);
828
897
  }
829
898
  };
830
899
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -350,6 +350,15 @@ var TemplatesResource = class {
350
350
  }
351
351
  return template.html_content ?? "";
352
352
  }
353
+ /**
354
+ * Publish a template, promoting preview_html to html_content
355
+ *
356
+ * @param id - The template ID
357
+ * @returns The published template
358
+ */
359
+ async publish(id) {
360
+ return this.http.post(`/v1/templates/${id}/publish`);
361
+ }
353
362
  };
354
363
 
355
364
  // src/resources/domains.ts
@@ -413,24 +422,10 @@ var WebhooksResource = class {
413
422
  return this.http.post("/v1/webhooks", data);
414
423
  }
415
424
  /**
416
- * Get webhook by ID
417
- */
418
- async get(id) {
419
- return this.http.get(`/v1/webhooks/${id}`);
420
- }
421
- /**
422
- * List webhooks with pagination
423
- */
424
- async list(params) {
425
- return this.http.get("/v1/webhooks", {
426
- params
427
- });
428
- }
429
- /**
430
- * Update a webhook
425
+ * List all webhooks
431
426
  */
432
- async update(id, data) {
433
- return this.http.put(`/v1/webhooks/${id}`, data);
427
+ async list() {
428
+ return this.http.get("/v1/webhooks");
434
429
  }
435
430
  /**
436
431
  * Delete a webhook
@@ -439,16 +434,10 @@ var WebhooksResource = class {
439
434
  return this.http.delete(`/v1/webhooks/${id}`);
440
435
  }
441
436
  /**
442
- * Enable a webhook
443
- */
444
- async enable(id) {
445
- return this.http.post(`/v1/webhooks/${id}/enable`);
446
- }
447
- /**
448
- * Disable a webhook
437
+ * Toggle a webhook's active state (enable/disable)
449
438
  */
450
- async disable(id) {
451
- return this.http.post(`/v1/webhooks/${id}/disable`);
439
+ async toggle(id) {
440
+ return this.http.put(`/v1/webhooks/${id}/toggle`);
452
441
  }
453
442
  /**
454
443
  * List webhook deliveries
@@ -456,12 +445,6 @@ var WebhooksResource = class {
456
445
  async listDeliveries(id) {
457
446
  return this.http.get(`/v1/webhooks/${id}/deliveries`);
458
447
  }
459
- /**
460
- * Retry a failed webhook delivery
461
- */
462
- async retryDelivery(webhookId, deliveryId) {
463
- return this.http.post(`/v1/webhooks/${webhookId}/deliveries/${deliveryId}/retry`);
464
- }
465
448
  };
466
449
 
467
450
  // src/resources/broadcasts.ts
@@ -585,6 +568,18 @@ var SegmentsResource = class {
585
568
  async getCount(id) {
586
569
  return this.http.get(`/v1/segments/${id}/count`);
587
570
  }
571
+ /**
572
+ * Add a single contact to a manual segment
573
+ */
574
+ async addContact(id, contactId) {
575
+ return this.http.post(`/v1/segments/${id}/contacts/${contactId}`);
576
+ }
577
+ /**
578
+ * Bulk add contacts to a manual segment
579
+ */
580
+ async bulkAddContacts(id, contactIds) {
581
+ return this.http.post(`/v1/segments/${id}/contacts/bulk`, { contact_ids: contactIds });
582
+ }
588
583
  };
589
584
 
590
585
  // src/resources/api-keys.ts
@@ -767,6 +762,77 @@ var ThreadsResource = class {
767
762
  }
768
763
  };
769
764
 
765
+ // src/resources/topics.ts
766
+ var TopicsResource = class {
767
+ constructor(http) {
768
+ this.http = http;
769
+ }
770
+ /**
771
+ * List all topics
772
+ */
773
+ async list() {
774
+ return this.http.get("/v1/topics");
775
+ }
776
+ /**
777
+ * Create a new topic
778
+ */
779
+ async create(data) {
780
+ return this.http.post("/v1/topics", data);
781
+ }
782
+ /**
783
+ * Update a topic
784
+ */
785
+ async update(id, data) {
786
+ return this.http.put(`/v1/topics/${id}`, data);
787
+ }
788
+ /**
789
+ * Delete a topic
790
+ */
791
+ async delete(id) {
792
+ return this.http.delete(`/v1/topics/${id}`);
793
+ }
794
+ };
795
+
796
+ // src/resources/contact-properties.ts
797
+ var ContactPropertiesResource = class {
798
+ constructor(http) {
799
+ this.http = http;
800
+ }
801
+ /**
802
+ * List all contact property definitions
803
+ */
804
+ async list() {
805
+ return this.http.get("/v1/contact-properties");
806
+ }
807
+ /**
808
+ * Create a new contact property definition
809
+ */
810
+ async create(data) {
811
+ return this.http.post("/v1/contact-properties", data);
812
+ }
813
+ /**
814
+ * Delete a contact property definition
815
+ */
816
+ async delete(id) {
817
+ return this.http.delete(`/v1/contact-properties/${id}`);
818
+ }
819
+ };
820
+
821
+ // src/resources/logs.ts
822
+ var LogsResource = class {
823
+ constructor(http) {
824
+ this.http = http;
825
+ }
826
+ /**
827
+ * List email event logs with optional filtering
828
+ */
829
+ async list(params) {
830
+ return this.http.get("/v1/logs", {
831
+ params
832
+ });
833
+ }
834
+ };
835
+
770
836
  // src/client.ts
771
837
  var Emailr = class {
772
838
  constructor(config) {
@@ -792,6 +858,9 @@ var Emailr = class {
792
858
  this.forwardingRules = new ForwardingRulesResource(this.http);
793
859
  this.inboxes = new InboxesResource(this.http);
794
860
  this.threads = new ThreadsResource(this.http);
861
+ this.topics = new TopicsResource(this.http);
862
+ this.contactProperties = new ContactPropertiesResource(this.http);
863
+ this.logs = new LogsResource(this.http);
795
864
  }
796
865
  };
797
866
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emailr",
3
- "version": "1.6.0",
3
+ "version": "1.7.1",
4
4
  "description": "Official Emailr API SDK for TypeScript/JavaScript",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",