From 27642625ac9612ceeb1329d0aa3db8004af87844 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Sun, 28 Apr 2024 14:55:29 +0800 Subject: [PATCH] feat: add survey backend endpoint --- pnpm-lock.yaml | 14 ++ src/server/package.json | 2 + src/server/prisma/zod/schemas/index.ts | 14 +- src/server/trpc/routers/survey.ts | 276 +++++++++++++++++++++++++ src/server/trpc/routers/telemetry.ts | 2 +- src/server/trpc/trpc.ts | 2 +- src/server/utils/const.ts | 1 + src/server/utils/detect.ts | 9 +- src/server/utils/prisma.ts | 28 ++- src/server/utils/schema.ts | 11 + website/openapi.json | 2 +- 11 files changed, 344 insertions(+), 17 deletions(-) create mode 100644 src/server/trpc/routers/survey.ts create mode 100644 src/server/utils/schema.ts diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index aea95c3..d995802 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -377,6 +377,9 @@ importers: '@trpc/server': specifier: ^10.45.0 version: 10.45.0 + accept-language-parser: + specifier: ^1.5.0 + version: 1.5.0 axios: specifier: ^1.5.0 version: 1.5.0 @@ -501,6 +504,9 @@ importers: '@faker-js/faker': specifier: ^8.4.0 version: 8.4.0 + '@types/accept-language-parser': + specifier: ^1.5.6 + version: 1.5.6 '@types/bcryptjs': specifier: ^2.4.3 version: 2.4.3 @@ -9967,6 +9973,10 @@ packages: d3-voronoi: 1.1.2 dev: false + /@types/accept-language-parser@1.5.6: + resolution: {integrity: sha512-lhSQUsAhAtbKjYgaw3f0c4EQKNQHFXhX87+OXUIqDHMkycvHGaqGskSRtnzysIUiqHPqNJ4BqI5SE++drsxx6A==} + dev: true + /@types/acorn@4.0.6: resolution: {integrity: sha512-veQTnWP+1D/xbxVrPC3zHnCZRjSrKfhbMUlEA43iMZLu7EsnTtkJklIuwrCPbOi8YkvDQAiW05VQQFvvz9oieQ==} dependencies: @@ -10754,6 +10764,10 @@ packages: event-target-shim: 5.0.1 dev: true + /accept-language-parser@1.5.0: + resolution: {integrity: sha512-QhyTbMLYo0BBGg1aWbeMG4ekWtds/31BrEU+DONOg/7ax23vxpL03Pb7/zBmha2v7vdD3AyzZVWBVGEZxKOXWw==} + dev: false + /accepts@1.3.8: resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==} engines: {node: '>= 0.6'} diff --git a/src/server/package.json b/src/server/package.json index 2cf1d6e..c3daa7b 100644 --- a/src/server/package.json +++ b/src/server/package.json @@ -25,6 +25,7 @@ "@prisma/client": "5.4.2", "@tianji/shared": "workspace:^", "@trpc/server": "^10.45.0", + "accept-language-parser": "^1.5.0", "axios": "^1.5.0", "badge-maker": "^3.3.1", "bcryptjs": "^2.4.3", @@ -68,6 +69,7 @@ }, "devDependencies": { "@faker-js/faker": "^8.4.0", + "@types/accept-language-parser": "^1.5.6", "@types/bcryptjs": "^2.4.3", "@types/compression": "^1.7.2", "@types/cors": "^2.8.15", diff --git a/src/server/prisma/zod/schemas/index.ts b/src/server/prisma/zod/schemas/index.ts index e580b38..6a3c8d9 100644 --- a/src/server/prisma/zod/schemas/index.ts +++ b/src/server/prisma/zod/schemas/index.ts @@ -10,10 +10,12 @@ export const MonitorStatusPageListSchema = z.array( ); export const SurveyPayloadSchema = z.object({ - items: z.object({ - label: z.string(), - name: z.string(), - type: z.enum(['text', 'select', 'email']), - options: z.array(z.string()).optional(), - }), + items: z.array( + z.object({ + label: z.string(), + name: z.string(), + type: z.enum(['text', 'select', 'email']), + options: z.array(z.string()).optional(), + }) + ), }); diff --git a/src/server/trpc/routers/survey.ts b/src/server/trpc/routers/survey.ts new file mode 100644 index 0000000..2b48734 --- /dev/null +++ b/src/server/trpc/routers/survey.ts @@ -0,0 +1,276 @@ +import { z } from 'zod'; +import { + OpenApiMetaInfo, + publicProcedure, + router, + workspaceOwnerProcedure, + workspaceProcedure, +} from '../trpc'; +import { OPENAPI_TAG } from '../../utils/const'; +import { prisma } from '../../model/_client'; +import { SurveyModelSchema, SurveyResultModelSchema } from '../../prisma/zod'; +import { OpenApiMeta } from 'trpc-openapi'; +import { hashUuid } from '../../utils/common'; +import { getRequestInfo } from '../../utils/detect'; +import { SurveyPayloadSchema } from '../../prisma/zod/schemas'; +import { buildCursorResponseSchema } from '../../utils/schema'; +import { fetchDataByCursor } from '../../utils/prisma'; + +export const telemetryRouter = router({ + all: workspaceProcedure + .meta( + buildSurveyOpenapi({ + method: 'GET', + path: '/all', + }) + ) + .output(z.array(SurveyModelSchema)) + .query(async ({ input }) => { + const { workspaceId } = input; + + const res = await prisma.survey.findMany({ + where: { + workspaceId, + }, + orderBy: { + updatedAt: 'desc', + }, + }); + + return res; + }), + get: publicProcedure + .meta( + buildSurveyOpenapi({ + method: 'GET', + path: '/{surveyId}', + }) + ) + .input( + z.object({ + workspaceId: z.string(), + surveyId: z.string(), + }) + ) + .output(SurveyModelSchema.nullable()) + .query(async ({ input }) => { + const { workspaceId, surveyId } = input; + + const res = await prisma.survey.findUnique({ + where: { + workspaceId, + id: surveyId, + }, + }); + + return res; + }), + count: workspaceProcedure + .meta( + buildSurveyOpenapi({ + method: 'GET', + path: '/{surveyId}/count', + }) + ) + .input( + z.object({ + surveyId: z.string(), + }) + ) + .output(z.number()) + .query(async ({ input }) => { + const { surveyId } = input; + + const count = await prisma.surveyResult.count({ + where: { + surveyId: surveyId, + }, + }); + + return count; + }), + submit: publicProcedure + .meta( + buildSurveyOpenapi({ + method: 'POST', + path: '/{surveyId}/submit', + }) + ) + .input( + z.object({ + workspaceId: z.string(), + surveyId: z.string(), + payload: z.record(z.string(), z.any()), + }) + ) + .output(z.any()) + .mutation(async ({ input, ctx }) => { + const { req } = ctx; + const { workspaceId, surveyId, payload } = input; + + const { + userAgent, + browser, + os, + language, + ip, + country, + subdivision1, + subdivision2, + city, + longitude, + latitude, + accuracyRadius, + } = await getRequestInfo(req); + + const sessionId = hashUuid(workspaceId, surveyId, ip, userAgent!); + + await prisma.surveyResult.create({ + data: { + surveyId, + sessionId, + payload, + browser, + os, + language, + ip, + country, + subdivision1, + subdivision2, + city, + longitude, + latitude, + accuracyRadius, + }, + }); + }), + create: workspaceOwnerProcedure + .meta( + buildSurveyOpenapi({ + method: 'POST', + path: '/create', + }) + ) + .input( + z.object({ + name: z.string(), + payload: SurveyPayloadSchema, + }) + ) + .output(SurveyModelSchema) + .mutation(async ({ input }) => { + const { workspaceId, name, payload } = input; + + const res = await prisma.survey.create({ + data: { + workspaceId, + name, + payload, + }, + }); + + return res; + }), + update: workspaceOwnerProcedure + .meta( + buildSurveyOpenapi({ + method: 'PATCH', + path: '/{surveyId}/update', + }) + ) + .input( + z.object({ + surveyId: z.string(), + name: z.string().optional(), + payload: SurveyPayloadSchema.optional(), + }) + ) + .output(SurveyModelSchema) + .mutation(async ({ input }) => { + const { workspaceId, surveyId, name, payload } = input; + + const res = await prisma.survey.update({ + where: { + workspaceId, + id: surveyId, + }, + data: { + name, + payload, + }, + }); + + return res; + }), + delete: workspaceOwnerProcedure + .meta( + buildSurveyOpenapi({ + method: 'DELETE', + path: '/{surveyId}/delete', + }) + ) + .input( + z.object({ + surveyId: z.string(), + }) + ) + .output(SurveyModelSchema) + .mutation(async ({ input }) => { + const { workspaceId, surveyId } = input; + + const res = await prisma.survey.delete({ + where: { + id: surveyId, + workspaceId, + }, + }); + + return res; + }), + resultList: workspaceProcedure + .meta( + buildSurveyOpenapi({ + method: 'GET', + path: '/{surveyId}/result/list', + }) + ) + .input( + z.object({ + surveyId: z.string(), + limit: z.number().min(1).max(100).default(50), + cursor: z.string().optional(), + }) + ) + .output(buildCursorResponseSchema(SurveyResultModelSchema)) + .query(async ({ input }) => { + const limit = input.limit; + const { cursor, surveyId } = input; + + const { items, nextCursor } = await fetchDataByCursor( + prisma.surveyResult, + { + where: { + surveyId, + }, + limit, + cursor, + } + ); + + return { + items, + nextCursor, + }; + }), +}); + +function buildSurveyOpenapi(meta: OpenApiMetaInfo): OpenApiMeta { + return { + openapi: { + tags: [OPENAPI_TAG.SURVEY], + protect: true, + ...meta, + path: `/workspace/{workspaceId}/survey/${meta.path}`, + }, + }; +} diff --git a/src/server/trpc/routers/telemetry.ts b/src/server/trpc/routers/telemetry.ts index 5324a9f..8e4c11e 100644 --- a/src/server/trpc/routers/telemetry.ts +++ b/src/server/trpc/routers/telemetry.ts @@ -427,7 +427,7 @@ function buildTelemetryOpenapi(meta: OpenApiMetaInfo): OpenApiMeta { tags: [OPENAPI_TAG.TELEMETRY], protect: true, ...meta, - path: `/workspace/{workspaceId}${meta.path}`, + path: `/workspace/{workspaceId}/telemetry${meta.path}`, }, }; } diff --git a/src/server/trpc/trpc.ts b/src/server/trpc/trpc.ts index 5426b76..8b5de8b 100644 --- a/src/server/trpc/trpc.ts +++ b/src/server/trpc/trpc.ts @@ -11,7 +11,7 @@ export function createContext({ req }: { req: IncomingMessage }) { const authorization = req.headers['authorization'] ?? ''; const token = authorization.replace('Bearer ', ''); - return { token }; + return { token, req }; } type Context = inferAsyncReturnType; diff --git a/src/server/utils/const.ts b/src/server/utils/const.ts index 92274f7..36a46fc 100644 --- a/src/server/utils/const.ts +++ b/src/server/utils/const.ts @@ -110,4 +110,5 @@ export enum OPENAPI_TAG { AUDIT_LOG = 'AuditLog', BILLING = 'Billing', TELEMETRY = 'Telemetry', + SURVEY = 'Survey', } diff --git a/src/server/utils/detect.ts b/src/server/utils/detect.ts index 9d9e7e6..8b7d913 100644 --- a/src/server/utils/detect.ts +++ b/src/server/utils/detect.ts @@ -12,8 +12,10 @@ import { } from './const'; import maxmind, { Reader, CityResponse } from 'maxmind'; import { libraryPath } from './lib'; +import { IncomingMessage } from 'http'; +import { parse as pareseAcceptLanguage } from 'accept-language-parser'; -export async function getRequestInfo(req: Request) { +export async function getRequestInfo(req: IncomingMessage) { const userAgent = req.headers['user-agent']; const ip = getIpAddress(req); const location = await getLocation(ip); @@ -28,11 +30,14 @@ export async function getRequestInfo(req: Request) { } = location ?? {}; const browser = browserName(userAgent ?? ''); const os = detectOS(userAgent ?? ''); + const language: string | undefined = + pareseAcceptLanguage(req.headers['accept-language'])[0]?.code ?? undefined; return { userAgent, browser, os, + language, ip, country, subdivision1, @@ -57,7 +62,7 @@ export async function getClientInfo( }; } -export function getIpAddress(req: Request): string { +export function getIpAddress(req: IncomingMessage): string { // Custom header if ( process.env.CLIENT_IP_HEADER && diff --git a/src/server/utils/prisma.ts b/src/server/utils/prisma.ts index 8ea04ae..3279ad5 100644 --- a/src/server/utils/prisma.ts +++ b/src/server/utils/prisma.ts @@ -116,13 +116,16 @@ export async function parseTelemetryFilters( } function normalizeFilters(filters: Record = {}) { - return Object.keys(filters).reduce((obj, key) => { - const value = filters[key]; + return Object.keys(filters).reduce( + (obj, key) => { + const value = filters[key]; - obj[key] = value?.value ?? value; + obj[key] = value?.value ?? value; - return obj; - }, {} as Record); + return obj; + }, + {} as Record + ); } export function getWebsiteFilterQuery( @@ -217,11 +220,24 @@ type ExtractFindManyReturnType = T extends ( ? R : never; +/** + * @example + * const { items, nextCursor } = await fetchDataByCursor( + * prisma.workspaceAuditLog, + * { + * where: { + * workspaceId, + * }, + * limit, + * cursor, + * } + * ); + */ export async function fetchDataByCursor< Model extends { findMany: (args?: any) => Prisma.PrismaPromise; }, - CursorType + CursorType, >( fetchModel: Model, options: { diff --git a/src/server/utils/schema.ts b/src/server/utils/schema.ts new file mode 100644 index 0000000..5929d75 --- /dev/null +++ b/src/server/utils/schema.ts @@ -0,0 +1,11 @@ +import { z } from 'zod'; + +export function buildCursorResponseSchema( + itemSchema: z.ZodType, + cursorSchema = z.string() +) { + return z.object({ + items: z.array(itemSchema), + nextCursor: cursorSchema.optional(), + }); +} diff --git a/website/openapi.json b/website/openapi.json index 104bacc..59ca1f7 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.8.1"},"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"}}}},"/register":{"post":{"operationId":"user-register","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"}}}},"/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"},"telemetry":{"type":"number"},"page":{"type":"number"}},"required":["website","monitor","telemetry","page"],"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/{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","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":{}},"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","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":{}},"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","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":{}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","type","active","interval","maxRetries","payload","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},"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":{}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","type","active","interval","maxRetries","payload","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":{}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","type","active","interval","maxRetries","payload","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/monitor/{monitorId}/recentData":{"get":{"operationId":"monitor-recentData","tags":["Monitor"],"parameters":[{"name":"workspaceId","in":"query","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}},"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}},"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}}},"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}},"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}}},"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}},"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}},"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}/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}/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}/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}/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}/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}/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}/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}/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"}}}},"/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"}}}}},"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.9.2"},"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"}}}},"/register":{"post":{"operationId":"user-register","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"}}}},"/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"}},"required":["website","monitor","server","telemetry","page"],"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/{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","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":{}},"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","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":{}},"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","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":{}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","type","active","interval","maxRetries","payload","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},"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":{}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","type","active","interval","maxRetries","payload","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":{}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","type","active","interval","maxRetries","payload","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"}}}},"/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"}}}}},"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}}}}}}}