magicbell-js 0.0.3 → 0.1.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/README.md +2 -3
- package/dist/commonjs/project-client/http/errors/throwable-error.d.ts +7 -0
- package/dist/commonjs/project-client/http/errors/throwable-error.d.ts.map +1 -0
- package/dist/commonjs/project-client/http/errors/throwable-error.js +25 -0
- package/dist/commonjs/project-client/http/errors/throwable-error.js.map +1 -0
- package/dist/commonjs/project-client/http/handlers/hook-handler.d.ts.map +1 -1
- package/dist/commonjs/project-client/http/handlers/hook-handler.js +2 -2
- package/dist/commonjs/project-client/http/handlers/hook-handler.js.map +1 -1
- package/dist/commonjs/project-client/http/transport/types.d.ts +2 -1
- package/dist/commonjs/project-client/http/transport/types.d.ts.map +1 -1
- package/dist/commonjs/project-client/services/broadcasts/broadcasts-service.d.ts.map +1 -1
- package/dist/commonjs/project-client/services/broadcasts/broadcasts-service.js.map +1 -1
- package/dist/commonjs/project-client/services/channels/channels-service.d.ts.map +1 -1
- package/dist/commonjs/project-client/services/channels/channels-service.js.map +1 -1
- package/dist/commonjs/project-client/services/events/events-service.d.ts.map +1 -1
- package/dist/commonjs/project-client/services/events/events-service.js.map +1 -1
- package/dist/commonjs/project-client/services/integrations/integrations-service.d.ts.map +1 -1
- package/dist/commonjs/project-client/services/integrations/integrations-service.js.map +1 -1
- package/dist/commonjs/project-client/services/jwt/jwt-service.d.ts +1 -25
- package/dist/commonjs/project-client/services/jwt/jwt-service.d.ts.map +1 -1
- package/dist/commonjs/project-client/services/jwt/jwt-service.js +0 -103
- package/dist/commonjs/project-client/services/jwt/jwt-service.js.map +1 -1
- package/dist/commonjs/project-client/services/jwt/models/index.d.ts +0 -1
- package/dist/commonjs/project-client/services/jwt/models/index.d.ts.map +1 -1
- package/dist/commonjs/project-client/services/jwt/request-params.d.ts +0 -5
- package/dist/commonjs/project-client/services/jwt/request-params.d.ts.map +1 -1
- package/dist/commonjs/project-client/services/notifications/notifications-service.d.ts.map +1 -1
- package/dist/commonjs/project-client/services/notifications/notifications-service.js.map +1 -1
- package/dist/commonjs/project-client/services/users/users-service.d.ts.map +1 -1
- package/dist/commonjs/project-client/services/users/users-service.js.map +1 -1
- package/dist/commonjs/user-client/http/errors/throwable-error.d.ts +7 -0
- package/dist/commonjs/user-client/http/errors/throwable-error.d.ts.map +1 -0
- package/dist/commonjs/user-client/http/errors/throwable-error.js +25 -0
- package/dist/commonjs/user-client/http/errors/throwable-error.js.map +1 -0
- package/dist/commonjs/user-client/http/handlers/hook-handler.d.ts.map +1 -1
- package/dist/commonjs/user-client/http/handlers/hook-handler.js +2 -2
- package/dist/commonjs/user-client/http/handlers/hook-handler.js.map +1 -1
- package/dist/commonjs/user-client/http/transport/types.d.ts +2 -1
- package/dist/commonjs/user-client/http/transport/types.d.ts.map +1 -1
- package/dist/commonjs/user-client/services/channels/channels-service.d.ts.map +1 -1
- package/dist/commonjs/user-client/services/channels/channels-service.js.map +1 -1
- package/dist/commonjs/user-client/services/integrations/integrations-service.d.ts.map +1 -1
- package/dist/commonjs/user-client/services/integrations/integrations-service.js.map +1 -1
- package/dist/commonjs/user-client/services/notifications/notifications-service.d.ts +26 -1
- package/dist/commonjs/user-client/services/notifications/notifications-service.d.ts.map +1 -1
- package/dist/commonjs/user-client/services/notifications/notifications-service.js +106 -0
- package/dist/commonjs/user-client/services/notifications/notifications-service.js.map +1 -1
- package/dist/commonjs/user-client/services/notifications/request-params.d.ts +9 -0
- package/dist/commonjs/user-client/services/notifications/request-params.d.ts.map +1 -1
- package/dist/esm/project-client/http/errors/throwable-error.d.ts +7 -0
- package/dist/esm/project-client/http/errors/throwable-error.d.ts.map +1 -0
- package/dist/esm/project-client/http/errors/throwable-error.js +21 -0
- package/dist/esm/project-client/http/errors/throwable-error.js.map +1 -0
- package/dist/esm/project-client/http/handlers/hook-handler.d.ts.map +1 -1
- package/dist/esm/project-client/http/handlers/hook-handler.js +2 -2
- package/dist/esm/project-client/http/handlers/hook-handler.js.map +1 -1
- package/dist/esm/project-client/http/transport/types.d.ts +2 -1
- package/dist/esm/project-client/http/transport/types.d.ts.map +1 -1
- package/dist/esm/project-client/services/broadcasts/broadcasts-service.d.ts.map +1 -1
- package/dist/esm/project-client/services/broadcasts/broadcasts-service.js.map +1 -1
- package/dist/esm/project-client/services/channels/channels-service.d.ts.map +1 -1
- package/dist/esm/project-client/services/channels/channels-service.js.map +1 -1
- package/dist/esm/project-client/services/events/events-service.d.ts.map +1 -1
- package/dist/esm/project-client/services/events/events-service.js.map +1 -1
- package/dist/esm/project-client/services/integrations/integrations-service.d.ts.map +1 -1
- package/dist/esm/project-client/services/integrations/integrations-service.js.map +1 -1
- package/dist/esm/project-client/services/jwt/jwt-service.d.ts +1 -25
- package/dist/esm/project-client/services/jwt/jwt-service.d.ts.map +1 -1
- package/dist/esm/project-client/services/jwt/jwt-service.js +0 -103
- package/dist/esm/project-client/services/jwt/jwt-service.js.map +1 -1
- package/dist/esm/project-client/services/jwt/models/index.d.ts +0 -1
- package/dist/esm/project-client/services/jwt/models/index.d.ts.map +1 -1
- package/dist/esm/project-client/services/jwt/request-params.d.ts +0 -5
- package/dist/esm/project-client/services/jwt/request-params.d.ts.map +1 -1
- package/dist/esm/project-client/services/notifications/notifications-service.d.ts.map +1 -1
- package/dist/esm/project-client/services/notifications/notifications-service.js.map +1 -1
- package/dist/esm/project-client/services/users/users-service.d.ts.map +1 -1
- package/dist/esm/project-client/services/users/users-service.js.map +1 -1
- package/dist/esm/user-client/http/errors/throwable-error.d.ts +7 -0
- package/dist/esm/user-client/http/errors/throwable-error.d.ts.map +1 -0
- package/dist/esm/user-client/http/errors/throwable-error.js +21 -0
- package/dist/esm/user-client/http/errors/throwable-error.js.map +1 -0
- package/dist/esm/user-client/http/handlers/hook-handler.d.ts.map +1 -1
- package/dist/esm/user-client/http/handlers/hook-handler.js +2 -2
- package/dist/esm/user-client/http/handlers/hook-handler.js.map +1 -1
- package/dist/esm/user-client/http/transport/types.d.ts +2 -1
- package/dist/esm/user-client/http/transport/types.d.ts.map +1 -1
- package/dist/esm/user-client/services/channels/channels-service.d.ts.map +1 -1
- package/dist/esm/user-client/services/channels/channels-service.js.map +1 -1
- package/dist/esm/user-client/services/integrations/integrations-service.d.ts.map +1 -1
- package/dist/esm/user-client/services/integrations/integrations-service.js.map +1 -1
- package/dist/esm/user-client/services/notifications/notifications-service.d.ts +26 -1
- package/dist/esm/user-client/services/notifications/notifications-service.d.ts.map +1 -1
- package/dist/esm/user-client/services/notifications/notifications-service.js +106 -0
- package/dist/esm/user-client/services/notifications/notifications-service.js.map +1 -1
- package/dist/esm/user-client/services/notifications/request-params.d.ts +9 -0
- package/dist/esm/user-client/services/notifications/request-params.d.ts.map +1 -1
- package/package.json +3 -1
- 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/throwable-error.ts +9 -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 +80 -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 +51 -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 +116 -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 +1018 -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 +85 -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 +1966 -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 +121 -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/discard-token-response.ts +51 -0
- package/src/project-client/services/jwt/models/index.ts +5 -0
- package/src/project-client/services/jwt/request-params.ts +5 -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 +45 -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 +118 -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/throwable-error.ts +9 -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 +80 -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 +51 -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 +1021 -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 +279 -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 +305 -0
- package/src/user-client/services/notifications/request-params.ts +18 -0
- package/src/user-client.ts +1 -0
- package/dist/commonjs/project-client/services/jwt/models/create-user-token-request.d.ts +0 -90
- package/dist/commonjs/project-client/services/jwt/models/create-user-token-request.d.ts.map +0 -1
- package/dist/commonjs/project-client/services/jwt/models/create-user-token-request.js +0 -54
- package/dist/commonjs/project-client/services/jwt/models/create-user-token-request.js.map +0 -1
- package/dist/esm/project-client/services/jwt/models/create-user-token-request.d.ts +0 -90
- package/dist/esm/project-client/services/jwt/models/create-user-token-request.d.ts.map +0 -1
- package/dist/esm/project-client/services/jwt/models/create-user-token-request.js +0 -51
- package/dist/esm/project-client/services/jwt/models/create-user-token-request.js.map +0 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ZodType } from 'zod';
|
|
2
|
+
|
|
3
|
+
import { ThrowableError } from '../errors/throwable-error.js';
|
|
4
|
+
import { SerializationStyle } from '../serialization/base-serializer.js';
|
|
5
|
+
import { ContentType, HttpMethod, RetryOptions, SdkConfig, ValidationOptions } from '../types.js';
|
|
6
|
+
|
|
7
|
+
export interface ResponseDefinition {
|
|
8
|
+
schema: ZodType;
|
|
9
|
+
contentType: ContentType;
|
|
10
|
+
status: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface ErrorDefinition {
|
|
14
|
+
error: new (...args: any[]) => ThrowableError;
|
|
15
|
+
contentType: ContentType;
|
|
16
|
+
status: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface CreateRequestParameters<Page = unknown[]> {
|
|
20
|
+
baseUrl: string;
|
|
21
|
+
method: HttpMethod;
|
|
22
|
+
body?: any;
|
|
23
|
+
headers: Map<string, RequestParameter>;
|
|
24
|
+
queryParams: Map<string, RequestParameter>;
|
|
25
|
+
pathParams: Map<string, RequestParameter>;
|
|
26
|
+
path: string;
|
|
27
|
+
config: SdkConfig;
|
|
28
|
+
responses: ResponseDefinition[];
|
|
29
|
+
errors: ErrorDefinition[];
|
|
30
|
+
requestSchema: ZodType;
|
|
31
|
+
requestContentType: ContentType;
|
|
32
|
+
validation: ValidationOptions;
|
|
33
|
+
retry: RetryOptions;
|
|
34
|
+
pagination?: RequestPagination<Page>;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface RequestParameter {
|
|
38
|
+
key: string | undefined;
|
|
39
|
+
value: unknown;
|
|
40
|
+
explode: boolean;
|
|
41
|
+
encode: boolean;
|
|
42
|
+
style: SerializationStyle;
|
|
43
|
+
isLimit: boolean;
|
|
44
|
+
isOffset: boolean;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface RequestPagination<Page> {
|
|
48
|
+
pageSize: number;
|
|
49
|
+
pagePath: string[];
|
|
50
|
+
pageSchema?: ZodType<Page, any, any>;
|
|
51
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ZodType } from 'zod';
|
|
2
|
+
|
|
3
|
+
import { Environment } from './environment.js';
|
|
4
|
+
import { Request } from './transport/request.js';
|
|
5
|
+
|
|
6
|
+
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
|
|
7
|
+
|
|
8
|
+
export interface SdkConfig {
|
|
9
|
+
baseUrl?: string;
|
|
10
|
+
environment?: Environment;
|
|
11
|
+
timeoutMs?: number;
|
|
12
|
+
token?: string;
|
|
13
|
+
retry?: RetryOptions;
|
|
14
|
+
validation?: ValidationOptions;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface HttpMetadata {
|
|
18
|
+
status: number;
|
|
19
|
+
statusText: string;
|
|
20
|
+
headers: Record<string, string>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface HttpResponse<T = unknown> {
|
|
24
|
+
data?: T;
|
|
25
|
+
metadata: HttpMetadata;
|
|
26
|
+
raw: ArrayBuffer;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface RequestHandler {
|
|
30
|
+
next?: RequestHandler;
|
|
31
|
+
|
|
32
|
+
handle<T>(request: Request): Promise<HttpResponse<T>>;
|
|
33
|
+
stream<T>(request: Request): AsyncGenerator<HttpResponse<T>>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export enum ContentType {
|
|
37
|
+
Json = 'json',
|
|
38
|
+
Xml = 'xml',
|
|
39
|
+
Pdf = 'pdf',
|
|
40
|
+
Image = 'image',
|
|
41
|
+
File = 'file',
|
|
42
|
+
Binary = 'binary',
|
|
43
|
+
FormUrlEncoded = 'form',
|
|
44
|
+
Text = 'text',
|
|
45
|
+
MultipartFormData = 'multipartFormData',
|
|
46
|
+
EventStream = 'eventStream',
|
|
47
|
+
NoContent = 'noContent',
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface Options<T> {
|
|
51
|
+
responseSchema: ZodType<T, any, any>;
|
|
52
|
+
requestSchema?: ZodType;
|
|
53
|
+
body?: any;
|
|
54
|
+
requestContentType?: ContentType;
|
|
55
|
+
responseContentType?: ContentType;
|
|
56
|
+
abortSignal?: AbortSignal;
|
|
57
|
+
queryParams?: Record<string, unknown>;
|
|
58
|
+
retry?: RetryOptions;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface RequestConfig {
|
|
62
|
+
retry?: RetryOptions;
|
|
63
|
+
validation?: ValidationOptions;
|
|
64
|
+
baseUrl?: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface RetryOptions {
|
|
68
|
+
attempts: number;
|
|
69
|
+
delayMs?: number;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface ValidationOptions {
|
|
73
|
+
responseValidation?: boolean;
|
|
74
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ContentType } from '../types.js';
|
|
2
|
+
|
|
3
|
+
export function getContentTypeDefinition(contentType: string): ContentType {
|
|
4
|
+
if (contentType.startsWith('application/') && contentType.includes('xml')) {
|
|
5
|
+
return ContentType.Xml;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
if (contentType.toLowerCase() === 'application/x-www-form-urlencoded') {
|
|
9
|
+
return ContentType.FormUrlEncoded;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (contentType.toLowerCase() === 'text/event-stream') {
|
|
13
|
+
return ContentType.EventStream;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (contentType.toLowerCase().startsWith('text/')) {
|
|
17
|
+
return ContentType.Text;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (contentType.toLowerCase().startsWith('image/')) {
|
|
21
|
+
return ContentType.Image;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (contentType.toLowerCase() === 'application/octet-stream') {
|
|
25
|
+
return ContentType.Binary;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (contentType.toLowerCase() === 'application/json') {
|
|
29
|
+
return ContentType.Json;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return ContentType.Json;
|
|
33
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export class LineDecoder {
|
|
2
|
+
private lineBuffer = '';
|
|
3
|
+
private decoder = new TextDecoder();
|
|
4
|
+
private encoder = new TextEncoder();
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Splits the given chunk into lines.
|
|
8
|
+
* Stores incomplete lines in a buffer and returns them when the next chunk arrives.
|
|
9
|
+
*/
|
|
10
|
+
public splitLines(chunk: Uint8Array): Uint8Array[] {
|
|
11
|
+
this.lineBuffer += this.decoder.decode(chunk);
|
|
12
|
+
|
|
13
|
+
let lineEndIndex;
|
|
14
|
+
const lines: Uint8Array[] = [];
|
|
15
|
+
while ((lineEndIndex = this.lineBuffer.indexOf('\n')) >= 0) {
|
|
16
|
+
const line = this.lineBuffer.slice(0, lineEndIndex + 1); // Include the newline character
|
|
17
|
+
this.lineBuffer = this.lineBuffer.slice(lineEndIndex + 1);
|
|
18
|
+
if (line.length > 1) {
|
|
19
|
+
lines.push(this.encoder.encode(line));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return lines;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Returns the remaining lines in the buffer. */
|
|
27
|
+
public flush(): Uint8Array[] {
|
|
28
|
+
if (this.lineBuffer.length === 0) {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
const lines = [this.encoder.encode(this.lineBuffer)];
|
|
32
|
+
this.lineBuffer = '';
|
|
33
|
+
return lines;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ResponseDefinition } from '../transport/types.js';
|
|
2
|
+
import { ContentType, HttpResponse } from '../types.js';
|
|
3
|
+
import { getContentTypeDefinition } from './content-type.js';
|
|
4
|
+
|
|
5
|
+
export class ResponseMatcher {
|
|
6
|
+
constructor(private responses: ResponseDefinition[]) {}
|
|
7
|
+
|
|
8
|
+
public getResponseDefinition(response: HttpResponse): ResponseDefinition | undefined {
|
|
9
|
+
const rawContentType = response.metadata.headers['content-type']?.toLocaleLowerCase() || '';
|
|
10
|
+
const contentType = getContentTypeDefinition(rawContentType);
|
|
11
|
+
const statusCode = response.metadata.status;
|
|
12
|
+
|
|
13
|
+
if (!this.responses.length) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (this.responses.length === 1) {
|
|
18
|
+
return this.responses[0];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return this.responses.find((response) => {
|
|
22
|
+
return response.contentType === contentType && response.status === statusCode;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -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,116 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
import { Environment } from '../../http/environment.js';
|
|
4
|
+
import { ThrowableError } from '../../http/errors/throwable-error.js';
|
|
5
|
+
import { SerializationStyle } from '../../http/serialization/base-serializer.js';
|
|
6
|
+
import { RequestBuilder } from '../../http/transport/request-builder.js';
|
|
7
|
+
import { ContentType, HttpResponse, RequestConfig } from '../../http/types.js';
|
|
8
|
+
import { BaseService } from '../base-service.js';
|
|
9
|
+
import { Broadcast, broadcastRequest, broadcastResponse } from './models/broadcast.js';
|
|
10
|
+
import { BroadcastCollection, broadcastCollectionResponse } from './models/broadcast-collection.js';
|
|
11
|
+
import { ListBroadcastsParams } from './request-params.js';
|
|
12
|
+
|
|
13
|
+
export class BroadcastsService extends BaseService {
|
|
14
|
+
/**
|
|
15
|
+
* Retrieves a paginated list of broadcasts for the project. Returns basic information about each broadcast including its creation time and status.
|
|
16
|
+
* @param {number} [params.limit] -
|
|
17
|
+
* @param {string} [params.startingAfter] -
|
|
18
|
+
* @param {string} [params.endingBefore] -
|
|
19
|
+
* @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
|
|
20
|
+
* @returns {Promise<HttpResponse<BroadcastCollection>>} OK
|
|
21
|
+
*/
|
|
22
|
+
async listBroadcasts(
|
|
23
|
+
params?: ListBroadcastsParams,
|
|
24
|
+
requestConfig?: RequestConfig,
|
|
25
|
+
): Promise<HttpResponse<BroadcastCollection>> {
|
|
26
|
+
const request = new RequestBuilder()
|
|
27
|
+
.setBaseUrl(requestConfig?.baseUrl || this.config.baseUrl || this.config.environment || Environment.DEFAULT)
|
|
28
|
+
.setConfig(this.config)
|
|
29
|
+
.setMethod('GET')
|
|
30
|
+
.setPath('/broadcasts')
|
|
31
|
+
.setRequestSchema(z.any())
|
|
32
|
+
.addAccessTokenAuth(this.config.token, 'Bearer')
|
|
33
|
+
.setRequestContentType(ContentType.Json)
|
|
34
|
+
.addResponse({
|
|
35
|
+
schema: broadcastCollectionResponse,
|
|
36
|
+
contentType: ContentType.Json,
|
|
37
|
+
status: 200,
|
|
38
|
+
})
|
|
39
|
+
.setRetryAttempts(this.config, requestConfig)
|
|
40
|
+
.setRetryDelayMs(this.config, requestConfig)
|
|
41
|
+
.setResponseValidation(this.config, requestConfig)
|
|
42
|
+
.addQueryParam({
|
|
43
|
+
key: 'limit',
|
|
44
|
+
value: params?.limit,
|
|
45
|
+
})
|
|
46
|
+
.addQueryParam({
|
|
47
|
+
key: 'starting_after',
|
|
48
|
+
value: params?.startingAfter,
|
|
49
|
+
})
|
|
50
|
+
.addQueryParam({
|
|
51
|
+
key: 'ending_before',
|
|
52
|
+
value: params?.endingBefore,
|
|
53
|
+
})
|
|
54
|
+
.build();
|
|
55
|
+
return this.client.call<BroadcastCollection>(request);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Creates a new broadcast message. When a broadcast is created, it generates individual notifications for relevant users within the project.
|
|
60
|
+
* @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
|
|
61
|
+
* @returns {Promise<HttpResponse<Broadcast>>} Created
|
|
62
|
+
*/
|
|
63
|
+
async createBroadcast(body: Broadcast, requestConfig?: RequestConfig): Promise<HttpResponse<Broadcast>> {
|
|
64
|
+
const request = new RequestBuilder()
|
|
65
|
+
.setBaseUrl(requestConfig?.baseUrl || this.config.baseUrl || this.config.environment || Environment.DEFAULT)
|
|
66
|
+
.setConfig(this.config)
|
|
67
|
+
.setMethod('POST')
|
|
68
|
+
.setPath('/broadcasts')
|
|
69
|
+
.setRequestSchema(broadcastRequest)
|
|
70
|
+
.addAccessTokenAuth(this.config.token, 'Bearer')
|
|
71
|
+
.setRequestContentType(ContentType.Json)
|
|
72
|
+
.addResponse({
|
|
73
|
+
schema: broadcastResponse,
|
|
74
|
+
contentType: ContentType.Json,
|
|
75
|
+
status: 201,
|
|
76
|
+
})
|
|
77
|
+
.setRetryAttempts(this.config, requestConfig)
|
|
78
|
+
.setRetryDelayMs(this.config, requestConfig)
|
|
79
|
+
.setResponseValidation(this.config, requestConfig)
|
|
80
|
+
.addHeaderParam({ key: 'Content-Type', value: 'application/json' })
|
|
81
|
+
.addBody(body)
|
|
82
|
+
.build();
|
|
83
|
+
return this.client.call<Broadcast>(request);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Retrieves detailed information about a specific broadcast by its ID. Includes the broadcast's configuration and current status.
|
|
88
|
+
* @param {string} broadcastId -
|
|
89
|
+
* @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
|
|
90
|
+
* @returns {Promise<HttpResponse<Broadcast>>} OK
|
|
91
|
+
*/
|
|
92
|
+
async fetchBroadcast(broadcastId: string, requestConfig?: RequestConfig): Promise<HttpResponse<Broadcast>> {
|
|
93
|
+
const request = new RequestBuilder()
|
|
94
|
+
.setBaseUrl(requestConfig?.baseUrl || this.config.baseUrl || this.config.environment || Environment.DEFAULT)
|
|
95
|
+
.setConfig(this.config)
|
|
96
|
+
.setMethod('GET')
|
|
97
|
+
.setPath('/broadcasts/{broadcast_id}')
|
|
98
|
+
.setRequestSchema(z.any())
|
|
99
|
+
.addAccessTokenAuth(this.config.token, 'Bearer')
|
|
100
|
+
.setRequestContentType(ContentType.Json)
|
|
101
|
+
.addResponse({
|
|
102
|
+
schema: broadcastResponse,
|
|
103
|
+
contentType: ContentType.Json,
|
|
104
|
+
status: 200,
|
|
105
|
+
})
|
|
106
|
+
.setRetryAttempts(this.config, requestConfig)
|
|
107
|
+
.setRetryDelayMs(this.config, requestConfig)
|
|
108
|
+
.setResponseValidation(this.config, requestConfig)
|
|
109
|
+
.addPathParam({
|
|
110
|
+
key: 'broadcast_id',
|
|
111
|
+
value: broadcastId,
|
|
112
|
+
})
|
|
113
|
+
.build();
|
|
114
|
+
return this.client.call<Broadcast>(request);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -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
|
+
});
|