@trycourier/courier 6.3.1 → 6.4.1
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/Client.d.ts +49 -108
- package/Client.js +89 -148
- package/README.md +113 -808
- package/api/client/requests/SendMessageRequest.d.ts +8 -76
- package/api/resources/audiences/client/Client.d.ts +26 -21
- package/api/resources/audiences/client/Client.js +97 -90
- package/api/resources/audiences/client/requests/AudienceMembersListParams.d.ts +1 -3
- package/api/resources/audiences/client/requests/AudienceUpdateParams.d.ts +3 -7
- package/api/resources/audiences/client/requests/AudiencesListParams.d.ts +1 -3
- package/api/resources/audiences/types/ComparisonOperator.d.ts +1 -1
- package/api/resources/audiences/types/Filter.d.ts +1 -1
- package/api/resources/audiences/types/FilterConfig.d.ts +1 -1
- package/api/resources/audiences/types/LogicalOperator.d.ts +1 -1
- package/api/resources/audiences/types/Operator.d.ts +1 -1
- package/api/resources/auditEvents/client/Client.d.ts +14 -6
- package/api/resources/auditEvents/client/Client.js +48 -38
- package/api/resources/auditEvents/client/requests/ListAuditEventsRequest.d.ts +1 -3
- package/api/resources/authTokens/client/Client.d.ts +13 -4
- package/api/resources/authTokens/client/Client.js +35 -26
- package/api/resources/authTokens/client/requests/IssueTokenParams.d.ts +2 -2
- package/api/resources/automations/client/Client.d.ts +19 -15
- package/api/resources/automations/client/Client.js +52 -50
- package/api/resources/automations/types/AutomationAddToBatchMaxItemsType.d.ts +1 -1
- package/api/resources/automations/types/AutomationAddToBatchRetainType.d.ts +1 -1
- package/api/resources/automations/types/AutomationAddToBatchScope.d.ts +1 -1
- package/api/resources/automations/types/AutomationFetchDataWebhookMethod.d.ts +1 -1
- package/api/resources/automations/types/AutomationStepOption.d.ts +1 -1
- package/api/resources/automations/types/AutomationThrottleScope.d.ts +1 -1
- package/api/resources/automations/types/MergeAlgorithm.d.ts +1 -1
- package/api/resources/automations/types/Profile.d.ts +1 -1
- package/api/resources/brands/client/Client.d.ts +32 -63
- package/api/resources/brands/client/Client.js +103 -134
- package/api/resources/brands/client/requests/BrandUpdateParameters.d.ts +3 -26
- package/api/resources/brands/client/requests/ListBrandsRequest.d.ts +1 -3
- package/api/resources/bulk/client/Client.d.ts +40 -126
- package/api/resources/bulk/client/Client.js +111 -201
- package/api/resources/bulk/client/requests/BulkCreateJobParams.d.ts +6 -86
- package/api/resources/bulk/client/requests/BulkGetUsersParams.d.ts +1 -3
- package/api/resources/bulk/types/BulkJobStatus.d.ts +1 -1
- package/api/resources/bulk/types/BulkJobUserStatus.d.ts +1 -1
- package/api/resources/bulk/types/InboundBulkMessageV2.d.ts +3 -5
- package/api/resources/commons/errors/AlreadyExistsError.d.ts +2 -1
- package/api/resources/commons/errors/AlreadyExistsError.js +19 -8
- package/api/resources/commons/errors/BadRequestError.d.ts +2 -1
- package/api/resources/commons/errors/BadRequestError.js +19 -8
- package/api/resources/commons/errors/ConflictError.d.ts +2 -1
- package/api/resources/commons/errors/ConflictError.js +19 -8
- package/api/resources/commons/errors/MessageNotFoundError.d.ts +2 -1
- package/api/resources/commons/errors/MessageNotFoundError.js +19 -8
- package/api/resources/commons/errors/NotFoundError.d.ts +2 -1
- package/api/resources/commons/errors/NotFoundError.js +19 -8
- package/api/resources/commons/errors/PaymentRequiredError.d.ts +2 -1
- package/api/resources/commons/errors/PaymentRequiredError.js +19 -8
- package/api/resources/commons/types/ChannelClassification.d.ts +1 -1
- package/api/resources/commons/types/NotificationPreferences.d.ts +1 -1
- package/api/resources/commons/types/PreferenceStatus.d.ts +1 -1
- package/api/resources/inbound/client/Client.d.ts +11 -2
- package/api/resources/inbound/client/Client.js +35 -24
- package/api/resources/index.js +17 -7
- package/api/resources/lists/client/Client.d.ts +51 -44
- package/api/resources/lists/client/Client.js +181 -174
- package/api/resources/lists/client/requests/AddSubscribersToList.d.ts +5 -5
- package/api/resources/lists/client/requests/GetAllListsRequest.d.ts +1 -4
- package/api/resources/lists/client/requests/GetSubscriptionForListRequest.d.ts +1 -3
- package/api/resources/lists/client/requests/SubscribeUserToListRequest.d.ts +1 -4
- package/api/resources/lists/client/requests/SubscribeUsersToListRequest.d.ts +5 -5
- package/api/resources/messages/client/Client.d.ts +26 -29
- package/api/resources/messages/client/Client.js +111 -114
- package/api/resources/messages/client/requests/GetMessageHistoryRequest.d.ts +1 -3
- package/api/resources/messages/client/requests/ListMessagesRequest.d.ts +1 -16
- package/api/resources/messages/types/MessageDetailsExtended.d.ts +7 -0
- package/api/resources/messages/types/MessageDetailsExtended.js +5 -0
- package/api/resources/messages/types/MessageStatus.d.ts +25 -5
- package/api/resources/messages/types/MessageStatus.js +6 -1
- package/api/resources/messages/types/Reason.d.ts +1 -1
- package/api/resources/messages/types/index.d.ts +1 -0
- package/api/resources/messages/types/index.js +1 -0
- package/api/resources/notifications/client/Client.d.ts +32 -17
- package/api/resources/notifications/client/Client.js +119 -93
- package/api/resources/notifications/client/requests/NotificationListParams.d.ts +1 -4
- package/api/resources/notifications/client/requests/SubmissionChecksReplaceParams.d.ts +6 -2
- package/api/resources/notifications/types/BlockType.d.ts +1 -1
- package/api/resources/notifications/types/CheckStatus.d.ts +1 -1
- package/api/resources/notifications/types/MessageRoutingChannel.d.ts +1 -1
- package/api/resources/notifications/types/MessageRoutingMethod.d.ts +1 -1
- package/api/resources/notifications/types/NotificationContent.d.ts +1 -1
- package/api/resources/profiles/client/Client.d.ts +50 -30
- package/api/resources/profiles/client/Client.js +160 -139
- package/api/resources/profiles/client/requests/GetListSubscriptionsRequest.d.ts +1 -3
- package/api/resources/profiles/client/requests/MergeProfileRequest.d.ts +1 -1
- package/api/resources/profiles/client/requests/ReplaceProfileRequest.d.ts +1 -1
- package/api/resources/profiles/types/DeviceType.d.ts +1 -1
- package/api/resources/profiles/types/Discord.d.ts +1 -1
- package/api/resources/profiles/types/Expo.d.ts +1 -1
- package/api/resources/profiles/types/MsTeams.d.ts +1 -1
- package/api/resources/profiles/types/ProfileUpdateRequest.d.ts +8 -0
- package/api/resources/profiles/types/ProfileUpdateRequest.js +5 -0
- package/api/resources/profiles/types/Slack.d.ts +1 -1
- package/api/resources/profiles/types/SnoozeRuleType.d.ts +1 -1
- package/api/resources/profiles/types/UserProfileFirebaseToken.d.ts +1 -1
- package/api/resources/profiles/types/WebhookAuthMode.d.ts +1 -1
- package/api/resources/profiles/types/WebhookMethod.d.ts +1 -1
- package/api/resources/profiles/types/WebhookProfileType.d.ts +1 -1
- package/api/resources/profiles/types/index.d.ts +1 -0
- package/api/resources/profiles/types/index.js +1 -0
- package/api/resources/send/types/Attachment.d.ts +1 -1
- package/api/resources/send/types/ChannelSource.d.ts +1 -1
- package/api/resources/send/types/Content.d.ts +1 -1
- package/api/resources/send/types/Criteria.d.ts +1 -1
- package/api/resources/send/types/ElementalNode.d.ts +1 -1
- package/api/resources/send/types/ExpiresInType.d.ts +1 -1
- package/api/resources/send/types/IActionButtonStyle.d.ts +1 -1
- package/api/resources/send/types/IAlignment.d.ts +1 -1
- package/api/resources/send/types/IPreferences.d.ts +1 -1
- package/api/resources/send/types/InAppPlacement.d.ts +1 -1
- package/api/resources/send/types/Locales.d.ts +1 -1
- package/api/resources/send/types/Message.d.ts +1 -1
- package/api/resources/send/types/MessageChannels.d.ts +1 -1
- package/api/resources/send/types/MessageData.d.ts +1 -1
- package/api/resources/send/types/MessageProviders.d.ts +1 -1
- package/api/resources/send/types/MessageRecipient.d.ts +1 -1
- package/api/resources/send/types/Recipient.d.ts +1 -1
- package/api/resources/send/types/RecipientData.d.ts +1 -1
- package/api/resources/send/types/RoutingChannel.d.ts +1 -1
- package/api/resources/send/types/RoutingMethod.d.ts +1 -1
- package/api/resources/send/types/RuleType.d.ts +1 -1
- package/api/resources/send/types/TextAlign.d.ts +1 -1
- package/api/resources/send/types/TextStyle.d.ts +1 -1
- package/api/resources/templates/client/Client.d.ts +11 -4
- package/api/resources/templates/client/Client.js +34 -25
- package/api/resources/templates/client/requests/ListTemplatesRequest.d.ts +1 -3
- package/api/resources/templates/types/ChannelIdentifier.d.ts +1 -1
- package/api/resources/templates/types/RoutingStrategyMethod.d.ts +1 -1
- package/api/resources/tenants/client/Client.d.ts +37 -44
- package/api/resources/tenants/client/Client.js +130 -135
- package/api/resources/tenants/client/requests/ListTenantParams.d.ts +1 -5
- package/api/resources/tenants/client/requests/ListUsersForTenantParams.d.ts +1 -4
- package/api/resources/tenants/client/requests/TenantCreateOrReplaceParams.d.ts +6 -21
- package/api/resources/tenants/types/SubscriptionTopicStatus.d.ts +1 -1
- package/api/resources/tenants/types/TemplateProperty.d.ts +1 -1
- package/api/resources/translations/client/Client.d.ts +14 -4
- package/api/resources/translations/client/Client.js +49 -37
- package/api/resources/users/client/Client.d.ts +5 -7
- package/api/resources/users/resources/index.js +17 -7
- package/api/resources/users/resources/preferences/client/Client.d.ts +19 -12
- package/api/resources/users/resources/preferences/client/Client.js +77 -59
- package/api/resources/users/resources/preferences/client/requests/UserPreferencesParams.d.ts +1 -3
- package/api/resources/users/resources/preferences/client/requests/UserPreferencesTopicParams.d.ts +1 -3
- package/api/resources/users/resources/preferences/client/requests/UserPreferencesUpdateParams.d.ts +2 -2
- package/api/resources/users/resources/tenants/client/Client.d.ts +33 -26
- package/api/resources/users/resources/tenants/client/Client.js +104 -92
- package/api/resources/users/resources/tenants/client/requests/AddUserToMultipleTenantsParams.d.ts +9 -8
- package/api/resources/users/resources/tenants/client/requests/AddUserToSingleTenantsParams.d.ts +1 -5
- package/api/resources/users/resources/tenants/client/requests/ListTenantsForUserParams.d.ts +1 -4
- package/api/resources/users/resources/tokens/client/Client.d.ts +39 -35
- package/api/resources/users/resources/tokens/client/Client.js +121 -115
- package/api/resources/users/resources/tokens/types/ExpiryDate.d.ts +1 -1
- package/api/resources/users/resources/tokens/types/GetAllTokensResponse.d.ts +1 -1
- package/api/resources/users/resources/tokens/types/PatchOp.d.ts +1 -1
- package/api/resources/users/resources/tokens/types/ProviderKey.d.ts +1 -1
- package/api/resources/users/resources/tokens/types/TokenStatus.d.ts +1 -1
- package/core/auth/BearerToken.d.ts +1 -1
- package/core/fetcher/APIResponse.d.ts +11 -1
- package/core/fetcher/Fetcher.d.ts +7 -3
- package/core/fetcher/Fetcher.js +37 -135
- package/core/fetcher/Headers.d.ts +2 -0
- package/core/fetcher/Headers.js +84 -0
- package/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/core/fetcher/HttpResponsePromise.js +103 -0
- package/core/fetcher/RawResponse.d.ts +29 -0
- package/core/fetcher/RawResponse.js +44 -0
- package/core/fetcher/Supplier.d.ts +1 -1
- package/core/fetcher/createRequestUrl.d.ts +1 -0
- package/core/fetcher/createRequestUrl.js +12 -0
- package/core/fetcher/getFetchFn.d.ts +4 -0
- package/core/fetcher/getFetchFn.js +68 -0
- package/core/fetcher/getHeader.js +1 -2
- package/core/fetcher/getRequestBody.d.ts +7 -0
- package/core/fetcher/getRequestBody.js +23 -0
- package/core/fetcher/getResponseBody.d.ts +1 -0
- package/core/fetcher/getResponseBody.js +54 -0
- package/core/fetcher/index.d.ts +3 -0
- package/core/fetcher/index.js +7 -1
- package/core/fetcher/makeRequest.d.ts +1 -0
- package/core/fetcher/makeRequest.js +42 -0
- package/core/fetcher/requestWithRetries.d.ts +1 -0
- package/core/fetcher/requestWithRetries.js +40 -0
- package/core/fetcher/signals.d.ts +11 -0
- package/core/fetcher/signals.js +36 -0
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +126 -0
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +59 -0
- package/core/index.d.ts +1 -1
- package/core/index.js +1 -1
- package/core/json.d.ts +15 -0
- package/core/json.js +24 -0
- package/core/runtime/runtime.d.ts +2 -1
- package/core/runtime/runtime.js +57 -36
- package/dist/Client.d.ts +49 -108
- package/dist/Client.js +89 -148
- package/dist/api/client/requests/SendMessageRequest.d.ts +8 -76
- package/dist/api/resources/audiences/client/Client.d.ts +26 -21
- package/dist/api/resources/audiences/client/Client.js +97 -90
- package/dist/api/resources/audiences/client/requests/AudienceMembersListParams.d.ts +1 -3
- package/dist/api/resources/audiences/client/requests/AudienceUpdateParams.d.ts +3 -7
- package/dist/api/resources/audiences/client/requests/AudiencesListParams.d.ts +1 -3
- package/dist/api/resources/audiences/types/ComparisonOperator.d.ts +1 -1
- package/dist/api/resources/audiences/types/Filter.d.ts +1 -1
- package/dist/api/resources/audiences/types/FilterConfig.d.ts +1 -1
- package/dist/api/resources/audiences/types/LogicalOperator.d.ts +1 -1
- package/dist/api/resources/audiences/types/Operator.d.ts +1 -1
- package/dist/api/resources/auditEvents/client/Client.d.ts +14 -6
- package/dist/api/resources/auditEvents/client/Client.js +48 -38
- package/dist/api/resources/auditEvents/client/requests/ListAuditEventsRequest.d.ts +1 -3
- package/dist/api/resources/authTokens/client/Client.d.ts +13 -4
- package/dist/api/resources/authTokens/client/Client.js +35 -26
- package/dist/api/resources/authTokens/client/requests/IssueTokenParams.d.ts +2 -2
- package/dist/api/resources/automations/client/Client.d.ts +19 -15
- package/dist/api/resources/automations/client/Client.js +52 -50
- package/dist/api/resources/automations/types/AutomationAddToBatchMaxItemsType.d.ts +1 -1
- package/dist/api/resources/automations/types/AutomationAddToBatchRetainType.d.ts +1 -1
- package/dist/api/resources/automations/types/AutomationAddToBatchScope.d.ts +1 -1
- package/dist/api/resources/automations/types/AutomationFetchDataWebhookMethod.d.ts +1 -1
- package/dist/api/resources/automations/types/AutomationStepOption.d.ts +1 -1
- package/dist/api/resources/automations/types/AutomationThrottleScope.d.ts +1 -1
- package/dist/api/resources/automations/types/MergeAlgorithm.d.ts +1 -1
- package/dist/api/resources/automations/types/Profile.d.ts +1 -1
- package/dist/api/resources/brands/client/Client.d.ts +32 -63
- package/dist/api/resources/brands/client/Client.js +103 -134
- package/dist/api/resources/brands/client/requests/BrandUpdateParameters.d.ts +3 -26
- package/dist/api/resources/brands/client/requests/ListBrandsRequest.d.ts +1 -3
- package/dist/api/resources/bulk/client/Client.d.ts +40 -126
- package/dist/api/resources/bulk/client/Client.js +111 -201
- package/dist/api/resources/bulk/client/requests/BulkCreateJobParams.d.ts +6 -86
- package/dist/api/resources/bulk/client/requests/BulkGetUsersParams.d.ts +1 -3
- package/dist/api/resources/bulk/types/BulkJobStatus.d.ts +1 -1
- package/dist/api/resources/bulk/types/BulkJobUserStatus.d.ts +1 -1
- package/dist/api/resources/bulk/types/InboundBulkMessageV2.d.ts +3 -5
- package/dist/api/resources/commons/errors/AlreadyExistsError.d.ts +2 -1
- package/dist/api/resources/commons/errors/AlreadyExistsError.js +19 -8
- package/dist/api/resources/commons/errors/BadRequestError.d.ts +2 -1
- package/dist/api/resources/commons/errors/BadRequestError.js +19 -8
- package/dist/api/resources/commons/errors/ConflictError.d.ts +2 -1
- package/dist/api/resources/commons/errors/ConflictError.js +19 -8
- package/dist/api/resources/commons/errors/MessageNotFoundError.d.ts +2 -1
- package/dist/api/resources/commons/errors/MessageNotFoundError.js +19 -8
- package/dist/api/resources/commons/errors/NotFoundError.d.ts +2 -1
- package/dist/api/resources/commons/errors/NotFoundError.js +19 -8
- package/dist/api/resources/commons/errors/PaymentRequiredError.d.ts +2 -1
- package/dist/api/resources/commons/errors/PaymentRequiredError.js +19 -8
- package/dist/api/resources/commons/types/ChannelClassification.d.ts +1 -1
- package/dist/api/resources/commons/types/NotificationPreferences.d.ts +1 -1
- package/dist/api/resources/commons/types/PreferenceStatus.d.ts +1 -1
- package/dist/api/resources/inbound/client/Client.d.ts +11 -2
- package/dist/api/resources/inbound/client/Client.js +35 -24
- package/dist/api/resources/index.js +17 -7
- package/dist/api/resources/lists/client/Client.d.ts +51 -44
- package/dist/api/resources/lists/client/Client.js +181 -174
- package/dist/api/resources/lists/client/requests/AddSubscribersToList.d.ts +5 -5
- package/dist/api/resources/lists/client/requests/GetAllListsRequest.d.ts +1 -4
- package/dist/api/resources/lists/client/requests/GetSubscriptionForListRequest.d.ts +1 -3
- package/dist/api/resources/lists/client/requests/SubscribeUserToListRequest.d.ts +1 -4
- package/dist/api/resources/lists/client/requests/SubscribeUsersToListRequest.d.ts +5 -5
- package/dist/api/resources/messages/client/Client.d.ts +26 -29
- package/dist/api/resources/messages/client/Client.js +111 -114
- package/dist/api/resources/messages/client/requests/GetMessageHistoryRequest.d.ts +1 -3
- package/dist/api/resources/messages/client/requests/ListMessagesRequest.d.ts +1 -16
- package/dist/api/resources/messages/types/MessageDetailsExtended.d.ts +7 -0
- package/dist/api/resources/messages/types/MessageDetailsExtended.js +5 -0
- package/dist/api/resources/messages/types/MessageStatus.d.ts +25 -5
- package/dist/api/resources/messages/types/MessageStatus.js +6 -1
- package/dist/api/resources/messages/types/Reason.d.ts +1 -1
- package/dist/api/resources/messages/types/index.d.ts +1 -0
- package/dist/api/resources/messages/types/index.js +1 -0
- package/dist/api/resources/notifications/client/Client.d.ts +32 -17
- package/dist/api/resources/notifications/client/Client.js +119 -93
- package/dist/api/resources/notifications/client/requests/NotificationListParams.d.ts +1 -4
- package/dist/api/resources/notifications/client/requests/SubmissionChecksReplaceParams.d.ts +6 -2
- package/dist/api/resources/notifications/types/BlockType.d.ts +1 -1
- package/dist/api/resources/notifications/types/CheckStatus.d.ts +1 -1
- package/dist/api/resources/notifications/types/MessageRoutingChannel.d.ts +1 -1
- package/dist/api/resources/notifications/types/MessageRoutingMethod.d.ts +1 -1
- package/dist/api/resources/notifications/types/NotificationContent.d.ts +1 -1
- package/dist/api/resources/profiles/client/Client.d.ts +50 -30
- package/dist/api/resources/profiles/client/Client.js +160 -139
- package/dist/api/resources/profiles/client/requests/GetListSubscriptionsRequest.d.ts +1 -3
- package/dist/api/resources/profiles/client/requests/MergeProfileRequest.d.ts +1 -1
- package/dist/api/resources/profiles/client/requests/ReplaceProfileRequest.d.ts +1 -1
- package/dist/api/resources/profiles/types/DeviceType.d.ts +1 -1
- package/dist/api/resources/profiles/types/Discord.d.ts +1 -1
- package/dist/api/resources/profiles/types/Expo.d.ts +1 -1
- package/dist/api/resources/profiles/types/MsTeams.d.ts +1 -1
- package/dist/api/resources/profiles/types/ProfileUpdateRequest.d.ts +8 -0
- package/dist/api/resources/profiles/types/ProfileUpdateRequest.js +5 -0
- package/dist/api/resources/profiles/types/Slack.d.ts +1 -1
- package/dist/api/resources/profiles/types/SnoozeRuleType.d.ts +1 -1
- package/dist/api/resources/profiles/types/UserProfileFirebaseToken.d.ts +1 -1
- package/dist/api/resources/profiles/types/WebhookAuthMode.d.ts +1 -1
- package/dist/api/resources/profiles/types/WebhookMethod.d.ts +1 -1
- package/dist/api/resources/profiles/types/WebhookProfileType.d.ts +1 -1
- package/dist/api/resources/profiles/types/index.d.ts +1 -0
- package/dist/api/resources/profiles/types/index.js +1 -0
- package/dist/api/resources/send/types/Attachment.d.ts +1 -1
- package/dist/api/resources/send/types/ChannelSource.d.ts +1 -1
- package/dist/api/resources/send/types/Content.d.ts +1 -1
- package/dist/api/resources/send/types/Criteria.d.ts +1 -1
- package/dist/api/resources/send/types/ElementalNode.d.ts +1 -1
- package/dist/api/resources/send/types/ExpiresInType.d.ts +1 -1
- package/dist/api/resources/send/types/IActionButtonStyle.d.ts +1 -1
- package/dist/api/resources/send/types/IAlignment.d.ts +1 -1
- package/dist/api/resources/send/types/IPreferences.d.ts +1 -1
- package/dist/api/resources/send/types/InAppPlacement.d.ts +1 -1
- package/dist/api/resources/send/types/Locales.d.ts +1 -1
- package/dist/api/resources/send/types/Message.d.ts +1 -1
- package/dist/api/resources/send/types/MessageChannels.d.ts +1 -1
- package/dist/api/resources/send/types/MessageData.d.ts +1 -1
- package/dist/api/resources/send/types/MessageProviders.d.ts +1 -1
- package/dist/api/resources/send/types/MessageRecipient.d.ts +1 -1
- package/dist/api/resources/send/types/Recipient.d.ts +1 -1
- package/dist/api/resources/send/types/RecipientData.d.ts +1 -1
- package/dist/api/resources/send/types/RoutingChannel.d.ts +1 -1
- package/dist/api/resources/send/types/RoutingMethod.d.ts +1 -1
- package/dist/api/resources/send/types/RuleType.d.ts +1 -1
- package/dist/api/resources/send/types/TextAlign.d.ts +1 -1
- package/dist/api/resources/send/types/TextStyle.d.ts +1 -1
- package/dist/api/resources/templates/client/Client.d.ts +11 -4
- package/dist/api/resources/templates/client/Client.js +34 -25
- package/dist/api/resources/templates/client/requests/ListTemplatesRequest.d.ts +1 -3
- package/dist/api/resources/templates/types/ChannelIdentifier.d.ts +1 -1
- package/dist/api/resources/templates/types/RoutingStrategyMethod.d.ts +1 -1
- package/dist/api/resources/tenants/client/Client.d.ts +37 -44
- package/dist/api/resources/tenants/client/Client.js +130 -135
- package/dist/api/resources/tenants/client/requests/ListTenantParams.d.ts +1 -5
- package/dist/api/resources/tenants/client/requests/ListUsersForTenantParams.d.ts +1 -4
- package/dist/api/resources/tenants/client/requests/TenantCreateOrReplaceParams.d.ts +6 -21
- package/dist/api/resources/tenants/types/SubscriptionTopicStatus.d.ts +1 -1
- package/dist/api/resources/tenants/types/TemplateProperty.d.ts +1 -1
- package/dist/api/resources/translations/client/Client.d.ts +14 -4
- package/dist/api/resources/translations/client/Client.js +49 -37
- package/dist/api/resources/users/client/Client.d.ts +5 -7
- package/dist/api/resources/users/resources/index.js +17 -7
- package/dist/api/resources/users/resources/preferences/client/Client.d.ts +19 -12
- package/dist/api/resources/users/resources/preferences/client/Client.js +77 -59
- package/dist/api/resources/users/resources/preferences/client/requests/UserPreferencesParams.d.ts +1 -3
- package/dist/api/resources/users/resources/preferences/client/requests/UserPreferencesTopicParams.d.ts +1 -3
- package/dist/api/resources/users/resources/preferences/client/requests/UserPreferencesUpdateParams.d.ts +2 -2
- package/dist/api/resources/users/resources/tenants/client/Client.d.ts +33 -26
- package/dist/api/resources/users/resources/tenants/client/Client.js +104 -92
- package/dist/api/resources/users/resources/tenants/client/requests/AddUserToMultipleTenantsParams.d.ts +9 -8
- package/dist/api/resources/users/resources/tenants/client/requests/AddUserToSingleTenantsParams.d.ts +1 -5
- package/dist/api/resources/users/resources/tenants/client/requests/ListTenantsForUserParams.d.ts +1 -4
- package/dist/api/resources/users/resources/tokens/client/Client.d.ts +39 -35
- package/dist/api/resources/users/resources/tokens/client/Client.js +121 -115
- package/dist/api/resources/users/resources/tokens/types/ExpiryDate.d.ts +1 -1
- package/dist/api/resources/users/resources/tokens/types/GetAllTokensResponse.d.ts +1 -1
- package/dist/api/resources/users/resources/tokens/types/PatchOp.d.ts +1 -1
- package/dist/api/resources/users/resources/tokens/types/ProviderKey.d.ts +1 -1
- package/dist/api/resources/users/resources/tokens/types/TokenStatus.d.ts +1 -1
- package/dist/core/auth/BearerToken.d.ts +1 -1
- package/dist/core/fetcher/APIResponse.d.ts +11 -1
- package/dist/core/fetcher/Fetcher.d.ts +7 -3
- package/dist/core/fetcher/Fetcher.js +37 -135
- package/dist/core/fetcher/Headers.d.ts +2 -0
- package/dist/core/fetcher/Headers.js +84 -0
- package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/dist/core/fetcher/HttpResponsePromise.js +103 -0
- package/dist/core/fetcher/RawResponse.d.ts +29 -0
- package/dist/core/fetcher/RawResponse.js +44 -0
- package/dist/core/fetcher/Supplier.d.ts +1 -1
- package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
- package/dist/core/fetcher/createRequestUrl.js +12 -0
- package/dist/core/fetcher/getFetchFn.d.ts +4 -0
- package/dist/core/fetcher/getFetchFn.js +68 -0
- package/dist/core/fetcher/getHeader.js +1 -2
- package/dist/core/fetcher/getRequestBody.d.ts +7 -0
- package/dist/core/fetcher/getRequestBody.js +23 -0
- package/dist/core/fetcher/getResponseBody.d.ts +1 -0
- package/dist/core/fetcher/getResponseBody.js +54 -0
- package/dist/core/fetcher/index.d.ts +3 -0
- package/dist/core/fetcher/index.js +7 -1
- package/dist/core/fetcher/makeRequest.d.ts +1 -0
- package/dist/core/fetcher/makeRequest.js +42 -0
- package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
- package/dist/core/fetcher/requestWithRetries.js +40 -0
- package/dist/core/fetcher/signals.d.ts +11 -0
- package/dist/core/fetcher/signals.js +36 -0
- package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
- package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +126 -0
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +59 -0
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/json.d.ts +15 -0
- package/dist/core/json.js +24 -0
- package/dist/core/runtime/runtime.d.ts +2 -1
- package/dist/core/runtime/runtime.js +57 -36
- package/dist/environments.d.ts +1 -1
- package/dist/errors/CourierError.d.ts +4 -1
- package/dist/errors/CourierError.js +6 -8
- package/dist/errors/CourierTimeoutError.d.ts +1 -1
- package/dist/errors/CourierTimeoutError.js +2 -2
- package/dist/index.js +17 -7
- package/dist/version.d.ts +1 -0
- package/dist/version.js +4 -0
- package/environments.d.ts +1 -1
- package/errors/CourierError.d.ts +4 -1
- package/errors/CourierError.js +6 -8
- package/errors/CourierTimeoutError.d.ts +1 -1
- package/errors/CourierTimeoutError.js +2 -2
- package/index.js +17 -7
- package/{jest.config.js → jest.config.mjs} +4 -1
- package/package.json +25 -15
- package/reference.md +5142 -0
- package/scripts/rename-to-esm-files.js +115 -0
- package/version.d.ts +1 -0
- package/version.js +4 -0
|
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
18
18
|
}) : function(o, v) {
|
|
19
19
|
o["default"] = v;
|
|
20
20
|
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
28
38
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
29
39
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
40
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -55,26 +65,14 @@ class Messages {
|
|
|
55
65
|
* @param {Messages.RequestOptions} requestOptions - Request-specific configuration.
|
|
56
66
|
*
|
|
57
67
|
* @example
|
|
58
|
-
* await
|
|
59
|
-
* archived: true,
|
|
60
|
-
* cursor: "string",
|
|
61
|
-
* event: "string",
|
|
62
|
-
* list: "string",
|
|
63
|
-
* messageId: "string",
|
|
64
|
-
* notification: "string",
|
|
65
|
-
* provider: "string",
|
|
66
|
-
* recipient: "string",
|
|
67
|
-
* status: "string",
|
|
68
|
-
* tag: "string",
|
|
69
|
-
* tags: "string",
|
|
70
|
-
* tenant_id: "string",
|
|
71
|
-
* enqueued_after: "string",
|
|
72
|
-
* traceId: "string"
|
|
73
|
-
* })
|
|
68
|
+
* await client.messages.list()
|
|
74
69
|
*/
|
|
75
70
|
list(request = {}, requestOptions) {
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
72
|
+
}
|
|
73
|
+
__list() {
|
|
74
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
75
|
+
var _a, _b, _c;
|
|
78
76
|
const { archived, cursor, event, list, messageId, notification, provider, recipient, status, tag, tags, tenant_id: tenantId, enqueued_after: enqueuedAfter, traceId, } = request;
|
|
79
77
|
const _queryParams = {};
|
|
80
78
|
if (archived != null) {
|
|
@@ -135,28 +133,24 @@ class Messages {
|
|
|
135
133
|
_queryParams["traceId"] = traceId;
|
|
136
134
|
}
|
|
137
135
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
138
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
136
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CourierEnvironment.Production, "messages"),
|
|
139
137
|
method: "GET",
|
|
140
|
-
headers: {
|
|
141
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
142
|
-
"X-Fern-Language": "JavaScript",
|
|
143
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
144
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
145
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
146
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
147
|
-
},
|
|
138
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.1", "User-Agent": "@trycourier/courier/6.4.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
148
139
|
contentType: "application/json",
|
|
149
140
|
queryParameters: _queryParams,
|
|
141
|
+
requestType: "json",
|
|
150
142
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
151
143
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
144
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
152
145
|
});
|
|
153
146
|
if (_response.ok) {
|
|
154
|
-
return _response.body;
|
|
147
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
155
148
|
}
|
|
156
149
|
if (_response.error.reason === "status-code") {
|
|
157
150
|
throw new errors.CourierError({
|
|
158
151
|
statusCode: _response.error.statusCode,
|
|
159
152
|
body: _response.error.body,
|
|
153
|
+
rawResponse: _response.rawResponse,
|
|
160
154
|
});
|
|
161
155
|
}
|
|
162
156
|
switch (_response.error.reason) {
|
|
@@ -164,12 +158,14 @@ class Messages {
|
|
|
164
158
|
throw new errors.CourierError({
|
|
165
159
|
statusCode: _response.error.statusCode,
|
|
166
160
|
body: _response.error.rawBody,
|
|
161
|
+
rawResponse: _response.rawResponse,
|
|
167
162
|
});
|
|
168
163
|
case "timeout":
|
|
169
|
-
throw new errors.CourierTimeoutError();
|
|
164
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /messages.");
|
|
170
165
|
case "unknown":
|
|
171
166
|
throw new errors.CourierError({
|
|
172
167
|
message: _response.error.errorMessage,
|
|
168
|
+
rawResponse: _response.rawResponse,
|
|
173
169
|
});
|
|
174
170
|
}
|
|
175
171
|
});
|
|
@@ -184,39 +180,38 @@ class Messages {
|
|
|
184
180
|
* @throws {@link Courier.MessageNotFoundError}
|
|
185
181
|
*
|
|
186
182
|
* @example
|
|
187
|
-
* await
|
|
183
|
+
* await client.messages.get("message_id")
|
|
188
184
|
*/
|
|
189
185
|
get(messageId, requestOptions) {
|
|
190
|
-
|
|
186
|
+
return core.HttpResponsePromise.fromPromise(this.__get(messageId, requestOptions));
|
|
187
|
+
}
|
|
188
|
+
__get(messageId, requestOptions) {
|
|
191
189
|
return __awaiter(this, void 0, void 0, function* () {
|
|
190
|
+
var _a, _b, _c;
|
|
192
191
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
193
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
192
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CourierEnvironment.Production, `messages/${encodeURIComponent(messageId)}`),
|
|
194
193
|
method: "GET",
|
|
195
|
-
headers: {
|
|
196
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
197
|
-
"X-Fern-Language": "JavaScript",
|
|
198
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
199
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
200
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
201
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
202
|
-
},
|
|
194
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.1", "User-Agent": "@trycourier/courier/6.4.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
203
195
|
contentType: "application/json",
|
|
196
|
+
requestType: "json",
|
|
204
197
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
205
198
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
199
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
206
200
|
});
|
|
207
201
|
if (_response.ok) {
|
|
208
|
-
return _response.body;
|
|
202
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
209
203
|
}
|
|
210
204
|
if (_response.error.reason === "status-code") {
|
|
211
205
|
switch (_response.error.statusCode) {
|
|
212
206
|
case 400:
|
|
213
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
207
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
214
208
|
case 404:
|
|
215
|
-
throw new Courier.MessageNotFoundError(_response.error.body);
|
|
209
|
+
throw new Courier.MessageNotFoundError(_response.error.body, _response.rawResponse);
|
|
216
210
|
default:
|
|
217
211
|
throw new errors.CourierError({
|
|
218
212
|
statusCode: _response.error.statusCode,
|
|
219
213
|
body: _response.error.body,
|
|
214
|
+
rawResponse: _response.rawResponse,
|
|
220
215
|
});
|
|
221
216
|
}
|
|
222
217
|
}
|
|
@@ -225,12 +220,14 @@ class Messages {
|
|
|
225
220
|
throw new errors.CourierError({
|
|
226
221
|
statusCode: _response.error.statusCode,
|
|
227
222
|
body: _response.error.rawBody,
|
|
223
|
+
rawResponse: _response.rawResponse,
|
|
228
224
|
});
|
|
229
225
|
case "timeout":
|
|
230
|
-
throw new errors.CourierTimeoutError();
|
|
226
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /messages/{message_id}.");
|
|
231
227
|
case "unknown":
|
|
232
228
|
throw new errors.CourierError({
|
|
233
229
|
message: _response.error.errorMessage,
|
|
230
|
+
rawResponse: _response.rawResponse,
|
|
234
231
|
});
|
|
235
232
|
}
|
|
236
233
|
});
|
|
@@ -242,35 +239,32 @@ class Messages {
|
|
|
242
239
|
* @param {Messages.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
243
240
|
*
|
|
244
241
|
* @example
|
|
245
|
-
* await
|
|
242
|
+
* await client.messages.cancel("message_id")
|
|
246
243
|
*/
|
|
247
244
|
cancel(messageId, requestOptions) {
|
|
248
|
-
|
|
245
|
+
return core.HttpResponsePromise.fromPromise(this.__cancel(messageId, requestOptions));
|
|
246
|
+
}
|
|
247
|
+
__cancel(messageId, requestOptions) {
|
|
249
248
|
return __awaiter(this, void 0, void 0, function* () {
|
|
249
|
+
var _a, _b, _c;
|
|
250
250
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
251
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
251
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CourierEnvironment.Production, `messages/${encodeURIComponent(messageId)}/cancel`),
|
|
252
252
|
method: "POST",
|
|
253
|
-
headers: {
|
|
254
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
255
|
-
"X-Fern-Language": "JavaScript",
|
|
256
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
257
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
258
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
259
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
260
|
-
"Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined,
|
|
261
|
-
"X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined,
|
|
262
|
-
},
|
|
253
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.1", "User-Agent": "@trycourier/courier/6.4.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, "Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined, "X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
263
254
|
contentType: "application/json",
|
|
255
|
+
requestType: "json",
|
|
264
256
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
265
257
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
258
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
266
259
|
});
|
|
267
260
|
if (_response.ok) {
|
|
268
|
-
return _response.body;
|
|
261
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
269
262
|
}
|
|
270
263
|
if (_response.error.reason === "status-code") {
|
|
271
264
|
throw new errors.CourierError({
|
|
272
265
|
statusCode: _response.error.statusCode,
|
|
273
266
|
body: _response.error.body,
|
|
267
|
+
rawResponse: _response.rawResponse,
|
|
274
268
|
});
|
|
275
269
|
}
|
|
276
270
|
switch (_response.error.reason) {
|
|
@@ -278,12 +272,14 @@ class Messages {
|
|
|
278
272
|
throw new errors.CourierError({
|
|
279
273
|
statusCode: _response.error.statusCode,
|
|
280
274
|
body: _response.error.rawBody,
|
|
275
|
+
rawResponse: _response.rawResponse,
|
|
281
276
|
});
|
|
282
277
|
case "timeout":
|
|
283
|
-
throw new errors.CourierTimeoutError();
|
|
278
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling POST /messages/{message_id}/cancel.");
|
|
284
279
|
case "unknown":
|
|
285
280
|
throw new errors.CourierError({
|
|
286
281
|
message: _response.error.errorMessage,
|
|
282
|
+
rawResponse: _response.rawResponse,
|
|
287
283
|
});
|
|
288
284
|
}
|
|
289
285
|
});
|
|
@@ -299,47 +295,44 @@ class Messages {
|
|
|
299
295
|
* @throws {@link Courier.MessageNotFoundError}
|
|
300
296
|
*
|
|
301
297
|
* @example
|
|
302
|
-
* await
|
|
303
|
-
* type: "string"
|
|
304
|
-
* })
|
|
298
|
+
* await client.messages.getHistory("message_id")
|
|
305
299
|
*/
|
|
306
300
|
getHistory(messageId, request = {}, requestOptions) {
|
|
307
|
-
|
|
308
|
-
|
|
301
|
+
return core.HttpResponsePromise.fromPromise(this.__getHistory(messageId, request, requestOptions));
|
|
302
|
+
}
|
|
303
|
+
__getHistory(messageId_1) {
|
|
304
|
+
return __awaiter(this, arguments, void 0, function* (messageId, request = {}, requestOptions) {
|
|
305
|
+
var _a, _b, _c;
|
|
309
306
|
const { type: type_ } = request;
|
|
310
307
|
const _queryParams = {};
|
|
311
308
|
if (type_ != null) {
|
|
312
309
|
_queryParams["type"] = type_;
|
|
313
310
|
}
|
|
314
311
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
315
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
312
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CourierEnvironment.Production, `messages/${encodeURIComponent(messageId)}/history`),
|
|
316
313
|
method: "GET",
|
|
317
|
-
headers: {
|
|
318
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
319
|
-
"X-Fern-Language": "JavaScript",
|
|
320
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
321
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
322
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
323
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
324
|
-
},
|
|
314
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.1", "User-Agent": "@trycourier/courier/6.4.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
325
315
|
contentType: "application/json",
|
|
326
316
|
queryParameters: _queryParams,
|
|
317
|
+
requestType: "json",
|
|
327
318
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
328
319
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
320
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
329
321
|
});
|
|
330
322
|
if (_response.ok) {
|
|
331
|
-
return _response.body;
|
|
323
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
332
324
|
}
|
|
333
325
|
if (_response.error.reason === "status-code") {
|
|
334
326
|
switch (_response.error.statusCode) {
|
|
335
327
|
case 400:
|
|
336
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
328
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
337
329
|
case 404:
|
|
338
|
-
throw new Courier.MessageNotFoundError(_response.error.body);
|
|
330
|
+
throw new Courier.MessageNotFoundError(_response.error.body, _response.rawResponse);
|
|
339
331
|
default:
|
|
340
332
|
throw new errors.CourierError({
|
|
341
333
|
statusCode: _response.error.statusCode,
|
|
342
334
|
body: _response.error.body,
|
|
335
|
+
rawResponse: _response.rawResponse,
|
|
343
336
|
});
|
|
344
337
|
}
|
|
345
338
|
}
|
|
@@ -348,12 +341,14 @@ class Messages {
|
|
|
348
341
|
throw new errors.CourierError({
|
|
349
342
|
statusCode: _response.error.statusCode,
|
|
350
343
|
body: _response.error.rawBody,
|
|
344
|
+
rawResponse: _response.rawResponse,
|
|
351
345
|
});
|
|
352
346
|
case "timeout":
|
|
353
|
-
throw new errors.CourierTimeoutError();
|
|
347
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /messages/{message_id}/history.");
|
|
354
348
|
case "unknown":
|
|
355
349
|
throw new errors.CourierError({
|
|
356
350
|
message: _response.error.errorMessage,
|
|
351
|
+
rawResponse: _response.rawResponse,
|
|
357
352
|
});
|
|
358
353
|
}
|
|
359
354
|
});
|
|
@@ -366,39 +361,38 @@ class Messages {
|
|
|
366
361
|
* @throws {@link Courier.MessageNotFoundError}
|
|
367
362
|
*
|
|
368
363
|
* @example
|
|
369
|
-
* await
|
|
364
|
+
* await client.messages.getContent("message_id")
|
|
370
365
|
*/
|
|
371
366
|
getContent(messageId, requestOptions) {
|
|
372
|
-
|
|
367
|
+
return core.HttpResponsePromise.fromPromise(this.__getContent(messageId, requestOptions));
|
|
368
|
+
}
|
|
369
|
+
__getContent(messageId, requestOptions) {
|
|
373
370
|
return __awaiter(this, void 0, void 0, function* () {
|
|
371
|
+
var _a, _b, _c;
|
|
374
372
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
375
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
373
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CourierEnvironment.Production, `messages/${encodeURIComponent(messageId)}/output`),
|
|
376
374
|
method: "GET",
|
|
377
|
-
headers: {
|
|
378
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
379
|
-
"X-Fern-Language": "JavaScript",
|
|
380
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
381
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
382
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
383
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
384
|
-
},
|
|
375
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.1", "User-Agent": "@trycourier/courier/6.4.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
385
376
|
contentType: "application/json",
|
|
377
|
+
requestType: "json",
|
|
386
378
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
387
379
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
380
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
388
381
|
});
|
|
389
382
|
if (_response.ok) {
|
|
390
|
-
return _response.body;
|
|
383
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
391
384
|
}
|
|
392
385
|
if (_response.error.reason === "status-code") {
|
|
393
386
|
switch (_response.error.statusCode) {
|
|
394
387
|
case 400:
|
|
395
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
388
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
396
389
|
case 404:
|
|
397
|
-
throw new Courier.MessageNotFoundError(_response.error.body);
|
|
390
|
+
throw new Courier.MessageNotFoundError(_response.error.body, _response.rawResponse);
|
|
398
391
|
default:
|
|
399
392
|
throw new errors.CourierError({
|
|
400
393
|
statusCode: _response.error.statusCode,
|
|
401
394
|
body: _response.error.body,
|
|
395
|
+
rawResponse: _response.rawResponse,
|
|
402
396
|
});
|
|
403
397
|
}
|
|
404
398
|
}
|
|
@@ -407,12 +401,14 @@ class Messages {
|
|
|
407
401
|
throw new errors.CourierError({
|
|
408
402
|
statusCode: _response.error.statusCode,
|
|
409
403
|
body: _response.error.rawBody,
|
|
404
|
+
rawResponse: _response.rawResponse,
|
|
410
405
|
});
|
|
411
406
|
case "timeout":
|
|
412
|
-
throw new errors.CourierTimeoutError();
|
|
407
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /messages/{message_id}/output.");
|
|
413
408
|
case "unknown":
|
|
414
409
|
throw new errors.CourierError({
|
|
415
410
|
message: _response.error.errorMessage,
|
|
411
|
+
rawResponse: _response.rawResponse,
|
|
416
412
|
});
|
|
417
413
|
}
|
|
418
414
|
});
|
|
@@ -422,33 +418,32 @@ class Messages {
|
|
|
422
418
|
* @param {Messages.RequestOptions} requestOptions - Request-specific configuration.
|
|
423
419
|
*
|
|
424
420
|
* @example
|
|
425
|
-
* await
|
|
421
|
+
* await client.messages.archive("request_id")
|
|
426
422
|
*/
|
|
427
423
|
archive(requestId, requestOptions) {
|
|
428
|
-
|
|
424
|
+
return core.HttpResponsePromise.fromPromise(this.__archive(requestId, requestOptions));
|
|
425
|
+
}
|
|
426
|
+
__archive(requestId, requestOptions) {
|
|
429
427
|
return __awaiter(this, void 0, void 0, function* () {
|
|
428
|
+
var _a, _b, _c;
|
|
430
429
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
431
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
430
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CourierEnvironment.Production, `requests/${encodeURIComponent(requestId)}/archive`),
|
|
432
431
|
method: "PUT",
|
|
433
|
-
headers: {
|
|
434
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
435
|
-
"X-Fern-Language": "JavaScript",
|
|
436
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
437
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
438
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
439
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
440
|
-
},
|
|
432
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.1", "User-Agent": "@trycourier/courier/6.4.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
441
433
|
contentType: "application/json",
|
|
434
|
+
requestType: "json",
|
|
442
435
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
443
436
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
437
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
444
438
|
});
|
|
445
439
|
if (_response.ok) {
|
|
446
|
-
return;
|
|
440
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
447
441
|
}
|
|
448
442
|
if (_response.error.reason === "status-code") {
|
|
449
443
|
throw new errors.CourierError({
|
|
450
444
|
statusCode: _response.error.statusCode,
|
|
451
445
|
body: _response.error.body,
|
|
446
|
+
rawResponse: _response.rawResponse,
|
|
452
447
|
});
|
|
453
448
|
}
|
|
454
449
|
switch (_response.error.reason) {
|
|
@@ -456,23 +451,25 @@ class Messages {
|
|
|
456
451
|
throw new errors.CourierError({
|
|
457
452
|
statusCode: _response.error.statusCode,
|
|
458
453
|
body: _response.error.rawBody,
|
|
454
|
+
rawResponse: _response.rawResponse,
|
|
459
455
|
});
|
|
460
456
|
case "timeout":
|
|
461
|
-
throw new errors.CourierTimeoutError();
|
|
457
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /requests/{request_id}/archive.");
|
|
462
458
|
case "unknown":
|
|
463
459
|
throw new errors.CourierError({
|
|
464
460
|
message: _response.error.errorMessage,
|
|
461
|
+
rawResponse: _response.rawResponse,
|
|
465
462
|
});
|
|
466
463
|
}
|
|
467
464
|
});
|
|
468
465
|
}
|
|
469
466
|
_getAuthorizationHeader() {
|
|
470
|
-
var _a;
|
|
471
467
|
return __awaiter(this, void 0, void 0, function* () {
|
|
468
|
+
var _a;
|
|
472
469
|
const bearer = (_a = (yield core.Supplier.get(this._options.authorizationToken))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["COURIER_AUTH_TOKEN"];
|
|
473
470
|
if (bearer == null) {
|
|
474
471
|
throw new errors.CourierError({
|
|
475
|
-
message: "Please specify
|
|
472
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a COURIER_AUTH_TOKEN environment variable",
|
|
476
473
|
});
|
|
477
474
|
}
|
|
478
475
|
return `Bearer ${bearer}`;
|
|
@@ -3,22 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* @example
|
|
6
|
-
* {
|
|
7
|
-
* archived: true,
|
|
8
|
-
* cursor: "string",
|
|
9
|
-
* event: "string",
|
|
10
|
-
* list: "string",
|
|
11
|
-
* messageId: "string",
|
|
12
|
-
* notification: "string",
|
|
13
|
-
* provider: "string",
|
|
14
|
-
* recipient: "string",
|
|
15
|
-
* status: "string",
|
|
16
|
-
* tag: "string",
|
|
17
|
-
* tags: "string",
|
|
18
|
-
* tenant_id: "string",
|
|
19
|
-
* enqueued_after: "string",
|
|
20
|
-
* traceId: "string"
|
|
21
|
-
* }
|
|
6
|
+
* {}
|
|
22
7
|
*/
|
|
23
8
|
export interface ListMessagesRequest {
|
|
24
9
|
/**
|
|
@@ -1,25 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export type MessageStatus =
|
|
5
|
+
/**
|
|
6
|
+
* The message has been canceled such that it will not be delivered. */
|
|
7
|
+
"CANCELED"
|
|
5
8
|
/**
|
|
6
9
|
* The recipient has clicked on any link in the message at least one time. */
|
|
7
|
-
"CLICKED"
|
|
10
|
+
| "CLICKED"
|
|
11
|
+
/**
|
|
12
|
+
* The message has been delayed and will be attempted for delivery at a later time. */
|
|
13
|
+
| "DELAYED"
|
|
8
14
|
/**
|
|
9
15
|
* The provider successfully delivered the message to the recipient. */
|
|
10
16
|
| "DELIVERED"
|
|
17
|
+
/**
|
|
18
|
+
* The message has been aggregated into a digest and will be sent according to digest rules. */
|
|
19
|
+
| "DIGESTED"
|
|
11
20
|
/**
|
|
12
21
|
* The request has been received to send a message, is waiting in the work queue. */
|
|
13
22
|
| "ENQUEUED"
|
|
23
|
+
/**
|
|
24
|
+
* The message was filtered out based on configured rules or preferences. */
|
|
25
|
+
| "FILTERED"
|
|
14
26
|
/**
|
|
15
27
|
* The recipient has opened the message at least one time. */
|
|
16
28
|
| "OPENED"
|
|
17
29
|
/**
|
|
18
|
-
* The message has been
|
|
19
|
-
| "
|
|
30
|
+
* The message has been successfully routed to a specific channel or provider. */
|
|
31
|
+
| "ROUTED"
|
|
20
32
|
/**
|
|
21
33
|
* The message has been accepted by the provider. */
|
|
22
34
|
| "SENT"
|
|
35
|
+
/**
|
|
36
|
+
* The message was sent with a mock key and Courier simulated the message lifecycle without sending to the downstream provider. */
|
|
37
|
+
| "SIMULATED"
|
|
23
38
|
/**
|
|
24
39
|
* The message was throttled by Courier. */
|
|
25
40
|
| "THROTTLED"
|
|
@@ -33,12 +48,17 @@ export declare type MessageStatus =
|
|
|
33
48
|
* The message could not be routed to any channel or provider. This can happen for multiple reasons: insufficient profile data, invalid notification setup, invalid integration configuration, etc. */
|
|
34
49
|
| "UNROUTABLE";
|
|
35
50
|
export declare const MessageStatus: {
|
|
51
|
+
readonly Canceled: "CANCELED";
|
|
36
52
|
readonly Clicked: "CLICKED";
|
|
53
|
+
readonly Delayed: "DELAYED";
|
|
37
54
|
readonly Delivered: "DELIVERED";
|
|
55
|
+
readonly Digested: "DIGESTED";
|
|
38
56
|
readonly Enqueued: "ENQUEUED";
|
|
57
|
+
readonly Filtered: "FILTERED";
|
|
39
58
|
readonly Opened: "OPENED";
|
|
40
|
-
readonly
|
|
59
|
+
readonly Routed: "ROUTED";
|
|
41
60
|
readonly Sent: "SENT";
|
|
61
|
+
readonly Simulated: "SIMULATED";
|
|
42
62
|
readonly Throttled: "THROTTLED";
|
|
43
63
|
readonly Undeliverable: "UNDELIVERABLE";
|
|
44
64
|
readonly Unmapped: "UNMAPPED";
|
|
@@ -5,12 +5,17 @@
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.MessageStatus = void 0;
|
|
7
7
|
exports.MessageStatus = {
|
|
8
|
+
Canceled: "CANCELED",
|
|
8
9
|
Clicked: "CLICKED",
|
|
10
|
+
Delayed: "DELAYED",
|
|
9
11
|
Delivered: "DELIVERED",
|
|
12
|
+
Digested: "DIGESTED",
|
|
10
13
|
Enqueued: "ENQUEUED",
|
|
14
|
+
Filtered: "FILTERED",
|
|
11
15
|
Opened: "OPENED",
|
|
12
|
-
|
|
16
|
+
Routed: "ROUTED",
|
|
13
17
|
Sent: "SENT",
|
|
18
|
+
Simulated: "SIMULATED",
|
|
14
19
|
Throttled: "THROTTLED",
|
|
15
20
|
Undeliverable: "UNDELIVERABLE",
|
|
16
21
|
Unmapped: "UNMAPPED",
|
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./MessageStatus"), exports);
|
|
18
18
|
__exportStar(require("./MessageDetails"), exports);
|
|
19
|
+
__exportStar(require("./MessageDetailsExtended"), exports);
|
|
19
20
|
__exportStar(require("./Reason"), exports);
|
|
20
21
|
__exportStar(require("./ListMessagesResponse"), exports);
|
|
21
22
|
__exportStar(require("./MessageHistoryResponse"), exports);
|