diff --git a/packages/client-sdk/package.json b/packages/client-sdk/package.json index 6918b79..385a7ae 100644 --- a/packages/client-sdk/package.json +++ b/packages/client-sdk/package.json @@ -6,6 +6,7 @@ "scripts": { "build": "tsc", "prepare": "tsc", + "generate:client": "openapi-ts -i ../../website/openapi.json -o src/open/client", "test": "vitest" }, "keywords": [ @@ -17,6 +18,7 @@ "load-script": "^2.0.0" }, "devDependencies": { + "@hey-api/openapi-ts": "^0.42.1", "@testing-library/dom": "^10.0.0", "happy-dom": "^14.7.1", "msw": "^2.2.13", diff --git a/packages/client-sdk/src/config.ts b/packages/client-sdk/src/config.ts new file mode 100644 index 0000000..9579c98 --- /dev/null +++ b/packages/client-sdk/src/config.ts @@ -0,0 +1,5 @@ +import { OpenAPI } from './open/client'; + +export function initOpenapiSDK(baseUrl: string) { + OpenAPI.BASE = baseUrl.endsWith('/open') ? baseUrl : `${baseUrl}/open`; +} diff --git a/packages/client-sdk/src/index.ts b/packages/client-sdk/src/index.ts index c6df020..cde4e73 100644 --- a/packages/client-sdk/src/index.ts +++ b/packages/client-sdk/src/index.ts @@ -1 +1,3 @@ +export { initOpenapiSDK } from './config'; export * from './tracker'; +export * from './survey'; diff --git a/packages/client-sdk/src/open/client/core/ApiError.ts b/packages/client-sdk/src/open/client/core/ApiError.ts new file mode 100644 index 0000000..36675d2 --- /dev/null +++ b/packages/client-sdk/src/open/client/core/ApiError.ts @@ -0,0 +1,21 @@ +import type { ApiRequestOptions } from './ApiRequestOptions'; +import type { ApiResult } from './ApiResult'; + +export class ApiError extends Error { + public readonly url: string; + public readonly status: number; + public readonly statusText: string; + public readonly body: unknown; + public readonly request: ApiRequestOptions; + + constructor(request: ApiRequestOptions, response: ApiResult, message: string) { + super(message); + + this.name = 'ApiError'; + this.url = response.url; + this.status = response.status; + this.statusText = response.statusText; + this.body = response.body; + this.request = request; + } +} \ No newline at end of file diff --git a/packages/client-sdk/src/open/client/core/ApiRequestOptions.ts b/packages/client-sdk/src/open/client/core/ApiRequestOptions.ts new file mode 100644 index 0000000..8f8d4d1 --- /dev/null +++ b/packages/client-sdk/src/open/client/core/ApiRequestOptions.ts @@ -0,0 +1,13 @@ +export type ApiRequestOptions = { + readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH'; + readonly url: string; + readonly path?: Record; + readonly cookies?: Record; + readonly headers?: Record; + readonly query?: Record; + readonly formData?: Record; + readonly body?: any; + readonly mediaType?: string; + readonly responseHeader?: string; + readonly errors?: Record; +}; \ No newline at end of file diff --git a/packages/client-sdk/src/open/client/core/ApiResult.ts b/packages/client-sdk/src/open/client/core/ApiResult.ts new file mode 100644 index 0000000..4c58e39 --- /dev/null +++ b/packages/client-sdk/src/open/client/core/ApiResult.ts @@ -0,0 +1,7 @@ +export type ApiResult = { + readonly body: TData; + readonly ok: boolean; + readonly status: number; + readonly statusText: string; + readonly url: string; +}; \ No newline at end of file diff --git a/packages/client-sdk/src/open/client/core/CancelablePromise.ts b/packages/client-sdk/src/open/client/core/CancelablePromise.ts new file mode 100644 index 0000000..ccc082e --- /dev/null +++ b/packages/client-sdk/src/open/client/core/CancelablePromise.ts @@ -0,0 +1,126 @@ +export class CancelError extends Error { + constructor(message: string) { + super(message); + this.name = 'CancelError'; + } + + public get isCancelled(): boolean { + return true; + } +} + +export interface OnCancel { + readonly isResolved: boolean; + readonly isRejected: boolean; + readonly isCancelled: boolean; + + (cancelHandler: () => void): void; +} + +export class CancelablePromise implements Promise { + private _isResolved: boolean; + private _isRejected: boolean; + private _isCancelled: boolean; + readonly cancelHandlers: (() => void)[]; + readonly promise: Promise; + private _resolve?: (value: T | PromiseLike) => void; + private _reject?: (reason?: unknown) => void; + + constructor( + executor: ( + resolve: (value: T | PromiseLike) => void, + reject: (reason?: unknown) => void, + onCancel: OnCancel + ) => void + ) { + this._isResolved = false; + this._isRejected = false; + this._isCancelled = false; + this.cancelHandlers = []; + this.promise = new Promise((resolve, reject) => { + this._resolve = resolve; + this._reject = reject; + + const onResolve = (value: T | PromiseLike): void => { + if (this._isResolved || this._isRejected || this._isCancelled) { + return; + } + this._isResolved = true; + if (this._resolve) this._resolve(value); + }; + + const onReject = (reason?: unknown): void => { + if (this._isResolved || this._isRejected || this._isCancelled) { + return; + } + this._isRejected = true; + if (this._reject) this._reject(reason); + }; + + const onCancel = (cancelHandler: () => void): void => { + if (this._isResolved || this._isRejected || this._isCancelled) { + return; + } + this.cancelHandlers.push(cancelHandler); + }; + + Object.defineProperty(onCancel, 'isResolved', { + get: (): boolean => this._isResolved, + }); + + Object.defineProperty(onCancel, 'isRejected', { + get: (): boolean => this._isRejected, + }); + + Object.defineProperty(onCancel, 'isCancelled', { + get: (): boolean => this._isCancelled, + }); + + return executor(onResolve, onReject, onCancel as OnCancel); + }); + } + + get [Symbol.toStringTag]() { + return "Cancellable Promise"; + } + + public then( + onFulfilled?: ((value: T) => TResult1 | PromiseLike) | null, + onRejected?: ((reason: unknown) => TResult2 | PromiseLike) | null + ): Promise { + return this.promise.then(onFulfilled, onRejected); + } + + public catch( + onRejected?: ((reason: unknown) => TResult | PromiseLike) | null + ): Promise { + return this.promise.catch(onRejected); + } + + public finally(onFinally?: (() => void) | null): Promise { + return this.promise.finally(onFinally); + } + + public cancel(): void { + if (this._isResolved || this._isRejected || this._isCancelled) { + return; + } + this._isCancelled = true; + if (this.cancelHandlers.length) { + try { + for (const cancelHandler of this.cancelHandlers) { + cancelHandler(); + } + } catch (error) { + console.warn('Cancellation threw an error', error); + return; + } + } + this.cancelHandlers.length = 0; + if (this._reject) this._reject(new CancelError('Request aborted')); + } + + public get isCancelled(): boolean { + return this._isCancelled; + } +} \ No newline at end of file diff --git a/packages/client-sdk/src/open/client/core/OpenAPI.ts b/packages/client-sdk/src/open/client/core/OpenAPI.ts new file mode 100644 index 0000000..326d4ea --- /dev/null +++ b/packages/client-sdk/src/open/client/core/OpenAPI.ts @@ -0,0 +1,56 @@ +import type { ApiRequestOptions } from './ApiRequestOptions'; + +type Headers = Record; +type Middleware = (value: T) => T | Promise; +type Resolver = (options: ApiRequestOptions) => Promise; + +export class Interceptors { + _fns: Middleware[]; + + constructor() { + this._fns = []; + } + + eject(fn: Middleware) { + const index = this._fns.indexOf(fn); + if (index !== -1) { + this._fns = [...this._fns.slice(0, index), ...this._fns.slice(index + 1)]; + } + } + + use(fn: Middleware) { + this._fns = [...this._fns, fn]; + } +} + +export type OpenAPIConfig = { + BASE: string; + CREDENTIALS: 'include' | 'omit' | 'same-origin'; + ENCODE_PATH?: ((path: string) => string) | undefined; + HEADERS?: Headers | Resolver | undefined; + PASSWORD?: string | Resolver | undefined; + TOKEN?: string | Resolver | undefined; + USERNAME?: string | Resolver | undefined; + VERSION: string; + WITH_CREDENTIALS: boolean; + interceptors: { + request: Interceptors; + response: Interceptors; + }; +}; + +export const OpenAPI: OpenAPIConfig = { + BASE: '/open', + CREDENTIALS: 'include', + ENCODE_PATH: undefined, + HEADERS: undefined, + PASSWORD: undefined, + TOKEN: undefined, + USERNAME: undefined, + VERSION: '1.9.2', + WITH_CREDENTIALS: false, + interceptors: { + request: new Interceptors(), + response: new Interceptors(), + }, +}; \ No newline at end of file diff --git a/packages/client-sdk/src/open/client/core/request.ts b/packages/client-sdk/src/open/client/core/request.ts new file mode 100644 index 0000000..79d04d0 --- /dev/null +++ b/packages/client-sdk/src/open/client/core/request.ts @@ -0,0 +1,341 @@ +import { ApiError } from './ApiError'; +import type { ApiRequestOptions } from './ApiRequestOptions'; +import type { ApiResult } from './ApiResult'; +import { CancelablePromise } from './CancelablePromise'; +import type { OnCancel } from './CancelablePromise'; +import type { OpenAPIConfig } from './OpenAPI'; + +export const isString = (value: unknown): value is string => { + return typeof value === 'string'; +}; + +export const isStringWithValue = (value: unknown): value is string => { + return isString(value) && value !== ''; +}; + +export const isBlob = (value: any): value is Blob => { + return value instanceof Blob; +}; + +export const isFormData = (value: unknown): value is FormData => { + return value instanceof FormData; +}; + +export const base64 = (str: string): string => { + try { + return btoa(str); + } catch (err) { + // @ts-ignore + return Buffer.from(str).toString('base64'); + } +}; + +export const getQueryString = (params: Record): string => { + const qs: string[] = []; + + const append = (key: string, value: unknown) => { + qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`); + }; + + const encodePair = (key: string, value: unknown) => { + if (value === undefined || value === null) { + return; + } + + if (value instanceof Date) { + append(key, value.toISOString()); + } else if (Array.isArray(value)) { + value.forEach(v => encodePair(key, v)); + } else if (typeof value === 'object') { + Object.entries(value).forEach(([k, v]) => encodePair(`${key}[${k}]`, v)); + } else { + append(key, value); + } + }; + + Object.entries(params).forEach(([key, value]) => encodePair(key, value)); + + return qs.length ? `?${qs.join('&')}` : ''; +}; + +const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => { + const encoder = config.ENCODE_PATH || encodeURI; + + const path = options.url + .replace('{api-version}', config.VERSION) + .replace(/{(.*?)}/g, (substring: string, group: string) => { + if (options.path?.hasOwnProperty(group)) { + return encoder(String(options.path[group])); + } + return substring; + }); + + const url = config.BASE + path; + return options.query ? url + getQueryString(options.query) : url; +}; + +export const getFormData = (options: ApiRequestOptions): FormData | undefined => { + if (options.formData) { + const formData = new FormData(); + + const process = (key: string, value: unknown) => { + if (isString(value) || isBlob(value)) { + formData.append(key, value); + } else { + formData.append(key, JSON.stringify(value)); + } + }; + + Object.entries(options.formData) + .filter(([, value]) => value !== undefined && value !== null) + .forEach(([key, value]) => { + if (Array.isArray(value)) { + value.forEach(v => process(key, v)); + } else { + process(key, value); + } + }); + + return formData; + } + return undefined; +}; + +type Resolver = (options: ApiRequestOptions) => Promise; + +export const resolve = async (options: ApiRequestOptions, resolver?: T | Resolver): Promise => { + if (typeof resolver === 'function') { + return (resolver as Resolver)(options); + } + return resolver; +}; + +export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions): Promise => { + const [token, username, password, additionalHeaders] = await Promise.all([ + resolve(options, config.TOKEN), + resolve(options, config.USERNAME), + resolve(options, config.PASSWORD), + resolve(options, config.HEADERS), + ]); + + const headers = Object.entries({ + Accept: 'application/json', + ...additionalHeaders, + ...options.headers, + }) + .filter(([, value]) => value !== undefined && value !== null) + .reduce((headers, [key, value]) => ({ + ...headers, + [key]: String(value), + }), {} as Record); + + if (isStringWithValue(token)) { + headers['Authorization'] = `Bearer ${token}`; + } + + if (isStringWithValue(username) && isStringWithValue(password)) { + const credentials = base64(`${username}:${password}`); + headers['Authorization'] = `Basic ${credentials}`; + } + + if (options.body !== undefined) { + if (options.mediaType) { + headers['Content-Type'] = options.mediaType; + } else if (isBlob(options.body)) { + headers['Content-Type'] = options.body.type || 'application/octet-stream'; + } else if (isString(options.body)) { + headers['Content-Type'] = 'text/plain'; + } else if (!isFormData(options.body)) { + headers['Content-Type'] = 'application/json'; + } + } + + return new Headers(headers); +}; + +export const getRequestBody = (options: ApiRequestOptions): unknown => { + if (options.body !== undefined) { + if (options.mediaType?.includes('application/json') || options.mediaType?.includes('+json')) { + return JSON.stringify(options.body); + } else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) { + return options.body; + } else { + return JSON.stringify(options.body); + } + } + return undefined; +}; + +export const sendRequest = async ( + config: OpenAPIConfig, + options: ApiRequestOptions, + url: string, + body: any, + formData: FormData | undefined, + headers: Headers, + onCancel: OnCancel +): Promise => { + const controller = new AbortController(); + + let request: RequestInit = { + headers, + body: body ?? formData, + method: options.method, + signal: controller.signal, + }; + + if (config.WITH_CREDENTIALS) { + request.credentials = config.CREDENTIALS; + } + + for (const fn of config.interceptors.request._fns) { + request = await fn(request); + } + + onCancel(() => controller.abort()); + + return await fetch(url, request); +}; + +export const getResponseHeader = (response: Response, responseHeader?: string): string | undefined => { + if (responseHeader) { + const content = response.headers.get(responseHeader); + if (isString(content)) { + return content; + } + } + return undefined; +}; + +export const getResponseBody = async (response: Response): Promise => { + if (response.status !== 204) { + try { + const contentType = response.headers.get('Content-Type'); + if (contentType) { + const binaryTypes = ['application/octet-stream', 'application/pdf', 'application/zip', 'audio/', 'image/', 'video/']; + if (contentType.includes('application/json') || contentType.includes('+json')) { + return await response.json(); + } else if (binaryTypes.some(type => contentType.includes(type))) { + return await response.blob(); + } else if (contentType.includes('multipart/form-data')) { + return await response.formData(); + } else if (contentType.includes('text/')) { + return await response.text(); + } + } + } catch (error) { + console.error(error); + } + } + return undefined; +}; + +export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => { + const errors: Record = { + 400: 'Bad Request', + 401: 'Unauthorized', + 402: 'Payment Required', + 403: 'Forbidden', + 404: 'Not Found', + 405: 'Method Not Allowed', + 406: 'Not Acceptable', + 407: 'Proxy Authentication Required', + 408: 'Request Timeout', + 409: 'Conflict', + 410: 'Gone', + 411: 'Length Required', + 412: 'Precondition Failed', + 413: 'Payload Too Large', + 414: 'URI Too Long', + 415: 'Unsupported Media Type', + 416: 'Range Not Satisfiable', + 417: 'Expectation Failed', + 418: 'Im a teapot', + 421: 'Misdirected Request', + 422: 'Unprocessable Content', + 423: 'Locked', + 424: 'Failed Dependency', + 425: 'Too Early', + 426: 'Upgrade Required', + 428: 'Precondition Required', + 429: 'Too Many Requests', + 431: 'Request Header Fields Too Large', + 451: 'Unavailable For Legal Reasons', + 500: 'Internal Server Error', + 501: 'Not Implemented', + 502: 'Bad Gateway', + 503: 'Service Unavailable', + 504: 'Gateway Timeout', + 505: 'HTTP Version Not Supported', + 506: 'Variant Also Negotiates', + 507: 'Insufficient Storage', + 508: 'Loop Detected', + 510: 'Not Extended', + 511: 'Network Authentication Required', + ...options.errors, + } + + const error = errors[result.status]; + if (error) { + throw new ApiError(options, result, error); + } + + if (!result.ok) { + const errorStatus = result.status ?? 'unknown'; + const errorStatusText = result.statusText ?? 'unknown'; + const errorBody = (() => { + try { + return JSON.stringify(result.body, null, 2); + } catch (e) { + return undefined; + } + })(); + + throw new ApiError(options, result, + `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}` + ); + } +}; + +/** + * Request method + * @param config The OpenAPI configuration object + * @param options The request options from the service + * @returns CancelablePromise + * @throws ApiError + */ +export const request = (config: OpenAPIConfig, options: ApiRequestOptions): CancelablePromise => { + return new CancelablePromise(async (resolve, reject, onCancel) => { + try { + const url = getUrl(config, options); + const formData = getFormData(options); + const body = getRequestBody(options); + const headers = await getHeaders(config, options); + + if (!onCancel.isCancelled) { + let response = await sendRequest(config, options, url, body, formData, headers, onCancel); + + for (const fn of config.interceptors.response._fns) { + response = await fn(response); + } + + const responseBody = await getResponseBody(response); + const responseHeader = getResponseHeader(response, options.responseHeader); + + const result: ApiResult = { + url, + ok: response.ok, + status: response.status, + statusText: response.statusText, + body: responseHeader ?? responseBody, + }; + + catchErrorCodes(options, result); + + resolve(result.body); + } + } catch (error) { + reject(error); + } + }); +}; \ No newline at end of file diff --git a/packages/client-sdk/src/open/client/index.ts b/packages/client-sdk/src/open/client/index.ts new file mode 100644 index 0000000..3e1f0b3 --- /dev/null +++ b/packages/client-sdk/src/open/client/index.ts @@ -0,0 +1,6 @@ +// This file is auto-generated by @hey-api/openapi-ts +export { ApiError } from './core/ApiError'; +export { CancelablePromise, CancelError } from './core/CancelablePromise'; +export { OpenAPI, type OpenAPIConfig } from './core/OpenAPI'; +export * from './services.gen'; +export * from './types.gen'; \ No newline at end of file diff --git a/packages/client-sdk/src/open/client/services.gen.ts b/packages/client-sdk/src/open/client/services.gen.ts new file mode 100644 index 0000000..c348854 --- /dev/null +++ b/packages/client-sdk/src/open/client/services.gen.ts @@ -0,0 +1,1145 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { CancelablePromise } from './core/CancelablePromise'; +import { OpenAPI } from './core/OpenAPI'; +import { request as __request } from './core/request'; +import type { $OpenApiTs } from './types.gen'; + +export class GlobalService { + /** + * Get Tianji system global config + * @returns unknown Successful response + * @throws ApiError + */ + public static globalConfig(): CancelablePromise<$OpenApiTs['/global/config']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/global/config' + }); + } + +} + +export class UserService { + /** + * @param data The data for the request. + * @param data.requestBody + * @returns unknown Successful response + * @throws ApiError + */ + public static userLogin(data: $OpenApiTs['/login']['post']['req']): CancelablePromise<$OpenApiTs['/login']['post']['res'][200]> { + return __request(OpenAPI, { + method: 'POST', + url: '/login', + body: data.requestBody, + mediaType: 'application/json' + }); + } + + /** + * @param data The data for the request. + * @param data.requestBody + * @returns unknown Successful response + * @throws ApiError + */ + public static userLoginWithToken(data: $OpenApiTs['/loginWithToken']['post']['req']): CancelablePromise<$OpenApiTs['/loginWithToken']['post']['res'][200]> { + return __request(OpenAPI, { + method: 'POST', + url: '/loginWithToken', + body: data.requestBody, + mediaType: 'application/json' + }); + } + + /** + * @param data The data for the request. + * @param data.requestBody + * @returns unknown Successful response + * @throws ApiError + */ + public static userRegister(data: $OpenApiTs['/register']['post']['req']): CancelablePromise<$OpenApiTs['/register']['post']['res'][200]> { + return __request(OpenAPI, { + method: 'POST', + url: '/register', + body: data.requestBody, + mediaType: 'application/json' + }); + } + +} + +export class WorkspaceService { + /** + * @param data The data for the request. + * @param data.workspaceId + * @returns unknown Successful response + * @throws ApiError + */ + public static workspaceGetServiceCount(data: $OpenApiTs['/workspace/{workspaceId}/getServiceCount']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/getServiceCount']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/getServiceCount', + path: { + workspaceId: data.workspaceId + } + }); + } + +} + +export class WebsiteService { + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.websiteId + * @returns number Successful response + * @returns unknown Error response + * @throws ApiError + */ + public static websiteOnlineCount(data: $OpenApiTs['/workspace/{workspaceId}/website/{websiteId}/onlineCount']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/website/{websiteId}/onlineCount']['get']['res'][200] | $OpenApiTs['/workspace/{workspaceId}/website/{websiteId}/onlineCount']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/website/{websiteId}/onlineCount', + path: { + workspaceId: data.workspaceId, + websiteId: data.websiteId + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @returns unknown Successful response + * @throws ApiError + */ + public static websiteAll(data: $OpenApiTs['/workspace/{workspaceId}/website/all']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/website/all']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/website/all', + path: { + workspaceId: data.workspaceId + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.websiteId + * @returns unknown Successful response + * @throws ApiError + */ + public static websiteInfo(data: $OpenApiTs['/workspace/{workspaceId}/website/{websiteId}/info']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/website/{websiteId}/info']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/website/{websiteId}/info', + path: { + workspaceId: data.workspaceId, + websiteId: data.websiteId + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.websiteId + * @param data.startAt + * @param data.endAt + * @param data.unit + * @param data.url + * @param data.country + * @param data.region + * @param data.city + * @param data.timezone + * @param data.referrer + * @param data.title + * @param data.os + * @param data.browser + * @param data.device + * @returns unknown Successful response + * @throws ApiError + */ + public static websiteStats(data: $OpenApiTs['/workspace/{workspaceId}/website/{websiteId}/stats']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/website/{websiteId}/stats']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/website/{websiteId}/stats', + path: { + workspaceId: data.workspaceId, + websiteId: data.websiteId + }, + query: { + startAt: data.startAt, + endAt: data.endAt, + unit: data.unit, + url: data.url, + country: data.country, + region: data.region, + city: data.city, + timezone: data.timezone, + referrer: data.referrer, + title: data.title, + os: data.os, + browser: data.browser, + device: data.device + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.websiteId + * @param data.startAt + * @param data.endAt + * @returns unknown Successful response + * @throws ApiError + */ + public static websiteGeoStats(data: $OpenApiTs['/workspace/{workspaceId}/website/{websiteId}/geoStats']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/website/{websiteId}/geoStats']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/website/{websiteId}/geoStats', + path: { + workspaceId: data.workspaceId, + websiteId: data.websiteId + }, + query: { + startAt: data.startAt, + endAt: data.endAt + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.websiteId + * @param data.startAt + * @param data.endAt + * @param data.unit + * @param data.url + * @param data.country + * @param data.region + * @param data.city + * @param data.timezone + * @param data.referrer + * @param data.title + * @param data.os + * @param data.browser + * @param data.device + * @returns unknown Successful response + * @throws ApiError + */ + public static websitePageviews(data: $OpenApiTs['/workspace/{workspaceId}/website/{websiteId}/pageviews']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/website/{websiteId}/pageviews']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/website/{websiteId}/pageviews', + path: { + workspaceId: data.workspaceId, + websiteId: data.websiteId + }, + query: { + startAt: data.startAt, + endAt: data.endAt, + unit: data.unit, + url: data.url, + country: data.country, + region: data.region, + city: data.city, + timezone: data.timezone, + referrer: data.referrer, + title: data.title, + os: data.os, + browser: data.browser, + device: data.device + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.websiteId + * @param data.type + * @param data.startAt + * @param data.endAt + * @param data.url + * @param data.referrer + * @param data.title + * @param data.os + * @param data.browser + * @param data.device + * @param data.country + * @param data.region + * @param data.city + * @param data.language + * @param data.event + * @returns unknown Successful response + * @throws ApiError + */ + public static websiteMetrics(data: $OpenApiTs['/workspace/{workspaceId}/website/{websiteId}/metrics']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/website/{websiteId}/metrics']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/website/{websiteId}/metrics', + path: { + workspaceId: data.workspaceId, + websiteId: data.websiteId + }, + query: { + type: data.type, + startAt: data.startAt, + endAt: data.endAt, + url: data.url, + referrer: data.referrer, + title: data.title, + os: data.os, + browser: data.browser, + device: data.device, + country: data.country, + region: data.region, + city: data.city, + language: data.language, + event: data.event + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.requestBody + * @returns unknown Successful response + * @throws ApiError + */ + public static websiteAdd(data: $OpenApiTs['/workspace/{workspaceId}/website/add']['post']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/website/add']['post']['res'][200]> { + return __request(OpenAPI, { + method: 'POST', + url: '/workspace/{workspaceId}/website/add', + path: { + workspaceId: data.workspaceId + }, + body: data.requestBody, + mediaType: 'application/json' + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.websiteId + * @param data.requestBody + * @returns unknown Successful response + * @throws ApiError + */ + public static websiteUpdateInfo(data: $OpenApiTs['/workspace/{workspaceId}/website/{websiteId}/update']['put']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/website/{websiteId}/update']['put']['res'][200]> { + return __request(OpenAPI, { + method: 'PUT', + url: '/workspace/{workspaceId}/website/{websiteId}/update', + path: { + workspaceId: data.workspaceId, + websiteId: data.websiteId + }, + body: data.requestBody, + mediaType: 'application/json' + }); + } + +} + +export class MonitorService { + /** + * @param data The data for the request. + * @param data.workspaceId + * @returns unknown Successful response + * @throws ApiError + */ + public static monitorAll(data: $OpenApiTs['/workspace/{workspaceId}/monitor/all']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/monitor/all']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/monitor/all', + path: { + workspaceId: data.workspaceId + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.monitorId + * @returns unknown Successful response + * @throws ApiError + */ + public static monitorGet(data: $OpenApiTs['/workspace/{workspaceId}/monitor/{monitorId}']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/monitor/{monitorId}']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/monitor/{monitorId}', + path: { + workspaceId: data.workspaceId, + monitorId: data.monitorId + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.monitorId + * @returns unknown Successful response + * @throws ApiError + */ + public static monitorDelete(data: $OpenApiTs['/workspace/{workspaceId}/monitor/{monitorId}']['delete']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/monitor/{monitorId}']['delete']['res'][200]> { + return __request(OpenAPI, { + method: 'DELETE', + url: '/workspace/{workspaceId}/monitor/{monitorId}', + path: { + workspaceId: data.workspaceId, + monitorId: data.monitorId + } + }); + } + + /** + * @param data The data for the request. + * @param data.requestBody + * @returns unknown Successful response + * @throws ApiError + */ + public static monitorGetPublicInfo(data: $OpenApiTs['/monitor/getPublicInfo']['post']['req']): CancelablePromise<$OpenApiTs['/monitor/getPublicInfo']['post']['res'][200]> { + return __request(OpenAPI, { + method: 'POST', + url: '/monitor/getPublicInfo', + body: data.requestBody, + mediaType: 'application/json' + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.requestBody + * @returns unknown Successful response + * @throws ApiError + */ + public static monitorUpsert(data: $OpenApiTs['/workspace/{workspaceId}/monitor/upsert']['post']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/monitor/upsert']['post']['res'][200]> { + return __request(OpenAPI, { + method: 'POST', + url: '/workspace/{workspaceId}/monitor/upsert', + path: { + workspaceId: data.workspaceId + }, + body: data.requestBody, + mediaType: 'application/json' + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.monitorId + * @param data.startAt + * @param data.endAt + * @returns unknown Successful response + * @throws ApiError + */ + public static monitorData(data: $OpenApiTs['/workspace/{workspaceId}/monitor/{monitorId}/data']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/monitor/{monitorId}/data']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/monitor/{monitorId}/data', + path: { + workspaceId: data.workspaceId, + monitorId: data.monitorId + }, + query: { + startAt: data.startAt, + endAt: data.endAt + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.monitorId + * @param data.requestBody + * @returns unknown Successful response + * @throws ApiError + */ + public static monitorChangeActive(data: $OpenApiTs['/workspace/{workspaceId}/monitor/{monitorId}/changeActive']['patch']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/monitor/{monitorId}/changeActive']['patch']['res'][200]> { + return __request(OpenAPI, { + method: 'PATCH', + url: '/workspace/{workspaceId}/monitor/{monitorId}/changeActive', + path: { + workspaceId: data.workspaceId, + monitorId: data.monitorId + }, + body: data.requestBody, + mediaType: 'application/json' + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.monitorId + * @param data.take + * @returns unknown Successful response + * @throws ApiError + */ + public static monitorRecentData(data: $OpenApiTs['/workspace/{workspaceId}/monitor/{monitorId}/recentData']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/monitor/{monitorId}/recentData']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/monitor/{monitorId}/recentData', + path: { + workspaceId: data.workspaceId, + monitorId: data.monitorId + }, + query: { + take: data.take + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.monitorId + * @returns unknown Successful response + * @throws ApiError + */ + public static monitorDataMetrics(data: $OpenApiTs['/workspace/{workspaceId}/monitor/{monitorId}/dataMetrics']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/monitor/{monitorId}/dataMetrics']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/monitor/{monitorId}/dataMetrics', + path: { + workspaceId: data.workspaceId, + monitorId: data.monitorId + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.monitorId + * @param data.limit + * @returns unknown Successful response + * @throws ApiError + */ + public static monitorEvents(data: $OpenApiTs['/workspace/{workspaceId}/monitor/events']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/monitor/events']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/monitor/events', + path: { + workspaceId: data.workspaceId + }, + query: { + monitorId: data.monitorId, + limit: data.limit + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.monitorId + * @returns number Successful response + * @returns unknown Error response + * @throws ApiError + */ + public static monitorClearEvents(data: $OpenApiTs['/workspace/{workspaceId}/monitor/clearEvents']['delete']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/monitor/clearEvents']['delete']['res'][200] | $OpenApiTs['/workspace/{workspaceId}/monitor/clearEvents']['delete']['res'][200]> { + return __request(OpenAPI, { + method: 'DELETE', + url: '/workspace/{workspaceId}/monitor/clearEvents', + path: { + workspaceId: data.workspaceId + }, + query: { + monitorId: data.monitorId + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.monitorId + * @returns number Successful response + * @returns unknown Error response + * @throws ApiError + */ + public static monitorClearData(data: $OpenApiTs['/workspace/{workspaceId}/monitor/clearData']['delete']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/monitor/clearData']['delete']['res'][200] | $OpenApiTs['/workspace/{workspaceId}/monitor/clearData']['delete']['res'][200]> { + return __request(OpenAPI, { + method: 'DELETE', + url: '/workspace/{workspaceId}/monitor/clearData', + path: { + workspaceId: data.workspaceId + }, + query: { + monitorId: data.monitorId + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.monitorId + * @param data.statusName + * @returns unknown Successful response + * @throws ApiError + */ + public static monitorGetStatus(data: $OpenApiTs['/workspace/{workspaceId}/monitor/{monitorId}/status']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/monitor/{monitorId}/status']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/monitor/{monitorId}/status', + path: { + workspaceId: data.workspaceId, + monitorId: data.monitorId + }, + query: { + statusName: data.statusName + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @returns unknown Successful response + * @throws ApiError + */ + public static monitorGetAllPages(data: $OpenApiTs['/workspace/{workspaceId}/monitor/getAllPages']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/monitor/getAllPages']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/monitor/getAllPages', + path: { + workspaceId: data.workspaceId + } + }); + } + + /** + * @param data The data for the request. + * @param data.slug + * @returns unknown Successful response + * @throws ApiError + */ + public static monitorGetPageInfo(data: $OpenApiTs['/monitor/getPageInfo']['get']['req']): CancelablePromise<$OpenApiTs['/monitor/getPageInfo']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/monitor/getPageInfo', + query: { + slug: data.slug + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.requestBody + * @returns unknown Successful response + * @throws ApiError + */ + public static monitorCreatePage(data: $OpenApiTs['/workspace/{workspaceId}/monitor/createStatusPage']['post']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/monitor/createStatusPage']['post']['res'][200]> { + return __request(OpenAPI, { + method: 'POST', + url: '/workspace/{workspaceId}/monitor/createStatusPage', + path: { + workspaceId: data.workspaceId + }, + body: data.requestBody, + mediaType: 'application/json' + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.requestBody + * @returns unknown Successful response + * @throws ApiError + */ + public static monitorEditPage(data: $OpenApiTs['/workspace/{workspaceId}/monitor/updateStatusPage']['patch']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/monitor/updateStatusPage']['patch']['res'][200]> { + return __request(OpenAPI, { + method: 'PATCH', + url: '/workspace/{workspaceId}/monitor/updateStatusPage', + path: { + workspaceId: data.workspaceId + }, + body: data.requestBody, + mediaType: 'application/json' + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.id + * @returns unknown Successful response + * @throws ApiError + */ + public static monitorDeletePage(data: $OpenApiTs['/workspace/{workspaceId}/monitor/deleteStatusPage']['delete']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/monitor/deleteStatusPage']['delete']['res'][200]> { + return __request(OpenAPI, { + method: 'DELETE', + url: '/workspace/{workspaceId}/monitor/deleteStatusPage', + path: { + workspaceId: data.workspaceId + }, + query: { + id: data.id + } + }); + } + +} + +export class TelemetryService { + /** + * @param data The data for the request. + * @param data.workspaceId + * @returns unknown Successful response + * @throws ApiError + */ + public static telemetryAll(data: $OpenApiTs['/workspace/{workspaceId}/telemetry/all']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/telemetry/all']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/telemetry/all', + path: { + workspaceId: data.workspaceId + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.telemetryId + * @returns unknown Successful response + * @throws ApiError + */ + public static telemetryInfo(data: $OpenApiTs['/workspace/{workspaceId}/telemetry/info']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/telemetry/info']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/telemetry/info', + path: { + workspaceId: data.workspaceId + }, + query: { + telemetryId: data.telemetryId + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @returns number Successful response + * @returns unknown Error response + * @throws ApiError + */ + public static telemetryAllEventCount(data: $OpenApiTs['/workspace/{workspaceId}/telemetry/allEventCount']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/telemetry/allEventCount']['get']['res'][200] | $OpenApiTs['/workspace/{workspaceId}/telemetry/allEventCount']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/telemetry/allEventCount', + path: { + workspaceId: data.workspaceId + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.telemetryId + * @returns number Successful response + * @returns unknown Error response + * @throws ApiError + */ + public static telemetryEventCount(data: $OpenApiTs['/workspace/{workspaceId}/telemetry/eventCount']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/telemetry/eventCount']['get']['res'][200] | $OpenApiTs['/workspace/{workspaceId}/telemetry/eventCount']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/telemetry/eventCount', + path: { + workspaceId: data.workspaceId + }, + query: { + telemetryId: data.telemetryId + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.requestBody + * @returns unknown Successful response + * @throws ApiError + */ + public static telemetryUpsert(data: $OpenApiTs['/workspace/{workspaceId}/telemetry/upsert']['post']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/telemetry/upsert']['post']['res'][200]> { + return __request(OpenAPI, { + method: 'POST', + url: '/workspace/{workspaceId}/telemetry/upsert', + path: { + workspaceId: data.workspaceId + }, + body: data.requestBody, + mediaType: 'application/json' + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.requestBody + * @returns unknown Successful response + * @throws ApiError + */ + public static telemetryDelete(data: $OpenApiTs['/workspace/{workspaceId}/telemetry/delete']['post']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/telemetry/delete']['post']['res'][200]> { + return __request(OpenAPI, { + method: 'POST', + url: '/workspace/{workspaceId}/telemetry/delete', + path: { + workspaceId: data.workspaceId + }, + body: data.requestBody, + mediaType: 'application/json' + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.telemetryId + * @param data.startAt + * @param data.endAt + * @param data.unit + * @param data.url + * @param data.country + * @param data.region + * @param data.city + * @param data.timezone + * @returns unknown Successful response + * @throws ApiError + */ + public static telemetryPageviews(data: $OpenApiTs['/workspace/{workspaceId}/telemetry/pageviews']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/telemetry/pageviews']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/telemetry/pageviews', + path: { + workspaceId: data.workspaceId + }, + query: { + telemetryId: data.telemetryId, + startAt: data.startAt, + endAt: data.endAt, + unit: data.unit, + url: data.url, + country: data.country, + region: data.region, + city: data.city, + timezone: data.timezone + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.telemetryId + * @param data.type + * @param data.startAt + * @param data.endAt + * @param data.url + * @param data.country + * @param data.region + * @param data.city + * @param data.timezone + * @returns unknown Successful response + * @throws ApiError + */ + public static telemetryMetrics(data: $OpenApiTs['/workspace/{workspaceId}/telemetry/metrics']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/telemetry/metrics']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/telemetry/metrics', + path: { + workspaceId: data.workspaceId + }, + query: { + telemetryId: data.telemetryId, + type: data.type, + startAt: data.startAt, + endAt: data.endAt, + url: data.url, + country: data.country, + region: data.region, + city: data.city, + timezone: data.timezone + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.telemetryId + * @param data.startAt + * @param data.endAt + * @param data.unit + * @param data.url + * @param data.country + * @param data.region + * @param data.city + * @param data.timezone + * @returns unknown Successful response + * @throws ApiError + */ + public static telemetryStats(data: $OpenApiTs['/workspace/{workspaceId}/telemetry/stats']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/telemetry/stats']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/telemetry/stats', + path: { + workspaceId: data.workspaceId + }, + query: { + telemetryId: data.telemetryId, + startAt: data.startAt, + endAt: data.endAt, + unit: data.unit, + url: data.url, + country: data.country, + region: data.region, + city: data.city, + timezone: data.timezone + } + }); + } + +} + +export class SurveyService { + /** + * @param data The data for the request. + * @param data.workspaceId + * @returns unknown Successful response + * @throws ApiError + */ + public static surveyAll(data: $OpenApiTs['/workspace/{workspaceId}/survey//all']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/survey//all']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/survey//all', + path: { + workspaceId: data.workspaceId + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.surveyId + * @returns unknown Successful response + * @throws ApiError + */ + public static surveyGet(data: $OpenApiTs['/workspace/{workspaceId}/survey//{surveyId}']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/survey//{surveyId}']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/survey//{surveyId}', + path: { + workspaceId: data.workspaceId, + surveyId: data.surveyId + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.surveyId + * @returns number Successful response + * @returns unknown Error response + * @throws ApiError + */ + public static surveyCount(data: $OpenApiTs['/workspace/{workspaceId}/survey//{surveyId}/count']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/survey//{surveyId}/count']['get']['res'][200] | $OpenApiTs['/workspace/{workspaceId}/survey//{surveyId}/count']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/survey//{surveyId}/count', + path: { + workspaceId: data.workspaceId, + surveyId: data.surveyId + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @returns number Successful response + * @returns unknown Error response + * @throws ApiError + */ + public static surveyAllResultCount(data: $OpenApiTs['/workspace/{workspaceId}/survey//allResultCount']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/survey//allResultCount']['get']['res'][200] | $OpenApiTs['/workspace/{workspaceId}/survey//allResultCount']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/survey//allResultCount', + path: { + workspaceId: data.workspaceId + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.surveyId + * @param data.requestBody + * @returns unknown Successful response + * @throws ApiError + */ + public static surveySubmit(data: $OpenApiTs['/workspace/{workspaceId}/survey//{surveyId}/submit']['post']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/survey//{surveyId}/submit']['post']['res'][200]> { + return __request(OpenAPI, { + method: 'POST', + url: '/workspace/{workspaceId}/survey//{surveyId}/submit', + path: { + workspaceId: data.workspaceId, + surveyId: data.surveyId + }, + body: data.requestBody, + mediaType: 'application/json' + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.requestBody + * @returns unknown Successful response + * @throws ApiError + */ + public static surveyCreate(data: $OpenApiTs['/workspace/{workspaceId}/survey//create']['post']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/survey//create']['post']['res'][200]> { + return __request(OpenAPI, { + method: 'POST', + url: '/workspace/{workspaceId}/survey//create', + path: { + workspaceId: data.workspaceId + }, + body: data.requestBody, + mediaType: 'application/json' + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.surveyId + * @param data.requestBody + * @returns unknown Successful response + * @throws ApiError + */ + public static surveyUpdate(data: $OpenApiTs['/workspace/{workspaceId}/survey//{surveyId}/update']['patch']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/survey//{surveyId}/update']['patch']['res'][200]> { + return __request(OpenAPI, { + method: 'PATCH', + url: '/workspace/{workspaceId}/survey//{surveyId}/update', + path: { + workspaceId: data.workspaceId, + surveyId: data.surveyId + }, + body: data.requestBody, + mediaType: 'application/json' + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.surveyId + * @returns unknown Successful response + * @throws ApiError + */ + public static surveyDelete(data: $OpenApiTs['/workspace/{workspaceId}/survey//{surveyId}/delete']['delete']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/survey//{surveyId}/delete']['delete']['res'][200]> { + return __request(OpenAPI, { + method: 'DELETE', + url: '/workspace/{workspaceId}/survey//{surveyId}/delete', + path: { + workspaceId: data.workspaceId, + surveyId: data.surveyId + } + }); + } + + /** + * @param data The data for the request. + * @param data.workspaceId + * @param data.surveyId + * @param data.limit + * @param data.cursor + * @returns unknown Successful response + * @throws ApiError + */ + public static surveyResultList(data: $OpenApiTs['/workspace/{workspaceId}/survey//{surveyId}/result/list']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/survey//{surveyId}/result/list']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/workspace/{workspaceId}/survey//{surveyId}/result/list', + path: { + workspaceId: data.workspaceId, + surveyId: data.surveyId + }, + query: { + limit: data.limit, + cursor: data.cursor + } + }); + } + +} + +export class AuditLogService { + /** + * Fetch workspace audit log + * @param data The data for the request. + * @param data.workspaceId + * @param data.limit + * @param data.cursor + * @returns unknown Successful response + * @throws ApiError + */ + public static auditLogFetchByCursor(data: $OpenApiTs['/audit/fetchByCursor']['get']['req']): CancelablePromise<$OpenApiTs['/audit/fetchByCursor']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/audit/fetchByCursor', + query: { + workspaceId: data.workspaceId, + limit: data.limit, + cursor: data.cursor + } + }); + } + +} + +export class BillingService { + /** + * get workspace usage + * @param data The data for the request. + * @param data.workspaceId + * @param data.startAt + * @param data.endAt + * @returns unknown Successful response + * @throws ApiError + */ + public static billingUsage(data: $OpenApiTs['/billing/usage']['get']['req']): CancelablePromise<$OpenApiTs['/billing/usage']['get']['res'][200]> { + return __request(OpenAPI, { + method: 'GET', + url: '/billing/usage', + query: { + workspaceId: data.workspaceId, + startAt: data.startAt, + endAt: data.endAt + } + }); + } + +} \ No newline at end of file diff --git a/packages/client-sdk/src/open/client/types.gen.ts b/packages/client-sdk/src/open/client/types.gen.ts new file mode 100644 index 0000000..3cd97dd --- /dev/null +++ b/packages/client-sdk/src/open/client/types.gen.ts @@ -0,0 +1,1394 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type $OpenApiTs = { + '/global/config': { + get: { + res: { + /** + * Successful response + */ + 200: { + allowRegister: boolean; + websiteId?: string; + amapToken?: string; + mapboxToken?: string; + alphaMode: boolean; + disableAnonymousTelemetry: boolean; + customTrackerScriptName?: string; + }; + }; + }; + }; + '/login': { + post: { + req: { + requestBody: { + username: string; + password: string; + }; + }; + res: { + /** + * Successful response + */ + 200: { + info: { + username: string; + id: string; + role: string; + createdAt: string; + updatedAt: string; + deletedAt: string | null; + currentWorkspace: { + id: string; + name: string; + dashboardLayout: { + layouts: { + [key: string]: (unknown[]); + }; + items: unknown[]; + } | null; + }; + workspaces: Array<{ + role: string; + workspace: { + id: string; + name: string; + }; + }>; + }; + token: string; + }; + }; + }; + }; + '/loginWithToken': { + post: { + req: { + requestBody: { + token: string; + }; + }; + res: { + /** + * Successful response + */ + 200: { + info: { + username: string; + id: string; + role: string; + createdAt: string; + updatedAt: string; + deletedAt: string | null; + currentWorkspace: { + id: string; + name: string; + dashboardLayout: { + layouts: { + [key: string]: (unknown[]); + }; + items: unknown[]; + } | null; + }; + workspaces: Array<{ + role: string; + workspace: { + id: string; + name: string; + }; + }>; + }; + token: string; + }; + }; + }; + }; + '/register': { + post: { + req: { + requestBody: { + username: string; + password: string; + }; + }; + res: { + /** + * Successful response + */ + 200: { + info: { + username: string; + id: string; + role: string; + createdAt: string; + updatedAt: string; + deletedAt: string | null; + currentWorkspace: { + id: string; + name: string; + dashboardLayout: { + layouts: { + [key: string]: (unknown[]); + }; + items: unknown[]; + } | null; + }; + workspaces: Array<{ + role: string; + workspace: { + id: string; + name: string; + }; + }>; + }; + token: string; + }; + }; + }; + }; + '/workspace/{workspaceId}/getServiceCount': { + get: { + req: { + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + website: number; + monitor: number; + server: number; + telemetry: number; + page: number; + survey: number; + }; + }; + }; + }; + '/workspace/{workspaceId}/website/{websiteId}/onlineCount': { + get: { + req: { + websiteId: string; + workspaceId: string; + }; + res: { + /** + * Error response + */ + 200: { + message: string; + code: string; + issues?: Array<{ + message: string; + }>; + }; + }; + }; + }; + '/workspace/{workspaceId}/website/all': { + get: { + req: { + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: Array<{ + id: string; + workspaceId: string; + name: string; + domain: string | null; + shareId: string | null; + resetAt: string | null; + monitorId: string | null; + createdAt: string; + updatedAt: string; + deletedAt: string | null; + }>; + }; + }; + }; + '/workspace/{workspaceId}/website/{websiteId}/info': { + get: { + req: { + websiteId: string; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + id: string; + workspaceId: string; + name: string; + domain: string | null; + shareId: string | null; + resetAt: string | null; + monitorId: string | null; + createdAt: string; + updatedAt: string; + deletedAt: string | null; + } | null; + }; + }; + }; + '/workspace/{workspaceId}/website/{websiteId}/stats': { + get: { + req: { + browser?: string; + city?: string; + country?: string; + device?: string; + endAt: number; + os?: string; + referrer?: string; + region?: string; + startAt: number; + timezone?: string; + title?: string; + unit?: string; + url?: string; + websiteId: string; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + pageviews: { + value: number; + prev: number; + }; + uniques: { + value: number; + prev: number; + }; + totaltime: { + value: number; + prev: number; + }; + bounces: { + value: number; + prev: number; + }; + }; + }; + }; + }; + '/workspace/{workspaceId}/website/{websiteId}/geoStats': { + get: { + req: { + endAt: number; + startAt: number; + websiteId: string; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: Array<{ + longitude: number; + latitude: number; + count: number; + }>; + }; + }; + }; + '/workspace/{workspaceId}/website/{websiteId}/pageviews': { + get: { + req: { + browser?: string; + city?: string; + country?: string; + device?: string; + endAt: number; + os?: string; + referrer?: string; + region?: string; + startAt: number; + timezone?: string; + title?: string; + unit?: string; + url?: string; + websiteId: string; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + pageviews?: unknown; + sessions?: unknown; + }; + }; + }; + }; + '/workspace/{workspaceId}/website/{websiteId}/metrics': { + get: { + req: { + browser?: string; + city?: string; + country?: string; + device?: string; + endAt: number; + event?: string; + language?: string; + os?: string; + referrer?: string; + region?: string; + startAt: number; + title?: string; + type: 'url' | 'language' | 'referrer' | 'browser' | 'os' | 'device' | 'country' | 'event'; + url?: string; + websiteId: string; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: Array<{ + x: string | null; + y: number; + }>; + }; + }; + }; + '/workspace/{workspaceId}/website/add': { + post: { + req: { + requestBody: { + name: string; + domain: string | unknown; + }; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + id: string; + workspaceId: string; + name: string; + domain: string | null; + shareId: string | null; + resetAt: string | null; + monitorId: string | null; + createdAt: string; + updatedAt: string; + deletedAt: string | null; + }; + }; + }; + }; + '/workspace/{workspaceId}/website/{websiteId}/update': { + put: { + req: { + requestBody: { + name: string; + domain: string | unknown; + monitorId?: string | null; + }; + websiteId: string; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + id: string; + workspaceId: string; + name: string; + domain: string | null; + shareId: string | null; + resetAt: string | null; + monitorId: string | null; + createdAt: string; + updatedAt: string; + deletedAt: string | null; + }; + }; + }; + }; + '/workspace/{workspaceId}/monitor/all': { + get: { + req: { + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: Array<{ + id: string; + workspaceId: string; + name: string; + type: string; + active: boolean; + interval: number; + maxRetries: number; + payload: { + [key: string]: unknown; + }; + createdAt: string; + updatedAt: string; + notifications: Array<{ + id: string; + }>; + }>; + }; + }; + }; + '/workspace/{workspaceId}/monitor/{monitorId}': { + get: { + req: { + monitorId: string; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + id: string; + workspaceId: string; + name: string; + type: string; + active: boolean; + interval: number; + maxRetries: number; + payload: { + [key: string]: unknown; + }; + createdAt: string; + updatedAt: string; + notifications: Array<{ + id: string; + }>; + } | null; + }; + }; + delete: { + req: { + monitorId: string; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + id: string; + workspaceId: string; + name: string; + type: string; + active: boolean; + interval: number; + maxRetries: number; + payload: { + [key: string]: unknown; + }; + createdAt: string; + updatedAt: string; + }; + }; + }; + }; + '/monitor/getPublicInfo': { + post: { + req: { + requestBody: { + monitorIds: Array<(string)>; + }; + }; + res: { + /** + * Successful response + */ + 200: Array<{ + id: string; + name: string; + type: string; + }>; + }; + }; + }; + '/workspace/{workspaceId}/monitor/upsert': { + post: { + req: { + requestBody: { + id?: string; + name: string; + type: string; + active?: boolean; + interval?: number; + maxRetries?: number; + notificationIds?: Array<(string)>; + payload: { + [key: string]: unknown; + }; + }; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + id: string; + workspaceId: string; + name: string; + type: string; + active: boolean; + interval: number; + maxRetries: number; + payload: { + [key: string]: unknown; + }; + createdAt: string; + updatedAt: string; + }; + }; + }; + }; + '/workspace/{workspaceId}/monitor/{monitorId}/data': { + get: { + req: { + endAt: number; + monitorId: string; + startAt: number; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: Array<{ + value: number; + createdAt: string; + }>; + }; + }; + }; + '/workspace/{workspaceId}/monitor/{monitorId}/changeActive': { + patch: { + req: { + monitorId: string; + requestBody: { + active: boolean; + }; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + id: string; + workspaceId: string; + name: string; + type: string; + active: boolean; + interval: number; + maxRetries: number; + payload: { + [key: string]: unknown; + }; + createdAt: string; + updatedAt: string; + }; + }; + }; + }; + '/workspace/{workspaceId}/monitor/{monitorId}/recentData': { + get: { + req: { + monitorId: string; + take: number; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: Array<{ + value: number; + createdAt: string; + }>; + }; + }; + }; + '/workspace/{workspaceId}/monitor/{monitorId}/dataMetrics': { + get: { + req: { + monitorId: string; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + recent1DayAvg: number; + recent1DayOnlineCount: number; + recent1DayOfflineCount: number; + recent30DayOnlineCount: number; + recent30DayOfflineCount: number; + }; + }; + }; + }; + '/workspace/{workspaceId}/monitor/events': { + get: { + req: { + limit?: number; + monitorId?: string; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: Array<{ + id: string; + message: string; + monitorId: string; + type: string; + createdAt: string; + }>; + }; + }; + }; + '/workspace/{workspaceId}/monitor/clearEvents': { + delete: { + req: { + monitorId: string; + workspaceId: string; + }; + res: { + /** + * Error response + */ + 200: { + message: string; + code: string; + issues?: Array<{ + message: string; + }>; + }; + }; + }; + }; + '/workspace/{workspaceId}/monitor/clearData': { + delete: { + req: { + monitorId: string; + workspaceId: string; + }; + res: { + /** + * Error response + */ + 200: { + message: string; + code: string; + issues?: Array<{ + message: string; + }>; + }; + }; + }; + }; + '/workspace/{workspaceId}/monitor/{monitorId}/status': { + get: { + req: { + monitorId: string; + statusName: string; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + monitorId: string; + statusName: string; + payload: 'null' | null | { + [key: string]: unknown; +} | unknown[] | string | boolean | number; + createdAt: string; + updatedAt: string; + } | null; + }; + }; + }; + '/workspace/{workspaceId}/monitor/getAllPages': { + get: { + req: { + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: Array<{ + id: string; + workspaceId: string; + slug: string; + title: string; + description: string; + monitorList: Array<{ + id: string; + showCurrent?: boolean; + }>; + domain?: string | null; + createdAt: string; + updatedAt: string; + }>; + }; + }; + }; + '/monitor/getPageInfo': { + get: { + req: { + slug: string; + }; + res: { + /** + * Successful response + */ + 200: { + id: string; + workspaceId: string; + slug: string; + title: string; + description: string; + monitorList: Array<{ + id: string; + showCurrent?: boolean; + }>; + domain?: string | null; + createdAt: string; + updatedAt: string; + } | null; + }; + }; + }; + '/workspace/{workspaceId}/monitor/createStatusPage': { + post: { + req: { + requestBody: { + slug: string; + title: string; + description?: string; + monitorList?: Array<{ + id: string; + showCurrent?: boolean; + }>; + domain?: string | null; + }; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + id: string; + workspaceId: string; + slug: string; + title: string; + description: string; + monitorList: Array<{ + id: string; + showCurrent?: boolean; + }>; + domain?: string | null; + createdAt: string; + updatedAt: string; + }; + }; + }; + }; + '/workspace/{workspaceId}/monitor/updateStatusPage': { + patch: { + req: { + requestBody: { + id: string; + slug?: string; + title?: string; + description?: string; + monitorList?: Array<{ + id: string; + showCurrent?: boolean; + }>; + domain?: string | null; + }; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + id: string; + workspaceId: string; + slug: string; + title: string; + description: string; + monitorList: Array<{ + id: string; + showCurrent?: boolean; + }>; + domain?: string | null; + createdAt: string; + updatedAt: string; + }; + }; + }; + }; + '/workspace/{workspaceId}/monitor/deleteStatusPage': { + delete: { + req: { + id: string; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + id: string; + workspaceId: string; + slug: string; + title: string; + description: string; + monitorList: Array<{ + id: string; + showCurrent?: boolean; + }>; + domain?: string | null; + createdAt: string; + updatedAt: string; + }; + }; + }; + }; + '/workspace/{workspaceId}/telemetry/all': { + get: { + req: { + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: Array<{ + id: string; + workspaceId: string; + name: string; + createdAt: string; + updatedAt: string; + deletedAt?: string | null; + }>; + }; + }; + }; + '/workspace/{workspaceId}/telemetry/info': { + get: { + req: { + telemetryId: string; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + id: string; + workspaceId: string; + name: string; + createdAt: string; + updatedAt: string; + deletedAt?: string | null; + } | null; + }; + }; + }; + '/workspace/{workspaceId}/telemetry/allEventCount': { + get: { + req: { + workspaceId: string; + }; + res: { + /** + * Error response + */ + 200: { + message: string; + code: string; + issues?: Array<{ + message: string; + }>; + }; + }; + }; + }; + '/workspace/{workspaceId}/telemetry/eventCount': { + get: { + req: { + telemetryId: string; + workspaceId: string; + }; + res: { + /** + * Error response + */ + 200: { + message: string; + code: string; + issues?: Array<{ + message: string; + }>; + }; + }; + }; + }; + '/workspace/{workspaceId}/telemetry/upsert': { + post: { + req: { + requestBody: { + telemetryId?: string; + name: string; + }; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + id: string; + workspaceId: string; + name: string; + createdAt: string; + updatedAt: string; + deletedAt?: string | null; + }; + }; + }; + }; + '/workspace/{workspaceId}/telemetry/delete': { + post: { + req: { + requestBody: { + telemetryId: string; + }; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + id: string; + workspaceId: string; + name: string; + createdAt: string; + updatedAt: string; + deletedAt?: string | null; + }; + }; + }; + }; + '/workspace/{workspaceId}/telemetry/pageviews': { + get: { + req: { + city?: string; + country?: string; + endAt: number; + region?: string; + startAt: number; + telemetryId: string; + timezone?: string; + unit?: string; + url?: string; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + pageviews?: unknown; + sessions?: unknown; + }; + }; + }; + }; + '/workspace/{workspaceId}/telemetry/metrics': { + get: { + req: { + city?: string; + country?: string; + endAt: number; + region?: string; + startAt: number; + telemetryId: string; + timezone?: string; + type: 'source' | 'url' | 'event' | 'referrer' | 'country'; + url?: string; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: Array<{ + x: string | null; + y: number; + }>; + }; + }; + }; + '/workspace/{workspaceId}/telemetry/stats': { + get: { + req: { + city?: string; + country?: string; + endAt: number; + region?: string; + startAt: number; + telemetryId: string; + timezone?: string; + unit?: string; + url?: string; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + pageviews: { + value: number; + prev: number; + }; + uniques: { + value: number; + prev: number; + }; + }; + }; + }; + }; + '/workspace/{workspaceId}/survey//all': { + get: { + req: { + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: Array<{ + id: string; + workspaceId: string; + name: string; + payload: { + items: Array<{ + label: string; + name: string; + type: 'text' | 'select' | 'email'; + options?: Array<(string)>; + }>; + }; + createdAt: string; + updatedAt: string; + }>; + }; + }; + }; + '/workspace/{workspaceId}/survey//{surveyId}': { + get: { + req: { + surveyId: string; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + id: string; + workspaceId: string; + name: string; + payload: { + items: Array<{ + label: string; + name: string; + type: 'text' | 'select' | 'email'; + options?: Array<(string)>; + }>; + }; + createdAt: string; + updatedAt: string; + } | null; + }; + }; + }; + '/workspace/{workspaceId}/survey//{surveyId}/count': { + get: { + req: { + surveyId: string; + workspaceId: string; + }; + res: { + /** + * Error response + */ + 200: { + message: string; + code: string; + issues?: Array<{ + message: string; + }>; + }; + }; + }; + }; + '/workspace/{workspaceId}/survey//allResultCount': { + get: { + req: { + workspaceId: string; + }; + res: { + /** + * Error response + */ + 200: { + message: string; + code: string; + issues?: Array<{ + message: string; + }>; + }; + }; + }; + }; + '/workspace/{workspaceId}/survey//{surveyId}/submit': { + post: { + req: { + requestBody: { + payload: { + [key: string]: unknown; + }; + }; + surveyId: string; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: unknown; + }; + }; + }; + '/workspace/{workspaceId}/survey//create': { + post: { + req: { + requestBody: { + name: string; + payload: { + items: Array<{ + label: string; + name: string; + type: 'text' | 'select' | 'email'; + options?: Array<(string)>; + }>; + }; + }; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + id: string; + workspaceId: string; + name: string; + payload: { + items: Array<{ + label: string; + name: string; + type: 'text' | 'select' | 'email'; + options?: Array<(string)>; + }>; + }; + createdAt: string; + updatedAt: string; + }; + }; + }; + }; + '/workspace/{workspaceId}/survey//{surveyId}/update': { + patch: { + req: { + requestBody: { + name?: string; + payload?: { + items: Array<{ + label: string; + name: string; + type: 'text' | 'select' | 'email'; + options?: Array<(string)>; + }>; + }; + }; + surveyId: string; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + id: string; + workspaceId: string; + name: string; + payload: { + items: Array<{ + label: string; + name: string; + type: 'text' | 'select' | 'email'; + options?: Array<(string)>; + }>; + }; + createdAt: string; + updatedAt: string; + }; + }; + }; + }; + '/workspace/{workspaceId}/survey//{surveyId}/delete': { + delete: { + req: { + surveyId: string; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + id: string; + workspaceId: string; + name: string; + payload: { + items: Array<{ + label: string; + name: string; + type: 'text' | 'select' | 'email'; + options?: Array<(string)>; + }>; + }; + createdAt: string; + updatedAt: string; + }; + }; + }; + }; + '/workspace/{workspaceId}/survey//{surveyId}/result/list': { + get: { + req: { + cursor?: string; + limit?: number; + surveyId: string; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + items: Array<{ + id: string; + surveyId: string; + createdAt: string; + sessionId: string; + payload: { + [key: string]: unknown; + }; + browser?: string | null; + os?: string | null; + language?: string | null; + ip?: string | null; + country?: string | null; + subdivision1?: string | null; + subdivision2?: string | null; + city?: string | null; + longitude?: number | null; + latitude?: number | null; + accuracyRadius?: number | null; + }>; + nextCursor?: string; + }; + }; + }; + }; + '/audit/fetchByCursor': { + get: { + req: { + cursor?: string; + limit?: number; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + items: Array<{ + id: string; + workspaceId: string; + content: string; + relatedId?: string | null; + relatedType?: 'Monitor' | 'Notification' | null; + createdAt: string; + }>; + nextCursor?: string; + }; + }; + }; + }; + '/billing/usage': { + get: { + req: { + endAt: number; + startAt: number; + workspaceId: string; + }; + res: { + /** + * Successful response + */ + 200: { + websiteAcceptedCount: number; + websiteEventCount: number; + monitorExecutionCount: number; + }; + }; + }; + }; +}; \ No newline at end of file diff --git a/packages/client-sdk/src/survey.ts b/packages/client-sdk/src/survey.ts new file mode 100644 index 0000000..2705ec5 --- /dev/null +++ b/packages/client-sdk/src/survey.ts @@ -0,0 +1,26 @@ +import { SurveyService } from './open/client'; + +export async function getSurveyInfo(workspaceId: string, surveyId: string) { + const survey = await SurveyService.surveyGet({ + workspaceId, + surveyId, + }); + + return survey; +} + +export async function submitSurvey( + workspaceId: string, + surveyId: string, + payload: Record +) { + const res = await SurveyService.surveySubmit({ + workspaceId, + surveyId, + requestBody: { + payload, + }, + }); + + return res; +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d995802..716807f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -67,6 +67,9 @@ importers: specifier: ^2.0.0 version: 2.0.0 devDependencies: + '@hey-api/openapi-ts': + specifier: ^0.42.1 + version: 0.42.1(typescript@5.4.5) '@testing-library/dom': specifier: ^10.0.0 version: 10.0.0 @@ -1849,6 +1852,15 @@ packages: - reflect-metadata dev: false + /@apidevtools/json-schema-ref-parser@11.5.5: + resolution: {integrity: sha512-hv/aXDILyroHioVW27etFMV+IX6FyNn41YwbeGIAt5h/7fUTQvHI5w3ols8qYAT8aQt3kzexq5ZwxFDxNHIhdQ==} + engines: {node: '>= 16'} + dependencies: + '@jsdevtools/ono': 7.1.3 + '@types/json-schema': 7.0.15 + js-yaml: 4.1.0 + dev: true + /@babel/code-frame@7.23.5: resolution: {integrity: sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==} engines: {node: '>=6.9.0'} @@ -6359,6 +6371,21 @@ packages: dependencies: '@hapi/hoek': 9.3.0 + /@hey-api/openapi-ts@0.42.1(typescript@5.4.5): + resolution: {integrity: sha512-hLWNkTwvF0xdop8R6WTXNZRS+Nc4qPxf15Bad0Ft03rR/DGi4UkHtrjDsSo7ZqIZjl82mXNOxuX8j6ZS5VF2Gw==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + peerDependencies: + typescript: ^5.x + dependencies: + '@apidevtools/json-schema-ref-parser': 11.5.5 + c12: 1.10.0 + camelcase: 8.0.0 + commander: 12.0.0 + handlebars: 4.7.8 + typescript: 5.4.5 + dev: true + /@hookform/resolvers@3.3.4(react-hook-form@7.51.1): resolution: {integrity: sha512-o5cgpGOuJYrd+iMKvkttOclgwRW86EsWJZZRC23prf0uU2i48Htq4PuT73AVb9ionFyZrwYEITuOFGF+BydEtQ==} peerDependencies: @@ -6539,6 +6566,10 @@ packages: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.4.15 + /@jsdevtools/ono@7.1.3: + resolution: {integrity: sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==} + dev: true + /@langchain/core@0.1.52: resolution: {integrity: sha512-AEyP99r7jijF33pyzaWtqCkiO9crotgethqq7jznAGlIojMCL9BT/id2DjVyN32SGFTpet273kkjsmEdFSHqpA==} engines: {node: '>=18'} @@ -11927,6 +11958,23 @@ packages: typewise: 1.0.3 dev: false + /c12@1.10.0: + resolution: {integrity: sha512-0SsG7UDhoRWcuSvKWHaXmu5uNjDCDN3nkQLRL4Q42IlFy+ze58FcCoI3uPwINXinkz7ZinbhEgyzYFw9u9ZV8g==} + dependencies: + chokidar: 3.6.0 + confbox: 0.1.7 + defu: 6.1.4 + dotenv: 16.4.5 + giget: 1.2.3 + jiti: 1.21.0 + mlly: 1.6.1 + ohash: 1.1.3 + pathe: 1.1.2 + perfect-debounce: 1.0.0 + pkg-types: 1.0.3 + rc9: 2.1.2 + dev: true + /cac@6.7.14: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} engines: {node: '>=8'} @@ -12013,6 +12061,11 @@ packages: engines: {node: '>=14.16'} dev: true + /camelcase@8.0.0: + resolution: {integrity: sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==} + engines: {node: '>=16'} + dev: true + /caniuse-api@3.0.0: resolution: {integrity: sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==} dependencies: @@ -12244,6 +12297,12 @@ packages: resolution: {integrity: sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==} engines: {node: '>=8'} + /citty@0.1.6: + resolution: {integrity: sha512-tskPPKEs8D2KPafUypv2gxwJP8h/OaJmC82QQGGDQcHvXX43xF2VDACcJVmZ0EuSxkpO9Kc4MlrA3q0+FG58AQ==} + dependencies: + consola: 3.2.3 + dev: true + /clamp@1.0.1: resolution: {integrity: sha512-kgMuFyE78OC6Dyu3Dy7vcx4uy97EIbVxJB/B0eJ3bUNAkwdNcxYzgKltnyADiYwsR7SEqkkUPsEUT//OVS6XMA==} dev: false @@ -12531,6 +12590,11 @@ packages: engines: {node: '>=14'} dev: true + /commander@12.0.0: + resolution: {integrity: sha512-MwVNWlYjDTtOjX5PiD7o5pK0UrFU/OYgcJfjjK4RaHZETNtjJqrZa9Y9ds88+A+f+d5lv+561eZ+yCKoS3gbAA==} + engines: {node: '>=18'} + dev: true + /commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} @@ -12654,6 +12718,10 @@ packages: yargs: 17.7.2 dev: true + /confbox@0.1.7: + resolution: {integrity: sha512-uJcB/FKZtBMCJpK8MQji6bJHgu1tixKPxRLeGkNzBoOZzpnZUJm0jm2/sBDWcuBx1dYgxV4JU+g5hmNxCyAmdA==} + dev: true + /config-chain@1.1.13: resolution: {integrity: sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==} dependencies: @@ -12694,7 +12762,6 @@ packages: /consola@3.2.3: resolution: {integrity: sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ==} engines: {node: ^14.18.0 || >=16.10.0} - dev: false /content-disposition@0.5.2: resolution: {integrity: sha512-kRGRZw3bLlFISDBgwTSA1TMBFN6J6GWDeubmDE3AF+3+yXL8hTWv8r5rkLbqYXY4RjPk/EzHnClI3zQf1cFmHA==} @@ -13747,6 +13814,10 @@ packages: resolution: {integrity: sha512-+uO4+qr7msjNNWKYPHqN/3+Dx3NFkmIzayk2L1MyZQlvgZb/J1A0fo410dpKrN2SnqFjt8n4JL8fDJE0wIgjFQ==} dev: false + /defu@6.1.4: + resolution: {integrity: sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==} + dev: true + /degenerator@5.0.1: resolution: {integrity: sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==} engines: {node: '>= 14'} @@ -13796,6 +13867,10 @@ packages: resolution: {integrity: sha512-M1Ob1zPSIvlARiJUkKqvAZ3VAqQY6Jcuth/pBKQ2b1dX/Qx0OnJ8Vux6J2H5PTMQeRzWrrbTu70VxBfv/OPDJA==} dev: false + /destr@2.0.3: + resolution: {integrity: sha512-2N3BOUU4gYMpTP24s5rF5iP7BDr7uNTCs4ozw3kf/eKfvWSIu93GEBi5m427YoyJoeOzQ5smuu4nNAPGb8idSQ==} + dev: true + /destroy@1.2.0: resolution: {integrity: sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==} engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16} @@ -15447,6 +15522,20 @@ packages: engines: {node: '>=0.10.0'} dev: false + /giget@1.2.3: + resolution: {integrity: sha512-8EHPljDvs7qKykr6uw8b+lqLiUc/vUg+KVTI0uND4s63TdsZM2Xus3mflvF0DDG9SiM4RlCkFGL+7aAjRmV7KA==} + hasBin: true + dependencies: + citty: 0.1.6 + consola: 3.2.3 + defu: 6.1.4 + node-fetch-native: 1.6.4 + nypm: 0.3.8 + ohash: 1.1.3 + pathe: 1.1.2 + tar: 6.2.1 + dev: true + /git-raw-commits@4.0.0: resolution: {integrity: sha512-ICsMM1Wk8xSGMowkOmPrzo2Fgmfo4bMHLNX6ytHjajRJUqvHOw/TFapQ+QG75c3X/tTDDhOSRPGC52dDbNM8FQ==} engines: {node: '>=16'} @@ -19248,6 +19337,15 @@ packages: ufo: 1.3.2 dev: true + /mlly@1.6.1: + resolution: {integrity: sha512-vLgaHvaeunuOXHSmEbZ9izxPx3USsk8KCQ8iC+aTlp5sKRSoZvwhHh5L9VbKSaVC6sJDqbyohIS76E2VmHIPAA==} + dependencies: + acorn: 8.11.3 + pathe: 1.1.2 + pkg-types: 1.0.3 + ufo: 1.3.2 + dev: true + /mmdb-lib@2.1.0: resolution: {integrity: sha512-tdDTZmnI5G4UoSctv2KxM/3VQt2XRj4CmR5R4VsAWsOUcS3LysHR34wtixWm/pXxXdkBDuN92auxkC0T2+qd1Q==} engines: {node: '>=10', npm: '>=6'} @@ -19542,6 +19640,10 @@ packages: resolution: {integrity: sha512-F5kfEj95kX8tkDhUCYdV8dg3/8Olx/94zB8+ZNthFs6Bz31UpUi8Xh40TN3thLwXgrwXry1pEg9lJ++tLWTcqA==} dev: false + /node-fetch-native@1.6.4: + resolution: {integrity: sha512-IhOigYzAKHd244OC0JIMIUrjzctirCmPkaIfhDeGcEETWof5zKYUW7e7MYvChGWh/4CJeXEgsRyGzuF334rOOQ==} + dev: true + /node-fetch@2.6.11: resolution: {integrity: sha512-4I6pdBY1EthSqDmJkiNk3JIT8cswwR9nfeW/cPdUagJYEQG7R95WRH74wpz7ma8Gh/9dI9FP+OU+0E4FvtA55w==} engines: {node: 4.x || >=6.0.0} @@ -19742,6 +19844,18 @@ packages: engines: {node: '>=0.10.0'} dev: false + /nypm@0.3.8: + resolution: {integrity: sha512-IGWlC6So2xv6V4cIDmoV0SwwWx7zLG086gyqkyumteH2fIgCAM4nDVFB2iDRszDvmdSVW9xb1N+2KjQ6C7d4og==} + engines: {node: ^14.16.0 || >=16.10.0} + hasBin: true + dependencies: + citty: 0.1.6 + consola: 3.2.3 + execa: 8.0.1 + pathe: 1.1.2 + ufo: 1.5.3 + dev: true + /oas-kit-common@1.0.8: resolution: {integrity: sha512-pJTS2+T0oGIwgjGpw7sIRU8RQMcUoKCDWFLdBqKB2BNmGpbBMH2sdqAaOXUg8OzonZHU0L7vfJu1mJFEiYDWOQ==} dependencies: @@ -19796,6 +19910,10 @@ packages: /obuf@1.1.2: resolution: {integrity: sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==} + /ohash@1.1.3: + resolution: {integrity: sha512-zuHHiGTYTA1sYJ/wZN+t5HKZaH23i4yI1HMwbuXm24Nid7Dv0KcuRlKoNKS9UNfAVSBlnGLcuQrnOKWOZoEGaw==} + dev: true + /on-finished@2.3.0: resolution: {integrity: sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==} engines: {node: '>= 0.8'} @@ -20377,6 +20495,10 @@ packages: resolution: {integrity: sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==} dev: false + /perfect-debounce@1.0.0: + resolution: {integrity: sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==} + dev: true + /periscopic@3.1.0: resolution: {integrity: sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw==} dependencies: @@ -20435,7 +20557,7 @@ packages: resolution: {integrity: sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==} dependencies: jsonc-parser: 3.2.0 - mlly: 1.5.0 + mlly: 1.6.1 pathe: 1.1.2 dev: true @@ -22935,6 +23057,13 @@ packages: react-dom: 18.2.0(react@18.2.0) dev: false + /rc9@2.1.2: + resolution: {integrity: sha512-btXCnMmRIBINM2LDZoEmOogIZU7Qe7zn4BpomSKZ/ykbLObuBdvG+mFq11DL6fjH1DRwHhrlgtYWG96bJiC7Cg==} + dependencies: + defu: 6.1.4 + destr: 2.0.3 + dev: true + /rc@1.2.8: resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==} hasBin: true @@ -25667,6 +25796,18 @@ packages: yallist: 4.0.0 dev: true + /tar@6.2.1: + resolution: {integrity: sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==} + engines: {node: '>=10'} + dependencies: + chownr: 2.0.0 + fs-minipass: 2.1.0 + minipass: 5.0.0 + minizlib: 2.1.2 + mkdirp: 1.0.4 + yallist: 4.0.0 + dev: true + /tcp-ping@0.1.1: resolution: {integrity: sha512-7Ed10Ds0hYnF+O1lfiZ2iSZ1bCAj+96Madctebmq7Y1ALPWlBY4YI8C6pCL+UTlshFY5YogixKLpgDP/4BlHrw==} dev: false @@ -26321,6 +26462,10 @@ packages: /ufo@1.3.2: resolution: {integrity: sha512-o+ORpgGwaYQXgqGDwd+hkS4PuZ3QnmqMMxRuajK/a38L6fTpcE5GPIfrf+L/KemFzfUpeUQc1rRS1iDBozvnFA==} + /ufo@1.5.3: + resolution: {integrity: sha512-Y7HYmWaFwPUmkoQCUIAYpKqkOf+SbVj/2fJJZ4RJMCfZp0rTGwRbzQD+HghfnhKOjL9E01okqz+ncJskGYfBNw==} + dev: true + /uglify-js@2.8.29: resolution: {integrity: sha512-qLq/4y2pjcU3vhlhseXGGJ7VbFO4pBANu0kwl8VCa9KEI0V8VfZIx2Fy3w01iSTA/pGwKZSmu/+I4etLNDdt5w==} engines: {node: '>=0.8.0'} diff --git a/website/openapi.json b/website/openapi.json index 59ca1f7..bf749a4 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.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}}}}}}} +{"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"},"survey":{"type":"number"}},"required":["website","monitor","server","telemetry","page","survey"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/website/{websiteId}/onlineCount":{"get":{"operationId":"website-onlineCount","tags":["Website"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"websiteId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"number"}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/website/all":{"get":{"operationId":"website-all","tags":["Website"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"domain":{"type":"string","nullable":true},"shareId":{"type":"string","nullable":true},"resetAt":{"type":"string","format":"date-time","nullable":true},"monitorId":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","workspaceId","name","domain","shareId","resetAt","monitorId","createdAt","updatedAt","deletedAt"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/website/{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"}}}},"/workspace/{workspaceId}/survey//all":{"get":{"operationId":"survey-all","tags":["Survey"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"payload":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["text","select","email"]},"options":{"type":"array","items":{"type":"string"}}},"required":["label","name","type"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","payload","createdAt","updatedAt"],"additionalProperties":false}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey//{surveyId}":{"get":{"operationId":"survey-get","tags":["Survey"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"payload":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["text","select","email"]},"options":{"type":"array","items":{"type":"string"}}},"required":["label","name","type"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","payload","createdAt","updatedAt"],"additionalProperties":false,"nullable":true}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey//{surveyId}/count":{"get":{"operationId":"survey-count","tags":["Survey"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"number"}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey//allResultCount":{"get":{"operationId":"survey-allResultCount","tags":["Survey"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"number"}}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey//{surveyId}/submit":{"post":{"operationId":"survey-submit","tags":["Survey"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"payload":{"type":"object","additionalProperties":{}}},"required":["payload"],"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey//create":{"post":{"operationId":"survey-create","tags":["Survey"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"payload":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["text","select","email"]},"options":{"type":"array","items":{"type":"string"}}},"required":["label","name","type"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false}},"required":["name","payload"],"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"payload":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["text","select","email"]},"options":{"type":"array","items":{"type":"string"}}},"required":["label","name","type"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","payload","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey//{surveyId}/update":{"patch":{"operationId":"survey-update","tags":["Survey"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"payload":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["text","select","email"]},"options":{"type":"array","items":{"type":"string"}}},"required":["label","name","type"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false}},"additionalProperties":false}}}},"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"payload":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["text","select","email"]},"options":{"type":"array","items":{"type":"string"}}},"required":["label","name","type"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","payload","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey//{surveyId}/delete":{"delete":{"operationId":"survey-delete","tags":["Survey"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"name":{"type":"string"},"payload":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["text","select","email"]},"options":{"type":"array","items":{"type":"string"}}},"required":["label","name","type"],"additionalProperties":false}}},"required":["items"],"additionalProperties":false},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","name","payload","createdAt","updatedAt"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/workspace/{workspaceId}/survey//{surveyId}/result/list":{"get":{"operationId":"survey-resultList","tags":["Survey"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"path","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"surveyId","in":"path","required":true,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"number","minimum":1,"maximum":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"},"surveyId":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"sessionId":{"type":"string"},"payload":{"type":"object","additionalProperties":{}},"browser":{"type":"string","nullable":true},"os":{"type":"string","nullable":true},"language":{"type":"string","nullable":true},"ip":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"subdivision1":{"type":"string","nullable":true},"subdivision2":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"longitude":{"type":"number","nullable":true},"latitude":{"type":"number","nullable":true},"accuracyRadius":{"type":"integer","nullable":true}},"required":["id","surveyId","createdAt","sessionId","payload"],"additionalProperties":false}},"nextCursor":{"type":"string"}},"required":["items"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/audit/fetchByCursor":{"get":{"operationId":"auditLog-fetchByCursor","description":"Fetch workspace audit log","tags":["AuditLog"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"query","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"limit","in":"query","required":false,"schema":{"type":"number","minimum":1,"maximum":100,"default":50}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"workspaceId":{"type":"string"},"content":{"type":"string"},"relatedId":{"type":"string","nullable":true},"relatedType":{"type":"string","enum":["Monitor","Notification"],"nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","workspaceId","content","createdAt"],"additionalProperties":false}},"nextCursor":{"type":"string"}},"required":["items"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/billing/usage":{"get":{"operationId":"billing-usage","description":"get workspace usage","tags":["Billing"],"security":[{"Authorization":[]}],"parameters":[{"name":"workspaceId","in":"query","required":true,"schema":{"type":"string","pattern":"^[a-z][a-z0-9]*$"}},{"name":"startAt","in":"query","required":true,"schema":{"type":"number"}},{"name":"endAt","in":"query","required":true,"schema":{"type":"number"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"websiteAcceptedCount":{"type":"number"},"websiteEventCount":{"type":"number"},"monitorExecutionCount":{"type":"number"}},"required":["websiteAcceptedCount","websiteEventCount","monitorExecutionCount"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}}},"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}}}}}}}