From 96a5a33ad61c8b7bb4e4eae535acc659632aa914 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Mon, 24 Jun 2024 22:39:36 +0800 Subject: [PATCH] feat: add feed page --- .../src/open/client/services.gen.ts | 95 +++++++++++ .../client-sdk/src/open/client/types.gen.ts | 119 ++++++++++++++ src/client/components/CodeBlock.tsx | 3 +- src/client/components/feed/FeedApiGuide.tsx | 36 ++++ .../components/feed/FeedChannelEditForm.tsx | 81 +++++++++ src/client/components/feed/FeedEventItem.tsx | 23 +++ .../components/layout/DesktopLayout.tsx | 7 + src/client/components/layout/MobileLayout.tsx | 7 + src/client/routeTree.gen.ts | 45 +++++ src/client/routes/feed.tsx | 88 ++++++++++ src/client/routes/feed/$channelId/edit.tsx | 110 +++++++++++++ src/client/routes/feed/$channelId/index.tsx | 103 ++++++++++++ src/client/routes/feed/add.tsx | 52 ++++++ src/client/routes/survey.tsx | 2 +- src/server/trpc/routers/feed.ts | 154 +++++++++++++++++- website/openapi.json | 2 +- 16 files changed, 923 insertions(+), 4 deletions(-) create mode 100644 src/client/components/feed/FeedApiGuide.tsx create mode 100644 src/client/components/feed/FeedChannelEditForm.tsx create mode 100644 src/client/components/feed/FeedEventItem.tsx create mode 100644 src/client/routes/feed.tsx create mode 100644 src/client/routes/feed/$channelId/edit.tsx create mode 100644 src/client/routes/feed/$channelId/index.tsx create mode 100644 src/client/routes/feed/add.tsx diff --git a/packages/client-sdk/src/open/client/services.gen.ts b/packages/client-sdk/src/open/client/services.gen.ts index 7905633..df46688 100644 --- a/packages/client-sdk/src/open/client/services.gen.ts +++ b/packages/client-sdk/src/open/client/services.gen.ts @@ -1167,6 +1167,45 @@ export class FeedService { }); } + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.channelId + * @returns unknown Successful response + * @throws ApiError + */ + public static feedChannelInfo(data: $OpenApiTs['/workspace/{workspaceId}/feed/{channelId}/info']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/feed/{channelId}/info']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/feed/{channelId}/info', + path: { + workspaceId: data.workspaceId, + channelId: data.channelId + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.channelId + * @param data.requestBody + * @returns unknown Successful response + * @throws ApiError + */ + public static feedUpdateChannelInfo(data: $OpenApiTs['/workspace/{workspaceId}/feed/{channelId}/update']['post']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/feed/{channelId}/update']['post']['res'][200]> { + return __request(OpenAPI, { + method: 'POST', + url: '/workspace/{workspaceId}/feed/{channelId}/update', + path: { + workspaceId: data.workspaceId, + channelId: data.channelId + }, + body: data.requestBody, + mediaType: 'application/json' + }); + } + /** * @param data The data for the request. * @param data.workspaceId @@ -1185,4 +1224,60 @@ export class FeedService { }); } + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.requestBody + * @returns unknown Successful response + * @throws ApiError + */ + public static feedCreateChannel(data: $OpenApiTs['/workspace/{workspaceId}/feed/createChannel']['post']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/feed/createChannel']['post']['res'][200]> { + return __request(OpenAPI, { + method: 'POST', + url: '/workspace/{workspaceId}/feed/createChannel', + path: { + workspaceId: data.workspaceId + }, + body: data.requestBody, + mediaType: 'application/json' + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.channelId + * @returns unknown Successful response + * @throws ApiError + */ + public static feedDeleteChannel(data: $OpenApiTs['/workspace/{workspaceId}/feed/{channelId}']['delete']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/feed/{channelId}']['delete']['res'][200]> { + return __request(OpenAPI, { + method: 'DELETE', + url: '/workspace/{workspaceId}/feed/{channelId}', + path: { + workspaceId: data.workspaceId, + channelId: data.channelId + } + }); + } + + /** + * @param data The data for the request. + * @param data.channelId + * @param data.requestBody + * @returns unknown Successful response + * @throws ApiError + */ + public static feedSendEvent(data: $OpenApiTs['/feed/{channelId}/send']['post']['req']): CancelablePromise<$OpenApiTs['/feed/{channelId}/send']['post']['res'][200]> { + return __request(OpenAPI, { + method: 'POST', + url: '/feed/{channelId}/send', + path: { + channelId: data.channelId + }, + body: data.requestBody, + mediaType: 'application/json' + }); + } + } \ No newline at end of file diff --git a/packages/client-sdk/src/open/client/types.gen.ts b/packages/client-sdk/src/open/client/types.gen.ts index 9eb2690..1a16b1f 100644 --- a/packages/client-sdk/src/open/client/types.gen.ts +++ b/packages/client-sdk/src/open/client/types.gen.ts @@ -1397,6 +1397,49 @@ export type $OpenApiTs = { }; }; }; + '/workspace/{workspaceId}/feed/{channelId}/info': { + get: { + req: { + channelId: string; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + id: string; + workspaceId: string; + name: string; + createdAt: string; + updatedAt: string; + } | null; + }; + }; + }; + '/workspace/{workspaceId}/feed/{channelId}/update': { + post: { + req: { + channelId: string; + requestBody: { + name: string; + }; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + id: string; + workspaceId: string; + name: string; + createdAt: string; + updatedAt: string; + } | null; + }; + }; + }; '/workspace/{workspaceId}/feed/{channelId}/events': { get: { req: { @@ -1423,4 +1466,80 @@ export type $OpenApiTs = { }; }; }; + '/workspace/{workspaceId}/feed/createChannel': { + post: { + req: { + requestBody: { + name: string; + }; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + id: string; + workspaceId: string; + name: string; + createdAt: string; + updatedAt: string; + }; + }; + }; + }; + '/workspace/{workspaceId}/feed/{channelId}': { + delete: { + req: { + channelId: string; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + id: string; + workspaceId: string; + name: string; + createdAt: string; + updatedAt: string; + }; + }; + }; + }; + '/feed/{channelId}/send': { + post: { + req: { + channelId: string; + requestBody: { + eventName: string; + eventContent: string; + tags: Array<(string)>; + source: string; + senderId?: string | null; + senderName?: string | null; + important: boolean; + }; + }; + res: { + /** + * Successful response + */ + 200: { + id: string; + channelId: string; + createdAt: string; + updatedAt: string; + eventName: string; + eventContent: string; + tags: Array<(string)>; + source: string; + senderId?: string | null; + senderName?: string | null; + important: boolean; + }; + }; + }; + }; }; \ No newline at end of file diff --git a/src/client/components/CodeBlock.tsx b/src/client/components/CodeBlock.tsx index ef77f19..0fa327b 100644 --- a/src/client/components/CodeBlock.tsx +++ b/src/client/components/CodeBlock.tsx @@ -4,6 +4,7 @@ import { Button } from './ui/button'; import { LuCopy, LuCopyCheck } from 'react-icons/lu'; import { toast } from 'sonner'; import { useTranslation } from '@i18next-toolkit/react'; +import { ScrollBar } from './ui/scroll-area'; export const CodeBlock: React.FC<{ code: string; @@ -20,7 +21,7 @@ export const CodeBlock: React.FC<{ }); return ( -
+
         {props.code}
       
diff --git a/src/client/components/feed/FeedApiGuide.tsx b/src/client/components/feed/FeedApiGuide.tsx new file mode 100644 index 0000000..eaf2284 --- /dev/null +++ b/src/client/components/feed/FeedApiGuide.tsx @@ -0,0 +1,36 @@ +import { Card, CardContent, CardHeader } from '@/components/ui/card'; +import React from 'react'; +import { CodeBlock } from '../CodeBlock'; +import { useTranslation } from '@i18next-toolkit/react'; + +export const FeedApiGuide: React.FC<{ channelId: string }> = React.memo( + (props) => { + const { t } = useTranslation(); + + const code = `fetch('${window.location.origin}/open/feed/${props.channelId}/send', { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + eventName: 'test name', + eventContent: 'test content', + tags: ['test'], + source: 'custom', + important: false, + }) +})`; + + return ( + + +
{t('You can send any message into this channel with:')}
+
+ + + +
+ ); + } +); +FeedApiGuide.displayName = 'FeedApiGuide'; diff --git a/src/client/components/feed/FeedChannelEditForm.tsx b/src/client/components/feed/FeedChannelEditForm.tsx new file mode 100644 index 0000000..f7cd4c0 --- /dev/null +++ b/src/client/components/feed/FeedChannelEditForm.tsx @@ -0,0 +1,81 @@ +import { useTranslation } from '@i18next-toolkit/react'; +import { Button } from '@/components/ui/button'; +import { useEventWithLoading } from '@/hooks/useEvent'; +import { Card, CardContent, CardFooter } from '@/components/ui/card'; +import { z } from 'zod'; +import { + Form, + FormControl, + FormDescription, + FormField, + FormItem, + FormLabel, + FormMessage, +} from '@/components/ui/form'; +import { Input } from '@/components/ui/input'; +import { useForm } from 'react-hook-form'; +import { zodResolver } from '@hookform/resolvers/zod'; +import React from 'react'; + +const addFormSchema = z.object({ + name: z.string(), +}); + +export type FeedChannelEditFormValues = z.infer; + +interface FeedChannelEditFormProps { + defaultValues?: FeedChannelEditFormValues; + onSubmit: (values: FeedChannelEditFormValues) => Promise; +} +export const FeedChannelEditForm: React.FC = + React.memo((props) => { + const { t } = useTranslation(); + + const form = useForm({ + resolver: zodResolver(addFormSchema), + defaultValues: props.defaultValues ?? { + name: 'New Channel', + }, + }); + + const [handleSubmit, isLoading] = useEventWithLoading( + async (values: FeedChannelEditFormValues) => { + await props.onSubmit(values); + form.reset(); + } + ); + + return ( +
+ + + + ( + + {t('Channel Name')} + + + + + {t('Channel Name to Display')} + + + + )} + /> + + + + + + +
+ + ); + }); +FeedChannelEditForm.displayName = 'FeedChannelEditForm'; diff --git a/src/client/components/feed/FeedEventItem.tsx b/src/client/components/feed/FeedEventItem.tsx new file mode 100644 index 0000000..b6ca08c --- /dev/null +++ b/src/client/components/feed/FeedEventItem.tsx @@ -0,0 +1,23 @@ +import { AppRouterOutput } from '@/api/trpc'; +import React from 'react'; +import { Badge } from '../ui/badge'; + +type FeedEventItemType = AppRouterOutput['feed']['events'][number]; + +export const FeedEventItem: React.FC<{ event: FeedEventItemType }> = React.memo( + ({ event }) => { + return ( +
+
{event.eventName}
+
+ {event.source} + + {event.tags.map((tag) => ( + {tag} + ))} +
+
+ ); + } +); +FeedEventItem.displayName = 'FeedEventItem'; diff --git a/src/client/components/layout/DesktopLayout.tsx b/src/client/components/layout/DesktopLayout.tsx index f0ad33a..e4811d2 100644 --- a/src/client/components/layout/DesktopLayout.tsx +++ b/src/client/components/layout/DesktopLayout.tsx @@ -1,5 +1,6 @@ import * as React from 'react'; import { + LuActivitySquare, LuAreaChart, LuFilePieChart, LuMonitorDot, @@ -103,6 +104,12 @@ export const DesktopLayout: React.FC = React.memo((props) => { icon: RiSurveyLine, to: '/survey', }, + { + title: t('Feed'), + label: '', + icon: LuActivitySquare, + to: '/feed', + }, ]} /> diff --git a/src/client/components/layout/MobileLayout.tsx b/src/client/components/layout/MobileLayout.tsx index 2809b2d..35b0adf 100644 --- a/src/client/components/layout/MobileLayout.tsx +++ b/src/client/components/layout/MobileLayout.tsx @@ -1,5 +1,6 @@ import React from 'react'; import { + LuActivitySquare, LuAreaChart, LuFilePieChart, LuMonitorDot, @@ -79,6 +80,12 @@ export const MobileLayout: React.FC = React.memo((props) => { to="/survey" extraModal={true} /> +
diff --git a/src/client/routeTree.gen.ts b/src/client/routeTree.gen.ts index 2caf249..67a7f9e 100644 --- a/src/client/routeTree.gen.ts +++ b/src/client/routeTree.gen.ts @@ -20,6 +20,7 @@ import { Route as RegisterImport } from './routes/register' import { Route as PageImport } from './routes/page' import { Route as MonitorImport } from './routes/monitor' import { Route as LoginImport } from './routes/login' +import { Route as FeedImport } from './routes/feed' import { Route as DashboardImport } from './routes/dashboard' import { Route as IndexImport } from './routes/index' import { Route as WebsiteOverviewImport } from './routes/website/overview' @@ -35,12 +36,15 @@ import { Route as SettingsAuditLogImport } from './routes/settings/auditLog' import { Route as PageAddImport } from './routes/page/add' import { Route as PageSlugImport } from './routes/page/$slug' import { Route as MonitorAddImport } from './routes/monitor/add' +import { Route as FeedAddImport } from './routes/feed/add' import { Route as WebsiteWebsiteIdIndexImport } from './routes/website/$websiteId/index' import { Route as SurveySurveyIdIndexImport } from './routes/survey/$surveyId/index' import { Route as MonitorMonitorIdIndexImport } from './routes/monitor/$monitorId/index' +import { Route as FeedChannelIdIndexImport } from './routes/feed/$channelId/index' import { Route as WebsiteWebsiteIdConfigImport } from './routes/website/$websiteId/config' import { Route as SurveySurveyIdEditImport } from './routes/survey/$surveyId/edit' import { Route as MonitorMonitorIdEditImport } from './routes/monitor/$monitorId/edit' +import { Route as FeedChannelIdEditImport } from './routes/feed/$channelId/edit' // Create/Update Routes @@ -89,6 +93,11 @@ const LoginRoute = LoginImport.update({ getParentRoute: () => rootRoute, } as any) +const FeedRoute = FeedImport.update({ + path: '/feed', + getParentRoute: () => rootRoute, +} as any) + const DashboardRoute = DashboardImport.update({ path: '/dashboard', getParentRoute: () => rootRoute, @@ -164,6 +173,11 @@ const MonitorAddRoute = MonitorAddImport.update({ getParentRoute: () => MonitorRoute, } as any) +const FeedAddRoute = FeedAddImport.update({ + path: '/add', + getParentRoute: () => FeedRoute, +} as any) + const WebsiteWebsiteIdIndexRoute = WebsiteWebsiteIdIndexImport.update({ path: '/$websiteId/', getParentRoute: () => WebsiteRoute, @@ -179,6 +193,11 @@ const MonitorMonitorIdIndexRoute = MonitorMonitorIdIndexImport.update({ getParentRoute: () => MonitorRoute, } as any) +const FeedChannelIdIndexRoute = FeedChannelIdIndexImport.update({ + path: '/$channelId/', + getParentRoute: () => FeedRoute, +} as any) + const WebsiteWebsiteIdConfigRoute = WebsiteWebsiteIdConfigImport.update({ path: '/$websiteId/config', getParentRoute: () => WebsiteRoute, @@ -194,6 +213,11 @@ const MonitorMonitorIdEditRoute = MonitorMonitorIdEditImport.update({ getParentRoute: () => MonitorRoute, } as any) +const FeedChannelIdEditRoute = FeedChannelIdEditImport.update({ + path: '/$channelId/edit', + getParentRoute: () => FeedRoute, +} as any) + // Populate the FileRoutesByPath interface declare module '@tanstack/react-router' { @@ -206,6 +230,10 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof DashboardImport parentRoute: typeof rootRoute } + '/feed': { + preLoaderRoute: typeof FeedImport + parentRoute: typeof rootRoute + } '/login': { preLoaderRoute: typeof LoginImport parentRoute: typeof rootRoute @@ -242,6 +270,10 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof WebsiteImport parentRoute: typeof rootRoute } + '/feed/add': { + preLoaderRoute: typeof FeedAddImport + parentRoute: typeof FeedImport + } '/monitor/add': { preLoaderRoute: typeof MonitorAddImport parentRoute: typeof MonitorImport @@ -294,6 +326,10 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof WebsiteOverviewImport parentRoute: typeof WebsiteImport } + '/feed/$channelId/edit': { + preLoaderRoute: typeof FeedChannelIdEditImport + parentRoute: typeof FeedImport + } '/monitor/$monitorId/edit': { preLoaderRoute: typeof MonitorMonitorIdEditImport parentRoute: typeof MonitorImport @@ -306,6 +342,10 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof WebsiteWebsiteIdConfigImport parentRoute: typeof WebsiteImport } + '/feed/$channelId/': { + preLoaderRoute: typeof FeedChannelIdIndexImport + parentRoute: typeof FeedImport + } '/monitor/$monitorId/': { preLoaderRoute: typeof MonitorMonitorIdIndexImport parentRoute: typeof MonitorImport @@ -326,6 +366,11 @@ declare module '@tanstack/react-router' { export const routeTree = rootRoute.addChildren([ IndexRoute, DashboardRoute, + FeedRoute.addChildren([ + FeedAddRoute, + FeedChannelIdEditRoute, + FeedChannelIdIndexRoute, + ]), LoginRoute, MonitorRoute.addChildren([ MonitorAddRoute, diff --git a/src/client/routes/feed.tsx b/src/client/routes/feed.tsx new file mode 100644 index 0000000..61b9221 --- /dev/null +++ b/src/client/routes/feed.tsx @@ -0,0 +1,88 @@ +import { trpc } from '@/api/trpc'; +import { CommonHeader } from '@/components/CommonHeader'; +import { CommonList } from '@/components/CommonList'; +import { CommonWrapper } from '@/components/CommonWrapper'; +import { Button } from '@/components/ui/button'; +import { useDataReady } from '@/hooks/useDataReady'; +import { useEvent } from '@/hooks/useEvent'; +import { Layout } from '@/components/layout'; +import { useCurrentWorkspaceId } from '@/store/user'; +import { routeAuthBeforeLoad } from '@/utils/route'; +import { cn } from '@/utils/style'; +import { useTranslation } from '@i18next-toolkit/react'; +import { + createFileRoute, + useNavigate, + useRouterState, +} from '@tanstack/react-router'; +import { LuPlus } from 'react-icons/lu'; + +export const Route = createFileRoute('/feed')({ + beforeLoad: routeAuthBeforeLoad, + component: PageComponent, +}); + +function PageComponent() { + const workspaceId = useCurrentWorkspaceId(); + const { t } = useTranslation(); + const { data: channels = [], isLoading } = trpc.feed.channels.useQuery({ + workspaceId, + }); + const navigate = useNavigate(); + const pathname = useRouterState({ + select: (state) => state.location.pathname, + }); + + const items = channels.map((item) => ({ + id: item.id, + title: item.name, + number: item._count.events ?? 0, + href: `/feed/${item.id}`, + })); + + useDataReady( + () => channels.length > 0, + () => { + if (pathname === Route.fullPath) { + navigate({ + to: '/feed/$channelId', + params: { + channelId: channels[0].id, + }, + }); + } + } + ); + + const handleClickAdd = useEvent(() => { + navigate({ + to: '/feed/add', + }); + }); + + return ( + + {t('Add')} + + } + /> + } + > + + + } + /> + ); +} diff --git a/src/client/routes/feed/$channelId/edit.tsx b/src/client/routes/feed/$channelId/edit.tsx new file mode 100644 index 0000000..ac8bf17 --- /dev/null +++ b/src/client/routes/feed/$channelId/edit.tsx @@ -0,0 +1,110 @@ +import { createFileRoute, useNavigate } from '@tanstack/react-router'; +import { useTranslation } from '@i18next-toolkit/react'; +import { useEvent } from '@/hooks/useEvent'; +import { useCurrentWorkspaceId } from '@/store/user'; +import { defaultErrorHandler, trpc } from '@/api/trpc'; +import { Card, CardContent } from '@/components/ui/card'; +import { CommonWrapper } from '@/components/CommonWrapper'; +import { routeAuthBeforeLoad } from '@/utils/route'; +import { Loading } from '@/components/Loading'; +import { ErrorTip } from '@/components/ErrorTip'; +import { CommonHeader } from '@/components/CommonHeader'; +import { ScrollArea } from '@/components/ui/scroll-area'; +import { + FeedChannelEditForm, + FeedChannelEditFormValues, +} from '@/components/feed/FeedChannelEditForm'; + +export const Route = createFileRoute('/feed/$channelId/edit')({ + beforeLoad: routeAuthBeforeLoad, + component: PageComponent, +}); + +function PageComponent() { + const { t } = useTranslation(); + const { channelId } = Route.useParams<{ channelId: string }>(); + const workspaceId = useCurrentWorkspaceId(); + const navigate = useNavigate(); + const mutation = trpc.feed.updateChannelInfo.useMutation({ + onError: defaultErrorHandler, + }); + const { data: channel, isLoading } = trpc.feed.channelInfo.useQuery({ + workspaceId, + channelId, + }); + const trpcUtils = trpc.useUtils(); + + const handleSubmit = useEvent(async (values: FeedChannelEditFormValues) => { + const res = await mutation.mutateAsync({ + ...values, + channelId, + workspaceId, + }); + + trpcUtils.feed.channelInfo.setData( + { + channelId, + workspaceId, + }, + res + ); + trpcUtils.feed.channels.setData( + { + workspaceId, + }, + (prev) => { + if (prev) { + const index = prev.findIndex((item) => item.id === channelId); + if (index >= 0) { + prev[index] = { + ...prev[index], + ...res, + }; + } + } + + return prev; + } + ); + + if (res) { + navigate({ + to: '/feed/$channelId', + params: { + channelId: res.id, + }, + replace: true, + }); + } else { + navigate({ + to: '/feed', + replace: true, + }); + } + }); + + if (isLoading) { + return ; + } + + if (!channel) { + return ; + } + + return ( + } + > + + + + + + + + + ); +} diff --git a/src/client/routes/feed/$channelId/index.tsx b/src/client/routes/feed/$channelId/index.tsx new file mode 100644 index 0000000..7a50dcf --- /dev/null +++ b/src/client/routes/feed/$channelId/index.tsx @@ -0,0 +1,103 @@ +import { + AppRouterOutput, + defaultErrorHandler, + defaultSuccessHandler, + trpc, +} from '@/api/trpc'; +import { CommonHeader } from '@/components/CommonHeader'; +import { CommonWrapper } from '@/components/CommonWrapper'; +import { ScrollArea } from '@/components/ui/scroll-area'; +import { useCurrentWorkspaceId } from '@/store/user'; +import { routeAuthBeforeLoad } from '@/utils/route'; +import { useTranslation } from '@i18next-toolkit/react'; +import { createFileRoute, useNavigate } from '@tanstack/react-router'; +import { useEvent } from '@/hooks/useEvent'; +import { AlertConfirm } from '@/components/AlertConfirm'; +import { LuPencil, LuTrash } from 'react-icons/lu'; +import { Button } from '@/components/ui/button'; +import { Scrollbar } from '@radix-ui/react-scroll-area'; +import { Empty } from 'antd'; +import { FeedApiGuide } from '@/components/feed/FeedApiGuide'; +import { FeedEventItem } from '@/components/feed/FeedEventItem'; + +export const Route = createFileRoute('/feed/$channelId/')({ + beforeLoad: routeAuthBeforeLoad, + component: PageComponent, +}); + +function PageComponent() { + const { channelId } = Route.useParams<{ channelId: string }>(); + const workspaceId = useCurrentWorkspaceId(); + const { t } = useTranslation(); + const { data: info } = trpc.feed.channelInfo.useQuery({ + workspaceId, + channelId, + }); + const { data: events } = trpc.feed.events.useQuery({ + workspaceId, + channelId, + }); + const deleteMutation = trpc.feed.deleteChannel.useMutation({ + onSuccess: defaultSuccessHandler, + onError: defaultErrorHandler, + }); + const trpcUtils = trpc.useUtils(); + const navigate = useNavigate(); + + const handleDelete = useEvent(async () => { + await deleteMutation.mutateAsync({ workspaceId, channelId }); + trpcUtils.feed.channels.refetch(); + navigate({ + to: '/feed', + replace: true, + }); + }); + + return ( + +
+ } + /> + } + > + {events && events.length === 0 ? ( +
+ +
+ ) : ( + + {(events ?? []).map((event) => ( + + ))} + + )} + + ); +} diff --git a/src/client/routes/feed/add.tsx b/src/client/routes/feed/add.tsx new file mode 100644 index 0000000..678b073 --- /dev/null +++ b/src/client/routes/feed/add.tsx @@ -0,0 +1,52 @@ +import { createFileRoute, useNavigate } from '@tanstack/react-router'; +import { useTranslation } from '@i18next-toolkit/react'; +import { useEvent } from '@/hooks/useEvent'; +import { useCurrentWorkspaceId } from '@/store/user'; +import { defaultErrorHandler, trpc } from '@/api/trpc'; +import { CommonWrapper } from '@/components/CommonWrapper'; +import { routeAuthBeforeLoad } from '@/utils/route'; +import { + FeedChannelEditForm, + FeedChannelEditFormValues, +} from '@/components/feed/FeedChannelEditForm'; + +export const Route = createFileRoute('/feed/add')({ + beforeLoad: routeAuthBeforeLoad, + component: PageComponent, +}); + +function PageComponent() { + const { t } = useTranslation(); + const workspaceId = useCurrentWorkspaceId(); + const createMutation = trpc.feed.createChannel.useMutation({ + onError: defaultErrorHandler, + }); + const utils = trpc.useUtils(); + const navigate = useNavigate(); + + const onSubmit = useEvent(async (values: FeedChannelEditFormValues) => { + const res = await createMutation.mutateAsync({ + workspaceId, + name: values.name, + }); + + utils.feed.channels.refetch(); + + navigate({ + to: '/feed/$channelId', + params: { + channelId: res.id, + }, + }); + }); + + return ( + {t('Add Channel')}} + > +
+ +
+
+ ); +} diff --git a/src/client/routes/survey.tsx b/src/client/routes/survey.tsx index 406a82a..6650a10 100644 --- a/src/client/routes/survey.tsx +++ b/src/client/routes/survey.tsx @@ -9,7 +9,7 @@ import { Layout } from '@/components/layout'; import { useCurrentWorkspaceId } from '@/store/user'; import { routeAuthBeforeLoad } from '@/utils/route'; import { cn } from '@/utils/style'; -import { Trans, useTranslation } from '@i18next-toolkit/react'; +import { useTranslation } from '@i18next-toolkit/react'; import { createFileRoute, useNavigate, diff --git a/src/server/trpc/routers/feed.ts b/src/server/trpc/routers/feed.ts index be19e26..03686c7 100644 --- a/src/server/trpc/routers/feed.ts +++ b/src/server/trpc/routers/feed.ts @@ -1,5 +1,11 @@ import { z } from 'zod'; -import { OpenApiMetaInfo, router, workspaceProcedure } from '../trpc'; +import { + OpenApiMetaInfo, + publicProcedure, + router, + workspaceOwnerProcedure, + workspaceProcedure, +} from '../trpc'; import { OPENAPI_TAG } from '../../utils/const'; import { OpenApiMeta } from 'trpc-openapi'; import { FeedChannelModelSchema, FeedEventModelSchema } from '../../prisma/zod'; @@ -43,6 +49,65 @@ export const feedRouter = router({ return channels; }), + channelInfo: workspaceProcedure + .meta( + buildFeedOpenapi({ + method: 'GET', + path: '/{channelId}/info', + }) + ) + .input( + z.object({ + channelId: z.string(), + }) + ) + .output(FeedChannelModelSchema.nullable()) + .query(async ({ input }) => { + const { channelId, workspaceId } = input; + + const channel = prisma.feedChannel.findFirst({ + where: { + workspaceId, + id: channelId, + }, + }); + + return channel; + }), + updateChannelInfo: workspaceProcedure + .meta( + buildFeedOpenapi({ + method: 'POST', + path: '/{channelId}/update', + }) + ) + .input( + z + .object({ + channelId: z.string(), + }) + .merge( + FeedChannelModelSchema.pick({ + name: true, + }) + ) + ) + .output(FeedChannelModelSchema.nullable()) + .mutation(async ({ input }) => { + const { channelId, workspaceId, name } = input; + + const channel = prisma.feedChannel.update({ + where: { + workspaceId, + id: channelId, + }, + data: { + name, + }, + }); + + return channel; + }), events: workspaceProcedure .meta( buildFeedOpenapi({ @@ -67,6 +132,93 @@ export const feedRouter = router({ return events; }), + createChannel: workspaceOwnerProcedure + .meta( + buildFeedOpenapi({ + method: 'POST', + path: '/createChannel', + }) + ) + .input( + FeedChannelModelSchema.pick({ + name: true, + }) + ) + .output(FeedChannelModelSchema) + .mutation(async ({ input }) => { + const { name, workspaceId } = input; + + const channel = await prisma.feedChannel.create({ + data: { + workspaceId, + name, + }, + }); + + return channel; + }), + deleteChannel: workspaceOwnerProcedure + .meta( + buildFeedOpenapi({ + method: 'DELETE', + path: '/{channelId}', + }) + ) + .input( + z.object({ + channelId: z.string(), + }) + ) + .output(FeedChannelModelSchema) + .mutation(async ({ input }) => { + const { channelId, workspaceId } = input; + + const channel = await prisma.feedChannel.delete({ + where: { + workspaceId, + id: channelId, + }, + }); + + return channel; + }), + sendEvent: publicProcedure + .meta({ + openapi: { + tags: [OPENAPI_TAG.FEED], + protect: false, + method: 'POST', + path: '/feed/{channelId}/send', + }, + }) + .input( + FeedEventModelSchema.pick({ + eventName: true, + eventContent: true, + tags: true, + source: true, + senderId: true, + senderName: true, + important: true, + }).merge( + z.object({ + channelId: z.string(), + }) + ) + ) + .output(FeedEventModelSchema) + .mutation(async ({ input }) => { + const { channelId, ...data } = input; + + const event = await prisma.feedEvent.create({ + data: { + ...data, + channelId: channelId, + }, + }); + + return event; + }), }); function buildFeedOpenapi(meta: OpenApiMetaInfo): OpenApiMeta { diff --git a/website/openapi.json b/website/openapi.json index 2e06b4a..ef5f2b6 100644 --- a/website/openapi.json +++ b/website/openapi.json @@ -1 +1 @@ -{"openapi":"3.0.3","info":{"title":"Tianji OpenAPI","description":"

Insight into everything

\n

Github: https://github.com/msgbyte/tianji

","version":"v1.11.4"},"servers":[{"url":"/open"}],"paths":{"/global/config":{"get":{"operationId":"global-config","description":"Get Tianji system global config","tags":["Global"],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"allowRegister":{"type":"boolean"},"websiteId":{"type":"string"},"amapToken":{"type":"string"},"mapboxToken":{"type":"string"},"alphaMode":{"type":"boolean"},"disableAnonymousTelemetry":{"type":"boolean"},"customTrackerScriptName":{"type":"string"}},"required":["allowRegister","alphaMode","disableAnonymousTelemetry"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/login":{"post":{"operationId":"user-login","tags":["User"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"username":{"type":"string"},"password":{"type":"string"}},"required":["username","password"],"additionalProperties":false}}}},"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"info":{"type":"object","properties":{"username":{"type":"string"},"id":{"type":"string"},"role":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time","nullable":true},"currentWorkspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"dashboardLayout":{"type":"object","properties":{"layouts":{"type":"object","additionalProperties":{"type":"array"}},"items":{"type":"array"}},"required":["layouts","items"],"additionalProperties":false,"nullable":true}},"required":["id","name","dashboardLayout"],"additionalProperties":false},"workspaces":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"workspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false}},"required":["role","workspace"],"additionalProperties":false}}},"required":["username","id","role","createdAt","updatedAt","deletedAt","currentWorkspace","workspaces"],"additionalProperties":false},"token":{"type":"string"}},"required":["info","token"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/loginWithToken":{"post":{"operationId":"user-loginWithToken","tags":["User"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"}},"required":["token"],"additionalProperties":false}}}},"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"info":{"type":"object","properties":{"username":{"type":"string"},"id":{"type":"string"},"role":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time","nullable":true},"currentWorkspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"dashboardLayout":{"type":"object","properties":{"layouts":{"type":"object","additionalProperties":{"type":"array"}},"items":{"type":"array"}},"required":["layouts","items"],"additionalProperties":false,"nullable":true}},"required":["id","name","dashboardLayout"],"additionalProperties":false},"workspaces":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"workspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false}},"required":["role","workspace"],"additionalProperties":false}}},"required":["username","id","role","createdAt","updatedAt","deletedAt","currentWorkspace","workspaces"],"additionalProperties":false},"token":{"type":"string"}},"required":["info","token"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/getServiceCount":{"get":{"operationId":"workspace-getServiceCount","tags":["Workspace"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"website":{"type":"number"},"monitor":{"type":"number"},"server":{"type":"number"},"telemetry":{"type":"number"},"page":{"type":"number"},"survey":{"type":"number"}},"required":["website","monitor","server","telemetry","page","survey"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/website/{websiteId}/onlineCount":{"get":{"operationId":"website-onlineCount","tags":["Website"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"websiteId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"number"}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/website/all":{"get":{"operationId":"website-all","tags":["Website"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"domain":{"type":"string","nullable":true},"shareId":{"type":"string","nullable":true},"resetAt":{"type":"string","format":"date-time","nullable":true},"monitorId":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","workspaceId","name","domain","shareId","resetAt","monitorId","createdAt","updatedAt","deletedAt"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/website/allOverview":{"get":{"operationId":"website-allOverview","tags":["Website"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"number"}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/website/{websiteId}/info":{"get":{"operationId":"website-info","tags":["Website"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"websiteId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"domain":{"type":"string","nullable":true},"shareId":{"type":"string","nullable":true},"resetAt":{"type":"string","format":"date-time","nullable":true},"monitorId":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","workspaceId","name","domain","shareId","resetAt","monitorId","createdAt","updatedAt","deletedAt"],"additionalProperties":false,"nullable":true}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/website/{websiteId}/stats":{"get":{"operationId":"website-stats","tags":["Website"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"websiteId","in":"path","required":true,"schema":{"type":"string"}},{"name":"startAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"endAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"unit","in":"query","required":false,"schema":{"type":"string"}},{"name":"url","in":"query","required":false,"schema":{"type":"string"}},{"name":"country","in":"query","required":false,"schema":{"type":"string"}},{"name":"region","in":"query","required":false,"schema":{"type":"string"}},{"name":"city","in":"query","required":false,"schema":{"type":"string"}},{"name":"timezone","in":"query","required":false,"schema":{"type":"string"}},{"name":"referrer","in":"query","required":false,"schema":{"type":"string"}},{"name":"title","in":"query","required":false,"schema":{"type":"string"}},{"name":"os","in":"query","required":false,"schema":{"type":"string"}},{"name":"browser","in":"query","required":false,"schema":{"type":"string"}},{"name":"device","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"pageviews":{"type":"object","properties":{"value":{"type":"number"},"prev":{"type":"number"}},"required":["value","prev"],"additionalProperties":false},"uniques":{"type":"object","properties":{"value":{"type":"number"},"prev":{"type":"number"}},"required":["value","prev"],"additionalProperties":false},"totaltime":{"type":"object","properties":{"value":{"type":"number"},"prev":{"type":"number"}},"required":["value","prev"],"additionalProperties":false},"bounces":{"type":"object","properties":{"value":{"type":"number"},"prev":{"type":"number"}},"required":["value","prev"],"additionalProperties":false}},"required":["pageviews","uniques","totaltime","bounces"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/website/{websiteId}/geoStats":{"get":{"operationId":"website-geoStats","tags":["Website"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"websiteId","in":"path","required":true,"schema":{"type":"string"}},{"name":"startAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"endAt","in":"query","required":true,"schema":{"type":"number"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"longitude":{"type":"number"},"latitude":{"type":"number"},"count":{"type":"number"}},"required":["longitude","latitude","count"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/website/{websiteId}/pageviews":{"get":{"operationId":"website-pageviews","tags":["Website"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"websiteId","in":"path","required":true,"schema":{"type":"string"}},{"name":"startAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"endAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"unit","in":"query","required":false,"schema":{"type":"string"}},{"name":"url","in":"query","required":false,"schema":{"type":"string"}},{"name":"country","in":"query","required":false,"schema":{"type":"string"}},{"name":"region","in":"query","required":false,"schema":{"type":"string"}},{"name":"city","in":"query","required":false,"schema":{"type":"string"}},{"name":"timezone","in":"query","required":false,"schema":{"type":"string"}},{"name":"referrer","in":"query","required":false,"schema":{"type":"string"}},{"name":"title","in":"query","required":false,"schema":{"type":"string"}},{"name":"os","in":"query","required":false,"schema":{"type":"string"}},{"name":"browser","in":"query","required":false,"schema":{"type":"string"}},{"name":"device","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"pageviews":{},"sessions":{}},"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/website/{websiteId}/metrics":{"get":{"operationId":"website-metrics","tags":["Website"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"websiteId","in":"path","required":true,"schema":{"type":"string"}},{"name":"type","in":"query","required":true,"schema":{"type":"string","enum":["url","language","referrer","title","browser","os","device","country","event"]}},{"name":"startAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"endAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"url","in":"query","required":false,"schema":{"type":"string"}},{"name":"referrer","in":"query","required":false,"schema":{"type":"string"}},{"name":"title","in":"query","required":false,"schema":{"type":"string"}},{"name":"os","in":"query","required":false,"schema":{"type":"string"}},{"name":"browser","in":"query","required":false,"schema":{"type":"string"}},{"name":"device","in":"query","required":false,"schema":{"type":"string"}},{"name":"country","in":"query","required":false,"schema":{"type":"string"}},{"name":"region","in":"query","required":false,"schema":{"type":"string"}},{"name":"city","in":"query","required":false,"schema":{"type":"string"}},{"name":"language","in":"query","required":false,"schema":{"type":"string"}},{"name":"event","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"x":{"type":"string","nullable":true},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/website/add":{"post":{"operationId":"website-add","tags":["Website"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":100},"domain":{"anyOf":[{"type":"string","maxLength":500,"pattern":"^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9])$"},{"type":"string","maxLength":500,"anyOf":[{"format":"ipv4"},{"format":"ipv6"}]}]}},"required":["name","domain"],"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"domain":{"type":"string","nullable":true},"shareId":{"type":"string","nullable":true},"resetAt":{"type":"string","format":"date-time","nullable":true},"monitorId":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","workspaceId","name","domain","shareId","resetAt","monitorId","createdAt","updatedAt","deletedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/website/{websiteId}/update":{"put":{"operationId":"website-updateInfo","tags":["Website"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":100},"domain":{"anyOf":[{"type":"string","maxLength":500,"pattern":"^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9])$"},{"type":"string","maxLength":500,"anyOf":[{"format":"ipv4"},{"format":"ipv6"}]}]},"monitorId":{"type":"string","pattern":"^[a-z][a-z0-9]*$","nullable":true}},"required":["name","domain"],"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"websiteId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"domain":{"type":"string","nullable":true},"shareId":{"type":"string","nullable":true},"resetAt":{"type":"string","format":"date-time","nullable":true},"monitorId":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","workspaceId","name","domain","shareId","resetAt","monitorId","createdAt","updatedAt","deletedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/all":{"get":{"operationId":"monitor-all","tags":["Monitor"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"active":{"type":"boolean"},"interval":{"type":"integer"},"maxRetries":{"type":"integer"},"payload":{"type":"object","additionalProperties":{}},"trendingMode":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"notifications":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false}}},"required":["id","workspaceId","name","type","active","interval","maxRetries","payload","trendingMode","createdAt","updatedAt","notifications"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/{monitorId}":{"get":{"operationId":"monitor-get","tags":["Monitor"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"monitorId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"active":{"type":"boolean"},"interval":{"type":"integer"},"maxRetries":{"type":"integer"},"payload":{"type":"object","additionalProperties":{}},"trendingMode":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"notifications":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false}}},"required":["id","workspaceId","name","type","active","interval","maxRetries","payload","trendingMode","createdAt","updatedAt","notifications"],"additionalProperties":false,"nullable":true}}}},"default":{"$ref":"#/components/responses/error"}}},"delete":{"operationId":"monitor-delete","tags":["Monitor"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"monitorId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"active":{"type":"boolean"},"interval":{"type":"integer"},"maxRetries":{"type":"integer"},"payload":{"type":"object","additionalProperties":{}},"trendingMode":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","type","active","interval","maxRetries","payload","trendingMode","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/monitor/getPublicInfo":{"post":{"operationId":"monitor-getPublicInfo","tags":["Monitor"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"monitorIds":{"type":"array","items":{"type":"string"}}},"required":["monitorIds"],"additionalProperties":false}}}},"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"}},"required":["id","name","type"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/upsert":{"post":{"operationId":"monitor-upsert","tags":["Monitor"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9]*$"},"name":{"type":"string"},"type":{"type":"string"},"active":{"type":"boolean","default":true},"interval":{"type":"integer","minimum":5,"maximum":10000,"default":20},"maxRetries":{"type":"integer","minimum":0,"maximum":10,"default":0},"trendingMode":{"type":"boolean","default":false},"notificationIds":{"type":"array","items":{"type":"string"},"default":[]},"payload":{"type":"object","properties":{},"additionalProperties":true}},"required":["name","type","payload"],"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"active":{"type":"boolean"},"interval":{"type":"integer"},"maxRetries":{"type":"integer"},"payload":{"type":"object","additionalProperties":{}},"trendingMode":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","type","active","interval","maxRetries","payload","trendingMode","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/{monitorId}/data":{"get":{"operationId":"monitor-data","tags":["Monitor"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"monitorId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"startAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"endAt","in":"query","required":true,"schema":{"type":"number"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"value":{"type":"number"},"createdAt":{"type":"string","format":"date-time"}},"required":["value","createdAt"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/{monitorId}/changeActive":{"patch":{"operationId":"monitor-changeActive","tags":["Monitor"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"active":{"type":"boolean"}},"required":["active"],"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"monitorId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"active":{"type":"boolean"},"interval":{"type":"integer"},"maxRetries":{"type":"integer"},"payload":{"type":"object","additionalProperties":{}},"trendingMode":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","type","active","interval","maxRetries","payload","trendingMode","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/{monitorId}/recentData":{"get":{"operationId":"monitor-recentData","tags":["Monitor"],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"monitorId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"take","in":"query","required":true,"schema":{"type":"number"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"value":{"type":"number"},"createdAt":{"type":"string","format":"date-time"}},"required":["value","createdAt"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/{monitorId}/dataMetrics":{"get":{"operationId":"monitor-dataMetrics","tags":["Monitor"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"monitorId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"recent1DayAvg":{"type":"number"},"recent1DayOnlineCount":{"type":"number"},"recent1DayOfflineCount":{"type":"number"},"recent30DayOnlineCount":{"type":"number"},"recent30DayOfflineCount":{"type":"number"}},"required":["recent1DayAvg","recent1DayOnlineCount","recent1DayOfflineCount","recent30DayOnlineCount","recent30DayOfflineCount"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/events":{"get":{"operationId":"monitor-events","tags":["Monitor"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"monitorId","in":"query","required":false,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"limit","in":"query","required":false,"schema":{"type":"number","default":20}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"},"monitorId":{"type":"string"},"type":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","message","monitorId","type","createdAt"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/clearEvents":{"delete":{"operationId":"monitor-clearEvents","tags":["Monitor"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"monitorId","in":"query","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"number"}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/clearData":{"delete":{"operationId":"monitor-clearData","tags":["Monitor"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"monitorId","in":"query","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"number"}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/{monitorId}/status":{"get":{"operationId":"monitor-getStatus","tags":["Monitor"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"monitorId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"statusName","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"monitorId":{"type":"string"},"statusName":{"type":"string"},"payload":{"anyOf":[{"enum":["null"],"nullable":true},{"type":"object","additionalProperties":{}},{"type":"array"},{"type":"string"},{"type":"boolean"},{"type":"number"}]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["monitorId","statusName","payload","createdAt","updatedAt"],"additionalProperties":false,"nullable":true}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/getAllPages":{"get":{"operationId":"monitor-getAllPages","tags":["Monitor"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"monitorList":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"showCurrent":{"type":"boolean","default":false}},"required":["id"],"additionalProperties":false}},"domain":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","slug","title","description","monitorList","createdAt","updatedAt"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/monitor/getPageInfo":{"get":{"operationId":"monitor-getPageInfo","tags":["Monitor"],"parameters":[{"name":"slug","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"monitorList":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"showCurrent":{"type":"boolean","default":false}},"required":["id"],"additionalProperties":false}},"domain":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","slug","title","description","monitorList","createdAt","updatedAt"],"additionalProperties":false,"nullable":true}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/createStatusPage":{"post":{"operationId":"monitor-createPage","tags":["Monitor"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"monitorList":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"showCurrent":{"type":"boolean","default":false}},"required":["id"],"additionalProperties":false}},"domain":{"type":"string","nullable":true}},"required":["slug","title"],"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"monitorList":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"showCurrent":{"type":"boolean","default":false}},"required":["id"],"additionalProperties":false}},"domain":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","slug","title","description","monitorList","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/updateStatusPage":{"patch":{"operationId":"monitor-editPage","tags":["Monitor"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"monitorList":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"showCurrent":{"type":"boolean","default":false}},"required":["id"],"additionalProperties":false}},"domain":{"type":"string","nullable":true}},"required":["id"],"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"monitorList":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"showCurrent":{"type":"boolean","default":false}},"required":["id"],"additionalProperties":false}},"domain":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","slug","title","description","monitorList","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/deleteStatusPage":{"delete":{"operationId":"monitor-deletePage","tags":["Monitor"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"id","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"monitorList":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"showCurrent":{"type":"boolean","default":false}},"required":["id"],"additionalProperties":false}},"domain":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","slug","title","description","monitorList","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/telemetry/all":{"get":{"operationId":"telemetry-all","tags":["Telemetry"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","workspaceId","name","createdAt","updatedAt"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/telemetry/info":{"get":{"operationId":"telemetry-info","tags":["Telemetry"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"telemetryId","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","workspaceId","name","createdAt","updatedAt"],"additionalProperties":false,"nullable":true}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/telemetry/allEventCount":{"get":{"operationId":"telemetry-allEventCount","tags":["Telemetry"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"number"}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/telemetry/eventCount":{"get":{"operationId":"telemetry-eventCount","tags":["Telemetry"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"telemetryId","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"number"}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/telemetry/upsert":{"post":{"operationId":"telemetry-upsert","tags":["Telemetry"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"telemetryId":{"type":"string"},"name":{"type":"string"}},"required":["name"],"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","workspaceId","name","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/telemetry/delete":{"post":{"operationId":"telemetry-delete","tags":["Telemetry"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"telemetryId":{"type":"string"}},"required":["telemetryId"],"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","workspaceId","name","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/telemetry/pageviews":{"get":{"operationId":"telemetry-pageviews","tags":["Telemetry"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"telemetryId","in":"query","required":true,"schema":{"type":"string"}},{"name":"startAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"endAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"unit","in":"query","required":false,"schema":{"type":"string"}},{"name":"url","in":"query","required":false,"schema":{"type":"string"}},{"name":"country","in":"query","required":false,"schema":{"type":"string"}},{"name":"region","in":"query","required":false,"schema":{"type":"string"}},{"name":"city","in":"query","required":false,"schema":{"type":"string"}},{"name":"timezone","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"pageviews":{},"sessions":{}},"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/telemetry/metrics":{"get":{"operationId":"telemetry-metrics","tags":["Telemetry"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"telemetryId","in":"query","required":true,"schema":{"type":"string"}},{"name":"type","in":"query","required":true,"schema":{"type":"string","enum":["source","url","event","referrer","country"]}},{"name":"startAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"endAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"url","in":"query","required":false,"schema":{"type":"string"}},{"name":"country","in":"query","required":false,"schema":{"type":"string"}},{"name":"region","in":"query","required":false,"schema":{"type":"string"}},{"name":"city","in":"query","required":false,"schema":{"type":"string"}},{"name":"timezone","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"x":{"type":"string","nullable":true},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/telemetry/stats":{"get":{"operationId":"telemetry-stats","tags":["Telemetry"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"telemetryId","in":"query","required":true,"schema":{"type":"string"}},{"name":"startAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"endAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"unit","in":"query","required":false,"schema":{"type":"string"}},{"name":"url","in":"query","required":false,"schema":{"type":"string"}},{"name":"country","in":"query","required":false,"schema":{"type":"string"}},{"name":"region","in":"query","required":false,"schema":{"type":"string"}},{"name":"city","in":"query","required":false,"schema":{"type":"string"}},{"name":"timezone","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"pageviews":{"type":"object","properties":{"value":{"type":"number"},"prev":{"type":"number"}},"required":["value","prev"],"additionalProperties":false},"uniques":{"type":"object","properties":{"value":{"type":"number"},"prev":{"type":"number"}},"required":["value","prev"],"additionalProperties":false}},"required":["pageviews","uniques"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey/all":{"get":{"operationId":"survey-all","tags":["Survey"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"payload":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["text","select","email"]},"options":{"type":"array","items":{"type":"string"}}},"required":["label","name","type"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","payload","createdAt","updatedAt"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey/{surveyId}":{"get":{"operationId":"survey-get","tags":["Survey"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"payload":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["text","select","email"]},"options":{"type":"array","items":{"type":"string"}}},"required":["label","name","type"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","payload","createdAt","updatedAt"],"additionalProperties":false,"nullable":true}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey/{surveyId}/count":{"get":{"operationId":"survey-count","tags":["Survey"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"number"}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey/allResultCount":{"get":{"operationId":"survey-allResultCount","tags":["Survey"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"number"}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey/{surveyId}/submit":{"post":{"operationId":"survey-submit","tags":["Survey"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"payload":{"type":"object","additionalProperties":{}}},"required":["payload"],"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey/create":{"post":{"operationId":"survey-create","tags":["Survey"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"payload":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["text","select","email"]},"options":{"type":"array","items":{"type":"string"}}},"required":["label","name","type"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false}},"required":["name","payload"],"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"payload":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["text","select","email"]},"options":{"type":"array","items":{"type":"string"}}},"required":["label","name","type"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","payload","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey/{surveyId}/update":{"patch":{"operationId":"survey-update","tags":["Survey"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"payload":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["text","select","email"]},"options":{"type":"array","items":{"type":"string"}}},"required":["label","name","type"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false}},"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"payload":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["text","select","email"]},"options":{"type":"array","items":{"type":"string"}}},"required":["label","name","type"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","payload","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey/{surveyId}/delete":{"delete":{"operationId":"survey-delete","tags":["Survey"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"payload":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["text","select","email"]},"options":{"type":"array","items":{"type":"string"}}},"required":["label","name","type"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","payload","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey/{surveyId}/result/list":{"get":{"operationId":"survey-resultList","tags":["Survey"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"number","minimum":1,"maximum":1000,"default":50}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}},{"name":"startAt","in":"query","required":false,"schema":{"type":"number"}},{"name":"endAt","in":"query","required":false,"schema":{"type":"number"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"surveyId":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"sessionId":{"type":"string"},"payload":{"type":"object","additionalProperties":{}},"browser":{"type":"string","nullable":true},"os":{"type":"string","nullable":true},"language":{"type":"string","nullable":true},"ip":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"subdivision1":{"type":"string","nullable":true},"subdivision2":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"longitude":{"type":"number","nullable":true},"latitude":{"type":"number","nullable":true},"accuracyRadius":{"type":"integer","nullable":true}},"required":["id","surveyId","createdAt","sessionId","payload"],"additionalProperties":false}},"nextCursor":{"type":"string"}},"required":["items"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/audit/fetchByCursor":{"get":{"operationId":"auditLog-fetchByCursor","description":"Fetch workspace audit log","tags":["AuditLog"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"query","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"limit","in":"query","required":false,"schema":{"type":"number","minimum":1,"maximum":100,"default":50}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"content":{"type":"string"},"relatedId":{"type":"string","nullable":true},"relatedType":{"type":"string","enum":["Monitor","Notification"],"nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","content","createdAt"],"additionalProperties":false}},"nextCursor":{"type":"string"}},"required":["items"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/billing/usage":{"get":{"operationId":"billing-usage","description":"get workspace usage","tags":["Billing"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"query","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"startAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"endAt","in":"query","required":true,"schema":{"type":"number"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"websiteAcceptedCount":{"type":"number"},"websiteEventCount":{"type":"number"},"monitorExecutionCount":{"type":"number"}},"required":["websiteAcceptedCount","websiteEventCount","monitorExecutionCount"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/feed/channels":{"get":{"operationId":"feed-channels","tags":["Feed"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"_count":{"type":"object","properties":{"events":{"type":"number"}},"required":["events"],"additionalProperties":false}},"required":["id","workspaceId","name","createdAt","updatedAt","_count"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/feed/{channelId}/events":{"get":{"operationId":"feed-events","tags":["Feed"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"channelId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"channelId":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"eventName":{"type":"string"},"eventContent":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"source":{"type":"string"},"senderId":{"type":"string","nullable":true},"senderName":{"type":"string","nullable":true},"important":{"type":"boolean"}},"required":["id","channelId","createdAt","updatedAt","eventName","eventContent","tags","source","important"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}}},"components":{"securitySchemes":{"Authorization":{"type":"http","scheme":"bearer"}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string"},"issues":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false}}}}}}} +{"openapi":"3.0.3","info":{"title":"Tianji OpenAPI","description":"

Insight into everything

\n

Github: https://github.com/msgbyte/tianji

","version":"v1.11.4"},"servers":[{"url":"/open"}],"paths":{"/global/config":{"get":{"operationId":"global-config","description":"Get Tianji system global config","tags":["Global"],"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"allowRegister":{"type":"boolean"},"websiteId":{"type":"string"},"amapToken":{"type":"string"},"mapboxToken":{"type":"string"},"alphaMode":{"type":"boolean"},"disableAnonymousTelemetry":{"type":"boolean"},"customTrackerScriptName":{"type":"string"}},"required":["allowRegister","alphaMode","disableAnonymousTelemetry"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/login":{"post":{"operationId":"user-login","tags":["User"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"username":{"type":"string"},"password":{"type":"string"}},"required":["username","password"],"additionalProperties":false}}}},"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"info":{"type":"object","properties":{"username":{"type":"string"},"id":{"type":"string"},"role":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time","nullable":true},"currentWorkspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"dashboardLayout":{"type":"object","properties":{"layouts":{"type":"object","additionalProperties":{"type":"array"}},"items":{"type":"array"}},"required":["layouts","items"],"additionalProperties":false,"nullable":true}},"required":["id","name","dashboardLayout"],"additionalProperties":false},"workspaces":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"workspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false}},"required":["role","workspace"],"additionalProperties":false}}},"required":["username","id","role","createdAt","updatedAt","deletedAt","currentWorkspace","workspaces"],"additionalProperties":false},"token":{"type":"string"}},"required":["info","token"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/loginWithToken":{"post":{"operationId":"user-loginWithToken","tags":["User"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"}},"required":["token"],"additionalProperties":false}}}},"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"info":{"type":"object","properties":{"username":{"type":"string"},"id":{"type":"string"},"role":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time","nullable":true},"currentWorkspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"dashboardLayout":{"type":"object","properties":{"layouts":{"type":"object","additionalProperties":{"type":"array"}},"items":{"type":"array"}},"required":["layouts","items"],"additionalProperties":false,"nullable":true}},"required":["id","name","dashboardLayout"],"additionalProperties":false},"workspaces":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"workspace":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false}},"required":["role","workspace"],"additionalProperties":false}}},"required":["username","id","role","createdAt","updatedAt","deletedAt","currentWorkspace","workspaces"],"additionalProperties":false},"token":{"type":"string"}},"required":["info","token"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/getServiceCount":{"get":{"operationId":"workspace-getServiceCount","tags":["Workspace"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"website":{"type":"number"},"monitor":{"type":"number"},"server":{"type":"number"},"telemetry":{"type":"number"},"page":{"type":"number"},"survey":{"type":"number"}},"required":["website","monitor","server","telemetry","page","survey"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/website/{websiteId}/onlineCount":{"get":{"operationId":"website-onlineCount","tags":["Website"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"websiteId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"number"}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/website/all":{"get":{"operationId":"website-all","tags":["Website"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"domain":{"type":"string","nullable":true},"shareId":{"type":"string","nullable":true},"resetAt":{"type":"string","format":"date-time","nullable":true},"monitorId":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","workspaceId","name","domain","shareId","resetAt","monitorId","createdAt","updatedAt","deletedAt"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/website/allOverview":{"get":{"operationId":"website-allOverview","tags":["Website"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"number"}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/website/{websiteId}/info":{"get":{"operationId":"website-info","tags":["Website"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"websiteId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"domain":{"type":"string","nullable":true},"shareId":{"type":"string","nullable":true},"resetAt":{"type":"string","format":"date-time","nullable":true},"monitorId":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","workspaceId","name","domain","shareId","resetAt","monitorId","createdAt","updatedAt","deletedAt"],"additionalProperties":false,"nullable":true}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/website/{websiteId}/stats":{"get":{"operationId":"website-stats","tags":["Website"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"websiteId","in":"path","required":true,"schema":{"type":"string"}},{"name":"startAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"endAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"unit","in":"query","required":false,"schema":{"type":"string"}},{"name":"url","in":"query","required":false,"schema":{"type":"string"}},{"name":"country","in":"query","required":false,"schema":{"type":"string"}},{"name":"region","in":"query","required":false,"schema":{"type":"string"}},{"name":"city","in":"query","required":false,"schema":{"type":"string"}},{"name":"timezone","in":"query","required":false,"schema":{"type":"string"}},{"name":"referrer","in":"query","required":false,"schema":{"type":"string"}},{"name":"title","in":"query","required":false,"schema":{"type":"string"}},{"name":"os","in":"query","required":false,"schema":{"type":"string"}},{"name":"browser","in":"query","required":false,"schema":{"type":"string"}},{"name":"device","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"pageviews":{"type":"object","properties":{"value":{"type":"number"},"prev":{"type":"number"}},"required":["value","prev"],"additionalProperties":false},"uniques":{"type":"object","properties":{"value":{"type":"number"},"prev":{"type":"number"}},"required":["value","prev"],"additionalProperties":false},"totaltime":{"type":"object","properties":{"value":{"type":"number"},"prev":{"type":"number"}},"required":["value","prev"],"additionalProperties":false},"bounces":{"type":"object","properties":{"value":{"type":"number"},"prev":{"type":"number"}},"required":["value","prev"],"additionalProperties":false}},"required":["pageviews","uniques","totaltime","bounces"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/website/{websiteId}/geoStats":{"get":{"operationId":"website-geoStats","tags":["Website"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"websiteId","in":"path","required":true,"schema":{"type":"string"}},{"name":"startAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"endAt","in":"query","required":true,"schema":{"type":"number"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"longitude":{"type":"number"},"latitude":{"type":"number"},"count":{"type":"number"}},"required":["longitude","latitude","count"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/website/{websiteId}/pageviews":{"get":{"operationId":"website-pageviews","tags":["Website"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"websiteId","in":"path","required":true,"schema":{"type":"string"}},{"name":"startAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"endAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"unit","in":"query","required":false,"schema":{"type":"string"}},{"name":"url","in":"query","required":false,"schema":{"type":"string"}},{"name":"country","in":"query","required":false,"schema":{"type":"string"}},{"name":"region","in":"query","required":false,"schema":{"type":"string"}},{"name":"city","in":"query","required":false,"schema":{"type":"string"}},{"name":"timezone","in":"query","required":false,"schema":{"type":"string"}},{"name":"referrer","in":"query","required":false,"schema":{"type":"string"}},{"name":"title","in":"query","required":false,"schema":{"type":"string"}},{"name":"os","in":"query","required":false,"schema":{"type":"string"}},{"name":"browser","in":"query","required":false,"schema":{"type":"string"}},{"name":"device","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"pageviews":{},"sessions":{}},"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/website/{websiteId}/metrics":{"get":{"operationId":"website-metrics","tags":["Website"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"websiteId","in":"path","required":true,"schema":{"type":"string"}},{"name":"type","in":"query","required":true,"schema":{"type":"string","enum":["url","language","referrer","title","browser","os","device","country","event"]}},{"name":"startAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"endAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"url","in":"query","required":false,"schema":{"type":"string"}},{"name":"referrer","in":"query","required":false,"schema":{"type":"string"}},{"name":"title","in":"query","required":false,"schema":{"type":"string"}},{"name":"os","in":"query","required":false,"schema":{"type":"string"}},{"name":"browser","in":"query","required":false,"schema":{"type":"string"}},{"name":"device","in":"query","required":false,"schema":{"type":"string"}},{"name":"country","in":"query","required":false,"schema":{"type":"string"}},{"name":"region","in":"query","required":false,"schema":{"type":"string"}},{"name":"city","in":"query","required":false,"schema":{"type":"string"}},{"name":"language","in":"query","required":false,"schema":{"type":"string"}},{"name":"event","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"x":{"type":"string","nullable":true},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/website/add":{"post":{"operationId":"website-add","tags":["Website"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":100},"domain":{"anyOf":[{"type":"string","maxLength":500,"pattern":"^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9])$"},{"type":"string","maxLength":500,"anyOf":[{"format":"ipv4"},{"format":"ipv6"}]}]}},"required":["name","domain"],"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"domain":{"type":"string","nullable":true},"shareId":{"type":"string","nullable":true},"resetAt":{"type":"string","format":"date-time","nullable":true},"monitorId":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","workspaceId","name","domain","shareId","resetAt","monitorId","createdAt","updatedAt","deletedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/website/{websiteId}/update":{"put":{"operationId":"website-updateInfo","tags":["Website"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":100},"domain":{"anyOf":[{"type":"string","maxLength":500,"pattern":"^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9])$"},{"type":"string","maxLength":500,"anyOf":[{"format":"ipv4"},{"format":"ipv6"}]}]},"monitorId":{"type":"string","pattern":"^[a-z][a-z0-9]*$","nullable":true}},"required":["name","domain"],"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"websiteId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"domain":{"type":"string","nullable":true},"shareId":{"type":"string","nullable":true},"resetAt":{"type":"string","format":"date-time","nullable":true},"monitorId":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","workspaceId","name","domain","shareId","resetAt","monitorId","createdAt","updatedAt","deletedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/all":{"get":{"operationId":"monitor-all","tags":["Monitor"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"active":{"type":"boolean"},"interval":{"type":"integer"},"maxRetries":{"type":"integer"},"payload":{"type":"object","additionalProperties":{}},"trendingMode":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"notifications":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false}}},"required":["id","workspaceId","name","type","active","interval","maxRetries","payload","trendingMode","createdAt","updatedAt","notifications"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/{monitorId}":{"get":{"operationId":"monitor-get","tags":["Monitor"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"monitorId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"active":{"type":"boolean"},"interval":{"type":"integer"},"maxRetries":{"type":"integer"},"payload":{"type":"object","additionalProperties":{}},"trendingMode":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"notifications":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":false}}},"required":["id","workspaceId","name","type","active","interval","maxRetries","payload","trendingMode","createdAt","updatedAt","notifications"],"additionalProperties":false,"nullable":true}}}},"default":{"$ref":"#/components/responses/error"}}},"delete":{"operationId":"monitor-delete","tags":["Monitor"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"monitorId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"active":{"type":"boolean"},"interval":{"type":"integer"},"maxRetries":{"type":"integer"},"payload":{"type":"object","additionalProperties":{}},"trendingMode":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","type","active","interval","maxRetries","payload","trendingMode","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/monitor/getPublicInfo":{"post":{"operationId":"monitor-getPublicInfo","tags":["Monitor"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"monitorIds":{"type":"array","items":{"type":"string"}}},"required":["monitorIds"],"additionalProperties":false}}}},"parameters":[],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"}},"required":["id","name","type"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/upsert":{"post":{"operationId":"monitor-upsert","tags":["Monitor"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","pattern":"^[a-z][a-z0-9]*$"},"name":{"type":"string"},"type":{"type":"string"},"active":{"type":"boolean","default":true},"interval":{"type":"integer","minimum":5,"maximum":10000,"default":20},"maxRetries":{"type":"integer","minimum":0,"maximum":10,"default":0},"trendingMode":{"type":"boolean","default":false},"notificationIds":{"type":"array","items":{"type":"string"},"default":[]},"payload":{"type":"object","properties":{},"additionalProperties":true}},"required":["name","type","payload"],"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"active":{"type":"boolean"},"interval":{"type":"integer"},"maxRetries":{"type":"integer"},"payload":{"type":"object","additionalProperties":{}},"trendingMode":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","type","active","interval","maxRetries","payload","trendingMode","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/{monitorId}/data":{"get":{"operationId":"monitor-data","tags":["Monitor"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"monitorId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"startAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"endAt","in":"query","required":true,"schema":{"type":"number"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"value":{"type":"number"},"createdAt":{"type":"string","format":"date-time"}},"required":["value","createdAt"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/{monitorId}/changeActive":{"patch":{"operationId":"monitor-changeActive","tags":["Monitor"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"active":{"type":"boolean"}},"required":["active"],"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"monitorId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"active":{"type":"boolean"},"interval":{"type":"integer"},"maxRetries":{"type":"integer"},"payload":{"type":"object","additionalProperties":{}},"trendingMode":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","type","active","interval","maxRetries","payload","trendingMode","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/{monitorId}/recentData":{"get":{"operationId":"monitor-recentData","tags":["Monitor"],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"monitorId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"take","in":"query","required":true,"schema":{"type":"number"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"value":{"type":"number"},"createdAt":{"type":"string","format":"date-time"}},"required":["value","createdAt"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/{monitorId}/dataMetrics":{"get":{"operationId":"monitor-dataMetrics","tags":["Monitor"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"monitorId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"recent1DayAvg":{"type":"number"},"recent1DayOnlineCount":{"type":"number"},"recent1DayOfflineCount":{"type":"number"},"recent30DayOnlineCount":{"type":"number"},"recent30DayOfflineCount":{"type":"number"}},"required":["recent1DayAvg","recent1DayOnlineCount","recent1DayOfflineCount","recent30DayOnlineCount","recent30DayOfflineCount"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/events":{"get":{"operationId":"monitor-events","tags":["Monitor"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"monitorId","in":"query","required":false,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"limit","in":"query","required":false,"schema":{"type":"number","default":20}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"},"monitorId":{"type":"string"},"type":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","message","monitorId","type","createdAt"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/clearEvents":{"delete":{"operationId":"monitor-clearEvents","tags":["Monitor"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"monitorId","in":"query","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"number"}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/clearData":{"delete":{"operationId":"monitor-clearData","tags":["Monitor"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"monitorId","in":"query","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"number"}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/{monitorId}/status":{"get":{"operationId":"monitor-getStatus","tags":["Monitor"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"monitorId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"statusName","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"monitorId":{"type":"string"},"statusName":{"type":"string"},"payload":{"anyOf":[{"enum":["null"],"nullable":true},{"type":"object","additionalProperties":{}},{"type":"array"},{"type":"string"},{"type":"boolean"},{"type":"number"}]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["monitorId","statusName","payload","createdAt","updatedAt"],"additionalProperties":false,"nullable":true}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/getAllPages":{"get":{"operationId":"monitor-getAllPages","tags":["Monitor"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"monitorList":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"showCurrent":{"type":"boolean","default":false}},"required":["id"],"additionalProperties":false}},"domain":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","slug","title","description","monitorList","createdAt","updatedAt"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/monitor/getPageInfo":{"get":{"operationId":"monitor-getPageInfo","tags":["Monitor"],"parameters":[{"name":"slug","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"monitorList":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"showCurrent":{"type":"boolean","default":false}},"required":["id"],"additionalProperties":false}},"domain":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","slug","title","description","monitorList","createdAt","updatedAt"],"additionalProperties":false,"nullable":true}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/createStatusPage":{"post":{"operationId":"monitor-createPage","tags":["Monitor"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"monitorList":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"showCurrent":{"type":"boolean","default":false}},"required":["id"],"additionalProperties":false}},"domain":{"type":"string","nullable":true}},"required":["slug","title"],"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"monitorList":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"showCurrent":{"type":"boolean","default":false}},"required":["id"],"additionalProperties":false}},"domain":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","slug","title","description","monitorList","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/updateStatusPage":{"patch":{"operationId":"monitor-editPage","tags":["Monitor"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"monitorList":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"showCurrent":{"type":"boolean","default":false}},"required":["id"],"additionalProperties":false}},"domain":{"type":"string","nullable":true}},"required":["id"],"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"monitorList":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"showCurrent":{"type":"boolean","default":false}},"required":["id"],"additionalProperties":false}},"domain":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","slug","title","description","monitorList","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/monitor/deleteStatusPage":{"delete":{"operationId":"monitor-deletePage","tags":["Monitor"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"id","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"monitorList":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"showCurrent":{"type":"boolean","default":false}},"required":["id"],"additionalProperties":false}},"domain":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","slug","title","description","monitorList","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/telemetry/all":{"get":{"operationId":"telemetry-all","tags":["Telemetry"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","workspaceId","name","createdAt","updatedAt"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/telemetry/info":{"get":{"operationId":"telemetry-info","tags":["Telemetry"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"telemetryId","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","workspaceId","name","createdAt","updatedAt"],"additionalProperties":false,"nullable":true}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/telemetry/allEventCount":{"get":{"operationId":"telemetry-allEventCount","tags":["Telemetry"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"number"}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/telemetry/eventCount":{"get":{"operationId":"telemetry-eventCount","tags":["Telemetry"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"telemetryId","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"number"}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/telemetry/upsert":{"post":{"operationId":"telemetry-upsert","tags":["Telemetry"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"telemetryId":{"type":"string"},"name":{"type":"string"}},"required":["name"],"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","workspaceId","name","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/telemetry/delete":{"post":{"operationId":"telemetry-delete","tags":["Telemetry"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"telemetryId":{"type":"string"}},"required":["telemetryId"],"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","workspaceId","name","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/telemetry/pageviews":{"get":{"operationId":"telemetry-pageviews","tags":["Telemetry"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"telemetryId","in":"query","required":true,"schema":{"type":"string"}},{"name":"startAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"endAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"unit","in":"query","required":false,"schema":{"type":"string"}},{"name":"url","in":"query","required":false,"schema":{"type":"string"}},{"name":"country","in":"query","required":false,"schema":{"type":"string"}},{"name":"region","in":"query","required":false,"schema":{"type":"string"}},{"name":"city","in":"query","required":false,"schema":{"type":"string"}},{"name":"timezone","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"pageviews":{},"sessions":{}},"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/telemetry/metrics":{"get":{"operationId":"telemetry-metrics","tags":["Telemetry"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"telemetryId","in":"query","required":true,"schema":{"type":"string"}},{"name":"type","in":"query","required":true,"schema":{"type":"string","enum":["source","url","event","referrer","country"]}},{"name":"startAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"endAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"url","in":"query","required":false,"schema":{"type":"string"}},{"name":"country","in":"query","required":false,"schema":{"type":"string"}},{"name":"region","in":"query","required":false,"schema":{"type":"string"}},{"name":"city","in":"query","required":false,"schema":{"type":"string"}},{"name":"timezone","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"x":{"type":"string","nullable":true},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/telemetry/stats":{"get":{"operationId":"telemetry-stats","tags":["Telemetry"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"telemetryId","in":"query","required":true,"schema":{"type":"string"}},{"name":"startAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"endAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"unit","in":"query","required":false,"schema":{"type":"string"}},{"name":"url","in":"query","required":false,"schema":{"type":"string"}},{"name":"country","in":"query","required":false,"schema":{"type":"string"}},{"name":"region","in":"query","required":false,"schema":{"type":"string"}},{"name":"city","in":"query","required":false,"schema":{"type":"string"}},{"name":"timezone","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"pageviews":{"type":"object","properties":{"value":{"type":"number"},"prev":{"type":"number"}},"required":["value","prev"],"additionalProperties":false},"uniques":{"type":"object","properties":{"value":{"type":"number"},"prev":{"type":"number"}},"required":["value","prev"],"additionalProperties":false}},"required":["pageviews","uniques"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey/all":{"get":{"operationId":"survey-all","tags":["Survey"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"payload":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["text","select","email"]},"options":{"type":"array","items":{"type":"string"}}},"required":["label","name","type"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","payload","createdAt","updatedAt"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey/{surveyId}":{"get":{"operationId":"survey-get","tags":["Survey"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"payload":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["text","select","email"]},"options":{"type":"array","items":{"type":"string"}}},"required":["label","name","type"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","payload","createdAt","updatedAt"],"additionalProperties":false,"nullable":true}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey/{surveyId}/count":{"get":{"operationId":"survey-count","tags":["Survey"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"number"}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey/allResultCount":{"get":{"operationId":"survey-allResultCount","tags":["Survey"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"number"}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey/{surveyId}/submit":{"post":{"operationId":"survey-submit","tags":["Survey"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"payload":{"type":"object","additionalProperties":{}}},"required":["payload"],"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey/create":{"post":{"operationId":"survey-create","tags":["Survey"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"payload":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["text","select","email"]},"options":{"type":"array","items":{"type":"string"}}},"required":["label","name","type"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false}},"required":["name","payload"],"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"payload":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["text","select","email"]},"options":{"type":"array","items":{"type":"string"}}},"required":["label","name","type"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","payload","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey/{surveyId}/update":{"patch":{"operationId":"survey-update","tags":["Survey"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"payload":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["text","select","email"]},"options":{"type":"array","items":{"type":"string"}}},"required":["label","name","type"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false}},"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"payload":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["text","select","email"]},"options":{"type":"array","items":{"type":"string"}}},"required":["label","name","type"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","payload","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey/{surveyId}/delete":{"delete":{"operationId":"survey-delete","tags":["Survey"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"payload":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["text","select","email"]},"options":{"type":"array","items":{"type":"string"}}},"required":["label","name","type"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","payload","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey/{surveyId}/result/list":{"get":{"operationId":"survey-resultList","tags":["Survey"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"number","minimum":1,"maximum":1000,"default":50}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}},{"name":"startAt","in":"query","required":false,"schema":{"type":"number"}},{"name":"endAt","in":"query","required":false,"schema":{"type":"number"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"surveyId":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"sessionId":{"type":"string"},"payload":{"type":"object","additionalProperties":{}},"browser":{"type":"string","nullable":true},"os":{"type":"string","nullable":true},"language":{"type":"string","nullable":true},"ip":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"subdivision1":{"type":"string","nullable":true},"subdivision2":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"longitude":{"type":"number","nullable":true},"latitude":{"type":"number","nullable":true},"accuracyRadius":{"type":"integer","nullable":true}},"required":["id","surveyId","createdAt","sessionId","payload"],"additionalProperties":false}},"nextCursor":{"type":"string"}},"required":["items"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/audit/fetchByCursor":{"get":{"operationId":"auditLog-fetchByCursor","description":"Fetch workspace audit log","tags":["AuditLog"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"query","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"limit","in":"query","required":false,"schema":{"type":"number","minimum":1,"maximum":100,"default":50}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"content":{"type":"string"},"relatedId":{"type":"string","nullable":true},"relatedType":{"type":"string","enum":["Monitor","Notification"],"nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","content","createdAt"],"additionalProperties":false}},"nextCursor":{"type":"string"}},"required":["items"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/billing/usage":{"get":{"operationId":"billing-usage","description":"get workspace usage","tags":["Billing"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"query","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"startAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"endAt","in":"query","required":true,"schema":{"type":"number"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"websiteAcceptedCount":{"type":"number"},"websiteEventCount":{"type":"number"},"monitorExecutionCount":{"type":"number"}},"required":["websiteAcceptedCount","websiteEventCount","monitorExecutionCount"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/feed/channels":{"get":{"operationId":"feed-channels","tags":["Feed"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"_count":{"type":"object","properties":{"events":{"type":"number"}},"required":["events"],"additionalProperties":false}},"required":["id","workspaceId","name","createdAt","updatedAt","_count"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/feed/{channelId}/info":{"get":{"operationId":"feed-channelInfo","tags":["Feed"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"channelId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","createdAt","updatedAt"],"additionalProperties":false,"nullable":true}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/feed/{channelId}/update":{"post":{"operationId":"feed-updateChannelInfo","tags":["Feed"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"],"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"channelId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","createdAt","updatedAt"],"additionalProperties":false,"nullable":true}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/feed/{channelId}/events":{"get":{"operationId":"feed-events","tags":["Feed"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"channelId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"channelId":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"eventName":{"type":"string"},"eventContent":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"source":{"type":"string"},"senderId":{"type":"string","nullable":true},"senderName":{"type":"string","nullable":true},"important":{"type":"boolean"}},"required":["id","channelId","createdAt","updatedAt","eventName","eventContent","tags","source","important"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/feed/createChannel":{"post":{"operationId":"feed-createChannel","tags":["Feed"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"],"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/feed/{channelId}":{"delete":{"operationId":"feed-deleteChannel","tags":["Feed"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"channelId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/feed/{channelId}/send":{"post":{"operationId":"feed-sendEvent","tags":["Feed"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"eventName":{"type":"string"},"eventContent":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"source":{"type":"string"},"senderId":{"type":"string","nullable":true},"senderName":{"type":"string","nullable":true},"important":{"type":"boolean"}},"required":["eventName","eventContent","tags","source","important"],"additionalProperties":false}}}},"parameters":[{"name":"channelId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"channelId":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"eventName":{"type":"string"},"eventContent":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"source":{"type":"string"},"senderId":{"type":"string","nullable":true},"senderName":{"type":"string","nullable":true},"important":{"type":"boolean"}},"required":["id","channelId","createdAt","updatedAt","eventName","eventContent","tags","source","important"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}}},"components":{"securitySchemes":{"Authorization":{"type":"http","scheme":"bearer"}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string"},"issues":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false}}}}}}}