@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) {
|
|
@@ -57,72 +67,50 @@ class Brands {
|
|
|
57
67
|
* @throws {@link Courier.AlreadyExistsError}
|
|
58
68
|
*
|
|
59
69
|
* @example
|
|
60
|
-
* await
|
|
61
|
-
* id:
|
|
62
|
-
* name: "
|
|
70
|
+
* await client.brands.create({
|
|
71
|
+
* id: undefined,
|
|
72
|
+
* name: "name",
|
|
63
73
|
* settings: {
|
|
64
|
-
* colors:
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* tertiary: "string"
|
|
68
|
-
* },
|
|
69
|
-
* inapp: {
|
|
70
|
-
* "key": "value"
|
|
71
|
-
* },
|
|
72
|
-
* email: {
|
|
73
|
-
* footer: {
|
|
74
|
-
* "key": "value"
|
|
75
|
-
* },
|
|
76
|
-
* header: {
|
|
77
|
-
* "key": "value"
|
|
78
|
-
* }
|
|
79
|
-
* }
|
|
74
|
+
* colors: undefined,
|
|
75
|
+
* inapp: undefined,
|
|
76
|
+
* email: undefined
|
|
80
77
|
* },
|
|
81
|
-
* snippets:
|
|
82
|
-
* items: [{
|
|
83
|
-
* format: "handlebars",
|
|
84
|
-
* name: "string",
|
|
85
|
-
* value: "string"
|
|
86
|
-
* }]
|
|
87
|
-
* }
|
|
78
|
+
* snippets: undefined
|
|
88
79
|
* })
|
|
89
80
|
*/
|
|
90
81
|
create(request, requestOptions) {
|
|
91
|
-
|
|
82
|
+
return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
|
|
83
|
+
}
|
|
84
|
+
__create(request, requestOptions) {
|
|
92
85
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
var _a, _b, _c;
|
|
93
87
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
94
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
88
|
+
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, "/brands"),
|
|
95
89
|
method: "POST",
|
|
96
|
-
headers: {
|
|
97
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
98
|
-
"X-Fern-Language": "JavaScript",
|
|
99
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
100
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
101
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
102
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
103
|
-
"Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined,
|
|
104
|
-
"X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined,
|
|
105
|
-
},
|
|
90
|
+
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),
|
|
106
91
|
contentType: "application/json",
|
|
92
|
+
requestType: "json",
|
|
107
93
|
body: request,
|
|
108
94
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
109
95
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
96
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
110
97
|
});
|
|
111
98
|
if (_response.ok) {
|
|
112
|
-
return _response.body;
|
|
99
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
113
100
|
}
|
|
114
101
|
if (_response.error.reason === "status-code") {
|
|
115
102
|
switch (_response.error.statusCode) {
|
|
116
103
|
case 400:
|
|
117
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
104
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
118
105
|
case 402:
|
|
119
|
-
throw new Courier.PaymentRequiredError(_response.error.body);
|
|
106
|
+
throw new Courier.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
120
107
|
case 409:
|
|
121
|
-
throw new Courier.AlreadyExistsError(_response.error.body);
|
|
108
|
+
throw new Courier.AlreadyExistsError(_response.error.body, _response.rawResponse);
|
|
122
109
|
default:
|
|
123
110
|
throw new errors.CourierError({
|
|
124
111
|
statusCode: _response.error.statusCode,
|
|
125
112
|
body: _response.error.body,
|
|
113
|
+
rawResponse: _response.rawResponse,
|
|
126
114
|
});
|
|
127
115
|
}
|
|
128
116
|
}
|
|
@@ -131,12 +119,14 @@ class Brands {
|
|
|
131
119
|
throw new errors.CourierError({
|
|
132
120
|
statusCode: _response.error.statusCode,
|
|
133
121
|
body: _response.error.rawBody,
|
|
122
|
+
rawResponse: _response.rawResponse,
|
|
134
123
|
});
|
|
135
124
|
case "timeout":
|
|
136
|
-
throw new errors.CourierTimeoutError();
|
|
125
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling POST /brands.");
|
|
137
126
|
case "unknown":
|
|
138
127
|
throw new errors.CourierError({
|
|
139
128
|
message: _response.error.errorMessage,
|
|
129
|
+
rawResponse: _response.rawResponse,
|
|
140
130
|
});
|
|
141
131
|
}
|
|
142
132
|
});
|
|
@@ -148,33 +138,32 @@ class Brands {
|
|
|
148
138
|
* @param {Brands.RequestOptions} requestOptions - Request-specific configuration.
|
|
149
139
|
*
|
|
150
140
|
* @example
|
|
151
|
-
* await
|
|
141
|
+
* await client.brands.get("brand_id")
|
|
152
142
|
*/
|
|
153
143
|
get(brandId, requestOptions) {
|
|
154
|
-
|
|
144
|
+
return core.HttpResponsePromise.fromPromise(this.__get(brandId, requestOptions));
|
|
145
|
+
}
|
|
146
|
+
__get(brandId, requestOptions) {
|
|
155
147
|
return __awaiter(this, void 0, void 0, function* () {
|
|
148
|
+
var _a, _b, _c;
|
|
156
149
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
157
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
150
|
+
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, `/brands/${encodeURIComponent(brandId)}`),
|
|
158
151
|
method: "GET",
|
|
159
|
-
headers: {
|
|
160
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
161
|
-
"X-Fern-Language": "JavaScript",
|
|
162
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
163
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
164
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
165
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
166
|
-
},
|
|
152
|
+
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),
|
|
167
153
|
contentType: "application/json",
|
|
154
|
+
requestType: "json",
|
|
168
155
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
169
156
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
157
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
170
158
|
});
|
|
171
159
|
if (_response.ok) {
|
|
172
|
-
return _response.body;
|
|
160
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
173
161
|
}
|
|
174
162
|
if (_response.error.reason === "status-code") {
|
|
175
163
|
throw new errors.CourierError({
|
|
176
164
|
statusCode: _response.error.statusCode,
|
|
177
165
|
body: _response.error.body,
|
|
166
|
+
rawResponse: _response.rawResponse,
|
|
178
167
|
});
|
|
179
168
|
}
|
|
180
169
|
switch (_response.error.reason) {
|
|
@@ -182,12 +171,14 @@ class Brands {
|
|
|
182
171
|
throw new errors.CourierError({
|
|
183
172
|
statusCode: _response.error.statusCode,
|
|
184
173
|
body: _response.error.rawBody,
|
|
174
|
+
rawResponse: _response.rawResponse,
|
|
185
175
|
});
|
|
186
176
|
case "timeout":
|
|
187
|
-
throw new errors.CourierTimeoutError();
|
|
177
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /brands/{brand_id}.");
|
|
188
178
|
case "unknown":
|
|
189
179
|
throw new errors.CourierError({
|
|
190
180
|
message: _response.error.errorMessage,
|
|
181
|
+
rawResponse: _response.rawResponse,
|
|
191
182
|
});
|
|
192
183
|
}
|
|
193
184
|
});
|
|
@@ -199,41 +190,38 @@ class Brands {
|
|
|
199
190
|
* @param {Brands.RequestOptions} requestOptions - Request-specific configuration.
|
|
200
191
|
*
|
|
201
192
|
* @example
|
|
202
|
-
* await
|
|
203
|
-
* cursor: "string"
|
|
204
|
-
* })
|
|
193
|
+
* await client.brands.list()
|
|
205
194
|
*/
|
|
206
195
|
list(request = {}, requestOptions) {
|
|
207
|
-
|
|
208
|
-
|
|
196
|
+
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
197
|
+
}
|
|
198
|
+
__list() {
|
|
199
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
200
|
+
var _a, _b, _c;
|
|
209
201
|
const { cursor } = request;
|
|
210
202
|
const _queryParams = {};
|
|
211
203
|
if (cursor != null) {
|
|
212
204
|
_queryParams["cursor"] = cursor;
|
|
213
205
|
}
|
|
214
206
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
215
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
207
|
+
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, "/brands"),
|
|
216
208
|
method: "GET",
|
|
217
|
-
headers: {
|
|
218
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
219
|
-
"X-Fern-Language": "JavaScript",
|
|
220
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
221
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
222
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
223
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
224
|
-
},
|
|
209
|
+
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),
|
|
225
210
|
contentType: "application/json",
|
|
226
211
|
queryParameters: _queryParams,
|
|
212
|
+
requestType: "json",
|
|
227
213
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
228
214
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
215
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
229
216
|
});
|
|
230
217
|
if (_response.ok) {
|
|
231
|
-
return _response.body;
|
|
218
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
232
219
|
}
|
|
233
220
|
if (_response.error.reason === "status-code") {
|
|
234
221
|
throw new errors.CourierError({
|
|
235
222
|
statusCode: _response.error.statusCode,
|
|
236
223
|
body: _response.error.body,
|
|
224
|
+
rawResponse: _response.rawResponse,
|
|
237
225
|
});
|
|
238
226
|
}
|
|
239
227
|
switch (_response.error.reason) {
|
|
@@ -241,12 +229,14 @@ class Brands {
|
|
|
241
229
|
throw new errors.CourierError({
|
|
242
230
|
statusCode: _response.error.statusCode,
|
|
243
231
|
body: _response.error.rawBody,
|
|
232
|
+
rawResponse: _response.rawResponse,
|
|
244
233
|
});
|
|
245
234
|
case "timeout":
|
|
246
|
-
throw new errors.CourierTimeoutError();
|
|
235
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /brands.");
|
|
247
236
|
case "unknown":
|
|
248
237
|
throw new errors.CourierError({
|
|
249
238
|
message: _response.error.errorMessage,
|
|
239
|
+
rawResponse: _response.rawResponse,
|
|
250
240
|
});
|
|
251
241
|
}
|
|
252
242
|
});
|
|
@@ -260,37 +250,36 @@ class Brands {
|
|
|
260
250
|
* @throws {@link Courier.ConflictError}
|
|
261
251
|
*
|
|
262
252
|
* @example
|
|
263
|
-
* await
|
|
253
|
+
* await client.brands.delete("brand_id")
|
|
264
254
|
*/
|
|
265
255
|
delete(brandId, requestOptions) {
|
|
266
|
-
|
|
256
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(brandId, requestOptions));
|
|
257
|
+
}
|
|
258
|
+
__delete(brandId, requestOptions) {
|
|
267
259
|
return __awaiter(this, void 0, void 0, function* () {
|
|
260
|
+
var _a, _b, _c;
|
|
268
261
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
269
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
262
|
+
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, `/brands/${encodeURIComponent(brandId)}`),
|
|
270
263
|
method: "DELETE",
|
|
271
|
-
headers: {
|
|
272
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
273
|
-
"X-Fern-Language": "JavaScript",
|
|
274
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
275
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
276
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
277
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
278
|
-
},
|
|
264
|
+
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),
|
|
279
265
|
contentType: "application/json",
|
|
266
|
+
requestType: "json",
|
|
280
267
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
281
268
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
269
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
282
270
|
});
|
|
283
271
|
if (_response.ok) {
|
|
284
|
-
return;
|
|
272
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
285
273
|
}
|
|
286
274
|
if (_response.error.reason === "status-code") {
|
|
287
275
|
switch (_response.error.statusCode) {
|
|
288
276
|
case 409:
|
|
289
|
-
throw new Courier.ConflictError(_response.error.body);
|
|
277
|
+
throw new Courier.ConflictError(_response.error.body, _response.rawResponse);
|
|
290
278
|
default:
|
|
291
279
|
throw new errors.CourierError({
|
|
292
280
|
statusCode: _response.error.statusCode,
|
|
293
281
|
body: _response.error.body,
|
|
282
|
+
rawResponse: _response.rawResponse,
|
|
294
283
|
});
|
|
295
284
|
}
|
|
296
285
|
}
|
|
@@ -299,12 +288,14 @@ class Brands {
|
|
|
299
288
|
throw new errors.CourierError({
|
|
300
289
|
statusCode: _response.error.statusCode,
|
|
301
290
|
body: _response.error.rawBody,
|
|
291
|
+
rawResponse: _response.rawResponse,
|
|
302
292
|
});
|
|
303
293
|
case "timeout":
|
|
304
|
-
throw new errors.CourierTimeoutError();
|
|
294
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling DELETE /brands/{brand_id}.");
|
|
305
295
|
case "unknown":
|
|
306
296
|
throw new errors.CourierError({
|
|
307
297
|
message: _response.error.errorMessage,
|
|
298
|
+
rawResponse: _response.rawResponse,
|
|
308
299
|
});
|
|
309
300
|
}
|
|
310
301
|
});
|
|
@@ -317,61 +308,37 @@ class Brands {
|
|
|
317
308
|
* @param {Brands.RequestOptions} requestOptions - Request-specific configuration.
|
|
318
309
|
*
|
|
319
310
|
* @example
|
|
320
|
-
* await
|
|
321
|
-
* name: "
|
|
322
|
-
* settings:
|
|
323
|
-
*
|
|
324
|
-
* primary: "string",
|
|
325
|
-
* secondary: "string",
|
|
326
|
-
* tertiary: "string"
|
|
327
|
-
* },
|
|
328
|
-
* inapp: {
|
|
329
|
-
* "key": "value"
|
|
330
|
-
* },
|
|
331
|
-
* email: {
|
|
332
|
-
* footer: {
|
|
333
|
-
* "key": "value"
|
|
334
|
-
* },
|
|
335
|
-
* header: {
|
|
336
|
-
* "key": "value"
|
|
337
|
-
* }
|
|
338
|
-
* }
|
|
339
|
-
* },
|
|
340
|
-
* snippets: {
|
|
341
|
-
* items: [{
|
|
342
|
-
* format: "handlebars",
|
|
343
|
-
* name: "string",
|
|
344
|
-
* value: "string"
|
|
345
|
-
* }]
|
|
346
|
-
* }
|
|
311
|
+
* await client.brands.replace("brand_id", {
|
|
312
|
+
* name: "name",
|
|
313
|
+
* settings: undefined,
|
|
314
|
+
* snippets: undefined
|
|
347
315
|
* })
|
|
348
316
|
*/
|
|
349
317
|
replace(brandId, request, requestOptions) {
|
|
350
|
-
|
|
318
|
+
return core.HttpResponsePromise.fromPromise(this.__replace(brandId, request, requestOptions));
|
|
319
|
+
}
|
|
320
|
+
__replace(brandId, request, requestOptions) {
|
|
351
321
|
return __awaiter(this, void 0, void 0, function* () {
|
|
322
|
+
var _a, _b, _c;
|
|
352
323
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
353
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
324
|
+
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, `/brands/${encodeURIComponent(brandId)}`),
|
|
354
325
|
method: "PUT",
|
|
355
|
-
headers: {
|
|
356
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
357
|
-
"X-Fern-Language": "JavaScript",
|
|
358
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
359
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
360
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
361
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
362
|
-
},
|
|
326
|
+
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),
|
|
363
327
|
contentType: "application/json",
|
|
328
|
+
requestType: "json",
|
|
364
329
|
body: request,
|
|
365
330
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
366
331
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
332
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
367
333
|
});
|
|
368
334
|
if (_response.ok) {
|
|
369
|
-
return _response.body;
|
|
335
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
370
336
|
}
|
|
371
337
|
if (_response.error.reason === "status-code") {
|
|
372
338
|
throw new errors.CourierError({
|
|
373
339
|
statusCode: _response.error.statusCode,
|
|
374
340
|
body: _response.error.body,
|
|
341
|
+
rawResponse: _response.rawResponse,
|
|
375
342
|
});
|
|
376
343
|
}
|
|
377
344
|
switch (_response.error.reason) {
|
|
@@ -379,23 +346,25 @@ class Brands {
|
|
|
379
346
|
throw new errors.CourierError({
|
|
380
347
|
statusCode: _response.error.statusCode,
|
|
381
348
|
body: _response.error.rawBody,
|
|
349
|
+
rawResponse: _response.rawResponse,
|
|
382
350
|
});
|
|
383
351
|
case "timeout":
|
|
384
|
-
throw new errors.CourierTimeoutError();
|
|
352
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /brands/{brand_id}.");
|
|
385
353
|
case "unknown":
|
|
386
354
|
throw new errors.CourierError({
|
|
387
355
|
message: _response.error.errorMessage,
|
|
356
|
+
rawResponse: _response.rawResponse,
|
|
388
357
|
});
|
|
389
358
|
}
|
|
390
359
|
});
|
|
391
360
|
}
|
|
392
361
|
_getAuthorizationHeader() {
|
|
393
|
-
var _a;
|
|
394
362
|
return __awaiter(this, void 0, void 0, function* () {
|
|
363
|
+
var _a;
|
|
395
364
|
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"];
|
|
396
365
|
if (bearer == null) {
|
|
397
366
|
throw new errors.CourierError({
|
|
398
|
-
message: "Please specify
|
|
367
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a COURIER_AUTH_TOKEN environment variable",
|
|
399
368
|
});
|
|
400
369
|
}
|
|
401
370
|
return `Bearer ${bearer}`;
|
|
@@ -5,32 +5,9 @@ import * as Courier from "../../../../index";
|
|
|
5
5
|
/**
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
|
-
* name: "
|
|
9
|
-
* settings:
|
|
10
|
-
*
|
|
11
|
-
* primary: "string",
|
|
12
|
-
* secondary: "string",
|
|
13
|
-
* tertiary: "string"
|
|
14
|
-
* },
|
|
15
|
-
* inapp: {
|
|
16
|
-
* "key": "value"
|
|
17
|
-
* },
|
|
18
|
-
* email: {
|
|
19
|
-
* footer: {
|
|
20
|
-
* "key": "value"
|
|
21
|
-
* },
|
|
22
|
-
* header: {
|
|
23
|
-
* "key": "value"
|
|
24
|
-
* }
|
|
25
|
-
* }
|
|
26
|
-
* },
|
|
27
|
-
* snippets: {
|
|
28
|
-
* items: [{
|
|
29
|
-
* format: "handlebars",
|
|
30
|
-
* name: "string",
|
|
31
|
-
* value: "string"
|
|
32
|
-
* }]
|
|
33
|
-
* }
|
|
8
|
+
* name: "name",
|
|
9
|
+
* settings: undefined,
|
|
10
|
+
* snippets: undefined
|
|
34
11
|
* }
|
|
35
12
|
*/
|
|
36
13
|
export interface BrandUpdateParameters {
|