@trycourier/courier 6.3.0 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Client.d.ts +84 -109
- package/Client.js +118 -148
- package/api/client/requests/SendMessageRequest.d.ts +45 -78
- package/api/resources/audiences/client/Client.d.ts +16 -16
- package/api/resources/audiences/client/Client.js +63 -86
- package/api/resources/audiences/client/requests/AudienceMembersListParams.d.ts +1 -3
- package/api/resources/audiences/client/requests/AudienceUpdateParams.d.ts +3 -7
- package/api/resources/audiences/client/requests/AudiencesListParams.d.ts +1 -3
- package/api/resources/audiences/types/ComparisonOperator.d.ts +1 -1
- package/api/resources/audiences/types/Filter.d.ts +1 -1
- package/api/resources/audiences/types/FilterConfig.d.ts +1 -1
- package/api/resources/audiences/types/LogicalOperator.d.ts +1 -1
- package/api/resources/audiences/types/Operator.d.ts +1 -1
- package/api/resources/auditEvents/client/Client.d.ts +10 -4
- package/api/resources/auditEvents/client/Client.js +35 -37
- package/api/resources/auditEvents/client/requests/ListAuditEventsRequest.d.ts +1 -3
- package/api/resources/authTokens/client/Client.d.ts +11 -3
- package/api/resources/authTokens/client/Client.js +28 -25
- package/api/resources/authTokens/client/requests/IssueTokenParams.d.ts +2 -2
- package/api/resources/automations/client/Client.d.ts +15 -13
- package/api/resources/automations/client/Client.js +38 -48
- package/api/resources/automations/types/AutomationAddToBatchMaxItemsType.d.ts +1 -1
- package/api/resources/automations/types/AutomationAddToBatchRetainType.d.ts +1 -1
- package/api/resources/automations/types/AutomationAddToBatchScope.d.ts +1 -1
- package/api/resources/automations/types/AutomationFetchDataWebhookMethod.d.ts +1 -1
- package/api/resources/automations/types/AutomationStepOption.d.ts +1 -1
- package/api/resources/automations/types/AutomationThrottleScope.d.ts +1 -1
- package/api/resources/automations/types/MergeAlgorithm.d.ts +1 -1
- package/api/resources/automations/types/Profile.d.ts +1 -1
- package/api/resources/brands/client/Client.d.ts +22 -58
- package/api/resources/brands/client/Client.js +65 -126
- package/api/resources/brands/client/requests/BrandUpdateParameters.d.ts +3 -26
- package/api/resources/brands/client/requests/ListBrandsRequest.d.ts +1 -3
- package/api/resources/bulk/client/Client.d.ts +32 -120
- package/api/resources/bulk/client/Client.js +80 -191
- package/api/resources/bulk/client/requests/BulkCreateJobParams.d.ts +6 -86
- package/api/resources/bulk/client/requests/BulkGetUsersParams.d.ts +13 -0
- package/api/resources/bulk/client/requests/BulkGetUsersParams.js +5 -0
- package/api/resources/bulk/client/requests/index.d.ts +1 -0
- package/api/resources/bulk/types/BulkJobStatus.d.ts +1 -1
- package/api/resources/bulk/types/BulkJobUserStatus.d.ts +1 -1
- package/api/resources/bulk/types/InboundBulkMessageV2.d.ts +3 -5
- package/api/resources/commons/errors/AlreadyExistsError.js +17 -7
- package/api/resources/commons/errors/BadRequestError.js +17 -7
- package/api/resources/commons/errors/ConflictError.js +17 -7
- package/api/resources/commons/errors/MessageNotFoundError.js +17 -7
- package/api/resources/commons/errors/NotFoundError.js +17 -7
- package/api/resources/commons/errors/PaymentRequiredError.js +17 -7
- package/api/resources/commons/types/ChannelClassification.d.ts +1 -1
- package/api/resources/commons/types/NotificationPreferences.d.ts +1 -1
- package/api/resources/commons/types/PreferenceStatus.d.ts +1 -1
- package/api/resources/inbound/client/Client.d.ts +9 -1
- package/api/resources/inbound/client/Client.js +26 -21
- package/api/resources/index.js +17 -7
- package/api/resources/lists/client/Client.d.ts +31 -34
- package/api/resources/lists/client/Client.js +108 -161
- package/api/resources/lists/client/requests/AddSubscribersToList.d.ts +5 -5
- package/api/resources/lists/client/requests/GetAllListsRequest.d.ts +1 -4
- package/api/resources/lists/client/requests/GetSubscriptionForListRequest.d.ts +1 -3
- package/api/resources/lists/client/requests/SubscribeUserToListRequest.d.ts +1 -4
- package/api/resources/lists/client/requests/SubscribeUsersToListRequest.d.ts +5 -5
- package/api/resources/messages/client/Client.d.ts +15 -24
- package/api/resources/messages/client/Client.js +65 -104
- package/api/resources/messages/client/requests/GetMessageHistoryRequest.d.ts +1 -3
- package/api/resources/messages/client/requests/ListMessagesRequest.d.ts +1 -16
- package/api/resources/messages/types/MessageDetailsExtended.d.ts +7 -0
- package/api/resources/messages/types/MessageDetailsExtended.js +5 -0
- package/api/resources/messages/types/MessageStatus.d.ts +25 -5
- package/api/resources/messages/types/MessageStatus.js +6 -1
- package/api/resources/messages/types/Reason.d.ts +1 -1
- package/api/resources/messages/types/index.d.ts +1 -0
- package/api/resources/messages/types/index.js +1 -0
- package/api/resources/notifications/client/Client.d.ts +20 -11
- package/api/resources/notifications/client/Client.js +69 -88
- package/api/resources/notifications/client/requests/NotificationListParams.d.ts +1 -4
- package/api/resources/notifications/client/requests/SubmissionChecksReplaceParams.d.ts +6 -2
- package/api/resources/notifications/types/BlockType.d.ts +1 -1
- package/api/resources/notifications/types/CheckStatus.d.ts +1 -1
- package/api/resources/notifications/types/MessageRoutingChannel.d.ts +1 -1
- package/api/resources/notifications/types/MessageRoutingMethod.d.ts +1 -1
- package/api/resources/notifications/types/NotificationContent.d.ts +1 -1
- package/api/resources/profiles/client/Client.d.ts +35 -23
- package/api/resources/profiles/client/Client.js +95 -125
- package/api/resources/profiles/client/requests/GetListSubscriptionsRequest.d.ts +1 -3
- package/api/resources/profiles/client/requests/MergeProfileRequest.d.ts +1 -1
- package/api/resources/profiles/client/requests/ReplaceProfileRequest.d.ts +1 -1
- package/api/resources/profiles/types/DeviceType.d.ts +1 -1
- package/api/resources/profiles/types/Discord.d.ts +1 -1
- package/api/resources/profiles/types/Expo.d.ts +1 -1
- package/api/resources/profiles/types/MsTeams.d.ts +1 -1
- package/api/resources/profiles/types/ProfileUpdateRequest.d.ts +8 -0
- package/api/resources/profiles/types/ProfileUpdateRequest.js +5 -0
- package/api/resources/profiles/types/Slack.d.ts +1 -1
- package/api/resources/profiles/types/SnoozeRuleType.d.ts +1 -1
- package/api/resources/profiles/types/UserProfileFirebaseToken.d.ts +1 -1
- package/api/resources/profiles/types/WebhookAuthMode.d.ts +1 -1
- package/api/resources/profiles/types/WebhookMethod.d.ts +1 -1
- package/api/resources/profiles/types/WebhookProfileType.d.ts +1 -1
- package/api/resources/profiles/types/index.d.ts +1 -0
- package/api/resources/profiles/types/index.js +1 -0
- package/api/resources/send/types/Attachment.d.ts +1 -1
- package/api/resources/send/types/ChannelSource.d.ts +1 -1
- package/api/resources/send/types/Content.d.ts +1 -1
- package/api/resources/send/types/Criteria.d.ts +1 -1
- package/api/resources/send/types/ElementalNode.d.ts +1 -1
- package/api/resources/send/types/ExpiresInType.d.ts +1 -1
- package/api/resources/send/types/IActionButtonStyle.d.ts +1 -1
- package/api/resources/send/types/IAlignment.d.ts +1 -1
- package/api/resources/send/types/IPreferences.d.ts +1 -1
- package/api/resources/send/types/InAppPlacement.d.ts +1 -1
- package/api/resources/send/types/Locales.d.ts +1 -1
- package/api/resources/send/types/Message.d.ts +1 -1
- package/api/resources/send/types/MessageChannels.d.ts +1 -1
- package/api/resources/send/types/MessageData.d.ts +1 -1
- package/api/resources/send/types/MessageProviders.d.ts +1 -1
- package/api/resources/send/types/MessageRecipient.d.ts +1 -1
- package/api/resources/send/types/Recipient.d.ts +1 -1
- package/api/resources/send/types/RecipientData.d.ts +1 -1
- package/api/resources/send/types/RoutingChannel.d.ts +1 -1
- package/api/resources/send/types/RoutingMethod.d.ts +1 -1
- package/api/resources/send/types/RuleType.d.ts +1 -1
- package/api/resources/send/types/TextAlign.d.ts +1 -1
- package/api/resources/send/types/TextStyle.d.ts +1 -1
- package/api/resources/templates/client/Client.d.ts +9 -3
- package/api/resources/templates/client/Client.js +28 -25
- package/api/resources/templates/client/requests/ListTemplatesRequest.d.ts +1 -3
- package/api/resources/templates/types/ChannelIdentifier.d.ts +1 -1
- package/api/resources/templates/types/RoutingStrategyMethod.d.ts +1 -1
- package/api/resources/tenants/client/Client.d.ts +23 -37
- package/api/resources/tenants/client/Client.js +80 -127
- package/api/resources/tenants/client/requests/ListTenantParams.d.ts +1 -5
- package/api/resources/tenants/client/requests/ListUsersForTenantParams.d.ts +1 -4
- package/api/resources/tenants/client/requests/TenantCreateOrReplaceParams.d.ts +6 -21
- package/api/resources/tenants/types/SubscriptionTopicStatus.d.ts +1 -1
- package/api/resources/tenants/types/TemplateProperty.d.ts +1 -1
- package/api/resources/translations/client/Client.d.ts +10 -2
- package/api/resources/translations/client/Client.js +33 -33
- package/api/resources/users/client/Client.d.ts +5 -7
- package/api/resources/users/resources/index.js +17 -7
- package/api/resources/users/resources/preferences/client/Client.d.ts +13 -9
- package/api/resources/users/resources/preferences/client/Client.js +46 -55
- package/api/resources/users/resources/preferences/client/requests/UserPreferencesParams.d.ts +1 -3
- package/api/resources/users/resources/preferences/client/requests/UserPreferencesTopicParams.d.ts +1 -3
- package/api/resources/users/resources/preferences/client/requests/UserPreferencesUpdateParams.d.ts +2 -2
- package/api/resources/users/resources/tenants/client/Client.d.ts +23 -21
- package/api/resources/users/resources/tenants/client/Client.js +68 -89
- package/api/resources/users/resources/tenants/client/requests/AddUserToMultipleTenantsParams.d.ts +9 -8
- package/api/resources/users/resources/tenants/client/requests/AddUserToSingleTenantsParams.d.ts +1 -5
- package/api/resources/users/resources/tenants/client/requests/ListTenantsForUserParams.d.ts +1 -4
- package/api/resources/users/resources/tokens/client/Client.d.ts +27 -29
- package/api/resources/users/resources/tokens/client/Client.js +74 -104
- package/api/resources/users/resources/tokens/types/ExpiryDate.d.ts +1 -1
- package/api/resources/users/resources/tokens/types/GetAllTokensResponse.d.ts +1 -1
- package/api/resources/users/resources/tokens/types/PatchOp.d.ts +1 -1
- package/api/resources/users/resources/tokens/types/ProviderKey.d.ts +1 -1
- package/api/resources/users/resources/tokens/types/TokenStatus.d.ts +1 -1
- package/core/auth/BearerToken.d.ts +1 -1
- package/core/fetcher/APIResponse.d.ts +1 -1
- package/core/fetcher/Fetcher.d.ts +7 -3
- package/core/fetcher/Fetcher.js +30 -135
- package/core/fetcher/Supplier.d.ts +1 -1
- package/core/fetcher/createRequestUrl.d.ts +1 -0
- package/core/fetcher/createRequestUrl.js +12 -0
- package/core/fetcher/getFetchFn.d.ts +4 -0
- package/core/fetcher/getFetchFn.js +68 -0
- package/core/fetcher/getHeader.js +1 -2
- package/core/fetcher/getRequestBody.d.ts +7 -0
- package/core/fetcher/getRequestBody.js +23 -0
- package/core/fetcher/getResponseBody.d.ts +1 -0
- package/core/fetcher/getResponseBody.js +54 -0
- package/core/fetcher/makeRequest.d.ts +1 -0
- package/core/fetcher/makeRequest.js +42 -0
- package/core/fetcher/requestWithRetries.d.ts +1 -0
- package/core/fetcher/requestWithRetries.js +40 -0
- package/core/fetcher/signals.d.ts +11 -0
- package/core/fetcher/signals.js +36 -0
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +126 -0
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +59 -0
- package/core/json.d.ts +15 -0
- package/core/json.js +24 -0
- package/core/runtime/runtime.d.ts +2 -1
- package/core/runtime/runtime.js +57 -36
- package/dist/Client.d.ts +84 -109
- package/dist/Client.js +118 -148
- package/dist/api/client/requests/SendMessageRequest.d.ts +45 -78
- package/dist/api/resources/audiences/client/Client.d.ts +16 -16
- package/dist/api/resources/audiences/client/Client.js +63 -86
- package/dist/api/resources/audiences/client/requests/AudienceMembersListParams.d.ts +1 -3
- package/dist/api/resources/audiences/client/requests/AudienceUpdateParams.d.ts +3 -7
- package/dist/api/resources/audiences/client/requests/AudiencesListParams.d.ts +1 -3
- package/dist/api/resources/audiences/types/ComparisonOperator.d.ts +1 -1
- package/dist/api/resources/audiences/types/Filter.d.ts +1 -1
- package/dist/api/resources/audiences/types/FilterConfig.d.ts +1 -1
- package/dist/api/resources/audiences/types/LogicalOperator.d.ts +1 -1
- package/dist/api/resources/audiences/types/Operator.d.ts +1 -1
- package/dist/api/resources/auditEvents/client/Client.d.ts +10 -4
- package/dist/api/resources/auditEvents/client/Client.js +35 -37
- package/dist/api/resources/auditEvents/client/requests/ListAuditEventsRequest.d.ts +1 -3
- package/dist/api/resources/authTokens/client/Client.d.ts +11 -3
- package/dist/api/resources/authTokens/client/Client.js +28 -25
- package/dist/api/resources/authTokens/client/requests/IssueTokenParams.d.ts +2 -2
- package/dist/api/resources/automations/client/Client.d.ts +15 -13
- package/dist/api/resources/automations/client/Client.js +38 -48
- package/dist/api/resources/automations/types/AutomationAddToBatchMaxItemsType.d.ts +1 -1
- package/dist/api/resources/automations/types/AutomationAddToBatchRetainType.d.ts +1 -1
- package/dist/api/resources/automations/types/AutomationAddToBatchScope.d.ts +1 -1
- package/dist/api/resources/automations/types/AutomationFetchDataWebhookMethod.d.ts +1 -1
- package/dist/api/resources/automations/types/AutomationStepOption.d.ts +1 -1
- package/dist/api/resources/automations/types/AutomationThrottleScope.d.ts +1 -1
- package/dist/api/resources/automations/types/MergeAlgorithm.d.ts +1 -1
- package/dist/api/resources/automations/types/Profile.d.ts +1 -1
- package/dist/api/resources/brands/client/Client.d.ts +22 -58
- package/dist/api/resources/brands/client/Client.js +65 -126
- package/dist/api/resources/brands/client/requests/BrandUpdateParameters.d.ts +3 -26
- package/dist/api/resources/brands/client/requests/ListBrandsRequest.d.ts +1 -3
- package/dist/api/resources/bulk/client/Client.d.ts +32 -120
- package/dist/api/resources/bulk/client/Client.js +80 -191
- package/dist/api/resources/bulk/client/requests/BulkCreateJobParams.d.ts +6 -86
- package/dist/api/resources/bulk/client/requests/BulkGetUsersParams.d.ts +13 -0
- package/dist/api/resources/bulk/client/requests/BulkGetUsersParams.js +5 -0
- package/dist/api/resources/bulk/client/requests/index.d.ts +1 -0
- package/dist/api/resources/bulk/types/BulkJobStatus.d.ts +1 -1
- package/dist/api/resources/bulk/types/BulkJobUserStatus.d.ts +1 -1
- package/dist/api/resources/bulk/types/InboundBulkMessageV2.d.ts +3 -5
- package/dist/api/resources/commons/errors/AlreadyExistsError.js +17 -7
- package/dist/api/resources/commons/errors/BadRequestError.js +17 -7
- package/dist/api/resources/commons/errors/ConflictError.js +17 -7
- package/dist/api/resources/commons/errors/MessageNotFoundError.js +17 -7
- package/dist/api/resources/commons/errors/NotFoundError.js +17 -7
- package/dist/api/resources/commons/errors/PaymentRequiredError.js +17 -7
- package/dist/api/resources/commons/types/ChannelClassification.d.ts +1 -1
- package/dist/api/resources/commons/types/NotificationPreferences.d.ts +1 -1
- package/dist/api/resources/commons/types/PreferenceStatus.d.ts +1 -1
- package/dist/api/resources/inbound/client/Client.d.ts +9 -1
- package/dist/api/resources/inbound/client/Client.js +26 -21
- package/dist/api/resources/index.js +17 -7
- package/dist/api/resources/lists/client/Client.d.ts +31 -34
- package/dist/api/resources/lists/client/Client.js +108 -161
- package/dist/api/resources/lists/client/requests/AddSubscribersToList.d.ts +5 -5
- package/dist/api/resources/lists/client/requests/GetAllListsRequest.d.ts +1 -4
- package/dist/api/resources/lists/client/requests/GetSubscriptionForListRequest.d.ts +1 -3
- package/dist/api/resources/lists/client/requests/SubscribeUserToListRequest.d.ts +1 -4
- package/dist/api/resources/lists/client/requests/SubscribeUsersToListRequest.d.ts +5 -5
- package/dist/api/resources/messages/client/Client.d.ts +15 -24
- package/dist/api/resources/messages/client/Client.js +65 -104
- package/dist/api/resources/messages/client/requests/GetMessageHistoryRequest.d.ts +1 -3
- package/dist/api/resources/messages/client/requests/ListMessagesRequest.d.ts +1 -16
- package/dist/api/resources/messages/types/MessageDetailsExtended.d.ts +7 -0
- package/dist/api/resources/messages/types/MessageDetailsExtended.js +5 -0
- package/dist/api/resources/messages/types/MessageStatus.d.ts +25 -5
- package/dist/api/resources/messages/types/MessageStatus.js +6 -1
- package/dist/api/resources/messages/types/Reason.d.ts +1 -1
- package/dist/api/resources/messages/types/index.d.ts +1 -0
- package/dist/api/resources/messages/types/index.js +1 -0
- package/dist/api/resources/notifications/client/Client.d.ts +20 -11
- package/dist/api/resources/notifications/client/Client.js +69 -88
- package/dist/api/resources/notifications/client/requests/NotificationListParams.d.ts +1 -4
- package/dist/api/resources/notifications/client/requests/SubmissionChecksReplaceParams.d.ts +6 -2
- package/dist/api/resources/notifications/types/BlockType.d.ts +1 -1
- package/dist/api/resources/notifications/types/CheckStatus.d.ts +1 -1
- package/dist/api/resources/notifications/types/MessageRoutingChannel.d.ts +1 -1
- package/dist/api/resources/notifications/types/MessageRoutingMethod.d.ts +1 -1
- package/dist/api/resources/notifications/types/NotificationContent.d.ts +1 -1
- package/dist/api/resources/profiles/client/Client.d.ts +35 -23
- package/dist/api/resources/profiles/client/Client.js +95 -125
- package/dist/api/resources/profiles/client/requests/GetListSubscriptionsRequest.d.ts +1 -3
- package/dist/api/resources/profiles/client/requests/MergeProfileRequest.d.ts +1 -1
- package/dist/api/resources/profiles/client/requests/ReplaceProfileRequest.d.ts +1 -1
- package/dist/api/resources/profiles/types/DeviceType.d.ts +1 -1
- package/dist/api/resources/profiles/types/Discord.d.ts +1 -1
- package/dist/api/resources/profiles/types/Expo.d.ts +1 -1
- package/dist/api/resources/profiles/types/MsTeams.d.ts +1 -1
- package/dist/api/resources/profiles/types/ProfileUpdateRequest.d.ts +8 -0
- package/dist/api/resources/profiles/types/ProfileUpdateRequest.js +5 -0
- package/dist/api/resources/profiles/types/Slack.d.ts +1 -1
- package/dist/api/resources/profiles/types/SnoozeRuleType.d.ts +1 -1
- package/dist/api/resources/profiles/types/UserProfileFirebaseToken.d.ts +1 -1
- package/dist/api/resources/profiles/types/WebhookAuthMode.d.ts +1 -1
- package/dist/api/resources/profiles/types/WebhookMethod.d.ts +1 -1
- package/dist/api/resources/profiles/types/WebhookProfileType.d.ts +1 -1
- package/dist/api/resources/profiles/types/index.d.ts +1 -0
- package/dist/api/resources/profiles/types/index.js +1 -0
- package/dist/api/resources/send/types/Attachment.d.ts +1 -1
- package/dist/api/resources/send/types/ChannelSource.d.ts +1 -1
- package/dist/api/resources/send/types/Content.d.ts +1 -1
- package/dist/api/resources/send/types/Criteria.d.ts +1 -1
- package/dist/api/resources/send/types/ElementalNode.d.ts +1 -1
- package/dist/api/resources/send/types/ExpiresInType.d.ts +1 -1
- package/dist/api/resources/send/types/IActionButtonStyle.d.ts +1 -1
- package/dist/api/resources/send/types/IAlignment.d.ts +1 -1
- package/dist/api/resources/send/types/IPreferences.d.ts +1 -1
- package/dist/api/resources/send/types/InAppPlacement.d.ts +1 -1
- package/dist/api/resources/send/types/Locales.d.ts +1 -1
- package/dist/api/resources/send/types/Message.d.ts +1 -1
- package/dist/api/resources/send/types/MessageChannels.d.ts +1 -1
- package/dist/api/resources/send/types/MessageData.d.ts +1 -1
- package/dist/api/resources/send/types/MessageProviders.d.ts +1 -1
- package/dist/api/resources/send/types/MessageRecipient.d.ts +1 -1
- package/dist/api/resources/send/types/Recipient.d.ts +1 -1
- package/dist/api/resources/send/types/RecipientData.d.ts +1 -1
- package/dist/api/resources/send/types/RoutingChannel.d.ts +1 -1
- package/dist/api/resources/send/types/RoutingMethod.d.ts +1 -1
- package/dist/api/resources/send/types/RuleType.d.ts +1 -1
- package/dist/api/resources/send/types/TextAlign.d.ts +1 -1
- package/dist/api/resources/send/types/TextStyle.d.ts +1 -1
- package/dist/api/resources/templates/client/Client.d.ts +9 -3
- package/dist/api/resources/templates/client/Client.js +28 -25
- package/dist/api/resources/templates/client/requests/ListTemplatesRequest.d.ts +1 -3
- package/dist/api/resources/templates/types/ChannelIdentifier.d.ts +1 -1
- package/dist/api/resources/templates/types/RoutingStrategyMethod.d.ts +1 -1
- package/dist/api/resources/tenants/client/Client.d.ts +23 -37
- package/dist/api/resources/tenants/client/Client.js +80 -127
- package/dist/api/resources/tenants/client/requests/ListTenantParams.d.ts +1 -5
- package/dist/api/resources/tenants/client/requests/ListUsersForTenantParams.d.ts +1 -4
- package/dist/api/resources/tenants/client/requests/TenantCreateOrReplaceParams.d.ts +6 -21
- package/dist/api/resources/tenants/types/SubscriptionTopicStatus.d.ts +1 -1
- package/dist/api/resources/tenants/types/TemplateProperty.d.ts +1 -1
- package/dist/api/resources/translations/client/Client.d.ts +10 -2
- package/dist/api/resources/translations/client/Client.js +33 -33
- package/dist/api/resources/users/client/Client.d.ts +5 -7
- package/dist/api/resources/users/resources/index.js +17 -7
- package/dist/api/resources/users/resources/preferences/client/Client.d.ts +13 -9
- package/dist/api/resources/users/resources/preferences/client/Client.js +46 -55
- package/dist/api/resources/users/resources/preferences/client/requests/UserPreferencesParams.d.ts +1 -3
- package/dist/api/resources/users/resources/preferences/client/requests/UserPreferencesTopicParams.d.ts +1 -3
- package/dist/api/resources/users/resources/preferences/client/requests/UserPreferencesUpdateParams.d.ts +2 -2
- package/dist/api/resources/users/resources/tenants/client/Client.d.ts +23 -21
- package/dist/api/resources/users/resources/tenants/client/Client.js +68 -89
- package/dist/api/resources/users/resources/tenants/client/requests/AddUserToMultipleTenantsParams.d.ts +9 -8
- package/dist/api/resources/users/resources/tenants/client/requests/AddUserToSingleTenantsParams.d.ts +1 -5
- package/dist/api/resources/users/resources/tenants/client/requests/ListTenantsForUserParams.d.ts +1 -4
- package/dist/api/resources/users/resources/tokens/client/Client.d.ts +27 -29
- package/dist/api/resources/users/resources/tokens/client/Client.js +74 -104
- package/dist/api/resources/users/resources/tokens/types/ExpiryDate.d.ts +1 -1
- package/dist/api/resources/users/resources/tokens/types/GetAllTokensResponse.d.ts +1 -1
- package/dist/api/resources/users/resources/tokens/types/PatchOp.d.ts +1 -1
- package/dist/api/resources/users/resources/tokens/types/ProviderKey.d.ts +1 -1
- package/dist/api/resources/users/resources/tokens/types/TokenStatus.d.ts +1 -1
- package/dist/core/auth/BearerToken.d.ts +1 -1
- package/dist/core/fetcher/APIResponse.d.ts +1 -1
- package/dist/core/fetcher/Fetcher.d.ts +7 -3
- package/dist/core/fetcher/Fetcher.js +30 -135
- package/dist/core/fetcher/Supplier.d.ts +1 -1
- package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
- package/dist/core/fetcher/createRequestUrl.js +12 -0
- package/dist/core/fetcher/getFetchFn.d.ts +4 -0
- package/dist/core/fetcher/getFetchFn.js +68 -0
- package/dist/core/fetcher/getHeader.js +1 -2
- package/dist/core/fetcher/getRequestBody.d.ts +7 -0
- package/dist/core/fetcher/getRequestBody.js +23 -0
- package/dist/core/fetcher/getResponseBody.d.ts +1 -0
- package/dist/core/fetcher/getResponseBody.js +54 -0
- package/dist/core/fetcher/makeRequest.d.ts +1 -0
- package/dist/core/fetcher/makeRequest.js +42 -0
- package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
- package/dist/core/fetcher/requestWithRetries.js +40 -0
- package/dist/core/fetcher/signals.d.ts +11 -0
- package/dist/core/fetcher/signals.js +36 -0
- package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
- package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
- package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +126 -0
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
- package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
- package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +59 -0
- package/dist/core/json.d.ts +15 -0
- package/dist/core/json.js +24 -0
- package/dist/core/runtime/runtime.d.ts +2 -1
- package/dist/core/runtime/runtime.js +57 -36
- package/dist/environments.d.ts +1 -1
- package/dist/errors/CourierError.js +2 -1
- package/dist/errors/CourierTimeoutError.d.ts +1 -1
- package/dist/errors/CourierTimeoutError.js +2 -2
- package/dist/index.js +17 -7
- package/dist/version.d.ts +1 -0
- package/dist/version.js +4 -0
- package/environments.d.ts +1 -1
- package/errors/CourierError.js +2 -1
- package/errors/CourierTimeoutError.d.ts +1 -1
- package/errors/CourierTimeoutError.js +2 -2
- package/index.js +17 -7
- package/{jest.config.js → jest.config.mjs} +4 -1
- package/package.json +23 -14
- package/reference.md +5180 -0
- package/scripts/rename-to-esm-files.js +115 -0
- package/version.d.ts +1 -0
- package/version.js +4 -0
|
@@ -7,12 +7,20 @@ import * as Courier from "../../../index";
|
|
|
7
7
|
export declare namespace AuthTokens {
|
|
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
|
interface IdempotentRequestOptions extends RequestOptions {
|
|
18
26
|
idempotencyKey?: string | undefined;
|
|
@@ -29,9 +37,9 @@ export declare class AuthTokens {
|
|
|
29
37
|
* @param {AuthTokens.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
30
38
|
*
|
|
31
39
|
* @example
|
|
32
|
-
* await
|
|
33
|
-
* scope: "
|
|
34
|
-
* expires_in: "
|
|
40
|
+
* await client.authTokens.issueToken({
|
|
41
|
+
* scope: "scope",
|
|
42
|
+
* expires_in: "expires_in"
|
|
35
43
|
* })
|
|
36
44
|
*/
|
|
37
45
|
issueToken(request: Courier.IssueTokenParams, requestOptions?: AuthTokens.IdempotentRequestOptions): Promise<Courier.IssueTokenResponse>;
|
|
@@ -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) {
|
|
@@ -54,31 +64,24 @@ class AuthTokens {
|
|
|
54
64
|
* @param {AuthTokens.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
55
65
|
*
|
|
56
66
|
* @example
|
|
57
|
-
* await
|
|
58
|
-
* scope: "
|
|
59
|
-
* expires_in: "
|
|
67
|
+
* await client.authTokens.issueToken({
|
|
68
|
+
* scope: "scope",
|
|
69
|
+
* expires_in: "expires_in"
|
|
60
70
|
* })
|
|
61
71
|
*/
|
|
62
72
|
issueToken(request, requestOptions) {
|
|
63
|
-
var _a, _b;
|
|
64
73
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
var _a, _b, _c;
|
|
65
75
|
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.
|
|
76
|
+
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, "/auth/issue-token"),
|
|
67
77
|
method: "POST",
|
|
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.0",
|
|
73
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
74
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
75
|
-
"Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined,
|
|
76
|
-
"X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined,
|
|
77
|
-
},
|
|
78
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.0", "User-Agent": "@trycourier/courier/6.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, "Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined, "X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
78
79
|
contentType: "application/json",
|
|
80
|
+
requestType: "json",
|
|
79
81
|
body: request,
|
|
80
82
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
81
83
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
84
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
82
85
|
});
|
|
83
86
|
if (_response.ok) {
|
|
84
87
|
return _response.body;
|
|
@@ -96,7 +99,7 @@ class AuthTokens {
|
|
|
96
99
|
body: _response.error.rawBody,
|
|
97
100
|
});
|
|
98
101
|
case "timeout":
|
|
99
|
-
throw new errors.CourierTimeoutError();
|
|
102
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling POST /auth/issue-token.");
|
|
100
103
|
case "unknown":
|
|
101
104
|
throw new errors.CourierError({
|
|
102
105
|
message: _response.error.errorMessage,
|
|
@@ -105,12 +108,12 @@ class AuthTokens {
|
|
|
105
108
|
});
|
|
106
109
|
}
|
|
107
110
|
_getAuthorizationHeader() {
|
|
108
|
-
var _a;
|
|
109
111
|
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
var _a;
|
|
110
113
|
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"];
|
|
111
114
|
if (bearer == null) {
|
|
112
115
|
throw new errors.CourierError({
|
|
113
|
-
message: "Please specify
|
|
116
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a COURIER_AUTH_TOKEN environment variable",
|
|
114
117
|
});
|
|
115
118
|
}
|
|
116
119
|
return `Bearer ${bearer}`;
|
|
@@ -7,12 +7,20 @@ import * as Courier from "../../../index";
|
|
|
7
7
|
export declare namespace Automations {
|
|
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
|
interface IdempotentRequestOptions extends RequestOptions {
|
|
18
26
|
idempotencyKey?: string | undefined;
|
|
@@ -30,18 +38,12 @@ export declare class Automations {
|
|
|
30
38
|
* @param {Automations.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
31
39
|
*
|
|
32
40
|
* @example
|
|
33
|
-
* await
|
|
34
|
-
* brand:
|
|
35
|
-
* data:
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* },
|
|
40
|
-
* profile: {
|
|
41
|
-
* "key": "value"
|
|
42
|
-
* },
|
|
43
|
-
* recipient: "string",
|
|
44
|
-
* template: "string"
|
|
41
|
+
* await client.automations.invokeAutomationTemplate("templateId", {
|
|
42
|
+
* brand: undefined,
|
|
43
|
+
* data: undefined,
|
|
44
|
+
* profile: undefined,
|
|
45
|
+
* recipient: undefined,
|
|
46
|
+
* template: undefined
|
|
45
47
|
* })
|
|
46
48
|
*/
|
|
47
49
|
invokeAutomationTemplate(templateId: string, request: Courier.AutomationInvokeParams, requestOptions?: Automations.IdempotentRequestOptions): Promise<Courier.AutomationInvokeResponse>;
|
|
@@ -52,7 +54,7 @@ export declare class Automations {
|
|
|
52
54
|
* @param {Automations.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
53
55
|
*
|
|
54
56
|
* @example
|
|
55
|
-
* await
|
|
57
|
+
* await client.automations.invokeAdHocAutomation({
|
|
56
58
|
* data: {
|
|
57
59
|
* "name": "Foo"
|
|
58
60
|
* },
|
|
@@ -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) {
|
|
@@ -55,40 +65,27 @@ class Automations {
|
|
|
55
65
|
* @param {Automations.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
56
66
|
*
|
|
57
67
|
* @example
|
|
58
|
-
* await
|
|
59
|
-
* brand:
|
|
60
|
-
* data:
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* },
|
|
65
|
-
* profile: {
|
|
66
|
-
* "key": "value"
|
|
67
|
-
* },
|
|
68
|
-
* recipient: "string",
|
|
69
|
-
* template: "string"
|
|
68
|
+
* await client.automations.invokeAutomationTemplate("templateId", {
|
|
69
|
+
* brand: undefined,
|
|
70
|
+
* data: undefined,
|
|
71
|
+
* profile: undefined,
|
|
72
|
+
* recipient: undefined,
|
|
73
|
+
* template: undefined
|
|
70
74
|
* })
|
|
71
75
|
*/
|
|
72
76
|
invokeAutomationTemplate(templateId, request, requestOptions) {
|
|
73
|
-
var _a, _b;
|
|
74
77
|
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
var _a, _b, _c;
|
|
75
79
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
76
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
80
|
+
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, `/automations/${encodeURIComponent(templateId)}/invoke`),
|
|
77
81
|
method: "POST",
|
|
78
|
-
headers: {
|
|
79
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
80
|
-
"X-Fern-Language": "JavaScript",
|
|
81
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
82
|
-
"X-Fern-SDK-Version": "v6.3.0",
|
|
83
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
84
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
85
|
-
"Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined,
|
|
86
|
-
"X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined,
|
|
87
|
-
},
|
|
82
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.0", "User-Agent": "@trycourier/courier/6.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, "Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined, "X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
88
83
|
contentType: "application/json",
|
|
84
|
+
requestType: "json",
|
|
89
85
|
body: request,
|
|
90
86
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
91
87
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
88
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
92
89
|
});
|
|
93
90
|
if (_response.ok) {
|
|
94
91
|
return _response.body;
|
|
@@ -106,7 +103,7 @@ class Automations {
|
|
|
106
103
|
body: _response.error.rawBody,
|
|
107
104
|
});
|
|
108
105
|
case "timeout":
|
|
109
|
-
throw new errors.CourierTimeoutError();
|
|
106
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling POST /automations/{templateId}/invoke.");
|
|
110
107
|
case "unknown":
|
|
111
108
|
throw new errors.CourierError({
|
|
112
109
|
message: _response.error.errorMessage,
|
|
@@ -121,7 +118,7 @@ class Automations {
|
|
|
121
118
|
* @param {Automations.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
122
119
|
*
|
|
123
120
|
* @example
|
|
124
|
-
* await
|
|
121
|
+
* await client.automations.invokeAdHocAutomation({
|
|
125
122
|
* data: {
|
|
126
123
|
* "name": "Foo"
|
|
127
124
|
* },
|
|
@@ -142,25 +139,18 @@ class Automations {
|
|
|
142
139
|
* })
|
|
143
140
|
*/
|
|
144
141
|
invokeAdHocAutomation(request, requestOptions) {
|
|
145
|
-
var _a, _b;
|
|
146
142
|
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
+
var _a, _b, _c;
|
|
147
144
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
148
|
-
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.
|
|
145
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.CourierEnvironment.Production, "/automations/invoke"),
|
|
149
146
|
method: "POST",
|
|
150
|
-
headers: {
|
|
151
|
-
Authorization: yield this._getAuthorizationHeader(),
|
|
152
|
-
"X-Fern-Language": "JavaScript",
|
|
153
|
-
"X-Fern-SDK-Name": "@trycourier/courier",
|
|
154
|
-
"X-Fern-SDK-Version": "v6.3.0",
|
|
155
|
-
"X-Fern-Runtime": core.RUNTIME.type,
|
|
156
|
-
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
157
|
-
"Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined,
|
|
158
|
-
"X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined,
|
|
159
|
-
},
|
|
147
|
+
headers: Object.assign({ Authorization: yield this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@trycourier/courier", "X-Fern-SDK-Version": "6.4.0", "User-Agent": "@trycourier/courier/6.4.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, "Idempotency-Key": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey : undefined, "X-Idempotency-Expiration": (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry) != null ? requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyExpiry : undefined }, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
160
148
|
contentType: "application/json",
|
|
149
|
+
requestType: "json",
|
|
161
150
|
body: request,
|
|
162
151
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
163
152
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
153
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
164
154
|
});
|
|
165
155
|
if (_response.ok) {
|
|
166
156
|
return _response.body;
|
|
@@ -178,7 +168,7 @@ class Automations {
|
|
|
178
168
|
body: _response.error.rawBody,
|
|
179
169
|
});
|
|
180
170
|
case "timeout":
|
|
181
|
-
throw new errors.CourierTimeoutError();
|
|
171
|
+
throw new errors.CourierTimeoutError("Timeout exceeded when calling POST /automations/invoke.");
|
|
182
172
|
case "unknown":
|
|
183
173
|
throw new errors.CourierError({
|
|
184
174
|
message: _response.error.errorMessage,
|
|
@@ -187,12 +177,12 @@ class Automations {
|
|
|
187
177
|
});
|
|
188
178
|
}
|
|
189
179
|
_getAuthorizationHeader() {
|
|
190
|
-
var _a;
|
|
191
180
|
return __awaiter(this, void 0, void 0, function* () {
|
|
181
|
+
var _a;
|
|
192
182
|
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"];
|
|
193
183
|
if (bearer == null) {
|
|
194
184
|
throw new errors.CourierError({
|
|
195
|
-
message: "Please specify
|
|
185
|
+
message: "Please specify a bearer by either passing it in to the constructor or initializing a COURIER_AUTH_TOKEN environment variable",
|
|
196
186
|
});
|
|
197
187
|
}
|
|
198
188
|
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 AutomationAddToBatchRetainType = "first" | "last" | "highest" | "lowest";
|
|
5
5
|
export declare const AutomationAddToBatchRetainType: {
|
|
6
6
|
readonly First: "first";
|
|
7
7
|
readonly Last: "last";
|
|
@@ -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 AutomationAddToBatchScope = "user" | "global" | "dynamic";
|
|
5
5
|
export declare const AutomationAddToBatchScope: {
|
|
6
6
|
readonly User: "user";
|
|
7
7
|
readonly Global: "global";
|
|
@@ -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 AutomationFetchDataWebhookMethod = "GET" | "POST";
|
|
5
5
|
export declare const AutomationFetchDataWebhookMethod: {
|
|
6
6
|
readonly Get: "GET";
|
|
7
7
|
readonly Post: "POST";
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
import * as Courier from "../../../index";
|
|
5
|
-
export
|
|
5
|
+
export type AutomationStepOption = Courier.AutomationAddToDigestStep | Courier.AutomationAddToBatchStep | Courier.AutomationThrottleStep | Courier.AutomationCancelStep | Courier.AutomationDelayStep | Courier.AutomationFetchDataStep | Courier.AutomationInvokeStep | Courier.AutomationSendStep | Courier.AutomationV2SendStep | Courier.AutomationSendListStep | Courier.AutomationUpdateProfileStep;
|
|
@@ -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 AutomationThrottleScope = "user" | "global" | "dynamic";
|
|
5
5
|
export declare const AutomationThrottleScope: {
|
|
6
6
|
readonly User: "user";
|
|
7
7
|
readonly Global: "global";
|
|
@@ -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 MergeAlgorithm = "replace" | "none" | "overwrite" | "soft-merge";
|
|
5
5
|
export declare const MergeAlgorithm: {
|
|
6
6
|
readonly Replace: "replace";
|
|
7
7
|
readonly None: "none";
|
|
@@ -7,12 +7,20 @@ import * as Courier from "../../../index";
|
|
|
7
7
|
export declare namespace Brands {
|
|
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
|
interface IdempotentRequestOptions extends RequestOptions {
|
|
18
26
|
idempotencyKey?: string | undefined;
|
|
@@ -31,34 +39,15 @@ export declare class Brands {
|
|
|
31
39
|
* @throws {@link Courier.AlreadyExistsError}
|
|
32
40
|
*
|
|
33
41
|
* @example
|
|
34
|
-
* await
|
|
35
|
-
* id:
|
|
36
|
-
* name: "
|
|
42
|
+
* await client.brands.create({
|
|
43
|
+
* id: undefined,
|
|
44
|
+
* name: "name",
|
|
37
45
|
* settings: {
|
|
38
|
-
* colors:
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* tertiary: "string"
|
|
42
|
-
* },
|
|
43
|
-
* inapp: {
|
|
44
|
-
* "key": "value"
|
|
45
|
-
* },
|
|
46
|
-
* email: {
|
|
47
|
-
* footer: {
|
|
48
|
-
* "key": "value"
|
|
49
|
-
* },
|
|
50
|
-
* header: {
|
|
51
|
-
* "key": "value"
|
|
52
|
-
* }
|
|
53
|
-
* }
|
|
46
|
+
* colors: undefined,
|
|
47
|
+
* inapp: undefined,
|
|
48
|
+
* email: undefined
|
|
54
49
|
* },
|
|
55
|
-
* snippets:
|
|
56
|
-
* items: [{
|
|
57
|
-
* format: "handlebars",
|
|
58
|
-
* name: "string",
|
|
59
|
-
* value: "string"
|
|
60
|
-
* }]
|
|
61
|
-
* }
|
|
50
|
+
* snippets: undefined
|
|
62
51
|
* })
|
|
63
52
|
*/
|
|
64
53
|
create(request: Courier.BrandParameters, requestOptions?: Brands.IdempotentRequestOptions): Promise<Courier.Brand>;
|
|
@@ -69,7 +58,7 @@ export declare class Brands {
|
|
|
69
58
|
* @param {Brands.RequestOptions} requestOptions - Request-specific configuration.
|
|
70
59
|
*
|
|
71
60
|
* @example
|
|
72
|
-
* await
|
|
61
|
+
* await client.brands.get("brand_id")
|
|
73
62
|
*/
|
|
74
63
|
get(brandId: string, requestOptions?: Brands.RequestOptions): Promise<Courier.Brand>;
|
|
75
64
|
/**
|
|
@@ -79,9 +68,7 @@ export declare class Brands {
|
|
|
79
68
|
* @param {Brands.RequestOptions} requestOptions - Request-specific configuration.
|
|
80
69
|
*
|
|
81
70
|
* @example
|
|
82
|
-
* await
|
|
83
|
-
* cursor: "string"
|
|
84
|
-
* })
|
|
71
|
+
* await client.brands.list()
|
|
85
72
|
*/
|
|
86
73
|
list(request?: Courier.ListBrandsRequest, requestOptions?: Brands.RequestOptions): Promise<Courier.BrandsResponse>;
|
|
87
74
|
/**
|
|
@@ -93,7 +80,7 @@ export declare class Brands {
|
|
|
93
80
|
* @throws {@link Courier.ConflictError}
|
|
94
81
|
*
|
|
95
82
|
* @example
|
|
96
|
-
* await
|
|
83
|
+
* await client.brands.delete("brand_id")
|
|
97
84
|
*/
|
|
98
85
|
delete(brandId: string, requestOptions?: Brands.RequestOptions): Promise<void>;
|
|
99
86
|
/**
|
|
@@ -104,33 +91,10 @@ export declare class Brands {
|
|
|
104
91
|
* @param {Brands.RequestOptions} requestOptions - Request-specific configuration.
|
|
105
92
|
*
|
|
106
93
|
* @example
|
|
107
|
-
* await
|
|
108
|
-
* name: "
|
|
109
|
-
* settings:
|
|
110
|
-
*
|
|
111
|
-
* primary: "string",
|
|
112
|
-
* secondary: "string",
|
|
113
|
-
* tertiary: "string"
|
|
114
|
-
* },
|
|
115
|
-
* inapp: {
|
|
116
|
-
* "key": "value"
|
|
117
|
-
* },
|
|
118
|
-
* email: {
|
|
119
|
-
* footer: {
|
|
120
|
-
* "key": "value"
|
|
121
|
-
* },
|
|
122
|
-
* header: {
|
|
123
|
-
* "key": "value"
|
|
124
|
-
* }
|
|
125
|
-
* }
|
|
126
|
-
* },
|
|
127
|
-
* snippets: {
|
|
128
|
-
* items: [{
|
|
129
|
-
* format: "handlebars",
|
|
130
|
-
* name: "string",
|
|
131
|
-
* value: "string"
|
|
132
|
-
* }]
|
|
133
|
-
* }
|
|
94
|
+
* await client.brands.replace("brand_id", {
|
|
95
|
+
* name: "name",
|
|
96
|
+
* settings: undefined,
|
|
97
|
+
* snippets: undefined
|
|
134
98
|
* })
|
|
135
99
|
*/
|
|
136
100
|
replace(brandId: string, request: Courier.BrandUpdateParameters, requestOptions?: Brands.RequestOptions): Promise<Courier.Brand>;
|