shipmail 0.4.11 → 0.4.13
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/LICENSE +1 -1
- package/README.md +13 -13
- package/dist/index.cjs +25 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -23
- package/dist/index.d.ts +23 -23
- package/dist/index.js +23 -23
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -4,16 +4,16 @@ declare class Page<T> implements AsyncIterable<T> {
|
|
|
4
4
|
private readonly client;
|
|
5
5
|
private readonly path;
|
|
6
6
|
private readonly query;
|
|
7
|
-
constructor(client:
|
|
7
|
+
constructor(client: ShipmailClient, path: string, query: Record<string, string | number | boolean | undefined>);
|
|
8
8
|
[Symbol.asyncIterator](): AsyncIterator<T>;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
declare abstract class ApiResource {
|
|
12
|
-
protected readonly client:
|
|
13
|
-
constructor(client:
|
|
12
|
+
protected readonly client: ShipmailClient;
|
|
13
|
+
constructor(client: ShipmailClient);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
type
|
|
16
|
+
type ShipmailConfig = {
|
|
17
17
|
readonly apiKey: string;
|
|
18
18
|
readonly baseUrl?: string | undefined;
|
|
19
19
|
readonly maxRetries?: number | undefined;
|
|
@@ -196,7 +196,7 @@ declare class Subscribers extends ApiResource {
|
|
|
196
196
|
declare class Audiences extends ApiResource {
|
|
197
197
|
readonly feeds: AudienceFeeds;
|
|
198
198
|
readonly subscribers: Subscribers;
|
|
199
|
-
constructor(client:
|
|
199
|
+
constructor(client: ShipmailClient);
|
|
200
200
|
create(params: CreateAudienceParams, options?: MethodOptions): Promise<Audience>;
|
|
201
201
|
list(params?: ListAudiencesParams, options?: MethodOptions): Promise<PaginatedResponse<Audience>>;
|
|
202
202
|
listAutoPaginating(params?: Omit<ListAudiencesParams, "cursor">): Page<Audience>;
|
|
@@ -415,7 +415,7 @@ declare class CalendarEvents extends ApiResource {
|
|
|
415
415
|
}
|
|
416
416
|
declare class Calendar extends ApiResource {
|
|
417
417
|
readonly events: CalendarEvents;
|
|
418
|
-
constructor(client:
|
|
418
|
+
constructor(client: ShipmailClient);
|
|
419
419
|
availability(params: CalendarAvailabilityParams, options?: MethodOptions): Promise<CalendarAvailability>;
|
|
420
420
|
}
|
|
421
421
|
|
|
@@ -1701,7 +1701,7 @@ declare class Newsletters extends ApiResource {
|
|
|
1701
1701
|
readonly domains: NewsletterDomains;
|
|
1702
1702
|
readonly senderIdentities: NewsletterSenderIdentities;
|
|
1703
1703
|
readonly assets: NewsletterAssets;
|
|
1704
|
-
constructor(client:
|
|
1704
|
+
constructor(client: ShipmailClient);
|
|
1705
1705
|
create(params: CreateNewsletterParams, options?: MethodOptions): Promise<Newsletter>;
|
|
1706
1706
|
createFromChangelog(params: CreateNewsletterFromChangelogParams, options?: MethodOptions): Promise<Newsletter>;
|
|
1707
1707
|
list(params?: ListNewslettersParams, options?: MethodOptions): Promise<PaginatedResponse<Newsletter>>;
|
|
@@ -2019,9 +2019,9 @@ type RequestOptions = {
|
|
|
2019
2019
|
readonly methodOptions?: MethodOptions | undefined;
|
|
2020
2020
|
};
|
|
2021
2021
|
/**
|
|
2022
|
-
* Client for the
|
|
2022
|
+
* Client for the Shipmail API. Handles authentication, retries, and resource access.
|
|
2023
2023
|
*/
|
|
2024
|
-
declare class
|
|
2024
|
+
declare class ShipmailClient {
|
|
2025
2025
|
private readonly apiKey;
|
|
2026
2026
|
private readonly baseUrl;
|
|
2027
2027
|
private readonly maxRetries;
|
|
@@ -2045,17 +2045,17 @@ declare class ShipMailClient {
|
|
|
2045
2045
|
readonly webhooks: Webhooks;
|
|
2046
2046
|
readonly status: Status;
|
|
2047
2047
|
/**
|
|
2048
|
-
* Create a new
|
|
2048
|
+
* Create a new Shipmail client.
|
|
2049
2049
|
* @param config - API key string or full configuration object.
|
|
2050
2050
|
*/
|
|
2051
|
-
constructor(config: string |
|
|
2051
|
+
constructor(config: string | ShipmailConfig);
|
|
2052
2052
|
request<T>(options: RequestOptions): Promise<T>;
|
|
2053
2053
|
requestBytes(options: RequestOptions): Promise<Uint8Array>;
|
|
2054
2054
|
private requestWithParser;
|
|
2055
2055
|
private buildUrl;
|
|
2056
2056
|
}
|
|
2057
2057
|
|
|
2058
|
-
declare class
|
|
2058
|
+
declare class ShipmailError extends Error {
|
|
2059
2059
|
readonly status: number | undefined;
|
|
2060
2060
|
readonly type: ErrorType | undefined;
|
|
2061
2061
|
readonly requestId: string | undefined;
|
|
@@ -2067,13 +2067,13 @@ declare class ShipMailError extends Error {
|
|
|
2067
2067
|
readonly retryable?: boolean | undefined;
|
|
2068
2068
|
});
|
|
2069
2069
|
}
|
|
2070
|
-
declare class AuthenticationError extends
|
|
2070
|
+
declare class AuthenticationError extends ShipmailError {
|
|
2071
2071
|
constructor(message: string, requestId?: string);
|
|
2072
2072
|
}
|
|
2073
|
-
declare class AuthorizationError extends
|
|
2073
|
+
declare class AuthorizationError extends ShipmailError {
|
|
2074
2074
|
constructor(message: string, requestId?: string);
|
|
2075
2075
|
}
|
|
2076
|
-
declare class ValidationError extends
|
|
2076
|
+
declare class ValidationError extends ShipmailError {
|
|
2077
2077
|
readonly details: readonly {
|
|
2078
2078
|
readonly field: string;
|
|
2079
2079
|
readonly message: string;
|
|
@@ -2088,29 +2088,29 @@ declare class ValidationError extends ShipMailError {
|
|
|
2088
2088
|
}[] | undefined;
|
|
2089
2089
|
});
|
|
2090
2090
|
}
|
|
2091
|
-
declare class QuotaExceededError extends
|
|
2091
|
+
declare class QuotaExceededError extends ShipmailError {
|
|
2092
2092
|
constructor(message: string, requestId?: string);
|
|
2093
2093
|
}
|
|
2094
|
-
declare class NotFoundError extends
|
|
2094
|
+
declare class NotFoundError extends ShipmailError {
|
|
2095
2095
|
constructor(message: string, requestId?: string);
|
|
2096
2096
|
}
|
|
2097
|
-
declare class RateLimitError extends
|
|
2097
|
+
declare class RateLimitError extends ShipmailError {
|
|
2098
2098
|
readonly retryAfter: number | undefined;
|
|
2099
2099
|
constructor(message: string, options?: {
|
|
2100
2100
|
readonly requestId?: string | undefined;
|
|
2101
2101
|
readonly retryAfter?: number | undefined;
|
|
2102
2102
|
});
|
|
2103
2103
|
}
|
|
2104
|
-
declare class ConflictError extends
|
|
2104
|
+
declare class ConflictError extends ShipmailError {
|
|
2105
2105
|
constructor(message: string, requestId?: string);
|
|
2106
2106
|
}
|
|
2107
|
-
declare class InternalServerError extends
|
|
2107
|
+
declare class InternalServerError extends ShipmailError {
|
|
2108
2108
|
constructor(message: string, requestId?: string);
|
|
2109
2109
|
}
|
|
2110
|
-
declare class ConnectionError extends
|
|
2110
|
+
declare class ConnectionError extends ShipmailError {
|
|
2111
2111
|
constructor(message: string);
|
|
2112
2112
|
}
|
|
2113
|
-
declare class WebhookVerificationError extends
|
|
2113
|
+
declare class WebhookVerificationError extends ShipmailError {
|
|
2114
2114
|
constructor(message: string);
|
|
2115
2115
|
}
|
|
2116
2116
|
|
|
@@ -2128,4 +2128,4 @@ declare function verifyWebhook(body: string, headers: WebhookHeaders | Headers,
|
|
|
2128
2128
|
readonly toleranceInSeconds?: number | undefined;
|
|
2129
2129
|
}): Promise<WebhookEvent>;
|
|
2130
2130
|
|
|
2131
|
-
export { type AddSubscriberParams, type AddSubscribersBatchParams, type AddSubscribersBatchResult, type ApiErrorBody, type Audience, type AudienceFeed, AuthenticationError, AuthorizationError, type BookingPage, CONFERENCING_PROVIDER_IDS, type CalendarAvailability, type CalendarAvailabilityParams, type CalendarAvailabilitySlot, type CalendarEvent, type CalendarEventPrivacy, type CalendarEventStatus, type CalendarFreeBusyStatus, type CapabilitiesResponse, type CapabilityResourceConstraints, type ConferencingProviderId, ConflictError, ConnectionError, type ConsumePartnerMailboxCredentialGrantParams, type CreateAudienceParams, type CreateBookingPageParams, type CreateCalendarEventParams, type CreateDomainParams, type CreateInboxReplyDraftParams, type CreateMailboxAppPasswordParams, type CreateMailboxFolderParams, type CreateMailboxParams, type CreateNewsletterFromChangelogParams, type CreateNewsletterParams, type CreatePartnerOrganizationParams, type CreateReplyScanParams, type CreateWebhookParams, type CreatedMailboxAppPassword, type CreatedPartnerOrganization, 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 InboxEmailHeader, type InboxFullMessage, type InboxKeyword, type InboxMessage, type InboxMessageAction, type InboxMessages, type InboxReplyDraft, type InboxReplyDraftSend, type InboxThread, type InboxThreadReplyState, type InboxThreadReplyStateResult, type InboxThreadSummary, type InboxThreads, type InjectSandboxInboundParams, InternalServerError, type ListAudiencesParams, type ListBookingPagesParams, type ListCalendarEventsParams, type ListDeliveriesParams, type ListDomainsParams, type ListInboxMessagesParams, type ListInboxThreadsParams, type ListMailboxesParams, 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 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 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 NewsletterAssetKind, type NewsletterAssetListResponse, type NewsletterAssetStorageUsage, type NewsletterBlock, type NewsletterButtonAlign, type NewsletterCalloutVariant, type NewsletterChangelogEntry, type NewsletterChangelogMedia, type NewsletterChangelogTone, type NewsletterColumnContent, 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 PartnerDataClassification, type PartnerMailboxCredential, type PartnerMailboxCredentialGrant, type PartnerMailboxCredentialGrantList, type PartnerOrganization, type PartnerOrganizationList, type PartnerOrganizationStatus, type PartnerOwnershipInvitation, type PartnerUsage, type PrepareStagedAttachmentUploadParams, QuotaExceededError, RateLimitError, 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,
|
|
2131
|
+
export { type AddSubscriberParams, type AddSubscribersBatchParams, type AddSubscribersBatchResult, type ApiErrorBody, type Audience, type AudienceFeed, AuthenticationError, AuthorizationError, type BookingPage, CONFERENCING_PROVIDER_IDS, type CalendarAvailability, type CalendarAvailabilityParams, type CalendarAvailabilitySlot, type CalendarEvent, type CalendarEventPrivacy, type CalendarEventStatus, type CalendarFreeBusyStatus, type CapabilitiesResponse, type CapabilityResourceConstraints, type ConferencingProviderId, ConflictError, ConnectionError, type ConsumePartnerMailboxCredentialGrantParams, type CreateAudienceParams, type CreateBookingPageParams, type CreateCalendarEventParams, type CreateDomainParams, type CreateInboxReplyDraftParams, type CreateMailboxAppPasswordParams, type CreateMailboxFolderParams, type CreateMailboxParams, type CreateNewsletterFromChangelogParams, type CreateNewsletterParams, type CreatePartnerOrganizationParams, type CreateReplyScanParams, type CreateWebhookParams, type CreatedMailboxAppPassword, type CreatedPartnerOrganization, 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 InboxEmailHeader, type InboxFullMessage, type InboxKeyword, type InboxMessage, type InboxMessageAction, type InboxMessages, type InboxReplyDraft, type InboxReplyDraftSend, type InboxThread, type InboxThreadReplyState, type InboxThreadReplyStateResult, type InboxThreadSummary, type InboxThreads, type InjectSandboxInboundParams, InternalServerError, type ListAudiencesParams, type ListBookingPagesParams, type ListCalendarEventsParams, type ListDeliveriesParams, type ListDomainsParams, type ListInboxMessagesParams, type ListInboxThreadsParams, type ListMailboxesParams, 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 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 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 NewsletterAssetKind, type NewsletterAssetListResponse, type NewsletterAssetStorageUsage, type NewsletterBlock, type NewsletterButtonAlign, type NewsletterCalloutVariant, type NewsletterChangelogEntry, type NewsletterChangelogMedia, type NewsletterChangelogTone, type NewsletterColumnContent, 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 PartnerDataClassification, type PartnerMailboxCredential, type PartnerMailboxCredentialGrant, type PartnerMailboxCredentialGrantList, type PartnerOrganization, type PartnerOrganizationList, type PartnerOrganizationStatus, type PartnerOwnershipInvitation, type PartnerUsage, type PrepareStagedAttachmentUploadParams, QuotaExceededError, RateLimitError, 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 TransactionalRecipientBudget, type UpdateAudienceFeedParams, type UpdateAudienceParams, type UpdateAutoReplyParams, type UpdateBookingPageParams, type UpdateCalendarEventParams, type UpdateDomainParams, type UpdateInboxMessageParams, type UpdateInboxThreadReplyStateParams, type UpdateMailboxFolderParams, type UpdateMailboxParams, type UpdateMailboxRulesParams, type UpdateNewsletterParams, type UpdatePartnerOrganizationParams, type UpdateScheduledMessageParams, type UpdateSpamFilterParams, 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
|
@@ -4,16 +4,16 @@ declare class Page<T> implements AsyncIterable<T> {
|
|
|
4
4
|
private readonly client;
|
|
5
5
|
private readonly path;
|
|
6
6
|
private readonly query;
|
|
7
|
-
constructor(client:
|
|
7
|
+
constructor(client: ShipmailClient, path: string, query: Record<string, string | number | boolean | undefined>);
|
|
8
8
|
[Symbol.asyncIterator](): AsyncIterator<T>;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
declare abstract class ApiResource {
|
|
12
|
-
protected readonly client:
|
|
13
|
-
constructor(client:
|
|
12
|
+
protected readonly client: ShipmailClient;
|
|
13
|
+
constructor(client: ShipmailClient);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
type
|
|
16
|
+
type ShipmailConfig = {
|
|
17
17
|
readonly apiKey: string;
|
|
18
18
|
readonly baseUrl?: string | undefined;
|
|
19
19
|
readonly maxRetries?: number | undefined;
|
|
@@ -196,7 +196,7 @@ declare class Subscribers extends ApiResource {
|
|
|
196
196
|
declare class Audiences extends ApiResource {
|
|
197
197
|
readonly feeds: AudienceFeeds;
|
|
198
198
|
readonly subscribers: Subscribers;
|
|
199
|
-
constructor(client:
|
|
199
|
+
constructor(client: ShipmailClient);
|
|
200
200
|
create(params: CreateAudienceParams, options?: MethodOptions): Promise<Audience>;
|
|
201
201
|
list(params?: ListAudiencesParams, options?: MethodOptions): Promise<PaginatedResponse<Audience>>;
|
|
202
202
|
listAutoPaginating(params?: Omit<ListAudiencesParams, "cursor">): Page<Audience>;
|
|
@@ -415,7 +415,7 @@ declare class CalendarEvents extends ApiResource {
|
|
|
415
415
|
}
|
|
416
416
|
declare class Calendar extends ApiResource {
|
|
417
417
|
readonly events: CalendarEvents;
|
|
418
|
-
constructor(client:
|
|
418
|
+
constructor(client: ShipmailClient);
|
|
419
419
|
availability(params: CalendarAvailabilityParams, options?: MethodOptions): Promise<CalendarAvailability>;
|
|
420
420
|
}
|
|
421
421
|
|
|
@@ -1701,7 +1701,7 @@ declare class Newsletters extends ApiResource {
|
|
|
1701
1701
|
readonly domains: NewsletterDomains;
|
|
1702
1702
|
readonly senderIdentities: NewsletterSenderIdentities;
|
|
1703
1703
|
readonly assets: NewsletterAssets;
|
|
1704
|
-
constructor(client:
|
|
1704
|
+
constructor(client: ShipmailClient);
|
|
1705
1705
|
create(params: CreateNewsletterParams, options?: MethodOptions): Promise<Newsletter>;
|
|
1706
1706
|
createFromChangelog(params: CreateNewsletterFromChangelogParams, options?: MethodOptions): Promise<Newsletter>;
|
|
1707
1707
|
list(params?: ListNewslettersParams, options?: MethodOptions): Promise<PaginatedResponse<Newsletter>>;
|
|
@@ -2019,9 +2019,9 @@ type RequestOptions = {
|
|
|
2019
2019
|
readonly methodOptions?: MethodOptions | undefined;
|
|
2020
2020
|
};
|
|
2021
2021
|
/**
|
|
2022
|
-
* Client for the
|
|
2022
|
+
* Client for the Shipmail API. Handles authentication, retries, and resource access.
|
|
2023
2023
|
*/
|
|
2024
|
-
declare class
|
|
2024
|
+
declare class ShipmailClient {
|
|
2025
2025
|
private readonly apiKey;
|
|
2026
2026
|
private readonly baseUrl;
|
|
2027
2027
|
private readonly maxRetries;
|
|
@@ -2045,17 +2045,17 @@ declare class ShipMailClient {
|
|
|
2045
2045
|
readonly webhooks: Webhooks;
|
|
2046
2046
|
readonly status: Status;
|
|
2047
2047
|
/**
|
|
2048
|
-
* Create a new
|
|
2048
|
+
* Create a new Shipmail client.
|
|
2049
2049
|
* @param config - API key string or full configuration object.
|
|
2050
2050
|
*/
|
|
2051
|
-
constructor(config: string |
|
|
2051
|
+
constructor(config: string | ShipmailConfig);
|
|
2052
2052
|
request<T>(options: RequestOptions): Promise<T>;
|
|
2053
2053
|
requestBytes(options: RequestOptions): Promise<Uint8Array>;
|
|
2054
2054
|
private requestWithParser;
|
|
2055
2055
|
private buildUrl;
|
|
2056
2056
|
}
|
|
2057
2057
|
|
|
2058
|
-
declare class
|
|
2058
|
+
declare class ShipmailError extends Error {
|
|
2059
2059
|
readonly status: number | undefined;
|
|
2060
2060
|
readonly type: ErrorType | undefined;
|
|
2061
2061
|
readonly requestId: string | undefined;
|
|
@@ -2067,13 +2067,13 @@ declare class ShipMailError extends Error {
|
|
|
2067
2067
|
readonly retryable?: boolean | undefined;
|
|
2068
2068
|
});
|
|
2069
2069
|
}
|
|
2070
|
-
declare class AuthenticationError extends
|
|
2070
|
+
declare class AuthenticationError extends ShipmailError {
|
|
2071
2071
|
constructor(message: string, requestId?: string);
|
|
2072
2072
|
}
|
|
2073
|
-
declare class AuthorizationError extends
|
|
2073
|
+
declare class AuthorizationError extends ShipmailError {
|
|
2074
2074
|
constructor(message: string, requestId?: string);
|
|
2075
2075
|
}
|
|
2076
|
-
declare class ValidationError extends
|
|
2076
|
+
declare class ValidationError extends ShipmailError {
|
|
2077
2077
|
readonly details: readonly {
|
|
2078
2078
|
readonly field: string;
|
|
2079
2079
|
readonly message: string;
|
|
@@ -2088,29 +2088,29 @@ declare class ValidationError extends ShipMailError {
|
|
|
2088
2088
|
}[] | undefined;
|
|
2089
2089
|
});
|
|
2090
2090
|
}
|
|
2091
|
-
declare class QuotaExceededError extends
|
|
2091
|
+
declare class QuotaExceededError extends ShipmailError {
|
|
2092
2092
|
constructor(message: string, requestId?: string);
|
|
2093
2093
|
}
|
|
2094
|
-
declare class NotFoundError extends
|
|
2094
|
+
declare class NotFoundError extends ShipmailError {
|
|
2095
2095
|
constructor(message: string, requestId?: string);
|
|
2096
2096
|
}
|
|
2097
|
-
declare class RateLimitError extends
|
|
2097
|
+
declare class RateLimitError extends ShipmailError {
|
|
2098
2098
|
readonly retryAfter: number | undefined;
|
|
2099
2099
|
constructor(message: string, options?: {
|
|
2100
2100
|
readonly requestId?: string | undefined;
|
|
2101
2101
|
readonly retryAfter?: number | undefined;
|
|
2102
2102
|
});
|
|
2103
2103
|
}
|
|
2104
|
-
declare class ConflictError extends
|
|
2104
|
+
declare class ConflictError extends ShipmailError {
|
|
2105
2105
|
constructor(message: string, requestId?: string);
|
|
2106
2106
|
}
|
|
2107
|
-
declare class InternalServerError extends
|
|
2107
|
+
declare class InternalServerError extends ShipmailError {
|
|
2108
2108
|
constructor(message: string, requestId?: string);
|
|
2109
2109
|
}
|
|
2110
|
-
declare class ConnectionError extends
|
|
2110
|
+
declare class ConnectionError extends ShipmailError {
|
|
2111
2111
|
constructor(message: string);
|
|
2112
2112
|
}
|
|
2113
|
-
declare class WebhookVerificationError extends
|
|
2113
|
+
declare class WebhookVerificationError extends ShipmailError {
|
|
2114
2114
|
constructor(message: string);
|
|
2115
2115
|
}
|
|
2116
2116
|
|
|
@@ -2128,4 +2128,4 @@ declare function verifyWebhook(body: string, headers: WebhookHeaders | Headers,
|
|
|
2128
2128
|
readonly toleranceInSeconds?: number | undefined;
|
|
2129
2129
|
}): Promise<WebhookEvent>;
|
|
2130
2130
|
|
|
2131
|
-
export { type AddSubscriberParams, type AddSubscribersBatchParams, type AddSubscribersBatchResult, type ApiErrorBody, type Audience, type AudienceFeed, AuthenticationError, AuthorizationError, type BookingPage, CONFERENCING_PROVIDER_IDS, type CalendarAvailability, type CalendarAvailabilityParams, type CalendarAvailabilitySlot, type CalendarEvent, type CalendarEventPrivacy, type CalendarEventStatus, type CalendarFreeBusyStatus, type CapabilitiesResponse, type CapabilityResourceConstraints, type ConferencingProviderId, ConflictError, ConnectionError, type ConsumePartnerMailboxCredentialGrantParams, type CreateAudienceParams, type CreateBookingPageParams, type CreateCalendarEventParams, type CreateDomainParams, type CreateInboxReplyDraftParams, type CreateMailboxAppPasswordParams, type CreateMailboxFolderParams, type CreateMailboxParams, type CreateNewsletterFromChangelogParams, type CreateNewsletterParams, type CreatePartnerOrganizationParams, type CreateReplyScanParams, type CreateWebhookParams, type CreatedMailboxAppPassword, type CreatedPartnerOrganization, 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 InboxEmailHeader, type InboxFullMessage, type InboxKeyword, type InboxMessage, type InboxMessageAction, type InboxMessages, type InboxReplyDraft, type InboxReplyDraftSend, type InboxThread, type InboxThreadReplyState, type InboxThreadReplyStateResult, type InboxThreadSummary, type InboxThreads, type InjectSandboxInboundParams, InternalServerError, type ListAudiencesParams, type ListBookingPagesParams, type ListCalendarEventsParams, type ListDeliveriesParams, type ListDomainsParams, type ListInboxMessagesParams, type ListInboxThreadsParams, type ListMailboxesParams, 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 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 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 NewsletterAssetKind, type NewsletterAssetListResponse, type NewsletterAssetStorageUsage, type NewsletterBlock, type NewsletterButtonAlign, type NewsletterCalloutVariant, type NewsletterChangelogEntry, type NewsletterChangelogMedia, type NewsletterChangelogTone, type NewsletterColumnContent, 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 PartnerDataClassification, type PartnerMailboxCredential, type PartnerMailboxCredentialGrant, type PartnerMailboxCredentialGrantList, type PartnerOrganization, type PartnerOrganizationList, type PartnerOrganizationStatus, type PartnerOwnershipInvitation, type PartnerUsage, type PrepareStagedAttachmentUploadParams, QuotaExceededError, RateLimitError, 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,
|
|
2131
|
+
export { type AddSubscriberParams, type AddSubscribersBatchParams, type AddSubscribersBatchResult, type ApiErrorBody, type Audience, type AudienceFeed, AuthenticationError, AuthorizationError, type BookingPage, CONFERENCING_PROVIDER_IDS, type CalendarAvailability, type CalendarAvailabilityParams, type CalendarAvailabilitySlot, type CalendarEvent, type CalendarEventPrivacy, type CalendarEventStatus, type CalendarFreeBusyStatus, type CapabilitiesResponse, type CapabilityResourceConstraints, type ConferencingProviderId, ConflictError, ConnectionError, type ConsumePartnerMailboxCredentialGrantParams, type CreateAudienceParams, type CreateBookingPageParams, type CreateCalendarEventParams, type CreateDomainParams, type CreateInboxReplyDraftParams, type CreateMailboxAppPasswordParams, type CreateMailboxFolderParams, type CreateMailboxParams, type CreateNewsletterFromChangelogParams, type CreateNewsletterParams, type CreatePartnerOrganizationParams, type CreateReplyScanParams, type CreateWebhookParams, type CreatedMailboxAppPassword, type CreatedPartnerOrganization, 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 InboxEmailHeader, type InboxFullMessage, type InboxKeyword, type InboxMessage, type InboxMessageAction, type InboxMessages, type InboxReplyDraft, type InboxReplyDraftSend, type InboxThread, type InboxThreadReplyState, type InboxThreadReplyStateResult, type InboxThreadSummary, type InboxThreads, type InjectSandboxInboundParams, InternalServerError, type ListAudiencesParams, type ListBookingPagesParams, type ListCalendarEventsParams, type ListDeliveriesParams, type ListDomainsParams, type ListInboxMessagesParams, type ListInboxThreadsParams, type ListMailboxesParams, 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 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 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 NewsletterAssetKind, type NewsletterAssetListResponse, type NewsletterAssetStorageUsage, type NewsletterBlock, type NewsletterButtonAlign, type NewsletterCalloutVariant, type NewsletterChangelogEntry, type NewsletterChangelogMedia, type NewsletterChangelogTone, type NewsletterColumnContent, 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 PartnerDataClassification, type PartnerMailboxCredential, type PartnerMailboxCredentialGrant, type PartnerMailboxCredentialGrantList, type PartnerOrganization, type PartnerOrganizationList, type PartnerOrganizationStatus, type PartnerOwnershipInvitation, type PartnerUsage, type PrepareStagedAttachmentUploadParams, QuotaExceededError, RateLimitError, 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 TransactionalRecipientBudget, type UpdateAudienceFeedParams, type UpdateAudienceParams, type UpdateAutoReplyParams, type UpdateBookingPageParams, type UpdateCalendarEventParams, type UpdateDomainParams, type UpdateInboxMessageParams, type UpdateInboxThreadReplyStateParams, type UpdateMailboxFolderParams, type UpdateMailboxParams, type UpdateMailboxRulesParams, type UpdateNewsletterParams, type UpdatePartnerOrganizationParams, type UpdateScheduledMessageParams, type UpdateSpamFilterParams, 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
|
@@ -81,29 +81,29 @@ function apiKeyScopesGrant(grantedScopes, requiredScope) {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
// src/errors.ts
|
|
84
|
-
var
|
|
84
|
+
var ShipmailError = class extends Error {
|
|
85
85
|
constructor(message, options) {
|
|
86
86
|
super(message);
|
|
87
|
-
this.name = "
|
|
87
|
+
this.name = "ShipmailError";
|
|
88
88
|
this.status = options?.status;
|
|
89
89
|
this.type = options?.type;
|
|
90
90
|
this.requestId = options?.requestId;
|
|
91
91
|
this.retryable = options?.retryable ?? false;
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
|
-
var AuthenticationError = class extends
|
|
94
|
+
var AuthenticationError = class extends ShipmailError {
|
|
95
95
|
constructor(message, requestId) {
|
|
96
96
|
super(message, { status: 401, type: "authentication_error", requestId, retryable: false });
|
|
97
97
|
this.name = "AuthenticationError";
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
|
-
var AuthorizationError = class extends
|
|
100
|
+
var AuthorizationError = class extends ShipmailError {
|
|
101
101
|
constructor(message, requestId) {
|
|
102
102
|
super(message, { status: 403, type: "authorization_error", requestId, retryable: false });
|
|
103
103
|
this.name = "AuthorizationError";
|
|
104
104
|
}
|
|
105
105
|
};
|
|
106
|
-
var ValidationError = class extends
|
|
106
|
+
var ValidationError = class extends ShipmailError {
|
|
107
107
|
constructor(message, options) {
|
|
108
108
|
super(message, {
|
|
109
109
|
status: 422,
|
|
@@ -115,19 +115,19 @@ var ValidationError = class extends ShipMailError {
|
|
|
115
115
|
this.details = options?.details;
|
|
116
116
|
}
|
|
117
117
|
};
|
|
118
|
-
var QuotaExceededError = class extends
|
|
118
|
+
var QuotaExceededError = class extends ShipmailError {
|
|
119
119
|
constructor(message, requestId) {
|
|
120
120
|
super(message, { status: 403, type: "quota_exceeded", requestId, retryable: false });
|
|
121
121
|
this.name = "QuotaExceededError";
|
|
122
122
|
}
|
|
123
123
|
};
|
|
124
|
-
var NotFoundError = class extends
|
|
124
|
+
var NotFoundError = class extends ShipmailError {
|
|
125
125
|
constructor(message, requestId) {
|
|
126
126
|
super(message, { status: 404, type: "not_found", requestId, retryable: false });
|
|
127
127
|
this.name = "NotFoundError";
|
|
128
128
|
}
|
|
129
129
|
};
|
|
130
|
-
var RateLimitError = class extends
|
|
130
|
+
var RateLimitError = class extends ShipmailError {
|
|
131
131
|
constructor(message, options) {
|
|
132
132
|
super(message, {
|
|
133
133
|
status: 429,
|
|
@@ -139,25 +139,25 @@ var RateLimitError = class extends ShipMailError {
|
|
|
139
139
|
this.retryAfter = options?.retryAfter;
|
|
140
140
|
}
|
|
141
141
|
};
|
|
142
|
-
var ConflictError = class extends
|
|
142
|
+
var ConflictError = class extends ShipmailError {
|
|
143
143
|
constructor(message, requestId) {
|
|
144
144
|
super(message, { status: 409, type: "conflict", requestId, retryable: false });
|
|
145
145
|
this.name = "ConflictError";
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
|
-
var InternalServerError = class extends
|
|
148
|
+
var InternalServerError = class extends ShipmailError {
|
|
149
149
|
constructor(message, requestId) {
|
|
150
150
|
super(message, { status: 500, type: "internal_error", requestId, retryable: true });
|
|
151
151
|
this.name = "InternalServerError";
|
|
152
152
|
}
|
|
153
153
|
};
|
|
154
|
-
var ConnectionError = class extends
|
|
154
|
+
var ConnectionError = class extends ShipmailError {
|
|
155
155
|
constructor(message) {
|
|
156
156
|
super(message, { retryable: true });
|
|
157
157
|
this.name = "ConnectionError";
|
|
158
158
|
}
|
|
159
159
|
};
|
|
160
|
-
var WebhookVerificationError = class extends
|
|
160
|
+
var WebhookVerificationError = class extends ShipmailError {
|
|
161
161
|
constructor(message) {
|
|
162
162
|
super(message, { retryable: false });
|
|
163
163
|
this.name = "WebhookVerificationError";
|
|
@@ -184,7 +184,7 @@ function mapErrorFromResponse(status, body, requestId) {
|
|
|
184
184
|
case "internal_error":
|
|
185
185
|
return new InternalServerError(error.message, rid);
|
|
186
186
|
default:
|
|
187
|
-
return new
|
|
187
|
+
return new ShipmailError(error.message, {
|
|
188
188
|
status,
|
|
189
189
|
type: error.type,
|
|
190
190
|
requestId: rid,
|
|
@@ -1564,7 +1564,7 @@ var Webhooks = class extends ApiResource {
|
|
|
1564
1564
|
};
|
|
1565
1565
|
|
|
1566
1566
|
// src/version.ts
|
|
1567
|
-
var VERSION = "0.4.
|
|
1567
|
+
var VERSION = "0.4.13";
|
|
1568
1568
|
|
|
1569
1569
|
// src/client.ts
|
|
1570
1570
|
var DEFAULT_BASE_URL = "https://shipmail.to/api/v1";
|
|
@@ -1594,9 +1594,9 @@ function rawBodyToBlobPart(rawBody) {
|
|
|
1594
1594
|
new Uint8Array(buffer).set(rawBody);
|
|
1595
1595
|
return buffer;
|
|
1596
1596
|
}
|
|
1597
|
-
var
|
|
1597
|
+
var ShipmailClient = class {
|
|
1598
1598
|
/**
|
|
1599
|
-
* Create a new
|
|
1599
|
+
* Create a new Shipmail client.
|
|
1600
1600
|
* @param config - API key string or full configuration object.
|
|
1601
1601
|
*/
|
|
1602
1602
|
constructor(config) {
|
|
@@ -1670,7 +1670,7 @@ var ShipMailClient = class {
|
|
|
1670
1670
|
}
|
|
1671
1671
|
const targetOrganizationId = methodOpts?.organizationId ?? this.organizationId;
|
|
1672
1672
|
if (targetOrganizationId) {
|
|
1673
|
-
headers["X-
|
|
1673
|
+
headers["X-Shipmail-Organization-Id"] = targetOrganizationId;
|
|
1674
1674
|
}
|
|
1675
1675
|
let body = null;
|
|
1676
1676
|
if (options.rawBody !== void 0) {
|
|
@@ -1704,7 +1704,7 @@ var ShipMailClient = class {
|
|
|
1704
1704
|
if (isApiErrorBody(errorBody)) {
|
|
1705
1705
|
lastError = mapErrorFromResponse(response.status, errorBody);
|
|
1706
1706
|
} else {
|
|
1707
|
-
lastError = new
|
|
1707
|
+
lastError = new ShipmailError(`Request failed with status ${response.status}`, {
|
|
1708
1708
|
status: response.status,
|
|
1709
1709
|
retryable: isRetryableStatus(response.status)
|
|
1710
1710
|
});
|
|
@@ -1713,7 +1713,7 @@ var ShipMailClient = class {
|
|
|
1713
1713
|
throw lastError;
|
|
1714
1714
|
}
|
|
1715
1715
|
}
|
|
1716
|
-
throw lastError ?? new
|
|
1716
|
+
throw lastError ?? new ShipmailError("Request failed after retries");
|
|
1717
1717
|
}
|
|
1718
1718
|
buildUrl(path2, query) {
|
|
1719
1719
|
const url = new URL(`${this.baseUrl}${path2}`);
|
|
@@ -1788,14 +1788,14 @@ async function verifyWebhook(body, headers, secret, options) {
|
|
|
1788
1788
|
const signature = getHeader(headers, "x-shipmail-signature");
|
|
1789
1789
|
const timestampStr = getHeader(headers, "x-shipmail-timestamp");
|
|
1790
1790
|
if (!signature) {
|
|
1791
|
-
throw new WebhookVerificationError("Missing X-
|
|
1791
|
+
throw new WebhookVerificationError("Missing X-Shipmail-Signature header");
|
|
1792
1792
|
}
|
|
1793
1793
|
if (!timestampStr) {
|
|
1794
|
-
throw new WebhookVerificationError("Missing X-
|
|
1794
|
+
throw new WebhookVerificationError("Missing X-Shipmail-Timestamp header");
|
|
1795
1795
|
}
|
|
1796
1796
|
const timestamp = parseInt(timestampStr, 10);
|
|
1797
1797
|
if (isNaN(timestamp)) {
|
|
1798
|
-
throw new WebhookVerificationError("Invalid X-
|
|
1798
|
+
throw new WebhookVerificationError("Invalid X-Shipmail-Timestamp header");
|
|
1799
1799
|
}
|
|
1800
1800
|
const tolerance = options?.toleranceInSeconds ?? DEFAULT_TOLERANCE_SECONDS;
|
|
1801
1801
|
const now = Math.floor(Date.now() / 1e3);
|
|
@@ -1818,6 +1818,6 @@ async function verifyWebhook(body, headers, secret, options) {
|
|
|
1818
1818
|
return parsed;
|
|
1819
1819
|
}
|
|
1820
1820
|
|
|
1821
|
-
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,
|
|
1821
|
+
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, ShipmailClient, ShipmailError, ValidationError, WEBHOOK_DELIVERY_EVENT_TYPES, WEBHOOK_DELIVERY_STATUSES, WEBHOOK_EVENT_TYPES, WebhookVerificationError, apiKeyScopesGrant, ShipmailClient as default, isApiKeyScope, verifyWebhook };
|
|
1822
1822
|
//# sourceMappingURL=index.js.map
|
|
1823
1823
|
//# sourceMappingURL=index.js.map
|