@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,129 +65,46 @@ class Bulk {
|
|
|
55
65
|
* @throws {@link Courier.BadRequestError}
|
|
56
66
|
*
|
|
57
67
|
* @example
|
|
58
|
-
* await
|
|
68
|
+
* await client.bulk.createJob({
|
|
59
69
|
* message: {
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* },
|
|
67
|
-
* brand_id: "string",
|
|
68
|
-
* channels: {
|
|
69
|
-
* "string": {
|
|
70
|
-
* brand_id: undefined,
|
|
71
|
-
* providers: undefined,
|
|
72
|
-
* routing_method: undefined,
|
|
73
|
-
* if: undefined,
|
|
74
|
-
* timeouts: undefined,
|
|
75
|
-
* override: undefined,
|
|
76
|
-
* metadata: undefined
|
|
77
|
-
* }
|
|
78
|
-
* },
|
|
79
|
-
* context: {
|
|
80
|
-
* tenant_id: "string"
|
|
81
|
-
* },
|
|
82
|
-
* metadata: {
|
|
83
|
-
* event: "string",
|
|
84
|
-
* tags: [],
|
|
85
|
-
* utm: {
|
|
86
|
-
* source: undefined,
|
|
87
|
-
* medium: undefined,
|
|
88
|
-
* campaign: undefined,
|
|
89
|
-
* term: undefined,
|
|
90
|
-
* content: undefined
|
|
91
|
-
* },
|
|
92
|
-
* trace_id: "string"
|
|
93
|
-
* },
|
|
94
|
-
* preferences: {
|
|
95
|
-
* subscription_topic_id: "string"
|
|
96
|
-
* },
|
|
97
|
-
* providers: {
|
|
98
|
-
* "string": {
|
|
99
|
-
* override: undefined,
|
|
100
|
-
* if: undefined,
|
|
101
|
-
* timeouts: undefined,
|
|
102
|
-
* metadata: undefined
|
|
103
|
-
* }
|
|
104
|
-
* },
|
|
105
|
-
* routing: {
|
|
106
|
-
* method: Courier.RoutingMethod.All,
|
|
107
|
-
* channels: [{
|
|
108
|
-
* channel: "string",
|
|
109
|
-
* config: undefined,
|
|
110
|
-
* method: undefined,
|
|
111
|
-
* providers: undefined,
|
|
112
|
-
* if: undefined
|
|
113
|
-
* }]
|
|
114
|
-
* },
|
|
115
|
-
* timeout: {
|
|
116
|
-
* provider: {},
|
|
117
|
-
* channel: {},
|
|
118
|
-
* message: 1,
|
|
119
|
-
* escalation: 1,
|
|
120
|
-
* criteria: Courier.Criteria.NoEscalation
|
|
121
|
-
* },
|
|
122
|
-
* delay: {
|
|
123
|
-
* duration: 1,
|
|
124
|
-
* until: "string"
|
|
125
|
-
* },
|
|
126
|
-
* expiry: {
|
|
127
|
-
* expires_at: "string",
|
|
128
|
-
* expires_in: "string"
|
|
129
|
-
* }
|
|
130
|
-
* },
|
|
131
|
-
* brand: "string",
|
|
132
|
-
* data: {
|
|
133
|
-
* "string": {
|
|
134
|
-
* "key": "value"
|
|
135
|
-
* }
|
|
136
|
-
* },
|
|
137
|
-
* event: "string",
|
|
138
|
-
* locale: {
|
|
139
|
-
* "string": {
|
|
140
|
-
* "key": "value"
|
|
141
|
-
* }
|
|
142
|
-
* },
|
|
143
|
-
* override: {
|
|
144
|
-
* "key": "value"
|
|
145
|
-
* }
|
|
70
|
+
* brand: undefined,
|
|
71
|
+
* data: undefined,
|
|
72
|
+
* event: undefined,
|
|
73
|
+
* locale: undefined,
|
|
74
|
+
* override: undefined,
|
|
75
|
+
* message: undefined
|
|
146
76
|
* }
|
|
147
77
|
* })
|
|
148
78
|
*/
|
|
149
79
|
createJob(request, requestOptions) {
|
|
150
|
-
|
|
80
|
+
return core.HttpResponsePromise.fromPromise(this.__createJob(request, requestOptions));
|
|
81
|
+
}
|
|
82
|
+
__createJob(request, requestOptions) {
|
|
151
83
|
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
var _a, _b, _c;
|
|
152
85
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
153
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
86
|
+
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, "/bulk"),
|
|
154
87
|
method: "POST",
|
|
155
|
-
headers: {
|
|
156
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
157
|
-
"X-Fern-Language": "JavaScript",
|
|
158
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
159
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
160
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
161
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
162
|
-
"Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined,
|
|
163
|
-
"X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined,
|
|
164
|
-
},
|
|
88
|
+
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),
|
|
165
89
|
contentType: "application/json",
|
|
90
|
+
requestType: "json",
|
|
166
91
|
body: request,
|
|
167
92
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
168
93
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
94
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
169
95
|
});
|
|
170
96
|
if (_response.ok) {
|
|
171
|
-
return _response.body;
|
|
97
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
172
98
|
}
|
|
173
99
|
if (_response.error.reason === "status-code") {
|
|
174
100
|
switch (_response.error.statusCode) {
|
|
175
101
|
case 400:
|
|
176
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
102
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
177
103
|
default:
|
|
178
104
|
throw new errors.CourierError({
|
|
179
105
|
statusCode: _response.error.statusCode,
|
|
180
106
|
body: _response.error.body,
|
|
107
|
+
rawResponse: _response.rawResponse,
|
|
181
108
|
});
|
|
182
109
|
}
|
|
183
110
|
}
|
|
@@ -186,12 +113,14 @@ class Bulk {
|
|
|
186
113
|
throw new errors.CourierError({
|
|
187
114
|
statusCode: _response.error.statusCode,
|
|
188
115
|
body: _response.error.rawBody,
|
|
116
|
+
rawResponse: _response.rawResponse,
|
|
189
117
|
});
|
|
190
118
|
case "timeout":
|
|
191
|
-
throw new errors.CourierTimeoutError();
|
|
119
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling POST /bulk.");
|
|
192
120
|
case "unknown":
|
|
193
121
|
throw new errors.CourierError({
|
|
194
122
|
message: _response.error.errorMessage,
|
|
123
|
+
rawResponse: _response.rawResponse,
|
|
195
124
|
});
|
|
196
125
|
}
|
|
197
126
|
});
|
|
@@ -204,67 +133,47 @@ class Bulk {
|
|
|
204
133
|
* @param {Bulk.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
205
134
|
*
|
|
206
135
|
* @example
|
|
207
|
-
* await
|
|
136
|
+
* await client.bulk.ingestUsers("job_id", {
|
|
208
137
|
* users: [{
|
|
209
|
-
* preferences:
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
* to: {
|
|
221
|
-
* account_id: "string",
|
|
222
|
-
* context: {
|
|
223
|
-
* tenant_id: "string"
|
|
224
|
-
* },
|
|
225
|
-
* data: {},
|
|
226
|
-
* email: "string",
|
|
227
|
-
* locale: "string",
|
|
228
|
-
* user_id: "string",
|
|
229
|
-
* phone_number: "string",
|
|
230
|
-
* preferences: {
|
|
231
|
-
* categories: undefined,
|
|
232
|
-
* notifications: {},
|
|
233
|
-
* templateId: undefined
|
|
234
|
-
* },
|
|
235
|
-
* tenant_id: "string"
|
|
236
|
-
* }
|
|
138
|
+
* preferences: undefined,
|
|
139
|
+
* profile: undefined,
|
|
140
|
+
* recipient: undefined,
|
|
141
|
+
* data: undefined,
|
|
142
|
+
* to: undefined
|
|
143
|
+
* }, {
|
|
144
|
+
* preferences: undefined,
|
|
145
|
+
* profile: undefined,
|
|
146
|
+
* recipient: undefined,
|
|
147
|
+
* data: undefined,
|
|
148
|
+
* to: undefined
|
|
237
149
|
* }]
|
|
238
150
|
* })
|
|
239
151
|
*/
|
|
240
152
|
ingestUsers(jobId, request, requestOptions) {
|
|
241
|
-
|
|
153
|
+
return core.HttpResponsePromise.fromPromise(this.__ingestUsers(jobId, request, requestOptions));
|
|
154
|
+
}
|
|
155
|
+
__ingestUsers(jobId, request, requestOptions) {
|
|
242
156
|
return __awaiter(this, void 0, void 0, function* () {
|
|
157
|
+
var _a, _b, _c;
|
|
243
158
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
244
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
159
|
+
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, `/bulk/${encodeURIComponent(jobId)}`),
|
|
245
160
|
method: "POST",
|
|
246
|
-
headers: {
|
|
247
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
248
|
-
"X-Fern-Language": "JavaScript",
|
|
249
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
250
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
251
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
252
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
253
|
-
"Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined,
|
|
254
|
-
"X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined,
|
|
255
|
-
},
|
|
161
|
+
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),
|
|
256
162
|
contentType: "application/json",
|
|
163
|
+
requestType: "json",
|
|
257
164
|
body: request,
|
|
258
165
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
259
166
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
167
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
260
168
|
});
|
|
261
169
|
if (_response.ok) {
|
|
262
|
-
return;
|
|
170
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
263
171
|
}
|
|
264
172
|
if (_response.error.reason === "status-code") {
|
|
265
173
|
throw new errors.CourierError({
|
|
266
174
|
statusCode: _response.error.statusCode,
|
|
267
175
|
body: _response.error.body,
|
|
176
|
+
rawResponse: _response.rawResponse,
|
|
268
177
|
});
|
|
269
178
|
}
|
|
270
179
|
switch (_response.error.reason) {
|
|
@@ -272,12 +181,14 @@ class Bulk {
|
|
|
272
181
|
throw new errors.CourierError({
|
|
273
182
|
statusCode: _response.error.statusCode,
|
|
274
183
|
body: _response.error.rawBody,
|
|
184
|
+
rawResponse: _response.rawResponse,
|
|
275
185
|
});
|
|
276
186
|
case "timeout":
|
|
277
|
-
throw new errors.CourierTimeoutError();
|
|
187
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling POST /bulk/{job_id}.");
|
|
278
188
|
case "unknown":
|
|
279
189
|
throw new errors.CourierError({
|
|
280
190
|
message: _response.error.errorMessage,
|
|
191
|
+
rawResponse: _response.rawResponse,
|
|
281
192
|
});
|
|
282
193
|
}
|
|
283
194
|
});
|
|
@@ -291,39 +202,36 @@ class Bulk {
|
|
|
291
202
|
* @throws {@link Courier.BadRequestError}
|
|
292
203
|
*
|
|
293
204
|
* @example
|
|
294
|
-
* await
|
|
205
|
+
* await client.bulk.runJob("job_id")
|
|
295
206
|
*/
|
|
296
207
|
runJob(jobId, requestOptions) {
|
|
297
|
-
|
|
208
|
+
return core.HttpResponsePromise.fromPromise(this.__runJob(jobId, requestOptions));
|
|
209
|
+
}
|
|
210
|
+
__runJob(jobId, requestOptions) {
|
|
298
211
|
return __awaiter(this, void 0, void 0, function* () {
|
|
212
|
+
var _a, _b, _c;
|
|
299
213
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
300
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
214
|
+
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, `/bulk/${encodeURIComponent(jobId)}/run`),
|
|
301
215
|
method: "POST",
|
|
302
|
-
headers: {
|
|
303
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
304
|
-
"X-Fern-Language": "JavaScript",
|
|
305
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
306
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
307
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
308
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
309
|
-
"Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined,
|
|
310
|
-
"X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined,
|
|
311
|
-
},
|
|
216
|
+
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),
|
|
312
217
|
contentType: "application/json",
|
|
218
|
+
requestType: "json",
|
|
313
219
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
314
220
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
221
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
315
222
|
});
|
|
316
223
|
if (_response.ok) {
|
|
317
|
-
return;
|
|
224
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
318
225
|
}
|
|
319
226
|
if (_response.error.reason === "status-code") {
|
|
320
227
|
switch (_response.error.statusCode) {
|
|
321
228
|
case 400:
|
|
322
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
229
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
323
230
|
default:
|
|
324
231
|
throw new errors.CourierError({
|
|
325
232
|
statusCode: _response.error.statusCode,
|
|
326
233
|
body: _response.error.body,
|
|
234
|
+
rawResponse: _response.rawResponse,
|
|
327
235
|
});
|
|
328
236
|
}
|
|
329
237
|
}
|
|
@@ -332,12 +240,14 @@ class Bulk {
|
|
|
332
240
|
throw new errors.CourierError({
|
|
333
241
|
statusCode: _response.error.statusCode,
|
|
334
242
|
body: _response.error.rawBody,
|
|
243
|
+
rawResponse: _response.rawResponse,
|
|
335
244
|
});
|
|
336
245
|
case "timeout":
|
|
337
|
-
throw new errors.CourierTimeoutError();
|
|
246
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling POST /bulk/{job_id}/run.");
|
|
338
247
|
case "unknown":
|
|
339
248
|
throw new errors.CourierError({
|
|
340
249
|
message: _response.error.errorMessage,
|
|
250
|
+
rawResponse: _response.rawResponse,
|
|
341
251
|
});
|
|
342
252
|
}
|
|
343
253
|
});
|
|
@@ -351,37 +261,36 @@ class Bulk {
|
|
|
351
261
|
* @throws {@link Courier.BadRequestError}
|
|
352
262
|
*
|
|
353
263
|
* @example
|
|
354
|
-
* await
|
|
264
|
+
* await client.bulk.getJob("job_id")
|
|
355
265
|
*/
|
|
356
266
|
getJob(jobId, requestOptions) {
|
|
357
|
-
|
|
267
|
+
return core.HttpResponsePromise.fromPromise(this.__getJob(jobId, requestOptions));
|
|
268
|
+
}
|
|
269
|
+
__getJob(jobId, requestOptions) {
|
|
358
270
|
return __awaiter(this, void 0, void 0, function* () {
|
|
271
|
+
var _a, _b, _c;
|
|
359
272
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
360
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
273
|
+
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, `/bulk/${encodeURIComponent(jobId)}`),
|
|
361
274
|
method: "GET",
|
|
362
|
-
headers: {
|
|
363
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
364
|
-
"X-Fern-Language": "JavaScript",
|
|
365
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
366
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
367
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
368
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
369
|
-
},
|
|
275
|
+
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),
|
|
370
276
|
contentType: "application/json",
|
|
277
|
+
requestType: "json",
|
|
371
278
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
372
279
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
280
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
373
281
|
});
|
|
374
282
|
if (_response.ok) {
|
|
375
|
-
return _response.body;
|
|
283
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
376
284
|
}
|
|
377
285
|
if (_response.error.reason === "status-code") {
|
|
378
286
|
switch (_response.error.statusCode) {
|
|
379
287
|
case 400:
|
|
380
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
288
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
381
289
|
default:
|
|
382
290
|
throw new errors.CourierError({
|
|
383
291
|
statusCode: _response.error.statusCode,
|
|
384
292
|
body: _response.error.body,
|
|
293
|
+
rawResponse: _response.rawResponse,
|
|
385
294
|
});
|
|
386
295
|
}
|
|
387
296
|
}
|
|
@@ -390,12 +299,14 @@ class Bulk {
|
|
|
390
299
|
throw new errors.CourierError({
|
|
391
300
|
statusCode: _response.error.statusCode,
|
|
392
301
|
body: _response.error.rawBody,
|
|
302
|
+
rawResponse: _response.rawResponse,
|
|
393
303
|
});
|
|
394
304
|
case "timeout":
|
|
395
|
-
throw new errors.CourierTimeoutError();
|
|
305
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /bulk/{job_id}.");
|
|
396
306
|
case "unknown":
|
|
397
307
|
throw new errors.CourierError({
|
|
398
308
|
message: _response.error.errorMessage,
|
|
309
|
+
rawResponse: _response.rawResponse,
|
|
399
310
|
});
|
|
400
311
|
}
|
|
401
312
|
});
|
|
@@ -410,45 +321,42 @@ class Bulk {
|
|
|
410
321
|
* @throws {@link Courier.BadRequestError}
|
|
411
322
|
*
|
|
412
323
|
* @example
|
|
413
|
-
* await
|
|
414
|
-
* cursor: "string"
|
|
415
|
-
* })
|
|
324
|
+
* await client.bulk.getUsers("job_id")
|
|
416
325
|
*/
|
|
417
326
|
getUsers(jobId, request = {}, requestOptions) {
|
|
418
|
-
|
|
419
|
-
|
|
327
|
+
return core.HttpResponsePromise.fromPromise(this.__getUsers(jobId, request, requestOptions));
|
|
328
|
+
}
|
|
329
|
+
__getUsers(jobId_1) {
|
|
330
|
+
return __awaiter(this, arguments, void 0, function* (jobId, request = {}, requestOptions) {
|
|
331
|
+
var _a, _b, _c;
|
|
420
332
|
const { cursor } = request;
|
|
421
333
|
const _queryParams = {};
|
|
422
334
|
if (cursor != null) {
|
|
423
335
|
_queryParams["cursor"] = cursor;
|
|
424
336
|
}
|
|
425
337
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
426
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
338
|
+
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, `/bulk/${encodeURIComponent(jobId)}/users`),
|
|
427
339
|
method: "GET",
|
|
428
|
-
headers: {
|
|
429
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
430
|
-
"X-Fern-Language": "JavaScript",
|
|
431
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
432
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
433
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
434
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
435
|
-
},
|
|
340
|
+
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),
|
|
436
341
|
contentType: "application/json",
|
|
437
342
|
queryParameters: _queryParams,
|
|
343
|
+
requestType: "json",
|
|
438
344
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
439
345
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
346
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
440
347
|
});
|
|
441
348
|
if (_response.ok) {
|
|
442
|
-
return _response.body;
|
|
349
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
443
350
|
}
|
|
444
351
|
if (_response.error.reason === "status-code") {
|
|
445
352
|
switch (_response.error.statusCode) {
|
|
446
353
|
case 400:
|
|
447
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
354
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
448
355
|
default:
|
|
449
356
|
throw new errors.CourierError({
|
|
450
357
|
statusCode: _response.error.statusCode,
|
|
451
358
|
body: _response.error.body,
|
|
359
|
+
rawResponse: _response.rawResponse,
|
|
452
360
|
});
|
|
453
361
|
}
|
|
454
362
|
}
|
|
@@ -457,23 +365,25 @@ class Bulk {
|
|
|
457
365
|
throw new errors.CourierError({
|
|
458
366
|
statusCode: _response.error.statusCode,
|
|
459
367
|
body: _response.error.rawBody,
|
|
368
|
+
rawResponse: _response.rawResponse,
|
|
460
369
|
});
|
|
461
370
|
case "timeout":
|
|
462
|
-
throw new errors.CourierTimeoutError();
|
|
371
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /bulk/{job_id}/users.");
|
|
463
372
|
case "unknown":
|
|
464
373
|
throw new errors.CourierError({
|
|
465
374
|
message: _response.error.errorMessage,
|
|
375
|
+
rawResponse: _response.rawResponse,
|
|
466
376
|
});
|
|
467
377
|
}
|
|
468
378
|
});
|
|
469
379
|
}
|
|
470
380
|
_getAuthorizationHeader() {
|
|
471
|
-
var _a;
|
|
472
381
|
return __awaiter(this, void 0, void 0, function* () {
|
|
382
|
+
var _a;
|
|
473
383
|
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"];
|
|
474
384
|
if (bearer == null) {
|
|
475
385
|
throw new errors.CourierError({
|
|
476
|
-
message: "Please specify
|
|
386
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a COURIER_AUTH_TOKEN environment variable",
|
|
477
387
|
});
|
|
478
388
|
}
|
|
479
389
|
return `Bearer ${bearer}`;
|
|
@@ -6,92 +6,12 @@ import * as Courier from "../../../../index";
|
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
8
|
* message: {
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* },
|
|
16
|
-
* brand_id: "string",
|
|
17
|
-
* channels: {
|
|
18
|
-
* "string": {
|
|
19
|
-
* brand_id: undefined,
|
|
20
|
-
* providers: undefined,
|
|
21
|
-
* routing_method: undefined,
|
|
22
|
-
* if: undefined,
|
|
23
|
-
* timeouts: undefined,
|
|
24
|
-
* override: undefined,
|
|
25
|
-
* metadata: undefined
|
|
26
|
-
* }
|
|
27
|
-
* },
|
|
28
|
-
* context: {
|
|
29
|
-
* tenant_id: "string"
|
|
30
|
-
* },
|
|
31
|
-
* metadata: {
|
|
32
|
-
* event: "string",
|
|
33
|
-
* tags: [],
|
|
34
|
-
* utm: {
|
|
35
|
-
* source: undefined,
|
|
36
|
-
* medium: undefined,
|
|
37
|
-
* campaign: undefined,
|
|
38
|
-
* term: undefined,
|
|
39
|
-
* content: undefined
|
|
40
|
-
* },
|
|
41
|
-
* trace_id: "string"
|
|
42
|
-
* },
|
|
43
|
-
* preferences: {
|
|
44
|
-
* subscription_topic_id: "string"
|
|
45
|
-
* },
|
|
46
|
-
* providers: {
|
|
47
|
-
* "string": {
|
|
48
|
-
* override: undefined,
|
|
49
|
-
* if: undefined,
|
|
50
|
-
* timeouts: undefined,
|
|
51
|
-
* metadata: undefined
|
|
52
|
-
* }
|
|
53
|
-
* },
|
|
54
|
-
* routing: {
|
|
55
|
-
* method: Courier.RoutingMethod.All,
|
|
56
|
-
* channels: [{
|
|
57
|
-
* channel: "string",
|
|
58
|
-
* config: undefined,
|
|
59
|
-
* method: undefined,
|
|
60
|
-
* providers: undefined,
|
|
61
|
-
* if: undefined
|
|
62
|
-
* }]
|
|
63
|
-
* },
|
|
64
|
-
* timeout: {
|
|
65
|
-
* provider: {},
|
|
66
|
-
* channel: {},
|
|
67
|
-
* message: 1,
|
|
68
|
-
* escalation: 1,
|
|
69
|
-
* criteria: Courier.Criteria.NoEscalation
|
|
70
|
-
* },
|
|
71
|
-
* delay: {
|
|
72
|
-
* duration: 1,
|
|
73
|
-
* until: "string"
|
|
74
|
-
* },
|
|
75
|
-
* expiry: {
|
|
76
|
-
* expires_at: "string",
|
|
77
|
-
* expires_in: "string"
|
|
78
|
-
* }
|
|
79
|
-
* },
|
|
80
|
-
* brand: "string",
|
|
81
|
-
* data: {
|
|
82
|
-
* "string": {
|
|
83
|
-
* "key": "value"
|
|
84
|
-
* }
|
|
85
|
-
* },
|
|
86
|
-
* event: "string",
|
|
87
|
-
* locale: {
|
|
88
|
-
* "string": {
|
|
89
|
-
* "key": "value"
|
|
90
|
-
* }
|
|
91
|
-
* },
|
|
92
|
-
* override: {
|
|
93
|
-
* "key": "value"
|
|
94
|
-
* }
|
|
9
|
+
* brand: undefined,
|
|
10
|
+
* data: undefined,
|
|
11
|
+
* event: undefined,
|
|
12
|
+
* locale: undefined,
|
|
13
|
+
* override: undefined,
|
|
14
|
+
* message: undefined
|
|
95
15
|
* }
|
|
96
16
|
* }
|
|
97
17
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export type BulkJobStatus = "CREATED" | "PROCESSING" | "COMPLETED" | "ERROR";
|
|
5
5
|
export declare const BulkJobStatus: {
|
|
6
6
|
readonly Created: "CREATED";
|
|
7
7
|
readonly Processing: "PROCESSING";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export type BulkJobUserStatus = "PENDING" | "ENQUEUED" | "ERROR";
|
|
5
5
|
export declare const BulkJobUserStatus: {
|
|
6
6
|
readonly Pending: "PENDING";
|
|
7
7
|
readonly Enqueued: "ENQUEUED";
|