-
Notifications
You must be signed in to change notification settings - Fork 80
feat: [CHA-1584] - Predefined filters support #1675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f416f1f
d1a7548
d96f9b6
798c4cf
1b0981d
ebf8364
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1011,6 +1011,21 @@ export type ChannelOptions = { | |
| state?: boolean; | ||
| user_id?: string; | ||
| watch?: boolean; | ||
| /** | ||
| * Name of a predefined filter to use instead of filter_conditions. | ||
| * When provided, filter_conditions and sort parameters are ignored. | ||
| */ | ||
| predefined_filter?: string; | ||
| /** | ||
| * Values to interpolate into the predefined filter template placeholders. | ||
| * Only used when predefined_filter is provided. | ||
| */ | ||
| filter_values?: Record<string, unknown>; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keys in this object will need to correspond to some specific entity field names or it can really be any string?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @totalimmersion Could you give an example of interpolation, please?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can be any string
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| /** | ||
| * Values to interpolate into the predefined filter sort template placeholders. | ||
| * Only used when predefined_filter is provided. | ||
| */ | ||
| sort_values?: Record<string, unknown>; | ||
| }; | ||
|
|
||
| export type ChannelQueryOptions = { | ||
|
|
@@ -4544,3 +4559,52 @@ export type UpdateChannelsBatchFilters = QueryFilters<{ | |
| export type UpdateChannelsBatchResponse = { | ||
| result: Record<string, string>; | ||
| } & Partial<TaskResponse>; | ||
|
|
||
| /** | ||
| * Predefined Filter Types | ||
| */ | ||
|
|
||
| export type PredefinedFilterOperation = 'QueryChannels'; | ||
|
|
||
| export type PredefinedFilterSortParam = { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @totalimmersion there was a discussion btw @kanat and @arnautov-anton regarding
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure about that discussion, this pr follows current practices |
||
| field: string; | ||
| direction?: AscDesc; | ||
| type?: string; | ||
| }; | ||
|
|
||
| export type PredefinedFilter = { | ||
| name: string; | ||
| operation: PredefinedFilterOperation; | ||
| filter: Record<string, unknown>; | ||
| created_at: string; | ||
| updated_at: string; | ||
| description?: string; | ||
| sort?: PredefinedFilterSortParam[]; | ||
| query_id?: number; | ||
| }; | ||
|
|
||
| export type CreatePredefinedFilterOptions = { | ||
| name: string; | ||
| operation: PredefinedFilterOperation; | ||
| filter: Record<string, unknown>; | ||
| description?: string; | ||
| sort?: PredefinedFilterSortParam[]; | ||
| }; | ||
|
|
||
| export type UpdatePredefinedFilterOptions = Omit<CreatePredefinedFilterOptions, 'name'>; | ||
|
|
||
| export type PredefinedFilterResponse = APIResponse & { | ||
| predefined_filter: PredefinedFilter; | ||
| }; | ||
|
|
||
| export type ListPredefinedFiltersResponse = APIResponse & { | ||
| predefined_filters: PredefinedFilter[]; | ||
| next?: string; | ||
| prev?: string; | ||
| }; | ||
|
|
||
| export type PredefinedFilterSort = SortParam[]; | ||
|
|
||
| export type ListPredefinedFiltersOptions = Pager & { | ||
| sort?: PredefinedFilterSort; | ||
| }; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@totalimmersion Why do we convert the object into string? I see in types.ts the following declarations implying and usually objects are not stringified in other API calls in other methods:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because it's a GET request