@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
|
@@ -7,12 +7,20 @@ import * as Courier from "../../../../../index";
|
|
|
7
7
|
export declare namespace Tokens {
|
|
8
8
|
interface Options {
|
|
9
9
|
environment?: core.Supplier<environments.CourierEnvironment | string>;
|
|
10
|
+
/** Specify a custom URL to connect the client to. */
|
|
11
|
+
baseUrl?: core.Supplier<string>;
|
|
10
12
|
authorizationToken?: core.Supplier<core.BearerToken | undefined>;
|
|
11
13
|
fetcher?: core.FetchFunction;
|
|
12
14
|
}
|
|
13
15
|
interface RequestOptions {
|
|
16
|
+
/** The maximum time to wait for a response in seconds. */
|
|
14
17
|
timeoutInSeconds?: number;
|
|
18
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
15
19
|
maxRetries?: number;
|
|
20
|
+
/** A hook to abort the request. */
|
|
21
|
+
abortSignal?: AbortSignal;
|
|
22
|
+
/** Additional headers to include in the request. */
|
|
23
|
+
headers?: Record<string, string>;
|
|
16
24
|
}
|
|
17
25
|
}
|
|
18
26
|
export declare class Tokens {
|
|
@@ -27,9 +35,10 @@ export declare class Tokens {
|
|
|
27
35
|
* @throws {@link Courier.BadRequestError}
|
|
28
36
|
*
|
|
29
37
|
* @example
|
|
30
|
-
* await
|
|
38
|
+
* await client.users.tokens.addMultiple("user_id")
|
|
31
39
|
*/
|
|
32
|
-
addMultiple(userId: string, requestOptions?: Tokens.RequestOptions):
|
|
40
|
+
addMultiple(userId: string, requestOptions?: Tokens.RequestOptions): core.HttpResponsePromise<void>;
|
|
41
|
+
private __addMultiple;
|
|
33
42
|
/**
|
|
34
43
|
* Adds a single token to a user and overwrites a matching existing token.
|
|
35
44
|
*
|
|
@@ -41,30 +50,17 @@ export declare class Tokens {
|
|
|
41
50
|
* @throws {@link Courier.BadRequestError}
|
|
42
51
|
*
|
|
43
52
|
* @example
|
|
44
|
-
* await
|
|
45
|
-
* token:
|
|
46
|
-
* provider_key:
|
|
47
|
-
* expiry_date:
|
|
48
|
-
* properties:
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* device: {
|
|
52
|
-
* app_id: "string",
|
|
53
|
-
* ad_id: "string",
|
|
54
|
-
* device_id: "string",
|
|
55
|
-
* platform: "string",
|
|
56
|
-
* manufacturer: "string",
|
|
57
|
-
* model: "string"
|
|
58
|
-
* },
|
|
59
|
-
* tracking: {
|
|
60
|
-
* os_version: "string",
|
|
61
|
-
* ip: "string",
|
|
62
|
-
* lat: "string",
|
|
63
|
-
* long: "string"
|
|
64
|
-
* }
|
|
53
|
+
* await client.users.tokens.add("user_id", "token", {
|
|
54
|
+
* token: undefined,
|
|
55
|
+
* provider_key: "firebase-fcm",
|
|
56
|
+
* expiry_date: undefined,
|
|
57
|
+
* properties: undefined,
|
|
58
|
+
* device: undefined,
|
|
59
|
+
* tracking: undefined
|
|
65
60
|
* })
|
|
66
61
|
*/
|
|
67
|
-
add(userId: string, token: string, request: Courier.users.UserToken, requestOptions?: Tokens.RequestOptions):
|
|
62
|
+
add(userId: string, token: string, request: Courier.users.UserToken, requestOptions?: Tokens.RequestOptions): core.HttpResponsePromise<void>;
|
|
63
|
+
private __add;
|
|
68
64
|
/**
|
|
69
65
|
* Apply a JSON Patch (RFC 6902) to the specified token.
|
|
70
66
|
*
|
|
@@ -76,15 +72,20 @@ export declare class Tokens {
|
|
|
76
72
|
* @throws {@link Courier.BadRequestError}
|
|
77
73
|
*
|
|
78
74
|
* @example
|
|
79
|
-
* await
|
|
75
|
+
* await client.users.tokens.update("user_id", "token", {
|
|
80
76
|
* patch: [{
|
|
81
|
-
* op: "
|
|
82
|
-
* path: "
|
|
83
|
-
* value:
|
|
77
|
+
* op: "op",
|
|
78
|
+
* path: "path",
|
|
79
|
+
* value: undefined
|
|
80
|
+
* }, {
|
|
81
|
+
* op: "op",
|
|
82
|
+
* path: "path",
|
|
83
|
+
* value: undefined
|
|
84
84
|
* }]
|
|
85
85
|
* })
|
|
86
86
|
*/
|
|
87
|
-
update(userId: string, token: string, request: Courier.users.PatchUserTokenOpts, requestOptions?: Tokens.RequestOptions):
|
|
87
|
+
update(userId: string, token: string, request: Courier.users.PatchUserTokenOpts, requestOptions?: Tokens.RequestOptions): core.HttpResponsePromise<void>;
|
|
88
|
+
private __update;
|
|
88
89
|
/**
|
|
89
90
|
* Get single token available for a `:token`
|
|
90
91
|
*
|
|
@@ -95,9 +96,10 @@ export declare class Tokens {
|
|
|
95
96
|
* @throws {@link Courier.BadRequestError}
|
|
96
97
|
*
|
|
97
98
|
* @example
|
|
98
|
-
* await
|
|
99
|
+
* await client.users.tokens.get("user_id", "token")
|
|
99
100
|
*/
|
|
100
|
-
get(userId: string, token: string, requestOptions?: Tokens.RequestOptions):
|
|
101
|
+
get(userId: string, token: string, requestOptions?: Tokens.RequestOptions): core.HttpResponsePromise<Courier.users.GetUserTokenResponse>;
|
|
102
|
+
private __get;
|
|
101
103
|
/**
|
|
102
104
|
* Gets all tokens available for a :user_id
|
|
103
105
|
*
|
|
@@ -107,17 +109,19 @@ export declare class Tokens {
|
|
|
107
109
|
* @throws {@link Courier.BadRequestError}
|
|
108
110
|
*
|
|
109
111
|
* @example
|
|
110
|
-
* await
|
|
112
|
+
* await client.users.tokens.list("user_id")
|
|
111
113
|
*/
|
|
112
|
-
list(userId: string, requestOptions?: Tokens.RequestOptions):
|
|
114
|
+
list(userId: string, requestOptions?: Tokens.RequestOptions): core.HttpResponsePromise<Courier.users.GetAllTokensResponse>;
|
|
115
|
+
private __list;
|
|
113
116
|
/**
|
|
114
117
|
* @param {string} userId - The user's ID. This can be any uniquely identifiable string.
|
|
115
118
|
* @param {string} token - The full token string.
|
|
116
119
|
* @param {Tokens.RequestOptions} requestOptions - Request-specific configuration.
|
|
117
120
|
*
|
|
118
121
|
* @example
|
|
119
|
-
* await
|
|
122
|
+
* await client.users.tokens.delete("user_id", "token")
|
|
120
123
|
*/
|
|
121
|
-
delete(userId: string, token: string, requestOptions?: Tokens.RequestOptions):
|
|
124
|
+
delete(userId: string, token: string, requestOptions?: Tokens.RequestOptions): core.HttpResponsePromise<void>;
|
|
125
|
+
private __delete;
|
|
122
126
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
123
127
|
}
|
|
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
18
18
|
}) : function(o, v) {
|
|
19
19
|
o["default"] = v;
|
|
20
20
|
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
28
38
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
29
39
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
40
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -57,37 +67,36 @@ class Tokens {
|
|
|
57
67
|
* @throws {@link Courier.BadRequestError}
|
|
58
68
|
*
|
|
59
69
|
* @example
|
|
60
|
-
* await
|
|
70
|
+
* await client.users.tokens.addMultiple("user_id")
|
|
61
71
|
*/
|
|
62
72
|
addMultiple(userId, requestOptions) {
|
|
63
|
-
|
|
73
|
+
return core.HttpResponsePromise.fromPromise(this.__addMultiple(userId, requestOptions));
|
|
74
|
+
}
|
|
75
|
+
__addMultiple(userId, requestOptions) {
|
|
64
76
|
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
var _a, _b, _c;
|
|
65
78
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
66
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
79
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CourierEnvironment.Production, `/users/${encodeURIComponent(userId)}/tokens`),
|
|
67
80
|
method: "PUT",
|
|
68
|
-
headers: {
|
|
69
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
70
|
-
"X-Fern-Language": "JavaScript",
|
|
71
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
72
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
73
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
74
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
75
|
-
},
|
|
81
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.1", "User-Agent": "@trycourier/courier/6.4.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
76
82
|
contentType: "application/json",
|
|
83
|
+
requestType: "json",
|
|
77
84
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
78
85
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
86
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
79
87
|
});
|
|
80
88
|
if (_response.ok) {
|
|
81
|
-
return;
|
|
89
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
82
90
|
}
|
|
83
91
|
if (_response.error.reason === "status-code") {
|
|
84
92
|
switch (_response.error.statusCode) {
|
|
85
93
|
case 400:
|
|
86
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
94
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
87
95
|
default:
|
|
88
96
|
throw new errors.CourierError({
|
|
89
97
|
statusCode: _response.error.statusCode,
|
|
90
98
|
body: _response.error.body,
|
|
99
|
+
rawResponse: _response.rawResponse,
|
|
91
100
|
});
|
|
92
101
|
}
|
|
93
102
|
}
|
|
@@ -96,12 +105,14 @@ class Tokens {
|
|
|
96
105
|
throw new errors.CourierError({
|
|
97
106
|
statusCode: _response.error.statusCode,
|
|
98
107
|
body: _response.error.rawBody,
|
|
108
|
+
rawResponse: _response.rawResponse,
|
|
99
109
|
});
|
|
100
110
|
case "timeout":
|
|
101
|
-
throw new errors.CourierTimeoutError();
|
|
111
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /users/{user_id}/tokens.");
|
|
102
112
|
case "unknown":
|
|
103
113
|
throw new errors.CourierError({
|
|
104
114
|
message: _response.error.errorMessage,
|
|
115
|
+
rawResponse: _response.rawResponse,
|
|
105
116
|
});
|
|
106
117
|
}
|
|
107
118
|
});
|
|
@@ -117,59 +128,44 @@ class Tokens {
|
|
|
117
128
|
* @throws {@link Courier.BadRequestError}
|
|
118
129
|
*
|
|
119
130
|
* @example
|
|
120
|
-
* await
|
|
121
|
-
* token:
|
|
122
|
-
* provider_key:
|
|
123
|
-
* expiry_date:
|
|
124
|
-
* properties:
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
* device: {
|
|
128
|
-
* app_id: "string",
|
|
129
|
-
* ad_id: "string",
|
|
130
|
-
* device_id: "string",
|
|
131
|
-
* platform: "string",
|
|
132
|
-
* manufacturer: "string",
|
|
133
|
-
* model: "string"
|
|
134
|
-
* },
|
|
135
|
-
* tracking: {
|
|
136
|
-
* os_version: "string",
|
|
137
|
-
* ip: "string",
|
|
138
|
-
* lat: "string",
|
|
139
|
-
* long: "string"
|
|
140
|
-
* }
|
|
131
|
+
* await client.users.tokens.add("user_id", "token", {
|
|
132
|
+
* token: undefined,
|
|
133
|
+
* provider_key: "firebase-fcm",
|
|
134
|
+
* expiry_date: undefined,
|
|
135
|
+
* properties: undefined,
|
|
136
|
+
* device: undefined,
|
|
137
|
+
* tracking: undefined
|
|
141
138
|
* })
|
|
142
139
|
*/
|
|
143
140
|
add(userId, token, request, requestOptions) {
|
|
144
|
-
|
|
141
|
+
return core.HttpResponsePromise.fromPromise(this.__add(userId, token, request, requestOptions));
|
|
142
|
+
}
|
|
143
|
+
__add(userId, token, request, requestOptions) {
|
|
145
144
|
return __awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
var _a, _b, _c;
|
|
146
146
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
147
|
-
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, `/users/${encodeURIComponent(userId)}/tokens/${encodeURIComponent(token)}`),
|
|
148
148
|
method: "PUT",
|
|
149
|
-
headers: {
|
|
150
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
151
|
-
"X-Fern-Language": "JavaScript",
|
|
152
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
153
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
154
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
155
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
156
|
-
},
|
|
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),
|
|
157
150
|
contentType: "application/json",
|
|
151
|
+
requestType: "json",
|
|
158
152
|
body: request,
|
|
159
153
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
160
154
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
155
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
161
156
|
});
|
|
162
157
|
if (_response.ok) {
|
|
163
|
-
return;
|
|
158
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
164
159
|
}
|
|
165
160
|
if (_response.error.reason === "status-code") {
|
|
166
161
|
switch (_response.error.statusCode) {
|
|
167
162
|
case 400:
|
|
168
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
163
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
169
164
|
default:
|
|
170
165
|
throw new errors.CourierError({
|
|
171
166
|
statusCode: _response.error.statusCode,
|
|
172
167
|
body: _response.error.body,
|
|
168
|
+
rawResponse: _response.rawResponse,
|
|
173
169
|
});
|
|
174
170
|
}
|
|
175
171
|
}
|
|
@@ -178,12 +174,14 @@ class Tokens {
|
|
|
178
174
|
throw new errors.CourierError({
|
|
179
175
|
statusCode: _response.error.statusCode,
|
|
180
176
|
body: _response.error.rawBody,
|
|
177
|
+
rawResponse: _response.rawResponse,
|
|
181
178
|
});
|
|
182
179
|
case "timeout":
|
|
183
|
-
throw new errors.CourierTimeoutError();
|
|
180
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /users/{user_id}/tokens/{token}.");
|
|
184
181
|
case "unknown":
|
|
185
182
|
throw new errors.CourierError({
|
|
186
183
|
message: _response.error.errorMessage,
|
|
184
|
+
rawResponse: _response.rawResponse,
|
|
187
185
|
});
|
|
188
186
|
}
|
|
189
187
|
});
|
|
@@ -199,44 +197,47 @@ class Tokens {
|
|
|
199
197
|
* @throws {@link Courier.BadRequestError}
|
|
200
198
|
*
|
|
201
199
|
* @example
|
|
202
|
-
* await
|
|
200
|
+
* await client.users.tokens.update("user_id", "token", {
|
|
203
201
|
* patch: [{
|
|
204
|
-
* op: "
|
|
205
|
-
* path: "
|
|
206
|
-
* value:
|
|
202
|
+
* op: "op",
|
|
203
|
+
* path: "path",
|
|
204
|
+
* value: undefined
|
|
205
|
+
* }, {
|
|
206
|
+
* op: "op",
|
|
207
|
+
* path: "path",
|
|
208
|
+
* value: undefined
|
|
207
209
|
* }]
|
|
208
210
|
* })
|
|
209
211
|
*/
|
|
210
212
|
update(userId, token, request, requestOptions) {
|
|
211
|
-
|
|
213
|
+
return core.HttpResponsePromise.fromPromise(this.__update(userId, token, request, requestOptions));
|
|
214
|
+
}
|
|
215
|
+
__update(userId, token, request, requestOptions) {
|
|
212
216
|
return __awaiter(this, void 0, void 0, function* () {
|
|
217
|
+
var _a, _b, _c;
|
|
213
218
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
214
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
219
|
+
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, `/users/${encodeURIComponent(userId)}/tokens/${encodeURIComponent(token)}`),
|
|
215
220
|
method: "PATCH",
|
|
216
|
-
headers: {
|
|
217
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
218
|
-
"X-Fern-Language": "JavaScript",
|
|
219
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
220
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
221
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
222
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
223
|
-
},
|
|
221
|
+
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),
|
|
224
222
|
contentType: "application/json",
|
|
223
|
+
requestType: "json",
|
|
225
224
|
body: request,
|
|
226
225
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
227
226
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
227
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
228
228
|
});
|
|
229
229
|
if (_response.ok) {
|
|
230
|
-
return;
|
|
230
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
231
231
|
}
|
|
232
232
|
if (_response.error.reason === "status-code") {
|
|
233
233
|
switch (_response.error.statusCode) {
|
|
234
234
|
case 400:
|
|
235
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
235
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
236
236
|
default:
|
|
237
237
|
throw new errors.CourierError({
|
|
238
238
|
statusCode: _response.error.statusCode,
|
|
239
239
|
body: _response.error.body,
|
|
240
|
+
rawResponse: _response.rawResponse,
|
|
240
241
|
});
|
|
241
242
|
}
|
|
242
243
|
}
|
|
@@ -245,12 +246,14 @@ class Tokens {
|
|
|
245
246
|
throw new errors.CourierError({
|
|
246
247
|
statusCode: _response.error.statusCode,
|
|
247
248
|
body: _response.error.rawBody,
|
|
249
|
+
rawResponse: _response.rawResponse,
|
|
248
250
|
});
|
|
249
251
|
case "timeout":
|
|
250
|
-
throw new errors.CourierTimeoutError();
|
|
252
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling PATCH /users/{user_id}/tokens/{token}.");
|
|
251
253
|
case "unknown":
|
|
252
254
|
throw new errors.CourierError({
|
|
253
255
|
message: _response.error.errorMessage,
|
|
256
|
+
rawResponse: _response.rawResponse,
|
|
254
257
|
});
|
|
255
258
|
}
|
|
256
259
|
});
|
|
@@ -265,37 +268,36 @@ class Tokens {
|
|
|
265
268
|
* @throws {@link Courier.BadRequestError}
|
|
266
269
|
*
|
|
267
270
|
* @example
|
|
268
|
-
* await
|
|
271
|
+
* await client.users.tokens.get("user_id", "token")
|
|
269
272
|
*/
|
|
270
273
|
get(userId, token, requestOptions) {
|
|
271
|
-
|
|
274
|
+
return core.HttpResponsePromise.fromPromise(this.__get(userId, token, requestOptions));
|
|
275
|
+
}
|
|
276
|
+
__get(userId, token, requestOptions) {
|
|
272
277
|
return __awaiter(this, void 0, void 0, function* () {
|
|
278
|
+
var _a, _b, _c;
|
|
273
279
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
274
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
280
|
+
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, `/users/${encodeURIComponent(userId)}/tokens/${encodeURIComponent(token)}`),
|
|
275
281
|
method: "GET",
|
|
276
|
-
headers: {
|
|
277
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
278
|
-
"X-Fern-Language": "JavaScript",
|
|
279
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
280
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
281
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
282
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
283
|
-
},
|
|
282
|
+
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),
|
|
284
283
|
contentType: "application/json",
|
|
284
|
+
requestType: "json",
|
|
285
285
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
286
286
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
287
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
287
288
|
});
|
|
288
289
|
if (_response.ok) {
|
|
289
|
-
return _response.body;
|
|
290
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
290
291
|
}
|
|
291
292
|
if (_response.error.reason === "status-code") {
|
|
292
293
|
switch (_response.error.statusCode) {
|
|
293
294
|
case 400:
|
|
294
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
295
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
295
296
|
default:
|
|
296
297
|
throw new errors.CourierError({
|
|
297
298
|
statusCode: _response.error.statusCode,
|
|
298
299
|
body: _response.error.body,
|
|
300
|
+
rawResponse: _response.rawResponse,
|
|
299
301
|
});
|
|
300
302
|
}
|
|
301
303
|
}
|
|
@@ -304,12 +306,14 @@ class Tokens {
|
|
|
304
306
|
throw new errors.CourierError({
|
|
305
307
|
statusCode: _response.error.statusCode,
|
|
306
308
|
body: _response.error.rawBody,
|
|
309
|
+
rawResponse: _response.rawResponse,
|
|
307
310
|
});
|
|
308
311
|
case "timeout":
|
|
309
|
-
throw new errors.CourierTimeoutError();
|
|
312
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /users/{user_id}/tokens/{token}.");
|
|
310
313
|
case "unknown":
|
|
311
314
|
throw new errors.CourierError({
|
|
312
315
|
message: _response.error.errorMessage,
|
|
316
|
+
rawResponse: _response.rawResponse,
|
|
313
317
|
});
|
|
314
318
|
}
|
|
315
319
|
});
|
|
@@ -323,37 +327,36 @@ class Tokens {
|
|
|
323
327
|
* @throws {@link Courier.BadRequestError}
|
|
324
328
|
*
|
|
325
329
|
* @example
|
|
326
|
-
* await
|
|
330
|
+
* await client.users.tokens.list("user_id")
|
|
327
331
|
*/
|
|
328
332
|
list(userId, requestOptions) {
|
|
329
|
-
|
|
333
|
+
return core.HttpResponsePromise.fromPromise(this.__list(userId, requestOptions));
|
|
334
|
+
}
|
|
335
|
+
__list(userId, requestOptions) {
|
|
330
336
|
return __awaiter(this, void 0, void 0, function* () {
|
|
337
|
+
var _a, _b, _c;
|
|
331
338
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
332
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
339
|
+
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, `/users/${encodeURIComponent(userId)}/tokens`),
|
|
333
340
|
method: "GET",
|
|
334
|
-
headers: {
|
|
335
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
336
|
-
"X-Fern-Language": "JavaScript",
|
|
337
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
338
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
339
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
340
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
341
|
-
},
|
|
341
|
+
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),
|
|
342
342
|
contentType: "application/json",
|
|
343
|
+
requestType: "json",
|
|
343
344
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
344
345
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
346
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
345
347
|
});
|
|
346
348
|
if (_response.ok) {
|
|
347
|
-
return _response.body;
|
|
349
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
348
350
|
}
|
|
349
351
|
if (_response.error.reason === "status-code") {
|
|
350
352
|
switch (_response.error.statusCode) {
|
|
351
353
|
case 400:
|
|
352
|
-
throw new Courier.BadRequestError(_response.error.body);
|
|
354
|
+
throw new Courier.BadRequestError(_response.error.body, _response.rawResponse);
|
|
353
355
|
default:
|
|
354
356
|
throw new errors.CourierError({
|
|
355
357
|
statusCode: _response.error.statusCode,
|
|
356
358
|
body: _response.error.body,
|
|
359
|
+
rawResponse: _response.rawResponse,
|
|
357
360
|
});
|
|
358
361
|
}
|
|
359
362
|
}
|
|
@@ -362,12 +365,14 @@ class Tokens {
|
|
|
362
365
|
throw new errors.CourierError({
|
|
363
366
|
statusCode: _response.error.statusCode,
|
|
364
367
|
body: _response.error.rawBody,
|
|
368
|
+
rawResponse: _response.rawResponse,
|
|
365
369
|
});
|
|
366
370
|
case "timeout":
|
|
367
|
-
throw new errors.CourierTimeoutError();
|
|
371
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /users/{user_id}/tokens.");
|
|
368
372
|
case "unknown":
|
|
369
373
|
throw new errors.CourierError({
|
|
370
374
|
message: _response.error.errorMessage,
|
|
375
|
+
rawResponse: _response.rawResponse,
|
|
371
376
|
});
|
|
372
377
|
}
|
|
373
378
|
});
|
|
@@ -378,33 +383,32 @@ class Tokens {
|
|
|
378
383
|
* @param {Tokens.RequestOptions} requestOptions - Request-specific configuration.
|
|
379
384
|
*
|
|
380
385
|
* @example
|
|
381
|
-
* await
|
|
386
|
+
* await client.users.tokens.delete("user_id", "token")
|
|
382
387
|
*/
|
|
383
388
|
delete(userId, token, requestOptions) {
|
|
384
|
-
|
|
389
|
+
return core.HttpResponsePromise.fromPromise(this.__delete(userId, token, requestOptions));
|
|
390
|
+
}
|
|
391
|
+
__delete(userId, token, requestOptions) {
|
|
385
392
|
return __awaiter(this, void 0, void 0, function* () {
|
|
393
|
+
var _a, _b, _c;
|
|
386
394
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
387
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
395
|
+
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, `/users/${encodeURIComponent(userId)}/tokens/${encodeURIComponent(token)}`),
|
|
388
396
|
method: "DELETE",
|
|
389
|
-
headers: {
|
|
390
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
391
|
-
"X-Fern-Language": "JavaScript",
|
|
392
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
393
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
394
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
395
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
396
|
-
},
|
|
397
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.1", "User-Agent": "@trycourier/courier/6.4.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
397
398
|
contentType: "application/json",
|
|
399
|
+
requestType: "json",
|
|
398
400
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
399
401
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
402
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
400
403
|
});
|
|
401
404
|
if (_response.ok) {
|
|
402
|
-
return;
|
|
405
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
403
406
|
}
|
|
404
407
|
if (_response.error.reason === "status-code") {
|
|
405
408
|
throw new errors.CourierError({
|
|
406
409
|
statusCode: _response.error.statusCode,
|
|
407
410
|
body: _response.error.body,
|
|
411
|
+
rawResponse: _response.rawResponse,
|
|
408
412
|
});
|
|
409
413
|
}
|
|
410
414
|
switch (_response.error.reason) {
|
|
@@ -412,23 +416,25 @@ class Tokens {
|
|
|
412
416
|
throw new errors.CourierError({
|
|
413
417
|
statusCode: _response.error.statusCode,
|
|
414
418
|
body: _response.error.rawBody,
|
|
419
|
+
rawResponse: _response.rawResponse,
|
|
415
420
|
});
|
|
416
421
|
case "timeout":
|
|
417
|
-
throw new errors.CourierTimeoutError();
|
|
422
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling DELETE /users/{user_id}/tokens/{token}.");
|
|
418
423
|
case "unknown":
|
|
419
424
|
throw new errors.CourierError({
|
|
420
425
|
message: _response.error.errorMessage,
|
|
426
|
+
rawResponse: _response.rawResponse,
|
|
421
427
|
});
|
|
422
428
|
}
|
|
423
429
|
});
|
|
424
430
|
}
|
|
425
431
|
_getAuthorizationHeader() {
|
|
426
|
-
var _a;
|
|
427
432
|
return __awaiter(this, void 0, void 0, function* () {
|
|
433
|
+
var _a;
|
|
428
434
|
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"];
|
|
429
435
|
if (bearer == null) {
|
|
430
436
|
throw new errors.CourierError({
|
|
431
|
-
message: "Please specify
|
|
437
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a COURIER_AUTH_TOKEN environment variable",
|
|
432
438
|
});
|
|
433
439
|
}
|
|
434
440
|
return `Bearer ${bearer}`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export type PatchOp = "replace" | "add" | "remove" | "copy" | "move" | "test";
|
|
5
5
|
export declare const PatchOp: {
|
|
6
6
|
readonly Replace: "replace";
|
|
7
7
|
readonly Add: "add";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export type ProviderKey = "firebase-fcm" | "apn" | "expo" | "onesignal";
|
|
5
5
|
export declare const ProviderKey: {
|
|
6
6
|
readonly FirebaseFcm: "firebase-fcm";
|
|
7
7
|
readonly Apn: "apn";
|