migma 1.4.1 → 1.6.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/README.md +2 -1
- package/dist/index.d.mts +165 -1
- package/dist/index.d.ts +165 -1
- package/dist/index.js +98 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +98 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -646,7 +646,7 @@ await migma.images.updateLogos('proj_abc123', {
|
|
|
646
646
|
| `migma.sending` | `send` `getBatchStatus` | [Sending](https://docs.migma.ai/api-reference/sending/send-email) |
|
|
647
647
|
| `migma.metrics` | `sending` | [API Reference](https://docs.migma.ai/api-reference/introduction) |
|
|
648
648
|
| `migma.projects` | `list` `get` `import` `getImportStatus` `retryImport` `fieldCatalog` `importAndWait` | [Projects](https://docs.migma.ai/api-reference/projects/list-projects) |
|
|
649
|
-
| `migma.emails` | `generate` `getGenerationStatus` `generateAndWait` `sendTest` `get` `edit` | [Email Generation](https://docs.migma.ai/api-reference/email/generate-email-async) |
|
|
649
|
+
| `migma.emails` | `generate` `importHtml` `getGenerationStatus` `generateAndWait` `importHtmlAndWait` `sendTest` `get` `edit` | [Email Generation](https://docs.migma.ai/api-reference/email/generate-email-async) |
|
|
650
650
|
| `migma.campaigns` | `list` `create` `get` `send` `schedule` `cancel` `stats` `logs` `archive` `unarchive` | [Campaigns](https://docs.migma.ai/campaigns/overview) |
|
|
651
651
|
| `migma.validation` | `all` `compatibility` `links` `spelling` `deliverability` | [Validation](https://docs.migma.ai/api-reference/email-validation/run-all-validation-checks) |
|
|
652
652
|
| `migma.previews` | `create` `get` `getStatus` `getDevice` `getSupportedDevices` `createAndWait` | [Previews](https://docs.migma.ai/api-reference/email-previews/create-email-preview) |
|
|
@@ -670,6 +670,7 @@ const options = {
|
|
|
670
670
|
};
|
|
671
671
|
|
|
672
672
|
await migma.emails.generateAndWait(params, options);
|
|
673
|
+
await migma.emails.importHtmlAndWait(params, options);
|
|
673
674
|
await migma.projects.importAndWait(params, options);
|
|
674
675
|
await migma.previews.createAndWait(params, options);
|
|
675
676
|
```
|
package/dist/index.d.mts
CHANGED
|
@@ -605,6 +605,24 @@ interface GenerateEmailParams {
|
|
|
605
605
|
/** Optional target email count. Omit to let Migma infer single vs series from the prompt. */
|
|
606
606
|
count?: number;
|
|
607
607
|
}
|
|
608
|
+
interface ImportHtmlEmailFile {
|
|
609
|
+
name: string;
|
|
610
|
+
source: string;
|
|
611
|
+
}
|
|
612
|
+
interface ImportHtmlEmailParams {
|
|
613
|
+
projectId: string;
|
|
614
|
+
/** Single HTML or .eml source. Provide this or `htmls`, not both. */
|
|
615
|
+
html?: string;
|
|
616
|
+
/** Filename for a single `html` paste. */
|
|
617
|
+
name?: string;
|
|
618
|
+
/** Multiple HTML / .eml files (1–12). Provide this or `html`, not both. */
|
|
619
|
+
htmls?: ImportHtmlEmailFile[];
|
|
620
|
+
/** Natural-language conversion instruction (keep as-is vs apply brand). */
|
|
621
|
+
instruction?: string;
|
|
622
|
+
languages?: string[];
|
|
623
|
+
visibility?: 'private' | 'unlisted' | 'public';
|
|
624
|
+
generateMedia?: boolean;
|
|
625
|
+
}
|
|
608
626
|
interface GenerateEmailResponse {
|
|
609
627
|
conversationId: string;
|
|
610
628
|
status: 'pending';
|
|
@@ -805,6 +823,8 @@ declare class Emails {
|
|
|
805
823
|
list(params: ListEmailsParams): Promise<MigmaResult<ListEmailsResponse>>;
|
|
806
824
|
/** Start async email generation */
|
|
807
825
|
generate(params: GenerateEmailParams, options?: CallOptions): Promise<MigmaResult<GenerateEmailResponse>>;
|
|
826
|
+
/** Convert existing HTML or .eml into editable emails (async). */
|
|
827
|
+
importHtml(params: ImportHtmlEmailParams, options?: CallOptions): Promise<MigmaResult<GenerateEmailResponse>>;
|
|
808
828
|
/** Check email generation status */
|
|
809
829
|
getGenerationStatus(conversationId: string): Promise<MigmaResult<EmailGenerationStatus>>;
|
|
810
830
|
/** Fetch one generated email by email id */
|
|
@@ -816,6 +836,11 @@ declare class Emails {
|
|
|
816
836
|
* Polls getGenerationStatus until status is 'completed' or 'failed'.
|
|
817
837
|
*/
|
|
818
838
|
generateAndWait(params: GenerateEmailParams, options?: PollingOptions, callOptions?: CallOptions): Promise<MigmaResult<EmailGenerationStatus>>;
|
|
839
|
+
/**
|
|
840
|
+
* Import HTML and wait for completion.
|
|
841
|
+
* Polls getGenerationStatus until status is 'completed' or 'failed'.
|
|
842
|
+
*/
|
|
843
|
+
importHtmlAndWait(params: ImportHtmlEmailParams, options?: PollingOptions, callOptions?: CallOptions): Promise<MigmaResult<EmailGenerationStatus>>;
|
|
819
844
|
/** Send a test email from a completed conversation */
|
|
820
845
|
sendTest(params: SendTestEmailParams): Promise<MigmaResult<SendTestEmailResponse>>;
|
|
821
846
|
/**
|
|
@@ -1197,6 +1222,143 @@ declare class Domains {
|
|
|
1197
1222
|
setup(params: SetupDomainParams): Promise<MigmaResult<SetupDomainResponse>>;
|
|
1198
1223
|
}
|
|
1199
1224
|
|
|
1225
|
+
interface DomainPurchaseQuote {
|
|
1226
|
+
rootDomain: string;
|
|
1227
|
+
tld: string;
|
|
1228
|
+
available?: boolean;
|
|
1229
|
+
supported?: boolean;
|
|
1230
|
+
premium?: boolean;
|
|
1231
|
+
sellPrice?: number;
|
|
1232
|
+
currency?: string;
|
|
1233
|
+
[key: string]: unknown;
|
|
1234
|
+
}
|
|
1235
|
+
interface DomainPurchaseSearchParams {
|
|
1236
|
+
/** Name or keyword, e.g. 'acme' or 'acme.com'. */
|
|
1237
|
+
q: string;
|
|
1238
|
+
/** Max quotes to return (1-20, default 8). */
|
|
1239
|
+
limit?: number;
|
|
1240
|
+
}
|
|
1241
|
+
interface DomainPurchaseParams {
|
|
1242
|
+
/** Domain to buy, e.g. 'acme.com'. */
|
|
1243
|
+
domain: string;
|
|
1244
|
+
/** Optional website the bought apex domain should redirect to. */
|
|
1245
|
+
redirectUrl?: string;
|
|
1246
|
+
}
|
|
1247
|
+
interface DomainPurchaseCheckout {
|
|
1248
|
+
/** Stripe checkout URL the account owner opens in a browser to pay. */
|
|
1249
|
+
checkoutUrl: string;
|
|
1250
|
+
checkoutSessionId?: string;
|
|
1251
|
+
billingMode?: 'annual_subscription';
|
|
1252
|
+
[key: string]: unknown;
|
|
1253
|
+
}
|
|
1254
|
+
type DomainRegistrationStatus = 'quoted' | 'payment_pending' | 'registering' | 'active' | 'failed' | 'refunded' | string;
|
|
1255
|
+
interface DomainRegistration {
|
|
1256
|
+
id: string;
|
|
1257
|
+
rootDomain: string;
|
|
1258
|
+
status: DomainRegistrationStatus;
|
|
1259
|
+
sellPrice?: number;
|
|
1260
|
+
currency?: string;
|
|
1261
|
+
[key: string]: unknown;
|
|
1262
|
+
}
|
|
1263
|
+
type CustomDnsRecordType = 'A' | 'AAAA' | 'CNAME' | 'MX' | 'TXT' | 'NS';
|
|
1264
|
+
interface CustomDnsRecord {
|
|
1265
|
+
id: string;
|
|
1266
|
+
type: CustomDnsRecordType;
|
|
1267
|
+
name: string;
|
|
1268
|
+
content: string;
|
|
1269
|
+
/** MX only. */
|
|
1270
|
+
priority?: number;
|
|
1271
|
+
createdAt: string;
|
|
1272
|
+
[key: string]: unknown;
|
|
1273
|
+
}
|
|
1274
|
+
interface CustomDnsRecordList {
|
|
1275
|
+
/** false = Migma does not host this domain's DNS zone (connected from an outside registrar). */
|
|
1276
|
+
managed: boolean;
|
|
1277
|
+
records: CustomDnsRecord[];
|
|
1278
|
+
}
|
|
1279
|
+
interface AddCustomDnsRecordParams {
|
|
1280
|
+
/** Record name: '@' for the root, a label like 'mail', or a full name like 'mail.acme.com'. */
|
|
1281
|
+
name: string;
|
|
1282
|
+
/** Record value, e.g. an IP, hostname, or TXT string. */
|
|
1283
|
+
content: string;
|
|
1284
|
+
/** Defaults to TXT. */
|
|
1285
|
+
type?: CustomDnsRecordType;
|
|
1286
|
+
/** MX priority (0-65535). */
|
|
1287
|
+
priority?: number;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
declare class DomainPurchases {
|
|
1291
|
+
private readonly client;
|
|
1292
|
+
constructor(client: MigmaClient);
|
|
1293
|
+
/** Availability and price quotes for domains you could buy. */
|
|
1294
|
+
search(params: DomainPurchaseSearchParams): Promise<MigmaResult<{
|
|
1295
|
+
quotes: DomainPurchaseQuote[];
|
|
1296
|
+
}>>;
|
|
1297
|
+
/**
|
|
1298
|
+
* Start buying a domain. Returns a Stripe checkout URL the account owner
|
|
1299
|
+
* opens in a browser; the domain registers after payment clears. Requires
|
|
1300
|
+
* an active paid Migma subscription.
|
|
1301
|
+
*/
|
|
1302
|
+
create(params: DomainPurchaseParams): Promise<MigmaResult<DomainPurchaseCheckout>>;
|
|
1303
|
+
/** Purchase history and status: payment_pending → registering → active. */
|
|
1304
|
+
registrations(params?: {
|
|
1305
|
+
limit?: number;
|
|
1306
|
+
}): Promise<MigmaResult<{
|
|
1307
|
+
registrations: DomainRegistration[];
|
|
1308
|
+
}>>;
|
|
1309
|
+
/** DNS records you added to a domain bought in Migma. `managed: false` = zone not hosted by Migma. */
|
|
1310
|
+
listDnsRecords(domain: string): Promise<MigmaResult<CustomDnsRecordList>>;
|
|
1311
|
+
/**
|
|
1312
|
+
* Add a DNS record (A, AAAA, CNAME, MX, TXT, or NS) to a domain bought in
|
|
1313
|
+
* Migma. Migma's email sending records are protected and cannot be
|
|
1314
|
+
* overridden; the root and www stay with domain forwarding.
|
|
1315
|
+
*/
|
|
1316
|
+
addDnsRecord(domain: string, params: AddCustomDnsRecordParams): Promise<MigmaResult<{
|
|
1317
|
+
record: CustomDnsRecord;
|
|
1318
|
+
}>>;
|
|
1319
|
+
/** Remove a DNS record you added earlier (never Migma's own records). */
|
|
1320
|
+
removeDnsRecord(domain: string, recordId: string): Promise<MigmaResult<{
|
|
1321
|
+
ok: boolean;
|
|
1322
|
+
}>>;
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
interface CreditStatus {
|
|
1326
|
+
currentPlan: string;
|
|
1327
|
+
isExpired: boolean;
|
|
1328
|
+
planExpiry?: string;
|
|
1329
|
+
hasCredits: boolean;
|
|
1330
|
+
emailCreditsRemainingToday: number;
|
|
1331
|
+
imageCreditsRemainingToday: number;
|
|
1332
|
+
monthlyCreditsRemaining: number;
|
|
1333
|
+
}
|
|
1334
|
+
type UpgradePlan = 'basic' | 'premium' | 'business' | 'basic_annual' | 'premium_annual' | 'business_annual';
|
|
1335
|
+
interface UpgradeLinkParams {
|
|
1336
|
+
/**
|
|
1337
|
+
* Target plan for Stripe Checkout. Omit to get a billing portal link
|
|
1338
|
+
* (existing Stripe customers only).
|
|
1339
|
+
*/
|
|
1340
|
+
plan?: UpgradePlan;
|
|
1341
|
+
}
|
|
1342
|
+
interface UpgradeLink {
|
|
1343
|
+
/** URL the account owner opens in a browser to pay or manage billing. */
|
|
1344
|
+
url: string;
|
|
1345
|
+
kind: 'checkout' | 'portal';
|
|
1346
|
+
sessionId?: string;
|
|
1347
|
+
orderId?: string;
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
declare class Billing {
|
|
1351
|
+
private readonly client;
|
|
1352
|
+
constructor(client: MigmaClient);
|
|
1353
|
+
/** Plan and remaining credits for the API key owner. */
|
|
1354
|
+
credits(): Promise<MigmaResult<CreditStatus>>;
|
|
1355
|
+
/**
|
|
1356
|
+
* Mint a Stripe link the account owner opens in a browser to upgrade or
|
|
1357
|
+
* manage the subscription. Nothing is charged by this call itself.
|
|
1358
|
+
*/
|
|
1359
|
+
upgradeLink(params?: UpgradeLinkParams): Promise<MigmaResult<UpgradeLink>>;
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1200
1362
|
type WebhookEventType = 'email.generation.started' | 'email.generation.completed' | 'email.generation.failed' | 'email.test.sent' | 'project.import.started' | 'project.import.processing' | 'project.import.completed' | 'project.import.failed' | 'export.completed' | 'export.failed' | 'subscriber.added' | 'subscriber.updated' | 'subscriber.unsubscribed' | 'subscriber.bulk_imported' | 'api_key.created' | 'api_key.revoked';
|
|
1201
1363
|
interface CreateWebhookParams {
|
|
1202
1364
|
url: string;
|
|
@@ -1552,6 +1714,8 @@ declare class Migma {
|
|
|
1552
1714
|
readonly previews: Previews;
|
|
1553
1715
|
readonly export: Export;
|
|
1554
1716
|
readonly domains: Domains;
|
|
1717
|
+
readonly domainPurchases: DomainPurchases;
|
|
1718
|
+
readonly billing: Billing;
|
|
1555
1719
|
readonly webhooks: Webhooks;
|
|
1556
1720
|
readonly knowledgeBase: KnowledgeBase;
|
|
1557
1721
|
readonly images: Images;
|
|
@@ -1560,4 +1724,4 @@ declare class Migma {
|
|
|
1560
1724
|
constructor(apiKey: string, config?: MigmaConfig);
|
|
1561
1725
|
}
|
|
1562
1726
|
|
|
1563
|
-
export { type AddImageParams, type AddKnowledgeBaseParams, type AnalyzeDeliverabilityParams, type AnalyzeLinksParams, type ApiResponse, type BatchDeleteContactsParams, type BatchDeleteResponse, type BatchStatus, type BulkImportAsyncResponse, type BulkImportContactItem, type BulkImportJobStatus, type BulkImportParams, type BulkImportResponse, type BulkImportSyncResponse, type Campaign, type CampaignLog, type CampaignLogsParams, type CampaignLogsResponse, type CampaignStats, 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 CreateWebhookResponse, type DeleteResponse, type DeliverabilityResponse, type DeviceCategoriesResponse, type DnsRecord, type Domain, type DomainAvailability, type DomainDeleteResponse, type DomainStream, type DomainVerificationResult, type EditEmailParams, type Email, type EmailGenerationResult, type EmailGenerationStatus, type EmailImage, type EmailLogsParams, type EmailLogsResponse, type EmailMetrics, type EmailMetricsCountry, type EmailMetricsSummary, type EmailMetricsTimePoint, type EmailSendLog, 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 ProvisionStreamParams, type RecipientType, type RetryImportResponse, type ScheduleCampaignParams, type Segment, type SegmentActivityFilter, type SegmentFieldFilter, type SegmentFilters, type SendEmailParams, type SendEmailResponse, type SendTestEmailParams, type SendTestEmailResponse, type SendingMetrics, type SendingMetricsCounts, type SendingMetricsHistoryEntry, type SendingMetricsParams, type SendingMetricsToday, type SetupDomainParams, type SetupDomainResponse, 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 };
|
|
1727
|
+
export { type AddCustomDnsRecordParams, type AddImageParams, type AddKnowledgeBaseParams, type AnalyzeDeliverabilityParams, type AnalyzeLinksParams, type ApiResponse, type BatchDeleteContactsParams, type BatchDeleteResponse, type BatchStatus, type BulkImportAsyncResponse, type BulkImportContactItem, type BulkImportJobStatus, type BulkImportParams, type BulkImportResponse, type BulkImportSyncResponse, type Campaign, type CampaignLog, type CampaignLogsParams, type CampaignLogsResponse, type CampaignStats, 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 CreateWebhookResponse, type CreditStatus, type CustomDnsRecord, type CustomDnsRecordList, type CustomDnsRecordType, type DeleteResponse, type DeliverabilityResponse, type DeviceCategoriesResponse, type DnsRecord, type Domain, type DomainAvailability, type DomainDeleteResponse, type DomainPurchaseCheckout, type DomainPurchaseParams, type DomainPurchaseQuote, type DomainPurchaseSearchParams, type DomainRegistration, type DomainRegistrationStatus, type DomainStream, type DomainVerificationResult, type EditEmailParams, type Email, type EmailGenerationResult, type EmailGenerationStatus, type EmailImage, type EmailLogsParams, type EmailLogsResponse, type EmailMetrics, type EmailMetricsCountry, type EmailMetricsSummary, type EmailMetricsTimePoint, type EmailSendLog, 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 ImportHtmlEmailFile, type ImportHtmlEmailParams, 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 ProvisionStreamParams, type RecipientType, type RetryImportResponse, type ScheduleCampaignParams, type Segment, type SegmentActivityFilter, type SegmentFieldFilter, type SegmentFilters, type SendEmailParams, type SendEmailResponse, type SendTestEmailParams, type SendTestEmailResponse, type SendingMetrics, type SendingMetricsCounts, type SendingMetricsHistoryEntry, type SendingMetricsParams, type SendingMetricsToday, type SetupDomainParams, type SetupDomainResponse, 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 UpgradeLink, type UpgradeLinkParams, type UpgradePlan, type ValidateAllParams, type ValidateAllResponse, type Webhook, type WebhookDeliveriesResponse, type WebhookDelivery, type WebhookDetail, type WebhookEvent, type WebhookEventType, type WebhookEventsResponse, type WebhookTestResult, poll };
|
package/dist/index.d.ts
CHANGED
|
@@ -605,6 +605,24 @@ interface GenerateEmailParams {
|
|
|
605
605
|
/** Optional target email count. Omit to let Migma infer single vs series from the prompt. */
|
|
606
606
|
count?: number;
|
|
607
607
|
}
|
|
608
|
+
interface ImportHtmlEmailFile {
|
|
609
|
+
name: string;
|
|
610
|
+
source: string;
|
|
611
|
+
}
|
|
612
|
+
interface ImportHtmlEmailParams {
|
|
613
|
+
projectId: string;
|
|
614
|
+
/** Single HTML or .eml source. Provide this or `htmls`, not both. */
|
|
615
|
+
html?: string;
|
|
616
|
+
/** Filename for a single `html` paste. */
|
|
617
|
+
name?: string;
|
|
618
|
+
/** Multiple HTML / .eml files (1–12). Provide this or `html`, not both. */
|
|
619
|
+
htmls?: ImportHtmlEmailFile[];
|
|
620
|
+
/** Natural-language conversion instruction (keep as-is vs apply brand). */
|
|
621
|
+
instruction?: string;
|
|
622
|
+
languages?: string[];
|
|
623
|
+
visibility?: 'private' | 'unlisted' | 'public';
|
|
624
|
+
generateMedia?: boolean;
|
|
625
|
+
}
|
|
608
626
|
interface GenerateEmailResponse {
|
|
609
627
|
conversationId: string;
|
|
610
628
|
status: 'pending';
|
|
@@ -805,6 +823,8 @@ declare class Emails {
|
|
|
805
823
|
list(params: ListEmailsParams): Promise<MigmaResult<ListEmailsResponse>>;
|
|
806
824
|
/** Start async email generation */
|
|
807
825
|
generate(params: GenerateEmailParams, options?: CallOptions): Promise<MigmaResult<GenerateEmailResponse>>;
|
|
826
|
+
/** Convert existing HTML or .eml into editable emails (async). */
|
|
827
|
+
importHtml(params: ImportHtmlEmailParams, options?: CallOptions): Promise<MigmaResult<GenerateEmailResponse>>;
|
|
808
828
|
/** Check email generation status */
|
|
809
829
|
getGenerationStatus(conversationId: string): Promise<MigmaResult<EmailGenerationStatus>>;
|
|
810
830
|
/** Fetch one generated email by email id */
|
|
@@ -816,6 +836,11 @@ declare class Emails {
|
|
|
816
836
|
* Polls getGenerationStatus until status is 'completed' or 'failed'.
|
|
817
837
|
*/
|
|
818
838
|
generateAndWait(params: GenerateEmailParams, options?: PollingOptions, callOptions?: CallOptions): Promise<MigmaResult<EmailGenerationStatus>>;
|
|
839
|
+
/**
|
|
840
|
+
* Import HTML and wait for completion.
|
|
841
|
+
* Polls getGenerationStatus until status is 'completed' or 'failed'.
|
|
842
|
+
*/
|
|
843
|
+
importHtmlAndWait(params: ImportHtmlEmailParams, options?: PollingOptions, callOptions?: CallOptions): Promise<MigmaResult<EmailGenerationStatus>>;
|
|
819
844
|
/** Send a test email from a completed conversation */
|
|
820
845
|
sendTest(params: SendTestEmailParams): Promise<MigmaResult<SendTestEmailResponse>>;
|
|
821
846
|
/**
|
|
@@ -1197,6 +1222,143 @@ declare class Domains {
|
|
|
1197
1222
|
setup(params: SetupDomainParams): Promise<MigmaResult<SetupDomainResponse>>;
|
|
1198
1223
|
}
|
|
1199
1224
|
|
|
1225
|
+
interface DomainPurchaseQuote {
|
|
1226
|
+
rootDomain: string;
|
|
1227
|
+
tld: string;
|
|
1228
|
+
available?: boolean;
|
|
1229
|
+
supported?: boolean;
|
|
1230
|
+
premium?: boolean;
|
|
1231
|
+
sellPrice?: number;
|
|
1232
|
+
currency?: string;
|
|
1233
|
+
[key: string]: unknown;
|
|
1234
|
+
}
|
|
1235
|
+
interface DomainPurchaseSearchParams {
|
|
1236
|
+
/** Name or keyword, e.g. 'acme' or 'acme.com'. */
|
|
1237
|
+
q: string;
|
|
1238
|
+
/** Max quotes to return (1-20, default 8). */
|
|
1239
|
+
limit?: number;
|
|
1240
|
+
}
|
|
1241
|
+
interface DomainPurchaseParams {
|
|
1242
|
+
/** Domain to buy, e.g. 'acme.com'. */
|
|
1243
|
+
domain: string;
|
|
1244
|
+
/** Optional website the bought apex domain should redirect to. */
|
|
1245
|
+
redirectUrl?: string;
|
|
1246
|
+
}
|
|
1247
|
+
interface DomainPurchaseCheckout {
|
|
1248
|
+
/** Stripe checkout URL the account owner opens in a browser to pay. */
|
|
1249
|
+
checkoutUrl: string;
|
|
1250
|
+
checkoutSessionId?: string;
|
|
1251
|
+
billingMode?: 'annual_subscription';
|
|
1252
|
+
[key: string]: unknown;
|
|
1253
|
+
}
|
|
1254
|
+
type DomainRegistrationStatus = 'quoted' | 'payment_pending' | 'registering' | 'active' | 'failed' | 'refunded' | string;
|
|
1255
|
+
interface DomainRegistration {
|
|
1256
|
+
id: string;
|
|
1257
|
+
rootDomain: string;
|
|
1258
|
+
status: DomainRegistrationStatus;
|
|
1259
|
+
sellPrice?: number;
|
|
1260
|
+
currency?: string;
|
|
1261
|
+
[key: string]: unknown;
|
|
1262
|
+
}
|
|
1263
|
+
type CustomDnsRecordType = 'A' | 'AAAA' | 'CNAME' | 'MX' | 'TXT' | 'NS';
|
|
1264
|
+
interface CustomDnsRecord {
|
|
1265
|
+
id: string;
|
|
1266
|
+
type: CustomDnsRecordType;
|
|
1267
|
+
name: string;
|
|
1268
|
+
content: string;
|
|
1269
|
+
/** MX only. */
|
|
1270
|
+
priority?: number;
|
|
1271
|
+
createdAt: string;
|
|
1272
|
+
[key: string]: unknown;
|
|
1273
|
+
}
|
|
1274
|
+
interface CustomDnsRecordList {
|
|
1275
|
+
/** false = Migma does not host this domain's DNS zone (connected from an outside registrar). */
|
|
1276
|
+
managed: boolean;
|
|
1277
|
+
records: CustomDnsRecord[];
|
|
1278
|
+
}
|
|
1279
|
+
interface AddCustomDnsRecordParams {
|
|
1280
|
+
/** Record name: '@' for the root, a label like 'mail', or a full name like 'mail.acme.com'. */
|
|
1281
|
+
name: string;
|
|
1282
|
+
/** Record value, e.g. an IP, hostname, or TXT string. */
|
|
1283
|
+
content: string;
|
|
1284
|
+
/** Defaults to TXT. */
|
|
1285
|
+
type?: CustomDnsRecordType;
|
|
1286
|
+
/** MX priority (0-65535). */
|
|
1287
|
+
priority?: number;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
declare class DomainPurchases {
|
|
1291
|
+
private readonly client;
|
|
1292
|
+
constructor(client: MigmaClient);
|
|
1293
|
+
/** Availability and price quotes for domains you could buy. */
|
|
1294
|
+
search(params: DomainPurchaseSearchParams): Promise<MigmaResult<{
|
|
1295
|
+
quotes: DomainPurchaseQuote[];
|
|
1296
|
+
}>>;
|
|
1297
|
+
/**
|
|
1298
|
+
* Start buying a domain. Returns a Stripe checkout URL the account owner
|
|
1299
|
+
* opens in a browser; the domain registers after payment clears. Requires
|
|
1300
|
+
* an active paid Migma subscription.
|
|
1301
|
+
*/
|
|
1302
|
+
create(params: DomainPurchaseParams): Promise<MigmaResult<DomainPurchaseCheckout>>;
|
|
1303
|
+
/** Purchase history and status: payment_pending → registering → active. */
|
|
1304
|
+
registrations(params?: {
|
|
1305
|
+
limit?: number;
|
|
1306
|
+
}): Promise<MigmaResult<{
|
|
1307
|
+
registrations: DomainRegistration[];
|
|
1308
|
+
}>>;
|
|
1309
|
+
/** DNS records you added to a domain bought in Migma. `managed: false` = zone not hosted by Migma. */
|
|
1310
|
+
listDnsRecords(domain: string): Promise<MigmaResult<CustomDnsRecordList>>;
|
|
1311
|
+
/**
|
|
1312
|
+
* Add a DNS record (A, AAAA, CNAME, MX, TXT, or NS) to a domain bought in
|
|
1313
|
+
* Migma. Migma's email sending records are protected and cannot be
|
|
1314
|
+
* overridden; the root and www stay with domain forwarding.
|
|
1315
|
+
*/
|
|
1316
|
+
addDnsRecord(domain: string, params: AddCustomDnsRecordParams): Promise<MigmaResult<{
|
|
1317
|
+
record: CustomDnsRecord;
|
|
1318
|
+
}>>;
|
|
1319
|
+
/** Remove a DNS record you added earlier (never Migma's own records). */
|
|
1320
|
+
removeDnsRecord(domain: string, recordId: string): Promise<MigmaResult<{
|
|
1321
|
+
ok: boolean;
|
|
1322
|
+
}>>;
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
interface CreditStatus {
|
|
1326
|
+
currentPlan: string;
|
|
1327
|
+
isExpired: boolean;
|
|
1328
|
+
planExpiry?: string;
|
|
1329
|
+
hasCredits: boolean;
|
|
1330
|
+
emailCreditsRemainingToday: number;
|
|
1331
|
+
imageCreditsRemainingToday: number;
|
|
1332
|
+
monthlyCreditsRemaining: number;
|
|
1333
|
+
}
|
|
1334
|
+
type UpgradePlan = 'basic' | 'premium' | 'business' | 'basic_annual' | 'premium_annual' | 'business_annual';
|
|
1335
|
+
interface UpgradeLinkParams {
|
|
1336
|
+
/**
|
|
1337
|
+
* Target plan for Stripe Checkout. Omit to get a billing portal link
|
|
1338
|
+
* (existing Stripe customers only).
|
|
1339
|
+
*/
|
|
1340
|
+
plan?: UpgradePlan;
|
|
1341
|
+
}
|
|
1342
|
+
interface UpgradeLink {
|
|
1343
|
+
/** URL the account owner opens in a browser to pay or manage billing. */
|
|
1344
|
+
url: string;
|
|
1345
|
+
kind: 'checkout' | 'portal';
|
|
1346
|
+
sessionId?: string;
|
|
1347
|
+
orderId?: string;
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
declare class Billing {
|
|
1351
|
+
private readonly client;
|
|
1352
|
+
constructor(client: MigmaClient);
|
|
1353
|
+
/** Plan and remaining credits for the API key owner. */
|
|
1354
|
+
credits(): Promise<MigmaResult<CreditStatus>>;
|
|
1355
|
+
/**
|
|
1356
|
+
* Mint a Stripe link the account owner opens in a browser to upgrade or
|
|
1357
|
+
* manage the subscription. Nothing is charged by this call itself.
|
|
1358
|
+
*/
|
|
1359
|
+
upgradeLink(params?: UpgradeLinkParams): Promise<MigmaResult<UpgradeLink>>;
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1200
1362
|
type WebhookEventType = 'email.generation.started' | 'email.generation.completed' | 'email.generation.failed' | 'email.test.sent' | 'project.import.started' | 'project.import.processing' | 'project.import.completed' | 'project.import.failed' | 'export.completed' | 'export.failed' | 'subscriber.added' | 'subscriber.updated' | 'subscriber.unsubscribed' | 'subscriber.bulk_imported' | 'api_key.created' | 'api_key.revoked';
|
|
1201
1363
|
interface CreateWebhookParams {
|
|
1202
1364
|
url: string;
|
|
@@ -1552,6 +1714,8 @@ declare class Migma {
|
|
|
1552
1714
|
readonly previews: Previews;
|
|
1553
1715
|
readonly export: Export;
|
|
1554
1716
|
readonly domains: Domains;
|
|
1717
|
+
readonly domainPurchases: DomainPurchases;
|
|
1718
|
+
readonly billing: Billing;
|
|
1555
1719
|
readonly webhooks: Webhooks;
|
|
1556
1720
|
readonly knowledgeBase: KnowledgeBase;
|
|
1557
1721
|
readonly images: Images;
|
|
@@ -1560,4 +1724,4 @@ declare class Migma {
|
|
|
1560
1724
|
constructor(apiKey: string, config?: MigmaConfig);
|
|
1561
1725
|
}
|
|
1562
1726
|
|
|
1563
|
-
export { type AddImageParams, type AddKnowledgeBaseParams, type AnalyzeDeliverabilityParams, type AnalyzeLinksParams, type ApiResponse, type BatchDeleteContactsParams, type BatchDeleteResponse, type BatchStatus, type BulkImportAsyncResponse, type BulkImportContactItem, type BulkImportJobStatus, type BulkImportParams, type BulkImportResponse, type BulkImportSyncResponse, type Campaign, type CampaignLog, type CampaignLogsParams, type CampaignLogsResponse, type CampaignStats, 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 CreateWebhookResponse, type DeleteResponse, type DeliverabilityResponse, type DeviceCategoriesResponse, type DnsRecord, type Domain, type DomainAvailability, type DomainDeleteResponse, type DomainStream, type DomainVerificationResult, type EditEmailParams, type Email, type EmailGenerationResult, type EmailGenerationStatus, type EmailImage, type EmailLogsParams, type EmailLogsResponse, type EmailMetrics, type EmailMetricsCountry, type EmailMetricsSummary, type EmailMetricsTimePoint, type EmailSendLog, 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 ProvisionStreamParams, type RecipientType, type RetryImportResponse, type ScheduleCampaignParams, type Segment, type SegmentActivityFilter, type SegmentFieldFilter, type SegmentFilters, type SendEmailParams, type SendEmailResponse, type SendTestEmailParams, type SendTestEmailResponse, type SendingMetrics, type SendingMetricsCounts, type SendingMetricsHistoryEntry, type SendingMetricsParams, type SendingMetricsToday, type SetupDomainParams, type SetupDomainResponse, 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 };
|
|
1727
|
+
export { type AddCustomDnsRecordParams, type AddImageParams, type AddKnowledgeBaseParams, type AnalyzeDeliverabilityParams, type AnalyzeLinksParams, type ApiResponse, type BatchDeleteContactsParams, type BatchDeleteResponse, type BatchStatus, type BulkImportAsyncResponse, type BulkImportContactItem, type BulkImportJobStatus, type BulkImportParams, type BulkImportResponse, type BulkImportSyncResponse, type Campaign, type CampaignLog, type CampaignLogsParams, type CampaignLogsResponse, type CampaignStats, 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 CreateWebhookResponse, type CreditStatus, type CustomDnsRecord, type CustomDnsRecordList, type CustomDnsRecordType, type DeleteResponse, type DeliverabilityResponse, type DeviceCategoriesResponse, type DnsRecord, type Domain, type DomainAvailability, type DomainDeleteResponse, type DomainPurchaseCheckout, type DomainPurchaseParams, type DomainPurchaseQuote, type DomainPurchaseSearchParams, type DomainRegistration, type DomainRegistrationStatus, type DomainStream, type DomainVerificationResult, type EditEmailParams, type Email, type EmailGenerationResult, type EmailGenerationStatus, type EmailImage, type EmailLogsParams, type EmailLogsResponse, type EmailMetrics, type EmailMetricsCountry, type EmailMetricsSummary, type EmailMetricsTimePoint, type EmailSendLog, 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 ImportHtmlEmailFile, type ImportHtmlEmailParams, 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 ProvisionStreamParams, type RecipientType, type RetryImportResponse, type ScheduleCampaignParams, type Segment, type SegmentActivityFilter, type SegmentFieldFilter, type SegmentFilters, type SendEmailParams, type SendEmailResponse, type SendTestEmailParams, type SendTestEmailResponse, type SendingMetrics, type SendingMetricsCounts, type SendingMetricsHistoryEntry, type SendingMetricsParams, type SendingMetricsToday, type SetupDomainParams, type SetupDomainResponse, 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 UpgradeLink, type UpgradeLinkParams, type UpgradePlan, 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
|
@@ -484,6 +484,14 @@ var Emails = class {
|
|
|
484
484
|
options
|
|
485
485
|
);
|
|
486
486
|
}
|
|
487
|
+
/** Convert existing HTML or .eml into editable emails (async). */
|
|
488
|
+
async importHtml(params, options) {
|
|
489
|
+
return this.client.post(
|
|
490
|
+
"/projects/emails/import-html",
|
|
491
|
+
params,
|
|
492
|
+
options
|
|
493
|
+
);
|
|
494
|
+
}
|
|
487
495
|
/** Check email generation status */
|
|
488
496
|
async getGenerationStatus(conversationId) {
|
|
489
497
|
return this.client.get(
|
|
@@ -517,6 +525,22 @@ var Emails = class {
|
|
|
517
525
|
options
|
|
518
526
|
);
|
|
519
527
|
}
|
|
528
|
+
/**
|
|
529
|
+
* Import HTML and wait for completion.
|
|
530
|
+
* Polls getGenerationStatus until status is 'completed' or 'failed'.
|
|
531
|
+
*/
|
|
532
|
+
async importHtmlAndWait(params, options, callOptions) {
|
|
533
|
+
const startResult = await this.importHtml(params, callOptions);
|
|
534
|
+
if (startResult.error) {
|
|
535
|
+
return { data: null, error: startResult.error };
|
|
536
|
+
}
|
|
537
|
+
const conversationId = startResult.data.conversationId;
|
|
538
|
+
return poll(
|
|
539
|
+
() => this.getGenerationStatus(conversationId),
|
|
540
|
+
(status) => status.status === "completed" || status.status === "failed",
|
|
541
|
+
options
|
|
542
|
+
);
|
|
543
|
+
}
|
|
520
544
|
/** Send a test email from a completed conversation */
|
|
521
545
|
async sendTest(params) {
|
|
522
546
|
return this.client.post(
|
|
@@ -719,6 +743,76 @@ var Domains = class {
|
|
|
719
743
|
}
|
|
720
744
|
};
|
|
721
745
|
|
|
746
|
+
// src/resources/domain-purchases.ts
|
|
747
|
+
var DomainPurchases = class {
|
|
748
|
+
constructor(client) {
|
|
749
|
+
this.client = client;
|
|
750
|
+
}
|
|
751
|
+
/** Availability and price quotes for domains you could buy. */
|
|
752
|
+
async search(params) {
|
|
753
|
+
return this.client.get("/domains/purchase/search", {
|
|
754
|
+
q: params.q,
|
|
755
|
+
limit: params.limit
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* Start buying a domain. Returns a Stripe checkout URL the account owner
|
|
760
|
+
* opens in a browser; the domain registers after payment clears. Requires
|
|
761
|
+
* an active paid Migma subscription.
|
|
762
|
+
*/
|
|
763
|
+
async create(params) {
|
|
764
|
+
return this.client.post("/domains/purchase", params);
|
|
765
|
+
}
|
|
766
|
+
/** Purchase history and status: payment_pending → registering → active. */
|
|
767
|
+
async registrations(params) {
|
|
768
|
+
return this.client.get("/domains/purchase/registrations", {
|
|
769
|
+
limit: params?.limit
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
// DNS records live on Migma-hosted zones, which exist exactly for domains
|
|
773
|
+
// bought in Migma — hence they sit on this resource even though the API
|
|
774
|
+
// path is /domains/:domain/dns-records.
|
|
775
|
+
/** DNS records you added to a domain bought in Migma. `managed: false` = zone not hosted by Migma. */
|
|
776
|
+
async listDnsRecords(domain) {
|
|
777
|
+
return this.client.get(`/domains/${encodeURIComponent(domain)}/dns-records`);
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* Add a DNS record (A, AAAA, CNAME, MX, TXT, or NS) to a domain bought in
|
|
781
|
+
* Migma. Migma's email sending records are protected and cannot be
|
|
782
|
+
* overridden; the root and www stay with domain forwarding.
|
|
783
|
+
*/
|
|
784
|
+
async addDnsRecord(domain, params) {
|
|
785
|
+
return this.client.post(
|
|
786
|
+
`/domains/${encodeURIComponent(domain)}/dns-records`,
|
|
787
|
+
params
|
|
788
|
+
);
|
|
789
|
+
}
|
|
790
|
+
/** Remove a DNS record you added earlier (never Migma's own records). */
|
|
791
|
+
async removeDnsRecord(domain, recordId) {
|
|
792
|
+
return this.client.delete(
|
|
793
|
+
`/domains/${encodeURIComponent(domain)}/dns-records/${encodeURIComponent(recordId)}`
|
|
794
|
+
);
|
|
795
|
+
}
|
|
796
|
+
};
|
|
797
|
+
|
|
798
|
+
// src/resources/billing.ts
|
|
799
|
+
var Billing = class {
|
|
800
|
+
constructor(client) {
|
|
801
|
+
this.client = client;
|
|
802
|
+
}
|
|
803
|
+
/** Plan and remaining credits for the API key owner. */
|
|
804
|
+
async credits() {
|
|
805
|
+
return this.client.get("/billing/credits");
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Mint a Stripe link the account owner opens in a browser to upgrade or
|
|
809
|
+
* manage the subscription. Nothing is charged by this call itself.
|
|
810
|
+
*/
|
|
811
|
+
async upgradeLink(params = {}) {
|
|
812
|
+
return this.client.post("/billing/upgrade-link", params);
|
|
813
|
+
}
|
|
814
|
+
};
|
|
815
|
+
|
|
722
816
|
// src/resources/webhooks.ts
|
|
723
817
|
var Webhooks = class {
|
|
724
818
|
constructor(client) {
|
|
@@ -895,6 +989,8 @@ var Migma = class {
|
|
|
895
989
|
previews;
|
|
896
990
|
export;
|
|
897
991
|
domains;
|
|
992
|
+
domainPurchases;
|
|
993
|
+
billing;
|
|
898
994
|
webhooks;
|
|
899
995
|
knowledgeBase;
|
|
900
996
|
images;
|
|
@@ -922,6 +1018,8 @@ var Migma = class {
|
|
|
922
1018
|
this.previews = new Previews(this.client);
|
|
923
1019
|
this.export = new Export(this.client);
|
|
924
1020
|
this.domains = new Domains(this.client);
|
|
1021
|
+
this.domainPurchases = new DomainPurchases(this.client);
|
|
1022
|
+
this.billing = new Billing(this.client);
|
|
925
1023
|
this.webhooks = new Webhooks(this.client);
|
|
926
1024
|
this.knowledgeBase = new KnowledgeBase(this.client);
|
|
927
1025
|
this.images = new Images(this.client);
|