migma 1.3.2 → 1.3.3
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/README.md +19 -21
- package/dist/index.d.mts +75 -43
- package/dist/index.d.ts +75 -43
- package/dist/index.js +54 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ interface RequestOptions {
|
|
|
64
64
|
declare class MigmaClient {
|
|
65
65
|
private readonly apiKey;
|
|
66
66
|
private readonly config;
|
|
67
|
+
private readonly headers;
|
|
67
68
|
constructor(apiKey: string, config: ClientConfig);
|
|
68
69
|
request<T>(options: RequestOptions): Promise<MigmaResult<T>>;
|
|
69
70
|
/**
|
|
@@ -94,6 +95,7 @@ interface Contact {
|
|
|
94
95
|
email: string;
|
|
95
96
|
firstName?: string;
|
|
96
97
|
lastName?: string;
|
|
98
|
+
phone?: string;
|
|
97
99
|
country?: string;
|
|
98
100
|
language?: string;
|
|
99
101
|
tags: string[];
|
|
@@ -107,6 +109,7 @@ interface CreateContactParams {
|
|
|
107
109
|
email: string;
|
|
108
110
|
firstName?: string;
|
|
109
111
|
lastName?: string;
|
|
112
|
+
phone?: string;
|
|
110
113
|
/** ISO 3166-1 alpha-2 country code (e.g., US, CA, GB) */
|
|
111
114
|
country?: string;
|
|
112
115
|
/** Language code in ISO 639-1 or BCP 47 format (e.g., en, en-US) */
|
|
@@ -118,6 +121,7 @@ interface CreateContactParams {
|
|
|
118
121
|
interface UpdateContactParams {
|
|
119
122
|
firstName?: string;
|
|
120
123
|
lastName?: string;
|
|
124
|
+
phone?: string | null;
|
|
121
125
|
country?: string;
|
|
122
126
|
language?: string;
|
|
123
127
|
tags?: string[];
|
|
@@ -141,6 +145,7 @@ interface BulkImportContactItem {
|
|
|
141
145
|
email: string;
|
|
142
146
|
firstName?: string;
|
|
143
147
|
lastName?: string;
|
|
148
|
+
phone?: string;
|
|
144
149
|
country?: string;
|
|
145
150
|
language?: string;
|
|
146
151
|
tags?: string[];
|
|
@@ -241,10 +246,28 @@ declare class Tags {
|
|
|
241
246
|
remove(id: string, projectId: string): Promise<MigmaResult<DeleteResponse>>;
|
|
242
247
|
}
|
|
243
248
|
|
|
249
|
+
interface SegmentFieldFilter {
|
|
250
|
+
key: string;
|
|
251
|
+
mode?: 'is' | 'is_not';
|
|
252
|
+
values: string[];
|
|
253
|
+
}
|
|
254
|
+
interface SegmentActivityFilter {
|
|
255
|
+
action: 'sent' | 'opened' | 'clicked';
|
|
256
|
+
mode: 'within' | 'before' | 'never' | 'between';
|
|
257
|
+
unit?: 'hours' | 'days';
|
|
258
|
+
amount?: number;
|
|
259
|
+
from?: string | Date;
|
|
260
|
+
to?: string | Date;
|
|
261
|
+
campaignId?: string;
|
|
262
|
+
}
|
|
244
263
|
interface SegmentFilters {
|
|
245
264
|
tags?: string[];
|
|
265
|
+
excludeTags?: string[];
|
|
246
266
|
status?: 'subscribed' | 'unsubscribed' | 'non-subscribed' | 'bounced';
|
|
267
|
+
validationStatus?: 'valid' | 'invalid' | 'risky' | 'unknown';
|
|
247
268
|
customFields?: Record<string, string[]>;
|
|
269
|
+
fields?: SegmentFieldFilter[];
|
|
270
|
+
activity?: SegmentActivityFilter[];
|
|
248
271
|
}
|
|
249
272
|
interface Segment {
|
|
250
273
|
id: string;
|
|
@@ -352,21 +375,19 @@ interface SendEmailParams {
|
|
|
352
375
|
replyTo?: string;
|
|
353
376
|
bcc?: string[];
|
|
354
377
|
subject: string;
|
|
355
|
-
/** Email template source. Required unless conversationId or artifactId is provided. */
|
|
356
|
-
template?: string;
|
|
357
378
|
variables?: Record<string, unknown>;
|
|
358
379
|
providerType?: ProviderType;
|
|
359
|
-
/**
|
|
380
|
+
/** Optional when emailId or conversationId can resolve project automatically. */
|
|
360
381
|
projectId?: string;
|
|
361
382
|
/**
|
|
362
|
-
*
|
|
363
|
-
* multi-slot
|
|
364
|
-
* conversation automatically.
|
|
383
|
+
* Generated email id from result.emails[].emailId. Use this for selected
|
|
384
|
+
* emails inside multi-slot conversations or series. Resolves template,
|
|
385
|
+
* projectId, and parent conversation automatically.
|
|
365
386
|
*/
|
|
366
|
-
|
|
387
|
+
emailId?: string;
|
|
367
388
|
/**
|
|
368
389
|
* Conversation id. Works for single-email conversations. For multi-slot
|
|
369
|
-
* conversations,
|
|
390
|
+
* conversations, use emailId so API knows which email to send.
|
|
370
391
|
*/
|
|
371
392
|
conversationId?: string;
|
|
372
393
|
/** Defaults to true for single sends, false for batch sends. Set explicitly to override. Transactional emails bypass subscription status and topic filters, and omit List-Unsubscribe headers. */
|
|
@@ -476,6 +497,24 @@ interface RetryImportResponse {
|
|
|
476
497
|
status: string;
|
|
477
498
|
message: string;
|
|
478
499
|
}
|
|
500
|
+
interface FieldCatalogParams {
|
|
501
|
+
segmentId?: string;
|
|
502
|
+
tag?: string;
|
|
503
|
+
}
|
|
504
|
+
type FieldCatalogEntryType = 'string' | 'number' | 'boolean' | 'date' | 'url' | 'unknown';
|
|
505
|
+
interface FieldCatalogEntry {
|
|
506
|
+
key: string;
|
|
507
|
+
label: string;
|
|
508
|
+
type: FieldCatalogEntryType;
|
|
509
|
+
fillRate: number;
|
|
510
|
+
sample: string[];
|
|
511
|
+
auto: boolean;
|
|
512
|
+
}
|
|
513
|
+
interface FieldCatalogResponse {
|
|
514
|
+
entries: FieldCatalogEntry[];
|
|
515
|
+
totalSubscribers: number;
|
|
516
|
+
computedAt: string;
|
|
517
|
+
}
|
|
479
518
|
|
|
480
519
|
interface PollingOptions {
|
|
481
520
|
/** Polling interval in ms. Default: 2000 */
|
|
@@ -502,6 +541,7 @@ declare class Projects {
|
|
|
502
541
|
import(params: ImportProjectParams): Promise<MigmaResult<ImportProjectResponse>>;
|
|
503
542
|
getImportStatus(projectId: string): Promise<MigmaResult<ImportStatusResponse>>;
|
|
504
543
|
retryImport(projectId: string): Promise<MigmaResult<RetryImportResponse>>;
|
|
544
|
+
fieldCatalog(projectId: string, params?: FieldCatalogParams): Promise<MigmaResult<FieldCatalogResponse>>;
|
|
505
545
|
/**
|
|
506
546
|
* Import a project and wait for completion.
|
|
507
547
|
* Polls getImportStatus until status is 'active' or 'error'.
|
|
@@ -539,8 +579,7 @@ interface EmailGenerationResult {
|
|
|
539
579
|
subject: string;
|
|
540
580
|
previewText: string;
|
|
541
581
|
html: string;
|
|
542
|
-
|
|
543
|
-
emails: GeneratedEmailArtifact[];
|
|
582
|
+
emails: GeneratedEmail[];
|
|
544
583
|
seriesPlan?: {
|
|
545
584
|
name?: string;
|
|
546
585
|
count?: number;
|
|
@@ -555,10 +594,10 @@ interface EmailGenerationResult {
|
|
|
555
594
|
colors: string[];
|
|
556
595
|
};
|
|
557
596
|
languages: string[];
|
|
558
|
-
templateVariables?: unknown[];
|
|
559
597
|
}
|
|
560
|
-
interface
|
|
561
|
-
|
|
598
|
+
interface GeneratedEmail {
|
|
599
|
+
id: string | null;
|
|
600
|
+
emailId: string | null;
|
|
562
601
|
conversationId: string;
|
|
563
602
|
messageId: string | null;
|
|
564
603
|
slotIdx: number;
|
|
@@ -566,11 +605,10 @@ interface GeneratedEmailArtifact {
|
|
|
566
605
|
subject: string;
|
|
567
606
|
preheader: string;
|
|
568
607
|
html: string;
|
|
569
|
-
source?: string;
|
|
570
608
|
sendOffsetDays?: number;
|
|
571
609
|
status: 'ready' | 'processing' | 'failed';
|
|
610
|
+
screenshotUrl?: string | null;
|
|
572
611
|
thumbnailUrl?: string | null;
|
|
573
|
-
templateVariables?: unknown[];
|
|
574
612
|
}
|
|
575
613
|
interface EmailGenerationStatus {
|
|
576
614
|
conversationId: string;
|
|
@@ -607,50 +645,38 @@ interface ListEmailsResponse {
|
|
|
607
645
|
};
|
|
608
646
|
}
|
|
609
647
|
interface SendTestEmailParams {
|
|
610
|
-
|
|
648
|
+
emailId?: string;
|
|
649
|
+
conversationId?: string;
|
|
611
650
|
to: string;
|
|
612
651
|
}
|
|
613
652
|
interface SendTestEmailResponse {
|
|
614
653
|
messageId: string;
|
|
654
|
+
emailId?: string;
|
|
615
655
|
conversationId: string;
|
|
616
656
|
sentTo: string;
|
|
617
657
|
sentAt: string;
|
|
618
658
|
subject: string;
|
|
619
659
|
}
|
|
620
|
-
interface
|
|
621
|
-
|
|
660
|
+
interface Email {
|
|
661
|
+
id: string;
|
|
662
|
+
emailId: string;
|
|
622
663
|
conversationId: string;
|
|
623
664
|
messageId: string | null;
|
|
624
665
|
slotIdx: number;
|
|
625
666
|
slotUuid: string | null;
|
|
626
667
|
status: string;
|
|
627
|
-
engine: 'zinn' | 'react-email';
|
|
628
668
|
subject: string;
|
|
629
669
|
preheader: string;
|
|
630
670
|
html: string;
|
|
631
|
-
|
|
632
|
-
templateVariables: unknown[];
|
|
671
|
+
screenshotUrl: string | null;
|
|
633
672
|
warnings: string[];
|
|
634
673
|
thumbnailUrl: string | null;
|
|
635
674
|
updatedAt: string;
|
|
636
675
|
}
|
|
637
|
-
interface
|
|
638
|
-
|
|
639
|
-
vars?: Record<string, unknown>;
|
|
640
|
-
lang?: string;
|
|
676
|
+
interface EditEmailParams {
|
|
677
|
+
prompt: string;
|
|
641
678
|
label?: string;
|
|
642
679
|
}
|
|
643
|
-
interface CompileEmailArtifactParams {
|
|
644
|
-
source?: string;
|
|
645
|
-
vars?: Record<string, unknown>;
|
|
646
|
-
lang?: string;
|
|
647
|
-
}
|
|
648
|
-
interface CompileEmailArtifactResponse {
|
|
649
|
-
artifactId: string;
|
|
650
|
-
html: string;
|
|
651
|
-
warnings: string[];
|
|
652
|
-
metadata?: Record<string, unknown>;
|
|
653
|
-
}
|
|
654
680
|
|
|
655
681
|
declare class Emails {
|
|
656
682
|
private readonly client;
|
|
@@ -661,12 +687,10 @@ declare class Emails {
|
|
|
661
687
|
generate(params: GenerateEmailParams): Promise<MigmaResult<GenerateEmailResponse>>;
|
|
662
688
|
/** Check email generation status */
|
|
663
689
|
getGenerationStatus(conversationId: string): Promise<MigmaResult<EmailGenerationStatus>>;
|
|
664
|
-
/** Fetch one generated email by
|
|
665
|
-
get(
|
|
666
|
-
/**
|
|
667
|
-
|
|
668
|
-
/** Compile an email artifact's source without persisting */
|
|
669
|
-
compile(artifactId: string, params?: CompileEmailArtifactParams): Promise<MigmaResult<CompileEmailArtifactResponse>>;
|
|
690
|
+
/** Fetch one generated email by email id */
|
|
691
|
+
get(emailId: string): Promise<MigmaResult<Email>>;
|
|
692
|
+
/** Prompt Migma to edit one generated email */
|
|
693
|
+
edit(emailId: string, params: EditEmailParams): Promise<MigmaResult<Email>>;
|
|
670
694
|
/**
|
|
671
695
|
* Generate an email and wait for completion.
|
|
672
696
|
* Polls getGenerationStatus until status is 'completed' or 'failed'.
|
|
@@ -1160,6 +1184,7 @@ interface Campaign {
|
|
|
1160
1184
|
projectId: string;
|
|
1161
1185
|
name: string;
|
|
1162
1186
|
conversationId: string;
|
|
1187
|
+
emailId?: string | null;
|
|
1163
1188
|
subject: string;
|
|
1164
1189
|
preheaderText?: string | null;
|
|
1165
1190
|
from: string;
|
|
@@ -1178,6 +1203,8 @@ interface Campaign {
|
|
|
1178
1203
|
sentAt?: string | null;
|
|
1179
1204
|
completedAt?: string | null;
|
|
1180
1205
|
error?: string | null;
|
|
1206
|
+
archived?: boolean;
|
|
1207
|
+
archivedAt?: string | null;
|
|
1181
1208
|
triggeredBy?: 'manual' | 'api' | 'automation';
|
|
1182
1209
|
createdAt: string;
|
|
1183
1210
|
updatedAt: string;
|
|
@@ -1186,6 +1213,8 @@ interface CreateCampaignParams {
|
|
|
1186
1213
|
projectId: string;
|
|
1187
1214
|
name: string;
|
|
1188
1215
|
conversationId: string;
|
|
1216
|
+
/** Generated email ID from result.emails[].emailId. Recommended for series slots. */
|
|
1217
|
+
emailId?: string;
|
|
1189
1218
|
subject?: string;
|
|
1190
1219
|
preheaderText?: string;
|
|
1191
1220
|
from: string;
|
|
@@ -1202,6 +1231,7 @@ interface ListCampaignsParams {
|
|
|
1202
1231
|
status?: CampaignStatus;
|
|
1203
1232
|
page?: number;
|
|
1204
1233
|
limit?: number;
|
|
1234
|
+
archived?: boolean;
|
|
1205
1235
|
}
|
|
1206
1236
|
interface ListCampaignsResponse {
|
|
1207
1237
|
campaigns: Campaign[];
|
|
@@ -1221,6 +1251,8 @@ declare class Campaigns {
|
|
|
1221
1251
|
send(id: string): Promise<MigmaResult<Campaign>>;
|
|
1222
1252
|
schedule(id: string, params: ScheduleCampaignParams): Promise<MigmaResult<Campaign>>;
|
|
1223
1253
|
cancel(id: string): Promise<MigmaResult<Campaign>>;
|
|
1254
|
+
archive(id: string): Promise<MigmaResult<Campaign>>;
|
|
1255
|
+
unarchive(id: string): Promise<MigmaResult<Campaign>>;
|
|
1224
1256
|
}
|
|
1225
1257
|
|
|
1226
1258
|
interface MigmaConfig {
|
|
@@ -1251,4 +1283,4 @@ declare class Migma {
|
|
|
1251
1283
|
constructor(apiKey: string, config?: MigmaConfig);
|
|
1252
1284
|
}
|
|
1253
1285
|
|
|
1254
|
-
export { type AddImageParams, type AddKnowledgeBaseParams, type AnalyzeDeliverabilityParams, type AnalyzeLinksParams, type ApiResponse, type BatchStatus, type BulkImportAsyncResponse, type BulkImportContactItem, type BulkImportJobStatus, type BulkImportParams, type BulkImportResponse, type BulkImportSyncResponse, type Campaign, type CampaignStatus, type ChangeStatusParams, type CheckCompatibilityParams, type CheckSpellingParams, type CheckedLink, type ClientConfig, type CompatibilityResponse, type
|
|
1286
|
+
export { type AddImageParams, type AddKnowledgeBaseParams, type AnalyzeDeliverabilityParams, type AnalyzeLinksParams, type ApiResponse, type BatchStatus, type BulkImportAsyncResponse, type BulkImportContactItem, type BulkImportJobStatus, type BulkImportParams, type BulkImportResponse, type BulkImportSyncResponse, type Campaign, type CampaignStatus, type ChangeStatusParams, type CheckCompatibilityParams, type CheckSpellingParams, type CheckedLink, type ClientConfig, type CompatibilityResponse, type Contact, type ContactStatus, type CreateCampaignParams, type CreateContactParams, type CreateDomainParams, type CreateManagedDomainParams, type CreatePreviewParams, type CreatePreviewResponse, type CreateSegmentParams, type CreateTagParams, type CreateTopicParams, type CreateWebhookParams, type DeleteResponse, type DeliverabilityResponse, type DeviceCategoriesResponse, type DnsRecord, type Domain, type DomainAvailability, type DomainDeleteResponse, type DomainVerificationResult, type EditEmailParams, type Email, type EmailGenerationResult, type EmailGenerationStatus, type EmailImage, type ExportFile, type ExportFormat, type ExportFormatsResponse, type ExportResult, type ExportStatusResponse, type FieldCatalogEntry, type FieldCatalogEntryType, type FieldCatalogParams, type FieldCatalogResponse, type GenerateEmailParams, type GenerateEmailResponse, type GeneratedEmail, type GetDevicePreviewResponse, type GetPreviewResponse, type GetPreviewStatusResponse, type GetSupportedDevicesResponse, type HubspotExportParams, type ImportProjectParams, type ImportProjectResponse, type ImportStatusResponse, type KnowledgeBaseEntry, type KnowledgeBaseListResponse, type LinkAnalysisResponse, type ListCampaignsParams, type ListCampaignsResponse, type ListContactsParams, type ListContactsResponse, type ListEmailsEmail, type ListEmailsParams, type ListEmailsResponse, type ListProjectsParams, type ListProjectsResponse, type ListSegmentsResponse, type ListTagsParams, type ListTagsResponse, type ListTopicsParams, type ListTopicsResponse, type ListWebhooksResponse, type LogosResponse, type MessageResponse, Migma, MigmaClient, type MigmaConfig, MigmaError, MigmaErrorCode, type MigmaResult, type PollingOptions, type PreviewDevice, type PreviewDeviceCategory, type PreviewDeviceStatus, type PreviewMetadata, type PreviewStatus, type Project, type ProjectImage, type ProviderType, type RecipientType, type RetryImportResponse, type ScheduleCampaignParams, type Segment, type SegmentActivityFilter, type SegmentFieldFilter, type SegmentFilters, type SendEmailParams, type SendEmailResponse, type SendTestEmailParams, type SendTestEmailResponse, type SpellingResponse, type SupportedDevice, type Tag, type Topic, type TopicSubscriptionParams, type TopicSubscriptionResponse, type UpdateContactParams, type UpdateDomainParams, type UpdateImageParams, type UpdateKnowledgeBaseParams, type UpdateLogosParams, type UpdateSegmentParams, type UpdateTagParams, type UpdateTopicParams, type UpdateWebhookParams, type ValidateAllParams, type ValidateAllResponse, type Webhook, type WebhookDeliveriesResponse, type WebhookDelivery, type WebhookDetail, type WebhookEvent, type WebhookEventType, type WebhookEventsResponse, type WebhookTestResult, poll };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
// src/agent-identity.ts
|
|
4
|
+
var AGENT_ID_PATTERN = /^ai:[a-z0-9][a-z0-9._-]{0,62}$/;
|
|
5
|
+
var HOST_AGENT_ENV = [
|
|
6
|
+
{ env: "CLAUDECODE", id: "ai:claude-code" },
|
|
7
|
+
{ env: "CURSOR_TRACE_ID", id: "ai:cursor" },
|
|
8
|
+
{ env: "CODEX_HOME", id: "ai:codex" }
|
|
9
|
+
];
|
|
10
|
+
function detectAgentId() {
|
|
11
|
+
if (typeof process === "undefined" || !process.env) return null;
|
|
12
|
+
const explicit = (process.env.MIGMA_AGENT_ID || "").trim().toLowerCase();
|
|
13
|
+
if (AGENT_ID_PATTERN.test(explicit)) return explicit;
|
|
14
|
+
for (const { env, id } of HOST_AGENT_ENV) {
|
|
15
|
+
if (process.env[env]) return id;
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
|
|
3
20
|
// src/errors.ts
|
|
4
21
|
var MigmaErrorCode = /* @__PURE__ */ ((MigmaErrorCode2) => {
|
|
5
22
|
MigmaErrorCode2["VALIDATION_ERROR"] = "validation_error";
|
|
@@ -56,9 +73,19 @@ var MigmaError = class _MigmaError extends Error {
|
|
|
56
73
|
var MigmaClient = class {
|
|
57
74
|
apiKey;
|
|
58
75
|
config;
|
|
76
|
+
headers;
|
|
59
77
|
constructor(apiKey, config) {
|
|
60
78
|
this.apiKey = apiKey;
|
|
61
79
|
this.config = config;
|
|
80
|
+
this.headers = {
|
|
81
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
82
|
+
"Content-Type": "application/json",
|
|
83
|
+
"User-Agent": "migma-node/1.0.0"
|
|
84
|
+
};
|
|
85
|
+
const agentId = detectAgentId();
|
|
86
|
+
if (agentId) {
|
|
87
|
+
this.headers["X-Agent-Id"] = agentId;
|
|
88
|
+
}
|
|
62
89
|
}
|
|
63
90
|
async request(options) {
|
|
64
91
|
const url = this.buildUrl(options.path, options.query);
|
|
@@ -68,11 +95,7 @@ var MigmaClient = class {
|
|
|
68
95
|
try {
|
|
69
96
|
const response = await fetch(url, {
|
|
70
97
|
method: options.method,
|
|
71
|
-
headers:
|
|
72
|
-
Authorization: `Bearer ${this.apiKey}`,
|
|
73
|
-
"Content-Type": "application/json",
|
|
74
|
-
"User-Agent": "migma-node/1.0.0"
|
|
75
|
-
},
|
|
98
|
+
headers: this.headers,
|
|
76
99
|
body: options.body ? JSON.stringify(options.body) : void 0
|
|
77
100
|
});
|
|
78
101
|
const json = await response.json();
|
|
@@ -115,11 +138,7 @@ var MigmaClient = class {
|
|
|
115
138
|
try {
|
|
116
139
|
const response = await fetch(url, {
|
|
117
140
|
method: options.method,
|
|
118
|
-
headers:
|
|
119
|
-
Authorization: `Bearer ${this.apiKey}`,
|
|
120
|
-
"Content-Type": "application/json",
|
|
121
|
-
"User-Agent": "migma-node/1.0.0"
|
|
122
|
-
},
|
|
141
|
+
headers: this.headers,
|
|
123
142
|
body: options.body ? JSON.stringify(options.body) : void 0
|
|
124
143
|
});
|
|
125
144
|
const json = await response.json();
|
|
@@ -404,6 +423,15 @@ var Projects = class {
|
|
|
404
423
|
`/projects/import/${projectId}/retry`
|
|
405
424
|
);
|
|
406
425
|
}
|
|
426
|
+
async fieldCatalog(projectId, params) {
|
|
427
|
+
return this.client.get(
|
|
428
|
+
`/projects/${projectId}/field-catalog`,
|
|
429
|
+
{
|
|
430
|
+
segmentId: params?.segmentId,
|
|
431
|
+
tag: params?.tag
|
|
432
|
+
}
|
|
433
|
+
);
|
|
434
|
+
}
|
|
407
435
|
/**
|
|
408
436
|
* Import a project and wait for completion.
|
|
409
437
|
* Polls getImportStatus until status is 'active' or 'error'.
|
|
@@ -451,22 +479,15 @@ var Emails = class {
|
|
|
451
479
|
`/projects/emails/${conversationId}/status`
|
|
452
480
|
);
|
|
453
481
|
}
|
|
454
|
-
/** Fetch one generated email by
|
|
455
|
-
async get(
|
|
456
|
-
return this.client.get(`/emails/${
|
|
482
|
+
/** Fetch one generated email by email id */
|
|
483
|
+
async get(emailId) {
|
|
484
|
+
return this.client.get(`/emails/${emailId}`);
|
|
457
485
|
}
|
|
458
|
-
/**
|
|
459
|
-
async
|
|
460
|
-
return this.client.patch(
|
|
461
|
-
`/emails/${artifactId}`,
|
|
462
|
-
params
|
|
463
|
-
);
|
|
464
|
-
}
|
|
465
|
-
/** Compile an email artifact's source without persisting */
|
|
466
|
-
async compile(artifactId, params) {
|
|
486
|
+
/** Prompt Migma to edit one generated email */
|
|
487
|
+
async edit(emailId, params) {
|
|
467
488
|
return this.client.post(
|
|
468
|
-
`/emails/${
|
|
469
|
-
params
|
|
489
|
+
`/emails/${emailId}/edit`,
|
|
490
|
+
params
|
|
470
491
|
);
|
|
471
492
|
}
|
|
472
493
|
/**
|
|
@@ -760,12 +781,13 @@ var Campaigns = class {
|
|
|
760
781
|
this.client = client;
|
|
761
782
|
}
|
|
762
783
|
async list(params) {
|
|
763
|
-
const { projectId, status, page, limit } = params;
|
|
784
|
+
const { projectId, status, page, limit, archived } = params;
|
|
764
785
|
return this.client.get("/campaigns", {
|
|
765
786
|
projectId,
|
|
766
787
|
status,
|
|
767
788
|
page,
|
|
768
|
-
limit
|
|
789
|
+
limit,
|
|
790
|
+
archived
|
|
769
791
|
});
|
|
770
792
|
}
|
|
771
793
|
async create(params) {
|
|
@@ -783,6 +805,12 @@ var Campaigns = class {
|
|
|
783
805
|
async cancel(id) {
|
|
784
806
|
return this.client.post(`/campaigns/${id}/cancel`);
|
|
785
807
|
}
|
|
808
|
+
async archive(id) {
|
|
809
|
+
return this.client.post(`/campaigns/${id}/archive`);
|
|
810
|
+
}
|
|
811
|
+
async unarchive(id) {
|
|
812
|
+
return this.client.post(`/campaigns/${id}/unarchive`);
|
|
813
|
+
}
|
|
786
814
|
};
|
|
787
815
|
|
|
788
816
|
// src/migma.ts
|