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.7 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: 'get',
  path: '/api/me',
  audience: 'public',
  auth: 'bearer',
  operation: {
    operationId: 'getMe',
    summary: 'Get my authentication details',
    description:
      'Returns the current authentication context, including the authenticated user or share credentials.',
    tags: ['Account'],
    responses: {
      '200': {
        description: 'The operation completed successfully.',
        content: {
          'application/json': {
            schema: {
              type: 'object',
              properties: {
                user: {
                  type: 'object',
                  properties: {
                    id: {
                      type: 'string',
                      description: 'Unique identifier of the resource.',
                    },
                    username: {
                      type: 'string',
                      description: 'Username of the account.',
                    },
                    role: {
                      type: 'string',
                      description: 'Permission role assigned to the user.',
                    },
                    isAdmin: {
                      type: 'boolean',
                      description: 'Whether the user has administrator privileges.',
                    },
                  },
                  required: ['id', 'username', 'role', 'isAdmin'],
                  description: 'User associated with the resource.',
                },
                apiKey: {
                  type: 'object',
                  properties: {
                    id: {
                      type: 'string',
                      description: 'Unique identifier of the resource.',
                    },
                    name: {
                      type: 'string',
                      description: 'Display name of the resource.',
                    },
                  },
                  required: ['id', 'name'],
                  description: 'API key authentication details.',
                },
                authType: {
                  anyOf: [
                    {
                      const: 'session',
                    },
                    {
                      const: 'share',
                    },
                    {
                      const: 'api-key',
                    },
                  ],
                },
                shareToken: {
                  type: 'object',
                  properties: {
                    shareType: {
                      type: 'number',
                      description: 'Type of resource made available by the share.',
                    },
                    websiteId: {
                      type: 'string',
                      description: 'ID of the website.',
                    },
                    websiteIds: {
                      type: 'array',
                      items: {
                        type: 'string',
                      },
                    },
                    boardId: {
                      type: 'string',
                      description: 'ID of the board.',
                    },
                    pixelId: {
                      type: 'string',
                      description: 'ID of the tracking pixel.',
                    },
                    pixelIds: {
                      type: 'array',
                      items: {
                        type: 'string',
                      },
                    },
                    linkId: {
                      type: 'string',
                      description: 'ID of the tracked link.',
                    },
                    linkIds: {
                      type: 'array',
                      items: {
                        type: 'string',
                      },
                    },
                    parameters: {
                      type: 'object',
                      properties: {
                        allowFilter: {
                          type: 'boolean',
                        },
                        theme: {
                          anyOf: [
                            {
                              const: 'light',
                            },
                            {
                              const: 'dark',
                            },
                          ],
                        },
                      },
                      additionalProperties: {
                        anyOf: [
                          {
                            const: false,
                          },
                          {
                            const: true,
                          },
                          {
                            const: 'light',
                          },
                          {
                            const: 'dark',
                          },
                        ],
                      },
                      description: 'Configuration parameters for the resource.',
                    },
                  },
                },
              },
            },
          },
        },
      },
      '401': {
        description: 'Unauthorized.',
        content: {
          'application/json': {
            example: {
              error: {
                message: 'Unauthorized.',
                code: 'unauthorized',
                status: 401,
              },
            },
            schema: {
              $ref: '#/components/schemas/ApiError',
            },
          },
        },
      },
    },
  } as ZodOpenApiOperationObject,
});

export const operations = [operation1] as const;