8000 [Librarian] Regenerated @ 1a14b4b899a456500bb88dcccf4f97602c6b31d6 · DataXujing/twilio-python@dd23536 · GitHub
[go: up one dir, main page]

Skip to content

Commit dd23536

Browse files
committed
[Librarian] Regenerated @ 1a14b4b899a456500bb88dcccf4f97602c6b31d6
1 parent 3a7e153 commit dd23536

File tree

27 files changed

+446
-161
lines changed

27 files changed

+446
-161
lines changed

CHANGES.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,21 @@ twilio-python Changelog
33

44
Here you can see the full list of changes between each twilio-python release.
55

6+
[2018-10-29] Version 6.19.2
7+
----------------------------
8+
**Api**
9+
- Add new Balance resource:
10+
- url: '/v1/Accounts/{account sid}/Balance'
11+
- supported methods: GET
12+
- returns the balance of the account
13+
14+
**Proxy**
15+
- Add chat_instance_sid to Service
16+
17+
**Verify**
18+
- Add `Locale` optional parameter on Verification creation.
19+
20+
621
[2018-10-15] Version 6.19.1
722
----------------------------
823
**Api**
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# coding=utf-8
2+
"""
3+
This code was generated by
4+
\ / _ _ _| _ _
5+
| (_)\/(_)(_|\/| |(/_ v1.0.0
6+
/ /
7+
"""
8+
9+
from tests import IntegrationTestCase
10+
from tests.holodeck import Request
11+
from twilio.base.exceptions import TwilioException
12+
from twilio.http.response import Response
13+
14+
15+
class BalanceTestCase(IntegrationTestCase):
16+
17+
def test_fetch_request(self):
18+
self.holodeck.mock(Response(500, ''))
19+
20+
with self.assertRaises(TwilioException):
21+
self.client.api.v2010.accounts(sid="ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \
22+
.balance.fetch()
23+
24+
self.holodeck.assert_has_request(Request(
25+
'get',
26+
'https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Balance.json',
27+
))
28+
29+
def test_fetch_response(self):
30+
self.holodeck.mock(Response(
31+
200,
32+
'''
33+
{
34+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
35+
"balance": "0.05",
36+
"currency": "USD"
37+
}
38+
'''
39+
))
40+
41+
actual = self.client.api.v2010.accounts(sid="ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \
42+
.balance.fetch()
43+
44+
self.assertIsNotNone(actual)

tests/integration/api/v2010/test_account.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ def test_create_response(self):
5656
"applications": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Applications.json",
5757
"short_codes": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SMS/ShortCodes.json",
5858
"queues": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queues.json",
59-
"messages": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages.json"
59+
"messages": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages.json",
60+
"balance": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Balance.json"
6061
},
6162
"type": "Full",
6263
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"
@@ -110,7 +111,8 @@ def test_fetch_response(self):
110111
"applications": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Applications.json",
111112
"short_codes": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SMS/ShortCodes.json",
112113
"queues": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queues.json",
113-
"messages": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages.json"
114+
"messages": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages.json",
115+
"balance": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Balance.json"
114116
},
115117
"type": "Full",
116118
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"
@@ -191,7 +193,8 @@ def test_read_full_response(self):
191193
"applications": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Applications.json",
192194
"short_codes": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/SMS/ShortCodes.json",
193195
"queues": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queues.json",
194-
"messages": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages.json"
196+
"messages": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages.json",
197+
"balance": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Balance.json"
195198
},
196199
"type": "Full",
197200
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"

tests/integration/proxy/v1/test_service.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def test_fetch_response(self):
3232
{
3333
"sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3434
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
35+
"chat_instance_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
3536
"unique_name": "unique_name",
3637
"default_ttl": 3600,
3738
"callback_url": "http://www.example.com",
@@ -110,6 +111,7 @@ def test_create_response(self):
110111
{
111112
"sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
112113
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
114+
"chat_instance_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
113115
"unique_name": "unique_name",
114116
"default_ttl": 3600,
115117
"callback_url": "http://www.example.com",
@@ -172,6 +174,7 @@ def test_update_response(self):
172174
{
173175
"sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
174176
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
177+
"chat_instance_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
175178
"unique_name": "unique_name",
176179
"default_ttl": 3600,
177180
"callback_url": "http://www.example.com",

twilio/rest/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,13 @@ def available_phone_numbers(self):
440440
"""
441441
return self.api.account.available_phone_numbers
442442

443+
@property
444+
def balance(self):
445+
"""
446+
:rtype: twilio.rest.api.v2010.account.balance.BalanceList
447+
"""
448+
return self.api.account.balance
449+
443450
@property
444451
def calls(self):
445452
"""

twilio/rest/api/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ def available_phone_numbers(self):
7979
"""
8080
return self.account.available_phone_numbers
8181

82+
@property
83+
def balance(self):
84+
"""
85+
:rtype: twilio.rest.api.v2010.account.balance.BalanceList
86+
"""
87+
retu F438 rn self.account.balance
88+
8289
@property
8390
def calls(self):
8491
"""

twilio/rest/api/v2010/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ def available_phone_numbers(self):
8181
"""
8282
return self.account.available_phone_numbers
8383

84+
@property
85+
def balance(self):
86+
"""
87+
:rtype: twilio.rest.api.v2010.account.balance.BalanceList
88+
"""
89+
return self.account.balance
90+
8491
@property
8592
def calls(self):
8693
"""

twilio/rest/api/v2010/account/__init__.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from twilio.rest.api.v2010.account.application import ApplicationList
1717
from twilio.rest.api.v2010.account.authorized_connect_app import AuthorizedConnectAppList
1818
from twilio.rest.api.v2010.account.available_phone_number import AvailablePhoneNumberCountryList
19+
from twilio.rest.api.v2010.account.balance import BalanceList
1920
from twilio.rest.api.v2010.account.call import CallList
2021
from twilio.rest.api.v2010.account.conference import ConferenceList
2122
from twilio.rest.api.v2010.account.connect_app import ConnectAppList
@@ -270,6 +271,7 @@ def __init__(self, version, sid):
270271
self._applications = None
271272
self._authorized_connect_apps = None
272273
self._available_phone_numbers = None
274+
self._balance = None
273275
self._calls = None
274276
self._conferences = None
275277
self._connect_apps = None
@@ -381,6 +383,18 @@ def available_phone_numbers(self):
381383
)
382384
return self._available_phone_numbers
383385

386+
@property
387+
def balance(self):
388+
"""
389+
Access the balance
390+
391+
:returns: twilio.rest.api.v2010.account.balance.BalanceList
392+
:rtype: twilio.rest.api.v2010.account.balance.BalanceList
393+
"""
394+
if self._balance is None:
395+
self._balance = BalanceList(self._version, account_sid=self._solution['sid'], )
396+
return self._balance
397+
384398
@property
385399
def calls(self):
386400
"""
@@ -816,6 +830,16 @@ def available_phone_numbers(self):
816830
"""
817831
return self._proxy.available_phone_numbers
818832

833+
@property
834+
def balance(self):
835+
"""
836+
Access the balance
837+
838+
:returns: twilio.rest.api.v2010.account.balance.BalanceList
839+
:rtype: twilio.rest.api.v2010.account.balance.BalanceList
840+
"""
841+
return self._proxy.balance
842+
819843
@property
820844
def calls(self):
821845
"""
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
# coding=utf-8
2+
"""
3+
This code was generated by
4+
\ / _ _ _| _ _
5+
| (_)\/(_)(_|\/| |(/_ v1.0.0
6+
/ /
7+
"""
8+
9+
from twilio.base import values
10+
from twilio.base.instance_resource import InstanceResource
11+
from twilio.base.list_resource import ListResource
12+
from twilio.base.page import Page
13+
14+
15+
class BalanceList(ListResource):
16+
""" """
17+
18+
def __init__(self, version, account_sid):
19+
"""
20+
Initialize the BalanceList
21+
22+
:param Version version: Version that contains the resource
23+
:param account_sid: Account Sid.
24+
25+
:returns: twilio.rest.api.v2010.account.balance.BalanceList
26+
:rtype: twilio.rest.api.v2010.account.balance.BalanceList
27+
"""
28+
super(BalanceList, self).__init__(version)
29+
30+
# Path Solution
31+
self._solution = {'account_sid': account_sid, }
32+
self._uri = '/Accounts/{account_sid}/Balance.json'.format(**self._solution)
33+
34+
def fetch(self):
35+
"""
36+
Fetch a BalanceInstance
37+
38+
:returns: Fetched BalanceInstance
39+
:rtype: twilio.rest.api.v2010.account.balance.BalanceInstance
40+
"""
41+
params = values.of({})
42+
43+
payload = self._version.fetch(
44+
'GET',
45+
self._uri,
46+
params=params,
47+
)
48+
49+
return BalanceInstance(self._version, payload, account_sid=self._solution['account_sid'], )
50+
51+
def __repr__(self):
52+
"""
53+
Provide a friendly representation
54+
55+
:returns: Machine friendly representation
56+
:rtype: str
57+
"""
58+
return '<Twilio.Api.V2010.BalanceList>'
59+
60+
61+
class BalancePage(Page):
62+
""" """
63+
64+
def __init__(self, version, response, solution):
65+
"""
66+
Initialize the BalancePage
67+
68+
:param Version version: Version that contains the resource
69+
:param Response response: Response from the API
70+
:param account_sid: Account Sid.
71+
72+
:returns: twilio.rest.api.v2010.account.balance.BalancePage
73+
:rtype: twilio.rest.api.v2010.account.balance.BalancePage
74+
"""
75+
super(BalancePage, self).__init__(version, response)
76+
77+
# Path Solution
78+
self._solution = solution
79+
80+
def get_instance(self, payload):
81+
"""
82+
Build an instance of BalanceInstance
83+
84+
:param dict payload: Payload response from the API
85+
86+
:returns: twilio.rest.api.v2010.account.balance.BalanceInstance
87+
:rtype: twilio.rest.api.v2010.account.balance.BalanceInstance
88+
"""
89+
return BalanceInstance(self._version, payload, account_sid=self._solution['account_sid'], )
90+
91+
def __repr__(self):
92+
"""
93+
Provide a friendly representation
94+
95+
:returns: Machine friendly representation
96+
:rtype: str
97+
"""
98+
return '<Twilio.Api.V2010.BalancePage>'
99+
100+
101+
class BalanceInstance(InstanceResource):
102+
""" """
103+
104+
def __init__(self, version, payload, account_sid):
105+
"""
106+
Initialize the BalanceInstance
107+
108+
:returns: twilio.rest.api.v2010.account.balance.BalanceInstance
109+
:rtype: twilio.rest.api.v2010.account.balance.BalanceInstance
110+
"""
111+
super(BalanceInstance, self).__init__(version)
112+
113+
# Marshaled Properties
114+
self._properties = {
115+
'account_sid': payload['account_sid'],
116+
'balance': payload['balance'],
117+
'currency': payload['currency'],
118+
}
119+
120+
# Context
121+
self._context = None
122+
self._solution = {'account_sid': account_sid, }
123+
124+
@property
125+
def account_sid(self):
126+
"""
127+
:returns: Account Sid.
128+
:rtype: unicode
129+
"""
130+
return self._properties['account_sid']
131+
132+
@property
133+
def balance(self):
134+
"""
135+
:returns: Account balance
136+
:rtype: unicode
137+
"""
138+
return self._properties['balance']
139+
140+
@property
141+
def currency(self):
142+
"""
143+
:returns: Currency units
144+
:rtype: unicode
145+
"""
146+
return self._properties['currency']
147+
148+
def __repr__(self):
149+
"""
150+
Provide a friendly representation
151+
152+
:returns: Machine friendly representation
153+
:rtype: str
154+
"""
155+
return '<Twilio.Api.V2010.BalanceInstance>'

twilio/rest/authy/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,18 @@ def v1(self):
3737
return self._v1
3838

3939
@property
40-
def services(self):
40+
def forms(self):
4141
"""
42-
:rtype: twilio.rest.authy.v1.service.ServiceList
42+
:rtype: twilio.rest.authy.v1.form.FormList
4343
"""
44-
return self.v1.services
44+
return self.v1.forms
4545

4646
@property
47-
def forms(self):
47+
def services(self):
4848
"""
49-
:rtype: twilio.rest.authy.v1.form.FormList
49+
:rtype: twilio.rest.authy.v1.service.ServiceList
5050
"""
51-
return self.v1.forms
51+
return self.v1.services
5252

5353
def __repr__(self):
5454
"""

0 commit comments

Comments
 (0)
0