22
33from __future__ import annotations
44
5- from typing import Union
6- from typing_extensions import Literal , Annotated , TypedDict
5+ from typing import Union , Iterable
6+ from typing_extensions import Literal , Required , Annotated , TypeAlias , TypedDict
77
88from .._types import SequenceNotStr
99from .._utils import PropertyInfo
1010
11- __all__ = ["DocumentListParams" ]
11+ __all__ = [
12+ "DocumentListParams" ,
13+ "Filters" ,
14+ "FiltersOr" ,
15+ "FiltersOrOr" ,
16+ "FiltersOrOrUnionMember0" ,
17+ "FiltersOrOrOr" ,
18+ "FiltersOrOrAnd" ,
19+ "FiltersAnd" ,
20+ "FiltersAndAnd" ,
21+ "FiltersAndAndUnionMember0" ,
22+ "FiltersAndAndOr" ,
23+ "FiltersAndAndAnd" ,
24+ ]
1225
1326
1427class DocumentListParams (TypedDict , total = False ):
@@ -19,8 +32,8 @@ class DocumentListParams(TypedDict, total=False):
1932 to use to group documents.
2033 """
2134
22- filters : str
23- """Optional filters to apply to the search"""
35+ filters : Filters
36+ """Optional filters to apply to the search. Can be a JSON string or Query object. """
2437
2538 include_content : Annotated [bool , PropertyInfo (alias = "includeContent" )]
2639 """Whether to include the content field in the response.
@@ -39,3 +52,60 @@ class DocumentListParams(TypedDict, total=False):
3952
4053 sort : Literal ["createdAt" , "updatedAt" ]
4154 """Field to sort by"""
55+
56+
57+ class FiltersOrOrUnionMember0 (TypedDict , total = False ):
58+ key : Required [str ]
59+
60+ value : Required [str ]
61+
62+ filter_type : Annotated [Literal ["metadata" , "numeric" , "array_contains" ], PropertyInfo (alias = "filterType" )]
63+
64+ negate : Union [bool , Literal ["true" , "false" ]]
65+
66+ numeric_operator : Annotated [Literal [">" , "<" , ">=" , "<=" , "=" ], PropertyInfo (alias = "numericOperator" )]
67+
68+
69+ class FiltersOrOrOr (TypedDict , total = False ):
70+ or_ : Required [Annotated [Iterable [object ], PropertyInfo (alias = "OR" )]]
71+
72+
73+ class FiltersOrOrAnd (TypedDict , total = False ):
74+ and_ : Required [Annotated [Iterable [object ], PropertyInfo (alias = "AND" )]]
75+
76+
77+ FiltersOrOr : TypeAlias = Union [FiltersOrOrUnionMember0 , FiltersOrOrOr , FiltersOrOrAnd ]
78+
79+
80+ class FiltersOr (TypedDict , total = False ):
81+ or_ : Required [Annotated [Iterable [FiltersOrOr ], PropertyInfo (alias = "OR" )]]
82+
83+
84+ class FiltersAndAndUnionMember0 (TypedDict , total = False ):
85+ key : Required [str ]
86+
87+ value : Required [str ]
88+
89+ filter_type : Annotated [Literal ["metadata" , "numeric" , "array_contains" ], PropertyInfo (alias = "filterType" )]
90+
91+ negate : Union [bool , Literal ["true" , "false" ]]
92+
93+ numeric_operator : Annotated [Literal [">" , "<" , ">=" , "<=" , "=" ], PropertyInfo (alias = "numericOperator" )]
94+
95+
96+ class FiltersAndAndOr (TypedDict , total = False ):
97+ or_ : Required [Annotated [Iterable [object ], PropertyInfo (alias = "OR" )]]
98+
99+
100+ class FiltersAndAndAnd (TypedDict , total = False ):
101+ and_ : Required [Annotated [Iterable [object ], PropertyInfo (alias = "AND" )]]
102+
103+
104+ FiltersAndAnd : TypeAlias = Union [FiltersAndAndUnionMember0 , FiltersAndAndOr , FiltersAndAndAnd ]
105+
106+
107+ class FiltersAnd (TypedDict , total = False ):
108+ and_ : Required [Annotated [Iterable [FiltersAndAnd ], PropertyInfo (alias = "AND" )]]
109+
110+
111+ Filters : TypeAlias = Union [FiltersOr , FiltersAnd ]
0 commit comments