|
8 | 8 | unmarshal_Money,
|
9 | 9 | )
|
10 | 10 | from .types import (
|
11 |
| - Invoice, |
12 |
| - ListConsumptionsResponseConsumption, |
13 |
| - ListConsumptionsResponse, |
14 | 11 | DiscountCoupon,
|
15 | 12 | DiscountFilter,
|
16 | 13 | Discount,
|
| 14 | + Invoice, |
| 15 | + ListConsumptionsResponseConsumption, |
| 16 | + ListConsumptionsResponse, |
17 | 17 | ListDiscountsResponse,
|
18 | 18 | ListInvoicesResponse,
|
19 | 19 | ListTaxesResponseTax,
|
20 | 20 | ListTaxesResponse,
|
21 | 21 | )
|
22 | 22 |
|
23 | 23 |
|
| 24 | +def unmarshal_DiscountCoupon(data: Any) -> DiscountCoupon: |
| 25 | + if not isinstance(data, dict): |
| 26 | + raise TypeError( |
| 27 | + "Unmarshalling the type 'DiscountCoupon' failed as data isn't a dictionary." |
| 28 | + ) |
| 29 | + |
| 30 | + args: Dict[str, Any] = {} |
| 31 | + |
| 32 | + field = data.get("description", None) |
| 33 | + if field is not None: |
| 34 | + args["description"] = field |
| 35 | + else: |
| 36 | + args["description"] = None |
| 37 | + |
| 38 | + return DiscountCoupon(**args) |
| 39 | + |
| 40 | + |
| 41 | +def unmarshal_DiscountFilter(data: Any) -> DiscountFilter: |
| 42 | + if not isinstance(data, dict): |
| 43 | + raise TypeError( |
| 44 | + "Unmarshalling the type 'DiscountFilter' failed as data isn't a dictionary." |
| 45 | + ) |
| 46 | + |
| 47 | + args: Dict[str, Any] = {} |
| 48 | + |
| 49 | + field = data.get("type", None) |
| 50 | + if field is not None: |
| 51 | + args["type_"] = field |
| 52 | + |
| 53 | + field = data.get("value", None) |
| 54 | + if field is not None: |
| 55 | + args["value"] = field |
| 56 | + |
| 57 | + field = data.get("exclude", None) |
| 58 | + if field is not None: |
| 59 | + args["exclude"] = field |
| 60 | + |
| 61 | + return DiscountFilter(**args) |
| 62 | + |
| 63 | + |
| 64 | +def unmarshal_Discount(data: Any) -> Discount: |
| 65 | + if not isinstance(data, dict): |
| 66 | + raise TypeError( |
| 67 | + "Unmarshalling the type 'Discount' failed as data isn't a dictionary." |
| 68 | + ) |
| 69 | + |
| 70 | + args: Dict[str, Any] = {} |
| 71 | + |
| 72 | + field = data.get("id", None) |
| 73 | + if field is not None: |
| 74 | + args["id"] = field |
| 75 | + |
| 76 | + field = data.get("organization_id", None) |
| 77 | + if field is not None: |
| 78 | + args["organization_id"] = field |
| 79 | + |
| 80 | + field = data.get("description", None) |
| 81 | + if field is not None: |
| 82 | + args["description"] = field |
| 83 | + |
| 84 | + field = data.get("value", None) |
| 85 | + if field is not None: |
| 86 | + args["value"] = field |
| 87 | + |
| 88 | + field = data.get("value_used", None) |
| 89 | + if field is not None: |
| 90 | + args["value_used"] = field |
| 91 | + |
| 92 | + field = data.get("value_remaining", None) |
| 93 | + if field is not None: |
| 94 | + args["value_remaining"] = field |
| 95 | + |
| 96 | + field = data.get("mode", None) |
| 97 | + if field is not None: |
| 98 | + args["mode"] = field |
| 99 | + |
| 100 | + field = data.get("filters", None) |
| 101 | + if field is not None: |
| 102 | + args["filters"] = ( |
| 103 | + [unmarshal_DiscountFilter(v) for v in field] if field is not None else None |
| 104 | + ) |
| 105 | + |
| 106 | + field = data.get("creation_date", None) |
| 107 | + if field is not None: |
| 108 | + args["creation_date"] = ( |
| 109 | + parser.isoparse(field) if isinstance(field, str) else field |
| 110 | + ) |
| 111 | + else: |
| 112 | + args["creation_date"] = None |
| 113 | + |
| 114 | + field = data.get("start_date", None) |
| 115 | + if field is not None: |
| 116 | + args["start_date"] = parser.isoparse(field) if isinstance(field, str) else field |
| 117 | + else: |
| 118 | + args["start_date"] = None |
| 119 | + |
| 120 | + field = data.get("stop_date", None) |
| 121 | + if field is not None: |
| 122 | + args["stop_date"] = parser.isoparse(field) if isinstance(field, str) else field |
| 123 | + else: |
| 124 | + args["stop_date"] = None |
| 125 | + |
| 126 | + field = data.get("coupon", None) |
| 127 | + if field is not None: |
| 128 | + args["coupon"] = unmarshal_DiscountCoupon(field) |
| 129 | + else: |
| 130 | + args["coupon"] = None |
| 131 | + |
| 132 | + return Discount(**args) |
| 133 | + |
| 134 | + |
24 | 135 | def unmarshal_Invoice(data: Any) -> Invoice:
|
25 | 136 | if not isinstance(data, dict):
|
26 | 137 | raise TypeError(
|
@@ -204,117 +315,6 @@ def unmarshal_ListConsumptionsResponse(data: Any) -> ListConsumptionsResponse:
|
204 | 315 | return ListConsumptionsResponse(**args)
|
205 | 316 |
|
206 | 317 |
|
207 |
| -def unmarshal_DiscountCoupon(data: Any) -> DiscountCoupon: |
208 |
| - if not isinstance(data, dict): |
209 |
| - raise TypeError( |
210 |
| - "Unmarshalling the type 'DiscountCoupon' failed as data isn't a dictionary." |
211 |
| - ) |
212 |
| - |
213 |
| - args: Dict[str, Any] = {} |
214 |
| - |
215 |
| - field = data.get("description", None) |
216 |
| - if field is not None: |
217 |
| - args["description"] = field |
218 |
| - else: |
219 |
| - args["description"] = None |
220 |
| - |
221 |
| - return DiscountCoupon(**args) |
222 |
| - |
223 |
| - |
224 |
| -def unmarshal_DiscountFilter(data: Any) -> DiscountFilter: |
225 |
| - if not isinstance(data, dict): |
226 |
| - raise TypeError( |
227 |
| - "Unmarshalling the type 'DiscountFilter' failed as data isn't a dictionary." |
228 |
| - ) |
229 |
| - |
230 |
| - args: Dict[str, Any] = {} |
231 |
| - |
232 |
| - field = data.get("type", None) |
233 |
| - if field is not None: |
234 |
| - args["type_"] = field |
235 |
| - |
236 |
| - field = data.get("value", None) |
237 |
| - if field is not None: |
238 |
| - args["value"] = field |
239 |
| - |
240 |
| - field = data.get("exclude", None) |
241 |
| - if field is not None: |
242 |
| - args["exclude"] = field |
243 |
| - |
244 |
| - return DiscountFilter(**args) |
245 |
| - |
246 |
| - |
247 |
| -def unmarshal_Discount(data: Any) -> Discount: |
248 |
| - if not isinstance(data, dict): |
249 |
| - raise TypeError( |
250 |
| - "Unmarshalling the type 'Discount' failed as data isn't a dictionary." |
251 |
| - ) |
252 |
| - |
253 |
| - args: Dict[str, Any] = {} |
254 |
| - |
255 |
| - field = data.get("id", None) |
256 |
| - if field is not None: |
257 |
| - args["id"] = field |
258 |
| - |
259 |
| - field = data.get("organization_id", None) |
260 |
| - if field is not None: |
261 |
| - args["organization_id"] = field |
262 |
| - |
263 |
| - field = data.get("description", None) |
264 |
| - if field is not None: |
265 |
| - args["description"] = field |
266 |
| - |
267 |
| - field = data.get("value", None) |
268 |
| - if field is not None: |
269 |
| - args["value"] = field |
270 |
| - |
271 |
| - field = data.get("value_used", None) |
272 |
| - if field is not None: |
273 |
| - args["value_used"] = field |
274 |
| - |
275 |
| - field = data.get("value_remaining", None) |
276 |
| - if field is not None: |
277 |
| - args["value_remaining"] = field |
278 |
| - |
279 |
| - field = data.get("mode", None) |
280 |
| - if field is not None: |
281 |
| - args["mode"] = field |
282 |
| - |
283 |
| - field = data.get("filters", None) |
284 |
| - if field is not None: |
285 |
| - args["filters"] = ( |
286 |
| - [unmarshal_DiscountFilter(v) for v in field] if field is not None else None |
287 |
| - ) |
288 |
| - |
289 |
| - field = data.get("creation_date", None) |
290 |
| - if field is not None: |
291 |
| - args["creation_date"] = ( |
292 |
| - parser.isoparse(field) if isinstance(field, str) else field |
293 |
| - ) |
294 |
| - else: |
295 |
| - args["creation_date"] = None |
296 |
| - |
297 |
| - field = data.get("start_date", None) |
298 |
| - if field is not None: |
299 |
| - args["start_date"] = parser.isoparse(field) if isinstance(field, str) else field |
300 |
| - else: |
301 |
| - args["start_date"] = None |
302 |
| - |
303 |
| - field = data.get("stop_date", None) |
304 |
| - if field is not None: |
305 |
| - args["stop_date"] = parser.isoparse(field) if isinstance(field, str) else field |
306 |
| - else: |
307 |
| - args["stop_date"] = None |
308 |
| - |
309 |
| - field = data.get("coupon", None) |
310 |
| - if field is not None: |
311 |
| - args["coupon"] = unmarshal_DiscountCoupon(field) |
312 |
| - else: |
313 |
| - args["coupon"] = None |
314 |
| - |
315 |
| - return Discount(**args) |
316 |
| - |
317 |
| - |
318 | 318 | def unmarshal_ListDiscountsResponse(data: Any) -> ListDiscountsResponse:
|
319 | 319 | if not isinstance(data, dict):
|
320 | 320 | raise TypeError(
|
|
0 commit comments