@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,14 +67,14 @@ class Lists {
|
|
|
57
67
|
* @throws {@link Courier.BadRequestError}
|
|
58
68
|
*
|
|
59
69
|
* @example
|
|
60
|
-
* await
|
|
61
|
-
* cursor: "string",
|
|
62
|
-
* pattern: "string"
|
|
63
|
-
* })
|
|
70
|
+
* await client.lists.list()
|
|
64
71
|
*/
|
|
65
72
|
list(request = {}, requestOptions) {
|
|
66
|
-
|
|
67
|
-
|
|
73
|
+
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
74
|
+
}
|
|
75
|
+
__list() {
|
|
76
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
77
|
+
var _a, _b, _c;
|
|
68
78
|
const { cursor, pattern } = request;
|
|
69
79
|
const _queryParams = {};
|
|
70
80
|
if (cursor != null) {
|
|
@@ -74,32 +84,28 @@ class Lists {
|
|
|
74
84
|
_queryParams["pattern"] = pattern;
|
|
75
85
|
}
|
|
76
86
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
77
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
87
|
+
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, "/lists"),
|
|
78
88
|
method: "GET",
|
|
79
|
-
headers: {
|
|
80
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
81
|
-
"X-Fern-Language": "JavaScript",
|
|
82
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
83
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
84
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
85
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
86
|
-
},
|
|
89
|
+
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),
|
|
87
90
|
contentType: "application/json",
|
|
88
91
|
queryParameters: _queryParams,
|
|
92
|
+
requestType: "json",
|
|
89
93
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
90
94
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
95
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
91
96
|
});
|
|
92
97
|
if (_response.ok) {
|
|
93
|
-
return _response.body;
|
|
98
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
94
99
|
}
|
|
95
100
|
if (_response.error.reason === "status-code") {
|
|
96
101
|
switch (_response.error.statusCode) {
|
|
97
102
|
case 400:
|
|
98
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
103
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
99
104
|
default:
|
|
100
105
|
throw new errors.CourierError({
|
|
101
106
|
statusCode: _response.error.statusCode,
|
|
102
107
|
body: _response.error.body,
|
|
108
|
+
rawResponse: _response.rawResponse,
|
|
103
109
|
});
|
|
104
110
|
}
|
|
105
111
|
}
|
|
@@ -108,12 +114,14 @@ class Lists {
|
|
|
108
114
|
throw new errors.CourierError({
|
|
109
115
|
statusCode: _response.error.statusCode,
|
|
110
116
|
body: _response.error.rawBody,
|
|
117
|
+
rawResponse: _response.rawResponse,
|
|
111
118
|
});
|
|
112
119
|
case "timeout":
|
|
113
|
-
throw new errors.CourierTimeoutError();
|
|
120
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /lists.");
|
|
114
121
|
case "unknown":
|
|
115
122
|
throw new errors.CourierError({
|
|
116
123
|
message: _response.error.errorMessage,
|
|
124
|
+
rawResponse: _response.rawResponse,
|
|
117
125
|
});
|
|
118
126
|
}
|
|
119
127
|
});
|
|
@@ -127,37 +135,36 @@ class Lists {
|
|
|
127
135
|
* @throws {@link Courier.NotFoundError}
|
|
128
136
|
*
|
|
129
137
|
* @example
|
|
130
|
-
* await
|
|
138
|
+
* await client.lists.get("list_id")
|
|
131
139
|
*/
|
|
132
140
|
get(listId, requestOptions) {
|
|
133
|
-
|
|
141
|
+
return core.HttpResponsePromise.fromPromise(this.__get(listId, requestOptions));
|
|
142
|
+
}
|
|
143
|
+
__get(listId, requestOptions) {
|
|
134
144
|
return __awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
var _a, _b, _c;
|
|
135
146
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
136
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
147
|
+
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, `/lists/${encodeURIComponent(listId)}`),
|
|
137
148
|
method: "GET",
|
|
138
|
-
headers: {
|
|
139
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
140
|
-
"X-Fern-Language": "JavaScript",
|
|
141
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
142
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
143
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
144
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
145
|
-
},
|
|
149
|
+
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),
|
|
146
150
|
contentType: "application/json",
|
|
151
|
+
requestType: "json",
|
|
147
152
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
148
153
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
154
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
149
155
|
});
|
|
150
156
|
if (_response.ok) {
|
|
151
|
-
return _response.body;
|
|
157
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
152
158
|
}
|
|
153
159
|
if (_response.error.reason === "status-code") {
|
|
154
160
|
switch (_response.error.statusCode) {
|
|
155
161
|
case 404:
|
|
156
|
-
throw new Courier.NotFoundError(_response.error.body);
|
|
162
|
+
throw new Courier.NotFoundError(_response.error.body, _response.rawResponse);
|
|
157
163
|
default:
|
|
158
164
|
throw new errors.CourierError({
|
|
159
165
|
statusCode: _response.error.statusCode,
|
|
160
166
|
body: _response.error.body,
|
|
167
|
+
rawResponse: _response.rawResponse,
|
|
161
168
|
});
|
|
162
169
|
}
|
|
163
170
|
}
|
|
@@ -166,12 +173,14 @@ class Lists {
|
|
|
166
173
|
throw new errors.CourierError({
|
|
167
174
|
statusCode: _response.error.statusCode,
|
|
168
175
|
body: _response.error.rawBody,
|
|
176
|
+
rawResponse: _response.rawResponse,
|
|
169
177
|
});
|
|
170
178
|
case "timeout":
|
|
171
|
-
throw new errors.CourierTimeoutError();
|
|
179
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /lists/{list_id}.");
|
|
172
180
|
case "unknown":
|
|
173
181
|
throw new errors.CourierError({
|
|
174
182
|
message: _response.error.errorMessage,
|
|
183
|
+
rawResponse: _response.rawResponse,
|
|
175
184
|
});
|
|
176
185
|
}
|
|
177
186
|
});
|
|
@@ -184,40 +193,36 @@ class Lists {
|
|
|
184
193
|
* @param {Lists.RequestOptions} requestOptions - Request-specific configuration.
|
|
185
194
|
*
|
|
186
195
|
* @example
|
|
187
|
-
* await
|
|
188
|
-
* name: "
|
|
189
|
-
* preferences:
|
|
190
|
-
* categories: {},
|
|
191
|
-
* notifications: {}
|
|
192
|
-
* }
|
|
196
|
+
* await client.lists.update("list_id", {
|
|
197
|
+
* name: "name",
|
|
198
|
+
* preferences: undefined
|
|
193
199
|
* })
|
|
194
200
|
*/
|
|
195
201
|
update(listId, request, requestOptions) {
|
|
196
|
-
|
|
202
|
+
return core.HttpResponsePromise.fromPromise(this.__update(listId, request, requestOptions));
|
|
203
|
+
}
|
|
204
|
+
__update(listId, request, requestOptions) {
|
|
197
205
|
return __awaiter(this, void 0, void 0, function* () {
|
|
206
|
+
var _a, _b, _c;
|
|
198
207
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
199
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
208
|
+
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, `/lists/${encodeURIComponent(listId)}`),
|
|
200
209
|
method: "PUT",
|
|
201
|
-
headers: {
|
|
202
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
203
|
-
"X-Fern-Language": "JavaScript",
|
|
204
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
205
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
206
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
207
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
208
|
-
},
|
|
210
|
+
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),
|
|
209
211
|
contentType: "application/json",
|
|
212
|
+
requestType: "json",
|
|
210
213
|
body: request,
|
|
211
214
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
212
215
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
216
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
213
217
|
});
|
|
214
218
|
if (_response.ok) {
|
|
215
|
-
return _response.body;
|
|
219
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
216
220
|
}
|
|
217
221
|
if (_response.error.reason === "status-code") {
|
|
218
222
|
throw new errors.CourierError({
|
|
219
223
|
statusCode: _response.error.statusCode,
|
|
220
224
|
body: _response.error.body,
|
|
225
|
+
rawResponse: _response.rawResponse,
|
|
221
226
|
});
|
|
222
227
|
}
|
|
223
228
|
switch (_response.error.reason) {
|
|
@@ -225,12 +230,14 @@ class Lists {
|
|
|
225
230
|
throw new errors.CourierError({
|
|
226
231
|
statusCode: _response.error.statusCode,
|
|
227
232
|
body: _response.error.rawBody,
|
|
233
|
+
rawResponse: _response.rawResponse,
|
|
228
234
|
});
|
|
229
235
|
case "timeout":
|
|
230
|
-
throw new errors.CourierTimeoutError();
|
|
236
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /lists/{list_id}.");
|
|
231
237
|
case "unknown":
|
|
232
238
|
throw new errors.CourierError({
|
|
233
239
|
message: _response.error.errorMessage,
|
|
240
|
+
rawResponse: _response.rawResponse,
|
|
234
241
|
});
|
|
235
242
|
}
|
|
236
243
|
});
|
|
@@ -242,33 +249,32 @@ class Lists {
|
|
|
242
249
|
* @param {Lists.RequestOptions} requestOptions - Request-specific configuration.
|
|
243
250
|
*
|
|
244
251
|
* @example
|
|
245
|
-
* await
|
|
252
|
+
* await client.lists.delete("list_id")
|
|
246
253
|
*/
|
|
247
254
|
delete(listId, requestOptions) {
|
|
248
|
-
|
|
255
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(listId, requestOptions));
|
|
256
|
+
}
|
|
257
|
+
__delete(listId, requestOptions) {
|
|
249
258
|
return __awaiter(this, void 0, void 0, function* () {
|
|
259
|
+
var _a, _b, _c;
|
|
250
260
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
251
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
261
|
+
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, `/lists/${encodeURIComponent(listId)}`),
|
|
252
262
|
method: "DELETE",
|
|
253
|
-
headers: {
|
|
254
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
255
|
-
"X-Fern-Language": "JavaScript",
|
|
256
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
257
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
258
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
259
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
260
|
-
},
|
|
263
|
+
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),
|
|
261
264
|
contentType: "application/json",
|
|
265
|
+
requestType: "json",
|
|
262
266
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
263
267
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
268
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
264
269
|
});
|
|
265
270
|
if (_response.ok) {
|
|
266
|
-
return;
|
|
271
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
267
272
|
}
|
|
268
273
|
if (_response.error.reason === "status-code") {
|
|
269
274
|
throw new errors.CourierError({
|
|
270
275
|
statusCode: _response.error.statusCode,
|
|
271
276
|
body: _response.error.body,
|
|
277
|
+
rawResponse: _response.rawResponse,
|
|
272
278
|
});
|
|
273
279
|
}
|
|
274
280
|
switch (_response.error.reason) {
|
|
@@ -276,12 +282,14 @@ class Lists {
|
|
|
276
282
|
throw new errors.CourierError({
|
|
277
283
|
statusCode: _response.error.statusCode,
|
|
278
284
|
body: _response.error.rawBody,
|
|
285
|
+
rawResponse: _response.rawResponse,
|
|
279
286
|
});
|
|
280
287
|
case "timeout":
|
|
281
|
-
throw new errors.CourierTimeoutError();
|
|
288
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling DELETE /lists/{list_id}.");
|
|
282
289
|
case "unknown":
|
|
283
290
|
throw new errors.CourierError({
|
|
284
291
|
message: _response.error.errorMessage,
|
|
292
|
+
rawResponse: _response.rawResponse,
|
|
285
293
|
});
|
|
286
294
|
}
|
|
287
295
|
});
|
|
@@ -293,33 +301,32 @@ class Lists {
|
|
|
293
301
|
* @param {Lists.RequestOptions} requestOptions - Request-specific configuration.
|
|
294
302
|
*
|
|
295
303
|
* @example
|
|
296
|
-
* await
|
|
304
|
+
* await client.lists.restore("list_id")
|
|
297
305
|
*/
|
|
298
306
|
restore(listId, requestOptions) {
|
|
299
|
-
|
|
307
|
+
return core.HttpResponsePromise.fromPromise(this.__restore(listId, requestOptions));
|
|
308
|
+
}
|
|
309
|
+
__restore(listId, requestOptions) {
|
|
300
310
|
return __awaiter(this, void 0, void 0, function* () {
|
|
311
|
+
var _a, _b, _c;
|
|
301
312
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
302
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
313
|
+
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, `/lists/${encodeURIComponent(listId)}/restore`),
|
|
303
314
|
method: "PUT",
|
|
304
|
-
headers: {
|
|
305
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
306
|
-
"X-Fern-Language": "JavaScript",
|
|
307
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
308
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
309
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
310
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
311
|
-
},
|
|
315
|
+
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),
|
|
312
316
|
contentType: "application/json",
|
|
317
|
+
requestType: "json",
|
|
313
318
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
314
319
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
320
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
315
321
|
});
|
|
316
322
|
if (_response.ok) {
|
|
317
|
-
return;
|
|
323
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
318
324
|
}
|
|
319
325
|
if (_response.error.reason === "status-code") {
|
|
320
326
|
throw new errors.CourierError({
|
|
321
327
|
statusCode: _response.error.statusCode,
|
|
322
328
|
body: _response.error.body,
|
|
329
|
+
rawResponse: _response.rawResponse,
|
|
323
330
|
});
|
|
324
331
|
}
|
|
325
332
|
switch (_response.error.reason) {
|
|
@@ -327,12 +334,14 @@ class Lists {
|
|
|
327
334
|
throw new errors.CourierError({
|
|
328
335
|
statusCode: _response.error.statusCode,
|
|
329
336
|
body: _response.error.rawBody,
|
|
337
|
+
rawResponse: _response.rawResponse,
|
|
330
338
|
});
|
|
331
339
|
case "timeout":
|
|
332
|
-
throw new errors.CourierTimeoutError();
|
|
340
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /lists/{list_id}/restore.");
|
|
333
341
|
case "unknown":
|
|
334
342
|
throw new errors.CourierError({
|
|
335
343
|
message: _response.error.errorMessage,
|
|
344
|
+
rawResponse: _response.rawResponse,
|
|
336
345
|
});
|
|
337
346
|
}
|
|
338
347
|
});
|
|
@@ -347,45 +356,42 @@ class Lists {
|
|
|
347
356
|
* @throws {@link Courier.NotFoundError}
|
|
348
357
|
*
|
|
349
358
|
* @example
|
|
350
|
-
* await
|
|
351
|
-
* cursor: "string"
|
|
352
|
-
* })
|
|
359
|
+
* await client.lists.getSubscribers("list_id")
|
|
353
360
|
*/
|
|
354
361
|
getSubscribers(listId, request = {}, requestOptions) {
|
|
355
|
-
|
|
356
|
-
|
|
362
|
+
return core.HttpResponsePromise.fromPromise(this.__getSubscribers(listId, request, requestOptions));
|
|
363
|
+
}
|
|
364
|
+
__getSubscribers(listId_1) {
|
|
365
|
+
return __awaiter(this, arguments, void 0, function* (listId, request = {}, requestOptions) {
|
|
366
|
+
var _a, _b, _c;
|
|
357
367
|
const { cursor } = request;
|
|
358
368
|
const _queryParams = {};
|
|
359
369
|
if (cursor != null) {
|
|
360
370
|
_queryParams["cursor"] = cursor;
|
|
361
371
|
}
|
|
362
372
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
363
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
373
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CourierEnvironment.Production, `/lists/${encodeURIComponent(listId)}/subscriptions`),
|
|
364
374
|
method: "GET",
|
|
365
|
-
headers: {
|
|
366
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
367
|
-
"X-Fern-Language": "JavaScript",
|
|
368
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
369
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
370
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
371
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
372
|
-
},
|
|
375
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.1", "User-Agent": "@trycourier/courier/6.4.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
373
376
|
contentType: "application/json",
|
|
374
377
|
queryParameters: _queryParams,
|
|
378
|
+
requestType: "json",
|
|
375
379
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
376
380
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
381
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
377
382
|
});
|
|
378
383
|
if (_response.ok) {
|
|
379
|
-
return _response.body;
|
|
384
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
380
385
|
}
|
|
381
386
|
if (_response.error.reason === "status-code") {
|
|
382
387
|
switch (_response.error.statusCode) {
|
|
383
388
|
case 404:
|
|
384
|
-
throw new Courier.NotFoundError(_response.error.body);
|
|
389
|
+
throw new Courier.NotFoundError(_response.error.body, _response.rawResponse);
|
|
385
390
|
default:
|
|
386
391
|
throw new errors.CourierError({
|
|
387
392
|
statusCode: _response.error.statusCode,
|
|
388
393
|
body: _response.error.body,
|
|
394
|
+
rawResponse: _response.rawResponse,
|
|
389
395
|
});
|
|
390
396
|
}
|
|
391
397
|
}
|
|
@@ -394,12 +400,14 @@ class Lists {
|
|
|
394
400
|
throw new errors.CourierError({
|
|
395
401
|
statusCode: _response.error.statusCode,
|
|
396
402
|
body: _response.error.rawBody,
|
|
403
|
+
rawResponse: _response.rawResponse,
|
|
397
404
|
});
|
|
398
405
|
case "timeout":
|
|
399
|
-
throw new errors.CourierTimeoutError();
|
|
406
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /lists/{list_id}/subscriptions.");
|
|
400
407
|
case "unknown":
|
|
401
408
|
throw new errors.CourierError({
|
|
402
409
|
message: _response.error.errorMessage,
|
|
410
|
+
rawResponse: _response.rawResponse,
|
|
403
411
|
});
|
|
404
412
|
}
|
|
405
413
|
});
|
|
@@ -414,46 +422,45 @@ class Lists {
|
|
|
414
422
|
* @throws {@link Courier.BadRequestError}
|
|
415
423
|
*
|
|
416
424
|
* @example
|
|
417
|
-
* await
|
|
425
|
+
* await client.lists.updateSubscribers("list_id", {
|
|
418
426
|
* recipients: [{
|
|
419
|
-
* recipientId: "
|
|
420
|
-
* preferences:
|
|
421
|
-
*
|
|
422
|
-
*
|
|
423
|
-
*
|
|
427
|
+
* recipientId: "recipientId",
|
|
428
|
+
* preferences: undefined
|
|
429
|
+
* }, {
|
|
430
|
+
* recipientId: "recipientId",
|
|
431
|
+
* preferences: undefined
|
|
424
432
|
* }]
|
|
425
433
|
* })
|
|
426
434
|
*/
|
|
427
435
|
updateSubscribers(listId, request, requestOptions) {
|
|
428
|
-
|
|
436
|
+
return core.HttpResponsePromise.fromPromise(this.__updateSubscribers(listId, request, requestOptions));
|
|
437
|
+
}
|
|
438
|
+
__updateSubscribers(listId, request, requestOptions) {
|
|
429
439
|
return __awaiter(this, void 0, void 0, function* () {
|
|
440
|
+
var _a, _b, _c;
|
|
430
441
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
431
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
442
|
+
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, `/lists/${encodeURIComponent(listId)}/subscriptions`),
|
|
432
443
|
method: "PUT",
|
|
433
|
-
headers: {
|
|
434
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
435
|
-
"X-Fern-Language": "JavaScript",
|
|
436
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
437
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
438
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
439
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
440
|
-
},
|
|
444
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.1", "User-Agent": "@trycourier/courier/6.4.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
441
445
|
contentType: "application/json",
|
|
446
|
+
requestType: "json",
|
|
442
447
|
body: request,
|
|
443
448
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
444
449
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
450
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
445
451
|
});
|
|
446
452
|
if (_response.ok) {
|
|
447
|
-
return;
|
|
453
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
448
454
|
}
|
|
449
455
|
if (_response.error.reason === "status-code") {
|
|
450
456
|
switch (_response.error.statusCode) {
|
|
451
457
|
case 400:
|
|
452
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
458
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
453
459
|
default:
|
|
454
460
|
throw new errors.CourierError({
|
|
455
461
|
statusCode: _response.error.statusCode,
|
|
456
462
|
body: _response.error.body,
|
|
463
|
+
rawResponse: _response.rawResponse,
|
|
457
464
|
});
|
|
458
465
|
}
|
|
459
466
|
}
|
|
@@ -462,12 +469,14 @@ class Lists {
|
|
|
462
469
|
throw new errors.CourierError({
|
|
463
470
|
statusCode: _response.error.statusCode,
|
|
464
471
|
body: _response.error.rawBody,
|
|
472
|
+
rawResponse: _response.rawResponse,
|
|
465
473
|
});
|
|
466
474
|
case "timeout":
|
|
467
|
-
throw new errors.CourierTimeoutError();
|
|
475
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /lists/{list_id}/subscriptions.");
|
|
468
476
|
case "unknown":
|
|
469
477
|
throw new errors.CourierError({
|
|
470
478
|
message: _response.error.errorMessage,
|
|
479
|
+
rawResponse: _response.rawResponse,
|
|
471
480
|
});
|
|
472
481
|
}
|
|
473
482
|
});
|
|
@@ -482,48 +491,45 @@ class Lists {
|
|
|
482
491
|
* @throws {@link Courier.BadRequestError}
|
|
483
492
|
*
|
|
484
493
|
* @example
|
|
485
|
-
* await
|
|
494
|
+
* await client.lists.addSubscribers("list_id", {
|
|
486
495
|
* recipients: [{
|
|
487
|
-
* recipientId: "
|
|
488
|
-
* preferences:
|
|
489
|
-
*
|
|
490
|
-
*
|
|
491
|
-
*
|
|
496
|
+
* recipientId: "recipientId",
|
|
497
|
+
* preferences: undefined
|
|
498
|
+
* }, {
|
|
499
|
+
* recipientId: "recipientId",
|
|
500
|
+
* preferences: undefined
|
|
492
501
|
* }]
|
|
493
502
|
* })
|
|
494
503
|
*/
|
|
495
504
|
addSubscribers(listId, request, requestOptions) {
|
|
496
|
-
|
|
505
|
+
return core.HttpResponsePromise.fromPromise(this.__addSubscribers(listId, request, requestOptions));
|
|
506
|
+
}
|
|
507
|
+
__addSubscribers(listId, request, requestOptions) {
|
|
497
508
|
return __awaiter(this, void 0, void 0, function* () {
|
|
509
|
+
var _a, _b, _c;
|
|
498
510
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
499
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
511
|
+
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, `/lists/${encodeURIComponent(listId)}/subscriptions`),
|
|
500
512
|
method: "POST",
|
|
501
|
-
headers: {
|
|
502
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
503
|
-
"X-Fern-Language": "JavaScript",
|
|
504
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
505
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
506
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
507
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
508
|
-
"Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined,
|
|
509
|
-
"X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined,
|
|
510
|
-
},
|
|
513
|
+
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),
|
|
511
514
|
contentType: "application/json",
|
|
515
|
+
requestType: "json",
|
|
512
516
|
body: request,
|
|
513
517
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
514
518
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
519
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
515
520
|
});
|
|
516
521
|
if (_response.ok) {
|
|
517
|
-
return;
|
|
522
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
518
523
|
}
|
|
519
524
|
if (_response.error.reason === "status-code") {
|
|
520
525
|
switch (_response.error.statusCode) {
|
|
521
526
|
case 400:
|
|
522
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
527
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
523
528
|
default:
|
|
524
529
|
throw new errors.CourierError({
|
|
525
530
|
statusCode: _response.error.statusCode,
|
|
526
531
|
body: _response.error.body,
|
|
532
|
+
rawResponse: _response.rawResponse,
|
|
527
533
|
});
|
|
528
534
|
}
|
|
529
535
|
}
|
|
@@ -532,12 +538,14 @@ class Lists {
|
|
|
532
538
|
throw new errors.CourierError({
|
|
533
539
|
statusCode: _response.error.statusCode,
|
|
534
540
|
body: _response.error.rawBody,
|
|
541
|
+
rawResponse: _response.rawResponse,
|
|
535
542
|
});
|
|
536
543
|
case "timeout":
|
|
537
|
-
throw new errors.CourierTimeoutError();
|
|
544
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling POST /lists/{list_id}/subscriptions.");
|
|
538
545
|
case "unknown":
|
|
539
546
|
throw new errors.CourierError({
|
|
540
547
|
message: _response.error.errorMessage,
|
|
548
|
+
rawResponse: _response.rawResponse,
|
|
541
549
|
});
|
|
542
550
|
}
|
|
543
551
|
});
|
|
@@ -551,39 +559,35 @@ class Lists {
|
|
|
551
559
|
* @param {Lists.RequestOptions} requestOptions - Request-specific configuration.
|
|
552
560
|
*
|
|
553
561
|
* @example
|
|
554
|
-
* await
|
|
555
|
-
* preferences:
|
|
556
|
-
* categories: {},
|
|
557
|
-
* notifications: {}
|
|
558
|
-
* }
|
|
562
|
+
* await client.lists.subscribe("list_id", "user_id", {
|
|
563
|
+
* preferences: undefined
|
|
559
564
|
* })
|
|
560
565
|
*/
|
|
561
566
|
subscribe(listId, userId, request = {}, requestOptions) {
|
|
562
|
-
|
|
563
|
-
|
|
567
|
+
return core.HttpResponsePromise.fromPromise(this.__subscribe(listId, userId, request, requestOptions));
|
|
568
|
+
}
|
|
569
|
+
__subscribe(listId_1, userId_1) {
|
|
570
|
+
return __awaiter(this, arguments, void 0, function* (listId, userId, request = {}, requestOptions) {
|
|
571
|
+
var _a, _b, _c;
|
|
564
572
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
565
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
573
|
+
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, `/lists/${encodeURIComponent(listId)}/subscriptions/${encodeURIComponent(userId)}`),
|
|
566
574
|
method: "PUT",
|
|
567
|
-
headers: {
|
|
568
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
569
|
-
"X-Fern-Language": "JavaScript",
|
|
570
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
571
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
572
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
573
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
574
|
-
},
|
|
575
|
+
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),
|
|
575
576
|
contentType: "application/json",
|
|
577
|
+
requestType: "json",
|
|
576
578
|
body: request,
|
|
577
579
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
578
580
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
581
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
579
582
|
});
|
|
580
583
|
if (_response.ok) {
|
|
581
|
-
return;
|
|
584
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
582
585
|
}
|
|
583
586
|
if (_response.error.reason === "status-code") {
|
|
584
587
|
throw new errors.CourierError({
|
|
585
588
|
statusCode: _response.error.statusCode,
|
|
586
589
|
body: _response.error.body,
|
|
590
|
+
rawResponse: _response.rawResponse,
|
|
587
591
|
});
|
|
588
592
|
}
|
|
589
593
|
switch (_response.error.reason) {
|
|
@@ -591,12 +595,14 @@ class Lists {
|
|
|
591
595
|
throw new errors.CourierError({
|
|
592
596
|
statusCode: _response.error.statusCode,
|
|
593
597
|
body: _response.error.rawBody,
|
|
598
|
+
rawResponse: _response.rawResponse,
|
|
594
599
|
});
|
|
595
600
|
case "timeout":
|
|
596
|
-
throw new errors.CourierTimeoutError();
|
|
601
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /lists/{list_id}/subscriptions/{user_id}.");
|
|
597
602
|
case "unknown":
|
|
598
603
|
throw new errors.CourierError({
|
|
599
604
|
message: _response.error.errorMessage,
|
|
605
|
+
rawResponse: _response.rawResponse,
|
|
600
606
|
});
|
|
601
607
|
}
|
|
602
608
|
});
|
|
@@ -611,37 +617,36 @@ class Lists {
|
|
|
611
617
|
* @throws {@link Courier.NotFoundError}
|
|
612
618
|
*
|
|
613
619
|
* @example
|
|
614
|
-
* await
|
|
620
|
+
* await client.lists.unsubscribe("list_id", "user_id")
|
|
615
621
|
*/
|
|
616
622
|
unsubscribe(listId, userId, requestOptions) {
|
|
617
|
-
|
|
623
|
+
return core.HttpResponsePromise.fromPromise(this.__unsubscribe(listId, userId, requestOptions));
|
|
624
|
+
}
|
|
625
|
+
__unsubscribe(listId, userId, requestOptions) {
|
|
618
626
|
return __awaiter(this, void 0, void 0, function* () {
|
|
627
|
+
var _a, _b, _c;
|
|
619
628
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
620
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
629
|
+
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, `/lists/${encodeURIComponent(listId)}/subscriptions/${encodeURIComponent(userId)}`),
|
|
621
630
|
method: "DELETE",
|
|
622
|
-
headers: {
|
|
623
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
624
|
-
"X-Fern-Language": "JavaScript",
|
|
625
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
626
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
627
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
628
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
629
|
-
},
|
|
631
|
+
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),
|
|
630
632
|
contentType: "application/json",
|
|
633
|
+
requestType: "json",
|
|
631
634
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
632
635
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
636
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
633
637
|
});
|
|
634
638
|
if (_response.ok) {
|
|
635
|
-
return;
|
|
639
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
636
640
|
}
|
|
637
641
|
if (_response.error.reason === "status-code") {
|
|
638
642
|
switch (_response.error.statusCode) {
|
|
639
643
|
case 404:
|
|
640
|
-
throw new Courier.NotFoundError(_response.error.body);
|
|
644
|
+
throw new Courier.NotFoundError(_response.error.body, _response.rawResponse);
|
|
641
645
|
default:
|
|
642
646
|
throw new errors.CourierError({
|
|
643
647
|
statusCode: _response.error.statusCode,
|
|
644
648
|
body: _response.error.body,
|
|
649
|
+
rawResponse: _response.rawResponse,
|
|
645
650
|
});
|
|
646
651
|
}
|
|
647
652
|
}
|
|
@@ -650,23 +655,25 @@ class Lists {
|
|
|
650
655
|
throw new errors.CourierError({
|
|
651
656
|
statusCode: _response.error.statusCode,
|
|
652
657
|
body: _response.error.rawBody,
|
|
658
|
+
rawResponse: _response.rawResponse,
|
|
653
659
|
});
|
|
654
660
|
case "timeout":
|
|
655
|
-
throw new errors.CourierTimeoutError();
|
|
661
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling DELETE /lists/{list_id}/subscriptions/{user_id}.");
|
|
656
662
|
case "unknown":
|
|
657
663
|
throw new errors.CourierError({
|
|
658
664
|
message: _response.error.errorMessage,
|
|
665
|
+
rawResponse: _response.rawResponse,
|
|
659
666
|
});
|
|
660
667
|
}
|
|
661
668
|
});
|
|
662
669
|
}
|
|
663
670
|
_getAuthorizationHeader() {
|
|
664
|
-
var _a;
|
|
665
671
|
return __awaiter(this, void 0, void 0, function* () {
|
|
672
|
+
var _a;
|
|
666
673
|
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"];
|
|
667
674
|
if (bearer == null) {
|
|
668
675
|
throw new errors.CourierError({
|
|
669
|
-
message: "Please specify
|
|
676
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a COURIER_AUTH_TOKEN environment variable",
|
|
670
677
|
});
|
|
671
678
|
}
|
|
672
679
|
return `Bearer ${bearer}`;
|