shipmail 0.4.2 → 0.4.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/dist/index.d.cts CHANGED
@@ -55,9 +55,9 @@ type EmailRecipient = {
55
55
  readonly name?: string | null | undefined;
56
56
  };
57
57
  type EmailRecipientInput = EmailRecipient | string;
58
- declare const WEBHOOK_EVENT_TYPES: readonly ["message.received", "message.sent", "message.delivered", "message.bounced", "message.complained", "thread.needs_reply", "domain.verified", "domain.verification_failed", "domain.degraded", "org.reputation_warning", "org.sending_throttled", "org.sending_suspended", "org.reputation_recovered"];
58
+ declare const WEBHOOK_EVENT_TYPES: readonly ["message.received", "message.sent", "message.delivered", "message.bounced", "message.complained", "thread.needs_reply", "mailbox.rule_matched", "domain.verified", "domain.verification_failed", "domain.degraded", "org.reputation_warning", "org.sending_throttled", "org.sending_suspended", "org.reputation_recovered"];
59
59
  type WebhookEventType = (typeof WEBHOOK_EVENT_TYPES)[number];
60
- declare const WEBHOOK_DELIVERY_EVENT_TYPES: readonly ["webhook.test", "message.received", "message.sent", "message.delivered", "message.bounced", "message.complained", "thread.needs_reply", "domain.verified", "domain.verification_failed", "domain.degraded", "org.reputation_warning", "org.sending_throttled", "org.sending_suspended", "org.reputation_recovered"];
60
+ declare const WEBHOOK_DELIVERY_EVENT_TYPES: readonly ["webhook.test", "message.received", "message.sent", "message.delivered", "message.bounced", "message.complained", "thread.needs_reply", "mailbox.rule_matched", "domain.verified", "domain.verification_failed", "domain.degraded", "org.reputation_warning", "org.sending_throttled", "org.sending_suspended", "org.reputation_recovered"];
61
61
  type WebhookDeliveryEventType = (typeof WEBHOOK_DELIVERY_EVENT_TYPES)[number];
62
62
  type StatusResponse = {
63
63
  readonly status: string;
@@ -621,6 +621,10 @@ type ImportUpload = {
621
621
  readonly expires_in_seconds: number;
622
622
  };
623
623
 
624
+ type MessageRuleDisposition = {
625
+ readonly matched_rule_ids: readonly string[];
626
+ readonly stop_rule_id: string | null;
627
+ };
624
628
  type Message = {
625
629
  readonly object: "message";
626
630
  readonly id: string;
@@ -653,6 +657,7 @@ type Message = {
653
657
  readonly source: MessageSource;
654
658
  readonly mode: DataMode;
655
659
  readonly status: MessageStatus;
660
+ readonly rule_disposition: MessageRuleDisposition | null;
656
661
  readonly scheduled_at: string | null;
657
662
  readonly created_at: string;
658
663
  readonly updated_at: string;
@@ -1056,6 +1061,58 @@ type InboxMessageAction = {
1056
1061
  readonly message_id: string;
1057
1062
  readonly ok: true;
1058
1063
  };
1064
+ type MailboxRuleMatchMode = "all" | "any";
1065
+ type MailboxRuleCondition = {
1066
+ readonly type: "from_is" | "from_contains" | "recipient_is" | "plus_tag_is" | "subject_contains";
1067
+ readonly value: string;
1068
+ } | {
1069
+ readonly type: "has_attachment" | "list_unsubscribe_exists";
1070
+ } | {
1071
+ readonly type: "group";
1072
+ readonly match_mode: MailboxRuleMatchMode;
1073
+ readonly conditions: readonly MailboxRuleCondition[];
1074
+ };
1075
+ type MailboxRuleMoveTarget = {
1076
+ readonly kind: "system";
1077
+ readonly role: "inbox" | "archive" | "junk" | "trash";
1078
+ } | {
1079
+ readonly kind: "custom";
1080
+ readonly folder_id: string;
1081
+ };
1082
+ type MailboxRuleAction = {
1083
+ readonly type: "move";
1084
+ readonly target: MailboxRuleMoveTarget;
1085
+ } | {
1086
+ readonly type: "mark_read";
1087
+ } | {
1088
+ readonly type: "star";
1089
+ } | {
1090
+ readonly type: "send_webhook";
1091
+ };
1092
+ type MailboxRule = {
1093
+ readonly id: string;
1094
+ readonly name: string;
1095
+ readonly enabled: boolean;
1096
+ readonly position: number;
1097
+ readonly match_mode: MailboxRuleMatchMode;
1098
+ readonly stop: boolean;
1099
+ readonly conditions: readonly MailboxRuleCondition[];
1100
+ readonly actions: readonly MailboxRuleAction[];
1101
+ };
1102
+ type MailboxRuleFolder = {
1103
+ readonly id: string;
1104
+ readonly name: string;
1105
+ readonly parent_id: string | null;
1106
+ readonly role: string | null;
1107
+ readonly kind: "custom" | "system";
1108
+ };
1109
+ type MailboxRules = {
1110
+ readonly object: "mailbox_rules";
1111
+ readonly mailbox_id: string;
1112
+ readonly address: string;
1113
+ readonly rules: readonly MailboxRule[];
1114
+ readonly folders: readonly MailboxRuleFolder[];
1115
+ };
1059
1116
  type MailboxForwarding = {
1060
1117
  readonly object: "mailbox_forwarding";
1061
1118
  readonly id: string;
@@ -1156,6 +1213,9 @@ type UpdateAutoReplyParams = {
1156
1213
  type UpdateSpamFilterParams = {
1157
1214
  readonly threshold: number;
1158
1215
  };
1216
+ type UpdateMailboxRulesParams = {
1217
+ readonly rules: readonly MailboxRule[];
1218
+ };
1159
1219
 
1160
1220
  declare class Mailboxes extends ApiResource {
1161
1221
  prepareStagedAttachmentUpload(id: string, params: PrepareStagedAttachmentUploadParams, options?: OneTimeSecretMethodOptions): Promise<StagedAttachmentUpload>;
@@ -1193,6 +1253,8 @@ declare class Mailboxes extends ApiResource {
1193
1253
  listAppPasswords(id: string, options?: MethodOptions): Promise<MailboxAppPasswordList>;
1194
1254
  createAppPassword(id: string, params: CreateMailboxAppPasswordParams, options?: OneTimeSecretMethodOptions): Promise<CreatedMailboxAppPassword>;
1195
1255
  revokeAppPassword(id: string, appPasswordId: string, options?: MethodOptions): Promise<void>;
1256
+ getRules(id: string, options?: MethodOptions): Promise<MailboxRules>;
1257
+ updateRules(id: string, params: UpdateMailboxRulesParams, options?: MethodOptions): Promise<MailboxRules>;
1196
1258
  listForwarding(id: string, options?: MethodOptions): Promise<MailboxForwardingList>;
1197
1259
  createForwarding(id: string, params: CreateMailboxForwardingParams, options?: MethodOptions): Promise<MailboxForwarding>;
1198
1260
  deleteForwarding(id: string, forwardingId: string, options?: MethodOptions): Promise<void>;
@@ -1959,4 +2021,4 @@ declare function verifyWebhook(body: string, headers: WebhookHeaders | Headers,
1959
2021
  readonly toleranceInSeconds?: number | undefined;
1960
2022
  }): Promise<WebhookEvent>;
1961
2023
 
1962
- export { type AddSubscriberParams, type AddSubscribersBatchParams, type AddSubscribersBatchResult, type ApiErrorBody, type Audience, 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 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 ListMessagesParams, type ListNewsletterAssetsParams, type ListNewsletterDomainsParams, 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 MergeFields, type Message, type MessageMetadata, 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 NewsletterStatus, 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 UpdateAudienceParams, type UpdateAutoReplyParams, type UpdateBookingPageParams, type UpdateCalendarEventParams, type UpdateDomainParams, type UpdateInboxMessageParams, type UpdateInboxThreadReplyStateParams, type UpdateMailboxFolderParams, type UpdateMailboxParams, 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 };
2024
+ export { type AddSubscriberParams, type AddSubscribersBatchParams, type AddSubscribersBatchResult, type ApiErrorBody, type Audience, 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 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 ListMessagesParams, type ListNewsletterAssetsParams, type ListNewsletterDomainsParams, 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 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 NewsletterStatus, 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 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
@@ -55,9 +55,9 @@ type EmailRecipient = {
55
55
  readonly name?: string | null | undefined;
56
56
  };
57
57
  type EmailRecipientInput = EmailRecipient | string;
58
- declare const WEBHOOK_EVENT_TYPES: readonly ["message.received", "message.sent", "message.delivered", "message.bounced", "message.complained", "thread.needs_reply", "domain.verified", "domain.verification_failed", "domain.degraded", "org.reputation_warning", "org.sending_throttled", "org.sending_suspended", "org.reputation_recovered"];
58
+ declare const WEBHOOK_EVENT_TYPES: readonly ["message.received", "message.sent", "message.delivered", "message.bounced", "message.complained", "thread.needs_reply", "mailbox.rule_matched", "domain.verified", "domain.verification_failed", "domain.degraded", "org.reputation_warning", "org.sending_throttled", "org.sending_suspended", "org.reputation_recovered"];
59
59
  type WebhookEventType = (typeof WEBHOOK_EVENT_TYPES)[number];
60
- declare const WEBHOOK_DELIVERY_EVENT_TYPES: readonly ["webhook.test", "message.received", "message.sent", "message.delivered", "message.bounced", "message.complained", "thread.needs_reply", "domain.verified", "domain.verification_failed", "domain.degraded", "org.reputation_warning", "org.sending_throttled", "org.sending_suspended", "org.reputation_recovered"];
60
+ declare const WEBHOOK_DELIVERY_EVENT_TYPES: readonly ["webhook.test", "message.received", "message.sent", "message.delivered", "message.bounced", "message.complained", "thread.needs_reply", "mailbox.rule_matched", "domain.verified", "domain.verification_failed", "domain.degraded", "org.reputation_warning", "org.sending_throttled", "org.sending_suspended", "org.reputation_recovered"];
61
61
  type WebhookDeliveryEventType = (typeof WEBHOOK_DELIVERY_EVENT_TYPES)[number];
62
62
  type StatusResponse = {
63
63
  readonly status: string;
@@ -621,6 +621,10 @@ type ImportUpload = {
621
621
  readonly expires_in_seconds: number;
622
622
  };
623
623
 
624
+ type MessageRuleDisposition = {
625
+ readonly matched_rule_ids: readonly string[];
626
+ readonly stop_rule_id: string | null;
627
+ };
624
628
  type Message = {
625
629
  readonly object: "message";
626
630
  readonly id: string;
@@ -653,6 +657,7 @@ type Message = {
653
657
  readonly source: MessageSource;
654
658
  readonly mode: DataMode;
655
659
  readonly status: MessageStatus;
660
+ readonly rule_disposition: MessageRuleDisposition | null;
656
661
  readonly scheduled_at: string | null;
657
662
  readonly created_at: string;
658
663
  readonly updated_at: string;
@@ -1056,6 +1061,58 @@ type InboxMessageAction = {
1056
1061
  readonly message_id: string;
1057
1062
  readonly ok: true;
1058
1063
  };
1064
+ type MailboxRuleMatchMode = "all" | "any";
1065
+ type MailboxRuleCondition = {
1066
+ readonly type: "from_is" | "from_contains" | "recipient_is" | "plus_tag_is" | "subject_contains";
1067
+ readonly value: string;
1068
+ } | {
1069
+ readonly type: "has_attachment" | "list_unsubscribe_exists";
1070
+ } | {
1071
+ readonly type: "group";
1072
+ readonly match_mode: MailboxRuleMatchMode;
1073
+ readonly conditions: readonly MailboxRuleCondition[];
1074
+ };
1075
+ type MailboxRuleMoveTarget = {
1076
+ readonly kind: "system";
1077
+ readonly role: "inbox" | "archive" | "junk" | "trash";
1078
+ } | {
1079
+ readonly kind: "custom";
1080
+ readonly folder_id: string;
1081
+ };
1082
+ type MailboxRuleAction = {
1083
+ readonly type: "move";
1084
+ readonly target: MailboxRuleMoveTarget;
1085
+ } | {
1086
+ readonly type: "mark_read";
1087
+ } | {
1088
+ readonly type: "star";
1089
+ } | {
1090
+ readonly type: "send_webhook";
1091
+ };
1092
+ type MailboxRule = {
1093
+ readonly id: string;
1094
+ readonly name: string;
1095
+ readonly enabled: boolean;
1096
+ readonly position: number;
1097
+ readonly match_mode: MailboxRuleMatchMode;
1098
+ readonly stop: boolean;
1099
+ readonly conditions: readonly MailboxRuleCondition[];
1100
+ readonly actions: readonly MailboxRuleAction[];
1101
+ };
1102
+ type MailboxRuleFolder = {
1103
+ readonly id: string;
1104
+ readonly name: string;
1105
+ readonly parent_id: string | null;
1106
+ readonly role: string | null;
1107
+ readonly kind: "custom" | "system";
1108
+ };
1109
+ type MailboxRules = {
1110
+ readonly object: "mailbox_rules";
1111
+ readonly mailbox_id: string;
1112
+ readonly address: string;
1113
+ readonly rules: readonly MailboxRule[];
1114
+ readonly folders: readonly MailboxRuleFolder[];
1115
+ };
1059
1116
  type MailboxForwarding = {
1060
1117
  readonly object: "mailbox_forwarding";
1061
1118
  readonly id: string;
@@ -1156,6 +1213,9 @@ type UpdateAutoReplyParams = {
1156
1213
  type UpdateSpamFilterParams = {
1157
1214
  readonly threshold: number;
1158
1215
  };
1216
+ type UpdateMailboxRulesParams = {
1217
+ readonly rules: readonly MailboxRule[];
1218
+ };
1159
1219
 
1160
1220
  declare class Mailboxes extends ApiResource {
1161
1221
  prepareStagedAttachmentUpload(id: string, params: PrepareStagedAttachmentUploadParams, options?: OneTimeSecretMethodOptions): Promise<StagedAttachmentUpload>;
@@ -1193,6 +1253,8 @@ declare class Mailboxes extends ApiResource {
1193
1253
  listAppPasswords(id: string, options?: MethodOptions): Promise<MailboxAppPasswordList>;
1194
1254
  createAppPassword(id: string, params: CreateMailboxAppPasswordParams, options?: OneTimeSecretMethodOptions): Promise<CreatedMailboxAppPassword>;
1195
1255
  revokeAppPassword(id: string, appPasswordId: string, options?: MethodOptions): Promise<void>;
1256
+ getRules(id: string, options?: MethodOptions): Promise<MailboxRules>;
1257
+ updateRules(id: string, params: UpdateMailboxRulesParams, options?: MethodOptions): Promise<MailboxRules>;
1196
1258
  listForwarding(id: string, options?: MethodOptions): Promise<MailboxForwardingList>;
1197
1259
  createForwarding(id: string, params: CreateMailboxForwardingParams, options?: MethodOptions): Promise<MailboxForwarding>;
1198
1260
  deleteForwarding(id: string, forwardingId: string, options?: MethodOptions): Promise<void>;
@@ -1959,4 +2021,4 @@ declare function verifyWebhook(body: string, headers: WebhookHeaders | Headers,
1959
2021
  readonly toleranceInSeconds?: number | undefined;
1960
2022
  }): Promise<WebhookEvent>;
1961
2023
 
1962
- export { type AddSubscriberParams, type AddSubscribersBatchParams, type AddSubscribersBatchResult, type ApiErrorBody, type Audience, 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 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 ListMessagesParams, type ListNewsletterAssetsParams, type ListNewsletterDomainsParams, 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 MergeFields, type Message, type MessageMetadata, 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 NewsletterStatus, 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 UpdateAudienceParams, type UpdateAutoReplyParams, type UpdateBookingPageParams, type UpdateCalendarEventParams, type UpdateDomainParams, type UpdateInboxMessageParams, type UpdateInboxThreadReplyStateParams, type UpdateMailboxFolderParams, type UpdateMailboxParams, 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 };
2024
+ export { type AddSubscriberParams, type AddSubscribersBatchParams, type AddSubscribersBatchResult, type ApiErrorBody, type Audience, 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 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 ListMessagesParams, type ListNewsletterAssetsParams, type ListNewsletterDomainsParams, 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 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 NewsletterStatus, 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 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
@@ -16,6 +16,8 @@ var API_KEY_SCOPES = [
16
16
  "mailbox_credentials:write",
17
17
  "mailbox_forwarding:read",
18
18
  "mailbox_forwarding:write",
19
+ "mailbox_rules:read",
20
+ "mailbox_rules:write",
19
21
  "messages:read",
20
22
  "messages:write",
21
23
  "drafts:write",
@@ -50,6 +52,8 @@ var API_KEY_SCOPE_DESCRIPTIONS = {
50
52
  "mailbox_credentials:write": "Create and revoke app passwords for allowed mailboxes.",
51
53
  "mailbox_forwarding:read": "List forwarding destinations for allowed mailboxes.",
52
54
  "mailbox_forwarding:write": "Create and remove forwarding destinations for allowed mailboxes.",
55
+ "mailbox_rules:read": "List deterministic server-side rules for allowed mailboxes.",
56
+ "mailbox_rules:write": "Create, replace, and remove deterministic rules for allowed mailboxes.",
53
57
  "messages:read": "List and retrieve messages.",
54
58
  "messages:write": "Update, move, delete, and inject sandbox messages.",
55
59
  "drafts:write": "Create agent-safe reply drafts with server-derived recipients.",
@@ -870,6 +874,21 @@ var Mailboxes = class extends ApiResource {
870
874
  methodOptions: options
871
875
  });
872
876
  }
877
+ getRules(id, options) {
878
+ return this.client.request({
879
+ method: "GET",
880
+ path: `/mailboxes/${encodeURIComponent(id)}/rules`,
881
+ methodOptions: options
882
+ });
883
+ }
884
+ updateRules(id, params, options) {
885
+ return this.client.request({
886
+ method: "PUT",
887
+ path: `/mailboxes/${encodeURIComponent(id)}/rules`,
888
+ body: params,
889
+ methodOptions: options
890
+ });
891
+ }
873
892
  listForwarding(id, options) {
874
893
  return this.client.request({
875
894
  method: "GET",
@@ -1481,7 +1500,7 @@ var Webhooks = class extends ApiResource {
1481
1500
  };
1482
1501
 
1483
1502
  // src/version.ts
1484
- var VERSION = "0.4.2";
1503
+ var VERSION = "0.4.3";
1485
1504
 
1486
1505
  // src/client.ts
1487
1506
  var DEFAULT_BASE_URL = "https://shipmail.to/api/v1";
@@ -1656,6 +1675,7 @@ var WEBHOOK_EVENT_TYPES = [
1656
1675
  "message.bounced",
1657
1676
  "message.complained",
1658
1677
  "thread.needs_reply",
1678
+ "mailbox.rule_matched",
1659
1679
  "domain.verified",
1660
1680
  "domain.verification_failed",
1661
1681
  "domain.degraded",