Skip to content

Commit 6c0a52e

Browse files
committed
fix: types
1 parent afd5d92 commit 6c0a52e

2 files changed

Lines changed: 24 additions & 26 deletions

File tree

src/typesense/types/analytics.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class AnalyticsEvent(typing.TypedDict):
1212
"""Schema for an analytics event to be created."""
1313

1414
name: str
15-
event_type: str
1615
data: typing.Dict[str, typing.Any]
1716

1817

@@ -24,13 +23,12 @@ class AnalyticsEventCreateResponse(typing.TypedDict):
2423

2524
class _AnalyticsEventItem(typing.TypedDict, total=False):
2625
name: str
27-
event_type: str
2826
collection: str
29-
timestamp: int
27+
timestamp: typing.NotRequired[int]
3028
user_id: str
31-
doc_id: str
32-
doc_ids: typing.List[str]
33-
query: str
29+
doc_id: typing.NotRequired[str]
30+
doc_ids: typing.NotRequired[typing.List[str]]
31+
query: typing.NotRequired[str]
3432

3533

3634
class AnalyticsEventsResponse(typing.TypedDict):
@@ -54,21 +52,21 @@ class AnalyticsStatus(typing.TypedDict, total=False):
5452
# Rules
5553

5654
class AnalyticsRuleParams(typing.TypedDict, total=False):
57-
destination_collection: str
58-
limit: int
59-
capture_search_requests: bool
60-
meta_fields: typing.List[str]
61-
expand_query: bool
62-
counter_field: str
63-
weight: int
55+
destination_collection: typing.NotRequired[str]
56+
limit: typing.NotRequired[int]
57+
capture_search_requests: typing.NotRequired[bool]
58+
meta_fields: typing.NotRequired[typing.List[str]]
59+
expand_query: typing.NotRequired[bool]
60+
counter_field: typing.NotRequired[str]
61+
weight: typing.NotRequired[int]
6462

6563

6664
class AnalyticsRuleCreate(typing.TypedDict):
6765
name: str
6866
type: str
6967
collection: str
7068
event_type: str
71-
params: AnalyticsRuleParams
69+
params: typing.NotRequired[AnalyticsRuleParams]
7270
rule_tag: typing.NotRequired[str]
7371

7472

src/typesense/types/curation_set.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ class CurationRuleSchema(typing.TypedDict, total=False):
3030
Schema representing rule conditions for a curation item.
3131
"""
3232

33-
query: str
34-
match: typing.Literal["exact", "contains"]
35-
filter_by: str
36-
tags: typing.List[str]
33+
query: typing.NotRequired[str]
34+
match: typing.NotRequired[typing.Literal["exact", "contains"]]
35+
filter_by: typing.NotRequired[str]
36+
tags: typing.NotRequired[typing.List[str]]
3737

3838

3939
class CurationItemSchema(typing.TypedDict, total=False):
@@ -43,14 +43,14 @@ class CurationItemSchema(typing.TypedDict, total=False):
4343

4444
id: str
4545
rule: CurationRuleSchema
46-
includes: typing.List[CurationIncludeSchema]
47-
excludes: typing.List[CurationExcludeSchema]
48-
filter_by: str
49-
sort_by: str
50-
replace_query: str
51-
remove_matched_tokens: bool
52-
filter_curated_hits: bool
53-
stop_processing: bool
46+
includes: typing.NotRequired[typing.List[CurationIncludeSchema]]
47+
excludes: typing.NotRequired[typing.List[CurationExcludeSchema]]
48+
filter_by: typing.NotRequired[str]
49+
sort_by: typing.NotRequired[str]
50+
replace_query: typing.NotRequired[str]
51+
remove_matched_tokens: typing.NotRequired[bool]
52+
filter_curated_hits: typing.NotRequired[bool]
53+
stop_processing: typing.NotRequired[bool]
5454
metadata: typing.Dict[str, typing.Any]
5555

5656

0 commit comments

Comments
 (0)