Skip to content

Commit 85095ad

Browse files
auto codegen for UBill
Co-authored-by: Yufei Li <yufeiminds@gmail.com>
1 parent 8d4fd7c commit 85095ad

File tree

7 files changed

+159
-0
lines changed

7 files changed

+159
-0
lines changed

docs/services.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ IPSecVPN
101101
:members:
102102

103103

104+
UBill
105+
-----
106+
107+
.. autoclass:: ucloud.services.ubill.client.UBillClient
108+
:members:
109+
110+
104111
UFS
105112
---
106113

ucloud/client.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ def uaccount(self):
6262
self.logger,
6363
)
6464

65+
def ubill(self):
66+
from ucloud.services.ubill.client import UBillClient
67+
68+
return UBillClient(
69+
self._auto_config("ubill"),
70+
self.transport,
71+
self.middleware,
72+
self.logger,
73+
)
74+
6575
def ucdn(self):
6676
from ucloud.services.ucdn.client import UCDNClient
6777

ucloud/services/ubill/__init__.py

Whitespace-only changes.

ucloud/services/ubill/client.py

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
""" Code is generated by ucloud-model, DO NOT EDIT IT. """
2+
3+
import typing
4+
5+
6+
from ucloud.core.client import Client
7+
from ucloud.services.ubill.schemas import apis
8+
9+
10+
class UBillClient(Client):
11+
def __init__(
12+
self, config: dict, transport=None, middleware=None, logger=None
13+
):
14+
super(UBillClient, self).__init__(config, transport, middleware, logger)
15+
16+
def get_balance(self, req: typing.Optional[dict] = None, **kwargs) -> dict:
17+
"""GetBalance - 获取账户余额
18+
19+
**Request**
20+
21+
22+
**Response**
23+
24+
- **AccountInfo** (dict) - 见 **AccountInfo** 模型定义
25+
26+
**Response Model**
27+
28+
**AccountInfo**
29+
- **Amount** (str) - 账户余额
30+
- **AmountAvailable** (str) - 账户可用余额
31+
- **AmountCredit** (str) - 信用账户余额
32+
- **AmountFree** (str) - 赠送账户余额
33+
- **AmountFreeze** (str) - 冻结账户金额
34+
35+
36+
"""
37+
# build request
38+
d = {}
39+
req and d.update(req)
40+
d = apis.GetBalanceRequestSchema().dumps(d)
41+
42+
resp = self.invoke("GetBalance", d, **kwargs)
43+
return apis.GetBalanceResponseSchema().loads(resp)
44+
45+
def get_bill_data_file_url(
46+
self, req: typing.Optional[dict] = None, **kwargs
47+
) -> dict:
48+
"""GetBillDataFileUrl - 生成账单数据文件下载的 url
49+
50+
**Request**
51+
52+
- **BillPeriod** (int) - (Required) 账期(时间戳格式)
53+
- **BillType** (int) - (Required) 账单类型,传 0 时获取账单总览报表,传 1 获取账单明细报表
54+
- **PaidType** (int) - 获取账单总览报表时,账单的支付状态,传 0 时获取待支付账单,传 1 时获取已支付账单。获取账单明细报表时该参数无效
55+
- **RequireVersion** (str) - 如需求其他语言版本的账单则使用此参数。默认中文。如 RequireVersion = "EN",则提供英文版本账单。
56+
57+
**Response**
58+
59+
- **FileUrl** (str) - 交易账单数据下载URL
60+
- **IsValid** (str) - 生成的 URL是否有效,即有对应数据文件
61+
62+
"""
63+
# build request
64+
d = {}
65+
req and d.update(req)
66+
d = apis.GetBillDataFileUrlRequestSchema().dumps(d)
67+
68+
resp = self.invoke("GetBillDataFileUrl", d, **kwargs)
69+
return apis.GetBillDataFileUrlResponseSchema().loads(resp)

ucloud/services/ubill/schemas/__init__.py

Whitespace-only changes.

ucloud/services/ubill/schemas/apis.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
""" Code is generated by ucloud-model, DO NOT EDIT IT. """
2+
3+
4+
from ucloud.core.typesystem import schema, fields
5+
from ucloud.services.ubill.schemas import models
6+
7+
""" UBill API Schema
8+
"""
9+
10+
11+
"""
12+
API: GetBalance
13+
14+
获取账户余额
15+
"""
16+
17+
18+
class GetBalanceRequestSchema(schema.RequestSchema):
19+
"""GetBalance - 获取账户余额"""
20+
21+
fields = {}
22+
23+
24+
class GetBalanceResponseSchema(schema.ResponseSchema):
25+
"""GetBalance - 获取账户余额"""
26+
27+
fields = {
28+
"AccountInfo": models.AccountInfoSchema(),
29+
}
30+
31+
32+
"""
33+
API: GetBillDataFileUrl
34+
35+
生成账单数据文件下载的 url
36+
"""
37+
38+
39+
class GetBillDataFileUrlRequestSchema(schema.RequestSchema):
40+
"""GetBillDataFileUrl - 生成账单数据文件下载的 url"""
41+
42+
fields = {
43+
"BillPeriod": fields.Int(required=True, dump_to="BillPeriod"),
44+
"BillType": fields.Int(required=True, dump_to="BillType"),
45+
"PaidType": fields.Int(required=False, dump_to="PaidType"),
46+
"RequireVersion": fields.Str(required=False, dump_to="RequireVersion"),
47+
}
48+
49+
50+
class GetBillDataFileUrlResponseSchema(schema.ResponseSchema):
51+
"""GetBillDataFileUrl - 生成账单数据文件下载的 url"""
52+
53+
fields = {
54+
"FileUrl": fields.Str(required=False, load_from="FileUrl"),
55+
"IsValid": fields.Str(required=False, load_from="IsValid"),
56+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
""" Code is generated by ucloud-model, DO NOT EDIT IT. """
2+
3+
from ucloud.core.typesystem import schema, fields
4+
5+
6+
class AccountInfoSchema(schema.ResponseSchema):
7+
"""AccountInfo - 账户信息"""
8+
9+
fields = {
10+
"Amount": fields.Str(required=False, load_from="Amount"),
11+
"AmountAvailable": fields.Str(
12+
required=False, load_from="AmountAvailable"
13+
),
14+
"AmountCredit": fields.Str(required=False, load_from="AmountCredit"),
15+
"AmountFree": fields.Str(required=False, load_from="AmountFree"),
16+
"AmountFreeze": fields.Str(required=False, load_from="AmountFreeze"),
17+
}

0 commit comments

Comments
 (0)