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,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 unseenHover = z.lazy(() => {
|
|
7
|
+
return z.object({
|
|
8
|
+
backgroundColor: z.string(),
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @typedef {UnseenHover} unseenHover
|
|
15
|
+
* @property {string}
|
|
16
|
+
*/
|
|
17
|
+
export type UnseenHover = z.infer<typeof unseenHover>;
|
|
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 unseenHoverResponse = z.lazy(() => {
|
|
24
|
+
return z
|
|
25
|
+
.object({
|
|
26
|
+
backgroundColor: z.string(),
|
|
27
|
+
})
|
|
28
|
+
.transform((data) => ({
|
|
29
|
+
backgroundColor: data['backgroundColor'],
|
|
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 unseenHoverRequest = z.lazy(() => {
|
|
38
|
+
return z
|
|
39
|
+
.object({
|
|
40
|
+
backgroundColor: z.string(),
|
|
41
|
+
})
|
|
42
|
+
.transform((data) => ({
|
|
43
|
+
backgroundColor: data['backgroundColor'],
|
|
44
|
+
}));
|
|
45
|
+
});
|
|
@@ -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 unseenState = z.lazy(() => {
|
|
7
|
+
return z.object({
|
|
8
|
+
color: z.string(),
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @typedef {UnseenState} unseenState
|
|
15
|
+
* @property {string}
|
|
16
|
+
*/
|
|
17
|
+
export type UnseenState = z.infer<typeof unseenState>;
|
|
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 unseenStateResponse = z.lazy(() => {
|
|
24
|
+
return z
|
|
25
|
+
.object({
|
|
26
|
+
color: z.string(),
|
|
27
|
+
})
|
|
28
|
+
.transform((data) => ({
|
|
29
|
+
color: data['color'],
|
|
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 unseenStateRequest = z.lazy(() => {
|
|
38
|
+
return z
|
|
39
|
+
.object({
|
|
40
|
+
color: z.string(),
|
|
41
|
+
})
|
|
42
|
+
.transform((data) => ({
|
|
43
|
+
color: data['color'],
|
|
44
|
+
}));
|
|
45
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
import { UnseenHover, unseenHover, unseenHoverRequest, unseenHoverResponse } from './unseen-hover.js';
|
|
4
|
+
import { UnseenState, unseenState, unseenStateRequest, unseenStateResponse } from './unseen-state.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The shape of the model inside the application code - what the users use
|
|
8
|
+
*/
|
|
9
|
+
export const unseen = z.lazy(() => {
|
|
10
|
+
return z.object({
|
|
11
|
+
backgroundColor: z.string(),
|
|
12
|
+
hover: unseenHover.optional(),
|
|
13
|
+
state: unseenState.optional(),
|
|
14
|
+
textColor: z.string(),
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @typedef {Unseen} unseen
|
|
21
|
+
* @property {string}
|
|
22
|
+
* @property {UnseenHover}
|
|
23
|
+
* @property {UnseenState}
|
|
24
|
+
* @property {string}
|
|
25
|
+
*/
|
|
26
|
+
export type Unseen = z.infer<typeof unseen>;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The shape of the model mapping from the api schema into the application shape.
|
|
30
|
+
* Is equal to application shape if all property names match the api schema
|
|
31
|
+
*/
|
|
32
|
+
export const unseenResponse = z.lazy(() => {
|
|
33
|
+
return z
|
|
34
|
+
.object({
|
|
35
|
+
backgroundColor: z.string(),
|
|
36
|
+
hover: unseenHoverResponse.optional(),
|
|
37
|
+
state: unseenStateResponse.optional(),
|
|
38
|
+
textColor: z.string(),
|
|
39
|
+
})
|
|
40
|
+
.transform((data) => ({
|
|
41
|
+
backgroundColor: data['backgroundColor'],
|
|
42
|
+
hover: data['hover'],
|
|
43
|
+
state: data['state'],
|
|
44
|
+
textColor: data['textColor'],
|
|
45
|
+
}));
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The shape of the model mapping from the application shape into the api schema.
|
|
50
|
+
* Is equal to application shape if all property names match the api schema
|
|
51
|
+
*/
|
|
52
|
+
export const unseenRequest = z.lazy(() => {
|
|
53
|
+
return z
|
|
54
|
+
.object({
|
|
55
|
+
backgroundColor: z.string(),
|
|
56
|
+
hover: unseenHoverRequest.optional(),
|
|
57
|
+
state: unseenStateRequest.optional(),
|
|
58
|
+
textColor: z.string(),
|
|
59
|
+
})
|
|
60
|
+
.transform((data) => ({
|
|
61
|
+
backgroundColor: data['backgroundColor'],
|
|
62
|
+
hover: data['hover'],
|
|
63
|
+
state: data['state'],
|
|
64
|
+
textColor: data['textColor'],
|
|
65
|
+
}));
|
|
66
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
import { Links, links, linksRequest, linksResponse } from '../../common/links.js';
|
|
4
|
+
import { WebpushConfig, webpushConfig, webpushConfigRequest, webpushConfigResponse } from './webpush-config.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The shape of the model inside the application code - what the users use
|
|
8
|
+
*/
|
|
9
|
+
export const webpushConfigCollection = z.lazy(() => {
|
|
10
|
+
return z.object({
|
|
11
|
+
data: z.array(webpushConfig).optional(),
|
|
12
|
+
links: links.optional(),
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @typedef {WebpushConfigCollection} webpushConfigCollection
|
|
19
|
+
* @property {WebpushConfig[]}
|
|
20
|
+
* @property {Links}
|
|
21
|
+
*/
|
|
22
|
+
export type WebpushConfigCollection = z.infer<typeof webpushConfigCollection>;
|
|
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 webpushConfigCollectionResponse = z.lazy(() => {
|
|
29
|
+
return z
|
|
30
|
+
.object({
|
|
31
|
+
data: z.array(webpushConfigResponse).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 webpushConfigCollectionRequest = z.lazy(() => {
|
|
45
|
+
return z
|
|
46
|
+
.object({
|
|
47
|
+
data: z.array(webpushConfigRequest).optional(),
|
|
48
|
+
links: linksRequest.optional(),
|
|
49
|
+
})
|
|
50
|
+
.transform((data) => ({
|
|
51
|
+
data: data['data'],
|
|
52
|
+
links: data['links'],
|
|
53
|
+
}));
|
|
54
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
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 webpushConfigPayload = z.lazy(() => {
|
|
7
|
+
return z.object({
|
|
8
|
+
privateKey: z.string().min(8).max(128),
|
|
9
|
+
publicKey: z.string().min(8).max(128),
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @typedef {WebpushConfigPayload} webpushConfigPayload
|
|
16
|
+
* @property {string} - VAPID private key - from the pair you generated.
|
|
17
|
+
* @property {string} - VAPID public key - generate one at https://tools.reactpwa.com/vapid.
|
|
18
|
+
*/
|
|
19
|
+
export type WebpushConfigPayload = z.infer<typeof webpushConfigPayload>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The shape of the model mapping from the api schema into the application shape.
|
|
23
|
+
* Is equal to application shape if all property names match the api schema
|
|
24
|
+
*/
|
|
25
|
+
export const webpushConfigPayloadResponse = z.lazy(() => {
|
|
26
|
+
return z
|
|
27
|
+
.object({
|
|
28
|
+
private_key: z.string().min(8).max(128),
|
|
29
|
+
public_key: z.string().min(8).max(128),
|
|
30
|
+
})
|
|
31
|
+
.transform((data) => ({
|
|
32
|
+
privateKey: data['private_key'],
|
|
33
|
+
publicKey: data['public_key'],
|
|
34
|
+
}));
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The shape of the model mapping from the application shape into the api schema.
|
|
39
|
+
* Is equal to application shape if all property names match the api schema
|
|
40
|
+
*/
|
|
41
|
+
export const webpushConfigPayloadRequest = z.lazy(() => {
|
|
42
|
+
return z
|
|
43
|
+
.object({
|
|
44
|
+
privateKey: z.string().min(8).max(128),
|
|
45
|
+
publicKey: z.string().min(8).max(128),
|
|
46
|
+
})
|
|
47
|
+
.transform((data) => ({
|
|
48
|
+
private_key: data['privateKey'],
|
|
49
|
+
public_key: data['publicKey'],
|
|
50
|
+
}));
|
|
51
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
WebpushConfigPayload,
|
|
5
|
+
webpushConfigPayload,
|
|
6
|
+
webpushConfigPayloadRequest,
|
|
7
|
+
webpushConfigPayloadResponse,
|
|
8
|
+
} from './webpush-config-payload.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The shape of the model inside the application code - what the users use
|
|
12
|
+
*/
|
|
13
|
+
export const webpushConfig = z.lazy(() => {
|
|
14
|
+
return z.object({
|
|
15
|
+
config: webpushConfigPayload,
|
|
16
|
+
id: z.string(),
|
|
17
|
+
name: z.string(),
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @typedef {WebpushConfig} webpushConfig
|
|
24
|
+
* @property {WebpushConfigPayload}
|
|
25
|
+
* @property {string}
|
|
26
|
+
* @property {string}
|
|
27
|
+
*/
|
|
28
|
+
export type WebpushConfig = z.infer<typeof webpushConfig>;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The shape of the model mapping from the api schema into the application shape.
|
|
32
|
+
* Is equal to application shape if all property names match the api schema
|
|
33
|
+
*/
|
|
34
|
+
export const webpushConfigResponse = z.lazy(() => {
|
|
35
|
+
return z
|
|
36
|
+
.object({
|
|
37
|
+
config: webpushConfigPayloadResponse,
|
|
38
|
+
id: z.string(),
|
|
39
|
+
name: z.string(),
|
|
40
|
+
})
|
|
41
|
+
.transform((data) => ({
|
|
42
|
+
config: data['config'],
|
|
43
|
+
id: data['id'],
|
|
44
|
+
name: data['name'],
|
|
45
|
+
}));
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The shape of the model mapping from the application shape into the api schema.
|
|
50
|
+
* Is equal to application shape if all property names match the api schema
|
|
51
|
+
*/
|
|
52
|
+
export const webpushConfigRequest = z.lazy(() => {
|
|
53
|
+
return z
|
|
54
|
+
.object({
|
|
55
|
+
config: webpushConfigPayloadRequest,
|
|
56
|
+
id: z.string(),
|
|
57
|
+
name: z.string(),
|
|
58
|
+
})
|
|
59
|
+
.transform((data) => ({
|
|
60
|
+
config: data['config'],
|
|
61
|
+
id: data['id'],
|
|
62
|
+
name: data['name'],
|
|
63
|
+
}));
|
|
64
|
+
});
|
|
@@ -0,0 +1,233 @@
|
|
|
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 { AccessTokenCollection, accessTokenCollectionResponse } from './models/access-token-collection.js';
|
|
9
|
+
import { CreateProjectTokenRequest, createProjectTokenRequestRequest } from './models/create-project-token-request.js';
|
|
10
|
+
import { CreateTokenResponse, createTokenResponseResponse } from './models/create-token-response.js';
|
|
11
|
+
import { CreateUserTokenRequest, createUserTokenRequestRequest } from './models/create-user-token-request.js';
|
|
12
|
+
import { DiscardTokenResponse, discardTokenResponseResponse } from './models/discard-token-response.js';
|
|
13
|
+
import { FetchProjectTokensParams, FetchUserTokensParams } from './request-params.js';
|
|
14
|
+
|
|
15
|
+
export class JwtService extends BaseService {
|
|
16
|
+
/**
|
|
17
|
+
* Retrieves a list of all active project-level JWT tokens. Returns a paginated list showing token metadata including creation date, last used date, and expiration time. For security reasons, the actual token values are not included in the response.
|
|
18
|
+
* @param {number} [params.limit] -
|
|
19
|
+
* @param {string} [params.startingAfter] -
|
|
20
|
+
* @param {string} [params.endingBefore] -
|
|
21
|
+
* @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
|
|
22
|
+
* @returns {Promise<HttpResponse<AccessTokenCollection>>} OK
|
|
23
|
+
*/
|
|
24
|
+
async fetchProjectTokens(
|
|
25
|
+
params?: FetchProjectTokensParams,
|
|
26
|
+
requestConfig?: RequestConfig,
|
|
27
|
+
): Promise<HttpResponse<AccessTokenCollection>> {
|
|
28
|
+
const request = new RequestBuilder()
|
|
29
|
+
.setBaseUrl(requestConfig?.baseUrl || this.config.baseUrl || this.config.environment || Environment.DEFAULT)
|
|
30
|
+
.setConfig(this.config)
|
|
31
|
+
.setMethod('GET')
|
|
32
|
+
.setPath('/jwt/project')
|
|
33
|
+
.setRequestSchema(z.any())
|
|
34
|
+
.addAccessTokenAuth(this.config.token, 'Bearer')
|
|
35
|
+
.setRequestContentType(ContentType.Json)
|
|
36
|
+
.addResponse({
|
|
37
|
+
schema: accessTokenCollectionResponse,
|
|
38
|
+
contentType: ContentType.Json,
|
|
39
|
+
status: 200,
|
|
40
|
+
})
|
|
41
|
+
.setRetryAttempts(this.config, requestConfig)
|
|
42
|
+
.setRetryDelayMs(this.config, requestConfig)
|
|
43
|
+
.setResponseValidation(this.config, requestConfig)
|
|
44
|
+
.addQueryParam({
|
|
45
|
+
key: 'limit',
|
|
46
|
+
value: params?.limit,
|
|
47
|
+
})
|
|
48
|
+
.addQueryParam({
|
|
49
|
+
key: 'starting_after',
|
|
50
|
+
value: params?.startingAfter,
|
|
51
|
+
})
|
|
52
|
+
.addQueryParam({
|
|
53
|
+
key: 'ending_before',
|
|
54
|
+
value: params?.endingBefore,
|
|
55
|
+
})
|
|
56
|
+
.build();
|
|
57
|
+
return this.client.call<AccessTokenCollection>(request);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Creates a new project-level JWT token. These tokens provide project-wide access and should be carefully managed. Only administrators can create project tokens. The returned token should be securely stored as it cannot be retrieved again after creation.
|
|
62
|
+
* @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
|
|
63
|
+
* @returns {Promise<HttpResponse<CreateTokenResponse>>} Created
|
|
64
|
+
*/
|
|
65
|
+
async createProjectJwt(
|
|
66
|
+
body: CreateProjectTokenRequest,
|
|
67
|
+
requestConfig?: RequestConfig,
|
|
68
|
+
): Promise<HttpResponse<CreateTokenResponse>> {
|
|
69
|
+
const request = new RequestBuilder()
|
|
70
|
+
.setBaseUrl(requestConfig?.baseUrl || this.config.baseUrl || this.config.environment || Environment.DEFAULT)
|
|
71
|
+
.setConfig(this.config)
|
|
72
|
+
.setMethod('POST')
|
|
73
|
+
.setPath('/jwt/project')
|
|
74
|
+
.setRequestSchema(createProjectTokenRequestRequest)
|
|
75
|
+
.addAccessTokenAuth(this.config.token, 'Bearer')
|
|
76
|
+
.setRequestContentType(ContentType.Json)
|
|
77
|
+
.addResponse({
|
|
78
|
+
schema: createTokenResponseResponse,
|
|
79
|
+
contentType: ContentType.Json,
|
|
80
|
+
status: 201,
|
|
81
|
+
})
|
|
82
|
+
.setRetryAttempts(this.config, requestConfig)
|
|
83
|
+
.setRetryDelayMs(this.config, requestConfig)
|
|
84
|
+
.setResponseValidation(this.config, requestConfig)
|
|
85
|
+
.addHeaderParam({ key: 'Content-Type', value: 'application/json' })
|
|
86
|
+
.addBody(body)
|
|
87
|
+
.build();
|
|
88
|
+
return this.client.call<CreateTokenResponse>(request);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Immediately revokes a project-level JWT token. Once revoked, any requests using this token will be rejected. This action is immediate and cannot be undone. Active sessions using this token will be terminated.
|
|
93
|
+
* @param {string} tokenId -
|
|
94
|
+
* @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
|
|
95
|
+
* @returns {Promise<HttpResponse<DiscardTokenResponse>>} OK
|
|
96
|
+
*/
|
|
97
|
+
async discardProjectJwt(tokenId: string, requestConfig?: RequestConfig): Promise<HttpResponse<DiscardTokenResponse>> {
|
|
98
|
+
const request = new RequestBuilder()
|
|
99
|
+
.setBaseUrl(requestConfig?.baseUrl || this.config.baseUrl || this.config.environment || Environment.DEFAULT)
|
|
100
|
+
.setConfig(this.config)
|
|
101
|
+
.setMethod('DELETE')
|
|
102
|
+
.setPath('/jwt/project/{token_id}')
|
|
103
|
+
.setRequestSchema(z.any())
|
|
104
|
+
.addAccessTokenAuth(this.config.token, 'Bearer')
|
|
105
|
+
.setRequestContentType(ContentType.Json)
|
|
106
|
+
.addResponse({
|
|
107
|
+
schema: discardTokenResponseResponse,
|
|
108
|
+
contentType: ContentType.Json,
|
|
109
|
+
status: 200,
|
|
110
|
+
})
|
|
111
|
+
.setRetryAttempts(this.config, requestConfig)
|
|
112
|
+
.setRetryDelayMs(this.config, requestConfig)
|
|
113
|
+
.setResponseValidation(this.config, requestConfig)
|
|
114
|
+
.addPathParam({
|
|
115
|
+
key: 'token_id',
|
|
116
|
+
value: tokenId,
|
|
117
|
+
})
|
|
118
|
+
.build();
|
|
119
|
+
return this.client.call<DiscardTokenResponse>(request);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Issues a new user-specific JWT token. These tokens are scoped to individual user permissions and access levels. Only administrators can create user tokens. The token is returned only once at creation time and cannot be retrieved later.
|
|
124
|
+
* @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
|
|
125
|
+
* @returns {Promise<HttpResponse<CreateTokenResponse>>} Created
|
|
126
|
+
*/
|
|
127
|
+
async createUserJwt(
|
|
128
|
+
body: CreateUserTokenRequest,
|
|
129
|
+
requestConfig?: RequestConfig,
|
|
130
|
+
): Promise<HttpResponse<CreateTokenResponse>> {
|
|
131
|
+
const request = new RequestBuilder()
|
|
132
|
+
.setBaseUrl(requestConfig?.baseUrl || this.config.baseUrl || this.config.environment || Environment.DEFAULT)
|
|
133
|
+
.setConfig(this.config)
|
|
134
|
+
.setMethod('POST')
|
|
135
|
+
.setPath('/jwt/user')
|
|
136
|
+
.setRequestSchema(createUserTokenRequestRequest)
|
|
137
|
+
.addAccessTokenAuth(this.config.token, 'Bearer')
|
|
138
|
+
.setRequestContentType(ContentType.Json)
|
|
139
|
+
.addResponse({
|
|
140
|
+
schema: createTokenResponseResponse,
|
|
141
|
+
contentType: ContentType.Json,
|
|
142
|
+
status: 201,
|
|
143
|
+
})
|
|
144
|
+
.setRetryAttempts(this.config, requestConfig)
|
|
145
|
+
.setRetryDelayMs(this.config, requestConfig)
|
|
146
|
+
.setResponseValidation(this.config, requestConfig)
|
|
147
|
+
.addHeaderParam({ key: 'Content-Type', value: 'application/json' })
|
|
148
|
+
.addBody(body)
|
|
149
|
+
.build();
|
|
150
|
+
return this.client.call<CreateTokenResponse>(request);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Revokes a specific user's JWT token. This immediately invalidates the token and terminates any active sessions using it. This action cannot be undone. Administrators should use this to revoke access when needed for security purposes.
|
|
155
|
+
* @param {string} tokenId -
|
|
156
|
+
* @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
|
|
157
|
+
* @returns {Promise<HttpResponse<DiscardTokenResponse>>} OK
|
|
158
|
+
*/
|
|
159
|
+
async discardUserJwt(tokenId: string, requestConfig?: RequestConfig): Promise<HttpResponse<DiscardTokenResponse>> {
|
|
160
|
+
const request = new RequestBuilder()
|
|
161
|
+
.setBaseUrl(requestConfig?.baseUrl || this.config.baseUrl || this.config.environment || Environment.DEFAULT)
|
|
162
|
+
.setConfig(this.config)
|
|
163
|
+
.setMethod('DELETE')
|
|
164
|
+
.setPath('/jwt/user/{token_id}')
|
|
165
|
+
.setRequestSchema(z.any())
|
|
166
|
+
.addAccessTokenAuth(this.config.token, 'Bearer')
|
|
167
|
+
.setRequestContentType(ContentType.Json)
|
|
168
|
+
.addResponse({
|
|
169
|
+
schema: discardTokenResponseResponse,
|
|
170
|
+
contentType: ContentType.Json,
|
|
171
|
+
status: 200,
|
|
172
|
+
})
|
|
173
|
+
.setRetryAttempts(this.config, requestConfig)
|
|
174
|
+
.setRetryDelayMs(this.config, requestConfig)
|
|
175
|
+
.setResponseValidation(this.config, requestConfig)
|
|
176
|
+
.addPathParam({
|
|
177
|
+
key: 'token_id',
|
|
178
|
+
value: tokenId,
|
|
179
|
+
})
|
|
180
|
+
.build();
|
|
181
|
+
return this.client.call<DiscardTokenResponse>(request);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Lists all JWT tokens associated with a specific user. Returns token metadata including creation time, last access time, and expiration date. Administrators can use this to audit user token usage and manage active sessions. Token values are not included in the response for security reasons.
|
|
186
|
+
* @param {string} userId -
|
|
187
|
+
* @param {number} [params.limit] -
|
|
188
|
+
* @param {string} [params.startingAfter] -
|
|
189
|
+
* @param {string} [params.endingBefore] -
|
|
190
|
+
* @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
|
|
191
|
+
* @returns {Promise<HttpResponse<AccessTokenCollection>>} OK
|
|
192
|
+
*/
|
|
193
|
+
async fetchUserTokens(
|
|
194
|
+
userId: string,
|
|
195
|
+
params?: FetchUserTokensParams,
|
|
196
|
+
requestConfig?: RequestConfig,
|
|
197
|
+
): Promise<HttpResponse<AccessTokenCollection>> {
|
|
198
|
+
const request = new RequestBuilder()
|
|
199
|
+
.setBaseUrl(requestConfig?.baseUrl || this.config.baseUrl || this.config.environment || Environment.DEFAULT)
|
|
200
|
+
.setConfig(this.config)
|
|
201
|
+
.setMethod('GET')
|
|
202
|
+
.setPath('/jwt/user/{user_id}')
|
|
203
|
+
.setRequestSchema(z.any())
|
|
204
|
+
.addAccessTokenAuth(this.config.token, 'Bearer')
|
|
205
|
+
.setRequestContentType(ContentType.Json)
|
|
206
|
+
.addResponse({
|
|
207
|
+
schema: accessTokenCollectionResponse,
|
|
208
|
+
contentType: ContentType.Json,
|
|
209
|
+
status: 200,
|
|
210
|
+
})
|
|
211
|
+
.setRetryAttempts(this.config, requestConfig)
|
|
212
|
+
.setRetryDelayMs(this.config, requestConfig)
|
|
213
|
+
.setResponseValidation(this.config, requestConfig)
|
|
214
|
+
.addPathParam({
|
|
215
|
+
key: 'user_id',
|
|
216
|
+
value: userId,
|
|
217
|
+
})
|
|
218
|
+
.addQueryParam({
|
|
219
|
+
key: 'limit',
|
|
220
|
+
value: params?.limit,
|
|
221
|
+
})
|
|
222
|
+
.addQueryParam({
|
|
223
|
+
key: 'starting_after',
|
|
224
|
+
value: params?.startingAfter,
|
|
225
|
+
})
|
|
226
|
+
.addQueryParam({
|
|
227
|
+
key: 'ending_before',
|
|
228
|
+
value: params?.endingBefore,
|
|
229
|
+
})
|
|
230
|
+
.build();
|
|
231
|
+
return this.client.call<AccessTokenCollection>(request);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
import { Links, links, linksRequest, linksResponse } from '../../common/links.js';
|
|
4
|
+
import { AccessToken, accessToken, accessTokenRequest, accessTokenResponse } from './access-token.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The shape of the model inside the application code - what the users use
|
|
8
|
+
*/
|
|
9
|
+
export const accessTokenCollection = z.lazy(() => {
|
|
10
|
+
return z.object({
|
|
11
|
+
data: z.array(accessToken).optional(),
|
|
12
|
+
links: links.optional(),
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @typedef {AccessTokenCollection} accessTokenCollection
|
|
19
|
+
* @property {AccessToken[]}
|
|
20
|
+
* @property {Links}
|
|
21
|
+
*/
|
|
22
|
+
export type AccessTokenCollection = z.infer<typeof accessTokenCollection>;
|
|
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 accessTokenCollectionResponse = z.lazy(() => {
|
|
29
|
+
return z
|
|
30
|
+
.object({
|
|
31
|
+
data: z.array(accessTokenResponse).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 accessTokenCollectionRequest = z.lazy(() => {
|
|
45
|
+
return z
|
|
46
|
+
.object({
|
|
47
|
+
data: z.array(accessTokenRequest).optional(),
|
|
48
|
+
links: linksRequest.optional(),
|
|
49
|
+
})
|
|
50
|
+
.transform((data) => ({
|
|
51
|
+
data: data['data'],
|
|
52
|
+
links: data['links'],
|
|
53
|
+
}));
|
|
54
|
+
});
|