@trycourier/courier 6.3.1 → 6.4.0
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 +84 -109
- package/Client.js +118 -148
- package/api/client/requests/SendMessageRequest.d.ts +45 -78
- package/api/resources/audiences/client/Client.d.ts +16 -16
- package/api/resources/audiences/client/Client.js +63 -86
- 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 +10 -4
- package/api/resources/auditEvents/client/Client.js +35 -37
- package/api/resources/auditEvents/client/requests/ListAuditEventsRequest.d.ts +1 -3
- package/api/resources/authTokens/client/Client.d.ts +11 -3
- package/api/resources/authTokens/client/Client.js +28 -25
- package/api/resources/authTokens/client/requests/IssueTokenParams.d.ts +2 -2
- package/api/resources/automations/client/Client.d.ts +15 -13
- package/api/resources/automations/client/Client.js +38 -48
- 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 +22 -58
- package/api/resources/brands/client/Client.js +65 -126
- 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 +30 -121
- package/api/resources/bulk/client/Client.js +73 -193
- 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.js +17 -7
- package/api/resources/commons/errors/BadRequestError.js +17 -7
- package/api/resources/commons/errors/ConflictError.js +17 -7
- package/api/resources/commons/errors/MessageNotFoundError.js +17 -7
- package/api/resources/commons/errors/NotFoundError.js +17 -7
- package/api/resources/commons/errors/PaymentRequiredError.js +17 -7
- 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 +9 -1
- package/api/resources/inbound/client/Client.js +26 -21
- package/api/resources/index.js +17 -7
- package/api/resources/lists/client/Client.d.ts +31 -34
- package/api/resources/lists/client/Client.js +108 -161
- 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 +15 -24
- package/api/resources/messages/client/Client.js +65 -104
- 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 +20 -11
- package/api/resources/notifications/client/Client.js +69 -88
- 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 +35 -23
- package/api/resources/profiles/client/Client.js +95 -125
- 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 +9 -3
- package/api/resources/templates/client/Client.js +28 -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 +23 -37
- package/api/resources/tenants/client/Client.js +80 -127
- 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 +10 -2
- package/api/resources/translations/client/Client.js +33 -33
- 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 +13 -9
- package/api/resources/users/resources/preferences/client/Client.js +46 -55
- 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 +23 -21
- package/api/resources/users/resources/tenants/client/Client.js +68 -89
- 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 +27 -29
- package/api/resources/users/resources/tokens/client/Client.js +74 -104
- 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 +1 -1
- package/core/fetcher/Fetcher.d.ts +7 -3
- package/core/fetcher/Fetcher.js +30 -135
- 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/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/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 +84 -109
- package/dist/Client.js +118 -148
- package/dist/api/client/requests/SendMessageRequest.d.ts +45 -78
- package/dist/api/resources/audiences/client/Client.d.ts +16 -16
- package/dist/api/resources/audiences/client/Client.js +63 -86
- 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 +10 -4
- package/dist/api/resources/auditEvents/client/Client.js +35 -37
- package/dist/api/resources/auditEvents/client/requests/ListAuditEventsRequest.d.ts +1 -3
- package/dist/api/resources/authTokens/client/Client.d.ts +11 -3
- package/dist/api/resources/authTokens/client/Client.js +28 -25
- package/dist/api/resources/authTokens/client/requests/IssueTokenParams.d.ts +2 -2
- package/dist/api/resources/automations/client/Client.d.ts +15 -13
- package/dist/api/resources/automations/client/Client.js +38 -48
- 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 +22 -58
- package/dist/api/resources/brands/client/Client.js +65 -126
- 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 +30 -121
- package/dist/api/resources/bulk/client/Client.js +73 -193
- 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.js +17 -7
- package/dist/api/resources/commons/errors/BadRequestError.js +17 -7
- package/dist/api/resources/commons/errors/ConflictError.js +17 -7
- package/dist/api/resources/commons/errors/MessageNotFoundError.js +17 -7
- package/dist/api/resources/commons/errors/NotFoundError.js +17 -7
- package/dist/api/resources/commons/errors/PaymentRequiredError.js +17 -7
- 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 +9 -1
- package/dist/api/resources/inbound/client/Client.js +26 -21
- package/dist/api/resources/index.js +17 -7
- package/dist/api/resources/lists/client/Client.d.ts +31 -34
- package/dist/api/resources/lists/client/Client.js +108 -161
- 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 +15 -24
- package/dist/api/resources/messages/client/Client.js +65 -104
- 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 +20 -11
- package/dist/api/resources/notifications/client/Client.js +69 -88
- 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 +35 -23
- package/dist/api/resources/profiles/client/Client.js +95 -125
- 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 +9 -3
- package/dist/api/resources/templates/client/Client.js +28 -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 +23 -37
- package/dist/api/resources/tenants/client/Client.js +80 -127
- 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 +10 -2
- package/dist/api/resources/translations/client/Client.js +33 -33
- 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 +13 -9
- package/dist/api/resources/users/resources/preferences/client/Client.js +46 -55
- 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 +23 -21
- package/dist/api/resources/users/resources/tenants/client/Client.js +68 -89
- 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 +27 -29
- package/dist/api/resources/users/resources/tokens/client/Client.js +74 -104
- 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 +1 -1
- package/dist/core/fetcher/Fetcher.d.ts +7 -3
- package/dist/core/fetcher/Fetcher.js +30 -135
- 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/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/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.js +2 -1
- 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.js +2 -1
- 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 +23 -14
- package/reference.md +5180 -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,11 @@ 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
|
-
list(
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
list() {
|
|
73
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
74
|
+
var _a, _b, _c;
|
|
68
75
|
const { cursor, pattern } = request;
|
|
69
76
|
const _queryParams = {};
|
|
70
77
|
if (cursor != null) {
|
|
@@ -74,20 +81,15 @@ class Lists {
|
|
|
74
81
|
_queryParams["pattern"] = pattern;
|
|
75
82
|
}
|
|
76
83
|
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.
|
|
84
|
+
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
85
|
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
|
-
},
|
|
86
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.0", "User-Agent": "@trycourier/courier/6.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
87
87
|
contentType: "application/json",
|
|
88
88
|
queryParameters: _queryParams,
|
|
89
|
+
requestType: "json",
|
|
89
90
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
90
91
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
92
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
91
93
|
});
|
|
92
94
|
if (_response.ok) {
|
|
93
95
|
return _response.body;
|
|
@@ -110,7 +112,7 @@ class Lists {
|
|
|
110
112
|
body: _response.error.rawBody,
|
|
111
113
|
});
|
|
112
114
|
case "timeout":
|
|
113
|
-
throw new errors.CourierTimeoutError();
|
|
115
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /lists.");
|
|
114
116
|
case "unknown":
|
|
115
117
|
throw new errors.CourierError({
|
|
116
118
|
message: _response.error.errorMessage,
|
|
@@ -127,25 +129,20 @@ class Lists {
|
|
|
127
129
|
* @throws {@link Courier.NotFoundError}
|
|
128
130
|
*
|
|
129
131
|
* @example
|
|
130
|
-
* await
|
|
132
|
+
* await client.lists.get("list_id")
|
|
131
133
|
*/
|
|
132
134
|
get(listId, requestOptions) {
|
|
133
|
-
var _a, _b;
|
|
134
135
|
return __awaiter(this, void 0, void 0, function* () {
|
|
136
|
+
var _a, _b, _c;
|
|
135
137
|
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.
|
|
138
|
+
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
139
|
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
|
-
},
|
|
140
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.0", "User-Agent": "@trycourier/courier/6.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
146
141
|
contentType: "application/json",
|
|
142
|
+
requestType: "json",
|
|
147
143
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
148
144
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
145
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
149
146
|
});
|
|
150
147
|
if (_response.ok) {
|
|
151
148
|
return _response.body;
|
|
@@ -168,7 +165,7 @@ class Lists {
|
|
|
168
165
|
body: _response.error.rawBody,
|
|
169
166
|
});
|
|
170
167
|
case "timeout":
|
|
171
|
-
throw new errors.CourierTimeoutError();
|
|
168
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /lists/{list_id}.");
|
|
172
169
|
case "unknown":
|
|
173
170
|
throw new errors.CourierError({
|
|
174
171
|
message: _response.error.errorMessage,
|
|
@@ -184,32 +181,24 @@ class Lists {
|
|
|
184
181
|
* @param {Lists.RequestOptions} requestOptions - Request-specific configuration.
|
|
185
182
|
*
|
|
186
183
|
* @example
|
|
187
|
-
* await
|
|
188
|
-
* name: "
|
|
189
|
-
* preferences:
|
|
190
|
-
* categories: {},
|
|
191
|
-
* notifications: {}
|
|
192
|
-
* }
|
|
184
|
+
* await client.lists.update("list_id", {
|
|
185
|
+
* name: "name",
|
|
186
|
+
* preferences: undefined
|
|
193
187
|
* })
|
|
194
188
|
*/
|
|
195
189
|
update(listId, request, requestOptions) {
|
|
196
|
-
var _a, _b;
|
|
197
190
|
return __awaiter(this, void 0, void 0, function* () {
|
|
191
|
+
var _a, _b, _c;
|
|
198
192
|
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.
|
|
193
|
+
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
194
|
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
|
-
},
|
|
195
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.0", "User-Agent": "@trycourier/courier/6.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
209
196
|
contentType: "application/json",
|
|
197
|
+
requestType: "json",
|
|
210
198
|
body: request,
|
|
211
199
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
212
200
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
201
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
213
202
|
});
|
|
214
203
|
if (_response.ok) {
|
|
215
204
|
return _response.body;
|
|
@@ -227,7 +216,7 @@ class Lists {
|
|
|
227
216
|
body: _response.error.rawBody,
|
|
228
217
|
});
|
|
229
218
|
case "timeout":
|
|
230
|
-
throw new errors.CourierTimeoutError();
|
|
219
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /lists/{list_id}.");
|
|
231
220
|
case "unknown":
|
|
232
221
|
throw new errors.CourierError({
|
|
233
222
|
message: _response.error.errorMessage,
|
|
@@ -242,25 +231,20 @@ class Lists {
|
|
|
242
231
|
* @param {Lists.RequestOptions} requestOptions - Request-specific configuration.
|
|
243
232
|
*
|
|
244
233
|
* @example
|
|
245
|
-
* await
|
|
234
|
+
* await client.lists.delete("list_id")
|
|
246
235
|
*/
|
|
247
236
|
delete(listId, requestOptions) {
|
|
248
|
-
var _a, _b;
|
|
249
237
|
return __awaiter(this, void 0, void 0, function* () {
|
|
238
|
+
var _a, _b, _c;
|
|
250
239
|
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.
|
|
240
|
+
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
241
|
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
|
-
},
|
|
242
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.0", "User-Agent": "@trycourier/courier/6.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
261
243
|
contentType: "application/json",
|
|
244
|
+
requestType: "json",
|
|
262
245
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
263
246
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
247
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
264
248
|
});
|
|
265
249
|
if (_response.ok) {
|
|
266
250
|
return;
|
|
@@ -278,7 +262,7 @@ class Lists {
|
|
|
278
262
|
body: _response.error.rawBody,
|
|
279
263
|
});
|
|
280
264
|
case "timeout":
|
|
281
|
-
throw new errors.CourierTimeoutError();
|
|
265
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling DELETE /lists/{list_id}.");
|
|
282
266
|
case "unknown":
|
|
283
267
|
throw new errors.CourierError({
|
|
284
268
|
message: _response.error.errorMessage,
|
|
@@ -293,25 +277,20 @@ class Lists {
|
|
|
293
277
|
* @param {Lists.RequestOptions} requestOptions - Request-specific configuration.
|
|
294
278
|
*
|
|
295
279
|
* @example
|
|
296
|
-
* await
|
|
280
|
+
* await client.lists.restore("list_id")
|
|
297
281
|
*/
|
|
298
282
|
restore(listId, requestOptions) {
|
|
299
|
-
var _a, _b;
|
|
300
283
|
return __awaiter(this, void 0, void 0, function* () {
|
|
284
|
+
var _a, _b, _c;
|
|
301
285
|
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.
|
|
286
|
+
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
287
|
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
|
-
},
|
|
288
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.0", "User-Agent": "@trycourier/courier/6.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
312
289
|
contentType: "application/json",
|
|
290
|
+
requestType: "json",
|
|
313
291
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
314
292
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
293
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
315
294
|
});
|
|
316
295
|
if (_response.ok) {
|
|
317
296
|
return;
|
|
@@ -329,7 +308,7 @@ class Lists {
|
|
|
329
308
|
body: _response.error.rawBody,
|
|
330
309
|
});
|
|
331
310
|
case "timeout":
|
|
332
|
-
throw new errors.CourierTimeoutError();
|
|
311
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /lists/{list_id}/restore.");
|
|
333
312
|
case "unknown":
|
|
334
313
|
throw new errors.CourierError({
|
|
335
314
|
message: _response.error.errorMessage,
|
|
@@ -347,33 +326,26 @@ class Lists {
|
|
|
347
326
|
* @throws {@link Courier.NotFoundError}
|
|
348
327
|
*
|
|
349
328
|
* @example
|
|
350
|
-
* await
|
|
351
|
-
* cursor: "string"
|
|
352
|
-
* })
|
|
329
|
+
* await client.lists.getSubscribers("list_id")
|
|
353
330
|
*/
|
|
354
|
-
getSubscribers(
|
|
355
|
-
|
|
356
|
-
|
|
331
|
+
getSubscribers(listId_1) {
|
|
332
|
+
return __awaiter(this, arguments, void 0, function* (listId, request = {}, requestOptions) {
|
|
333
|
+
var _a, _b, _c;
|
|
357
334
|
const { cursor } = request;
|
|
358
335
|
const _queryParams = {};
|
|
359
336
|
if (cursor != null) {
|
|
360
337
|
_queryParams["cursor"] = cursor;
|
|
361
338
|
}
|
|
362
339
|
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.
|
|
340
|
+
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
341
|
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
|
-
},
|
|
342
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.0", "User-Agent": "@trycourier/courier/6.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
373
343
|
contentType: "application/json",
|
|
374
344
|
queryParameters: _queryParams,
|
|
345
|
+
requestType: "json",
|
|
375
346
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
376
347
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
348
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
377
349
|
});
|
|
378
350
|
if (_response.ok) {
|
|
379
351
|
return _response.body;
|
|
@@ -396,7 +368,7 @@ class Lists {
|
|
|
396
368
|
body: _response.error.rawBody,
|
|
397
369
|
});
|
|
398
370
|
case "timeout":
|
|
399
|
-
throw new errors.CourierTimeoutError();
|
|
371
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /lists/{list_id}/subscriptions.");
|
|
400
372
|
case "unknown":
|
|
401
373
|
throw new errors.CourierError({
|
|
402
374
|
message: _response.error.errorMessage,
|
|
@@ -414,34 +386,29 @@ class Lists {
|
|
|
414
386
|
* @throws {@link Courier.BadRequestError}
|
|
415
387
|
*
|
|
416
388
|
* @example
|
|
417
|
-
* await
|
|
389
|
+
* await client.lists.updateSubscribers("list_id", {
|
|
418
390
|
* recipients: [{
|
|
419
|
-
* recipientId: "
|
|
420
|
-
* preferences:
|
|
421
|
-
*
|
|
422
|
-
*
|
|
423
|
-
*
|
|
391
|
+
* recipientId: "recipientId",
|
|
392
|
+
* preferences: undefined
|
|
393
|
+
* }, {
|
|
394
|
+
* recipientId: "recipientId",
|
|
395
|
+
* preferences: undefined
|
|
424
396
|
* }]
|
|
425
397
|
* })
|
|
426
398
|
*/
|
|
427
399
|
updateSubscribers(listId, request, requestOptions) {
|
|
428
|
-
var _a, _b;
|
|
429
400
|
return __awaiter(this, void 0, void 0, function* () {
|
|
401
|
+
var _a, _b, _c;
|
|
430
402
|
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.
|
|
403
|
+
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
404
|
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
|
-
},
|
|
405
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.0", "User-Agent": "@trycourier/courier/6.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
441
406
|
contentType: "application/json",
|
|
407
|
+
requestType: "json",
|
|
442
408
|
body: request,
|
|
443
409
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
444
410
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
411
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
445
412
|
});
|
|
446
413
|
if (_response.ok) {
|
|
447
414
|
return;
|
|
@@ -464,7 +431,7 @@ class Lists {
|
|
|
464
431
|
body: _response.error.rawBody,
|
|
465
432
|
});
|
|
466
433
|
case "timeout":
|
|
467
|
-
throw new errors.CourierTimeoutError();
|
|
434
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /lists/{list_id}/subscriptions.");
|
|
468
435
|
case "unknown":
|
|
469
436
|
throw new errors.CourierError({
|
|
470
437
|
message: _response.error.errorMessage,
|
|
@@ -482,36 +449,29 @@ class Lists {
|
|
|
482
449
|
* @throws {@link Courier.BadRequestError}
|
|
483
450
|
*
|
|
484
451
|
* @example
|
|
485
|
-
* await
|
|
452
|
+
* await client.lists.addSubscribers("list_id", {
|
|
486
453
|
* recipients: [{
|
|
487
|
-
* recipientId: "
|
|
488
|
-
* preferences:
|
|
489
|
-
*
|
|
490
|
-
*
|
|
491
|
-
*
|
|
454
|
+
* recipientId: "recipientId",
|
|
455
|
+
* preferences: undefined
|
|
456
|
+
* }, {
|
|
457
|
+
* recipientId: "recipientId",
|
|
458
|
+
* preferences: undefined
|
|
492
459
|
* }]
|
|
493
460
|
* })
|
|
494
461
|
*/
|
|
495
462
|
addSubscribers(listId, request, requestOptions) {
|
|
496
|
-
var _a, _b;
|
|
497
463
|
return __awaiter(this, void 0, void 0, function* () {
|
|
464
|
+
var _a, _b, _c;
|
|
498
465
|
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.
|
|
466
|
+
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
467
|
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
|
-
},
|
|
468
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.0", "User-Agent": "@trycourier/courier/6.4.0", "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
469
|
contentType: "application/json",
|
|
470
|
+
requestType: "json",
|
|
512
471
|
body: request,
|
|
513
472
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
514
473
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
474
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
515
475
|
});
|
|
516
476
|
if (_response.ok) {
|
|
517
477
|
return;
|
|
@@ -534,7 +494,7 @@ class Lists {
|
|
|
534
494
|
body: _response.error.rawBody,
|
|
535
495
|
});
|
|
536
496
|
case "timeout":
|
|
537
|
-
throw new errors.CourierTimeoutError();
|
|
497
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling POST /lists/{list_id}/subscriptions.");
|
|
538
498
|
case "unknown":
|
|
539
499
|
throw new errors.CourierError({
|
|
540
500
|
message: _response.error.errorMessage,
|
|
@@ -551,31 +511,23 @@ class Lists {
|
|
|
551
511
|
* @param {Lists.RequestOptions} requestOptions - Request-specific configuration.
|
|
552
512
|
*
|
|
553
513
|
* @example
|
|
554
|
-
* await
|
|
555
|
-
* preferences:
|
|
556
|
-
* categories: {},
|
|
557
|
-
* notifications: {}
|
|
558
|
-
* }
|
|
514
|
+
* await client.lists.subscribe("list_id", "user_id", {
|
|
515
|
+
* preferences: undefined
|
|
559
516
|
* })
|
|
560
517
|
*/
|
|
561
|
-
subscribe(
|
|
562
|
-
|
|
563
|
-
|
|
518
|
+
subscribe(listId_1, userId_1) {
|
|
519
|
+
return __awaiter(this, arguments, void 0, function* (listId, userId, request = {}, requestOptions) {
|
|
520
|
+
var _a, _b, _c;
|
|
564
521
|
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.
|
|
522
|
+
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
523
|
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
|
-
},
|
|
524
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.0", "User-Agent": "@trycourier/courier/6.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
575
525
|
contentType: "application/json",
|
|
526
|
+
requestType: "json",
|
|
576
527
|
body: request,
|
|
577
528
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
578
529
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
530
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
579
531
|
});
|
|
580
532
|
if (_response.ok) {
|
|
581
533
|
return;
|
|
@@ -593,7 +545,7 @@ class Lists {
|
|
|
593
545
|
body: _response.error.rawBody,
|
|
594
546
|
});
|
|
595
547
|
case "timeout":
|
|
596
|
-
throw new errors.CourierTimeoutError();
|
|
548
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /lists/{list_id}/subscriptions/{user_id}.");
|
|
597
549
|
case "unknown":
|
|
598
550
|
throw new errors.CourierError({
|
|
599
551
|
message: _response.error.errorMessage,
|
|
@@ -611,25 +563,20 @@ class Lists {
|
|
|
611
563
|
* @throws {@link Courier.NotFoundError}
|
|
612
564
|
*
|
|
613
565
|
* @example
|
|
614
|
-
* await
|
|
566
|
+
* await client.lists.unsubscribe("list_id", "user_id")
|
|
615
567
|
*/
|
|
616
568
|
unsubscribe(listId, userId, requestOptions) {
|
|
617
|
-
var _a, _b;
|
|
618
569
|
return __awaiter(this, void 0, void 0, function* () {
|
|
570
|
+
var _a, _b, _c;
|
|
619
571
|
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.
|
|
572
|
+
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
573
|
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
|
-
},
|
|
574
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.0", "User-Agent": "@trycourier/courier/6.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
630
575
|
contentType: "application/json",
|
|
576
|
+
requestType: "json",
|
|
631
577
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
632
578
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
579
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
633
580
|
});
|
|
634
581
|
if (_response.ok) {
|
|
635
582
|
return;
|
|
@@ -652,7 +599,7 @@ class Lists {
|
|
|
652
599
|
body: _response.error.rawBody,
|
|
653
600
|
});
|
|
654
601
|
case "timeout":
|
|
655
|
-
throw new errors.CourierTimeoutError();
|
|
602
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling DELETE /lists/{list_id}/subscriptions/{user_id}.");
|
|
656
603
|
case "unknown":
|
|
657
604
|
throw new errors.CourierError({
|
|
658
605
|
message: _response.error.errorMessage,
|
|
@@ -661,12 +608,12 @@ class Lists {
|
|
|
661
608
|
});
|
|
662
609
|
}
|
|
663
610
|
_getAuthorizationHeader() {
|
|
664
|
-
var _a;
|
|
665
611
|
return __awaiter(this, void 0, void 0, function* () {
|
|
612
|
+
var _a;
|
|
666
613
|
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
614
|
if (bearer == null) {
|
|
668
615
|
throw new errors.CourierError({
|
|
669
|
-
message: "Please specify
|
|
616
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a COURIER_AUTH_TOKEN environment variable",
|
|
670
617
|
});
|
|
671
618
|
}
|
|
672
619
|
return `Bearer ${bearer}`;
|
|
@@ -6,11 +6,11 @@ import * as Courier from "../../../../index";
|
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
8
|
* recipients: [{
|
|
9
|
-
* recipientId: "
|
|
10
|
-
* preferences:
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
9
|
+
* recipientId: "recipientId",
|
|
10
|
+
* preferences: undefined
|
|
11
|
+
* }, {
|
|
12
|
+
* recipientId: "recipientId",
|
|
13
|
+
* preferences: undefined
|
|
14
14
|
* }]
|
|
15
15
|
* }
|
|
16
16
|
*/
|
|
@@ -6,11 +6,11 @@ import * as Courier from "../../../../index";
|
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
8
|
* recipients: [{
|
|
9
|
-
* recipientId: "
|
|
10
|
-
* preferences:
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
9
|
+
* recipientId: "recipientId",
|
|
10
|
+
* preferences: undefined
|
|
11
|
+
* }, {
|
|
12
|
+
* recipientId: "recipientId",
|
|
13
|
+
* preferences: undefined
|
|
14
14
|
* }]
|
|
15
15
|
* }
|
|
16
16
|
*/
|