sweb-api 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sweb_api/__init__.py +144 -0
- sweb_api/api/__init__.py +11 -0
- sweb_api/api/base.py +15 -0
- sweb_api/api/domains.py +274 -0
- sweb_api/api/pay.py +31 -0
- sweb_api/api/vh.py +444 -0
- sweb_api/api/vps.py +379 -0
- sweb_api/exceptions/exceptions.py +20 -0
- sweb_api/http/client.py +82 -0
- sweb_api-0.1.0.dist-info/METADATA +185 -0
- sweb_api-0.1.0.dist-info/RECORD +14 -0
- sweb_api-0.1.0.dist-info/WHEEL +5 -0
- sweb_api-0.1.0.dist-info/licenses/LICENSE +21 -0
- sweb_api-0.1.0.dist-info/top_level.txt +1 -0
sweb_api/__init__.py
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
from sweb_api.http.client import JSONRPCClient
|
|
2
|
+
from sweb_api.api.domains import DomainsAPI, DomainsBonusAPI, DomainsPersonsAPI, DomainsDNSAPI
|
|
3
|
+
from sweb_api.api.vh import (
|
|
4
|
+
SitesAPI, HostingAPI, BackupAPI, MailAPI, SSLAPI, TariffAPI,
|
|
5
|
+
LoadAPI, UtilsAPI, CronAPI, DDGAPI, DiskUsageAPI,
|
|
6
|
+
)
|
|
7
|
+
from sweb_api.api.vps import (
|
|
8
|
+
VPSAPI, VPSBackupAPI, VPSSSLAPI, VPSIPAPI, VPSProtectedIPAPI,
|
|
9
|
+
VPSDBaaSAPI, VPSBalancerAPI, VPSRemoteBackupAPI, VPSMonitoringAPI,
|
|
10
|
+
VPSMonitoringChecksAPI, VPSMonitoringContactsAPI,
|
|
11
|
+
)
|
|
12
|
+
from sweb_api.api.pay import PayAPI
|
|
13
|
+
from sweb_api.exceptions.exceptions import AuthenticationError
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class SwebClient:
|
|
17
|
+
BASE_URL = "https://api.sweb.ru"
|
|
18
|
+
|
|
19
|
+
def __init__(self, login: str, password: str, timeout: int = 30):
|
|
20
|
+
self._login = login
|
|
21
|
+
self._password = password
|
|
22
|
+
self._client = JSONRPCClient(self.BASE_URL, timeout)
|
|
23
|
+
self._token = self._authenticate()
|
|
24
|
+
self._client.set_token(self._token)
|
|
25
|
+
|
|
26
|
+
def _authenticate(self) -> str:
|
|
27
|
+
client = JSONRPCClient(f"{self.BASE_URL}/notAuthorized")
|
|
28
|
+
try:
|
|
29
|
+
result = client.call("getToken", {"login": self._login, "password": self._password})
|
|
30
|
+
if not result or not isinstance(result, str):
|
|
31
|
+
raise AuthenticationError("Invalid token received")
|
|
32
|
+
return result
|
|
33
|
+
except Exception as e:
|
|
34
|
+
if isinstance(e, AuthenticationError):
|
|
35
|
+
raise
|
|
36
|
+
raise AuthenticationError(f"Failed to authenticate: {e}")
|
|
37
|
+
|
|
38
|
+
@property
|
|
39
|
+
def domains(self) -> DomainsAPI:
|
|
40
|
+
return DomainsAPI(self._client, "domains")
|
|
41
|
+
|
|
42
|
+
@property
|
|
43
|
+
def domains_bonus(self) -> DomainsBonusAPI:
|
|
44
|
+
return DomainsBonusAPI(self._client, "domains/bonus")
|
|
45
|
+
|
|
46
|
+
@property
|
|
47
|
+
def domains_persons(self) -> DomainsPersonsAPI:
|
|
48
|
+
return DomainsPersonsAPI(self._client, "domains/persons")
|
|
49
|
+
|
|
50
|
+
@property
|
|
51
|
+
def domains_dns(self) -> DomainsDNSAPI:
|
|
52
|
+
return DomainsDNSAPI(self._client, "domains/dns")
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def sites(self) -> SitesAPI:
|
|
56
|
+
return SitesAPI(self._client, "sites")
|
|
57
|
+
|
|
58
|
+
@property
|
|
59
|
+
def hosting(self) -> HostingAPI:
|
|
60
|
+
return HostingAPI(self._client, "vh/hosting")
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
def backup(self) -> BackupAPI:
|
|
64
|
+
return BackupAPI(self._client, "vh/backup")
|
|
65
|
+
|
|
66
|
+
@property
|
|
67
|
+
def mail(self) -> MailAPI:
|
|
68
|
+
return MailAPI(self._client, "vh/mail")
|
|
69
|
+
|
|
70
|
+
@property
|
|
71
|
+
def ssl(self) -> SSLAPI:
|
|
72
|
+
return SSLAPI(self._client, "vh/ssl")
|
|
73
|
+
|
|
74
|
+
@property
|
|
75
|
+
def tariff(self) -> TariffAPI:
|
|
76
|
+
return TariffAPI(self._client, "tariff")
|
|
77
|
+
|
|
78
|
+
@property
|
|
79
|
+
def load(self) -> LoadAPI:
|
|
80
|
+
return LoadAPI(self._client, "vh/load")
|
|
81
|
+
|
|
82
|
+
@property
|
|
83
|
+
def utils(self) -> UtilsAPI:
|
|
84
|
+
return UtilsAPI(self._client, "vh/utils")
|
|
85
|
+
|
|
86
|
+
@property
|
|
87
|
+
def cron(self) -> CronAPI:
|
|
88
|
+
return CronAPI(self._client, "vh/cron")
|
|
89
|
+
|
|
90
|
+
@property
|
|
91
|
+
def disk_usage(self) -> DiskUsageAPI:
|
|
92
|
+
return DiskUsageAPI(self._client, "vh/utils/diskUsage")
|
|
93
|
+
|
|
94
|
+
@property
|
|
95
|
+
def ddg(self) -> DDGAPI:
|
|
96
|
+
return DDGAPI(self._client, "vh/ddg")
|
|
97
|
+
|
|
98
|
+
@property
|
|
99
|
+
def vps(self) -> VPSAPI:
|
|
100
|
+
return VPSAPI(self._client, "vps")
|
|
101
|
+
|
|
102
|
+
@property
|
|
103
|
+
def vps_backup(self) -> VPSBackupAPI:
|
|
104
|
+
return VPSBackupAPI(self._client, "vps/backup")
|
|
105
|
+
|
|
106
|
+
@property
|
|
107
|
+
def vps_ssl(self) -> VPSSSLAPI:
|
|
108
|
+
return VPSSSLAPI(self._client, "vps/ssl")
|
|
109
|
+
|
|
110
|
+
@property
|
|
111
|
+
def vps_ip(self) -> VPSIPAPI:
|
|
112
|
+
return VPSIPAPI(self._client, "vps/ip")
|
|
113
|
+
|
|
114
|
+
@property
|
|
115
|
+
def vps_protected_ip(self) -> VPSProtectedIPAPI:
|
|
116
|
+
return VPSProtectedIPAPI(self._client, "vps/protected-ip")
|
|
117
|
+
|
|
118
|
+
@property
|
|
119
|
+
def vps_dbaas(self) -> VPSDBaaSAPI:
|
|
120
|
+
return VPSDBaaSAPI(self._client, "vps/dbaas")
|
|
121
|
+
|
|
122
|
+
@property
|
|
123
|
+
def vps_balancer(self) -> VPSBalancerAPI:
|
|
124
|
+
return VPSBalancerAPI(self._client, "vps/balancer")
|
|
125
|
+
|
|
126
|
+
@property
|
|
127
|
+
def vps_remote_backup(self) -> VPSRemoteBackupAPI:
|
|
128
|
+
return VPSRemoteBackupAPI(self._client, "vps/remote-backup")
|
|
129
|
+
|
|
130
|
+
@property
|
|
131
|
+
def vps_monitoring(self) -> VPSMonitoringAPI:
|
|
132
|
+
return VPSMonitoringAPI(self._client, "vps/monitoring")
|
|
133
|
+
|
|
134
|
+
@property
|
|
135
|
+
def vps_monitoring_checks(self) -> VPSMonitoringChecksAPI:
|
|
136
|
+
return VPSMonitoringChecksAPI(self._client, "vps/monitoring/checks")
|
|
137
|
+
|
|
138
|
+
@property
|
|
139
|
+
def vps_monitoring_contacts(self) -> VPSMonitoringContactsAPI:
|
|
140
|
+
return VPSMonitoringContactsAPI(self._client, "vps/monitoring/contacts")
|
|
141
|
+
|
|
142
|
+
@property
|
|
143
|
+
def pay(self) -> PayAPI:
|
|
144
|
+
return PayAPI(self._client, "pay")
|
sweb_api/api/__init__.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from sweb_api.api.domains import DomainsAPI, DomainsBonusAPI, DomainsPersonsAPI, DomainsDNSAPI
|
|
2
|
+
from sweb_api.api.vh import (
|
|
3
|
+
SitesAPI, HostingAPI, BackupAPI, MailAPI, SSLAPI, TariffAPI,
|
|
4
|
+
LoadAPI, UtilsAPI, CronAPI, DDGAPI, DiskUsageAPI,
|
|
5
|
+
)
|
|
6
|
+
from sweb_api.api.vps import (
|
|
7
|
+
VPSAPI, VPSBackupAPI, VPSSSLAPI, VPSIPAPI, VPSProtectedIPAPI,
|
|
8
|
+
VPSDBaaSAPI, VPSBalancerAPI, VPSRemoteBackupAPI, VPSMonitoringAPI,
|
|
9
|
+
VPSMonitoringChecksAPI, VPSMonitoringContactsAPI,
|
|
10
|
+
)
|
|
11
|
+
from sweb_api.api.pay import PayAPI
|
sweb_api/api/base.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from typing import Any, Optional
|
|
2
|
+
from sweb_api.http.client import JSONRPCClient
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class BaseAPI:
|
|
6
|
+
def __init__(self, client: JSONRPCClient, endpoint: str):
|
|
7
|
+
self._client = client
|
|
8
|
+
self._endpoint = endpoint
|
|
9
|
+
|
|
10
|
+
def _call(self, method: str, params: Optional[dict] = None) -> Any:
|
|
11
|
+
full_method = f"{self._endpoint}/{method}" if self._endpoint else method
|
|
12
|
+
return self._client.call(full_method, params)
|
|
13
|
+
|
|
14
|
+
def index(self, params: Optional[dict] = None) -> Any:
|
|
15
|
+
return self._call("index", params)
|
sweb_api/api/domains.py
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
from typing import Any, Optional
|
|
2
|
+
from sweb_api.api.base import BaseAPI
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class DomainsAPI(BaseAPI):
|
|
6
|
+
def get_subdomains(self, domain: str) -> Any:
|
|
7
|
+
return self._call("getSubdomains", {"domain": domain})
|
|
8
|
+
|
|
9
|
+
def get_domain_info(self, domain: str) -> Any:
|
|
10
|
+
return self._call("getDomainInfo", {"domain": domain})
|
|
11
|
+
|
|
12
|
+
def reg_available(self, domain: str, pay_type: str = "balance") -> int:
|
|
13
|
+
return self._call("regAvailable", {"domain": domain, "payType": pay_type})
|
|
14
|
+
|
|
15
|
+
def get_available_packages(self, domains: str) -> Any:
|
|
16
|
+
return self._call("getAvailablePackages", {"domains": domains})
|
|
17
|
+
|
|
18
|
+
def reg_list(self, domains: str) -> int:
|
|
19
|
+
return self._call("regList", {"domains": domains})
|
|
20
|
+
|
|
21
|
+
def reg(
|
|
22
|
+
self,
|
|
23
|
+
domain: str,
|
|
24
|
+
pay_type: str = "balance",
|
|
25
|
+
dom_person: Optional[int] = None,
|
|
26
|
+
prolong_type: Optional[str] = None,
|
|
27
|
+
auto_reg: Optional[int] = None,
|
|
28
|
+
dir: Optional[str] = None,
|
|
29
|
+
id_shield: Optional[bool] = None,
|
|
30
|
+
) -> int:
|
|
31
|
+
params = {"domain": domain, "payType": pay_type}
|
|
32
|
+
if dom_person is not None:
|
|
33
|
+
params["domPerson"] = dom_person
|
|
34
|
+
if prolong_type is not None:
|
|
35
|
+
params["prolongType"] = prolong_type
|
|
36
|
+
if auto_reg is not None:
|
|
37
|
+
params["autoReg"] = auto_reg
|
|
38
|
+
if dir is not None:
|
|
39
|
+
params["dir"] = dir
|
|
40
|
+
if id_shield is not None:
|
|
41
|
+
params["idShield"] = id_shield
|
|
42
|
+
return self._call("reg", params)
|
|
43
|
+
|
|
44
|
+
def move(
|
|
45
|
+
self,
|
|
46
|
+
domain: str,
|
|
47
|
+
prolong_type: Optional[str] = None,
|
|
48
|
+
dir: Optional[str] = None,
|
|
49
|
+
) -> Any:
|
|
50
|
+
params = {"domain": domain}
|
|
51
|
+
if prolong_type is not None:
|
|
52
|
+
params["prolongType"] = prolong_type
|
|
53
|
+
if dir is not None:
|
|
54
|
+
params["dir"] = dir
|
|
55
|
+
return self._call("move", params)
|
|
56
|
+
|
|
57
|
+
def move_list(self, domains: list) -> Any:
|
|
58
|
+
return self._call("moveList", {"domains": domains})
|
|
59
|
+
|
|
60
|
+
def change_prolong(self, domain: str, prolong_type: str) -> int:
|
|
61
|
+
return self._call("changeProlong", {"domain": domain, "prolongType": prolong_type})
|
|
62
|
+
|
|
63
|
+
def change_prolong_list(self, domains: list) -> int:
|
|
64
|
+
return self._call("changeProlongList", {"domains": domains})
|
|
65
|
+
|
|
66
|
+
def remove(self, domain: str) -> int:
|
|
67
|
+
return self._call("remove", {"domain": domain})
|
|
68
|
+
|
|
69
|
+
def remove_list(self, domains: str) -> int:
|
|
70
|
+
return self._call("removeList", {"domains": domains})
|
|
71
|
+
|
|
72
|
+
def prolong(self, domain: str, pay_type: str = "balance") -> int:
|
|
73
|
+
return self._call("prolong", {"domain": domain, "payType": pay_type})
|
|
74
|
+
|
|
75
|
+
def prolong_list(self, domains: str) -> Any:
|
|
76
|
+
return self._call("prolongList", {"domains": domains})
|
|
77
|
+
|
|
78
|
+
def price_for_transfer(self, domain: str) -> int:
|
|
79
|
+
return self._call("priceForTrasfer", {"domain": domain})
|
|
80
|
+
|
|
81
|
+
def price_for_registration(self, domain: str) -> str:
|
|
82
|
+
return self._call("priceForRegistration", {"domain": domain})
|
|
83
|
+
|
|
84
|
+
def remove_subdomain(self, domain: str, machine: str) -> int:
|
|
85
|
+
return self._call("removeSubdomain", {"domain": domain, "machine": machine})
|
|
86
|
+
|
|
87
|
+
def create_subdomain(self, domain: str, machine: str, dir: str) -> int:
|
|
88
|
+
return self._call("createSubdomain", {"domain": domain, "machine": machine, "dir": dir})
|
|
89
|
+
|
|
90
|
+
def set_redirect_vh(self, domain: str, redirect: str) -> int:
|
|
91
|
+
return self._call("setRedirectVh", {"domain": domain, "redirect": redirect})
|
|
92
|
+
|
|
93
|
+
def get_redirect_vh(self, domain: str) -> Any:
|
|
94
|
+
return self._call("getRedirectVh", {"domain": domain})
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class DomainsBonusAPI(BaseAPI):
|
|
98
|
+
def get_list(self) -> Any:
|
|
99
|
+
return self._call("getList")
|
|
100
|
+
|
|
101
|
+
def buy(self, bonus_id: int) -> int:
|
|
102
|
+
return self._call("buy", {"bonusId": bonus_id})
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class DomainsPersonsAPI(BaseAPI):
|
|
106
|
+
def get_info(self, id: int) -> Any:
|
|
107
|
+
return self._call("getinfo", {"id": id})
|
|
108
|
+
|
|
109
|
+
def create_fiz_ip(
|
|
110
|
+
self,
|
|
111
|
+
name: str,
|
|
112
|
+
resident: bool,
|
|
113
|
+
phones: str,
|
|
114
|
+
emails: str,
|
|
115
|
+
post_index: str,
|
|
116
|
+
post_city: str,
|
|
117
|
+
post_address: str,
|
|
118
|
+
birthdate: str,
|
|
119
|
+
pass_series: str,
|
|
120
|
+
pass_num: str,
|
|
121
|
+
pass_date: str,
|
|
122
|
+
pass_org: str,
|
|
123
|
+
inn: Optional[str] = None,
|
|
124
|
+
id: Optional[int] = None,
|
|
125
|
+
) -> int:
|
|
126
|
+
params = {
|
|
127
|
+
"name": name,
|
|
128
|
+
"resident": resident,
|
|
129
|
+
"phones": phones,
|
|
130
|
+
"emails": emails,
|
|
131
|
+
"postIndex": post_index,
|
|
132
|
+
"postCity": post_city,
|
|
133
|
+
"postAddress": post_address,
|
|
134
|
+
"birthdate": birthdate,
|
|
135
|
+
"passSeries": pass_series,
|
|
136
|
+
"passNum": pass_num,
|
|
137
|
+
"passDate": pass_date,
|
|
138
|
+
"passOrg": pass_org,
|
|
139
|
+
}
|
|
140
|
+
if inn is not None:
|
|
141
|
+
params["inn"] = inn
|
|
142
|
+
if id is not None:
|
|
143
|
+
params["id"] = id
|
|
144
|
+
return self._call("createFizIp", params)
|
|
145
|
+
|
|
146
|
+
def create_jur(
|
|
147
|
+
self,
|
|
148
|
+
name: str,
|
|
149
|
+
name_trans: str,
|
|
150
|
+
resident: bool,
|
|
151
|
+
phones1: str,
|
|
152
|
+
emails: str,
|
|
153
|
+
post_index: str,
|
|
154
|
+
post_city: str,
|
|
155
|
+
post_address: str,
|
|
156
|
+
jur_index: str,
|
|
157
|
+
jur_city: str,
|
|
158
|
+
jur_address: str,
|
|
159
|
+
inn: str,
|
|
160
|
+
pers_name: str,
|
|
161
|
+
phones2: Optional[str] = None,
|
|
162
|
+
faxes: Optional[str] = None,
|
|
163
|
+
kpp: Optional[str] = None,
|
|
164
|
+
) -> int:
|
|
165
|
+
params = {
|
|
166
|
+
"name": name,
|
|
167
|
+
"nameTrans": name_trans,
|
|
168
|
+
"resident": resident,
|
|
169
|
+
"phones1": phones1,
|
|
170
|
+
"emails": emails,
|
|
171
|
+
"postIndex": post_index,
|
|
172
|
+
"postCity": post_city,
|
|
173
|
+
"postAddress": post_address,
|
|
174
|
+
"jurIndex": jur_index,
|
|
175
|
+
"jurCity": jur_city,
|
|
176
|
+
"jurAddress": jur_address,
|
|
177
|
+
"inn": inn,
|
|
178
|
+
"persName": pers_name,
|
|
179
|
+
}
|
|
180
|
+
if phones2 is not None:
|
|
181
|
+
params["phones2"] = phones2
|
|
182
|
+
if faxes is not None:
|
|
183
|
+
params["faxes"] = faxes
|
|
184
|
+
if kpp is not None:
|
|
185
|
+
params["kpp"] = kpp
|
|
186
|
+
return self._call("createJur", params)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
class DomainsDNSAPI(BaseAPI):
|
|
190
|
+
def info(self, domain: str) -> Any:
|
|
191
|
+
return self._call("info", {"domain": domain})
|
|
192
|
+
|
|
193
|
+
def edit_mx(
|
|
194
|
+
self,
|
|
195
|
+
domain: str,
|
|
196
|
+
action: str,
|
|
197
|
+
index: int,
|
|
198
|
+
priority: int,
|
|
199
|
+
value: str,
|
|
200
|
+
sub_domain: Optional[str] = None,
|
|
201
|
+
) -> int:
|
|
202
|
+
params = {
|
|
203
|
+
"domain": domain,
|
|
204
|
+
"action": action,
|
|
205
|
+
"index": index,
|
|
206
|
+
"priority": priority,
|
|
207
|
+
"value": value,
|
|
208
|
+
}
|
|
209
|
+
if sub_domain is not None:
|
|
210
|
+
params["subDomain"] = sub_domain
|
|
211
|
+
return self._call("editMx", params)
|
|
212
|
+
|
|
213
|
+
def edit_srv(
|
|
214
|
+
self,
|
|
215
|
+
domain: str,
|
|
216
|
+
action: str,
|
|
217
|
+
index: int,
|
|
218
|
+
priority: int,
|
|
219
|
+
ttl: int,
|
|
220
|
+
weight: int,
|
|
221
|
+
target: str,
|
|
222
|
+
service: str,
|
|
223
|
+
protocol: str,
|
|
224
|
+
port: int,
|
|
225
|
+
sub_domain: Optional[str] = None,
|
|
226
|
+
) -> bool:
|
|
227
|
+
params = {
|
|
228
|
+
"domain": domain,
|
|
229
|
+
"action": action,
|
|
230
|
+
"index": index,
|
|
231
|
+
"priority": priority,
|
|
232
|
+
"ttl": ttl,
|
|
233
|
+
"weight": weight,
|
|
234
|
+
"target": target,
|
|
235
|
+
"service": service,
|
|
236
|
+
"protocol": protocol,
|
|
237
|
+
"port": port,
|
|
238
|
+
}
|
|
239
|
+
if sub_domain is not None:
|
|
240
|
+
params["subDomain"] = sub_domain
|
|
241
|
+
return self._call("editSrv", params)
|
|
242
|
+
|
|
243
|
+
def edit_ns(
|
|
244
|
+
self,
|
|
245
|
+
domain: str,
|
|
246
|
+
action: str,
|
|
247
|
+
index: int,
|
|
248
|
+
sub_domain: Optional[str] = None,
|
|
249
|
+
value: Optional[str] = None,
|
|
250
|
+
) -> bool:
|
|
251
|
+
params = {"domain": domain, "action": action, "index": index}
|
|
252
|
+
if sub_domain is not None:
|
|
253
|
+
params["subDomain"] = sub_domain
|
|
254
|
+
if value is not None:
|
|
255
|
+
params["value"] = value
|
|
256
|
+
return self._call("editNS", params)
|
|
257
|
+
|
|
258
|
+
def edit_txt(
|
|
259
|
+
self,
|
|
260
|
+
domain: str,
|
|
261
|
+
action: str,
|
|
262
|
+
index: int,
|
|
263
|
+
sub_domain: Optional[str] = None,
|
|
264
|
+
value: Optional[str] = None,
|
|
265
|
+
) -> bool:
|
|
266
|
+
params = {"domain": domain, "action": action, "index": index}
|
|
267
|
+
if sub_domain is not None:
|
|
268
|
+
params["subDomain"] = sub_domain
|
|
269
|
+
if value is not None:
|
|
270
|
+
params["value"] = value
|
|
271
|
+
return self._call("editTxt", params)
|
|
272
|
+
|
|
273
|
+
def get_file(self, domain: str) -> Any:
|
|
274
|
+
return self._call("getFile", {"domain": domain})
|
sweb_api/api/pay.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
from sweb_api.api.base import BaseAPI
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class PayAPI(BaseAPI):
|
|
6
|
+
def is_autopayment_enable(self) -> Any:
|
|
7
|
+
return self._call("isAutopaymentEnable")
|
|
8
|
+
|
|
9
|
+
def get_pay_recommendations(self, add_balance_recommendations: bool = False) -> Any:
|
|
10
|
+
return self._call("getPayRecommendations", {"addBalanceRecommendations": add_balance_recommendations})
|
|
11
|
+
|
|
12
|
+
def get_recommendation_total_cost(self) -> int:
|
|
13
|
+
return self._call("getRecommendationTotalCost")
|
|
14
|
+
|
|
15
|
+
def get_upcoming_payments_vh(self) -> Any:
|
|
16
|
+
return self._call("getUpcomingPaymentsVh")
|
|
17
|
+
|
|
18
|
+
def change_deferment(self, turn_on: bool) -> int:
|
|
19
|
+
return self._call("changeDeferment", {"turnOn": turn_on})
|
|
20
|
+
|
|
21
|
+
def get_remains_date(self) -> str:
|
|
22
|
+
return self._call("getRemainsDate")
|
|
23
|
+
|
|
24
|
+
def get_remains_days(self) -> int:
|
|
25
|
+
return self._call("getRemainsDays")
|
|
26
|
+
|
|
27
|
+
def get_balance(self) -> Any:
|
|
28
|
+
return self._call("getBalance")
|
|
29
|
+
|
|
30
|
+
def get_active_reserves(self) -> Any:
|
|
31
|
+
return self._call("getActiveReserves")
|