-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathactivityeventparams.py
More file actions
90 lines (73 loc) · 3.54 KB
/
activityeventparams.py
File metadata and controls
90 lines (73 loc) · 3.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
from __future__ import annotations
from glean.api_client.types import BaseModel, UNSET_SENTINEL
import pydantic
from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict
class ActivityEventParamsTypedDict(TypedDict):
body_content: NotRequired[str]
r"""The HTML content of the page body."""
datasource_instance: NotRequired[str]
r"""The full datasource instance name inferred from the URL of the event"""
datasource: NotRequired[str]
r"""The datasource without the instance inferred from the URL of the event"""
instance_only_name: NotRequired[str]
r"""The instance only name of the datasource instance, e.g. 1 for jira_1, inferred from the URL of the event"""
duration: NotRequired[int]
r"""Length in seconds of the activity. For VIEWS, this represents the amount the page was visible in the foreground."""
query: NotRequired[str]
r"""The user's search query associated with a SEARCH."""
referrer: NotRequired[str]
r"""The referring URL of the VIEW or SEARCH."""
title: NotRequired[str]
r"""The page title associated with the URL of the event"""
truncated: NotRequired[bool]
r"""Indicates that the parameters are incomplete and more parameters may be sent with the same action+timestamp+URL in the future. This is used for sending the duration when a `VIEW` is finished."""
class ActivityEventParams(BaseModel):
body_content: Annotated[Optional[str], pydantic.Field(alias="bodyContent")] = None
r"""The HTML content of the page body."""
datasource_instance: Annotated[
Optional[str], pydantic.Field(alias="datasourceInstance")
] = None
r"""The full datasource instance name inferred from the URL of the event"""
datasource: Optional[str] = None
r"""The datasource without the instance inferred from the URL of the event"""
instance_only_name: Annotated[
Optional[str], pydantic.Field(alias="instanceOnlyName")
] = None
r"""The instance only name of the datasource instance, e.g. 1 for jira_1, inferred from the URL of the event"""
duration: Optional[int] = None
r"""Length in seconds of the activity. For VIEWS, this represents the amount the page was visible in the foreground."""
query: Optional[str] = None
r"""The user's search query associated with a SEARCH."""
referrer: Optional[str] = None
r"""The referring URL of the VIEW or SEARCH."""
title: Optional[str] = None
r"""The page title associated with the URL of the event"""
truncated: Optional[bool] = None
r"""Indicates that the parameters are incomplete and more parameters may be sent with the same action+timestamp+URL in the future. This is used for sending the duration when a `VIEW` is finished."""
@model_serializer(mode="wrap")
def serialize_model(self, handler):
optional_fields = set(
[
"bodyContent",
"datasourceInstance",
"datasource",
"instanceOnlyName",
"duration",
"query",
"referrer",
"title",
"truncated",
]
)
serialized = handler(self)
m = {}
for n, f in type(self).model_fields.items():
k = f.alias or n
val = serialized.get(k)
if val != UNSET_SENTINEL:
if val is not None or k not in optional_fields:
m[k] = val
return m