@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,37 +67,36 @@ class Profiles {
|
|
|
57
67
|
* @throws {@link Courier.BadRequestError}
|
|
58
68
|
*
|
|
59
69
|
* @example
|
|
60
|
-
* await
|
|
70
|
+
* await client.profiles.get("user_id")
|
|
61
71
|
*/
|
|
62
72
|
get(userId, requestOptions) {
|
|
63
|
-
|
|
73
|
+
return core.HttpResponsePromise.fromPromise(this.__get(userId, requestOptions));
|
|
74
|
+
}
|
|
75
|
+
__get(userId, requestOptions) {
|
|
64
76
|
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
var _a, _b, _c;
|
|
65
78
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
66
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
79
|
+
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, `/profiles/${encodeURIComponent(userId)}`),
|
|
67
80
|
method: "GET",
|
|
68
|
-
headers: {
|
|
69
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
70
|
-
"X-Fern-Language": "JavaScript",
|
|
71
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
72
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
73
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
74
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
75
|
-
},
|
|
81
|
+
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),
|
|
76
82
|
contentType: "application/json",
|
|
83
|
+
requestType: "json",
|
|
77
84
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
78
85
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
86
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
79
87
|
});
|
|
80
88
|
if (_response.ok) {
|
|
81
|
-
return _response.body;
|
|
89
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
82
90
|
}
|
|
83
91
|
if (_response.error.reason === "status-code") {
|
|
84
92
|
switch (_response.error.statusCode) {
|
|
85
93
|
case 400:
|
|
86
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
94
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
87
95
|
default:
|
|
88
96
|
throw new errors.CourierError({
|
|
89
97
|
statusCode: _response.error.statusCode,
|
|
90
98
|
body: _response.error.body,
|
|
99
|
+
rawResponse: _response.rawResponse,
|
|
91
100
|
});
|
|
92
101
|
}
|
|
93
102
|
}
|
|
@@ -96,12 +105,14 @@ class Profiles {
|
|
|
96
105
|
throw new errors.CourierError({
|
|
97
106
|
statusCode: _response.error.statusCode,
|
|
98
107
|
body: _response.error.rawBody,
|
|
108
|
+
rawResponse: _response.rawResponse,
|
|
99
109
|
});
|
|
100
110
|
case "timeout":
|
|
101
|
-
throw new errors.CourierTimeoutError();
|
|
111
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /profiles/{user_id}.");
|
|
102
112
|
case "unknown":
|
|
103
113
|
throw new errors.CourierError({
|
|
104
114
|
message: _response.error.errorMessage,
|
|
115
|
+
rawResponse: _response.rawResponse,
|
|
105
116
|
});
|
|
106
117
|
}
|
|
107
118
|
});
|
|
@@ -116,46 +127,43 @@ class Profiles {
|
|
|
116
127
|
* @throws {@link Courier.BadRequestError}
|
|
117
128
|
*
|
|
118
129
|
* @example
|
|
119
|
-
* await
|
|
130
|
+
* await client.profiles.create("user_id", {
|
|
120
131
|
* profile: {
|
|
121
|
-
* "
|
|
132
|
+
* "profile": {
|
|
122
133
|
* "key": "value"
|
|
123
134
|
* }
|
|
124
135
|
* }
|
|
125
136
|
* })
|
|
126
137
|
*/
|
|
127
138
|
create(userId, request, requestOptions) {
|
|
128
|
-
|
|
139
|
+
return core.HttpResponsePromise.fromPromise(this.__create(userId, request, requestOptions));
|
|
140
|
+
}
|
|
141
|
+
__create(userId, request, requestOptions) {
|
|
129
142
|
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
+
var _a, _b, _c;
|
|
130
144
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
131
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
145
|
+
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, `/profiles/${encodeURIComponent(userId)}`),
|
|
132
146
|
method: "POST",
|
|
133
|
-
headers: {
|
|
134
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
135
|
-
"X-Fern-Language": "JavaScript",
|
|
136
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
137
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
138
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
139
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
140
|
-
"Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined,
|
|
141
|
-
"X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined,
|
|
142
|
-
},
|
|
147
|
+
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),
|
|
143
148
|
contentType: "application/json",
|
|
149
|
+
requestType: "json",
|
|
144
150
|
body: request,
|
|
145
151
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
146
152
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
153
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
147
154
|
});
|
|
148
155
|
if (_response.ok) {
|
|
149
|
-
return _response.body;
|
|
156
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
150
157
|
}
|
|
151
158
|
if (_response.error.reason === "status-code") {
|
|
152
159
|
switch (_response.error.statusCode) {
|
|
153
160
|
case 400:
|
|
154
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
161
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
155
162
|
default:
|
|
156
163
|
throw new errors.CourierError({
|
|
157
164
|
statusCode: _response.error.statusCode,
|
|
158
165
|
body: _response.error.body,
|
|
166
|
+
rawResponse: _response.rawResponse,
|
|
159
167
|
});
|
|
160
168
|
}
|
|
161
169
|
}
|
|
@@ -164,12 +172,14 @@ class Profiles {
|
|
|
164
172
|
throw new errors.CourierError({
|
|
165
173
|
statusCode: _response.error.statusCode,
|
|
166
174
|
body: _response.error.rawBody,
|
|
175
|
+
rawResponse: _response.rawResponse,
|
|
167
176
|
});
|
|
168
177
|
case "timeout":
|
|
169
|
-
throw new errors.CourierTimeoutError();
|
|
178
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling POST /profiles/{user_id}.");
|
|
170
179
|
case "unknown":
|
|
171
180
|
throw new errors.CourierError({
|
|
172
181
|
message: _response.error.errorMessage,
|
|
182
|
+
rawResponse: _response.rawResponse,
|
|
173
183
|
});
|
|
174
184
|
}
|
|
175
185
|
});
|
|
@@ -187,44 +197,43 @@ class Profiles {
|
|
|
187
197
|
* @throws {@link Courier.BadRequestError}
|
|
188
198
|
*
|
|
189
199
|
* @example
|
|
190
|
-
* await
|
|
200
|
+
* await client.profiles.replace("user_id", {
|
|
191
201
|
* profile: {
|
|
192
|
-
* "
|
|
202
|
+
* "profile": {
|
|
193
203
|
* "key": "value"
|
|
194
204
|
* }
|
|
195
205
|
* }
|
|
196
206
|
* })
|
|
197
207
|
*/
|
|
198
208
|
replace(userId, request, requestOptions) {
|
|
199
|
-
|
|
209
|
+
return core.HttpResponsePromise.fromPromise(this.__replace(userId, request, requestOptions));
|
|
210
|
+
}
|
|
211
|
+
__replace(userId, request, requestOptions) {
|
|
200
212
|
return __awaiter(this, void 0, void 0, function* () {
|
|
213
|
+
var _a, _b, _c;
|
|
201
214
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
202
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
215
|
+
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, `/profiles/${encodeURIComponent(userId)}`),
|
|
203
216
|
method: "PUT",
|
|
204
|
-
headers: {
|
|
205
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
206
|
-
"X-Fern-Language": "JavaScript",
|
|
207
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
208
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
209
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
210
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
211
|
-
},
|
|
217
|
+
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),
|
|
212
218
|
contentType: "application/json",
|
|
219
|
+
requestType: "json",
|
|
213
220
|
body: request,
|
|
214
221
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
215
222
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
223
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
216
224
|
});
|
|
217
225
|
if (_response.ok) {
|
|
218
|
-
return _response.body;
|
|
226
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
219
227
|
}
|
|
220
228
|
if (_response.error.reason === "status-code") {
|
|
221
229
|
switch (_response.error.statusCode) {
|
|
222
230
|
case 400:
|
|
223
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
231
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
224
232
|
default:
|
|
225
233
|
throw new errors.CourierError({
|
|
226
234
|
statusCode: _response.error.statusCode,
|
|
227
235
|
body: _response.error.body,
|
|
236
|
+
rawResponse: _response.rawResponse,
|
|
228
237
|
});
|
|
229
238
|
}
|
|
230
239
|
}
|
|
@@ -233,54 +242,61 @@ class Profiles {
|
|
|
233
242
|
throw new errors.CourierError({
|
|
234
243
|
statusCode: _response.error.statusCode,
|
|
235
244
|
body: _response.error.rawBody,
|
|
245
|
+
rawResponse: _response.rawResponse,
|
|
236
246
|
});
|
|
237
247
|
case "timeout":
|
|
238
|
-
throw new errors.CourierTimeoutError();
|
|
248
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /profiles/{user_id}.");
|
|
239
249
|
case "unknown":
|
|
240
250
|
throw new errors.CourierError({
|
|
241
251
|
message: _response.error.errorMessage,
|
|
252
|
+
rawResponse: _response.rawResponse,
|
|
242
253
|
});
|
|
243
254
|
}
|
|
244
255
|
});
|
|
245
256
|
}
|
|
246
257
|
/**
|
|
247
258
|
* @param {string} userId - A unique identifier representing the user associated with the requested profile.
|
|
248
|
-
* @param {Courier.
|
|
259
|
+
* @param {Courier.ProfileUpdateRequest} request
|
|
249
260
|
* @param {Profiles.RequestOptions} requestOptions - Request-specific configuration.
|
|
250
261
|
*
|
|
251
262
|
* @example
|
|
252
|
-
* await
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
263
|
+
* await client.profiles.mergeProfile("user_id", {
|
|
264
|
+
* patch: [{
|
|
265
|
+
* op: "op",
|
|
266
|
+
* path: "path",
|
|
267
|
+
* value: "value"
|
|
268
|
+
* }, {
|
|
269
|
+
* op: "op",
|
|
270
|
+
* path: "path",
|
|
271
|
+
* value: "value"
|
|
272
|
+
* }]
|
|
273
|
+
* })
|
|
257
274
|
*/
|
|
258
275
|
mergeProfile(userId, request, requestOptions) {
|
|
259
|
-
|
|
276
|
+
return core.HttpResponsePromise.fromPromise(this.__mergeProfile(userId, request, requestOptions));
|
|
277
|
+
}
|
|
278
|
+
__mergeProfile(userId, request, requestOptions) {
|
|
260
279
|
return __awaiter(this, void 0, void 0, function* () {
|
|
280
|
+
var _a, _b, _c;
|
|
261
281
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
262
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
282
|
+
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, `/profiles/${encodeURIComponent(userId)}`),
|
|
263
283
|
method: "PATCH",
|
|
264
|
-
headers: {
|
|
265
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
266
|
-
"X-Fern-Language": "JavaScript",
|
|
267
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
268
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
269
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
270
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
271
|
-
},
|
|
284
|
+
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),
|
|
272
285
|
contentType: "application/json",
|
|
286
|
+
requestType: "json",
|
|
273
287
|
body: request,
|
|
274
288
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
275
289
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
290
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
276
291
|
});
|
|
277
292
|
if (_response.ok) {
|
|
278
|
-
return;
|
|
293
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
279
294
|
}
|
|
280
295
|
if (_response.error.reason === "status-code") {
|
|
281
296
|
throw new errors.CourierError({
|
|
282
297
|
statusCode: _response.error.statusCode,
|
|
283
298
|
body: _response.error.body,
|
|
299
|
+
rawResponse: _response.rawResponse,
|
|
284
300
|
});
|
|
285
301
|
}
|
|
286
302
|
switch (_response.error.reason) {
|
|
@@ -288,12 +304,14 @@ class Profiles {
|
|
|
288
304
|
throw new errors.CourierError({
|
|
289
305
|
statusCode: _response.error.statusCode,
|
|
290
306
|
body: _response.error.rawBody,
|
|
307
|
+
rawResponse: _response.rawResponse,
|
|
291
308
|
});
|
|
292
309
|
case "timeout":
|
|
293
|
-
throw new errors.CourierTimeoutError();
|
|
310
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling PATCH /profiles/{user_id}.");
|
|
294
311
|
case "unknown":
|
|
295
312
|
throw new errors.CourierError({
|
|
296
313
|
message: _response.error.errorMessage,
|
|
314
|
+
rawResponse: _response.rawResponse,
|
|
297
315
|
});
|
|
298
316
|
}
|
|
299
317
|
});
|
|
@@ -307,37 +325,36 @@ class Profiles {
|
|
|
307
325
|
* @throws {@link Courier.BadRequestError}
|
|
308
326
|
*
|
|
309
327
|
* @example
|
|
310
|
-
* await
|
|
328
|
+
* await client.profiles.delete("user_id")
|
|
311
329
|
*/
|
|
312
330
|
delete(userId, requestOptions) {
|
|
313
|
-
|
|
331
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(userId, requestOptions));
|
|
332
|
+
}
|
|
333
|
+
__delete(userId, requestOptions) {
|
|
314
334
|
return __awaiter(this, void 0, void 0, function* () {
|
|
335
|
+
var _a, _b, _c;
|
|
315
336
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
316
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
337
|
+
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, `/profiles/${encodeURIComponent(userId)}`),
|
|
317
338
|
method: "DELETE",
|
|
318
|
-
headers: {
|
|
319
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
320
|
-
"X-Fern-Language": "JavaScript",
|
|
321
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
322
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
323
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
324
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
325
|
-
},
|
|
339
|
+
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),
|
|
326
340
|
contentType: "application/json",
|
|
341
|
+
requestType: "json",
|
|
327
342
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
328
343
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
344
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
329
345
|
});
|
|
330
346
|
if (_response.ok) {
|
|
331
|
-
return;
|
|
347
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
332
348
|
}
|
|
333
349
|
if (_response.error.reason === "status-code") {
|
|
334
350
|
switch (_response.error.statusCode) {
|
|
335
351
|
case 400:
|
|
336
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
352
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
337
353
|
default:
|
|
338
354
|
throw new errors.CourierError({
|
|
339
355
|
statusCode: _response.error.statusCode,
|
|
340
356
|
body: _response.error.body,
|
|
357
|
+
rawResponse: _response.rawResponse,
|
|
341
358
|
});
|
|
342
359
|
}
|
|
343
360
|
}
|
|
@@ -346,12 +363,14 @@ class Profiles {
|
|
|
346
363
|
throw new errors.CourierError({
|
|
347
364
|
statusCode: _response.error.statusCode,
|
|
348
365
|
body: _response.error.rawBody,
|
|
366
|
+
rawResponse: _response.rawResponse,
|
|
349
367
|
});
|
|
350
368
|
case "timeout":
|
|
351
|
-
throw new errors.CourierTimeoutError();
|
|
369
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling DELETE /profiles/{user_id}.");
|
|
352
370
|
case "unknown":
|
|
353
371
|
throw new errors.CourierError({
|
|
354
372
|
message: _response.error.errorMessage,
|
|
373
|
+
rawResponse: _response.rawResponse,
|
|
355
374
|
});
|
|
356
375
|
}
|
|
357
376
|
});
|
|
@@ -366,45 +385,42 @@ class Profiles {
|
|
|
366
385
|
* @throws {@link Courier.BadRequestError}
|
|
367
386
|
*
|
|
368
387
|
* @example
|
|
369
|
-
* await
|
|
370
|
-
* cursor: "string"
|
|
371
|
-
* })
|
|
388
|
+
* await client.profiles.getListSubscriptions("user_id")
|
|
372
389
|
*/
|
|
373
390
|
getListSubscriptions(userId, request = {}, requestOptions) {
|
|
374
|
-
|
|
375
|
-
|
|
391
|
+
return core.HttpResponsePromise.fromPromise(this.__getListSubscriptions(userId, request, requestOptions));
|
|
392
|
+
}
|
|
393
|
+
__getListSubscriptions(userId_1) {
|
|
394
|
+
return __awaiter(this, arguments, void 0, function* (userId, request = {}, requestOptions) {
|
|
395
|
+
var _a, _b, _c;
|
|
376
396
|
const { cursor } = request;
|
|
377
397
|
const _queryParams = {};
|
|
378
398
|
if (cursor != null) {
|
|
379
399
|
_queryParams["cursor"] = cursor;
|
|
380
400
|
}
|
|
381
401
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
382
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
402
|
+
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, `/profiles/${encodeURIComponent(userId)}/lists`),
|
|
383
403
|
method: "GET",
|
|
384
|
-
headers: {
|
|
385
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
386
|
-
"X-Fern-Language": "JavaScript",
|
|
387
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
388
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
389
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
390
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
391
|
-
},
|
|
404
|
+
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),
|
|
392
405
|
contentType: "application/json",
|
|
393
406
|
queryParameters: _queryParams,
|
|
407
|
+
requestType: "json",
|
|
394
408
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
395
409
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
410
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
396
411
|
});
|
|
397
412
|
if (_response.ok) {
|
|
398
|
-
return _response.body;
|
|
413
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
399
414
|
}
|
|
400
415
|
if (_response.error.reason === "status-code") {
|
|
401
416
|
switch (_response.error.statusCode) {
|
|
402
417
|
case 400:
|
|
403
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
418
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
404
419
|
default:
|
|
405
420
|
throw new errors.CourierError({
|
|
406
421
|
statusCode: _response.error.statusCode,
|
|
407
422
|
body: _response.error.body,
|
|
423
|
+
rawResponse: _response.rawResponse,
|
|
408
424
|
});
|
|
409
425
|
}
|
|
410
426
|
}
|
|
@@ -413,12 +429,14 @@ class Profiles {
|
|
|
413
429
|
throw new errors.CourierError({
|
|
414
430
|
statusCode: _response.error.statusCode,
|
|
415
431
|
body: _response.error.rawBody,
|
|
432
|
+
rawResponse: _response.rawResponse,
|
|
416
433
|
});
|
|
417
434
|
case "timeout":
|
|
418
|
-
throw new errors.CourierTimeoutError();
|
|
435
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /profiles/{user_id}/lists.");
|
|
419
436
|
case "unknown":
|
|
420
437
|
throw new errors.CourierError({
|
|
421
438
|
message: _response.error.errorMessage,
|
|
439
|
+
rawResponse: _response.rawResponse,
|
|
422
440
|
});
|
|
423
441
|
}
|
|
424
442
|
});
|
|
@@ -433,48 +451,45 @@ class Profiles {
|
|
|
433
451
|
* @throws {@link Courier.BadRequestError}
|
|
434
452
|
*
|
|
435
453
|
* @example
|
|
436
|
-
* await
|
|
454
|
+
* await client.profiles.subscribeToLists("user_id", {
|
|
437
455
|
* lists: [{
|
|
438
|
-
* listId: "
|
|
439
|
-
* preferences:
|
|
440
|
-
*
|
|
441
|
-
*
|
|
442
|
-
*
|
|
456
|
+
* listId: "listId",
|
|
457
|
+
* preferences: undefined
|
|
458
|
+
* }, {
|
|
459
|
+
* listId: "listId",
|
|
460
|
+
* preferences: undefined
|
|
443
461
|
* }]
|
|
444
462
|
* })
|
|
445
463
|
*/
|
|
446
464
|
subscribeToLists(userId, request, requestOptions) {
|
|
447
|
-
|
|
465
|
+
return core.HttpResponsePromise.fromPromise(this.__subscribeToLists(userId, request, requestOptions));
|
|
466
|
+
}
|
|
467
|
+
__subscribeToLists(userId, request, requestOptions) {
|
|
448
468
|
return __awaiter(this, void 0, void 0, function* () {
|
|
469
|
+
var _a, _b, _c;
|
|
449
470
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
450
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
471
|
+
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, `/profiles/${encodeURIComponent(userId)}/lists`),
|
|
451
472
|
method: "POST",
|
|
452
|
-
headers: {
|
|
453
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
454
|
-
"X-Fern-Language": "JavaScript",
|
|
455
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
456
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
457
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
458
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
459
|
-
"Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined,
|
|
460
|
-
"X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined,
|
|
461
|
-
},
|
|
473
|
+
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),
|
|
462
474
|
contentType: "application/json",
|
|
475
|
+
requestType: "json",
|
|
463
476
|
body: request,
|
|
464
477
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
465
478
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
479
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
466
480
|
});
|
|
467
481
|
if (_response.ok) {
|
|
468
|
-
return _response.body;
|
|
482
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
469
483
|
}
|
|
470
484
|
if (_response.error.reason === "status-code") {
|
|
471
485
|
switch (_response.error.statusCode) {
|
|
472
486
|
case 400:
|
|
473
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
487
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
474
488
|
default:
|
|
475
489
|
throw new errors.CourierError({
|
|
476
490
|
statusCode: _response.error.statusCode,
|
|
477
491
|
body: _response.error.body,
|
|
492
|
+
rawResponse: _response.rawResponse,
|
|
478
493
|
});
|
|
479
494
|
}
|
|
480
495
|
}
|
|
@@ -483,12 +498,14 @@ class Profiles {
|
|
|
483
498
|
throw new errors.CourierError({
|
|
484
499
|
statusCode: _response.error.statusCode,
|
|
485
500
|
body: _response.error.rawBody,
|
|
501
|
+
rawResponse: _response.rawResponse,
|
|
486
502
|
});
|
|
487
503
|
case "timeout":
|
|
488
|
-
throw new errors.CourierTimeoutError();
|
|
504
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling POST /profiles/{user_id}/lists.");
|
|
489
505
|
case "unknown":
|
|
490
506
|
throw new errors.CourierError({
|
|
491
507
|
message: _response.error.errorMessage,
|
|
508
|
+
rawResponse: _response.rawResponse,
|
|
492
509
|
});
|
|
493
510
|
}
|
|
494
511
|
});
|
|
@@ -502,37 +519,39 @@ class Profiles {
|
|
|
502
519
|
* @throws {@link Courier.BadRequestError}
|
|
503
520
|
*
|
|
504
521
|
* @example
|
|
505
|
-
* await
|
|
522
|
+
* await client.profiles.deleteListSubscription("user_id")
|
|
506
523
|
*/
|
|
507
524
|
deleteListSubscription(userId, requestOptions) {
|
|
508
|
-
|
|
525
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteListSubscription(userId, requestOptions));
|
|
526
|
+
}
|
|
527
|
+
__deleteListSubscription(userId, requestOptions) {
|
|
509
528
|
return __awaiter(this, void 0, void 0, function* () {
|
|
529
|
+
var _a, _b, _c;
|
|
510
530
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
511
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
531
|
+
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, `/profiles/${encodeURIComponent(userId)}/lists`),
|
|
512
532
|
method: "DELETE",
|
|
513
|
-
headers: {
|
|
514
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
515
|
-
"X-Fern-Language": "JavaScript",
|
|
516
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
517
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
518
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
519
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
520
|
-
},
|
|
533
|
+
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),
|
|
521
534
|
contentType: "application/json",
|
|
535
|
+
requestType: "json",
|
|
522
536
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
523
537
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
538
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
524
539
|
});
|
|
525
540
|
if (_response.ok) {
|
|
526
|
-
return
|
|
541
|
+
return {
|
|
542
|
+
data: _response.body,
|
|
543
|
+
rawResponse: _response.rawResponse,
|
|
544
|
+
};
|
|
527
545
|
}
|
|
528
546
|
if (_response.error.reason === "status-code") {
|
|
529
547
|
switch (_response.error.statusCode) {
|
|
530
548
|
case 400:
|
|
531
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
549
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
532
550
|
default:
|
|
533
551
|
throw new errors.CourierError({
|
|
534
552
|
statusCode: _response.error.statusCode,
|
|
535
553
|
body: _response.error.body,
|
|
554
|
+
rawResponse: _response.rawResponse,
|
|
536
555
|
});
|
|
537
556
|
}
|
|
538
557
|
}
|
|
@@ -541,23 +560,25 @@ class Profiles {
|
|
|
541
560
|
throw new errors.CourierError({
|
|
542
561
|
statusCode: _response.error.statusCode,
|
|
543
562
|
body: _response.error.rawBody,
|
|
563
|
+
rawResponse: _response.rawResponse,
|
|
544
564
|
});
|
|
545
565
|
case "timeout":
|
|
546
|
-
throw new errors.CourierTimeoutError();
|
|
566
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling DELETE /profiles/{user_id}/lists.");
|
|
547
567
|
case "unknown":
|
|
548
568
|
throw new errors.CourierError({
|
|
549
569
|
message: _response.error.errorMessage,
|
|
570
|
+
rawResponse: _response.rawResponse,
|
|
550
571
|
});
|
|
551
572
|
}
|
|
552
573
|
});
|
|
553
574
|
}
|
|
554
575
|
_getAuthorizationHeader() {
|
|
555
|
-
var _a;
|
|
556
576
|
return __awaiter(this, void 0, void 0, function* () {
|
|
577
|
+
var _a;
|
|
557
578
|
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"];
|
|
558
579
|
if (bearer == null) {
|
|
559
580
|
throw new errors.CourierError({
|
|
560
|
-
message: "Please specify
|
|
581
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a COURIER_AUTH_TOKEN environment variable",
|
|
561
582
|
});
|
|
562
583
|
}
|
|
563
584
|
return `Bearer ${bearer}`;
|