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.

5.3 KB
Raw Blame
// Generated by `pnpm openapi:contracts`. Do not edit directly.

import type { ZodOpenApiOperationObject } from 'zod-openapi';
import { defineOperation } from '@/openapi/operation';

const operation1 = defineOperation({
  method: 'post',
  path: '/api/send',
  audience: 'collect',
  auth: 'none',
  operation: {
    operationId: 'send',
    summary: 'Create or update send',
    tags: ['Collection'],
    requestBody: {
      required: true,
      content: {
        'application/json': {
          schema: {
            type: 'object',
            properties: {
              type: {
                type: 'string',
                enum: ['event', 'identify', 'performance'],
              },
              payload: {
                type: 'object',
                properties: {
                  website: {
                    type: 'string',
                    format: 'uuid',
                  },
                  link: {
                    type: 'string',
                    format: 'uuid',
                  },
                  pixel: {
                    type: 'string',
                    format: 'uuid',
                  },
                  data: {
                    type: 'object',
                    additionalProperties: true,
                  },
                  hostname: {
                    type: 'string',
                  },
                  language: {
                    type: 'string',
                  },
                  referrer: {
                    type: 'string',
                  },
                  screen: {
                    type: 'string',
                  },
                  title: {
                    type: 'string',
                  },
                  url: {
                    type: 'string',
                  },
                  name: {},
                  tag: {},
                  ip: {
                    type: 'string',
                  },
                  userAgent: {
                    type: 'string',
                  },
                  timestamp: {
                    type: 'integer',
                  },
                  id: {
                    type: 'string',
                  },
                  browser: {
                    type: 'string',
                  },
                  os: {
                    type: 'string',
                  },
                  device: {
                    type: 'string',
                  },
                  lcp: {
                    type: 'number',
                    minimum: 0,
                    maximum: 60000,
                  },
                  inp: {
                    type: 'number',
                    minimum: 0,
                    maximum: 60000,
                  },
                  cls: {
                    type: 'number',
                    minimum: 0,
                    maximum: 100,
                  },
                  fcp: {
                    type: 'number',
                    minimum: 0,
                    maximum: 60000,
                  },
                  ttfb: {
                    type: 'number',
                    minimum: 0,
                    maximum: 60000,
                  },
                },
              },
            },
            required: ['type', 'payload'],
          },
        },
      },
    },
    responses: {
      '200': {
        description: 'The operation completed successfully.',
        content: {
          'application/json': {
            schema: {
              anyOf: [
                {
                  type: 'object',
                  properties: {
                    beep: {
                      type: 'string',
                    },
                  },
                  required: ['beep'],
                },
                {
                  type: 'object',
                  properties: {
                    cache: {},
                    sessionId: {},
                    visitId: {},
                  },
                  required: ['cache', 'sessionId', 'visitId'],
                },
              ],
            },
          },
        },
      },
      '400': {
        description: 'Bad request.',
        content: {
          'application/json': {
            example: {
              error: {
                message: 'Bad request.',
                code: 'bad-request',
                status: 400,
              },
            },
            schema: {
              $ref: '#/components/schemas/ApiError',
            },
          },
        },
      },
      '403': {
        description: 'Forbidden.',
        content: {
          'application/json': {
            example: {
              error: {
                message: 'Forbidden.',
                code: 'forbidden',
                status: 403,
              },
            },
            schema: {
              $ref: '#/components/schemas/ApiError',
            },
          },
        },
      },
      '500': {
        description: 'Server error.',
        content: {
          'application/json': {
            example: {
              error: {
                message: 'Server error.',
                code: 'server-error',
                status: 500,
              },
            },
            schema: {
              $ref: '#/components/schemas/ApiError',
            },
          },
        },
      },
    },
  } as ZodOpenApiOperationObject,
});

export const operations = [operation1] as const;