1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +01:00
unleash.unleash/src/lib/openapi/spec/search-events-schema.ts
olav a34c674971
feat: add event search endpoint (#1893)
* feat: add event search endpoint

* refactor: expand variable names

* refactor: add table type to query builder

* refactor: improve schema limit/offset types

* refactor: describe searchEventsSchema fields
2022-08-09 16:14:50 +02:00

48 lines
1.4 KiB
TypeScript

import { FromSchema } from 'json-schema-to-ts';
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).',
},
project: {
type: 'string',
description: 'Find events by project ID (case-sensitive).',
},
feature: {
type: 'string',
description: 'Find events by feature toggle name (case-sensitive).',
},
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).
`,
},
limit: {
type: 'integer',
minimum: 1,
maximum: 100,
default: 100,
},
offset: {
type: 'integer',
minimum: 0,
default: 0,
},
},
components: {},
} as const;
export type SearchEventsSchema = FromSchema<typeof searchEventsSchema>;