1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-15 01:16:22 +02:00
unleash.unleash/src/lib/openapi/spec/search-events-schema.ts
2024-05-23 11:32:11 +03:00

54 lines
1.8 KiB
TypeScript

import type { FromSchema } from 'json-schema-to-ts';
import { IEventTypes } from '../../types';
export const searchEventsSchema = {
$id: '#/components/schemas/searchEventsSchema',
type: 'object',
description: `
Search for events by type, project, feature, free-text query,
or a combination thereof. Pass an empty object to fetch all events.
`,
properties: {
type: {
type: 'string',
description: 'Find events by event type (case-sensitive).',
enum: IEventTypes,
example: 'feature-created',
},
project: {
type: 'string',
description: 'Find events by project ID (case-sensitive).',
example: 'default',
},
feature: {
type: 'string',
description: 'Find events by feature flag name (case-sensitive).',
example: 'my.first.flag',
},
query: {
type: 'string',
description: `Find events by a free-text search query. The query will be matched against the event type, the username or email that created the event (if any), and the event data payload (if any).`,
example: 'admin@example.com',
},
limit: {
type: 'integer',
description:
'The maximum amount of events to return in the search result',
minimum: 1,
maximum: 100,
default: 100,
example: 50,
},
offset: {
description: 'Which event id to start listing from',
type: 'integer',
minimum: 0,
default: 0,
example: 100,
},
},
components: {},
} as const;
export type SearchEventsSchema = FromSchema<typeof searchEventsSchema>;