Skip to content

Commit 642bade

Browse files
committed
feta: update generation
1 parent 33e03ee commit 642bade

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+2670
-11362
lines changed
Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,27 @@
11
# This file was automatically generated. DO NOT EDIT.
22
# If you have any remark or suggestion do not hesitate to open an issue.
3-
from .types import DiscountDiscountMode
4-
from .types import DiscountFilterType
53
from .types import DownloadInvoiceRequestFileType
64
from .types import InvoiceType
7-
from .types import ListDiscountsRequestOrderBy
85
from .types import ListInvoicesRequestOrderBy
9-
from .types import Discount
10-
from .types import DiscountCoupon
11-
from .types import DiscountFilter
12-
from .types import GetConsumptionResponse
136
from .types import GetConsumptionResponseConsumption
147
from .types import Invoice
15-
from .types import ListDiscountsResponse
8+
from .types import DownloadInvoiceRequest
9+
from .types import GetConsumptionRequest
10+
from .types import GetConsumptionResponse
11+
from .types import ListInvoicesRequest
1612
from .types import ListInvoicesResponse
1713
from .api import BillingV2Alpha1API
1814

1915
__all__ = [
20-
"DiscountDiscountMode",
21-
"DiscountFilterType",
2216
"DownloadInvoiceRequestFileType",
2317
"InvoiceType",
24-
"ListDiscountsRequestOrderBy",
2518
"ListInvoicesRequestOrderBy",
26-
"Discount",
27-
"DiscountCoupon",
28-
"DiscountFilter",
29-
"GetConsumptionResponse",
3019
"GetConsumptionResponseConsumption",
3120
"Invoice",
32-
"ListDiscountsResponse",
21+
"DownloadInvoiceRequest",
22+
"GetConsumptionRequest",
23+
"GetConsumptionResponse",
24+
"ListInvoicesRequest",
3325
"ListInvoicesResponse",
3426
"BillingV2Alpha1API",
3527
]

scaleway-async/scaleway_async/billing/v2alpha1/api.py

Lines changed: 1 addition & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,13 @@
1616
from .types import (
1717
DownloadInvoiceRequestFileType,
1818
InvoiceType,
19-
ListDiscountsRequestOrderBy,
2019
ListInvoicesRequestOrderBy,
21-
Discount,
2220
GetConsumptionResponse,
2321
Invoice,
24-
ListDiscountsResponse,
2522
ListInvoicesResponse,
2623
)
2724
from .marshalling import (
2825
unmarshal_GetConsumptionResponse,
29-
unmarshal_ListDiscountsResponse,
3026
unmarshal_ListInvoicesResponse,
3127
)
3228

@@ -189,78 +185,4 @@ async def download_invoice(
189185
)
190186

191187
self._throw_on_error(res)
192-
json = res.json()
193-
return unmarshal_ScwFile(json) if json is not None else None
194-
195-
async def list_discounts(
196-
self,
197-
*,
198-
order_by: ListDiscountsRequestOrderBy = ListDiscountsRequestOrderBy.CREATION_DATE_DESC,
199-
page: Optional[int] = None,
200-
page_size: Optional[int] = None,
201-
organization_id: Optional[str] = None,
202-
) -> ListDiscountsResponse:
203-
"""
204-
List all user's discounts.
205-
List all discounts for an organization and usable categories/products/offers/references/regions/zones where the discount can be applied.
206-
:param order_by: Order discounts in the response by their description.
207-
:param page: Positive integer to choose the page to return.
208-
:param page_size: Positive integer lower or equal to 100 to select the number of items to return.
209-
:param organization_id: ID of the organization.
210-
:return: :class:`ListDiscountsResponse <ListDiscountsResponse>`
211-
212-
Usage:
213-
::
214-
215-
result = await api.list_discounts()
216-
"""
217-
218-
res = self._request(
219-
"GET",
220-
f"/billing/v2alpha1/discounts",
221-
params={
222-
"order_by": order_by,
223-
"organization_id": organization_id
224-
or self.client.default_organization_id,
225-
"page": page,
226-
"page_size": page_size or self.client.default_page_size,
227-
},
228-
)
229-
230-
self._throw_on_error(res)
231-
return unmarshal_ListDiscountsResponse(res.json())
232-
233-
async def list_discounts_all(
234-
self,
235-
*,
236-
order_by: Optional[ListDiscountsRequestOrderBy] = None,
237-
page: Optional[int] = None,
238-
page_size: Optional[int] = None,
239-
organization_id: Optional[str] = None,
240-
) -> List[Discount]:
241-
"""
242-
List all user's discounts.
243-
List all discounts for an organization and usable categories/products/offers/references/regions/zones where the discount can be applied.
244-
:param order_by: Order discounts in the response by their description.
245-
:param page: Positive integer to choose the page to return.
246-
:param page_size: Positive integer lower or equal to 100 to select the number of items to return.
247-
:param organization_id: ID of the organization.
248-
:return: :class:`List[ListDiscountsResponse] <List[ListDiscountsResponse]>`
249-
250-
Usage:
251-
::
252-
253-
result = await api.list_discounts_all()
254-
"""
255-
256-
return await fetch_all_pages_async(
257-
type=ListDiscountsResponse,
258-
key="discounts",
259-
fetcher=self.list_discounts,
260-
args={
261-
"order_by": order_by,
262-
"page": page,
263-
"page_size": page_size,
264-
"organization_id": organization_id,
265-
},
266-
)
188+
return unmarshal_ScwFile(res.json())

scaleway-async/scaleway_async/billing/v2alpha1/marshalling.py

Lines changed: 2 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -8,98 +8,13 @@
88
unmarshal_Money,
99
)
1010
from .types import (
11-
Discount,
12-
DiscountCoupon,
13-
DiscountFilter,
14-
GetConsumptionResponse,
1511
GetConsumptionResponseConsumption,
1612
GetConsumptionResponse,
1713
Invoice,
18-
ListDiscountsResponse,
1914
ListInvoicesResponse,
2015
)
2116

2217

23-
def unmarshal_DiscountCoupon(data: Any) -> DiscountCoupon:
24-
if type(data) is not dict:
25-
raise TypeError(
26-
f"Unmarshalling the type 'DiscountCoupon' failed as data isn't a dictionary."
27-
)
28-
29-
args: Dict[str, Any] = {}
30-
31-
field = data.get("description", None)
32-
args["description"] = field
33-
34-
return DiscountCoupon(**args)
35-
36-
37-
def unmarshal_DiscountFilter(data: Any) -> DiscountFilter:
38-
if type(data) is not dict:
39-
raise TypeError(
40-
f"Unmarshalling the type 'DiscountFilter' failed as data isn't a dictionary."
41-
)
42-
43-
args: Dict[str, Any] = {}
44-
45-
field = data.get("type", None)
46-
args["type_"] = field
47-
48-
field = data.get("value", None)
49-
args["value"] = field
50-
51-
return DiscountFilter(**args)
52-
53-
54-
def unmarshal_Discount(data: Any) -> Discount:
55-
if type(data) is not dict:
56-
raise TypeError(
57-
f"Unmarshalling the type 'Discount' failed as data isn't a dictionary."
58-
)
59-
60-
args: Dict[str, Any] = {}
61-
62-
field = data.get("coupon", None)
63-
args["coupon"] = unmarshal_DiscountCoupon(field) if field is not None else None
64-
65-
field = data.get("creation_date", None)
66-
args["creation_date"] = parser.isoparse(field) if type(field) is str else field
67-
68-
field = data.get("description", None)
69-
args["description"] = field
70-
71-
field = data.get("filters", None)
72-
args["filters"] = (
73-
[unmarshal_DiscountFilter(v) for v in field] if field is not None else None
74-
)
75-
76-
field = data.get("id", None)
77-
args["id"] = field
78-
79-
field = data.get("mode", None)
80-
args["mode"] = field
81-
82-
field = data.get("organization_id", None)
83-
args["organization_id"] = field
84-
85-
field = data.get("start_date", None)
86-
args["start_date"] = parser.isoparse(field) if type(field) is str else field
87-
88-
field = data.get("stop_date", None)
89-
args["stop_date"] = parser.isoparse(field) if type(field) is str else field
90-
91-
field = data.get("value", None)
92-
args["value"] = field
93-
94-
field = data.get("value_remaining", None)
95-
args["value_remaining"] = field
96-
97-
field = data.get("value_used", None)
98-
args["value_used"] = field
99-
100-
return Discount(**args)
101-
102-
10318
def unmarshal_GetConsumptionResponseConsumption(
10419
data: Any,
10520
) -> GetConsumptionResponseConsumption:
@@ -149,27 +64,8 @@ def unmarshal_GetConsumptionResponse(data: Any) -> GetConsumptionResponse:
14964
return GetConsumptionResponse(**args)
15065

15166

152-
def unmarshal_ListDiscountsResponse(data: Any) -> ListDiscountsResponse:
153-
if type(data) is not dict:
154-
raise TypeError(
155-
f"Unmarshalling the type 'ListDiscountsResponse' failed as data isn't a dictionary."
156-
)
157-
158-
args: Dict[str, Any] = {}
159-
160-
field = data.get("discounts", None)
161-
args["discounts"] = (
162-
[unmarshal_Discount(v) for v in field] if field is not None else None
163-
)
164-
165-
field = data.get("total_count", None)
166-
args["total_count"] = field
167-
168-
return ListDiscountsResponse(**args)
169-
170-
171-
def unmarshal_ListInvoicesResponse(data: Any) -> ListInvoicesResponse:
172-
if type(data) is not dict:
67+
def unmarshal_Invoice(data: Any) -> Invoice:
68+
if not isinstance(data, dict):
17369
raise TypeError(
17470
"Unmarshalling the type 'Invoice' failed as data isn't a dictionary."
17571
)

0 commit comments

Comments
 (0)