shipmail 0.6.2 → 0.6.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 +1 -0
- package/dist/index.cjs +59 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +64 -3
- package/dist/index.d.ts +64 -3
- package/dist/index.js +59 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -52,6 +52,14 @@ type ApiErrorBody = {
|
|
|
52
52
|
* the interrupted send attempt left behind.
|
|
53
53
|
*/
|
|
54
54
|
readonly message_id?: string | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Present only on a refusal an organization owner can lift in Shipmail. One of
|
|
57
|
+
* `owner_confirmation_required`, `subscription_required`, `trial_capacity` or
|
|
58
|
+
* `purchased_capacity`; later servers may add values.
|
|
59
|
+
*/
|
|
60
|
+
readonly reason?: string | undefined;
|
|
61
|
+
/** Present with `reason`: the Shipmail page where the owner reviews and confirms. */
|
|
62
|
+
readonly action_url?: string | undefined;
|
|
55
63
|
};
|
|
56
64
|
};
|
|
57
65
|
type EmailRecipient = {
|
|
@@ -1406,6 +1414,7 @@ type MailboxForwarding = {
|
|
|
1406
1414
|
readonly mailbox_id: string;
|
|
1407
1415
|
readonly destination: string;
|
|
1408
1416
|
readonly sender: string | null;
|
|
1417
|
+
readonly recipient: string | null;
|
|
1409
1418
|
readonly status: "pending" | "active";
|
|
1410
1419
|
readonly verification_sent_at: string | null;
|
|
1411
1420
|
readonly verified_at: string | null;
|
|
@@ -1420,6 +1429,7 @@ type MailboxForwardingList = {
|
|
|
1420
1429
|
type CreateMailboxForwardingParams = {
|
|
1421
1430
|
readonly destination: string;
|
|
1422
1431
|
readonly sender?: string | null | undefined;
|
|
1432
|
+
readonly recipient?: string | null | undefined;
|
|
1423
1433
|
};
|
|
1424
1434
|
type CreateMailboxBaseParams = {
|
|
1425
1435
|
readonly domain_id: string;
|
|
@@ -2051,6 +2061,38 @@ declare class Newsletters extends ApiResource {
|
|
|
2051
2061
|
resume(id: string, options?: MethodOptions): Promise<Newsletter>;
|
|
2052
2062
|
}
|
|
2053
2063
|
|
|
2064
|
+
type OrganizationAccess = {
|
|
2065
|
+
readonly object: "organization_access";
|
|
2066
|
+
readonly organization: {
|
|
2067
|
+
readonly id: string;
|
|
2068
|
+
readonly name: string;
|
|
2069
|
+
};
|
|
2070
|
+
readonly plan: "free" | "solo" | "pro" | "team" | "scale";
|
|
2071
|
+
/** Mailboxes can be created now, by the same rule mailbox creation applies. */
|
|
2072
|
+
readonly has_access: boolean;
|
|
2073
|
+
readonly trial: {
|
|
2074
|
+
readonly active: boolean;
|
|
2075
|
+
readonly ends_at: string | null;
|
|
2076
|
+
/** No subscription yet and the owner never had a trial. Checkout still confirms it. */
|
|
2077
|
+
readonly eligible: boolean;
|
|
2078
|
+
};
|
|
2079
|
+
readonly mailboxes: {
|
|
2080
|
+
readonly limit: number;
|
|
2081
|
+
readonly used: number;
|
|
2082
|
+
};
|
|
2083
|
+
/** Newsletter sending is available. It is not during a trial. */
|
|
2084
|
+
readonly newsletters_allowed: boolean;
|
|
2085
|
+
};
|
|
2086
|
+
|
|
2087
|
+
declare class Organization extends ApiResource {
|
|
2088
|
+
/**
|
|
2089
|
+
* Whether the credential's organization can create mailboxes now, with its plan, trial and
|
|
2090
|
+
* mailbox capacity. Poll it after the owner pays: access appears once Shipmail has recorded the
|
|
2091
|
+
* payment.
|
|
2092
|
+
*/
|
|
2093
|
+
access(options?: MethodOptions): Promise<OrganizationAccess>;
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2054
2096
|
type ReplyScanStatus = "completed";
|
|
2055
2097
|
type ReplyScan = {
|
|
2056
2098
|
readonly object: "reply_scan";
|
|
@@ -2285,6 +2327,7 @@ declare class ShipmailClient {
|
|
|
2285
2327
|
readonly members: Members;
|
|
2286
2328
|
readonly messages: Messages;
|
|
2287
2329
|
readonly newsletters: Newsletters;
|
|
2330
|
+
readonly organization: Organization;
|
|
2288
2331
|
readonly replyScans: ReplyScans;
|
|
2289
2332
|
readonly scheduledMessages: ScheduledMessages;
|
|
2290
2333
|
readonly suppressions: Suppressions;
|
|
@@ -2302,23 +2345,39 @@ declare class ShipmailClient {
|
|
|
2302
2345
|
private buildUrl;
|
|
2303
2346
|
}
|
|
2304
2347
|
|
|
2348
|
+
/** The `reason` values this SDK knows. A newer server may send others; they pass through. */
|
|
2349
|
+
declare const ERROR_RECOVERY_REASONS: readonly ["owner_confirmation_required", "subscription_required", "trial_capacity", "purchased_capacity"];
|
|
2350
|
+
/** What an organization owner can do in Shipmail to lift a refusal. */
|
|
2351
|
+
type ErrorRecovery = {
|
|
2352
|
+
readonly reason?: string | undefined;
|
|
2353
|
+
readonly actionUrl?: string | undefined;
|
|
2354
|
+
};
|
|
2305
2355
|
declare class ShipmailError extends Error {
|
|
2306
2356
|
readonly status: number | undefined;
|
|
2307
2357
|
readonly type: ErrorType | undefined;
|
|
2308
2358
|
readonly requestId: string | undefined;
|
|
2309
2359
|
readonly retryable: boolean;
|
|
2360
|
+
/**
|
|
2361
|
+
* Why an organization owner must act, when they can lift this refusal in Shipmail. The error's
|
|
2362
|
+
* type and status stay what they were. See ERROR_RECOVERY_REASONS.
|
|
2363
|
+
*/
|
|
2364
|
+
readonly reason: string | undefined;
|
|
2365
|
+
/** The Shipmail page to send the owner to. Retry with a new idempotency key afterwards. */
|
|
2366
|
+
readonly actionUrl: string | undefined;
|
|
2310
2367
|
constructor(message: string, options?: {
|
|
2311
2368
|
readonly status?: number | undefined;
|
|
2312
2369
|
readonly type?: ErrorType | undefined;
|
|
2313
2370
|
readonly requestId?: string | undefined;
|
|
2314
2371
|
readonly retryable?: boolean | undefined;
|
|
2372
|
+
readonly reason?: string | undefined;
|
|
2373
|
+
readonly actionUrl?: string | undefined;
|
|
2315
2374
|
});
|
|
2316
2375
|
}
|
|
2317
2376
|
declare class AuthenticationError extends ShipmailError {
|
|
2318
2377
|
constructor(message: string, requestId?: string);
|
|
2319
2378
|
}
|
|
2320
2379
|
declare class AuthorizationError extends ShipmailError {
|
|
2321
|
-
constructor(message: string, requestId?: string);
|
|
2380
|
+
constructor(message: string, requestId?: string, recovery?: ErrorRecovery);
|
|
2322
2381
|
}
|
|
2323
2382
|
declare class ValidationError extends ShipmailError {
|
|
2324
2383
|
readonly details: readonly {
|
|
@@ -2333,10 +2392,12 @@ declare class ValidationError extends ShipmailError {
|
|
|
2333
2392
|
readonly message: string;
|
|
2334
2393
|
readonly code?: string | undefined;
|
|
2335
2394
|
}[] | undefined;
|
|
2395
|
+
readonly reason?: string | undefined;
|
|
2396
|
+
readonly actionUrl?: string | undefined;
|
|
2336
2397
|
});
|
|
2337
2398
|
}
|
|
2338
2399
|
declare class QuotaExceededError extends ShipmailError {
|
|
2339
|
-
constructor(message: string, requestId?: string);
|
|
2400
|
+
constructor(message: string, requestId?: string, recovery?: ErrorRecovery);
|
|
2340
2401
|
}
|
|
2341
2402
|
declare class NotFoundError extends ShipmailError {
|
|
2342
2403
|
constructor(message: string, requestId?: string);
|
|
@@ -2386,4 +2447,4 @@ declare function verifyWebhook(body: string, headers: WebhookHeaders | Headers,
|
|
|
2386
2447
|
readonly toleranceInSeconds?: number | undefined;
|
|
2387
2448
|
}): Promise<WebhookEvent>;
|
|
2388
2449
|
|
|
2389
|
-
export { type AddSubscriberParams, type AddSubscribersBatchParams, type AddSubscribersBatchResult, type ApiErrorBody, type Audience, type AudienceFeed, AuthenticationError, AuthorizationError, type Automation, type AutomationAction, type AutomationCondition, type AutomationDefinition, type AutomationRun, type AutomationRunStatus, type AutomationRunSummary, type AutomationStatus, type AutomationTrigger, type BookingPage, CONFERENCING_PROVIDER_IDS, type CalendarAvailability, type CalendarAvailabilityParams, type CalendarAvailabilitySlot, type CalendarEvent, type CalendarEventMutationResult, type CalendarEventPrivacy, type CalendarEventStatus, type CalendarFreeBusyStatus, type CalendarInvitationLanguage, type CalendarInvitationOutcome, type CapabilitiesResponse, type CapabilityResourceConstraints, type ConferencingProviderId, ConflictError, ConnectionError, type CreateAudienceParams, type CreateAutomationParams, type CreateBookingPageParams, type CreateCalendarEventParams, type CreateDomainParams, type CreateInboxDraftParams, type CreateInboxReplyDraftParams, type CreateMailboxAppPasswordParams, type CreateMailboxFolderParams, type CreateMailboxParams, type CreateNewsletterFromChangelogParams, type CreateNewsletterParams, type CreateReplyScanParams, type CreateWebhookParams, type CreatedMailboxAppPassword, DOMAIN_STATUSES, type DataMode, type DeleteCalendarEventParams, type Domain, type DomainDnsRecord, type DomainDnsRecordKey, type DomainDnsRecordSet, type DomainDnsRecordStatus, type DomainRegistrationInfo, type DomainSearchResult, type DomainStatus, type DomainVerificationResult, type DownloadInboxAttachmentParams, type EmailAuthVerdict, type EmailAuthenticationResults, type EmailRecipient, type EmailRecipientInput, type ErrorType, type GetCalendarEventParams, type GetThreadParams, type InboxAttachment, type InboxBodyPart, type InboxBodyValue, type InboxDraft, type InboxDraftRecipient, type InboxEmailHeader, type InboxFullMessage, type InboxKeyword, type InboxMessage, type InboxMessageAction, type InboxMessages, type InboxReplyDraft, type InboxReplyDraftSend, type InboxThread, type InboxThreadAttentionResult, type InboxThreadAttentionState, type InboxThreadSummary, type InboxThreads, type InjectSandboxInboundParams, InternalServerError, type ListAudiencesParams, type ListAutomationsResponse, type ListBookingPagesParams, type ListCalendarEventsParams, type ListDeliveriesParams, type ListDomainsParams, type ListInboxMessagesParams, type ListInboxThreadsParams, type ListMailboxesParams, type ListMembersParams, type ListMessageAnalyticsParams, type ListMessagesParams, type ListNewsletterAssetsParams, type ListNewsletterDomainsParams, type ListNewsletterSenderIdentitiesParams, type ListNewslettersParams, type ListReplyScanResultsParams, type ListScheduledMessagesParams, type ListSubscribersParams, type ListSuppressionsParams, type ListThreadsParams, type ListWebhooksParams, MESSAGE_SOURCES, MESSAGE_STATUSES, type Mailbox, type MailboxAppPassword, type MailboxAppPasswordList, type MailboxAppPasswordPurpose, type MailboxAppPasswordState, type MailboxDeliveryDestination, type MailboxDeliveryRouting, type MailboxExport, type MailboxExportErrorCode, type MailboxExportStatus, type MailboxFolder, type MailboxFolders, type MailboxIdentities, type MailboxIdentity, type MailboxRule, type MailboxRuleAction, type MailboxRuleCondition, type MailboxRuleFolder, type MailboxRuleMatchMode, type MailboxRuleMoveTarget, type MailboxRules, type Member, type MemberMailboxAccess, type MemberMailboxAccessScope, type MemberRole, type MergeFields, type Message, type MessageAnalytics, type MessageAnalyticsPage, type MessageMetadata, type MessageRuleDisposition, type MessageSource, type MessageStatus, type MethodOptions, type MoveInboxMessageParams, type Newsletter, type NewsletterArchiveVisibility, type NewsletterAsset, type NewsletterAssetContentType, type NewsletterAssetKind, type NewsletterAssetListResponse, type NewsletterAssetStorageUsage, type NewsletterAssetUpload, type NewsletterBlock, type NewsletterButtonAlign, type NewsletterCalloutVariant, type NewsletterChangelogEntry, type NewsletterChangelogMedia, type NewsletterChangelogTone, type NewsletterColumnContent, type NewsletterColumnImageFit, type NewsletterColumnRatio, type NewsletterCountedUrl, type NewsletterDomain, type NewsletterDomainRecordStatus, type NewsletterDomainStatus, type NewsletterPreflight, type NewsletterPreflightItem, type NewsletterPreflightItemStatus, type NewsletterPreflightStatus, type NewsletterPreview, type NewsletterSenderIdentity, type NewsletterStatus, type NewsletterStylingMode, type NewsletterTestSend, type NewsletterTestSendStatus, type NewsletterUrlBreakdown, type NewsletterUrlSource, NotFoundError, type OneTimeSecretMethodOptions, type OutboundHeader, Page, type PaginatedResponse, type PaginationParams, type PrepareNewsletterAssetUploadParams, type PrepareStagedAttachmentUploadParams, QuotaExceededError, RateLimitError, ReconciliationRequiredError, type Recurrence, type RecurrenceFrequency, type RecurrenceNDay, type RegisterDomainParams, type RegisterNewsletterAssetFromUrlParams, type RegistrationContact, type Reminder, type ReplyScan, type ReplyScanCandidate, type ReplyScanResults, type ReplyScanStatus, type ReplyToMessageParams, type ReplyToThreadParams, type RequestOptions, type ResetMailboxPasswordParams, type RotateSecretResponse, type SandboxOutcome, type ScheduleNewsletterParams, type ScheduledMessage, type ScheduledMessageAttachment, type ScheduledMessageList, type ScheduledMessageRecipient, type ScheduledMessageUploadedAttachment, type SearchDomainsParams, type SendMessageParams, type SendNewsletterTestParams, ShipmailClient, type ShipmailConfig, ShipmailError, type StageAttachmentParams, type StagedAttachment, type StagedAttachmentUpload, type StatusResponse, type Subscriber, type SubscriberOutcome, type SubscriberResult, type SubscriberStatus, type Suppression, type TestWebhookResponse, type Thread, type UpdateAudienceFeedParams, type UpdateAudienceParams, type UpdateAutoReplyParams, type UpdateAutomationParams, type UpdateBookingPageParams, type UpdateCalendarEventParams, type UpdateDomainParams, type UpdateInboxMessageParams, type UpdateInboxThreadAttentionParams, type UpdateMailboxDeliveryRoutingParams, type UpdateMailboxFolderParams, type UpdateMailboxParams, type UpdateMailboxRulesParams, type UpdateNewsletterParams, type UpdateScheduledMessageParams, type UpdateSubscriberParams, type UpdateWebhookParams, type UploadNewsletterAssetParams, ValidationError, WEBHOOK_DELIVERY_EVENT_TYPES, WEBHOOK_DELIVERY_STATUSES, WEBHOOK_EVENT_TYPES, type Webhook, type WebhookDelivery, type WebhookDeliveryDetail, type WebhookDeliveryEventType, type WebhookDeliveryStatus, type WebhookEvent, type WebhookEventType, WebhookVerificationError, type WebhookWithSecret, type Weekday, ShipmailClient as default, verifyWebhook };
|
|
2450
|
+
export { type AddSubscriberParams, type AddSubscribersBatchParams, type AddSubscribersBatchResult, type ApiErrorBody, type Audience, type AudienceFeed, AuthenticationError, AuthorizationError, type Automation, type AutomationAction, type AutomationCondition, type AutomationDefinition, type AutomationRun, type AutomationRunStatus, type AutomationRunSummary, type AutomationStatus, type AutomationTrigger, type BookingPage, CONFERENCING_PROVIDER_IDS, type CalendarAvailability, type CalendarAvailabilityParams, type CalendarAvailabilitySlot, type CalendarEvent, type CalendarEventMutationResult, type CalendarEventPrivacy, type CalendarEventStatus, type CalendarFreeBusyStatus, type CalendarInvitationLanguage, type CalendarInvitationOutcome, type CapabilitiesResponse, type CapabilityResourceConstraints, type ConferencingProviderId, ConflictError, ConnectionError, type CreateAudienceParams, type CreateAutomationParams, type CreateBookingPageParams, type CreateCalendarEventParams, type CreateDomainParams, type CreateInboxDraftParams, type CreateInboxReplyDraftParams, type CreateMailboxAppPasswordParams, type CreateMailboxFolderParams, type CreateMailboxForwardingParams, type CreateMailboxParams, type CreateNewsletterFromChangelogParams, type CreateNewsletterParams, type CreateReplyScanParams, type CreateWebhookParams, type CreatedMailboxAppPassword, DOMAIN_STATUSES, type DataMode, type DeleteCalendarEventParams, type Domain, type DomainDnsRecord, type DomainDnsRecordKey, type DomainDnsRecordSet, type DomainDnsRecordStatus, type DomainRegistrationInfo, type DomainSearchResult, type DomainStatus, type DomainVerificationResult, type DownloadInboxAttachmentParams, ERROR_RECOVERY_REASONS, type EmailAuthVerdict, type EmailAuthenticationResults, type EmailRecipient, type EmailRecipientInput, type ErrorRecovery, type ErrorType, type GetCalendarEventParams, type GetThreadParams, type InboxAttachment, type InboxBodyPart, type InboxBodyValue, type InboxDraft, type InboxDraftRecipient, type InboxEmailHeader, type InboxFullMessage, type InboxKeyword, type InboxMessage, type InboxMessageAction, type InboxMessages, type InboxReplyDraft, type InboxReplyDraftSend, type InboxThread, type InboxThreadAttentionResult, type InboxThreadAttentionState, type InboxThreadSummary, type InboxThreads, type InjectSandboxInboundParams, InternalServerError, type ListAudiencesParams, type ListAutomationsResponse, type ListBookingPagesParams, type ListCalendarEventsParams, type ListDeliveriesParams, type ListDomainsParams, type ListInboxMessagesParams, type ListInboxThreadsParams, type ListMailboxesParams, type ListMembersParams, type ListMessageAnalyticsParams, type ListMessagesParams, type ListNewsletterAssetsParams, type ListNewsletterDomainsParams, type ListNewsletterSenderIdentitiesParams, type ListNewslettersParams, type ListReplyScanResultsParams, type ListScheduledMessagesParams, type ListSubscribersParams, type ListSuppressionsParams, type ListThreadsParams, type ListWebhooksParams, MESSAGE_SOURCES, MESSAGE_STATUSES, type Mailbox, type MailboxAppPassword, type MailboxAppPasswordList, type MailboxAppPasswordPurpose, type MailboxAppPasswordState, type MailboxDeliveryDestination, type MailboxDeliveryRouting, type MailboxExport, type MailboxExportErrorCode, type MailboxExportStatus, type MailboxFolder, type MailboxFolders, type MailboxForwarding, type MailboxForwardingList, type MailboxIdentities, type MailboxIdentity, type MailboxRule, type MailboxRuleAction, type MailboxRuleCondition, type MailboxRuleFolder, type MailboxRuleMatchMode, type MailboxRuleMoveTarget, type MailboxRules, type Member, type MemberMailboxAccess, type MemberMailboxAccessScope, type MemberRole, type MergeFields, type Message, type MessageAnalytics, type MessageAnalyticsPage, type MessageMetadata, type MessageRuleDisposition, type MessageSource, type MessageStatus, type MethodOptions, type MoveInboxMessageParams, type Newsletter, type NewsletterArchiveVisibility, type NewsletterAsset, type NewsletterAssetContentType, type NewsletterAssetKind, type NewsletterAssetListResponse, type NewsletterAssetStorageUsage, type NewsletterAssetUpload, type NewsletterBlock, type NewsletterButtonAlign, type NewsletterCalloutVariant, type NewsletterChangelogEntry, type NewsletterChangelogMedia, type NewsletterChangelogTone, type NewsletterColumnContent, type NewsletterColumnImageFit, type NewsletterColumnRatio, type NewsletterCountedUrl, type NewsletterDomain, type NewsletterDomainRecordStatus, type NewsletterDomainStatus, type NewsletterPreflight, type NewsletterPreflightItem, type NewsletterPreflightItemStatus, type NewsletterPreflightStatus, type NewsletterPreview, type NewsletterSenderIdentity, type NewsletterStatus, type NewsletterStylingMode, type NewsletterTestSend, type NewsletterTestSendStatus, type NewsletterUrlBreakdown, type NewsletterUrlSource, NotFoundError, type OneTimeSecretMethodOptions, type OrganizationAccess, type OutboundHeader, Page, type PaginatedResponse, type PaginationParams, type PrepareNewsletterAssetUploadParams, type PrepareStagedAttachmentUploadParams, QuotaExceededError, RateLimitError, ReconciliationRequiredError, type Recurrence, type RecurrenceFrequency, type RecurrenceNDay, type RegisterDomainParams, type RegisterNewsletterAssetFromUrlParams, type RegistrationContact, type Reminder, type ReplyScan, type ReplyScanCandidate, type ReplyScanResults, type ReplyScanStatus, type ReplyToMessageParams, type ReplyToThreadParams, type RequestOptions, type ResetMailboxPasswordParams, type RotateSecretResponse, type SandboxOutcome, type ScheduleNewsletterParams, type ScheduledMessage, type ScheduledMessageAttachment, type ScheduledMessageList, type ScheduledMessageRecipient, type ScheduledMessageUploadedAttachment, type SearchDomainsParams, type SendMessageParams, type SendNewsletterTestParams, ShipmailClient, type ShipmailConfig, ShipmailError, type StageAttachmentParams, type StagedAttachment, type StagedAttachmentUpload, type StatusResponse, type Subscriber, type SubscriberOutcome, type SubscriberResult, type SubscriberStatus, type Suppression, type TestWebhookResponse, type Thread, type UpdateAudienceFeedParams, type UpdateAudienceParams, type UpdateAutoReplyParams, type UpdateAutomationParams, type UpdateBookingPageParams, type UpdateCalendarEventParams, type UpdateDomainParams, type UpdateInboxMessageParams, type UpdateInboxThreadAttentionParams, type UpdateMailboxDeliveryRoutingParams, type UpdateMailboxFolderParams, type UpdateMailboxParams, type UpdateMailboxRulesParams, type UpdateNewsletterParams, type UpdateScheduledMessageParams, type UpdateSubscriberParams, type UpdateWebhookParams, type UploadNewsletterAssetParams, ValidationError, WEBHOOK_DELIVERY_EVENT_TYPES, WEBHOOK_DELIVERY_STATUSES, WEBHOOK_EVENT_TYPES, type Webhook, type WebhookDelivery, type WebhookDeliveryDetail, type WebhookDeliveryEventType, type WebhookDeliveryStatus, type WebhookEvent, type WebhookEventType, WebhookVerificationError, type WebhookWithSecret, type Weekday, ShipmailClient as default, verifyWebhook };
|
package/dist/index.d.ts
CHANGED
|
@@ -52,6 +52,14 @@ type ApiErrorBody = {
|
|
|
52
52
|
* the interrupted send attempt left behind.
|
|
53
53
|
*/
|
|
54
54
|
readonly message_id?: string | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Present only on a refusal an organization owner can lift in Shipmail. One of
|
|
57
|
+
* `owner_confirmation_required`, `subscription_required`, `trial_capacity` or
|
|
58
|
+
* `purchased_capacity`; later servers may add values.
|
|
59
|
+
*/
|
|
60
|
+
readonly reason?: string | undefined;
|
|
61
|
+
/** Present with `reason`: the Shipmail page where the owner reviews and confirms. */
|
|
62
|
+
readonly action_url?: string | undefined;
|
|
55
63
|
};
|
|
56
64
|
};
|
|
57
65
|
type EmailRecipient = {
|
|
@@ -1406,6 +1414,7 @@ type MailboxForwarding = {
|
|
|
1406
1414
|
readonly mailbox_id: string;
|
|
1407
1415
|
readonly destination: string;
|
|
1408
1416
|
readonly sender: string | null;
|
|
1417
|
+
readonly recipient: string | null;
|
|
1409
1418
|
readonly status: "pending" | "active";
|
|
1410
1419
|
readonly verification_sent_at: string | null;
|
|
1411
1420
|
readonly verified_at: string | null;
|
|
@@ -1420,6 +1429,7 @@ type MailboxForwardingList = {
|
|
|
1420
1429
|
type CreateMailboxForwardingParams = {
|
|
1421
1430
|
readonly destination: string;
|
|
1422
1431
|
readonly sender?: string | null | undefined;
|
|
1432
|
+
readonly recipient?: string | null | undefined;
|
|
1423
1433
|
};
|
|
1424
1434
|
type CreateMailboxBaseParams = {
|
|
1425
1435
|
readonly domain_id: string;
|
|
@@ -2051,6 +2061,38 @@ declare class Newsletters extends ApiResource {
|
|
|
2051
2061
|
resume(id: string, options?: MethodOptions): Promise<Newsletter>;
|
|
2052
2062
|
}
|
|
2053
2063
|
|
|
2064
|
+
type OrganizationAccess = {
|
|
2065
|
+
readonly object: "organization_access";
|
|
2066
|
+
readonly organization: {
|
|
2067
|
+
readonly id: string;
|
|
2068
|
+
readonly name: string;
|
|
2069
|
+
};
|
|
2070
|
+
readonly plan: "free" | "solo" | "pro" | "team" | "scale";
|
|
2071
|
+
/** Mailboxes can be created now, by the same rule mailbox creation applies. */
|
|
2072
|
+
readonly has_access: boolean;
|
|
2073
|
+
readonly trial: {
|
|
2074
|
+
readonly active: boolean;
|
|
2075
|
+
readonly ends_at: string | null;
|
|
2076
|
+
/** No subscription yet and the owner never had a trial. Checkout still confirms it. */
|
|
2077
|
+
readonly eligible: boolean;
|
|
2078
|
+
};
|
|
2079
|
+
readonly mailboxes: {
|
|
2080
|
+
readonly limit: number;
|
|
2081
|
+
readonly used: number;
|
|
2082
|
+
};
|
|
2083
|
+
/** Newsletter sending is available. It is not during a trial. */
|
|
2084
|
+
readonly newsletters_allowed: boolean;
|
|
2085
|
+
};
|
|
2086
|
+
|
|
2087
|
+
declare class Organization extends ApiResource {
|
|
2088
|
+
/**
|
|
2089
|
+
* Whether the credential's organization can create mailboxes now, with its plan, trial and
|
|
2090
|
+
* mailbox capacity. Poll it after the owner pays: access appears once Shipmail has recorded the
|
|
2091
|
+
* payment.
|
|
2092
|
+
*/
|
|
2093
|
+
access(options?: MethodOptions): Promise<OrganizationAccess>;
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2054
2096
|
type ReplyScanStatus = "completed";
|
|
2055
2097
|
type ReplyScan = {
|
|
2056
2098
|
readonly object: "reply_scan";
|
|
@@ -2285,6 +2327,7 @@ declare class ShipmailClient {
|
|
|
2285
2327
|
readonly members: Members;
|
|
2286
2328
|
readonly messages: Messages;
|
|
2287
2329
|
readonly newsletters: Newsletters;
|
|
2330
|
+
readonly organization: Organization;
|
|
2288
2331
|
readonly replyScans: ReplyScans;
|
|
2289
2332
|
readonly scheduledMessages: ScheduledMessages;
|
|
2290
2333
|
readonly suppressions: Suppressions;
|
|
@@ -2302,23 +2345,39 @@ declare class ShipmailClient {
|
|
|
2302
2345
|
private buildUrl;
|
|
2303
2346
|
}
|
|
2304
2347
|
|
|
2348
|
+
/** The `reason` values this SDK knows. A newer server may send others; they pass through. */
|
|
2349
|
+
declare const ERROR_RECOVERY_REASONS: readonly ["owner_confirmation_required", "subscription_required", "trial_capacity", "purchased_capacity"];
|
|
2350
|
+
/** What an organization owner can do in Shipmail to lift a refusal. */
|
|
2351
|
+
type ErrorRecovery = {
|
|
2352
|
+
readonly reason?: string | undefined;
|
|
2353
|
+
readonly actionUrl?: string | undefined;
|
|
2354
|
+
};
|
|
2305
2355
|
declare class ShipmailError extends Error {
|
|
2306
2356
|
readonly status: number | undefined;
|
|
2307
2357
|
readonly type: ErrorType | undefined;
|
|
2308
2358
|
readonly requestId: string | undefined;
|
|
2309
2359
|
readonly retryable: boolean;
|
|
2360
|
+
/**
|
|
2361
|
+
* Why an organization owner must act, when they can lift this refusal in Shipmail. The error's
|
|
2362
|
+
* type and status stay what they were. See ERROR_RECOVERY_REASONS.
|
|
2363
|
+
*/
|
|
2364
|
+
readonly reason: string | undefined;
|
|
2365
|
+
/** The Shipmail page to send the owner to. Retry with a new idempotency key afterwards. */
|
|
2366
|
+
readonly actionUrl: string | undefined;
|
|
2310
2367
|
constructor(message: string, options?: {
|
|
2311
2368
|
readonly status?: number | undefined;
|
|
2312
2369
|
readonly type?: ErrorType | undefined;
|
|
2313
2370
|
readonly requestId?: string | undefined;
|
|
2314
2371
|
readonly retryable?: boolean | undefined;
|
|
2372
|
+
readonly reason?: string | undefined;
|
|
2373
|
+
readonly actionUrl?: string | undefined;
|
|
2315
2374
|
});
|
|
2316
2375
|
}
|
|
2317
2376
|
declare class AuthenticationError extends ShipmailError {
|
|
2318
2377
|
constructor(message: string, requestId?: string);
|
|
2319
2378
|
}
|
|
2320
2379
|
declare class AuthorizationError extends ShipmailError {
|
|
2321
|
-
constructor(message: string, requestId?: string);
|
|
2380
|
+
constructor(message: string, requestId?: string, recovery?: ErrorRecovery);
|
|
2322
2381
|
}
|
|
2323
2382
|
declare class ValidationError extends ShipmailError {
|
|
2324
2383
|
readonly details: readonly {
|
|
@@ -2333,10 +2392,12 @@ declare class ValidationError extends ShipmailError {
|
|
|
2333
2392
|
readonly message: string;
|
|
2334
2393
|
readonly code?: string | undefined;
|
|
2335
2394
|
}[] | undefined;
|
|
2395
|
+
readonly reason?: string | undefined;
|
|
2396
|
+
readonly actionUrl?: string | undefined;
|
|
2336
2397
|
});
|
|
2337
2398
|
}
|
|
2338
2399
|
declare class QuotaExceededError extends ShipmailError {
|
|
2339
|
-
constructor(message: string, requestId?: string);
|
|
2400
|
+
constructor(message: string, requestId?: string, recovery?: ErrorRecovery);
|
|
2340
2401
|
}
|
|
2341
2402
|
declare class NotFoundError extends ShipmailError {
|
|
2342
2403
|
constructor(message: string, requestId?: string);
|
|
@@ -2386,4 +2447,4 @@ declare function verifyWebhook(body: string, headers: WebhookHeaders | Headers,
|
|
|
2386
2447
|
readonly toleranceInSeconds?: number | undefined;
|
|
2387
2448
|
}): Promise<WebhookEvent>;
|
|
2388
2449
|
|
|
2389
|
-
export { type AddSubscriberParams, type AddSubscribersBatchParams, type AddSubscribersBatchResult, type ApiErrorBody, type Audience, type AudienceFeed, AuthenticationError, AuthorizationError, type Automation, type AutomationAction, type AutomationCondition, type AutomationDefinition, type AutomationRun, type AutomationRunStatus, type AutomationRunSummary, type AutomationStatus, type AutomationTrigger, type BookingPage, CONFERENCING_PROVIDER_IDS, type CalendarAvailability, type CalendarAvailabilityParams, type CalendarAvailabilitySlot, type CalendarEvent, type CalendarEventMutationResult, type CalendarEventPrivacy, type CalendarEventStatus, type CalendarFreeBusyStatus, type CalendarInvitationLanguage, type CalendarInvitationOutcome, type CapabilitiesResponse, type CapabilityResourceConstraints, type ConferencingProviderId, ConflictError, ConnectionError, type CreateAudienceParams, type CreateAutomationParams, type CreateBookingPageParams, type CreateCalendarEventParams, type CreateDomainParams, type CreateInboxDraftParams, type CreateInboxReplyDraftParams, type CreateMailboxAppPasswordParams, type CreateMailboxFolderParams, type CreateMailboxParams, type CreateNewsletterFromChangelogParams, type CreateNewsletterParams, type CreateReplyScanParams, type CreateWebhookParams, type CreatedMailboxAppPassword, DOMAIN_STATUSES, type DataMode, type DeleteCalendarEventParams, type Domain, type DomainDnsRecord, type DomainDnsRecordKey, type DomainDnsRecordSet, type DomainDnsRecordStatus, type DomainRegistrationInfo, type DomainSearchResult, type DomainStatus, type DomainVerificationResult, type DownloadInboxAttachmentParams, type EmailAuthVerdict, type EmailAuthenticationResults, type EmailRecipient, type EmailRecipientInput, type ErrorType, type GetCalendarEventParams, type GetThreadParams, type InboxAttachment, type InboxBodyPart, type InboxBodyValue, type InboxDraft, type InboxDraftRecipient, type InboxEmailHeader, type InboxFullMessage, type InboxKeyword, type InboxMessage, type InboxMessageAction, type InboxMessages, type InboxReplyDraft, type InboxReplyDraftSend, type InboxThread, type InboxThreadAttentionResult, type InboxThreadAttentionState, type InboxThreadSummary, type InboxThreads, type InjectSandboxInboundParams, InternalServerError, type ListAudiencesParams, type ListAutomationsResponse, type ListBookingPagesParams, type ListCalendarEventsParams, type ListDeliveriesParams, type ListDomainsParams, type ListInboxMessagesParams, type ListInboxThreadsParams, type ListMailboxesParams, type ListMembersParams, type ListMessageAnalyticsParams, type ListMessagesParams, type ListNewsletterAssetsParams, type ListNewsletterDomainsParams, type ListNewsletterSenderIdentitiesParams, type ListNewslettersParams, type ListReplyScanResultsParams, type ListScheduledMessagesParams, type ListSubscribersParams, type ListSuppressionsParams, type ListThreadsParams, type ListWebhooksParams, MESSAGE_SOURCES, MESSAGE_STATUSES, type Mailbox, type MailboxAppPassword, type MailboxAppPasswordList, type MailboxAppPasswordPurpose, type MailboxAppPasswordState, type MailboxDeliveryDestination, type MailboxDeliveryRouting, type MailboxExport, type MailboxExportErrorCode, type MailboxExportStatus, type MailboxFolder, type MailboxFolders, type MailboxIdentities, type MailboxIdentity, type MailboxRule, type MailboxRuleAction, type MailboxRuleCondition, type MailboxRuleFolder, type MailboxRuleMatchMode, type MailboxRuleMoveTarget, type MailboxRules, type Member, type MemberMailboxAccess, type MemberMailboxAccessScope, type MemberRole, type MergeFields, type Message, type MessageAnalytics, type MessageAnalyticsPage, type MessageMetadata, type MessageRuleDisposition, type MessageSource, type MessageStatus, type MethodOptions, type MoveInboxMessageParams, type Newsletter, type NewsletterArchiveVisibility, type NewsletterAsset, type NewsletterAssetContentType, type NewsletterAssetKind, type NewsletterAssetListResponse, type NewsletterAssetStorageUsage, type NewsletterAssetUpload, type NewsletterBlock, type NewsletterButtonAlign, type NewsletterCalloutVariant, type NewsletterChangelogEntry, type NewsletterChangelogMedia, type NewsletterChangelogTone, type NewsletterColumnContent, type NewsletterColumnImageFit, type NewsletterColumnRatio, type NewsletterCountedUrl, type NewsletterDomain, type NewsletterDomainRecordStatus, type NewsletterDomainStatus, type NewsletterPreflight, type NewsletterPreflightItem, type NewsletterPreflightItemStatus, type NewsletterPreflightStatus, type NewsletterPreview, type NewsletterSenderIdentity, type NewsletterStatus, type NewsletterStylingMode, type NewsletterTestSend, type NewsletterTestSendStatus, type NewsletterUrlBreakdown, type NewsletterUrlSource, NotFoundError, type OneTimeSecretMethodOptions, type OutboundHeader, Page, type PaginatedResponse, type PaginationParams, type PrepareNewsletterAssetUploadParams, type PrepareStagedAttachmentUploadParams, QuotaExceededError, RateLimitError, ReconciliationRequiredError, type Recurrence, type RecurrenceFrequency, type RecurrenceNDay, type RegisterDomainParams, type RegisterNewsletterAssetFromUrlParams, type RegistrationContact, type Reminder, type ReplyScan, type ReplyScanCandidate, type ReplyScanResults, type ReplyScanStatus, type ReplyToMessageParams, type ReplyToThreadParams, type RequestOptions, type ResetMailboxPasswordParams, type RotateSecretResponse, type SandboxOutcome, type ScheduleNewsletterParams, type ScheduledMessage, type ScheduledMessageAttachment, type ScheduledMessageList, type ScheduledMessageRecipient, type ScheduledMessageUploadedAttachment, type SearchDomainsParams, type SendMessageParams, type SendNewsletterTestParams, ShipmailClient, type ShipmailConfig, ShipmailError, type StageAttachmentParams, type StagedAttachment, type StagedAttachmentUpload, type StatusResponse, type Subscriber, type SubscriberOutcome, type SubscriberResult, type SubscriberStatus, type Suppression, type TestWebhookResponse, type Thread, type UpdateAudienceFeedParams, type UpdateAudienceParams, type UpdateAutoReplyParams, type UpdateAutomationParams, type UpdateBookingPageParams, type UpdateCalendarEventParams, type UpdateDomainParams, type UpdateInboxMessageParams, type UpdateInboxThreadAttentionParams, type UpdateMailboxDeliveryRoutingParams, type UpdateMailboxFolderParams, type UpdateMailboxParams, type UpdateMailboxRulesParams, type UpdateNewsletterParams, type UpdateScheduledMessageParams, type UpdateSubscriberParams, type UpdateWebhookParams, type UploadNewsletterAssetParams, ValidationError, WEBHOOK_DELIVERY_EVENT_TYPES, WEBHOOK_DELIVERY_STATUSES, WEBHOOK_EVENT_TYPES, type Webhook, type WebhookDelivery, type WebhookDeliveryDetail, type WebhookDeliveryEventType, type WebhookDeliveryStatus, type WebhookEvent, type WebhookEventType, WebhookVerificationError, type WebhookWithSecret, type Weekday, ShipmailClient as default, verifyWebhook };
|
|
2450
|
+
export { type AddSubscriberParams, type AddSubscribersBatchParams, type AddSubscribersBatchResult, type ApiErrorBody, type Audience, type AudienceFeed, AuthenticationError, AuthorizationError, type Automation, type AutomationAction, type AutomationCondition, type AutomationDefinition, type AutomationRun, type AutomationRunStatus, type AutomationRunSummary, type AutomationStatus, type AutomationTrigger, type BookingPage, CONFERENCING_PROVIDER_IDS, type CalendarAvailability, type CalendarAvailabilityParams, type CalendarAvailabilitySlot, type CalendarEvent, type CalendarEventMutationResult, type CalendarEventPrivacy, type CalendarEventStatus, type CalendarFreeBusyStatus, type CalendarInvitationLanguage, type CalendarInvitationOutcome, type CapabilitiesResponse, type CapabilityResourceConstraints, type ConferencingProviderId, ConflictError, ConnectionError, type CreateAudienceParams, type CreateAutomationParams, type CreateBookingPageParams, type CreateCalendarEventParams, type CreateDomainParams, type CreateInboxDraftParams, type CreateInboxReplyDraftParams, type CreateMailboxAppPasswordParams, type CreateMailboxFolderParams, type CreateMailboxForwardingParams, type CreateMailboxParams, type CreateNewsletterFromChangelogParams, type CreateNewsletterParams, type CreateReplyScanParams, type CreateWebhookParams, type CreatedMailboxAppPassword, DOMAIN_STATUSES, type DataMode, type DeleteCalendarEventParams, type Domain, type DomainDnsRecord, type DomainDnsRecordKey, type DomainDnsRecordSet, type DomainDnsRecordStatus, type DomainRegistrationInfo, type DomainSearchResult, type DomainStatus, type DomainVerificationResult, type DownloadInboxAttachmentParams, ERROR_RECOVERY_REASONS, type EmailAuthVerdict, type EmailAuthenticationResults, type EmailRecipient, type EmailRecipientInput, type ErrorRecovery, type ErrorType, type GetCalendarEventParams, type GetThreadParams, type InboxAttachment, type InboxBodyPart, type InboxBodyValue, type InboxDraft, type InboxDraftRecipient, type InboxEmailHeader, type InboxFullMessage, type InboxKeyword, type InboxMessage, type InboxMessageAction, type InboxMessages, type InboxReplyDraft, type InboxReplyDraftSend, type InboxThread, type InboxThreadAttentionResult, type InboxThreadAttentionState, type InboxThreadSummary, type InboxThreads, type InjectSandboxInboundParams, InternalServerError, type ListAudiencesParams, type ListAutomationsResponse, type ListBookingPagesParams, type ListCalendarEventsParams, type ListDeliveriesParams, type ListDomainsParams, type ListInboxMessagesParams, type ListInboxThreadsParams, type ListMailboxesParams, type ListMembersParams, type ListMessageAnalyticsParams, type ListMessagesParams, type ListNewsletterAssetsParams, type ListNewsletterDomainsParams, type ListNewsletterSenderIdentitiesParams, type ListNewslettersParams, type ListReplyScanResultsParams, type ListScheduledMessagesParams, type ListSubscribersParams, type ListSuppressionsParams, type ListThreadsParams, type ListWebhooksParams, MESSAGE_SOURCES, MESSAGE_STATUSES, type Mailbox, type MailboxAppPassword, type MailboxAppPasswordList, type MailboxAppPasswordPurpose, type MailboxAppPasswordState, type MailboxDeliveryDestination, type MailboxDeliveryRouting, type MailboxExport, type MailboxExportErrorCode, type MailboxExportStatus, type MailboxFolder, type MailboxFolders, type MailboxForwarding, type MailboxForwardingList, type MailboxIdentities, type MailboxIdentity, type MailboxRule, type MailboxRuleAction, type MailboxRuleCondition, type MailboxRuleFolder, type MailboxRuleMatchMode, type MailboxRuleMoveTarget, type MailboxRules, type Member, type MemberMailboxAccess, type MemberMailboxAccessScope, type MemberRole, type MergeFields, type Message, type MessageAnalytics, type MessageAnalyticsPage, type MessageMetadata, type MessageRuleDisposition, type MessageSource, type MessageStatus, type MethodOptions, type MoveInboxMessageParams, type Newsletter, type NewsletterArchiveVisibility, type NewsletterAsset, type NewsletterAssetContentType, type NewsletterAssetKind, type NewsletterAssetListResponse, type NewsletterAssetStorageUsage, type NewsletterAssetUpload, type NewsletterBlock, type NewsletterButtonAlign, type NewsletterCalloutVariant, type NewsletterChangelogEntry, type NewsletterChangelogMedia, type NewsletterChangelogTone, type NewsletterColumnContent, type NewsletterColumnImageFit, type NewsletterColumnRatio, type NewsletterCountedUrl, type NewsletterDomain, type NewsletterDomainRecordStatus, type NewsletterDomainStatus, type NewsletterPreflight, type NewsletterPreflightItem, type NewsletterPreflightItemStatus, type NewsletterPreflightStatus, type NewsletterPreview, type NewsletterSenderIdentity, type NewsletterStatus, type NewsletterStylingMode, type NewsletterTestSend, type NewsletterTestSendStatus, type NewsletterUrlBreakdown, type NewsletterUrlSource, NotFoundError, type OneTimeSecretMethodOptions, type OrganizationAccess, type OutboundHeader, Page, type PaginatedResponse, type PaginationParams, type PrepareNewsletterAssetUploadParams, type PrepareStagedAttachmentUploadParams, QuotaExceededError, RateLimitError, ReconciliationRequiredError, type Recurrence, type RecurrenceFrequency, type RecurrenceNDay, type RegisterDomainParams, type RegisterNewsletterAssetFromUrlParams, type RegistrationContact, type Reminder, type ReplyScan, type ReplyScanCandidate, type ReplyScanResults, type ReplyScanStatus, type ReplyToMessageParams, type ReplyToThreadParams, type RequestOptions, type ResetMailboxPasswordParams, type RotateSecretResponse, type SandboxOutcome, type ScheduleNewsletterParams, type ScheduledMessage, type ScheduledMessageAttachment, type ScheduledMessageList, type ScheduledMessageRecipient, type ScheduledMessageUploadedAttachment, type SearchDomainsParams, type SendMessageParams, type SendNewsletterTestParams, ShipmailClient, type ShipmailConfig, ShipmailError, type StageAttachmentParams, type StagedAttachment, type StagedAttachmentUpload, type StatusResponse, type Subscriber, type SubscriberOutcome, type SubscriberResult, type SubscriberStatus, type Suppression, type TestWebhookResponse, type Thread, type UpdateAudienceFeedParams, type UpdateAudienceParams, type UpdateAutoReplyParams, type UpdateAutomationParams, type UpdateBookingPageParams, type UpdateCalendarEventParams, type UpdateDomainParams, type UpdateInboxMessageParams, type UpdateInboxThreadAttentionParams, type UpdateMailboxDeliveryRoutingParams, type UpdateMailboxFolderParams, type UpdateMailboxParams, type UpdateMailboxRulesParams, type UpdateNewsletterParams, type UpdateScheduledMessageParams, type UpdateSubscriberParams, type UpdateWebhookParams, type UploadNewsletterAssetParams, ValidationError, WEBHOOK_DELIVERY_EVENT_TYPES, WEBHOOK_DELIVERY_STATUSES, WEBHOOK_EVENT_TYPES, type Webhook, type WebhookDelivery, type WebhookDeliveryDetail, type WebhookDeliveryEventType, type WebhookDeliveryStatus, type WebhookEvent, type WebhookEventType, WebhookVerificationError, type WebhookWithSecret, type Weekday, ShipmailClient as default, verifyWebhook };
|
package/dist/index.js
CHANGED
|
@@ -78,6 +78,12 @@ function apiKeyScopesGrant(grantedScopes, requiredScope) {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
// src/errors.ts
|
|
81
|
+
var ERROR_RECOVERY_REASONS = [
|
|
82
|
+
"owner_confirmation_required",
|
|
83
|
+
"subscription_required",
|
|
84
|
+
"trial_capacity",
|
|
85
|
+
"purchased_capacity"
|
|
86
|
+
];
|
|
81
87
|
var ShipmailError = class extends Error {
|
|
82
88
|
constructor(message, options) {
|
|
83
89
|
super(message);
|
|
@@ -86,6 +92,8 @@ var ShipmailError = class extends Error {
|
|
|
86
92
|
this.type = options?.type;
|
|
87
93
|
this.requestId = options?.requestId;
|
|
88
94
|
this.retryable = options?.retryable ?? false;
|
|
95
|
+
this.reason = options?.reason;
|
|
96
|
+
this.actionUrl = options?.actionUrl;
|
|
89
97
|
}
|
|
90
98
|
};
|
|
91
99
|
var AuthenticationError = class extends ShipmailError {
|
|
@@ -95,8 +103,14 @@ var AuthenticationError = class extends ShipmailError {
|
|
|
95
103
|
}
|
|
96
104
|
};
|
|
97
105
|
var AuthorizationError = class extends ShipmailError {
|
|
98
|
-
constructor(message, requestId) {
|
|
99
|
-
super(message, {
|
|
106
|
+
constructor(message, requestId, recovery) {
|
|
107
|
+
super(message, {
|
|
108
|
+
status: 403,
|
|
109
|
+
type: "authorization_error",
|
|
110
|
+
requestId,
|
|
111
|
+
retryable: false,
|
|
112
|
+
...recovery
|
|
113
|
+
});
|
|
100
114
|
this.name = "AuthorizationError";
|
|
101
115
|
}
|
|
102
116
|
};
|
|
@@ -106,15 +120,23 @@ var ValidationError = class extends ShipmailError {
|
|
|
106
120
|
status: 422,
|
|
107
121
|
type: "validation_error",
|
|
108
122
|
requestId: options?.requestId,
|
|
109
|
-
retryable: false
|
|
123
|
+
retryable: false,
|
|
124
|
+
reason: options?.reason,
|
|
125
|
+
actionUrl: options?.actionUrl
|
|
110
126
|
});
|
|
111
127
|
this.name = "ValidationError";
|
|
112
128
|
this.details = options?.details;
|
|
113
129
|
}
|
|
114
130
|
};
|
|
115
131
|
var QuotaExceededError = class extends ShipmailError {
|
|
116
|
-
constructor(message, requestId) {
|
|
117
|
-
super(message, {
|
|
132
|
+
constructor(message, requestId, recovery) {
|
|
133
|
+
super(message, {
|
|
134
|
+
status: 403,
|
|
135
|
+
type: "quota_exceeded",
|
|
136
|
+
requestId,
|
|
137
|
+
retryable: false,
|
|
138
|
+
...recovery
|
|
139
|
+
});
|
|
118
140
|
this.name = "QuotaExceededError";
|
|
119
141
|
}
|
|
120
142
|
};
|
|
@@ -175,15 +197,23 @@ var WebhookVerificationError = class extends ShipmailError {
|
|
|
175
197
|
function mapErrorFromResponse(status, body, requestId) {
|
|
176
198
|
const error = body.error;
|
|
177
199
|
const rid = error.request_id;
|
|
200
|
+
const recovery = {
|
|
201
|
+
reason: typeof error.reason === "string" ? error.reason : void 0,
|
|
202
|
+
actionUrl: typeof error.action_url === "string" ? error.action_url : void 0
|
|
203
|
+
};
|
|
178
204
|
switch (error.type) {
|
|
179
205
|
case "authentication_error":
|
|
180
206
|
return new AuthenticationError(error.message, rid);
|
|
181
207
|
case "authorization_error":
|
|
182
|
-
return new AuthorizationError(error.message, rid);
|
|
208
|
+
return new AuthorizationError(error.message, rid, recovery);
|
|
183
209
|
case "quota_exceeded":
|
|
184
|
-
return new QuotaExceededError(error.message, rid);
|
|
210
|
+
return new QuotaExceededError(error.message, rid, recovery);
|
|
185
211
|
case "validation_error":
|
|
186
|
-
return new ValidationError(error.message, {
|
|
212
|
+
return new ValidationError(error.message, {
|
|
213
|
+
requestId: rid,
|
|
214
|
+
details: error.details,
|
|
215
|
+
...recovery
|
|
216
|
+
});
|
|
187
217
|
case "not_found":
|
|
188
218
|
return new NotFoundError(error.message, rid);
|
|
189
219
|
case "rate_limit_error":
|
|
@@ -199,7 +229,8 @@ function mapErrorFromResponse(status, body, requestId) {
|
|
|
199
229
|
status,
|
|
200
230
|
type: error.type,
|
|
201
231
|
requestId: rid,
|
|
202
|
-
retryable: status >= 500
|
|
232
|
+
retryable: status >= 500,
|
|
233
|
+
...recovery
|
|
203
234
|
});
|
|
204
235
|
}
|
|
205
236
|
}
|
|
@@ -1366,6 +1397,22 @@ var Newsletters = class extends ApiResource {
|
|
|
1366
1397
|
}
|
|
1367
1398
|
};
|
|
1368
1399
|
|
|
1400
|
+
// src/resources/organization.ts
|
|
1401
|
+
var Organization = class extends ApiResource {
|
|
1402
|
+
/**
|
|
1403
|
+
* Whether the credential's organization can create mailboxes now, with its plan, trial and
|
|
1404
|
+
* mailbox capacity. Poll it after the owner pays: access appears once Shipmail has recorded the
|
|
1405
|
+
* payment.
|
|
1406
|
+
*/
|
|
1407
|
+
access(options) {
|
|
1408
|
+
return this.client.request({
|
|
1409
|
+
method: "GET",
|
|
1410
|
+
path: "/organization/access",
|
|
1411
|
+
methodOptions: options
|
|
1412
|
+
});
|
|
1413
|
+
}
|
|
1414
|
+
};
|
|
1415
|
+
|
|
1369
1416
|
// src/resources/reply-scans.ts
|
|
1370
1417
|
var ReplyScans = class extends ApiResource {
|
|
1371
1418
|
create(params, options) {
|
|
@@ -1614,7 +1661,7 @@ var Webhooks = class extends ApiResource {
|
|
|
1614
1661
|
};
|
|
1615
1662
|
|
|
1616
1663
|
// src/version.ts
|
|
1617
|
-
var VERSION = "0.6.
|
|
1664
|
+
var VERSION = "0.6.3";
|
|
1618
1665
|
|
|
1619
1666
|
// src/client.ts
|
|
1620
1667
|
var DEFAULT_BASE_URL = "https://shipmail.to/api/v1";
|
|
@@ -1687,6 +1734,7 @@ var ShipmailClient = class {
|
|
|
1687
1734
|
this.members = new Members(this);
|
|
1688
1735
|
this.messages = new Messages(this);
|
|
1689
1736
|
this.newsletters = new Newsletters(this);
|
|
1737
|
+
this.organization = new Organization(this);
|
|
1690
1738
|
this.replyScans = new ReplyScans(this);
|
|
1691
1739
|
this.scheduledMessages = new ScheduledMessages(this);
|
|
1692
1740
|
this.suppressions = new Suppressions(this);
|
|
@@ -1897,6 +1945,6 @@ async function verifyWebhook(body, headers, secret, options) {
|
|
|
1897
1945
|
return parsed;
|
|
1898
1946
|
}
|
|
1899
1947
|
|
|
1900
|
-
export { API_KEY_SCOPES, API_KEY_SCOPE_DESCRIPTIONS, AuthenticationError, AuthorizationError, CONFERENCING_PROVIDER_IDS, ConflictError, ConnectionError, DOMAIN_STATUSES, InternalServerError, MESSAGE_SOURCES, MESSAGE_STATUSES, NotFoundError, Page, QuotaExceededError, RateLimitError, ReconciliationRequiredError, ShipmailClient, ShipmailError, ValidationError, WEBHOOK_DELIVERY_EVENT_TYPES, WEBHOOK_DELIVERY_STATUSES, WEBHOOK_EVENT_TYPES, WebhookVerificationError, apiKeyScopesGrant, ShipmailClient as default, isApiKeyScope, verifyWebhook };
|
|
1948
|
+
export { API_KEY_SCOPES, API_KEY_SCOPE_DESCRIPTIONS, AuthenticationError, AuthorizationError, CONFERENCING_PROVIDER_IDS, ConflictError, ConnectionError, DOMAIN_STATUSES, ERROR_RECOVERY_REASONS, InternalServerError, MESSAGE_SOURCES, MESSAGE_STATUSES, NotFoundError, Page, QuotaExceededError, RateLimitError, ReconciliationRequiredError, ShipmailClient, ShipmailError, ValidationError, WEBHOOK_DELIVERY_EVENT_TYPES, WEBHOOK_DELIVERY_STATUSES, WEBHOOK_EVENT_TYPES, WebhookVerificationError, apiKeyScopesGrant, ShipmailClient as default, isApiKeyScope, verifyWebhook };
|
|
1901
1949
|
//# sourceMappingURL=index.js.map
|
|
1902
1950
|
//# sourceMappingURL=index.js.map
|