mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
b04545c25f
### What This PR adds documentation for our endpoints that are covered by our "Events" tag. It also adds a type for all valid events, and then uses this as valid values for type argument.
59 lines
1.8 KiB
TypeScript
59 lines
1.8 KiB
TypeScript
import { 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 toggle name (case-sensitive).',
|
|
example: 'my.first.toggle',
|
|
},
|
|
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>;
|