Skip to content

Commit b30004b

Browse files
chore: preview changes by twiml gather
1 parent 523612f commit b30004b

File tree

2 files changed

+266
-0
lines changed

2 files changed

+266
-0
lines changed

twilio/rest/iam/v1/key.py

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
r"""
2+
This code was generated by
3+
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4+
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5+
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6+
7+
Twilio - Iam
8+
This is the public Twilio REST API.
9+
10+
NOTE: This class is auto generated by OpenAPI Generator.
11+
https://openapi-generator.tech
12+
Do not edit the class manually.
13+
"""
14+
15+
from datetime import datetime
16+
from typing import Any, Dict, Optional, Union
17+
from twilio.base import deserialize, serialize, values
18+
19+
from twilio.base.instance_resource import InstanceResource
20+
from twilio.base.list_resource import ListResource
21+
from twilio.base.version import Version
22+
23+
24+
class KeyInstance(InstanceResource):
25+
26+
class Keytype(object):
27+
RESTRICTED = "restricted"
28+
29+
"""
30+
:ivar sid: The unique string that that we created to identify the NewKey resource. You will use this as the basic-auth `user` when authenticating to the API.
31+
:ivar friendly_name: The string that you assigned to describe the resource.
32+
:ivar date_created: The date and time in GMT that the API Key was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
33+
:ivar date_updated: The date and time in GMT that the new API Key was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
34+
:ivar secret: The secret your application uses to sign Access Tokens and to authenticate to the REST API (you will use this as the basic-auth `password`). **Note that for security reasons, this field is ONLY returned when the API Key is first created.**
35+
:ivar policy: Collection of allow assertions.
36+
"""
37+
38+
def __init__(self, version: Version, payload: Dict[str, Any]):
39+
super().__init__(version)
40+
41+
self.sid: Optional[str] = payload.get("sid")
42+
self.friendly_name: Optional[str] = payload.get("friendly_name")
43+
self.date_created: Optional[datetime] = deserialize.rfc2822_datetime(
44+
payload.get("date_created")
45+
)
46+
self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime(
47+
payload.get("date_updated")
48+
)
49+
self.secret: Optional[str] = payload.get("secret")
50+
self.policy: Optional[Dict[str, object]] = payload.get("policy")
51+
52+
def __repr__(self) -> str:
53+
"""
54+
Provide a friendly representation
55+
56+
:returns: Machine friendly representation
57+
"""
58+
59+
return "<Twilio.Iam.V1.KeyInstance>"
60+
61+
62+
class KeyList(ListResource):
63+
64+
def __init__(self, version: Version):
65+
"""
66+
Initialize the KeyList
67+
68+
:param version: Version that contains the resource
69+
70+
"""
71+
super().__init__(version)
72+
73+
self._uri = "/Keys"
74+
75+
def create(
76+
self,
77+
account_sid: str,
78+
friendly_name: Union[str, object] = values.unset,
79+
key_type: Union["KeyInstance.Keytype", object] = values.unset,
80+
policy: Union[object, object] = values.unset,
81+
) -> KeyInstance:
82+
"""
83+
Create the KeyInstance
84+
85+
:param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource.
86+
:param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long.
87+
:param key_type:
88+
:param policy: The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys).
89+
90+
:returns: The created KeyInstance
91+
"""
92+
93+
data = values.of(
94+
{
95+
"AccountSid": account_sid,
96+
"FriendlyName": friendly_name,
97+
"KeyType": key_type,
98+
"Policy": serialize.object(policy),
99+
}
100+
)
101+
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})
102+
103+
headers["Content-Type"] = "application/x-www-form-urlencoded"
104+
105+
headers["Accept"] = "application/json"
106+
107+
payload = self._version.create(
108+
method="POST", uri=self._uri, data=data, headers=headers
109+
)
110+
111+
return KeyInstance(self._version, payload)
112+
113+
async def create_async(
114+
self,
115+
account_sid: str,
116+
friendly_name: Union[str, object] = values.unset,
117+
key_type: Union["KeyInstance.Keytype", object] = values.unset,
118+
policy: Union[object, object] = values.unset,
119+
) -> KeyInstance:
120+
"""
121+
Asynchronously create the KeyInstance
122+
123+
:param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource.
124+
:param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long.
125+
:param key_type:
126+
:param policy: The \\\\`Policy\\\\` object is a collection that specifies the allowed Twilio permissions for the restricted key. For more information on the permissions available with restricted API keys, refer to the [Twilio documentation](https://www.twilio.com/docs/iam/api-keys/restricted-api-keys#permissions-available-with-restricted-api-keys).
127+
128+
:returns: The created KeyInstance
129+
"""
130+
131+
data = values.of(
132+
{
133+
"AccountSid": account_sid,
134+
"FriendlyName": friendly_name,
135+
"KeyType": key_type,
136+
"Policy": serialize.object(policy),
137+
}
138+
)
139+
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})
140+
141+
headers["Content-Type"] = "application/x-www-form-urlencoded"
142+
143+
headers["Accept"] = "application/json"
144+
145+
payload = await self._version.create_async(
146+
method="POST", uri=self._uri, data=data, headers=headers
147+
)
148+
149+
return KeyInstance(self._version, payload)
150+
151+
def __repr__(self) -> str:
152+
"""
153+
Provide a friendly representation
154+
155+
:returns: Machine friendly representation
156+
"""
157+
return "<Twilio.Iam.V1.KeyList>"

twilio/rest/numbers/v1/webhook.py

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
r"""
2+
This code was generated by
3+
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4+
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5+
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6+
7+
Twilio - Numbers
8+
This is the public Twilio REST API.
9+
10+
NOTE: This class is auto generated by OpenAPI Generator.
11+
https://openapi-generator.tech
12+
Do not edit the class manually.
13+
"""
14+
15+
from datetime import datetime
16+
from typing import Any, Dict, List, Optional
17+
from twilio.base import deserialize, values
18+
19+
from twilio.base.instance_resource import InstanceResource
20+
from twilio.base.list_resource import ListResource
21+
from twilio.base.version import Version
22+
23+
24+
class WebhookInstance(InstanceResource):
25+
"""
26+
:ivar url: The URL of the webhook configuration request
27+
:ivar port_in_target_url: The complete webhook url that will be called when a notification event for port in request or port in phone number happens
28+
:ivar port_out_target_url: The complete webhook url that will be called when a notification event for a port out phone number happens.
29+
:ivar notifications_of: A list to filter what notification events to receive for this account and its sub accounts. If it is an empty list, then it means that there are no filters for the notifications events to send in each webhook and all events will get sent.
30+
:ivar port_in_target_date_created: Creation date for the port in webhook configuration
31+
:ivar port_out_target_date_created: Creation date for the port out webhook configuration
32+
"""
33+
34+
def __init__(self, version: Version, payload: Dict[str, Any]):
35+
super().__init__(version)
36+
37+
self.url: Optional[str] = payload.get("url")
38+
self.port_in_target_url: Optional[str] = payload.get("port_in_target_url")
39+
self.port_out_target_url: Optional[str] = payload.get("port_out_target_url")
40+
self.notifications_of: Optional[List[str]] = payload.get("notifications_of")
41+
self.port_in_target_date_created: Optional[datetime] = (
42+
deserialize.iso8601_datetime(payload.get("port_in_target_date_created"))
43+
)
44+
self.port_out_target_date_created: Optional[datetime] = (
45+
deserialize.iso8601_datetime(payload.get("port_out_target_date_created"))
46+
)
47+
48+
def __repr__(self) -> str:
49+
"""
50+
Provide a friendly representation
51+
52+
:returns: Machine friendly representation
53+
"""
54+
55+
return "<Twilio.Numbers.V1.WebhookInstance>"
56+
57+
58+
class WebhookList(ListResource):
59+
60+
def __init__(self, version: Version):
61+
"""
62+
Initialize the WebhookList
63+
64+
:param version: Version that contains the resource
65+
66+
"""
67+
super().__init__(version)
68+
69+
self._uri = "/Porting/Configuration/Webhook"
70+
71+
def fetch(self) -> WebhookInstance:
72+
"""
73+
Asynchronously fetch the WebhookInstance
74+
75+
76+
:returns: The fetched WebhookInstance
77+
"""
78+
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})
79+
80+
headers["Accept"] = "application/json"
81+
82+
payload = self._version.fetch(method="GET", uri=self._uri, headers=headers)
83+
84+
return WebhookInstance(self._version, payload)
85+
86+
async def fetch_async(self) -> WebhookInstance:
87+
"""
88+
Asynchronously fetch the WebhookInstance
89+
90+
91+
:returns: The fetched WebhookInstance
92+
"""
93+
headers = values.of({"Content-Type": "application/x-www-form-urlencoded"})
94+
95+
headers["Accept"] = "application/json"
96+
97+
payload = await self._version.fetch_async(
98+
method="GET", uri=self._uri, headers=headers
99+
)
100+
101+
return WebhookInstance(self._version, payload)
102+
103+
def __repr__(self) -> str:
104+
"""
105+
Provide a friendly representation
106+
107+
:returns: Machine friendly representation
108+
"""
109+
return "<Twilio.Numbers.V1.WebhookList>"

0 commit comments

Comments
 (0)