Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

897 B
Raw Blame
import { defineOperation } from '@/openapi/operation';
import { jsonResponse, unauthorizedResponse } from '@/openapi/schemas';
import { websiteIdPathSchema } from '../../response-schema';
import { activeVisitorsSchema } from '../analytics-schema';

const getWebsiteActiveOperation = defineOperation({
  method: 'get',
  path: '/api/websites/{websiteId}/active',
  audience: 'public',
  auth: 'bearer-or-share',
  operation: {
    operationId: 'getWebsiteActive',
    summary: 'Get current active visitors',
    description: 'Returns the number of visitors active on the website in the last few minutes.',
    tags: ['Websites'],
    requestParams: {
      path: websiteIdPathSchema,
    },
    responses: {
      '200': jsonResponse(activeVisitorsSchema, 'Active visitor count.'),
      '401': unauthorizedResponse,
    },
  },
});

export const operations = [getWebsiteActiveOperation] as const;