@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
|
@@ -6,9 +6,9 @@ import * as Courier from "../../../../../../index";
|
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
8
|
* topic: {
|
|
9
|
-
* status:
|
|
9
|
+
* status: "OPTED_IN",
|
|
10
10
|
* has_custom_routing: true,
|
|
11
|
-
* custom_routing: [
|
|
11
|
+
* custom_routing: ["inbox", "email"]
|
|
12
12
|
* }
|
|
13
13
|
* }
|
|
14
14
|
*/
|
|
@@ -7,12 +7,20 @@ import * as Courier from "../../../../../index";
|
|
|
7
7
|
export declare namespace Tenants {
|
|
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 Tenants {
|
|
@@ -30,20 +38,22 @@ export declare class Tenants {
|
|
|
30
38
|
* @param {Tenants.RequestOptions} requestOptions - Request-specific configuration.
|
|
31
39
|
*
|
|
32
40
|
* @example
|
|
33
|
-
* await
|
|
41
|
+
* await client.users.tenants.addMultple("user_id", {
|
|
34
42
|
* tenants: [{
|
|
35
|
-
* user_id:
|
|
36
|
-
* type:
|
|
37
|
-
* tenant_id: "
|
|
38
|
-
* profile:
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
+
* user_id: undefined,
|
|
44
|
+
* type: undefined,
|
|
45
|
+
* tenant_id: "tenant_id",
|
|
46
|
+
* profile: undefined
|
|
47
|
+
* }, {
|
|
48
|
+
* user_id: undefined,
|
|
49
|
+
* type: undefined,
|
|
50
|
+
* tenant_id: "tenant_id",
|
|
51
|
+
* profile: undefined
|
|
43
52
|
* }]
|
|
44
53
|
* })
|
|
45
54
|
*/
|
|
46
|
-
addMultple(userId: string, request: Courier.users.AddUserToMultipleTenantsParams, requestOptions?: Tenants.RequestOptions):
|
|
55
|
+
addMultple(userId: string, request: Courier.users.AddUserToMultipleTenantsParams, requestOptions?: Tenants.RequestOptions): core.HttpResponsePromise<void>;
|
|
56
|
+
private __addMultple;
|
|
47
57
|
/**
|
|
48
58
|
* This endpoint is used to add a single tenant.
|
|
49
59
|
*
|
|
@@ -57,15 +67,12 @@ export declare class Tenants {
|
|
|
57
67
|
* @param {Tenants.RequestOptions} requestOptions - Request-specific configuration.
|
|
58
68
|
*
|
|
59
69
|
* @example
|
|
60
|
-
* await
|
|
61
|
-
* profile:
|
|
62
|
-
* "string": {
|
|
63
|
-
* "key": "value"
|
|
64
|
-
* }
|
|
65
|
-
* }
|
|
70
|
+
* await client.users.tenants.add("user_id", "tenant_id", {
|
|
71
|
+
* profile: undefined
|
|
66
72
|
* })
|
|
67
73
|
*/
|
|
68
|
-
add(userId: string, tenantId: string, request?: Courier.users.AddUserToSingleTenantsParams, requestOptions?: Tenants.RequestOptions):
|
|
74
|
+
add(userId: string, tenantId: string, request?: Courier.users.AddUserToSingleTenantsParams, requestOptions?: Tenants.RequestOptions): core.HttpResponsePromise<void>;
|
|
75
|
+
private __add;
|
|
69
76
|
/**
|
|
70
77
|
* Removes a user from any tenants they may have been associated with.
|
|
71
78
|
*
|
|
@@ -73,9 +80,10 @@ export declare class Tenants {
|
|
|
73
80
|
* @param {Tenants.RequestOptions} requestOptions - Request-specific configuration.
|
|
74
81
|
*
|
|
75
82
|
* @example
|
|
76
|
-
* await
|
|
83
|
+
* await client.users.tenants.removeAll("user_id")
|
|
77
84
|
*/
|
|
78
|
-
removeAll(userId: string, requestOptions?: Tenants.RequestOptions):
|
|
85
|
+
removeAll(userId: string, requestOptions?: Tenants.RequestOptions): core.HttpResponsePromise<void>;
|
|
86
|
+
private __removeAll;
|
|
79
87
|
/**
|
|
80
88
|
* Removes a user from the supplied tenant.
|
|
81
89
|
*
|
|
@@ -84,9 +92,10 @@ export declare class Tenants {
|
|
|
84
92
|
* @param {Tenants.RequestOptions} requestOptions - Request-specific configuration.
|
|
85
93
|
*
|
|
86
94
|
* @example
|
|
87
|
-
* await
|
|
95
|
+
* await client.users.tenants.remove("user_id", "tenant_id")
|
|
88
96
|
*/
|
|
89
|
-
remove(userId: string, tenantId: string, requestOptions?: Tenants.RequestOptions):
|
|
97
|
+
remove(userId: string, tenantId: string, requestOptions?: Tenants.RequestOptions): core.HttpResponsePromise<void>;
|
|
98
|
+
private __remove;
|
|
90
99
|
/**
|
|
91
100
|
* Returns a paginated list of user tenant associations.
|
|
92
101
|
*
|
|
@@ -95,11 +104,9 @@ export declare class Tenants {
|
|
|
95
104
|
* @param {Tenants.RequestOptions} requestOptions - Request-specific configuration.
|
|
96
105
|
*
|
|
97
106
|
* @example
|
|
98
|
-
* await
|
|
99
|
-
* limit: 1,
|
|
100
|
-
* cursor: "string"
|
|
101
|
-
* })
|
|
107
|
+
* await client.users.tenants.list("user_id")
|
|
102
108
|
*/
|
|
103
|
-
list(userId: string, request?: Courier.users.ListTenantsForUserParams, requestOptions?: Tenants.RequestOptions):
|
|
109
|
+
list(userId: string, request?: Courier.users.ListTenantsForUserParams, requestOptions?: Tenants.RequestOptions): core.HttpResponsePromise<Courier.users.ListTenantsForUserResponse>;
|
|
110
|
+
private __list;
|
|
104
111
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
105
112
|
}
|
|
@@ -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) {
|
|
@@ -59,45 +69,45 @@ class Tenants {
|
|
|
59
69
|
* @param {Tenants.RequestOptions} requestOptions - Request-specific configuration.
|
|
60
70
|
*
|
|
61
71
|
* @example
|
|
62
|
-
* await
|
|
72
|
+
* await client.users.tenants.addMultple("user_id", {
|
|
63
73
|
* tenants: [{
|
|
64
|
-
* user_id:
|
|
65
|
-
* type:
|
|
66
|
-
* tenant_id: "
|
|
67
|
-
* profile:
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
74
|
+
* user_id: undefined,
|
|
75
|
+
* type: undefined,
|
|
76
|
+
* tenant_id: "tenant_id",
|
|
77
|
+
* profile: undefined
|
|
78
|
+
* }, {
|
|
79
|
+
* user_id: undefined,
|
|
80
|
+
* type: undefined,
|
|
81
|
+
* tenant_id: "tenant_id",
|
|
82
|
+
* profile: undefined
|
|
72
83
|
* }]
|
|
73
84
|
* })
|
|
74
85
|
*/
|
|
75
86
|
addMultple(userId, request, requestOptions) {
|
|
76
|
-
|
|
87
|
+
return core.HttpResponsePromise.fromPromise(this.__addMultple(userId, request, requestOptions));
|
|
88
|
+
}
|
|
89
|
+
__addMultple(userId, request, requestOptions) {
|
|
77
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
var _a, _b, _c;
|
|
78
92
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
79
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
93
|
+
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)}/tenants`),
|
|
80
94
|
method: "PUT",
|
|
81
|
-
headers: {
|
|
82
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
83
|
-
"X-Fern-Language": "JavaScript",
|
|
84
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
85
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
86
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
87
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
88
|
-
},
|
|
95
|
+
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),
|
|
89
96
|
contentType: "application/json",
|
|
97
|
+
requestType: "json",
|
|
90
98
|
body: request,
|
|
91
99
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
92
100
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
101
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
93
102
|
});
|
|
94
103
|
if (_response.ok) {
|
|
95
|
-
return;
|
|
104
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
96
105
|
}
|
|
97
106
|
if (_response.error.reason === "status-code") {
|
|
98
107
|
throw new errors.CourierError({
|
|
99
108
|
statusCode: _response.error.statusCode,
|
|
100
109
|
body: _response.error.body,
|
|
110
|
+
rawResponse: _response.rawResponse,
|
|
101
111
|
});
|
|
102
112
|
}
|
|
103
113
|
switch (_response.error.reason) {
|
|
@@ -105,12 +115,14 @@ class Tenants {
|
|
|
105
115
|
throw new errors.CourierError({
|
|
106
116
|
statusCode: _response.error.statusCode,
|
|
107
117
|
body: _response.error.rawBody,
|
|
118
|
+
rawResponse: _response.rawResponse,
|
|
108
119
|
});
|
|
109
120
|
case "timeout":
|
|
110
|
-
throw new errors.CourierTimeoutError();
|
|
121
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /users/{user_id}/tenants.");
|
|
111
122
|
case "unknown":
|
|
112
123
|
throw new errors.CourierError({
|
|
113
124
|
message: _response.error.errorMessage,
|
|
125
|
+
rawResponse: _response.rawResponse,
|
|
114
126
|
});
|
|
115
127
|
}
|
|
116
128
|
});
|
|
@@ -128,40 +140,35 @@ class Tenants {
|
|
|
128
140
|
* @param {Tenants.RequestOptions} requestOptions - Request-specific configuration.
|
|
129
141
|
*
|
|
130
142
|
* @example
|
|
131
|
-
* await
|
|
132
|
-
* profile:
|
|
133
|
-
* "string": {
|
|
134
|
-
* "key": "value"
|
|
135
|
-
* }
|
|
136
|
-
* }
|
|
143
|
+
* await client.users.tenants.add("user_id", "tenant_id", {
|
|
144
|
+
* profile: undefined
|
|
137
145
|
* })
|
|
138
146
|
*/
|
|
139
147
|
add(userId, tenantId, request = {}, requestOptions) {
|
|
140
|
-
|
|
141
|
-
|
|
148
|
+
return core.HttpResponsePromise.fromPromise(this.__add(userId, tenantId, request, requestOptions));
|
|
149
|
+
}
|
|
150
|
+
__add(userId_1, tenantId_1) {
|
|
151
|
+
return __awaiter(this, arguments, void 0, function* (userId, tenantId, request = {}, requestOptions) {
|
|
152
|
+
var _a, _b, _c;
|
|
142
153
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
143
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
154
|
+
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)}/tenants/${encodeURIComponent(tenantId)}`),
|
|
144
155
|
method: "PUT",
|
|
145
|
-
headers: {
|
|
146
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
147
|
-
"X-Fern-Language": "JavaScript",
|
|
148
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
149
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
150
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
151
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
152
|
-
},
|
|
156
|
+
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),
|
|
153
157
|
contentType: "application/json",
|
|
158
|
+
requestType: "json",
|
|
154
159
|
body: request,
|
|
155
160
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
156
161
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
162
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
157
163
|
});
|
|
158
164
|
if (_response.ok) {
|
|
159
|
-
return;
|
|
165
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
160
166
|
}
|
|
161
167
|
if (_response.error.reason === "status-code") {
|
|
162
168
|
throw new errors.CourierError({
|
|
163
169
|
statusCode: _response.error.statusCode,
|
|
164
170
|
body: _response.error.body,
|
|
171
|
+
rawResponse: _response.rawResponse,
|
|
165
172
|
});
|
|
166
173
|
}
|
|
167
174
|
switch (_response.error.reason) {
|
|
@@ -169,12 +176,14 @@ class Tenants {
|
|
|
169
176
|
throw new errors.CourierError({
|
|
170
177
|
statusCode: _response.error.statusCode,
|
|
171
178
|
body: _response.error.rawBody,
|
|
179
|
+
rawResponse: _response.rawResponse,
|
|
172
180
|
});
|
|
173
181
|
case "timeout":
|
|
174
|
-
throw new errors.CourierTimeoutError();
|
|
182
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling PUT /users/{user_id}/tenants/{tenant_id}.");
|
|
175
183
|
case "unknown":
|
|
176
184
|
throw new errors.CourierError({
|
|
177
185
|
message: _response.error.errorMessage,
|
|
186
|
+
rawResponse: _response.rawResponse,
|
|
178
187
|
});
|
|
179
188
|
}
|
|
180
189
|
});
|
|
@@ -186,33 +195,32 @@ class Tenants {
|
|
|
186
195
|
* @param {Tenants.RequestOptions} requestOptions - Request-specific configuration.
|
|
187
196
|
*
|
|
188
197
|
* @example
|
|
189
|
-
* await
|
|
198
|
+
* await client.users.tenants.removeAll("user_id")
|
|
190
199
|
*/
|
|
191
200
|
removeAll(userId, requestOptions) {
|
|
192
|
-
|
|
201
|
+
return core.HttpResponsePromise.fromPromise(this.__removeAll(userId, requestOptions));
|
|
202
|
+
}
|
|
203
|
+
__removeAll(userId, requestOptions) {
|
|
193
204
|
return __awaiter(this, void 0, void 0, function* () {
|
|
205
|
+
var _a, _b, _c;
|
|
194
206
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
195
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
207
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CourierEnvironment.Production, `users/${encodeURIComponent(userId)}/tenants`),
|
|
196
208
|
method: "DELETE",
|
|
197
|
-
headers: {
|
|
198
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
199
|
-
"X-Fern-Language": "JavaScript",
|
|
200
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
201
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
202
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
203
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
204
|
-
},
|
|
209
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.1", "User-Agent": "@trycourier/courier/6.4.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
205
210
|
contentType: "application/json",
|
|
211
|
+
requestType: "json",
|
|
206
212
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
207
213
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
214
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
208
215
|
});
|
|
209
216
|
if (_response.ok) {
|
|
210
|
-
return;
|
|
217
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
211
218
|
}
|
|
212
219
|
if (_response.error.reason === "status-code") {
|
|
213
220
|
throw new errors.CourierError({
|
|
214
221
|
statusCode: _response.error.statusCode,
|
|
215
222
|
body: _response.error.body,
|
|
223
|
+
rawResponse: _response.rawResponse,
|
|
216
224
|
});
|
|
217
225
|
}
|
|
218
226
|
switch (_response.error.reason) {
|
|
@@ -220,12 +228,14 @@ class Tenants {
|
|
|
220
228
|
throw new errors.CourierError({
|
|
221
229
|
statusCode: _response.error.statusCode,
|
|
222
230
|
body: _response.error.rawBody,
|
|
231
|
+
rawResponse: _response.rawResponse,
|
|
223
232
|
});
|
|
224
233
|
case "timeout":
|
|
225
|
-
throw new errors.CourierTimeoutError();
|
|
234
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling DELETE /users/{user_id}/tenants.");
|
|
226
235
|
case "unknown":
|
|
227
236
|
throw new errors.CourierError({
|
|
228
237
|
message: _response.error.errorMessage,
|
|
238
|
+
rawResponse: _response.rawResponse,
|
|
229
239
|
});
|
|
230
240
|
}
|
|
231
241
|
});
|
|
@@ -238,33 +248,32 @@ class Tenants {
|
|
|
238
248
|
* @param {Tenants.RequestOptions} requestOptions - Request-specific configuration.
|
|
239
249
|
*
|
|
240
250
|
* @example
|
|
241
|
-
* await
|
|
251
|
+
* await client.users.tenants.remove("user_id", "tenant_id")
|
|
242
252
|
*/
|
|
243
253
|
remove(userId, tenantId, requestOptions) {
|
|
244
|
-
|
|
254
|
+
return core.HttpResponsePromise.fromPromise(this.__remove(userId, tenantId, requestOptions));
|
|
255
|
+
}
|
|
256
|
+
__remove(userId, tenantId, requestOptions) {
|
|
245
257
|
return __awaiter(this, void 0, void 0, function* () {
|
|
258
|
+
var _a, _b, _c;
|
|
246
259
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
247
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
260
|
+
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)}/tenants/${encodeURIComponent(tenantId)}`),
|
|
248
261
|
method: "DELETE",
|
|
249
|
-
headers: {
|
|
250
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
251
|
-
"X-Fern-Language": "JavaScript",
|
|
252
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
253
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
254
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
255
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
256
|
-
},
|
|
262
|
+
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),
|
|
257
263
|
contentType: "application/json",
|
|
264
|
+
requestType: "json",
|
|
258
265
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
259
266
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
267
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
260
268
|
});
|
|
261
269
|
if (_response.ok) {
|
|
262
|
-
return;
|
|
270
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
263
271
|
}
|
|
264
272
|
if (_response.error.reason === "status-code") {
|
|
265
273
|
throw new errors.CourierError({
|
|
266
274
|
statusCode: _response.error.statusCode,
|
|
267
275
|
body: _response.error.body,
|
|
276
|
+
rawResponse: _response.rawResponse,
|
|
268
277
|
});
|
|
269
278
|
}
|
|
270
279
|
switch (_response.error.reason) {
|
|
@@ -272,12 +281,14 @@ class Tenants {
|
|
|
272
281
|
throw new errors.CourierError({
|
|
273
282
|
statusCode: _response.error.statusCode,
|
|
274
283
|
body: _response.error.rawBody,
|
|
284
|
+
rawResponse: _response.rawResponse,
|
|
275
285
|
});
|
|
276
286
|
case "timeout":
|
|
277
|
-
throw new errors.CourierTimeoutError();
|
|
287
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling DELETE /users/{user_id}/tenants/{tenant_id}.");
|
|
278
288
|
case "unknown":
|
|
279
289
|
throw new errors.CourierError({
|
|
280
290
|
message: _response.error.errorMessage,
|
|
291
|
+
rawResponse: _response.rawResponse,
|
|
281
292
|
});
|
|
282
293
|
}
|
|
283
294
|
});
|
|
@@ -290,14 +301,14 @@ class Tenants {
|
|
|
290
301
|
* @param {Tenants.RequestOptions} requestOptions - Request-specific configuration.
|
|
291
302
|
*
|
|
292
303
|
* @example
|
|
293
|
-
* await
|
|
294
|
-
* limit: 1,
|
|
295
|
-
* cursor: "string"
|
|
296
|
-
* })
|
|
304
|
+
* await client.users.tenants.list("user_id")
|
|
297
305
|
*/
|
|
298
306
|
list(userId, request = {}, requestOptions) {
|
|
299
|
-
|
|
300
|
-
|
|
307
|
+
return core.HttpResponsePromise.fromPromise(this.__list(userId, request, requestOptions));
|
|
308
|
+
}
|
|
309
|
+
__list(userId_1) {
|
|
310
|
+
return __awaiter(this, arguments, void 0, function* (userId, request = {}, requestOptions) {
|
|
311
|
+
var _a, _b, _c;
|
|
301
312
|
const { limit, cursor } = request;
|
|
302
313
|
const _queryParams = {};
|
|
303
314
|
if (limit != null) {
|
|
@@ -307,28 +318,27 @@ class Tenants {
|
|
|
307
318
|
_queryParams["cursor"] = cursor;
|
|
308
319
|
}
|
|
309
320
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
310
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
321
|
+
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)}/tenants`),
|
|
311
322
|
method: "GET",
|
|
312
|
-
headers: {
|
|
313
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
314
|
-
"X-Fern-Language": "JavaScript",
|
|
315
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
316
|
-
"X-Fern-SDK-Version": "v6.3.1",
|
|
317
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
318
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
319
|
-
},
|
|
323
|
+
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),
|
|
320
324
|
contentType: "application/json",
|
|
321
325
|
queryParameters: _queryParams,
|
|
326
|
+
requestType: "json",
|
|
322
327
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
323
328
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
329
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
324
330
|
});
|
|
325
331
|
if (_response.ok) {
|
|
326
|
-
return
|
|
332
|
+
return {
|
|
333
|
+
data: _response.body,
|
|
334
|
+
rawResponse: _response.rawResponse,
|
|
335
|
+
};
|
|
327
336
|
}
|
|
328
337
|
if (_response.error.reason === "status-code") {
|
|
329
338
|
throw new errors.CourierError({
|
|
330
339
|
statusCode: _response.error.statusCode,
|
|
331
340
|
body: _response.error.body,
|
|
341
|
+
rawResponse: _response.rawResponse,
|
|
332
342
|
});
|
|
333
343
|
}
|
|
334
344
|
switch (_response.error.reason) {
|
|
@@ -336,23 +346,25 @@ class Tenants {
|
|
|
336
346
|
throw new errors.CourierError({
|
|
337
347
|
statusCode: _response.error.statusCode,
|
|
338
348
|
body: _response.error.rawBody,
|
|
349
|
+
rawResponse: _response.rawResponse,
|
|
339
350
|
});
|
|
340
351
|
case "timeout":
|
|
341
|
-
throw new errors.CourierTimeoutError();
|
|
352
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling GET /users/{user_id}/tenants.");
|
|
342
353
|
case "unknown":
|
|
343
354
|
throw new errors.CourierError({
|
|
344
355
|
message: _response.error.errorMessage,
|
|
356
|
+
rawResponse: _response.rawResponse,
|
|
345
357
|
});
|
|
346
358
|
}
|
|
347
359
|
});
|
|
348
360
|
}
|
|
349
361
|
_getAuthorizationHeader() {
|
|
350
|
-
var _a;
|
|
351
362
|
return __awaiter(this, void 0, void 0, function* () {
|
|
363
|
+
var _a;
|
|
352
364
|
const bearer = (_a = (yield core.Supplier.get(this._options.authorizationToken))) !== null && _a !== void 0 ? _a : process === null || process === void 0 ? void 0 : process.env["COURIER_AUTH_TOKEN"];
|
|
353
365
|
if (bearer == null) {
|
|
354
366
|
throw new errors.CourierError({
|
|
355
|
-
message: "Please specify
|
|
367
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a COURIER_AUTH_TOKEN environment variable",
|
|
356
368
|
});
|
|
357
369
|
}
|
|
358
370
|
return `Bearer ${bearer}`;
|
|
@@ -6,14 +6,15 @@ import * as Courier from "../../../../../../index";
|
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
8
|
* tenants: [{
|
|
9
|
-
* user_id:
|
|
10
|
-
* type:
|
|
11
|
-
* tenant_id: "
|
|
12
|
-
* profile:
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
9
|
+
* user_id: undefined,
|
|
10
|
+
* type: undefined,
|
|
11
|
+
* tenant_id: "tenant_id",
|
|
12
|
+
* profile: undefined
|
|
13
|
+
* }, {
|
|
14
|
+
* user_id: undefined,
|
|
15
|
+
* type: undefined,
|
|
16
|
+
* tenant_id: "tenant_id",
|
|
17
|
+
* profile: undefined
|
|
17
18
|
* }]
|
|
18
19
|
* }
|
|
19
20
|
*/
|