@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) {
|
|
@@ -56,60 +66,44 @@ class Tenants {
|
|
|
56
66
|
* @throws {@link Courier.BadRequestError}
|
|
57
67
|
*
|
|
58
68
|
* @example
|
|
59
|
-
* await
|
|
60
|
-
* name: "
|
|
61
|
-
* parent_tenant_id:
|
|
62
|
-
* default_preferences:
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* has_custom_routing: undefined,
|
|
67
|
-
* custom_routing: undefined
|
|
68
|
-
* }]
|
|
69
|
-
* },
|
|
70
|
-
* properties: {
|
|
71
|
-
* "string": {
|
|
72
|
-
* "key": "value"
|
|
73
|
-
* }
|
|
74
|
-
* },
|
|
75
|
-
* user_profile: {
|
|
76
|
-
* "string": {
|
|
77
|
-
* "key": "value"
|
|
78
|
-
* }
|
|
79
|
-
* },
|
|
80
|
-
* brand_id: "string"
|
|
69
|
+
* await client.tenants.createOrReplace("tenant_id", {
|
|
70
|
+
* name: "name",
|
|
71
|
+
* parent_tenant_id: undefined,
|
|
72
|
+
* default_preferences: undefined,
|
|
73
|
+
* properties: undefined,
|
|
74
|
+
* user_profile: undefined,
|
|
75
|
+
* brand_id: undefined
|
|
81
76
|
* })
|
|
82
77
|
*/
|
|
83
78
|
createOrReplace(tenantId, request, requestOptions) {
|
|
84
|
-
|
|
79
|
+
return core.HttpResponsePromise.fromPromise(this.__createOrReplace(tenantId, request, requestOptions));
|
|
80
|
+
}
|
|
81
|
+
__createOrReplace(tenantId, request, requestOptions) {
|
|
85
82
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
var _a, _b, _c;
|
|
86
84
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
87
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
85
|
+
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, `/tenants/${encodeURIComponent(tenantId)}`),
|
|
88
86
|
method: "PUT",
|
|
89
|
-
headers: {
|
|
90
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
91
|
-
"X-Fern-Language": "JavaScript",
|
|
92
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
93
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
94
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
95
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
96
|
-
},
|
|
87
|
+
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),
|
|
97
88
|
contentType: "application/json",
|
|
89
|
+
requestType: "json",
|
|
98
90
|
body: request,
|
|
99
91
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
100
92
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
93
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
101
94
|
});
|
|
102
95
|
if (_response.ok) {
|
|
103
|
-
return _response.body;
|
|
96
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
104
97
|
}
|
|
105
98
|
if (_response.error.reason === "status-code") {
|
|
106
99
|
switch (_response.error.statusCode) {
|
|
107
100
|
case 400:
|
|
108
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
101
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
109
102
|
default:
|
|
110
103
|
throw new errors.CourierError({
|
|
111
104
|
statusCode: _response.error.statusCode,
|
|
112
105
|
body: _response.error.body,
|
|
106
|
+
rawResponse: _response.rawResponse,
|
|
113
107
|
});
|
|
114
108
|
}
|
|
115
109
|
}
|
|
@@ -118,12 +112,14 @@ class Tenants {
|
|
|
118
112
|
throw new errors.CourierError({
|
|
119
113
|
statusCode: _response.error.statusCode,
|
|
120
114
|
body: _response.error.rawBody,
|
|
115
|
+
rawResponse: _response.rawResponse,
|
|
121
116
|
});
|
|
122
117
|
case "timeout":
|
|
123
|
-
throw new errors.CourierTimeoutError();
|
|
118
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /tenants/{tenant_id}.");
|
|
124
119
|
case "unknown":
|
|
125
120
|
throw new errors.CourierError({
|
|
126
121
|
message: _response.error.errorMessage,
|
|
122
|
+
rawResponse: _response.rawResponse,
|
|
127
123
|
});
|
|
128
124
|
}
|
|
129
125
|
});
|
|
@@ -135,37 +131,36 @@ class Tenants {
|
|
|
135
131
|
* @throws {@link Courier.BadRequestError}
|
|
136
132
|
*
|
|
137
133
|
* @example
|
|
138
|
-
* await
|
|
134
|
+
* await client.tenants.get("tenant_id")
|
|
139
135
|
*/
|
|
140
136
|
get(tenantId, requestOptions) {
|
|
141
|
-
|
|
137
|
+
return core.HttpResponsePromise.fromPromise(this.__get(tenantId, requestOptions));
|
|
138
|
+
}
|
|
139
|
+
__get(tenantId, requestOptions) {
|
|
142
140
|
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
+
var _a, _b, _c;
|
|
143
142
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
144
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
143
|
+
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, `/tenants/${encodeURIComponent(tenantId)}`),
|
|
145
144
|
method: "GET",
|
|
146
|
-
headers: {
|
|
147
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
148
|
-
"X-Fern-Language": "JavaScript",
|
|
149
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
150
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
151
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
152
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
153
|
-
},
|
|
145
|
+
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),
|
|
154
146
|
contentType: "application/json",
|
|
147
|
+
requestType: "json",
|
|
155
148
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
156
149
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
150
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
157
151
|
});
|
|
158
152
|
if (_response.ok) {
|
|
159
|
-
return _response.body;
|
|
153
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
160
154
|
}
|
|
161
155
|
if (_response.error.reason === "status-code") {
|
|
162
156
|
switch (_response.error.statusCode) {
|
|
163
157
|
case 400:
|
|
164
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
158
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
165
159
|
default:
|
|
166
160
|
throw new errors.CourierError({
|
|
167
161
|
statusCode: _response.error.statusCode,
|
|
168
162
|
body: _response.error.body,
|
|
163
|
+
rawResponse: _response.rawResponse,
|
|
169
164
|
});
|
|
170
165
|
}
|
|
171
166
|
}
|
|
@@ -174,12 +169,14 @@ class Tenants {
|
|
|
174
169
|
throw new errors.CourierError({
|
|
175
170
|
statusCode: _response.error.statusCode,
|
|
176
171
|
body: _response.error.rawBody,
|
|
172
|
+
rawResponse: _response.rawResponse,
|
|
177
173
|
});
|
|
178
174
|
case "timeout":
|
|
179
|
-
throw new errors.CourierTimeoutError();
|
|
175
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /tenants/{tenant_id}.");
|
|
180
176
|
case "unknown":
|
|
181
177
|
throw new errors.CourierError({
|
|
182
178
|
message: _response.error.errorMessage,
|
|
179
|
+
rawResponse: _response.rawResponse,
|
|
183
180
|
});
|
|
184
181
|
}
|
|
185
182
|
});
|
|
@@ -189,15 +186,14 @@ class Tenants {
|
|
|
189
186
|
* @param {Tenants.RequestOptions} requestOptions - Request-specific configuration.
|
|
190
187
|
*
|
|
191
188
|
* @example
|
|
192
|
-
* await
|
|
193
|
-
* parent_tenant_id: "string",
|
|
194
|
-
* limit: 1,
|
|
195
|
-
* cursor: "string"
|
|
196
|
-
* })
|
|
189
|
+
* await client.tenants.list()
|
|
197
190
|
*/
|
|
198
191
|
list(request = {}, requestOptions) {
|
|
199
|
-
|
|
200
|
-
|
|
192
|
+
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
193
|
+
}
|
|
194
|
+
__list() {
|
|
195
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
196
|
+
var _a, _b, _c;
|
|
201
197
|
const { parent_tenant_id: parentTenantId, limit, cursor } = request;
|
|
202
198
|
const _queryParams = {};
|
|
203
199
|
if (parentTenantId != null) {
|
|
@@ -210,28 +206,24 @@ class Tenants {
|
|
|
210
206
|
_queryParams["cursor"] = cursor;
|
|
211
207
|
}
|
|
212
208
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
213
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
209
|
+
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, "/tenants"),
|
|
214
210
|
method: "GET",
|
|
215
|
-
headers: {
|
|
216
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
217
|
-
"X-Fern-Language": "JavaScript",
|
|
218
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
219
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
220
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
221
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
222
|
-
},
|
|
211
|
+
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),
|
|
223
212
|
contentType: "application/json",
|
|
224
213
|
queryParameters: _queryParams,
|
|
214
|
+
requestType: "json",
|
|
225
215
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
226
216
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
217
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
227
218
|
});
|
|
228
219
|
if (_response.ok) {
|
|
229
|
-
return _response.body;
|
|
220
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
230
221
|
}
|
|
231
222
|
if (_response.error.reason === "status-code") {
|
|
232
223
|
throw new errors.CourierError({
|
|
233
224
|
statusCode: _response.error.statusCode,
|
|
234
225
|
body: _response.error.body,
|
|
226
|
+
rawResponse: _response.rawResponse,
|
|
235
227
|
});
|
|
236
228
|
}
|
|
237
229
|
switch (_response.error.reason) {
|
|
@@ -239,12 +231,14 @@ class Tenants {
|
|
|
239
231
|
throw new errors.CourierError({
|
|
240
232
|
statusCode: _response.error.statusCode,
|
|
241
233
|
body: _response.error.rawBody,
|
|
234
|
+
rawResponse: _response.rawResponse,
|
|
242
235
|
});
|
|
243
236
|
case "timeout":
|
|
244
|
-
throw new errors.CourierTimeoutError();
|
|
237
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /tenants.");
|
|
245
238
|
case "unknown":
|
|
246
239
|
throw new errors.CourierError({
|
|
247
240
|
message: _response.error.errorMessage,
|
|
241
|
+
rawResponse: _response.rawResponse,
|
|
248
242
|
});
|
|
249
243
|
}
|
|
250
244
|
});
|
|
@@ -254,33 +248,32 @@ class Tenants {
|
|
|
254
248
|
* @param {Tenants.RequestOptions} requestOptions - Request-specific configuration.
|
|
255
249
|
*
|
|
256
250
|
* @example
|
|
257
|
-
* await
|
|
251
|
+
* await client.tenants.delete("tenant_id")
|
|
258
252
|
*/
|
|
259
253
|
delete(tenantId, requestOptions) {
|
|
260
|
-
|
|
254
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(tenantId, requestOptions));
|
|
255
|
+
}
|
|
256
|
+
__delete(tenantId, requestOptions) {
|
|
261
257
|
return __awaiter(this, void 0, void 0, function* () {
|
|
258
|
+
var _a, _b, _c;
|
|
262
259
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
263
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
260
|
+
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, `/tenants/${encodeURIComponent(tenantId)}`),
|
|
264
261
|
method: "DELETE",
|
|
265
|
-
headers: {
|
|
266
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
267
|
-
"X-Fern-Language": "JavaScript",
|
|
268
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
269
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
270
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
271
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
272
|
-
},
|
|
262
|
+
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),
|
|
273
263
|
contentType: "application/json",
|
|
264
|
+
requestType: "json",
|
|
274
265
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
275
266
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
267
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
276
268
|
});
|
|
277
269
|
if (_response.ok) {
|
|
278
|
-
return;
|
|
270
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
279
271
|
}
|
|
280
272
|
if (_response.error.reason === "status-code") {
|
|
281
273
|
throw new errors.CourierError({
|
|
282
274
|
statusCode: _response.error.statusCode,
|
|
283
275
|
body: _response.error.body,
|
|
276
|
+
rawResponse: _response.rawResponse,
|
|
284
277
|
});
|
|
285
278
|
}
|
|
286
279
|
switch (_response.error.reason) {
|
|
@@ -288,12 +281,14 @@ class Tenants {
|
|
|
288
281
|
throw new errors.CourierError({
|
|
289
282
|
statusCode: _response.error.statusCode,
|
|
290
283
|
body: _response.error.rawBody,
|
|
284
|
+
rawResponse: _response.rawResponse,
|
|
291
285
|
});
|
|
292
286
|
case "timeout":
|
|
293
|
-
throw new errors.CourierTimeoutError();
|
|
287
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling DELETE /tenants/{tenant_id}.");
|
|
294
288
|
case "unknown":
|
|
295
289
|
throw new errors.CourierError({
|
|
296
290
|
message: _response.error.errorMessage,
|
|
291
|
+
rawResponse: _response.rawResponse,
|
|
297
292
|
});
|
|
298
293
|
}
|
|
299
294
|
});
|
|
@@ -306,14 +301,14 @@ class Tenants {
|
|
|
306
301
|
* @throws {@link Courier.BadRequestError}
|
|
307
302
|
*
|
|
308
303
|
* @example
|
|
309
|
-
* await
|
|
310
|
-
* limit: 1,
|
|
311
|
-
* cursor: "string"
|
|
312
|
-
* })
|
|
304
|
+
* await client.tenants.getUsersByTenant("tenant_id")
|
|
313
305
|
*/
|
|
314
306
|
getUsersByTenant(tenantId, request = {}, requestOptions) {
|
|
315
|
-
|
|
316
|
-
|
|
307
|
+
return core.HttpResponsePromise.fromPromise(this.__getUsersByTenant(tenantId, request, requestOptions));
|
|
308
|
+
}
|
|
309
|
+
__getUsersByTenant(tenantId_1) {
|
|
310
|
+
return __awaiter(this, arguments, void 0, function* (tenantId, request = {}, requestOptions) {
|
|
311
|
+
var _a, _b, _c;
|
|
317
312
|
const { limit, cursor } = request;
|
|
318
313
|
const _queryParams = {};
|
|
319
314
|
if (limit != null) {
|
|
@@ -323,32 +318,28 @@ class Tenants {
|
|
|
323
318
|
_queryParams["cursor"] = cursor;
|
|
324
319
|
}
|
|
325
320
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
326
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
321
|
+
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, `/tenants/${encodeURIComponent(tenantId)}/users`),
|
|
327
322
|
method: "GET",
|
|
328
|
-
headers: {
|
|
329
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
330
|
-
"X-Fern-Language": "JavaScript",
|
|
331
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
332
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
333
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
334
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
335
|
-
},
|
|
323
|
+
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),
|
|
336
324
|
contentType: "application/json",
|
|
337
325
|
queryParameters: _queryParams,
|
|
326
|
+
requestType: "json",
|
|
338
327
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
339
328
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
329
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
340
330
|
});
|
|
341
331
|
if (_response.ok) {
|
|
342
|
-
return _response.body;
|
|
332
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
343
333
|
}
|
|
344
334
|
if (_response.error.reason === "status-code") {
|
|
345
335
|
switch (_response.error.statusCode) {
|
|
346
336
|
case 400:
|
|
347
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
337
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
348
338
|
default:
|
|
349
339
|
throw new errors.CourierError({
|
|
350
340
|
statusCode: _response.error.statusCode,
|
|
351
341
|
body: _response.error.body,
|
|
342
|
+
rawResponse: _response.rawResponse,
|
|
352
343
|
});
|
|
353
344
|
}
|
|
354
345
|
}
|
|
@@ -357,12 +348,14 @@ class Tenants {
|
|
|
357
348
|
throw new errors.CourierError({
|
|
358
349
|
statusCode: _response.error.statusCode,
|
|
359
350
|
body: _response.error.rawBody,
|
|
351
|
+
rawResponse: _response.rawResponse,
|
|
360
352
|
});
|
|
361
353
|
case "timeout":
|
|
362
|
-
throw new errors.CourierTimeoutError();
|
|
354
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /tenants/{tenant_id}/users.");
|
|
363
355
|
case "unknown":
|
|
364
356
|
throw new errors.CourierError({
|
|
365
357
|
message: _response.error.errorMessage,
|
|
358
|
+
rawResponse: _response.rawResponse,
|
|
366
359
|
});
|
|
367
360
|
}
|
|
368
361
|
});
|
|
@@ -374,38 +367,37 @@ class Tenants {
|
|
|
374
367
|
* @param {Tenants.RequestOptions} requestOptions - Request-specific configuration.
|
|
375
368
|
*
|
|
376
369
|
* @example
|
|
377
|
-
* await
|
|
378
|
-
* status:
|
|
370
|
+
* await client.tenants.createOrReplaceDefaultPreferencesForTopic("tenantABC", "HB529N49MD4D5PMX9WR5P4JH78NA", {
|
|
371
|
+
* status: "OPTED_IN",
|
|
379
372
|
* has_custom_routing: true,
|
|
380
|
-
* custom_routing: [
|
|
373
|
+
* custom_routing: ["inbox"]
|
|
381
374
|
* })
|
|
382
375
|
*/
|
|
383
376
|
createOrReplaceDefaultPreferencesForTopic(tenantId, topicId, request, requestOptions) {
|
|
384
|
-
|
|
377
|
+
return core.HttpResponsePromise.fromPromise(this.__createOrReplaceDefaultPreferencesForTopic(tenantId, topicId, request, requestOptions));
|
|
378
|
+
}
|
|
379
|
+
__createOrReplaceDefaultPreferencesForTopic(tenantId, topicId, request, requestOptions) {
|
|
385
380
|
return __awaiter(this, void 0, void 0, function* () {
|
|
381
|
+
var _a, _b, _c;
|
|
386
382
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
387
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
383
|
+
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, `/tenants/${encodeURIComponent(tenantId)}/default_preferences/items/${encodeURIComponent(topicId)}`),
|
|
388
384
|
method: "PUT",
|
|
389
|
-
headers: {
|
|
390
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
391
|
-
"X-Fern-Language": "JavaScript",
|
|
392
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
393
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
394
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
395
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
396
|
-
},
|
|
385
|
+
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),
|
|
397
386
|
contentType: "application/json",
|
|
387
|
+
requestType: "json",
|
|
398
388
|
body: request,
|
|
399
389
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
400
390
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
391
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
401
392
|
});
|
|
402
393
|
if (_response.ok) {
|
|
403
|
-
return;
|
|
394
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
404
395
|
}
|
|
405
396
|
if (_response.error.reason === "status-code") {
|
|
406
397
|
throw new errors.CourierError({
|
|
407
398
|
statusCode: _response.error.statusCode,
|
|
408
399
|
body: _response.error.body,
|
|
400
|
+
rawResponse: _response.rawResponse,
|
|
409
401
|
});
|
|
410
402
|
}
|
|
411
403
|
switch (_response.error.reason) {
|
|
@@ -413,12 +405,14 @@ class Tenants {
|
|
|
413
405
|
throw new errors.CourierError({
|
|
414
406
|
statusCode: _response.error.statusCode,
|
|
415
407
|
body: _response.error.rawBody,
|
|
408
|
+
rawResponse: _response.rawResponse,
|
|
416
409
|
});
|
|
417
410
|
case "timeout":
|
|
418
|
-
throw new errors.CourierTimeoutError();
|
|
411
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /tenants/{tenant_id}/default_preferences/items/{topic_id}.");
|
|
419
412
|
case "unknown":
|
|
420
413
|
throw new errors.CourierError({
|
|
421
414
|
message: _response.error.errorMessage,
|
|
415
|
+
rawResponse: _response.rawResponse,
|
|
422
416
|
});
|
|
423
417
|
}
|
|
424
418
|
});
|
|
@@ -429,33 +423,32 @@ class Tenants {
|
|
|
429
423
|
* @param {Tenants.RequestOptions} requestOptions - Request-specific configuration.
|
|
430
424
|
*
|
|
431
425
|
* @example
|
|
432
|
-
* await
|
|
426
|
+
* await client.tenants.removeDefaultPreferencesForTopic("tenant_id", "topic_id")
|
|
433
427
|
*/
|
|
434
428
|
removeDefaultPreferencesForTopic(tenantId, topicId, requestOptions) {
|
|
435
|
-
|
|
429
|
+
return core.HttpResponsePromise.fromPromise(this.__removeDefaultPreferencesForTopic(tenantId, topicId, requestOptions));
|
|
430
|
+
}
|
|
431
|
+
__removeDefaultPreferencesForTopic(tenantId, topicId, requestOptions) {
|
|
436
432
|
return __awaiter(this, void 0, void 0, function* () {
|
|
433
|
+
var _a, _b, _c;
|
|
437
434
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
438
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
435
|
+
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, `/tenants/${encodeURIComponent(tenantId)}/default_preferences/items/${encodeURIComponent(topicId)}`),
|
|
439
436
|
method: "DELETE",
|
|
440
|
-
headers: {
|
|
441
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
442
|
-
"X-Fern-Language": "JavaScript",
|
|
443
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
444
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
445
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
446
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
447
|
-
},
|
|
437
|
+
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),
|
|
448
438
|
contentType: "application/json",
|
|
439
|
+
requestType: "json",
|
|
449
440
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
450
441
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
442
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
451
443
|
});
|
|
452
444
|
if (_response.ok) {
|
|
453
|
-
return;
|
|
445
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
454
446
|
}
|
|
455
447
|
if (_response.error.reason === "status-code") {
|
|
456
448
|
throw new errors.CourierError({
|
|
457
449
|
statusCode: _response.error.statusCode,
|
|
458
450
|
body: _response.error.body,
|
|
451
|
+
rawResponse: _response.rawResponse,
|
|
459
452
|
});
|
|
460
453
|
}
|
|
461
454
|
switch (_response.error.reason) {
|
|
@@ -463,23 +456,25 @@ class Tenants {
|
|
|
463
456
|
throw new errors.CourierError({
|
|
464
457
|
statusCode: _response.error.statusCode,
|
|
465
458
|
body: _response.error.rawBody,
|
|
459
|
+
rawResponse: _response.rawResponse,
|
|
466
460
|
});
|
|
467
461
|
case "timeout":
|
|
468
|
-
throw new errors.CourierTimeoutError();
|
|
462
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling DELETE /tenants/{tenant_id}/default_preferences/items/{topic_id}.");
|
|
469
463
|
case "unknown":
|
|
470
464
|
throw new errors.CourierError({
|
|
471
465
|
message: _response.error.errorMessage,
|
|
466
|
+
rawResponse: _response.rawResponse,
|
|
472
467
|
});
|
|
473
468
|
}
|
|
474
469
|
});
|
|
475
470
|
}
|
|
476
471
|
_getAuthorizationHeader() {
|
|
477
|
-
var _a;
|
|
478
472
|
return __awaiter(this, void 0, void 0, function* () {
|
|
473
|
+
var _a;
|
|
479
474
|
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"];
|
|
480
475
|
if (bearer == null) {
|
|
481
476
|
throw new errors.CourierError({
|
|
482
|
-
message: "Please specify
|
|
477
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a COURIER_AUTH_TOKEN environment variable",
|
|
483
478
|
});
|
|
484
479
|
}
|
|
485
480
|
return `Bearer ${bearer}`;
|
|
@@ -5,27 +5,12 @@ import * as Courier from "../../../../index";
|
|
|
5
5
|
/**
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
|
-
* name: "
|
|
9
|
-
* parent_tenant_id:
|
|
10
|
-
* default_preferences:
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* has_custom_routing: undefined,
|
|
15
|
-
* custom_routing: undefined
|
|
16
|
-
* }]
|
|
17
|
-
* },
|
|
18
|
-
* properties: {
|
|
19
|
-
* "string": {
|
|
20
|
-
* "key": "value"
|
|
21
|
-
* }
|
|
22
|
-
* },
|
|
23
|
-
* user_profile: {
|
|
24
|
-
* "string": {
|
|
25
|
-
* "key": "value"
|
|
26
|
-
* }
|
|
27
|
-
* },
|
|
28
|
-
* brand_id: "string"
|
|
8
|
+
* name: "name",
|
|
9
|
+
* parent_tenant_id: undefined,
|
|
10
|
+
* default_preferences: undefined,
|
|
11
|
+
* properties: undefined,
|
|
12
|
+
* user_profile: undefined,
|
|
13
|
+
* brand_id: undefined
|
|
29
14
|
* }
|
|
30
15
|
*/
|
|
31
16
|
export interface TenantCreateOrReplaceParams {
|
|
@@ -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 SubscriptionTopicStatus = "OPTED_OUT" | "OPTED_IN" | "REQUIRED";
|
|
5
5
|
export declare const SubscriptionTopicStatus: {
|
|
6
6
|
readonly OptedOut: "OPTED_OUT";
|
|
7
7
|
readonly OptedIn: "OPTED_IN";
|