emailr 1.1.0 → 1.3.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 +48 -1
- package/dist/index.d.ts +48 -1
- package/dist/index.js +35 -0
- package/dist/index.mjs +35 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -128,6 +128,7 @@ interface Contact {
|
|
|
128
128
|
metadata: Record<string, unknown> | null;
|
|
129
129
|
subscribed: boolean;
|
|
130
130
|
unsubscribed_at: string | null;
|
|
131
|
+
tags?: string[];
|
|
131
132
|
created_at: string;
|
|
132
133
|
updated_at: string;
|
|
133
134
|
}
|
|
@@ -137,6 +138,7 @@ interface CreateContactRequest {
|
|
|
137
138
|
last_name?: string;
|
|
138
139
|
subscribed?: boolean;
|
|
139
140
|
metadata?: Record<string, unknown>;
|
|
141
|
+
tags?: string[];
|
|
140
142
|
}
|
|
141
143
|
interface UpdateContactRequest {
|
|
142
144
|
email?: string;
|
|
@@ -144,11 +146,13 @@ interface UpdateContactRequest {
|
|
|
144
146
|
last_name?: string;
|
|
145
147
|
subscribed?: boolean;
|
|
146
148
|
metadata?: Record<string, unknown>;
|
|
149
|
+
tags?: string[];
|
|
147
150
|
}
|
|
148
151
|
interface ListContactsParams {
|
|
149
152
|
limit?: number;
|
|
150
153
|
offset?: number;
|
|
151
154
|
subscribed?: boolean;
|
|
155
|
+
tags?: string;
|
|
152
156
|
}
|
|
153
157
|
interface ContactListResponse {
|
|
154
158
|
contacts: Contact[];
|
|
@@ -170,7 +174,9 @@ interface Template {
|
|
|
170
174
|
subject: string;
|
|
171
175
|
html_content: string | null;
|
|
172
176
|
text_content: string | null;
|
|
177
|
+
preview_html: string | null;
|
|
173
178
|
variables: string[] | null;
|
|
179
|
+
tags?: string[];
|
|
174
180
|
from_email: string | null;
|
|
175
181
|
reply_to: string | null;
|
|
176
182
|
preview_text: string | null;
|
|
@@ -184,6 +190,7 @@ interface CreateTemplateRequest {
|
|
|
184
190
|
html_content?: string;
|
|
185
191
|
text_content?: string;
|
|
186
192
|
variables?: string[];
|
|
193
|
+
tags?: string[];
|
|
187
194
|
from_email?: string;
|
|
188
195
|
reply_to?: string;
|
|
189
196
|
preview_text?: string;
|
|
@@ -194,6 +201,7 @@ interface UpdateTemplateRequest {
|
|
|
194
201
|
html_content?: string;
|
|
195
202
|
text_content?: string;
|
|
196
203
|
variables?: string[];
|
|
204
|
+
tags?: string[];
|
|
197
205
|
from_email?: string;
|
|
198
206
|
reply_to?: string;
|
|
199
207
|
preview_text?: string;
|
|
@@ -201,6 +209,13 @@ interface UpdateTemplateRequest {
|
|
|
201
209
|
interface ListTemplatesParams {
|
|
202
210
|
page?: number;
|
|
203
211
|
limit?: number;
|
|
212
|
+
tags?: string;
|
|
213
|
+
}
|
|
214
|
+
interface PushPreviewResponse {
|
|
215
|
+
preview_url: string;
|
|
216
|
+
}
|
|
217
|
+
interface FetchTemplateOptions {
|
|
218
|
+
preview?: boolean;
|
|
204
219
|
}
|
|
205
220
|
interface DnsRecord {
|
|
206
221
|
type: 'TXT' | 'MX' | 'CNAME';
|
|
@@ -314,6 +329,7 @@ interface Broadcast {
|
|
|
314
329
|
scheduled_at: string | null;
|
|
315
330
|
started_at: string | null;
|
|
316
331
|
completed_at: string | null;
|
|
332
|
+
tags?: string[];
|
|
317
333
|
created_by: string | null;
|
|
318
334
|
created_at: string;
|
|
319
335
|
}
|
|
@@ -326,6 +342,7 @@ interface CreateBroadcastRequest {
|
|
|
326
342
|
html_content?: string;
|
|
327
343
|
text_content?: string;
|
|
328
344
|
scheduled_at?: string;
|
|
345
|
+
tags?: string[];
|
|
329
346
|
}
|
|
330
347
|
interface UpdateBroadcastRequest {
|
|
331
348
|
name?: string;
|
|
@@ -336,6 +353,7 @@ interface UpdateBroadcastRequest {
|
|
|
336
353
|
html_content?: string;
|
|
337
354
|
text_content?: string;
|
|
338
355
|
scheduled_at?: string;
|
|
356
|
+
tags?: string[];
|
|
339
357
|
}
|
|
340
358
|
interface SendBroadcastResponse {
|
|
341
359
|
success: boolean;
|
|
@@ -346,6 +364,7 @@ interface ListBroadcastsParams {
|
|
|
346
364
|
page?: number;
|
|
347
365
|
limit?: number;
|
|
348
366
|
status?: string;
|
|
367
|
+
tags?: string;
|
|
349
368
|
}
|
|
350
369
|
interface Segment {
|
|
351
370
|
id: string;
|
|
@@ -353,6 +372,7 @@ interface Segment {
|
|
|
353
372
|
name: string;
|
|
354
373
|
description: string | null;
|
|
355
374
|
conditions: Record<string, unknown>;
|
|
375
|
+
tags?: string[];
|
|
356
376
|
created_by: string | null;
|
|
357
377
|
created_at: string;
|
|
358
378
|
updated_at: string;
|
|
@@ -361,15 +381,18 @@ interface CreateSegmentRequest {
|
|
|
361
381
|
name: string;
|
|
362
382
|
description?: string;
|
|
363
383
|
conditions: Record<string, unknown>;
|
|
384
|
+
tags?: string[];
|
|
364
385
|
}
|
|
365
386
|
interface UpdateSegmentRequest {
|
|
366
387
|
name?: string;
|
|
367
388
|
description?: string;
|
|
368
389
|
conditions?: Record<string, unknown>;
|
|
390
|
+
tags?: string[];
|
|
369
391
|
}
|
|
370
392
|
interface ListSegmentsParams {
|
|
371
393
|
page?: number;
|
|
372
394
|
limit?: number;
|
|
395
|
+
tags?: string;
|
|
373
396
|
}
|
|
374
397
|
interface ApiKey {
|
|
375
398
|
id: string;
|
|
@@ -558,6 +581,30 @@ declare class TemplatesResource {
|
|
|
558
581
|
* Duplicate a template
|
|
559
582
|
*/
|
|
560
583
|
duplicate(id: string): Promise<Template>;
|
|
584
|
+
/**
|
|
585
|
+
* Push preview HTML for a template
|
|
586
|
+
*
|
|
587
|
+
* Uploads HTML content to the template's preview, which can be accessed
|
|
588
|
+
* publicly at /preview/{template_id} without authentication.
|
|
589
|
+
* This is useful for sharing previews with AI agents for review.
|
|
590
|
+
*
|
|
591
|
+
* @param id - The template ID
|
|
592
|
+
* @param htmlContent - The HTML content for the preview
|
|
593
|
+
* @returns The public preview URL
|
|
594
|
+
*/
|
|
595
|
+
pushPreview(id: string, htmlContent: string): Promise<PushPreviewResponse>;
|
|
596
|
+
/**
|
|
597
|
+
* Fetch template HTML content
|
|
598
|
+
*
|
|
599
|
+
* Downloads the template's HTML content. By default, returns the published
|
|
600
|
+
* html_content. Use `{ preview: true }` to fetch the preview_html instead.
|
|
601
|
+
*
|
|
602
|
+
* @param id - The template ID
|
|
603
|
+
* @param options - Fetch options
|
|
604
|
+
* @param options.preview - If true, fetch preview_html instead of html_content
|
|
605
|
+
* @returns The HTML content as a string
|
|
606
|
+
*/
|
|
607
|
+
fetch(id: string, options?: FetchTemplateOptions): Promise<string>;
|
|
561
608
|
}
|
|
562
609
|
|
|
563
610
|
declare class DomainsResource {
|
|
@@ -964,4 +1011,4 @@ declare class ValidationError extends EmailrError {
|
|
|
964
1011
|
constructor(message: string, details?: Record<string, unknown>, requestId?: string);
|
|
965
1012
|
}
|
|
966
1013
|
|
|
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 };
|
|
1014
|
+
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
|
@@ -128,6 +128,7 @@ interface Contact {
|
|
|
128
128
|
metadata: Record<string, unknown> | null;
|
|
129
129
|
subscribed: boolean;
|
|
130
130
|
unsubscribed_at: string | null;
|
|
131
|
+
tags?: string[];
|
|
131
132
|
created_at: string;
|
|
132
133
|
updated_at: string;
|
|
133
134
|
}
|
|
@@ -137,6 +138,7 @@ interface CreateContactRequest {
|
|
|
137
138
|
last_name?: string;
|
|
138
139
|
subscribed?: boolean;
|
|
139
140
|
metadata?: Record<string, unknown>;
|
|
141
|
+
tags?: string[];
|
|
140
142
|
}
|
|
141
143
|
interface UpdateContactRequest {
|
|
142
144
|
email?: string;
|
|
@@ -144,11 +146,13 @@ interface UpdateContactRequest {
|
|
|
144
146
|
last_name?: string;
|
|
145
147
|
subscribed?: boolean;
|
|
146
148
|
metadata?: Record<string, unknown>;
|
|
149
|
+
tags?: string[];
|
|
147
150
|
}
|
|
148
151
|
interface ListContactsParams {
|
|
149
152
|
limit?: number;
|
|
150
153
|
offset?: number;
|
|
151
154
|
subscribed?: boolean;
|
|
155
|
+
tags?: string;
|
|
152
156
|
}
|
|
153
157
|
interface ContactListResponse {
|
|
154
158
|
contacts: Contact[];
|
|
@@ -170,7 +174,9 @@ interface Template {
|
|
|
170
174
|
subject: string;
|
|
171
175
|
html_content: string | null;
|
|
172
176
|
text_content: string | null;
|
|
177
|
+
preview_html: string | null;
|
|
173
178
|
variables: string[] | null;
|
|
179
|
+
tags?: string[];
|
|
174
180
|
from_email: string | null;
|
|
175
181
|
reply_to: string | null;
|
|
176
182
|
preview_text: string | null;
|
|
@@ -184,6 +190,7 @@ interface CreateTemplateRequest {
|
|
|
184
190
|
html_content?: string;
|
|
185
191
|
text_content?: string;
|
|
186
192
|
variables?: string[];
|
|
193
|
+
tags?: string[];
|
|
187
194
|
from_email?: string;
|
|
188
195
|
reply_to?: string;
|
|
189
196
|
preview_text?: string;
|
|
@@ -194,6 +201,7 @@ interface UpdateTemplateRequest {
|
|
|
194
201
|
html_content?: string;
|
|
195
202
|
text_content?: string;
|
|
196
203
|
variables?: string[];
|
|
204
|
+
tags?: string[];
|
|
197
205
|
from_email?: string;
|
|
198
206
|
reply_to?: string;
|
|
199
207
|
preview_text?: string;
|
|
@@ -201,6 +209,13 @@ interface UpdateTemplateRequest {
|
|
|
201
209
|
interface ListTemplatesParams {
|
|
202
210
|
page?: number;
|
|
203
211
|
limit?: number;
|
|
212
|
+
tags?: string;
|
|
213
|
+
}
|
|
214
|
+
interface PushPreviewResponse {
|
|
215
|
+
preview_url: string;
|
|
216
|
+
}
|
|
217
|
+
interface FetchTemplateOptions {
|
|
218
|
+
preview?: boolean;
|
|
204
219
|
}
|
|
205
220
|
interface DnsRecord {
|
|
206
221
|
type: 'TXT' | 'MX' | 'CNAME';
|
|
@@ -314,6 +329,7 @@ interface Broadcast {
|
|
|
314
329
|
scheduled_at: string | null;
|
|
315
330
|
started_at: string | null;
|
|
316
331
|
completed_at: string | null;
|
|
332
|
+
tags?: string[];
|
|
317
333
|
created_by: string | null;
|
|
318
334
|
created_at: string;
|
|
319
335
|
}
|
|
@@ -326,6 +342,7 @@ interface CreateBroadcastRequest {
|
|
|
326
342
|
html_content?: string;
|
|
327
343
|
text_content?: string;
|
|
328
344
|
scheduled_at?: string;
|
|
345
|
+
tags?: string[];
|
|
329
346
|
}
|
|
330
347
|
interface UpdateBroadcastRequest {
|
|
331
348
|
name?: string;
|
|
@@ -336,6 +353,7 @@ interface UpdateBroadcastRequest {
|
|
|
336
353
|
html_content?: string;
|
|
337
354
|
text_content?: string;
|
|
338
355
|
scheduled_at?: string;
|
|
356
|
+
tags?: string[];
|
|
339
357
|
}
|
|
340
358
|
interface SendBroadcastResponse {
|
|
341
359
|
success: boolean;
|
|
@@ -346,6 +364,7 @@ interface ListBroadcastsParams {
|
|
|
346
364
|
page?: number;
|
|
347
365
|
limit?: number;
|
|
348
366
|
status?: string;
|
|
367
|
+
tags?: string;
|
|
349
368
|
}
|
|
350
369
|
interface Segment {
|
|
351
370
|
id: string;
|
|
@@ -353,6 +372,7 @@ interface Segment {
|
|
|
353
372
|
name: string;
|
|
354
373
|
description: string | null;
|
|
355
374
|
conditions: Record<string, unknown>;
|
|
375
|
+
tags?: string[];
|
|
356
376
|
created_by: string | null;
|
|
357
377
|
created_at: string;
|
|
358
378
|
updated_at: string;
|
|
@@ -361,15 +381,18 @@ interface CreateSegmentRequest {
|
|
|
361
381
|
name: string;
|
|
362
382
|
description?: string;
|
|
363
383
|
conditions: Record<string, unknown>;
|
|
384
|
+
tags?: string[];
|
|
364
385
|
}
|
|
365
386
|
interface UpdateSegmentRequest {
|
|
366
387
|
name?: string;
|
|
367
388
|
description?: string;
|
|
368
389
|
conditions?: Record<string, unknown>;
|
|
390
|
+
tags?: string[];
|
|
369
391
|
}
|
|
370
392
|
interface ListSegmentsParams {
|
|
371
393
|
page?: number;
|
|
372
394
|
limit?: number;
|
|
395
|
+
tags?: string;
|
|
373
396
|
}
|
|
374
397
|
interface ApiKey {
|
|
375
398
|
id: string;
|
|
@@ -558,6 +581,30 @@ declare class TemplatesResource {
|
|
|
558
581
|
* Duplicate a template
|
|
559
582
|
*/
|
|
560
583
|
duplicate(id: string): Promise<Template>;
|
|
584
|
+
/**
|
|
585
|
+
* Push preview HTML for a template
|
|
586
|
+
*
|
|
587
|
+
* Uploads HTML content to the template's preview, which can be accessed
|
|
588
|
+
* publicly at /preview/{template_id} without authentication.
|
|
589
|
+
* This is useful for sharing previews with AI agents for review.
|
|
590
|
+
*
|
|
591
|
+
* @param id - The template ID
|
|
592
|
+
* @param htmlContent - The HTML content for the preview
|
|
593
|
+
* @returns The public preview URL
|
|
594
|
+
*/
|
|
595
|
+
pushPreview(id: string, htmlContent: string): Promise<PushPreviewResponse>;
|
|
596
|
+
/**
|
|
597
|
+
* Fetch template HTML content
|
|
598
|
+
*
|
|
599
|
+
* Downloads the template's HTML content. By default, returns the published
|
|
600
|
+
* html_content. Use `{ preview: true }` to fetch the preview_html instead.
|
|
601
|
+
*
|
|
602
|
+
* @param id - The template ID
|
|
603
|
+
* @param options - Fetch options
|
|
604
|
+
* @param options.preview - If true, fetch preview_html instead of html_content
|
|
605
|
+
* @returns The HTML content as a string
|
|
606
|
+
*/
|
|
607
|
+
fetch(id: string, options?: FetchTemplateOptions): Promise<string>;
|
|
561
608
|
}
|
|
562
609
|
|
|
563
610
|
declare class DomainsResource {
|
|
@@ -964,4 +1011,4 @@ declare class ValidationError extends EmailrError {
|
|
|
964
1011
|
constructor(message: string, details?: Record<string, unknown>, requestId?: string);
|
|
965
1012
|
}
|
|
966
1013
|
|
|
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 };
|
|
1014
|
+
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
|
|
@@ -451,6 +485,7 @@ var BroadcastsResource = class {
|
|
|
451
485
|
if (params?.page) queryParams.page = String(params.page);
|
|
452
486
|
if (params?.limit) queryParams.limit = String(params.limit);
|
|
453
487
|
if (params?.status) queryParams.status = params.status;
|
|
488
|
+
if (params?.tags) queryParams.tags = params.tags;
|
|
454
489
|
const data = await this.http.get("/v1/broadcasts", queryParams);
|
|
455
490
|
if (Array.isArray(data)) {
|
|
456
491
|
return data;
|
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
|
|
@@ -418,6 +452,7 @@ var BroadcastsResource = class {
|
|
|
418
452
|
if (params?.page) queryParams.page = String(params.page);
|
|
419
453
|
if (params?.limit) queryParams.limit = String(params.limit);
|
|
420
454
|
if (params?.status) queryParams.status = params.status;
|
|
455
|
+
if (params?.tags) queryParams.tags = params.tags;
|
|
421
456
|
const data = await this.http.get("/v1/broadcasts", queryParams);
|
|
422
457
|
if (Array.isArray(data)) {
|
|
423
458
|
return data;
|