-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathcohort_widget_definition.py
More file actions
112 lines (93 loc) · 3.83 KB
/
cohort_widget_definition.py
File metadata and controls
112 lines (93 loc) · 3.83 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations
from typing import List, Union, TYPE_CHECKING
from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
unset,
UnsetType,
)
if TYPE_CHECKING:
from datadog_api_client.v1.model.retention_grid_request import RetentionGridRequest
from datadog_api_client.v1.model.widget_time import WidgetTime
from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign
from datadog_api_client.v1.model.cohort_widget_definition_type import CohortWidgetDefinitionType
from datadog_api_client.v1.model.widget_legacy_live_span import WidgetLegacyLiveSpan
from datadog_api_client.v1.model.widget_new_live_span import WidgetNewLiveSpan
from datadog_api_client.v1.model.widget_new_fixed_span import WidgetNewFixedSpan
class CohortWidgetDefinition(ModelNormal):
validations = {
"requests": {
"min_items": 1,
},
}
@cached_property
def additional_properties_type(_):
return None
@cached_property
def openapi_types(_):
from datadog_api_client.v1.model.retention_grid_request import RetentionGridRequest
from datadog_api_client.v1.model.widget_time import WidgetTime
from datadog_api_client.v1.model.widget_text_align import WidgetTextAlign
from datadog_api_client.v1.model.cohort_widget_definition_type import CohortWidgetDefinitionType
return {
"description": (str,),
"requests": ([RetentionGridRequest],),
"time": (WidgetTime,),
"title": (str,),
"title_align": (WidgetTextAlign,),
"title_size": (str,),
"type": (CohortWidgetDefinitionType,),
}
attribute_map = {
"description": "description",
"requests": "requests",
"time": "time",
"title": "title",
"title_align": "title_align",
"title_size": "title_size",
"type": "type",
}
def __init__(
self_,
requests: List[RetentionGridRequest],
type: CohortWidgetDefinitionType,
description: Union[str, UnsetType] = unset,
time: Union[WidgetTime, WidgetLegacyLiveSpan, WidgetNewLiveSpan, WidgetNewFixedSpan, UnsetType] = unset,
title: Union[str, UnsetType] = unset,
title_align: Union[WidgetTextAlign, UnsetType] = unset,
title_size: Union[str, UnsetType] = unset,
**kwargs,
):
"""
The cohort widget visualizes user retention over time.
:param description: The description of the widget.
:type description: str, optional
:param requests: List of Cohort widget requests.
:type requests: [RetentionGridRequest]
:param time: Time setting for the widget.
:type time: WidgetTime, optional
:param title: Title of your widget.
:type title: str, optional
:param title_align: How to align the text on the widget.
:type title_align: WidgetTextAlign, optional
:param title_size: Size of the title.
:type title_size: str, optional
:param type: Type of the Cohort widget.
:type type: CohortWidgetDefinitionType
"""
if description is not unset:
kwargs["description"] = description
if time is not unset:
kwargs["time"] = time
if title is not unset:
kwargs["title"] = title
if title_align is not unset:
kwargs["title_align"] = title_align
if title_size is not unset:
kwargs["title_size"] = title_size
super().__init__(kwargs)
self_.requests = requests
self_.type = type