magicbell-js 0.0.3 → 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/package.json +2 -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/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,278 @@
|
|
|
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 {
|
|
9
|
+
WebPushTokenPayload,
|
|
10
|
+
webPushTokenPayloadRequest,
|
|
11
|
+
webPushTokenPayloadResponse,
|
|
12
|
+
} from '../common/web-push-token-payload.js';
|
|
13
|
+
import {
|
|
14
|
+
InboxConfigPayload,
|
|
15
|
+
inboxConfigPayloadRequest,
|
|
16
|
+
inboxConfigPayloadResponse,
|
|
17
|
+
} from './models/inbox-config-payload.js';
|
|
18
|
+
import {
|
|
19
|
+
SlackFinishInstallResponse,
|
|
20
|
+
slackFinishInstallResponseRequest,
|
|
21
|
+
} from './models/slack-finish-install-response.js';
|
|
22
|
+
import { SlackInstallation, slackInstallationRequest, slackInstallationResponse } from './models/slack-installation.js';
|
|
23
|
+
import { SlackStartInstall, slackStartInstallRequest } from './models/slack-start-install.js';
|
|
24
|
+
import {
|
|
25
|
+
SlackStartInstallResponseContent,
|
|
26
|
+
slackStartInstallResponseContentResponse,
|
|
27
|
+
} from './models/slack-start-install-response-content.js';
|
|
28
|
+
import {
|
|
29
|
+
TemplatesInstallation,
|
|
30
|
+
templatesInstallationRequest,
|
|
31
|
+
templatesInstallationResponse,
|
|
32
|
+
} from './models/templates-installation.js';
|
|
33
|
+
import {
|
|
34
|
+
WebPushStartInstallationResponse,
|
|
35
|
+
webPushStartInstallationResponseResponse,
|
|
36
|
+
} from './models/web-push-start-installation-response.js';
|
|
37
|
+
|
|
38
|
+
export class IntegrationsService extends BaseService {
|
|
39
|
+
/**
|
|
40
|
+
* Creates a new installation of a inbox integration for a user. This endpoint is used when an integration needs to be set up with user-specific credentials or configuration.
|
|
41
|
+
* @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
|
|
42
|
+
* @returns {Promise<HttpResponse<InboxConfigPayload>>} Created
|
|
43
|
+
*/
|
|
44
|
+
async saveInboxInstallation(
|
|
45
|
+
body: InboxConfigPayload,
|
|
46
|
+
requestConfig?: RequestConfig,
|
|
47
|
+
): Promise<HttpResponse<InboxConfigPayload>> {
|
|
48
|
+
const request = new RequestBuilder()
|
|
49
|
+
.setBaseUrl(requestConfig?.baseUrl || this.config.baseUrl || this.config.environment || Environment.DEFAULT)
|
|
50
|
+
.setConfig(this.config)
|
|
51
|
+
.setMethod('POST')
|
|
52
|
+
.setPath('/integrations/inbox/installations')
|
|
53
|
+
.setRequestSchema(inboxConfigPayloadRequest)
|
|
54
|
+
.addAccessTokenAuth(this.config.token, 'Bearer')
|
|
55
|
+
.setRequestContentType(ContentType.Json)
|
|
56
|
+
.addResponse({
|
|
57
|
+
schema: inboxConfigPayloadResponse,
|
|
58
|
+
contentType: ContentType.Json,
|
|
59
|
+
status: 201,
|
|
60
|
+
})
|
|
61
|
+
.setRetryAttempts(this.config, requestConfig)
|
|
62
|
+
.setRetryDelayMs(this.config, requestConfig)
|
|
63
|
+
.setResponseValidation(this.config, requestConfig)
|
|
64
|
+
.addHeaderParam({ key: 'Content-Type', value: 'application/json' })
|
|
65
|
+
.addBody(body)
|
|
66
|
+
.build();
|
|
67
|
+
return this.client.call<InboxConfigPayload>(request);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Initiates the installation flow for a inbox integration. This is the first step in a multi-step installation process where user authorization or external service configuration may be required.
|
|
72
|
+
* @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
|
|
73
|
+
* @returns {Promise<HttpResponse<InboxConfigPayload>>} Created
|
|
74
|
+
*/
|
|
75
|
+
async startInboxInstallation(requestConfig?: RequestConfig): Promise<HttpResponse<InboxConfigPayload>> {
|
|
76
|
+
const request = new RequestBuilder()
|
|
77
|
+
.setBaseUrl(requestConfig?.baseUrl || this.config.baseUrl || this.config.environment || Environment.DEFAULT)
|
|
78
|
+
.setConfig(this.config)
|
|
79
|
+
.setMethod('POST')
|
|
80
|
+
.setPath('/integrations/inbox/installations/start')
|
|
81
|
+
.setRequestSchema(z.any())
|
|
82
|
+
.addAccessTokenAuth(this.config.token, 'Bearer')
|
|
83
|
+
.setRequestContentType(ContentType.Json)
|
|
84
|
+
.addResponse({
|
|
85
|
+
schema: inboxConfigPayloadResponse,
|
|
86
|
+
contentType: ContentType.Json,
|
|
87
|
+
status: 201,
|
|
88
|
+
})
|
|
89
|
+
.setRetryAttempts(this.config, requestConfig)
|
|
90
|
+
.setRetryDelayMs(this.config, requestConfig)
|
|
91
|
+
.setResponseValidation(this.config, requestConfig)
|
|
92
|
+
.build();
|
|
93
|
+
return this.client.call<InboxConfigPayload>(request);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Creates a new installation of a slack integration for a user. This endpoint is used when an integration needs to be set up with user-specific credentials or configuration.
|
|
98
|
+
* @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
|
|
99
|
+
* @returns {Promise<HttpResponse<SlackInstallation>>} Created
|
|
100
|
+
*/
|
|
101
|
+
async saveSlackInstallation(
|
|
102
|
+
body: SlackInstallation,
|
|
103
|
+
requestConfig?: RequestConfig,
|
|
104
|
+
): Promise<HttpResponse<SlackInstallation>> {
|
|
105
|
+
const request = new RequestBuilder()
|
|
106
|
+
.setBaseUrl(requestConfig?.baseUrl || this.config.baseUrl || this.config.environment || Environment.DEFAULT)
|
|
107
|
+
.setConfig(this.config)
|
|
108
|
+
.setMethod('POST')
|
|
109
|
+
.setPath('/integrations/slack/installations')
|
|
110
|
+
.setRequestSchema(slackInstallationRequest)
|
|
111
|
+
.addAccessTokenAuth(this.config.token, 'Bearer')
|
|
112
|
+
.setRequestContentType(ContentType.Json)
|
|
113
|
+
.addResponse({
|
|
114
|
+
schema: slackInstallationResponse,
|
|
115
|
+
contentType: ContentType.Json,
|
|
116
|
+
status: 201,
|
|
117
|
+
})
|
|
118
|
+
.setRetryAttempts(this.config, requestConfig)
|
|
119
|
+
.setRetryDelayMs(this.config, requestConfig)
|
|
120
|
+
.setResponseValidation(this.config, requestConfig)
|
|
121
|
+
.addHeaderParam({ key: 'Content-Type', value: 'application/json' })
|
|
122
|
+
.addBody(body)
|
|
123
|
+
.build();
|
|
124
|
+
return this.client.call<SlackInstallation>(request);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Completes the installation flow for a slack integration. This endpoint is typically called after the user has completed any required authorization steps with slack.
|
|
129
|
+
* @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
|
|
130
|
+
* @returns {Promise<HttpResponse<SlackInstallation>>} Created
|
|
131
|
+
*/
|
|
132
|
+
async finishSlackInstallation(
|
|
133
|
+
body: SlackFinishInstallResponse,
|
|
134
|
+
requestConfig?: RequestConfig,
|
|
135
|
+
): Promise<HttpResponse<SlackInstallation>> {
|
|
136
|
+
const request = new RequestBuilder()
|
|
137
|
+
.setBaseUrl(requestConfig?.baseUrl || this.config.baseUrl || this.config.environment || Environment.DEFAULT)
|
|
138
|
+
.setConfig(this.config)
|
|
139
|
+
.setMethod('POST')
|
|
140
|
+
.setPath('/integrations/slack/installations/finish')
|
|
141
|
+
.setRequestSchema(slackFinishInstallResponseRequest)
|
|
142
|
+
.addAccessTokenAuth(this.config.token, 'Bearer')
|
|
143
|
+
.setRequestContentType(ContentType.Json)
|
|
144
|
+
.addResponse({
|
|
145
|
+
schema: slackInstallationResponse,
|
|
146
|
+
contentType: ContentType.Json,
|
|
147
|
+
status: 201,
|
|
148
|
+
})
|
|
149
|
+
.setRetryAttempts(this.config, requestConfig)
|
|
150
|
+
.setRetryDelayMs(this.config, requestConfig)
|
|
151
|
+
.setResponseValidation(this.config, requestConfig)
|
|
152
|
+
.addHeaderParam({ key: 'Content-Type', value: 'application/json' })
|
|
153
|
+
.addBody(body)
|
|
154
|
+
.build();
|
|
155
|
+
return this.client.call<SlackInstallation>(request);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Initiates the installation flow for a slack integration. This is the first step in a multi-step installation process where user authorization or external service configuration may be required.
|
|
160
|
+
* @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
|
|
161
|
+
* @returns {Promise<HttpResponse<SlackStartInstallResponseContent>>} Created
|
|
162
|
+
*/
|
|
163
|
+
async startSlackInstallation(
|
|
164
|
+
body: SlackStartInstall,
|
|
165
|
+
requestConfig?: RequestConfig,
|
|
166
|
+
): Promise<HttpResponse<SlackStartInstallResponseContent>> {
|
|
167
|
+
const request = new RequestBuilder()
|
|
168
|
+
.setBaseUrl(requestConfig?.baseUrl || this.config.baseUrl || this.config.environment || Environment.DEFAULT)
|
|
169
|
+
.setConfig(this.config)
|
|
170
|
+
.setMethod('POST')
|
|
171
|
+
.setPath('/integrations/slack/installations/start')
|
|
172
|
+
.setRequestSchema(slackStartInstallRequest)
|
|
173
|
+
.addAccessTokenAuth(this.config.token, 'Bearer')
|
|
174
|
+
.setRequestContentType(ContentType.Json)
|
|
175
|
+
.addResponse({
|
|
176
|
+
schema: slackStartInstallResponseContentResponse,
|
|
177
|
+
contentType: ContentType.Json,
|
|
178
|
+
status: 201,
|
|
179
|
+
})
|
|
180
|
+
.setRetryAttempts(this.config, requestConfig)
|
|
181
|
+
.setRetryDelayMs(this.config, requestConfig)
|
|
182
|
+
.setResponseValidation(this.config, requestConfig)
|
|
183
|
+
.addHeaderParam({ key: 'Content-Type', value: 'application/json' })
|
|
184
|
+
.addBody(body)
|
|
185
|
+
.build();
|
|
186
|
+
return this.client.call<SlackStartInstallResponseContent>(request);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Creates a new installation of a templates integration for a user. This endpoint is used when an integration needs to be set up with user-specific credentials or configuration.
|
|
191
|
+
* @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
|
|
192
|
+
* @returns {Promise<HttpResponse<TemplatesInstallation>>} Created
|
|
193
|
+
*/
|
|
194
|
+
async saveTemplatesInstallation(
|
|
195
|
+
body: TemplatesInstallation,
|
|
196
|
+
requestConfig?: RequestConfig,
|
|
197
|
+
): Promise<HttpResponse<TemplatesInstallation>> {
|
|
198
|
+
const request = new RequestBuilder()
|
|
199
|
+
.setBaseUrl(requestConfig?.baseUrl || this.config.baseUrl || this.config.environment || Environment.DEFAULT)
|
|
200
|
+
.setConfig(this.config)
|
|
201
|
+
.setMethod('POST')
|
|
202
|
+
.setPath('/integrations/templates/installations')
|
|
203
|
+
.setRequestSchema(templatesInstallationRequest)
|
|
204
|
+
.addAccessTokenAuth(this.config.token, 'Bearer')
|
|
205
|
+
.setRequestContentType(ContentType.Json)
|
|
206
|
+
.addResponse({
|
|
207
|
+
schema: templatesInstallationResponse,
|
|
208
|
+
contentType: ContentType.Json,
|
|
209
|
+
status: 201,
|
|
210
|
+
})
|
|
211
|
+
.setRetryAttempts(this.config, requestConfig)
|
|
212
|
+
.setRetryDelayMs(this.config, requestConfig)
|
|
213
|
+
.setResponseValidation(this.config, requestConfig)
|
|
214
|
+
.addHeaderParam({ key: 'Content-Type', value: 'application/json' })
|
|
215
|
+
.addBody(body)
|
|
216
|
+
.build();
|
|
217
|
+
return this.client.call<TemplatesInstallation>(request);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Creates a new installation of a web_push integration for a user. This endpoint is used when an integration needs to be set up with user-specific credentials or configuration.
|
|
222
|
+
* @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
|
|
223
|
+
* @returns {Promise<HttpResponse<WebPushTokenPayload>>} Created
|
|
224
|
+
*/
|
|
225
|
+
async saveWebPushInstallation(
|
|
226
|
+
body: WebPushTokenPayload,
|
|
227
|
+
requestConfig?: RequestConfig,
|
|
228
|
+
): Promise<HttpResponse<WebPushTokenPayload>> {
|
|
229
|
+
const request = new RequestBuilder()
|
|
230
|
+
.setBaseUrl(requestConfig?.baseUrl || this.config.baseUrl || this.config.environment || Environment.DEFAULT)
|
|
231
|
+
.setConfig(this.config)
|
|
232
|
+
.setMethod('POST')
|
|
233
|
+
.setPath('/integrations/web_push/installations')
|
|
234
|
+
.setRequestSchema(webPushTokenPayloadRequest)
|
|
235
|
+
.addAccessTokenAuth(this.config.token, 'Bearer')
|
|
236
|
+
.setRequestContentType(ContentType.Json)
|
|
237
|
+
.addResponse({
|
|
238
|
+
schema: webPushTokenPayloadResponse,
|
|
239
|
+
contentType: ContentType.Json,
|
|
240
|
+
status: 201,
|
|
241
|
+
})
|
|
242
|
+
.setRetryAttempts(this.config, requestConfig)
|
|
243
|
+
.setRetryDelayMs(this.config, requestConfig)
|
|
244
|
+
.setResponseValidation(this.config, requestConfig)
|
|
245
|
+
.addHeaderParam({ key: 'Content-Type', value: 'application/json' })
|
|
246
|
+
.addBody(body)
|
|
247
|
+
.build();
|
|
248
|
+
return this.client.call<WebPushTokenPayload>(request);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Initiates the installation flow for a web_push integration. This is the first step in a multi-step installation process where user authorization or external service configuration may be required.
|
|
253
|
+
* @param {RequestConfig} requestConfig - (Optional) The request configuration for retry and validation.
|
|
254
|
+
* @returns {Promise<HttpResponse<WebPushStartInstallationResponse>>} Created
|
|
255
|
+
*/
|
|
256
|
+
async startWebPushInstallation(
|
|
257
|
+
requestConfig?: RequestConfig,
|
|
258
|
+
): Promise<HttpResponse<WebPushStartInstallationResponse>> {
|
|
259
|
+
const request = new RequestBuilder()
|
|
260
|
+
.setBaseUrl(requestConfig?.baseUrl || this.config.baseUrl || this.config.environment || Environment.DEFAULT)
|
|
261
|
+
.setConfig(this.config)
|
|
262
|
+
.setMethod('POST')
|
|
263
|
+
.setPath('/integrations/web_push/installations/start')
|
|
264
|
+
.setRequestSchema(z.any())
|
|
265
|
+
.addAccessTokenAuth(this.config.token, 'Bearer')
|
|
266
|
+
.setRequestContentType(ContentType.Json)
|
|
267
|
+
.addResponse({
|
|
268
|
+
schema: webPushStartInstallationResponseResponse,
|
|
269
|
+
contentType: ContentType.Json,
|
|
270
|
+
status: 201,
|
|
271
|
+
})
|
|
272
|
+
.setRetryAttempts(this.config, requestConfig)
|
|
273
|
+
.setRetryDelayMs(this.config, requestConfig)
|
|
274
|
+
.setResponseValidation(this.config, requestConfig)
|
|
275
|
+
.build();
|
|
276
|
+
return this.client.call<WebPushStartInstallationResponse>(request);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
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 authedUser = z.lazy(() => {
|
|
7
|
+
return z.object({
|
|
8
|
+
accessToken: z.string().optional(),
|
|
9
|
+
expiresIn: z.number().optional(),
|
|
10
|
+
id: z.string(),
|
|
11
|
+
refreshToken: z.string().optional(),
|
|
12
|
+
scope: z.string().optional(),
|
|
13
|
+
tokenType: z.string().optional(),
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @typedef {AuthedUser} authedUser
|
|
20
|
+
* @property {string}
|
|
21
|
+
* @property {number}
|
|
22
|
+
* @property {string}
|
|
23
|
+
* @property {string}
|
|
24
|
+
* @property {string}
|
|
25
|
+
* @property {string}
|
|
26
|
+
*/
|
|
27
|
+
export type AuthedUser = z.infer<typeof authedUser>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The shape of the model mapping from the api schema into the application shape.
|
|
31
|
+
* Is equal to application shape if all property names match the api schema
|
|
32
|
+
*/
|
|
33
|
+
export const authedUserResponse = z.lazy(() => {
|
|
34
|
+
return z
|
|
35
|
+
.object({
|
|
36
|
+
access_token: z.string().optional(),
|
|
37
|
+
expires_in: z.number().optional(),
|
|
38
|
+
id: z.string(),
|
|
39
|
+
refresh_token: z.string().optional(),
|
|
40
|
+
scope: z.string().optional(),
|
|
41
|
+
token_type: z.string().optional(),
|
|
42
|
+
})
|
|
43
|
+
.transform((data) => ({
|
|
44
|
+
accessToken: data['access_token'],
|
|
45
|
+
expiresIn: data['expires_in'],
|
|
46
|
+
id: data['id'],
|
|
47
|
+
refreshToken: data['refresh_token'],
|
|
48
|
+
scope: data['scope'],
|
|
49
|
+
tokenType: data['token_type'],
|
|
50
|
+
}));
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The shape of the model mapping from the application shape into the api schema.
|
|
55
|
+
* Is equal to application shape if all property names match the api schema
|
|
56
|
+
*/
|
|
57
|
+
export const authedUserRequest = z.lazy(() => {
|
|
58
|
+
return z
|
|
59
|
+
.object({
|
|
60
|
+
accessToken: z.string().optional(),
|
|
61
|
+
expiresIn: z.number().optional(),
|
|
62
|
+
id: z.string(),
|
|
63
|
+
refreshToken: z.string().optional(),
|
|
64
|
+
scope: z.string().optional(),
|
|
65
|
+
tokenType: z.string().optional(),
|
|
66
|
+
})
|
|
67
|
+
.transform((data) => ({
|
|
68
|
+
access_token: data['accessToken'],
|
|
69
|
+
expires_in: data['expiresIn'],
|
|
70
|
+
id: data['id'],
|
|
71
|
+
refresh_token: data['refreshToken'],
|
|
72
|
+
scope: data['scope'],
|
|
73
|
+
token_type: data['tokenType'],
|
|
74
|
+
}));
|
|
75
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
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 banner = z.lazy(() => {
|
|
7
|
+
return z.object({
|
|
8
|
+
backgroundColor: z.string(),
|
|
9
|
+
backgroundOpacity: z.number().optional(),
|
|
10
|
+
fontSize: z.string(),
|
|
11
|
+
textColor: z.string(),
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @typedef {Banner} banner
|
|
18
|
+
* @property {string}
|
|
19
|
+
* @property {number}
|
|
20
|
+
* @property {string}
|
|
21
|
+
* @property {string}
|
|
22
|
+
*/
|
|
23
|
+
export type Banner = z.infer<typeof banner>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The shape of the model mapping from the api schema into the application shape.
|
|
27
|
+
* Is equal to application shape if all property names match the api schema
|
|
28
|
+
*/
|
|
29
|
+
export const bannerResponse = z.lazy(() => {
|
|
30
|
+
return z
|
|
31
|
+
.object({
|
|
32
|
+
backgroundColor: z.string(),
|
|
33
|
+
backgroundOpacity: z.number().optional(),
|
|
34
|
+
fontSize: z.string(),
|
|
35
|
+
textColor: z.string(),
|
|
36
|
+
})
|
|
37
|
+
.transform((data) => ({
|
|
38
|
+
backgroundColor: data['backgroundColor'],
|
|
39
|
+
backgroundOpacity: data['backgroundOpacity'],
|
|
40
|
+
fontSize: data['fontSize'],
|
|
41
|
+
textColor: data['textColor'],
|
|
42
|
+
}));
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The shape of the model mapping from the application shape into the api schema.
|
|
47
|
+
* Is equal to application shape if all property names match the api schema
|
|
48
|
+
*/
|
|
49
|
+
export const bannerRequest = z.lazy(() => {
|
|
50
|
+
return z
|
|
51
|
+
.object({
|
|
52
|
+
backgroundColor: z.string(),
|
|
53
|
+
backgroundOpacity: z.number().optional(),
|
|
54
|
+
fontSize: z.string(),
|
|
55
|
+
textColor: z.string(),
|
|
56
|
+
})
|
|
57
|
+
.transform((data) => ({
|
|
58
|
+
backgroundColor: data['backgroundColor'],
|
|
59
|
+
backgroundOpacity: data['backgroundOpacity'],
|
|
60
|
+
fontSize: data['fontSize'],
|
|
61
|
+
textColor: data['textColor'],
|
|
62
|
+
}));
|
|
63
|
+
});
|
|
@@ -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 defaultHover = z.lazy(() => {
|
|
7
|
+
return z.object({
|
|
8
|
+
backgroundColor: z.string(),
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @typedef {DefaultHover} defaultHover
|
|
15
|
+
* @property {string}
|
|
16
|
+
*/
|
|
17
|
+
export type DefaultHover = z.infer<typeof defaultHover>;
|
|
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 defaultHoverResponse = 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 defaultHoverRequest = 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 defaultState = z.lazy(() => {
|
|
7
|
+
return z.object({
|
|
8
|
+
color: z.string(),
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @typedef {DefaultState} defaultState
|
|
15
|
+
* @property {string}
|
|
16
|
+
*/
|
|
17
|
+
export type DefaultState = z.infer<typeof defaultState>;
|
|
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 defaultStateResponse = 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 defaultStateRequest = z.lazy(() => {
|
|
38
|
+
return z
|
|
39
|
+
.object({
|
|
40
|
+
color: z.string(),
|
|
41
|
+
})
|
|
42
|
+
.transform((data) => ({
|
|
43
|
+
color: data['color'],
|
|
44
|
+
}));
|
|
45
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
import { DefaultHover, defaultHover, defaultHoverRequest, defaultHoverResponse } from './default-hover.js';
|
|
4
|
+
import { DefaultState, defaultState, defaultStateRequest, defaultStateResponse } from './default-state.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The shape of the model inside the application code - what the users use
|
|
8
|
+
*/
|
|
9
|
+
export const default_ = z.lazy(() => {
|
|
10
|
+
return z.object({
|
|
11
|
+
backgroundColor: z.string(),
|
|
12
|
+
borderRadius: z.string(),
|
|
13
|
+
fontFamily: z.string(),
|
|
14
|
+
fontSize: z.string(),
|
|
15
|
+
hover: defaultHover.optional(),
|
|
16
|
+
margin: z.string(),
|
|
17
|
+
state: defaultState.optional(),
|
|
18
|
+
textColor: z.string(),
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @typedef {Default_} default_
|
|
25
|
+
* @property {string}
|
|
26
|
+
* @property {string}
|
|
27
|
+
* @property {string}
|
|
28
|
+
* @property {string}
|
|
29
|
+
* @property {DefaultHover}
|
|
30
|
+
* @property {string}
|
|
31
|
+
* @property {DefaultState}
|
|
32
|
+
* @property {string}
|
|
33
|
+
*/
|
|
34
|
+
export type Default_ = z.infer<typeof default_>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The shape of the model mapping from the api schema into the application shape.
|
|
38
|
+
* Is equal to application shape if all property names match the api schema
|
|
39
|
+
*/
|
|
40
|
+
export const defaultResponse = z.lazy(() => {
|
|
41
|
+
return z
|
|
42
|
+
.object({
|
|
43
|
+
backgroundColor: z.string(),
|
|
44
|
+
borderRadius: z.string(),
|
|
45
|
+
fontFamily: z.string(),
|
|
46
|
+
fontSize: z.string(),
|
|
47
|
+
hover: defaultHoverResponse.optional(),
|
|
48
|
+
margin: z.string(),
|
|
49
|
+
state: defaultStateResponse.optional(),
|
|
50
|
+
textColor: z.string(),
|
|
51
|
+
})
|
|
52
|
+
.transform((data) => ({
|
|
53
|
+
backgroundColor: data['backgroundColor'],
|
|
54
|
+
borderRadius: data['borderRadius'],
|
|
55
|
+
fontFamily: data['fontFamily'],
|
|
56
|
+
fontSize: data['fontSize'],
|
|
57
|
+
hover: data['hover'],
|
|
58
|
+
margin: data['margin'],
|
|
59
|
+
state: data['state'],
|
|
60
|
+
textColor: data['textColor'],
|
|
61
|
+
}));
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The shape of the model mapping from the application shape into the api schema.
|
|
66
|
+
* Is equal to application shape if all property names match the api schema
|
|
67
|
+
*/
|
|
68
|
+
export const defaultRequest = z.lazy(() => {
|
|
69
|
+
return z
|
|
70
|
+
.object({
|
|
71
|
+
backgroundColor: z.string(),
|
|
72
|
+
borderRadius: z.string(),
|
|
73
|
+
fontFamily: z.string(),
|
|
74
|
+
fontSize: z.string(),
|
|
75
|
+
hover: defaultHoverRequest.optional(),
|
|
76
|
+
margin: z.string(),
|
|
77
|
+
state: defaultStateRequest.optional(),
|
|
78
|
+
textColor: z.string(),
|
|
79
|
+
})
|
|
80
|
+
.transform((data) => ({
|
|
81
|
+
backgroundColor: data['backgroundColor'],
|
|
82
|
+
borderRadius: data['borderRadius'],
|
|
83
|
+
fontFamily: data['fontFamily'],
|
|
84
|
+
fontSize: data['fontSize'],
|
|
85
|
+
hover: data['hover'],
|
|
86
|
+
margin: data['margin'],
|
|
87
|
+
state: data['state'],
|
|
88
|
+
textColor: data['textColor'],
|
|
89
|
+
}));
|
|
90
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The shape of the model inside the application code - what the users use
|
|
5
|
+
*/
|
|
6
|
+
export const dialog = z.lazy(() => {
|
|
7
|
+
return z.object({
|
|
8
|
+
accentColor: z.string(),
|
|
9
|
+
backgroundColor: z.string(),
|
|
10
|
+
textColor: z.string(),
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @typedef {Dialog} dialog
|
|
17
|
+
* @property {string}
|
|
18
|
+
* @property {string}
|
|
19
|
+
* @property {string}
|
|
20
|
+
*/
|
|
21
|
+
export type Dialog = z.infer<typeof dialog>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The shape of the model mapping from the api schema into the application shape.
|
|
25
|
+
* Is equal to application shape if all property names match the api schema
|
|
26
|
+
*/
|
|
27
|
+
export const dialogResponse = z.lazy(() => {
|
|
28
|
+
return z
|
|
29
|
+
.object({
|
|
30
|
+
accentColor: z.string(),
|
|
31
|
+
backgroundColor: z.string(),
|
|
32
|
+
textColor: z.string(),
|
|
33
|
+
})
|
|
34
|
+
.transform((data) => ({
|
|
35
|
+
accentColor: data['accentColor'],
|
|
36
|
+
backgroundColor: data['backgroundColor'],
|
|
37
|
+
textColor: data['textColor'],
|
|
38
|
+
}));
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The shape of the model mapping from the application shape into the api schema.
|
|
43
|
+
* Is equal to application shape if all property names match the api schema
|
|
44
|
+
*/
|
|
45
|
+
export const dialogRequest = z.lazy(() => {
|
|
46
|
+
return z
|
|
47
|
+
.object({
|
|
48
|
+
accentColor: z.string(),
|
|
49
|
+
backgroundColor: z.string(),
|
|
50
|
+
textColor: z.string(),
|
|
51
|
+
})
|
|
52
|
+
.transform((data) => ({
|
|
53
|
+
accentColor: data['accentColor'],
|
|
54
|
+
backgroundColor: data['backgroundColor'],
|
|
55
|
+
textColor: data['textColor'],
|
|
56
|
+
}));
|
|
57
|
+
});
|