emailr 1.1.0 → 1.2.0

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
@@ -170,6 +170,7 @@ interface Template {
170
170
  subject: string;
171
171
  html_content: string | null;
172
172
  text_content: string | null;
173
+ preview_html: string | null;
173
174
  variables: string[] | null;
174
175
  from_email: string | null;
175
176
  reply_to: string | null;
@@ -202,6 +203,12 @@ interface ListTemplatesParams {
202
203
  page?: number;
203
204
  limit?: number;
204
205
  }
206
+ interface PushPreviewResponse {
207
+ preview_url: string;
208
+ }
209
+ interface FetchTemplateOptions {
210
+ preview?: boolean;
211
+ }
205
212
  interface DnsRecord {
206
213
  type: 'TXT' | 'MX' | 'CNAME';
207
214
  name: string;
@@ -558,6 +565,30 @@ declare class TemplatesResource {
558
565
  * Duplicate a template
559
566
  */
560
567
  duplicate(id: string): Promise<Template>;
568
+ /**
569
+ * Push preview HTML for a template
570
+ *
571
+ * Uploads HTML content to the template's preview, which can be accessed
572
+ * publicly at /preview/{template_id} without authentication.
573
+ * This is useful for sharing previews with AI agents for review.
574
+ *
575
+ * @param id - The template ID
576
+ * @param htmlContent - The HTML content for the preview
577
+ * @returns The public preview URL
578
+ */
579
+ pushPreview(id: string, htmlContent: string): Promise<PushPreviewResponse>;
580
+ /**
581
+ * Fetch template HTML content
582
+ *
583
+ * Downloads the template's HTML content. By default, returns the published
584
+ * html_content. Use `{ preview: true }` to fetch the preview_html instead.
585
+ *
586
+ * @param id - The template ID
587
+ * @param options - Fetch options
588
+ * @param options.preview - If true, fetch preview_html instead of html_content
589
+ * @returns The HTML content as a string
590
+ */
591
+ fetch(id: string, options?: FetchTemplateOptions): Promise<string>;
561
592
  }
562
593
 
563
594
  declare class DomainsResource {
@@ -964,4 +995,4 @@ declare class ValidationError extends EmailrError {
964
995
  constructor(message: string, details?: Record<string, unknown>, requestId?: string);
965
996
  }
966
997
 
967
- 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 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 ForwardEmailRequest, type ForwardingRule, type ListApiKeysParams, type ListBroadcastsParams, type ListContactsParams, type ListEmailsParams, type ListSegmentsParams, type ListTemplatesParams, type ListWebhooksParams, NetworkError, NotFoundError, type PaginatedResponse, RateLimitError, type ReplyTo, type Segment, type SendBroadcastResponse, type SendEmailRequest, type SendEmailResponse, type SuccessResponse, type Template, type UpdateBroadcastRequest, type UpdateContactRequest, type UpdateDomainRequest, type UpdateSegmentRequest, type UpdateTemplateRequest, type UpdateWebhookRequest, ValidationError, type Webhook, type WebhookDelivery, type WebhookToggleResponse };
998
+ 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 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 ListApiKeysParams, type ListBroadcastsParams, type ListContactsParams, type ListEmailsParams, type ListSegmentsParams, type ListTemplatesParams, type ListWebhooksParams, NetworkError, NotFoundError, type PaginatedResponse, type PushPreviewResponse, RateLimitError, type ReplyTo, type Segment, type SendBroadcastResponse, type SendEmailRequest, type SendEmailResponse, type SuccessResponse, type Template, type UpdateBroadcastRequest, type UpdateContactRequest, type UpdateDomainRequest, type UpdateSegmentRequest, type UpdateTemplateRequest, type UpdateWebhookRequest, ValidationError, type Webhook, type WebhookDelivery, type WebhookToggleResponse };
package/dist/index.d.ts CHANGED
@@ -170,6 +170,7 @@ interface Template {
170
170
  subject: string;
171
171
  html_content: string | null;
172
172
  text_content: string | null;
173
+ preview_html: string | null;
173
174
  variables: string[] | null;
174
175
  from_email: string | null;
175
176
  reply_to: string | null;
@@ -202,6 +203,12 @@ interface ListTemplatesParams {
202
203
  page?: number;
203
204
  limit?: number;
204
205
  }
206
+ interface PushPreviewResponse {
207
+ preview_url: string;
208
+ }
209
+ interface FetchTemplateOptions {
210
+ preview?: boolean;
211
+ }
205
212
  interface DnsRecord {
206
213
  type: 'TXT' | 'MX' | 'CNAME';
207
214
  name: string;
@@ -558,6 +565,30 @@ declare class TemplatesResource {
558
565
  * Duplicate a template
559
566
  */
560
567
  duplicate(id: string): Promise<Template>;
568
+ /**
569
+ * Push preview HTML for a template
570
+ *
571
+ * Uploads HTML content to the template's preview, which can be accessed
572
+ * publicly at /preview/{template_id} without authentication.
573
+ * This is useful for sharing previews with AI agents for review.
574
+ *
575
+ * @param id - The template ID
576
+ * @param htmlContent - The HTML content for the preview
577
+ * @returns The public preview URL
578
+ */
579
+ pushPreview(id: string, htmlContent: string): Promise<PushPreviewResponse>;
580
+ /**
581
+ * Fetch template HTML content
582
+ *
583
+ * Downloads the template's HTML content. By default, returns the published
584
+ * html_content. Use `{ preview: true }` to fetch the preview_html instead.
585
+ *
586
+ * @param id - The template ID
587
+ * @param options - Fetch options
588
+ * @param options.preview - If true, fetch preview_html instead of html_content
589
+ * @returns The HTML content as a string
590
+ */
591
+ fetch(id: string, options?: FetchTemplateOptions): Promise<string>;
561
592
  }
562
593
 
563
594
  declare class DomainsResource {
@@ -964,4 +995,4 @@ declare class ValidationError extends EmailrError {
964
995
  constructor(message: string, details?: Record<string, unknown>, requestId?: string);
965
996
  }
966
997
 
967
- 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 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 ForwardEmailRequest, type ForwardingRule, type ListApiKeysParams, type ListBroadcastsParams, type ListContactsParams, type ListEmailsParams, type ListSegmentsParams, type ListTemplatesParams, type ListWebhooksParams, NetworkError, NotFoundError, type PaginatedResponse, RateLimitError, type ReplyTo, type Segment, type SendBroadcastResponse, type SendEmailRequest, type SendEmailResponse, type SuccessResponse, type Template, type UpdateBroadcastRequest, type UpdateContactRequest, type UpdateDomainRequest, type UpdateSegmentRequest, type UpdateTemplateRequest, type UpdateWebhookRequest, ValidationError, type Webhook, type WebhookDelivery, type WebhookToggleResponse };
998
+ 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 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 ListApiKeysParams, type ListBroadcastsParams, type ListContactsParams, type ListEmailsParams, type ListSegmentsParams, type ListTemplatesParams, type ListWebhooksParams, NetworkError, NotFoundError, type PaginatedResponse, type PushPreviewResponse, RateLimitError, type ReplyTo, type Segment, type SendBroadcastResponse, type SendEmailRequest, type SendEmailResponse, type SuccessResponse, type Template, type UpdateBroadcastRequest, type UpdateContactRequest, type UpdateDomainRequest, type UpdateSegmentRequest, type UpdateTemplateRequest, type UpdateWebhookRequest, ValidationError, type Webhook, type WebhookDelivery, type WebhookToggleResponse };
package/dist/index.js CHANGED
@@ -312,6 +312,40 @@ var TemplatesResource = class {
312
312
  async duplicate(id) {
313
313
  return this.http.post(`/v1/templates/${id}/duplicate`);
314
314
  }
315
+ /**
316
+ * Push preview HTML for a template
317
+ *
318
+ * Uploads HTML content to the template's preview, which can be accessed
319
+ * publicly at /preview/{template_id} without authentication.
320
+ * This is useful for sharing previews with AI agents for review.
321
+ *
322
+ * @param id - The template ID
323
+ * @param htmlContent - The HTML content for the preview
324
+ * @returns The public preview URL
325
+ */
326
+ async pushPreview(id, htmlContent) {
327
+ return this.http.put(`/v1/templates/${id}/preview`, {
328
+ html_content: htmlContent
329
+ });
330
+ }
331
+ /**
332
+ * Fetch template HTML content
333
+ *
334
+ * Downloads the template's HTML content. By default, returns the published
335
+ * html_content. Use `{ preview: true }` to fetch the preview_html instead.
336
+ *
337
+ * @param id - The template ID
338
+ * @param options - Fetch options
339
+ * @param options.preview - If true, fetch preview_html instead of html_content
340
+ * @returns The HTML content as a string
341
+ */
342
+ async fetch(id, options) {
343
+ const template = await this.get(id);
344
+ if (options?.preview) {
345
+ return template.preview_html ?? "";
346
+ }
347
+ return template.html_content ?? "";
348
+ }
315
349
  };
316
350
 
317
351
  // src/resources/domains.ts
package/dist/index.mjs CHANGED
@@ -279,6 +279,40 @@ var TemplatesResource = class {
279
279
  async duplicate(id) {
280
280
  return this.http.post(`/v1/templates/${id}/duplicate`);
281
281
  }
282
+ /**
283
+ * Push preview HTML for a template
284
+ *
285
+ * Uploads HTML content to the template's preview, which can be accessed
286
+ * publicly at /preview/{template_id} without authentication.
287
+ * This is useful for sharing previews with AI agents for review.
288
+ *
289
+ * @param id - The template ID
290
+ * @param htmlContent - The HTML content for the preview
291
+ * @returns The public preview URL
292
+ */
293
+ async pushPreview(id, htmlContent) {
294
+ return this.http.put(`/v1/templates/${id}/preview`, {
295
+ html_content: htmlContent
296
+ });
297
+ }
298
+ /**
299
+ * Fetch template HTML content
300
+ *
301
+ * Downloads the template's HTML content. By default, returns the published
302
+ * html_content. Use `{ preview: true }` to fetch the preview_html instead.
303
+ *
304
+ * @param id - The template ID
305
+ * @param options - Fetch options
306
+ * @param options.preview - If true, fetch preview_html instead of html_content
307
+ * @returns The HTML content as a string
308
+ */
309
+ async fetch(id, options) {
310
+ const template = await this.get(id);
311
+ if (options?.preview) {
312
+ return template.preview_html ?? "";
313
+ }
314
+ return template.html_content ?? "";
315
+ }
282
316
  };
283
317
 
284
318
  // src/resources/domains.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emailr",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Official Emailr API SDK for TypeScript/JavaScript",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",