magicbell-js 0.0.2 → 0.0.4
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/dist/commonjs/project-client/http/environment.d.ts +1 -1
- package/dist/commonjs/project-client/http/environment.d.ts.map +1 -1
- package/dist/commonjs/project-client/http/environment.js +1 -1
- package/dist/commonjs/project-client/http/environment.js.map +1 -1
- package/dist/commonjs/user-client/http/environment.d.ts +1 -1
- package/dist/commonjs/user-client/http/environment.d.ts.map +1 -1
- package/dist/commonjs/user-client/http/environment.js +1 -1
- package/dist/commonjs/user-client/http/environment.js.map +1 -1
- package/dist/esm/project-client/http/environment.d.ts +1 -1
- package/dist/esm/project-client/http/environment.d.ts.map +1 -1
- package/dist/esm/project-client/http/environment.js +1 -1
- package/dist/esm/project-client/http/environment.js.map +1 -1
- package/dist/esm/user-client/http/environment.d.ts +1 -1
- package/dist/esm/user-client/http/environment.d.ts.map +1 -1
- package/dist/esm/user-client/http/environment.js +1 -1
- package/dist/esm/user-client/http/environment.js.map +1 -1
- package/package.json +3 -2
- package/src/project-client/http/client.ts +71 -0
- package/src/project-client/http/environment.ts +3 -0
- package/src/project-client/http/error.ts +14 -0
- package/src/project-client/http/errors/validation-error.ts +25 -0
- package/src/project-client/http/handlers/handler-chain.ts +30 -0
- package/src/project-client/http/handlers/hook-handler.ts +78 -0
- package/src/project-client/http/handlers/request-validation-handler.ts +111 -0
- package/src/project-client/http/handlers/response-validation-handler.ts +203 -0
- package/src/project-client/http/handlers/retry-handler.ts +60 -0
- package/src/project-client/http/handlers/terminating-handler.ts +14 -0
- package/src/project-client/http/hooks/custom-hook.ts +25 -0
- package/src/project-client/http/hooks/hook.ts +41 -0
- package/src/project-client/http/index.ts +11 -0
- package/src/project-client/http/serialization/base-serializer.ts +139 -0
- package/src/project-client/http/serialization/header-serializer.ts +19 -0
- package/src/project-client/http/serialization/path-serializer.ts +12 -0
- package/src/project-client/http/serialization/query-serializer.ts +18 -0
- package/src/project-client/http/transport/request-builder.ts +242 -0
- package/src/project-client/http/transport/request-fetch-adapter.ts +131 -0
- package/src/project-client/http/transport/request.ts +222 -0
- package/src/project-client/http/transport/transport-hook-adapter.ts +91 -0
- package/src/project-client/http/transport/types.ts +50 -0
- package/src/project-client/http/types.ts +74 -0
- package/src/project-client/http/utils/content-type.ts +33 -0
- package/src/project-client/http/utils/line-decoder.ts +35 -0
- package/src/project-client/http/utils/response-matcher.ts +25 -0
- package/src/project-client/index.ts +94 -0
- package/src/project-client/services/base-service.ts +27 -0
- package/src/project-client/services/broadcasts/broadcasts-service.ts +115 -0
- package/src/project-client/services/broadcasts/index.ts +2 -0
- package/src/project-client/services/broadcasts/models/broadcast-collection.ts +54 -0
- package/src/project-client/services/broadcasts/models/broadcast-status.ts +60 -0
- package/src/project-client/services/broadcasts/models/broadcast.ts +143 -0
- package/src/project-client/services/broadcasts/models/email.ts +57 -0
- package/src/project-client/services/broadcasts/models/errors.ts +45 -0
- package/src/project-client/services/broadcasts/models/in-app.ts +57 -0
- package/src/project-client/services/broadcasts/models/index.ts +15 -0
- package/src/project-client/services/broadcasts/models/mobile-push.ts +57 -0
- package/src/project-client/services/broadcasts/models/overrides-channels.ts +82 -0
- package/src/project-client/services/broadcasts/models/overrides.ts +59 -0
- package/src/project-client/services/broadcasts/models/providers.ts +81 -0
- package/src/project-client/services/broadcasts/models/slack.ts +57 -0
- package/src/project-client/services/broadcasts/models/sms.ts +57 -0
- package/src/project-client/services/broadcasts/models/status-status.ts +7 -0
- package/src/project-client/services/broadcasts/models/summary.ts +51 -0
- package/src/project-client/services/broadcasts/models/web-push.ts +57 -0
- package/src/project-client/services/broadcasts/request-params.ts +5 -0
- package/src/project-client/services/channels/channels-service.ts +1017 -0
- package/src/project-client/services/channels/index.ts +2 -0
- package/src/project-client/services/channels/models/apns-token-collection.ts +54 -0
- package/src/project-client/services/channels/models/apns-token-installation-id.ts +6 -0
- package/src/project-client/services/channels/models/apns-token.ts +90 -0
- package/src/project-client/services/channels/models/category-delivery-config-channels.ts +57 -0
- package/src/project-client/services/channels/models/category-delivery-config.ts +73 -0
- package/src/project-client/services/channels/models/channel.ts +11 -0
- package/src/project-client/services/channels/models/discard-result.ts +51 -0
- package/src/project-client/services/channels/models/expo-token-collection.ts +54 -0
- package/src/project-client/services/channels/models/expo-token.ts +69 -0
- package/src/project-client/services/channels/models/fcm-token-collection.ts +54 -0
- package/src/project-client/services/channels/models/fcm-token-installation-id.ts +6 -0
- package/src/project-client/services/channels/models/fcm-token.ts +75 -0
- package/src/project-client/services/channels/models/inbox-token-response-collection.ts +59 -0
- package/src/project-client/services/channels/models/inbox-token-response.ts +75 -0
- package/src/project-client/services/channels/models/index.ts +24 -0
- package/src/project-client/services/channels/models/keys.ts +51 -0
- package/src/project-client/services/channels/models/oauth.ts +57 -0
- package/src/project-client/services/channels/models/slack-token-collection.ts +54 -0
- package/src/project-client/services/channels/models/slack-token-webhook.ts +45 -0
- package/src/project-client/services/channels/models/slack-token.ts +83 -0
- package/src/project-client/services/channels/models/teams-token-collection.ts +54 -0
- package/src/project-client/services/channels/models/teams-token-webhook.ts +45 -0
- package/src/project-client/services/channels/models/teams-token.ts +76 -0
- package/src/project-client/services/channels/models/web-push-token-collection.ts +54 -0
- package/src/project-client/services/channels/models/web-push-token.ts +77 -0
- package/src/project-client/services/channels/request-params.ts +45 -0
- package/src/project-client/services/common/index.ts +1 -0
- package/src/project-client/services/common/links.ts +57 -0
- package/src/project-client/services/events/events-service.ts +84 -0
- package/src/project-client/services/events/index.ts +2 -0
- package/src/project-client/services/events/models/event-collection.ts +54 -0
- package/src/project-client/services/events/models/event.ts +81 -0
- package/src/project-client/services/events/models/index.ts +2 -0
- package/src/project-client/services/events/request-params.ts +5 -0
- package/src/project-client/services/integrations/index.ts +2 -0
- package/src/project-client/services/integrations/integrations-service.ts +1965 -0
- package/src/project-client/services/integrations/models/apns-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/apns-config-payload.ts +81 -0
- package/src/project-client/services/integrations/models/apns-config.ts +64 -0
- package/src/project-client/services/integrations/models/awssns-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/awssns-config-payload.ts +45 -0
- package/src/project-client/services/integrations/models/awssns-config.ts +64 -0
- package/src/project-client/services/integrations/models/badge.ts +6 -0
- package/src/project-client/services/integrations/models/banner.ts +63 -0
- package/src/project-client/services/integrations/models/default-hover.ts +45 -0
- package/src/project-client/services/integrations/models/default-state.ts +45 -0
- package/src/project-client/services/integrations/models/default_.ts +90 -0
- package/src/project-client/services/integrations/models/dialog.ts +57 -0
- package/src/project-client/services/integrations/models/event-source-config-collection.ts +59 -0
- package/src/project-client/services/integrations/models/event-source-config-payload.ts +45 -0
- package/src/project-client/services/integrations/models/event-source-config.ts +64 -0
- package/src/project-client/services/integrations/models/expo-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/expo-config-payload.ts +45 -0
- package/src/project-client/services/integrations/models/expo-config.ts +64 -0
- package/src/project-client/services/integrations/models/fcm-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/fcm-config-payload.ts +105 -0
- package/src/project-client/services/integrations/models/fcm-config.ts +64 -0
- package/src/project-client/services/integrations/models/footer.ts +63 -0
- package/src/project-client/services/integrations/models/github-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/github-config-payload.ts +45 -0
- package/src/project-client/services/integrations/models/github-config.ts +64 -0
- package/src/project-client/services/integrations/models/header.ts +69 -0
- package/src/project-client/services/integrations/models/icon.ts +51 -0
- package/src/project-client/services/integrations/models/images.ts +45 -0
- package/src/project-client/services/integrations/models/inbox-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/inbox-config-payload.ts +60 -0
- package/src/project-client/services/integrations/models/inbox-config.ts +64 -0
- package/src/project-client/services/integrations/models/index.ts +75 -0
- package/src/project-client/services/integrations/models/integration-config-collection.ts +59 -0
- package/src/project-client/services/integrations/models/integration-config.ts +57 -0
- package/src/project-client/services/integrations/models/mailgun-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/mailgun-config-payload-from.ts +51 -0
- package/src/project-client/services/integrations/models/mailgun-config-payload.ts +70 -0
- package/src/project-client/services/integrations/models/mailgun-config.ts +64 -0
- package/src/project-client/services/integrations/models/notification.ts +61 -0
- package/src/project-client/services/integrations/models/payload-version.ts +6 -0
- package/src/project-client/services/integrations/models/ping-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/ping-config-payload.ts +45 -0
- package/src/project-client/services/integrations/models/ping-config.ts +64 -0
- package/src/project-client/services/integrations/models/region.ts +6 -0
- package/src/project-client/services/integrations/models/reply-to.ts +51 -0
- package/src/project-client/services/integrations/models/sendgrid-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/sendgrid-config-payload-from.ts +51 -0
- package/src/project-client/services/integrations/models/sendgrid-config-payload.ts +65 -0
- package/src/project-client/services/integrations/models/sendgrid-config.ts +64 -0
- package/src/project-client/services/integrations/models/ses-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/ses-config-payload-from.ts +51 -0
- package/src/project-client/services/integrations/models/ses-config-payload.ts +70 -0
- package/src/project-client/services/integrations/models/ses-config.ts +64 -0
- package/src/project-client/services/integrations/models/slack-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/slack-config-payload.ts +63 -0
- package/src/project-client/services/integrations/models/slack-config.ts +64 -0
- package/src/project-client/services/integrations/models/stripe-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/stripe-config-payload.ts +45 -0
- package/src/project-client/services/integrations/models/stripe-config.ts +64 -0
- package/src/project-client/services/integrations/models/templates-config-collection.ts +59 -0
- package/src/project-client/services/integrations/models/templates-config.ts +57 -0
- package/src/project-client/services/integrations/models/theme.ts +89 -0
- package/src/project-client/services/integrations/models/twilio-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/twilio-config-payload.ts +75 -0
- package/src/project-client/services/integrations/models/twilio-config.ts +64 -0
- package/src/project-client/services/integrations/models/type_.ts +5 -0
- package/src/project-client/services/integrations/models/unread-hover.ts +45 -0
- package/src/project-client/services/integrations/models/unread-state.ts +45 -0
- package/src/project-client/services/integrations/models/unread.ts +66 -0
- package/src/project-client/services/integrations/models/unseen-badge.ts +45 -0
- package/src/project-client/services/integrations/models/unseen-hover.ts +45 -0
- package/src/project-client/services/integrations/models/unseen-state.ts +45 -0
- package/src/project-client/services/integrations/models/unseen.ts +66 -0
- package/src/project-client/services/integrations/models/webpush-config-collection.ts +54 -0
- package/src/project-client/services/integrations/models/webpush-config-payload.ts +51 -0
- package/src/project-client/services/integrations/models/webpush-config.ts +64 -0
- package/src/project-client/services/integrations/request-params.ts +5 -0
- package/src/project-client/services/jwt/index.ts +2 -0
- package/src/project-client/services/jwt/jwt-service.ts +233 -0
- package/src/project-client/services/jwt/models/access-token-collection.ts +54 -0
- package/src/project-client/services/jwt/models/access-token.ts +69 -0
- package/src/project-client/services/jwt/models/create-project-token-request.ts +51 -0
- package/src/project-client/services/jwt/models/create-token-response.ts +63 -0
- package/src/project-client/services/jwt/models/create-user-token-request.ts +63 -0
- package/src/project-client/services/jwt/models/discard-token-response.ts +51 -0
- package/src/project-client/services/jwt/models/index.ts +6 -0
- package/src/project-client/services/jwt/request-params.ts +11 -0
- package/src/project-client/services/notifications/index.ts +2 -0
- package/src/project-client/services/notifications/models/delivery-plan-collection.ts +54 -0
- package/src/project-client/services/notifications/models/delivery-plan.ts +93 -0
- package/src/project-client/services/notifications/models/index.ts +2 -0
- package/src/project-client/services/notifications/notifications-service.ts +44 -0
- package/src/project-client/services/users/index.ts +2 -0
- package/src/project-client/services/users/models/index.ts +2 -0
- package/src/project-client/services/users/models/user-collection.ts +54 -0
- package/src/project-client/services/users/models/user.ts +99 -0
- package/src/project-client/services/users/request-params.ts +6 -0
- package/src/project-client/services/users/users-service.ts +117 -0
- package/src/project-client.ts +1 -0
- package/src/user-client/http/client.ts +71 -0
- package/src/user-client/http/environment.ts +3 -0
- package/src/user-client/http/error.ts +14 -0
- package/src/user-client/http/errors/validation-error.ts +25 -0
- package/src/user-client/http/handlers/handler-chain.ts +30 -0
- package/src/user-client/http/handlers/hook-handler.ts +78 -0
- package/src/user-client/http/handlers/request-validation-handler.ts +111 -0
- package/src/user-client/http/handlers/response-validation-handler.ts +203 -0
- package/src/user-client/http/handlers/retry-handler.ts +60 -0
- package/src/user-client/http/handlers/terminating-handler.ts +14 -0
- package/src/user-client/http/hooks/custom-hook.ts +25 -0
- package/src/user-client/http/hooks/hook.ts +41 -0
- package/src/user-client/http/index.ts +11 -0
- package/src/user-client/http/serialization/base-serializer.ts +139 -0
- package/src/user-client/http/serialization/header-serializer.ts +19 -0
- package/src/user-client/http/serialization/path-serializer.ts +12 -0
- package/src/user-client/http/serialization/query-serializer.ts +18 -0
- package/src/user-client/http/transport/request-builder.ts +242 -0
- package/src/user-client/http/transport/request-fetch-adapter.ts +131 -0
- package/src/user-client/http/transport/request.ts +222 -0
- package/src/user-client/http/transport/transport-hook-adapter.ts +91 -0
- package/src/user-client/http/transport/types.ts +50 -0
- package/src/user-client/http/types.ts +74 -0
- package/src/user-client/http/utils/content-type.ts +33 -0
- package/src/user-client/http/utils/line-decoder.ts +35 -0
- package/src/user-client/http/utils/response-matcher.ts +25 -0
- package/src/user-client/index.ts +54 -0
- package/src/user-client/services/base-service.ts +27 -0
- package/src/user-client/services/channels/channels-service.ts +1020 -0
- package/src/user-client/services/channels/index.ts +2 -0
- package/src/user-client/services/channels/models/apns-token-collection.ts +54 -0
- package/src/user-client/services/channels/models/apns-token-installation-id.ts +6 -0
- package/src/user-client/services/channels/models/apns-token-payload-installation-id.ts +6 -0
- package/src/user-client/services/channels/models/apns-token-payload.ts +66 -0
- package/src/user-client/services/channels/models/apns-token.ts +90 -0
- package/src/user-client/services/channels/models/discard-result.ts +51 -0
- package/src/user-client/services/channels/models/expo-token-collection.ts +54 -0
- package/src/user-client/services/channels/models/expo-token-payload.ts +45 -0
- package/src/user-client/services/channels/models/expo-token.ts +69 -0
- package/src/user-client/services/channels/models/fcm-token-collection.ts +54 -0
- package/src/user-client/services/channels/models/fcm-token-installation-id.ts +6 -0
- package/src/user-client/services/channels/models/fcm-token-payload-installation-id.ts +6 -0
- package/src/user-client/services/channels/models/fcm-token-payload.ts +51 -0
- package/src/user-client/services/channels/models/fcm-token.ts +75 -0
- package/src/user-client/services/channels/models/inbox-token-response-collection.ts +59 -0
- package/src/user-client/services/channels/models/inbox-token-response.ts +75 -0
- package/src/user-client/services/channels/models/inbox-token.ts +51 -0
- package/src/user-client/services/channels/models/index.ts +33 -0
- package/src/user-client/services/channels/models/slack-token-collection.ts +54 -0
- package/src/user-client/services/channels/models/slack-token-oauth.ts +57 -0
- package/src/user-client/services/channels/models/slack-token-payload-oauth.ts +57 -0
- package/src/user-client/services/channels/models/slack-token-payload-webhook.ts +45 -0
- package/src/user-client/services/channels/models/slack-token-payload.ts +64 -0
- package/src/user-client/services/channels/models/slack-token-webhook.ts +45 -0
- package/src/user-client/services/channels/models/slack-token.ts +88 -0
- package/src/user-client/services/channels/models/teams-token-collection.ts +54 -0
- package/src/user-client/services/channels/models/teams-token-payload-webhook.ts +45 -0
- package/src/user-client/services/channels/models/teams-token-payload.ts +52 -0
- package/src/user-client/services/channels/models/teams-token-webhook.ts +45 -0
- package/src/user-client/services/channels/models/teams-token.ts +76 -0
- package/src/user-client/services/channels/models/web-push-token-collection.ts +54 -0
- package/src/user-client/services/channels/models/web-push-token-keys.ts +51 -0
- package/src/user-client/services/channels/models/web-push-token-payload-keys.ts +51 -0
- package/src/user-client/services/channels/models/web-push-token.ts +82 -0
- package/src/user-client/services/channels/request-params.ts +41 -0
- package/src/user-client/services/common/index.ts +2 -0
- package/src/user-client/services/common/links.ts +57 -0
- package/src/user-client/services/common/web-push-token-payload.ts +58 -0
- package/src/user-client/services/integrations/index.ts +2 -0
- package/src/user-client/services/integrations/integrations-service.ts +278 -0
- package/src/user-client/services/integrations/models/authed-user.ts +75 -0
- package/src/user-client/services/integrations/models/banner.ts +63 -0
- package/src/user-client/services/integrations/models/default-hover.ts +45 -0
- package/src/user-client/services/integrations/models/default-state.ts +45 -0
- package/src/user-client/services/integrations/models/default_.ts +90 -0
- package/src/user-client/services/integrations/models/dialog.ts +57 -0
- package/src/user-client/services/integrations/models/enterprise.ts +51 -0
- package/src/user-client/services/integrations/models/footer.ts +63 -0
- package/src/user-client/services/integrations/models/header.ts +69 -0
- package/src/user-client/services/integrations/models/icon.ts +51 -0
- package/src/user-client/services/integrations/models/images.ts +45 -0
- package/src/user-client/services/integrations/models/inbox-config-payload.ts +60 -0
- package/src/user-client/services/integrations/models/incoming-webhook.ts +57 -0
- package/src/user-client/services/integrations/models/index.ts +29 -0
- package/src/user-client/services/integrations/models/slack-finish-install-response.ts +57 -0
- package/src/user-client/services/integrations/models/slack-installation.ts +136 -0
- package/src/user-client/services/integrations/models/slack-start-install-response-content.ts +57 -0
- package/src/user-client/services/integrations/models/slack-start-install.ts +63 -0
- package/src/user-client/services/integrations/models/team.ts +51 -0
- package/src/user-client/services/integrations/models/templates-installation.ts +57 -0
- package/src/user-client/services/integrations/models/theme-notification.ts +61 -0
- package/src/user-client/services/integrations/models/theme.ts +94 -0
- package/src/user-client/services/integrations/models/unread-hover.ts +45 -0
- package/src/user-client/services/integrations/models/unread-state.ts +45 -0
- package/src/user-client/services/integrations/models/unread.ts +66 -0
- package/src/user-client/services/integrations/models/unseen-badge.ts +45 -0
- package/src/user-client/services/integrations/models/unseen-hover.ts +45 -0
- package/src/user-client/services/integrations/models/unseen-state.ts +45 -0
- package/src/user-client/services/integrations/models/unseen.ts +66 -0
- package/src/user-client/services/integrations/models/web-push-start-installation-response.ts +51 -0
- package/src/user-client/services/notifications/index.ts +2 -0
- package/src/user-client/services/notifications/models/index.ts +2 -0
- package/src/user-client/services/notifications/models/notification-collection.ts +54 -0
- package/src/user-client/services/notifications/models/notification.ts +129 -0
- package/src/user-client/services/notifications/notifications-service.ts +189 -0
- package/src/user-client/services/notifications/request-params.ts +7 -0
- package/src/user-client.ts +1 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Environment } from './http/environment.js';
|
|
2
|
+
import { SdkConfig } from './http/types.js';
|
|
3
|
+
import { BroadcastsService } from './services/broadcasts/index.js';
|
|
4
|
+
import { ChannelsService } from './services/channels/index.js';
|
|
5
|
+
import { EventsService } from './services/events/index.js';
|
|
6
|
+
import { IntegrationsService } from './services/integrations/index.js';
|
|
7
|
+
import { JwtService } from './services/jwt/index.js';
|
|
8
|
+
import { NotificationsService } from './services/notifications/index.js';
|
|
9
|
+
import { UsersService } from './services/users/index.js';
|
|
10
|
+
|
|
11
|
+
export { Environment } from './http/environment.js';
|
|
12
|
+
export * from './http/index.js';
|
|
13
|
+
export * from './services/broadcasts/index.js';
|
|
14
|
+
export * from './services/channels/index.js';
|
|
15
|
+
export * from './services/common/index.js';
|
|
16
|
+
export * from './services/events/index.js';
|
|
17
|
+
export * from './services/integrations/index.js';
|
|
18
|
+
export * from './services/jwt/index.js';
|
|
19
|
+
export * from './services/notifications/index.js';
|
|
20
|
+
export * from './services/users/index.js';
|
|
21
|
+
|
|
22
|
+
export class Client {
|
|
23
|
+
public readonly broadcasts: BroadcastsService;
|
|
24
|
+
|
|
25
|
+
public readonly channels: ChannelsService;
|
|
26
|
+
|
|
27
|
+
public readonly events: EventsService;
|
|
28
|
+
|
|
29
|
+
public readonly integrations: IntegrationsService;
|
|
30
|
+
|
|
31
|
+
public readonly jwt: JwtService;
|
|
32
|
+
|
|
33
|
+
public readonly notifications: NotificationsService;
|
|
34
|
+
|
|
35
|
+
public readonly users: UsersService;
|
|
36
|
+
|
|
37
|
+
constructor(public config: SdkConfig) {
|
|
38
|
+
this.broadcasts = new BroadcastsService(this.config);
|
|
39
|
+
|
|
40
|
+
this.channels = new ChannelsService(this.config);
|
|
41
|
+
|
|
42
|
+
this.events = new EventsService(this.config);
|
|
43
|
+
|
|
44
|
+
this.integrations = new IntegrationsService(this.config);
|
|
45
|
+
|
|
46
|
+
this.jwt = new JwtService(this.config);
|
|
47
|
+
|
|
48
|
+
this.notifications = new NotificationsService(this.config);
|
|
49
|
+
|
|
50
|
+
this.users = new UsersService(this.config);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
set baseUrl(baseUrl: string) {
|
|
54
|
+
this.broadcasts.baseUrl = baseUrl;
|
|
55
|
+
this.channels.baseUrl = baseUrl;
|
|
56
|
+
this.events.baseUrl = baseUrl;
|
|
57
|
+
this.integrations.baseUrl = baseUrl;
|
|
58
|
+
this.jwt.baseUrl = baseUrl;
|
|
59
|
+
this.notifications.baseUrl = baseUrl;
|
|
60
|
+
this.users.baseUrl = baseUrl;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
set environment(environment: Environment) {
|
|
64
|
+
this.broadcasts.baseUrl = environment;
|
|
65
|
+
this.channels.baseUrl = environment;
|
|
66
|
+
this.events.baseUrl = environment;
|
|
67
|
+
this.integrations.baseUrl = environment;
|
|
68
|
+
this.jwt.baseUrl = environment;
|
|
69
|
+
this.notifications.baseUrl = environment;
|
|
70
|
+
this.users.baseUrl = environment;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
set timeoutMs(timeoutMs: number) {
|
|
74
|
+
this.broadcasts.timeoutMs = timeoutMs;
|
|
75
|
+
this.channels.timeoutMs = timeoutMs;
|
|
76
|
+
this.events.timeoutMs = timeoutMs;
|
|
77
|
+
this.integrations.timeoutMs = timeoutMs;
|
|
78
|
+
this.jwt.timeoutMs = timeoutMs;
|
|
79
|
+
this.notifications.timeoutMs = timeoutMs;
|
|
80
|
+
this.users.timeoutMs = timeoutMs;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
set token(token: string) {
|
|
84
|
+
this.broadcasts.token = token;
|
|
85
|
+
this.channels.token = token;
|
|
86
|
+
this.events.token = token;
|
|
87
|
+
this.integrations.token = token;
|
|
88
|
+
this.jwt.token = token;
|
|
89
|
+
this.notifications.token = token;
|
|
90
|
+
this.users.token = token;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// c029837e0e474b76bc487506e8799df5e3335891efe4fb02bda7a1441840310c
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { HttpClient } from '../http/client.js';
|
|
2
|
+
import { Environment } from '../http/environment.js';
|
|
3
|
+
import { SdkConfig } from '../http/types.js';
|
|
4
|
+
|
|
5
|
+
export class BaseService {
|
|
6
|
+
public client: HttpClient;
|
|
7
|
+
|
|
8
|
+
constructor(public config: SdkConfig) {
|
|
9
|
+
this.client = new HttpClient(this.config);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
set baseUrl(baseUrl: string) {
|
|
13
|
+
this.config.baseUrl = baseUrl;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
set environment(environment: Environment) {
|
|
17
|
+
this.config.environment = environment;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
set timeoutMs(timeoutMs: number) {
|
|
21
|
+
this.config.timeoutMs = timeoutMs;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
set token(token: string) {
|
|
25
|
+
this.config.token = token;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
import { Environment } from '../../http/environment.js';
|
|
4
|
+
import { SerializationStyle } from '../../http/serialization/base-serializer.js';
|
|
5
|
+
import { RequestBuilder } from '../../http/transport/request-builder.js';
|
|
6
|
+
import { ContentType, HttpResponse, RequestConfig } from '../../http/types.js';
|
|
7
|
+
import { BaseService } from '../base-service.js';
|
|
8
|
+
import { Broadcast, broadcastRequest, broadcastResponse } from './models/broadcast.js';
|
|
9
|
+
import { BroadcastCollection, broadcastCollectionResponse } from './models/broadcast-collection.js';
|
|
10
|
+
import { ListBroadcastsParams } from './request-params.js';
|
|
11
|
+
|
|
12
|
+
export class BroadcastsService extends BaseService {
|
|
13
|
+
/**
|
|
14
|
+
* Retrieves a paginated list of broadcasts for the project. Returns basic information about each broadcast including its creation time and status.
|
|
15
|
+
* @param {number} [params.limit] -
|
|
16
|
+
* @param {string} [params.startingAfter] -
|
|
17
|
+
* @param {string} [params.endingBefore] -
|
|
18
|
+
* @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
|
|
19
|
+
* @returns {Promise<HttpResponse<BroadcastCollection>>} OK
|
|
20
|
+
*/
|
|
21
|
+
async listBroadcasts(
|
|
22
|
+
params?: ListBroadcastsParams,
|
|
23
|
+
requestConfig?: RequestConfig,
|
|
24
|
+
): Promise<HttpResponse<BroadcastCollection>> {
|
|
25
|
+
const request = new RequestBuilder()
|
|
26
|
+
.setBaseUrl(requestConfig?.baseUrl || this.config.baseUrl || this.config.environment || Environment.DEFAULT)
|
|
27
|
+
.setConfig(this.config)
|
|
28
|
+
.setMethod('GET')
|
|
29
|
+
.setPath('/broadcasts')
|
|
30
|
+
.setRequestSchema(z.any())
|
|
31
|
+
.addAccessTokenAuth(this.config.token, 'Bearer')
|
|
32
|
+
.setRequestContentType(ContentType.Json)
|
|
33
|
+
.addResponse({
|
|
34
|
+
schema: broadcastCollectionResponse,
|
|
35
|
+
contentType: ContentType.Json,
|
|
36
|
+
status: 200,
|
|
37
|
+
})
|
|
38
|
+
.setRetryAttempts(this.config, requestConfig)
|
|
39
|
+
.setRetryDelayMs(this.config, requestConfig)
|
|
40
|
+
.setResponseValidation(this.config, requestConfig)
|
|
41
|
+
.addQueryParam({
|
|
42
|
+
key: 'limit',
|
|
43
|
+
value: params?.limit,
|
|
44
|
+
})
|
|
45
|
+
.addQueryParam({
|
|
46
|
+
key: 'starting_after',
|
|
47
|
+
value: params?.startingAfter,
|
|
48
|
+
})
|
|
49
|
+
.addQueryParam({
|
|
50
|
+
key: 'ending_before',
|
|
51
|
+
value: params?.endingBefore,
|
|
52
|
+
})
|
|
53
|
+
.build();
|
|
54
|
+
return this.client.call<BroadcastCollection>(request);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Creates a new broadcast message. When a broadcast is created, it generates individual notifications for relevant users within the project.
|
|
59
|
+
* @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
|
|
60
|
+
* @returns {Promise<HttpResponse<Broadcast>>} Created
|
|
61
|
+
*/
|
|
62
|
+
async createBroadcast(body: Broadcast, requestConfig?: RequestConfig): Promise<HttpResponse<Broadcast>> {
|
|
63
|
+
const request = new RequestBuilder()
|
|
64
|
+
.setBaseUrl(requestConfig?.baseUrl || this.config.baseUrl || this.config.environment || Environment.DEFAULT)
|
|
65
|
+
.setConfig(this.config)
|
|
66
|
+
.setMethod('POST')
|
|
67
|
+
.setPath('/broadcasts')
|
|
68
|
+
.setRequestSchema(broadcastRequest)
|
|
69
|
+
.addAccessTokenAuth(this.config.token, 'Bearer')
|
|
70
|
+
.setRequestContentType(ContentType.Json)
|
|
71
|
+
.addResponse({
|
|
72
|
+
schema: broadcastResponse,
|
|
73
|
+
contentType: ContentType.Json,
|
|
74
|
+
status: 201,
|
|
75
|
+
})
|
|
76
|
+
.setRetryAttempts(this.config, requestConfig)
|
|
77
|
+
.setRetryDelayMs(this.config, requestConfig)
|
|
78
|
+
.setResponseValidation(this.config, requestConfig)
|
|
79
|
+
.addHeaderParam({ key: 'Content-Type', value: 'application/json' })
|
|
80
|
+
.addBody(body)
|
|
81
|
+
.build();
|
|
82
|
+
return this.client.call<Broadcast>(request);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Retrieves detailed information about a specific broadcast by its ID. Includes the broadcast's configuration and current status.
|
|
87
|
+
* @param {string} broadcastId -
|
|
88
|
+
* @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
|
|
89
|
+
* @returns {Promise<HttpResponse<Broadcast>>} OK
|
|
90
|
+
*/
|
|
91
|
+
async fetchBroadcast(broadcastId: string, requestConfig?: RequestConfig): Promise<HttpResponse<Broadcast>> {
|
|
92
|
+
const request = new RequestBuilder()
|
|
93
|
+
.setBaseUrl(requestConfig?.baseUrl || this.config.baseUrl || this.config.environment || Environment.DEFAULT)
|
|
94
|
+
.setConfig(this.config)
|
|
95
|
+
.setMethod('GET')
|
|
96
|
+
.setPath('/broadcasts/{broadcast_id}')
|
|
97
|
+
.setRequestSchema(z.any())
|
|
98
|
+
.addAccessTokenAuth(this.config.token, 'Bearer')
|
|
99
|
+
.setRequestContentType(ContentType.Json)
|
|
100
|
+
.addResponse({
|
|
101
|
+
schema: broadcastResponse,
|
|
102
|
+
contentType: ContentType.Json,
|
|
103
|
+
status: 200,
|
|
104
|
+
})
|
|
105
|
+
.setRetryAttempts(this.config, requestConfig)
|
|
106
|
+
.setRetryDelayMs(this.config, requestConfig)
|
|
107
|
+
.setResponseValidation(this.config, requestConfig)
|
|
108
|
+
.addPathParam({
|
|
109
|
+
key: 'broadcast_id',
|
|
110
|
+
value: broadcastId,
|
|
111
|
+
})
|
|
112
|
+
.build();
|
|
113
|
+
return this.client.call<Broadcast>(request);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
import { Links, links, linksRequest, linksResponse } from '../../common/links.js';
|
|
4
|
+
import { Broadcast, broadcast, broadcastRequest, broadcastResponse } from './broadcast.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The shape of the model inside the application code - what the users use
|
|
8
|
+
*/
|
|
9
|
+
export const broadcastCollection = z.lazy(() => {
|
|
10
|
+
return z.object({
|
|
11
|
+
data: z.array(broadcast).optional(),
|
|
12
|
+
links: links.optional(),
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @typedef {BroadcastCollection} broadcastCollection
|
|
19
|
+
* @property {Broadcast[]}
|
|
20
|
+
* @property {Links}
|
|
21
|
+
*/
|
|
22
|
+
export type BroadcastCollection = z.infer<typeof broadcastCollection>;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The shape of the model mapping from the api schema into the application shape.
|
|
26
|
+
* Is equal to application shape if all property names match the api schema
|
|
27
|
+
*/
|
|
28
|
+
export const broadcastCollectionResponse = z.lazy(() => {
|
|
29
|
+
return z
|
|
30
|
+
.object({
|
|
31
|
+
data: z.array(broadcastResponse).optional(),
|
|
32
|
+
links: linksResponse.optional(),
|
|
33
|
+
})
|
|
34
|
+
.transform((data) => ({
|
|
35
|
+
data: data['data'],
|
|
36
|
+
links: data['links'],
|
|
37
|
+
}));
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The shape of the model mapping from the application shape into the api schema.
|
|
42
|
+
* Is equal to application shape if all property names match the api schema
|
|
43
|
+
*/
|
|
44
|
+
export const broadcastCollectionRequest = z.lazy(() => {
|
|
45
|
+
return z
|
|
46
|
+
.object({
|
|
47
|
+
data: z.array(broadcastRequest).optional(),
|
|
48
|
+
links: linksRequest.optional(),
|
|
49
|
+
})
|
|
50
|
+
.transform((data) => ({
|
|
51
|
+
data: data['data'],
|
|
52
|
+
links: data['links'],
|
|
53
|
+
}));
|
|
54
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
import { Errors, errors, errorsRequest, errorsResponse } from './errors.js';
|
|
4
|
+
import { Summary, summary, summaryRequest, summaryResponse } from './summary.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The shape of the model inside the application code - what the users use
|
|
8
|
+
*/
|
|
9
|
+
export const broadcastStatus = z.lazy(() => {
|
|
10
|
+
return z.object({
|
|
11
|
+
errors: z.array(errors).nullable(),
|
|
12
|
+
status: z.string(),
|
|
13
|
+
summary: summary,
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @typedef {BroadcastStatus} broadcastStatus
|
|
20
|
+
* @property {Errors[]}
|
|
21
|
+
* @property {StatusStatus}
|
|
22
|
+
* @property {Summary}
|
|
23
|
+
*/
|
|
24
|
+
export type BroadcastStatus = z.infer<typeof broadcastStatus>;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The shape of the model mapping from the api schema into the application shape.
|
|
28
|
+
* Is equal to application shape if all property names match the api schema
|
|
29
|
+
*/
|
|
30
|
+
export const broadcastStatusResponse = z.lazy(() => {
|
|
31
|
+
return z
|
|
32
|
+
.object({
|
|
33
|
+
errors: z.array(errorsResponse).nullable(),
|
|
34
|
+
status: z.string(),
|
|
35
|
+
summary: summaryResponse,
|
|
36
|
+
})
|
|
37
|
+
.transform((data) => ({
|
|
38
|
+
errors: data['errors'],
|
|
39
|
+
status: data['status'],
|
|
40
|
+
summary: data['summary'],
|
|
41
|
+
}));
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The shape of the model mapping from the application shape into the api schema.
|
|
46
|
+
* Is equal to application shape if all property names match the api schema
|
|
47
|
+
*/
|
|
48
|
+
export const broadcastStatusRequest = z.lazy(() => {
|
|
49
|
+
return z
|
|
50
|
+
.object({
|
|
51
|
+
errors: z.array(errorsRequest).nullable(),
|
|
52
|
+
status: z.string(),
|
|
53
|
+
summary: summaryRequest,
|
|
54
|
+
})
|
|
55
|
+
.transform((data) => ({
|
|
56
|
+
errors: data['errors'],
|
|
57
|
+
status: data['status'],
|
|
58
|
+
summary: data['summary'],
|
|
59
|
+
}));
|
|
60
|
+
});
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
BroadcastStatus,
|
|
5
|
+
broadcastStatus,
|
|
6
|
+
broadcastStatusRequest,
|
|
7
|
+
broadcastStatusResponse,
|
|
8
|
+
} from './broadcast-status.js';
|
|
9
|
+
import { Overrides, overrides, overridesRequest, overridesResponse } from './overrides.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The shape of the model inside the application code - what the users use
|
|
13
|
+
*/
|
|
14
|
+
export const broadcast = z.lazy(() => {
|
|
15
|
+
return z.object({
|
|
16
|
+
actionUrl: z.string().max(2048).optional().nullable(),
|
|
17
|
+
category: z
|
|
18
|
+
.string()
|
|
19
|
+
.max(255)
|
|
20
|
+
.regex(/^[A-Za-z0-9_\.\-\/:]+$/)
|
|
21
|
+
.optional()
|
|
22
|
+
.nullable(),
|
|
23
|
+
content: z.string().max(10485760).optional().nullable(),
|
|
24
|
+
createdAt: z.string().optional(),
|
|
25
|
+
customAttributes: z.any().optional().nullable(),
|
|
26
|
+
id: z.string().optional(),
|
|
27
|
+
overrides: overrides.optional().nullable(),
|
|
28
|
+
recipients: z.array(z.any()).min(1).max(1000).nullable(),
|
|
29
|
+
status: broadcastStatus.optional().nullable(),
|
|
30
|
+
title: z.string().min(1).max(255),
|
|
31
|
+
topic: z
|
|
32
|
+
.string()
|
|
33
|
+
.max(255)
|
|
34
|
+
.regex(/^[A-Za-z0-9_\.\-\/:]+$/)
|
|
35
|
+
.optional()
|
|
36
|
+
.nullable(),
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* @typedef {Broadcast} broadcast
|
|
43
|
+
* @property {string}
|
|
44
|
+
* @property {string}
|
|
45
|
+
* @property {string}
|
|
46
|
+
* @property {string} - The timestamp when the broadcast was created.
|
|
47
|
+
* @property {any}
|
|
48
|
+
* @property {string} - The unique id for this broadcast.
|
|
49
|
+
* @property {Overrides}
|
|
50
|
+
* @property {any[]}
|
|
51
|
+
* @property {BroadcastStatus}
|
|
52
|
+
* @property {string}
|
|
53
|
+
* @property {string}
|
|
54
|
+
*/
|
|
55
|
+
export type Broadcast = z.infer<typeof broadcast>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The shape of the model mapping from the api schema into the application shape.
|
|
59
|
+
* Is equal to application shape if all property names match the api schema
|
|
60
|
+
*/
|
|
61
|
+
export const broadcastResponse = z.lazy(() => {
|
|
62
|
+
return z
|
|
63
|
+
.object({
|
|
64
|
+
action_url: z.string().max(2048).optional().nullable(),
|
|
65
|
+
category: z
|
|
66
|
+
.string()
|
|
67
|
+
.max(255)
|
|
68
|
+
.regex(/^[A-Za-z0-9_\.\-\/:]+$/)
|
|
69
|
+
.optional()
|
|
70
|
+
.nullable(),
|
|
71
|
+
content: z.string().max(10485760).optional().nullable(),
|
|
72
|
+
created_at: z.string().optional(),
|
|
73
|
+
custom_attributes: z.any().optional().nullable(),
|
|
74
|
+
id: z.string().optional(),
|
|
75
|
+
overrides: overridesResponse.optional().nullable(),
|
|
76
|
+
recipients: z.array(z.any()).min(1).max(1000).nullable(),
|
|
77
|
+
status: broadcastStatusResponse.optional().nullable(),
|
|
78
|
+
title: z.string().min(1).max(255),
|
|
79
|
+
topic: z
|
|
80
|
+
.string()
|
|
81
|
+
.max(255)
|
|
82
|
+
.regex(/^[A-Za-z0-9_\.\-\/:]+$/)
|
|
83
|
+
.optional()
|
|
84
|
+
.nullable(),
|
|
85
|
+
})
|
|
86
|
+
.transform((data) => ({
|
|
87
|
+
actionUrl: data['action_url'],
|
|
88
|
+
category: data['category'],
|
|
89
|
+
content: data['content'],
|
|
90
|
+
createdAt: data['created_at'],
|
|
91
|
+
customAttributes: data['custom_attributes'],
|
|
92
|
+
id: data['id'],
|
|
93
|
+
overrides: data['overrides'],
|
|
94
|
+
recipients: data['recipients'],
|
|
95
|
+
status: data['status'],
|
|
96
|
+
title: data['title'],
|
|
97
|
+
topic: data['topic'],
|
|
98
|
+
}));
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* The shape of the model mapping from the application shape into the api schema.
|
|
103
|
+
* Is equal to application shape if all property names match the api schema
|
|
104
|
+
*/
|
|
105
|
+
export const broadcastRequest = z.lazy(() => {
|
|
106
|
+
return z
|
|
107
|
+
.object({
|
|
108
|
+
actionUrl: z.string().max(2048).optional().nullable(),
|
|
109
|
+
category: z
|
|
110
|
+
.string()
|
|
111
|
+
.max(255)
|
|
112
|
+
.regex(/^[A-Za-z0-9_\.\-\/:]+$/)
|
|
113
|
+
.optional()
|
|
114
|
+
.nullable(),
|
|
115
|
+
content: z.string().max(10485760).optional().nullable(),
|
|
116
|
+
createdAt: z.string().optional(),
|
|
117
|
+
customAttributes: z.any().optional().nullable(),
|
|
118
|
+
id: z.string().optional(),
|
|
119
|
+
overrides: overridesRequest.optional().nullable(),
|
|
120
|
+
recipients: z.array(z.any()).min(1).max(1000).nullable(),
|
|
121
|
+
status: broadcastStatusRequest.optional().nullable(),
|
|
122
|
+
title: z.string().min(1).max(255),
|
|
123
|
+
topic: z
|
|
124
|
+
.string()
|
|
125
|
+
.max(255)
|
|
126
|
+
.regex(/^[A-Za-z0-9_\.\-\/:]+$/)
|
|
127
|
+
.optional()
|
|
128
|
+
.nullable(),
|
|
129
|
+
})
|
|
130
|
+
.transform((data) => ({
|
|
131
|
+
action_url: data['actionUrl'],
|
|
132
|
+
category: data['category'],
|
|
133
|
+
content: data['content'],
|
|
134
|
+
created_at: data['createdAt'],
|
|
135
|
+
custom_attributes: data['customAttributes'],
|
|
136
|
+
id: data['id'],
|
|
137
|
+
overrides: data['overrides'],
|
|
138
|
+
recipients: data['recipients'],
|
|
139
|
+
status: data['status'],
|
|
140
|
+
title: data['title'],
|
|
141
|
+
topic: data['topic'],
|
|
142
|
+
}));
|
|
143
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The shape of the model inside the application code - what the users use
|
|
5
|
+
*/
|
|
6
|
+
export const email = z.lazy(() => {
|
|
7
|
+
return z.object({
|
|
8
|
+
actionUrl: z.string().max(2048).optional().nullable(),
|
|
9
|
+
content: z.string().max(1048576).optional(),
|
|
10
|
+
title: z.string().min(1).max(255).optional(),
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @typedef {Email} email
|
|
17
|
+
* @property {string}
|
|
18
|
+
* @property {string}
|
|
19
|
+
* @property {string}
|
|
20
|
+
*/
|
|
21
|
+
export type Email = z.infer<typeof email>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The shape of the model mapping from the api schema into the application shape.
|
|
25
|
+
* Is equal to application shape if all property names match the api schema
|
|
26
|
+
*/
|
|
27
|
+
export const emailResponse = z.lazy(() => {
|
|
28
|
+
return z
|
|
29
|
+
.object({
|
|
30
|
+
action_url: z.string().max(2048).optional().nullable(),
|
|
31
|
+
content: z.string().max(1048576).optional(),
|
|
32
|
+
title: z.string().min(1).max(255).optional(),
|
|
33
|
+
})
|
|
34
|
+
.transform((data) => ({
|
|
35
|
+
actionUrl: data['action_url'],
|
|
36
|
+
content: data['content'],
|
|
37
|
+
title: data['title'],
|
|
38
|
+
}));
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The shape of the model mapping from the application shape into the api schema.
|
|
43
|
+
* Is equal to application shape if all property names match the api schema
|
|
44
|
+
*/
|
|
45
|
+
export const emailRequest = z.lazy(() => {
|
|
46
|
+
return z
|
|
47
|
+
.object({
|
|
48
|
+
actionUrl: z.string().max(2048).optional().nullable(),
|
|
49
|
+
content: z.string().max(1048576).optional(),
|
|
50
|
+
title: z.string().min(1).max(255).optional(),
|
|
51
|
+
})
|
|
52
|
+
.transform((data) => ({
|
|
53
|
+
action_url: data['actionUrl'],
|
|
54
|
+
content: data['content'],
|
|
55
|
+
title: data['title'],
|
|
56
|
+
}));
|
|
57
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The shape of the model inside the application code - what the users use
|
|
5
|
+
*/
|
|
6
|
+
export const errors = z.lazy(() => {
|
|
7
|
+
return z.object({
|
|
8
|
+
message: z.string().optional(),
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @typedef {Errors} errors
|
|
15
|
+
* @property {string}
|
|
16
|
+
*/
|
|
17
|
+
export type Errors = z.infer<typeof errors>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The shape of the model mapping from the api schema into the application shape.
|
|
21
|
+
* Is equal to application shape if all property names match the api schema
|
|
22
|
+
*/
|
|
23
|
+
export const errorsResponse = z.lazy(() => {
|
|
24
|
+
return z
|
|
25
|
+
.object({
|
|
26
|
+
message: z.string().optional(),
|
|
27
|
+
})
|
|
28
|
+
.transform((data) => ({
|
|
29
|
+
message: data['message'],
|
|
30
|
+
}));
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The shape of the model mapping from the application shape into the api schema.
|
|
35
|
+
* Is equal to application shape if all property names match the api schema
|
|
36
|
+
*/
|
|
37
|
+
export const errorsRequest = z.lazy(() => {
|
|
38
|
+
return z
|
|
39
|
+
.object({
|
|
40
|
+
message: z.string().optional(),
|
|
41
|
+
})
|
|
42
|
+
.transform((data) => ({
|
|
43
|
+
message: data['message'],
|
|
44
|
+
}));
|
|
45
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The shape of the model inside the application code - what the users use
|
|
5
|
+
*/
|
|
6
|
+
export const inApp = z.lazy(() => {
|
|
7
|
+
return z.object({
|
|
8
|
+
actionUrl: z.string().max(2048).optional().nullable(),
|
|
9
|
+
content: z.string().max(1048576).optional(),
|
|
10
|
+
title: z.string().min(1).max(255).optional(),
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @typedef {InApp} inApp
|
|
17
|
+
* @property {string}
|
|
18
|
+
* @property {string}
|
|
19
|
+
* @property {string}
|
|
20
|
+
*/
|
|
21
|
+
export type InApp = z.infer<typeof inApp>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The shape of the model mapping from the api schema into the application shape.
|
|
25
|
+
* Is equal to application shape if all property names match the api schema
|
|
26
|
+
*/
|
|
27
|
+
export const inAppResponse = z.lazy(() => {
|
|
28
|
+
return z
|
|
29
|
+
.object({
|
|
30
|
+
action_url: z.string().max(2048).optional().nullable(),
|
|
31
|
+
content: z.string().max(1048576).optional(),
|
|
32
|
+
title: z.string().min(1).max(255).optional(),
|
|
33
|
+
})
|
|
34
|
+
.transform((data) => ({
|
|
35
|
+
actionUrl: data['action_url'],
|
|
36
|
+
content: data['content'],
|
|
37
|
+
title: data['title'],
|
|
38
|
+
}));
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The shape of the model mapping from the application shape into the api schema.
|
|
43
|
+
* Is equal to application shape if all property names match the api schema
|
|
44
|
+
*/
|
|
45
|
+
export const inAppRequest = z.lazy(() => {
|
|
46
|
+
return z
|
|
47
|
+
.object({
|
|
48
|
+
actionUrl: z.string().max(2048).optional().nullable(),
|
|
49
|
+
content: z.string().max(1048576).optional(),
|
|
50
|
+
title: z.string().min(1).max(255).optional(),
|
|
51
|
+
})
|
|
52
|
+
.transform((data) => ({
|
|
53
|
+
action_url: data['actionUrl'],
|
|
54
|
+
content: data['content'],
|
|
55
|
+
title: data['title'],
|
|
56
|
+
}));
|
|
57
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type { Broadcast } from './broadcast.js';
|
|
2
|
+
export type { BroadcastCollection } from './broadcast-collection.js';
|
|
3
|
+
export type { BroadcastStatus } from './broadcast-status.js';
|
|
4
|
+
export type { Email } from './email.js';
|
|
5
|
+
export type { Errors } from './errors.js';
|
|
6
|
+
export type { InApp } from './in-app.js';
|
|
7
|
+
export type { MobilePush } from './mobile-push.js';
|
|
8
|
+
export type { Overrides } from './overrides.js';
|
|
9
|
+
export type { OverridesChannels } from './overrides-channels.js';
|
|
10
|
+
export type { Providers } from './providers.js';
|
|
11
|
+
export type { Slack } from './slack.js';
|
|
12
|
+
export type { Sms } from './sms.js';
|
|
13
|
+
export { StatusStatus } from './status-status.js';
|
|
14
|
+
export type { Summary } from './summary.js';
|
|
15
|
+
export type { WebPush } from './web-push.js';
|