Repository navigation
Expand file tree
/
Copy pathgraph_subscription_response.py
More file actions
251 lines (198 loc) · 7.3 KB
/
Copy pathgraph_subscription_response.py
File metadata and controls
251 lines (198 loc) · 7.3 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
from __future__ import annotations
from collections.abc import Mapping
from typing import Any, TypeVar, cast
from attrs import define as _attrs_define
from attrs import field as _attrs_field
from ..types import UNSET, Unset
T = TypeVar("T", bound="GraphSubscriptionResponse")
@_attrs_define
class GraphSubscriptionResponse:
"""Response for graph or repository subscription details.
Attributes:
id (str): Subscription ID
resource_type (str): Resource type (graph or repository)
resource_id (str): Resource identifier
plan_name (str): Current plan name
plan_display_name (str): Human-readable plan name for UI display
billing_interval (str): Billing interval
status (str): Subscription status
base_price_cents (int): Base price in cents
created_at (str): Creation timestamp
current_period_start (None | str | Unset): Current billing period start
current_period_end (None | str | Unset): Current billing period end
started_at (None | str | Unset): Subscription start date
canceled_at (None | str | Unset): Cancellation date
ends_at (None | str | Unset): Subscription end date (when access will be revoked, especially relevant for
cancelled subscriptions)
operation_id (None | str | Unset): Operation ID for tracking async tier changes via SSE
"""
id: str
resource_type: str
resource_id: str
plan_name: str
plan_display_name: str
billing_interval: str
status: str
base_price_cents: int
created_at: str
current_period_start: None | str | Unset = UNSET
current_period_end: None | str | Unset = UNSET
started_at: None | str | Unset = UNSET
canceled_at: None | str | Unset = UNSET
ends_at: None | str | Unset = UNSET
operation_id: None | str | Unset = UNSET
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
def to_dict(self) -> dict[str, Any]:
id = self.id
resource_type = self.resource_type
resource_id = self.resource_id
plan_name = self.plan_name
plan_display_name = self.plan_display_name
billing_interval = self.billing_interval
status = self.status
base_price_cents = self.base_price_cents
created_at = self.created_at
current_period_start: None | str | Unset
if isinstance(self.current_period_start, Unset):
current_period_start = UNSET
else:
current_period_start = self.current_period_start
current_period_end: None | str | Unset
if isinstance(self.current_period_end, Unset):
current_period_end = UNSET
else:
current_period_end = self.current_period_end
started_at: None | str | Unset
if isinstance(self.started_at, Unset):
started_at = UNSET
else:
started_at = self.started_at
canceled_at: None | str | Unset
if isinstance(self.canceled_at, Unset):
canceled_at = UNSET
else:
canceled_at = self.canceled_at
ends_at: None | str | Unset
if isinstance(self.ends_at, Unset):
ends_at = UNSET
else:
ends_at = self.ends_at
operation_id: None | str | Unset
if isinstance(self.operation_id, Unset):
operation_id = UNSET
else:
operation_id = self.operation_id
field_dict: dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update(
{
"id": id,
"resource_type": resource_type,
"resource_id": resource_id,
"plan_name": plan_name,
"plan_display_name": plan_display_name,
"billing_interval": billing_interval,
"status": status,
"base_price_cents": base_price_cents,
"created_at": created_at,
}
)
if current_period_start is not UNSET:
field_dict["current_period_start"] = current_period_start
if current_period_end is not UNSET:
field_dict["current_period_end"] = current_period_end
if started_at is not UNSET:
field_dict["started_at"] = started_at
if canceled_at is not UNSET:
field_dict["canceled_at"] = canceled_at
if ends_at is not UNSET:
field_dict["ends_at"] = ends_at
if operation_id is not UNSET:
field_dict["operation_id"] = operation_id
return field_dict
@classmethod
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
d = dict(src_dict)
id = d.pop("id")
resource_type = d.pop("resource_type")
resource_id = d.pop("resource_id")
plan_name = d.pop("plan_name")
plan_display_name = d.pop("plan_display_name")
billing_interval = d.pop("billing_interval")
status = d.pop("status")
base_price_cents = d.pop("base_price_cents")
created_at = d.pop("created_at")
def _parse_current_period_start(data: object) -> None | str | Unset:
if data is None:
return data
if isinstance(data, Unset):
return data
return cast(None | str | Unset, data)
current_period_start = _parse_current_period_start(
d.pop("current_period_start", UNSET)
)
def _parse_current_period_end(data: object) -> None | str | Unset:
if data is None:
return data
if isinstance(data, Unset):
return data
return cast(None | str | Unset, data)
current_period_end = _parse_current_period_end(d.pop("current_period_end", UNSET))
def _parse_started_at(data: object) -> None | str | Unset:
if data is None:
return data
if isinstance(data, Unset):
return data
return cast(None | str | Unset, data)
started_at = _parse_started_at(d.pop("started_at", UNSET))
def _parse_canceled_at(data: object) -> None | str | Unset:
if data is None:
return data
if isinstance(data, Unset):
return data
return cast(None | str | Unset, data)
canceled_at = _parse_canceled_at(d.pop("canceled_at", UNSET))
def _parse_ends_at(data: object) -> None | str | Unset:
if data is None:
return data
if isinstance(data, Unset):
return data
return cast(None | str | Unset, data)
ends_at = _parse_ends_at(d.pop("ends_at", UNSET))
def _parse_operation_id(data: object) -> None | str | Unset:
if data is None:
return data
if isinstance(data, Unset):
return data
return cast(None | str | Unset, data)
operation_id = _parse_operation_id(d.pop("operation_id", UNSET))
graph_subscription_response = cls(
id=id,
resource_type=resource_type,
resource_id=resource_id,
plan_name=plan_name,
plan_display_name=plan_display_name,
billing_interval=billing_interval,
status=status,
base_price_cents=base_price_cents,
created_at=created_at,
current_period_start=current_period_start,
current_period_end=current_period_end,
started_at=started_at,
canceled_at=canceled_at,
ends_at=ends_at,
operation_id=operation_id,
)
graph_subscription_response.additional_properties = d
return graph_subscription_response
@property
def additional_keys(self) -> list[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties