Initial commit: Email alerts application
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from twilio.base.domain import Domain
|
||||
from twilio.rest import Client
|
||||
from twilio.rest.numbers.v1 import V1
|
||||
from twilio.rest.numbers.v2 import V2
|
||||
|
||||
|
||||
class NumbersBase(Domain):
|
||||
def __init__(self, twilio: Client):
|
||||
"""
|
||||
Initialize the Numbers Domain
|
||||
|
||||
:returns: Domain for Numbers
|
||||
"""
|
||||
super().__init__(twilio, "https://numbers.twilio.com")
|
||||
self._v1: Optional[V1] = None
|
||||
self._v2: Optional[V2] = None
|
||||
|
||||
@property
|
||||
def v1(self) -> V1:
|
||||
"""
|
||||
:returns: Versions v1 of Numbers
|
||||
"""
|
||||
if self._v1 is None:
|
||||
self._v1 = V1(self)
|
||||
return self._v1
|
||||
|
||||
@property
|
||||
def v2(self) -> V2:
|
||||
"""
|
||||
:returns: Versions v2 of Numbers
|
||||
"""
|
||||
if self._v2 is None:
|
||||
self._v2 = V2(self)
|
||||
return self._v2
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers>"
|
||||
@@ -0,0 +1,15 @@
|
||||
from warnings import warn
|
||||
|
||||
from twilio.rest.numbers.NumbersBase import NumbersBase
|
||||
from twilio.rest.numbers.v2.regulatory_compliance import RegulatoryComplianceList
|
||||
|
||||
|
||||
class Numbers(NumbersBase):
|
||||
@property
|
||||
def regulatory_compliance(self) -> RegulatoryComplianceList:
|
||||
warn(
|
||||
"regulatory_compliance is deprecated. Use v2.regulatory_compliance instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v2.regulatory_compliance
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,58 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Numbers
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
from typing import Optional
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.domain import Domain
|
||||
from twilio.rest.numbers.v1.bulk_eligibility import BulkEligibilityList
|
||||
from twilio.rest.numbers.v1.porting_bulk_portability import PortingBulkPortabilityList
|
||||
from twilio.rest.numbers.v1.porting_portability import PortingPortabilityList
|
||||
|
||||
|
||||
class V1(Version):
|
||||
def __init__(self, domain: Domain):
|
||||
"""
|
||||
Initialize the V1 version of Numbers
|
||||
|
||||
:param domain: The Twilio.numbers domain
|
||||
"""
|
||||
super().__init__(domain, "v1")
|
||||
self._bulk_eligibilities: Optional[BulkEligibilityList] = None
|
||||
self._porting_bulk_portabilities: Optional[PortingBulkPortabilityList] = None
|
||||
self._porting_portabilities: Optional[PortingPortabilityList] = None
|
||||
|
||||
@property
|
||||
def bulk_eligibilities(self) -> BulkEligibilityList:
|
||||
if self._bulk_eligibilities is None:
|
||||
self._bulk_eligibilities = BulkEligibilityList(self)
|
||||
return self._bulk_eligibilities
|
||||
|
||||
@property
|
||||
def porting_bulk_portabilities(self) -> PortingBulkPortabilityList:
|
||||
if self._porting_bulk_portabilities is None:
|
||||
self._porting_bulk_portabilities = PortingBulkPortabilityList(self)
|
||||
return self._porting_bulk_portabilities
|
||||
|
||||
@property
|
||||
def porting_portabilities(self) -> PortingPortabilityList:
|
||||
if self._porting_portabilities is None:
|
||||
self._porting_portabilities = PortingPortabilityList(self)
|
||||
return self._porting_portabilities
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V1>"
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,203 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Numbers
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional
|
||||
from twilio.base import deserialize
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
|
||||
|
||||
class BulkEligibilityInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar request_id: The SID of the bulk eligibility check that you want to know about.
|
||||
:ivar url: This is the url of the request that you're trying to reach out to locate the resource.
|
||||
:ivar results: The result set that contains the eligibility check response for each requested number, each result has at least the following attributes: phone_number: The requested phone number ,hosting_account_sid: The account sid where the phone number will be hosted, country: Phone number’s country, eligibility_status: Indicates the eligibility status of the PN (Eligible/Ineligible), eligibility_sub_status: Indicates the sub status of the eligibility , ineligibility_reason: Reason for number's ineligibility (if applicable), next_step: Suggested next step in the hosting process based on the eligibility status.
|
||||
:ivar friendly_name: This is the string that you assigned as a friendly name for describing the eligibility check request.
|
||||
:ivar status: This is the status of the bulk eligibility check request. (Example: COMPLETE, IN_PROGRESS)
|
||||
:ivar date_created:
|
||||
:ivar date_completed:
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
request_id: Optional[str] = None,
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.request_id: Optional[str] = payload.get("request_id")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
self.results: Optional[List[object]] = payload.get("results")
|
||||
self.friendly_name: Optional[str] = payload.get("friendly_name")
|
||||
self.status: Optional[str] = payload.get("status")
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
self.date_completed: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_completed")
|
||||
)
|
||||
|
||||
self._solution = {
|
||||
"request_id": request_id or self.request_id,
|
||||
}
|
||||
self._context: Optional[BulkEligibilityContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "BulkEligibilityContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: BulkEligibilityContext for this BulkEligibilityInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = BulkEligibilityContext(
|
||||
self._version,
|
||||
request_id=self._solution["request_id"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "BulkEligibilityInstance":
|
||||
"""
|
||||
Fetch the BulkEligibilityInstance
|
||||
|
||||
|
||||
:returns: The fetched BulkEligibilityInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "BulkEligibilityInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the BulkEligibilityInstance
|
||||
|
||||
|
||||
:returns: The fetched BulkEligibilityInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V1.BulkEligibilityInstance {}>".format(context)
|
||||
|
||||
|
||||
class BulkEligibilityContext(InstanceContext):
|
||||
def __init__(self, version: Version, request_id: str):
|
||||
"""
|
||||
Initialize the BulkEligibilityContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param request_id: The SID of the bulk eligibility check that you want to know about.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"request_id": request_id,
|
||||
}
|
||||
self._uri = "/HostedNumber/Eligibility/Bulk/{request_id}".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def fetch(self) -> BulkEligibilityInstance:
|
||||
"""
|
||||
Fetch the BulkEligibilityInstance
|
||||
|
||||
|
||||
:returns: The fetched BulkEligibilityInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return BulkEligibilityInstance(
|
||||
self._version,
|
||||
payload,
|
||||
request_id=self._solution["request_id"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> BulkEligibilityInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the BulkEligibilityInstance
|
||||
|
||||
|
||||
:returns: The fetched BulkEligibilityInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return BulkEligibilityInstance(
|
||||
self._version,
|
||||
payload,
|
||||
request_id=self._solution["request_id"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V1.BulkEligibilityContext {}>".format(context)
|
||||
|
||||
|
||||
class BulkEligibilityList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the BulkEligibilityList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
def get(self, request_id: str) -> BulkEligibilityContext:
|
||||
"""
|
||||
Constructs a BulkEligibilityContext
|
||||
|
||||
:param request_id: The SID of the bulk eligibility check that you want to know about.
|
||||
"""
|
||||
return BulkEligibilityContext(self._version, request_id=request_id)
|
||||
|
||||
def __call__(self, request_id: str) -> BulkEligibilityContext:
|
||||
"""
|
||||
Constructs a BulkEligibilityContext
|
||||
|
||||
:param request_id: The SID of the bulk eligibility check that you want to know about.
|
||||
"""
|
||||
return BulkEligibilityContext(self._version, request_id=request_id)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V1.BulkEligibilityList>"
|
||||
@@ -0,0 +1,246 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Numbers
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional
|
||||
from twilio.base import deserialize, serialize, values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
|
||||
|
||||
class PortingBulkPortabilityInstance(InstanceResource):
|
||||
class Status(object):
|
||||
IN_PROGRESS = "in-progress"
|
||||
COMPLETED = "completed"
|
||||
EXPIRED = "expired"
|
||||
|
||||
"""
|
||||
:ivar sid: A 34 character string that uniquely identifies this Portability check.
|
||||
:ivar status:
|
||||
:ivar datetime_created: The date that the Portability check was created, given in ISO 8601 format.
|
||||
:ivar phone_numbers: Contains a list with all the information of the requested phone numbers. Each phone number contains the following properties: `phone_number`: The phone number which portability is to be checked. `portable`: Boolean flag specifying if phone number is portable or not. `not_portable_reason`: Reason why the phone number cannot be ported into Twilio, `null` otherwise. `not_portable_reason_code`: The Portability Reason Code for the phone number if it cannot be ported in Twilio, `null` otherwise. `pin_and_account_number_required`: Boolean flag specifying if PIN and account number is required for the phone number. `number_type`: The type of the requested phone number. `country` Country the phone number belongs to. `messaging_carrier` Current messaging carrier of the phone number. `voice_carrier` Current voice carrier of the phone number.
|
||||
:ivar url: This is the url of the request that you're trying to reach out to locate the resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.status: Optional["PortingBulkPortabilityInstance.Status"] = payload.get(
|
||||
"status"
|
||||
)
|
||||
self.datetime_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("datetime_created")
|
||||
)
|
||||
self.phone_numbers: Optional[List[object]] = payload.get("phone_numbers")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[PortingBulkPortabilityContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "PortingBulkPortabilityContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: PortingBulkPortabilityContext for this PortingBulkPortabilityInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = PortingBulkPortabilityContext(
|
||||
self._version,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "PortingBulkPortabilityInstance":
|
||||
"""
|
||||
Fetch the PortingBulkPortabilityInstance
|
||||
|
||||
|
||||
:returns: The fetched PortingBulkPortabilityInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "PortingBulkPortabilityInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the PortingBulkPortabilityInstance
|
||||
|
||||
|
||||
:returns: The fetched PortingBulkPortabilityInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V1.PortingBulkPortabilityInstance {}>".format(context)
|
||||
|
||||
|
||||
class PortingBulkPortabilityContext(InstanceContext):
|
||||
def __init__(self, version: Version, sid: str):
|
||||
"""
|
||||
Initialize the PortingBulkPortabilityContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param sid: A 34 character string that uniquely identifies the Portability check.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/Porting/Portability/{sid}".format(**self._solution)
|
||||
|
||||
def fetch(self) -> PortingBulkPortabilityInstance:
|
||||
"""
|
||||
Fetch the PortingBulkPortabilityInstance
|
||||
|
||||
|
||||
:returns: The fetched PortingBulkPortabilityInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return PortingBulkPortabilityInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> PortingBulkPortabilityInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the PortingBulkPortabilityInstance
|
||||
|
||||
|
||||
:returns: The fetched PortingBulkPortabilityInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return PortingBulkPortabilityInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V1.PortingBulkPortabilityContext {}>".format(context)
|
||||
|
||||
|
||||
class PortingBulkPortabilityList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the PortingBulkPortabilityList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/Porting/Portability"
|
||||
|
||||
def create(self, phone_numbers: List[str]) -> PortingBulkPortabilityInstance:
|
||||
"""
|
||||
Create the PortingBulkPortabilityInstance
|
||||
|
||||
:param phone_numbers: The phone numbers which portability is to be checked. This should be a list of strings. Phone numbers are in E.164 format (e.g. +16175551212). .
|
||||
|
||||
:returns: The created PortingBulkPortabilityInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PhoneNumbers": serialize.map(phone_numbers, lambda e: e),
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return PortingBulkPortabilityInstance(self._version, payload)
|
||||
|
||||
async def create_async(
|
||||
self, phone_numbers: List[str]
|
||||
) -> PortingBulkPortabilityInstance:
|
||||
"""
|
||||
Asynchronously create the PortingBulkPortabilityInstance
|
||||
|
||||
:param phone_numbers: The phone numbers which portability is to be checked. This should be a list of strings. Phone numbers are in E.164 format (e.g. +16175551212). .
|
||||
|
||||
:returns: The created PortingBulkPortabilityInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PhoneNumbers": serialize.map(phone_numbers, lambda e: e),
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return PortingBulkPortabilityInstance(self._version, payload)
|
||||
|
||||
def get(self, sid: str) -> PortingBulkPortabilityContext:
|
||||
"""
|
||||
Constructs a PortingBulkPortabilityContext
|
||||
|
||||
:param sid: A 34 character string that uniquely identifies the Portability check.
|
||||
"""
|
||||
return PortingBulkPortabilityContext(self._version, sid=sid)
|
||||
|
||||
def __call__(self, sid: str) -> PortingBulkPortabilityContext:
|
||||
"""
|
||||
Constructs a PortingBulkPortabilityContext
|
||||
|
||||
:param sid: A 34 character string that uniquely identifies the Portability check.
|
||||
"""
|
||||
return PortingBulkPortabilityContext(self._version, sid=sid)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V1.PortingBulkPortabilityList>"
|
||||
@@ -0,0 +1,241 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Numbers
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from typing import Any, Dict, Optional, Union
|
||||
from twilio.base import deserialize, values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
|
||||
|
||||
class PortingPortabilityInstance(InstanceResource):
|
||||
class NumberType(object):
|
||||
LOCAL = "LOCAL"
|
||||
UNKNOWN = "UNKNOWN"
|
||||
MOBILE = "MOBILE"
|
||||
TOLL_FREE = "TOLL-FREE"
|
||||
|
||||
"""
|
||||
:ivar phone_number: The phone number which portability is to be checked. Phone numbers are in E.164 format (e.g. +16175551212).
|
||||
:ivar account_sid: The target account sid to which the number will be ported
|
||||
:ivar portable: Boolean flag specifying if phone number is portable or not.
|
||||
:ivar pin_and_account_number_required: Boolean flag specifying if PIN and account number is required for the phone number.
|
||||
:ivar not_portable_reason: Reason why the phone number cannot be ported into Twilio, `null` otherwise.
|
||||
:ivar not_portable_reason_code: The Portability Reason Code for the phone number if it cannot be ported into Twilio, `null` otherwise. One of `22131`, `22132`, `22130`, `22133`, `22102` or `22135`.
|
||||
:ivar number_type:
|
||||
:ivar country: Country the phone number belongs to.
|
||||
:ivar messaging_carrier: Current messaging carrier of the phone number
|
||||
:ivar voice_carrier: Current voice carrier of the phone number
|
||||
:ivar url: This is the url of the request that you're trying to reach out to locate the resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
phone_number: Optional[str] = None,
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.phone_number: Optional[str] = payload.get("phone_number")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.portable: Optional[bool] = payload.get("portable")
|
||||
self.pin_and_account_number_required: Optional[bool] = payload.get(
|
||||
"pin_and_account_number_required"
|
||||
)
|
||||
self.not_portable_reason: Optional[str] = payload.get("not_portable_reason")
|
||||
self.not_portable_reason_code: Optional[int] = deserialize.integer(
|
||||
payload.get("not_portable_reason_code")
|
||||
)
|
||||
self.number_type: Optional[
|
||||
"PortingPortabilityInstance.NumberType"
|
||||
] = payload.get("number_type")
|
||||
self.country: Optional[str] = payload.get("country")
|
||||
self.messaging_carrier: Optional[str] = payload.get("messaging_carrier")
|
||||
self.voice_carrier: Optional[str] = payload.get("voice_carrier")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"phone_number": phone_number or self.phone_number,
|
||||
}
|
||||
self._context: Optional[PortingPortabilityContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "PortingPortabilityContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: PortingPortabilityContext for this PortingPortabilityInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = PortingPortabilityContext(
|
||||
self._version,
|
||||
phone_number=self._solution["phone_number"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(
|
||||
self, target_account_sid: Union[str, object] = values.unset
|
||||
) -> "PortingPortabilityInstance":
|
||||
"""
|
||||
Fetch the PortingPortabilityInstance
|
||||
|
||||
:param target_account_sid: The SID of the account where the phone number(s) will be ported.
|
||||
|
||||
:returns: The fetched PortingPortabilityInstance
|
||||
"""
|
||||
return self._proxy.fetch(
|
||||
target_account_sid=target_account_sid,
|
||||
)
|
||||
|
||||
async def fetch_async(
|
||||
self, target_account_sid: Union[str, object] = values.unset
|
||||
) -> "PortingPortabilityInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the PortingPortabilityInstance
|
||||
|
||||
:param target_account_sid: The SID of the account where the phone number(s) will be ported.
|
||||
|
||||
:returns: The fetched PortingPortabilityInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async(
|
||||
target_account_sid=target_account_sid,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V1.PortingPortabilityInstance {}>".format(context)
|
||||
|
||||
|
||||
class PortingPortabilityContext(InstanceContext):
|
||||
def __init__(self, version: Version, phone_number: str):
|
||||
"""
|
||||
Initialize the PortingPortabilityContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param phone_number: The phone number which portability is to be checked. Phone numbers are in E.164 format (e.g. +16175551212).
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"phone_number": phone_number,
|
||||
}
|
||||
self._uri = "/Porting/Portability/PhoneNumber/{phone_number}".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def fetch(
|
||||
self, target_account_sid: Union[str, object] = values.unset
|
||||
) -> PortingPortabilityInstance:
|
||||
"""
|
||||
Fetch the PortingPortabilityInstance
|
||||
|
||||
:param target_account_sid: The SID of the account where the phone number(s) will be ported.
|
||||
|
||||
:returns: The fetched PortingPortabilityInstance
|
||||
"""
|
||||
|
||||
data = values.of(
|
||||
{
|
||||
"TargetAccountSid": target_account_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.fetch(method="GET", uri=self._uri, params=data)
|
||||
|
||||
return PortingPortabilityInstance(
|
||||
self._version,
|
||||
payload,
|
||||
phone_number=self._solution["phone_number"],
|
||||
)
|
||||
|
||||
async def fetch_async(
|
||||
self, target_account_sid: Union[str, object] = values.unset
|
||||
) -> PortingPortabilityInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the PortingPortabilityInstance
|
||||
|
||||
:param target_account_sid: The SID of the account where the phone number(s) will be ported.
|
||||
|
||||
:returns: The fetched PortingPortabilityInstance
|
||||
"""
|
||||
|
||||
data = values.of(
|
||||
{
|
||||
"TargetAccountSid": target_account_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
|
||||
return PortingPortabilityInstance(
|
||||
self._version,
|
||||
payload,
|
||||
phone_number=self._solution["phone_number"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V1.PortingPortabilityContext {}>".format(context)
|
||||
|
||||
|
||||
class PortingPortabilityList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the PortingPortabilityList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
def get(self, phone_number: str) -> PortingPortabilityContext:
|
||||
"""
|
||||
Constructs a PortingPortabilityContext
|
||||
|
||||
:param phone_number: The phone number which portability is to be checked. Phone numbers are in E.164 format (e.g. +16175551212).
|
||||
"""
|
||||
return PortingPortabilityContext(self._version, phone_number=phone_number)
|
||||
|
||||
def __call__(self, phone_number: str) -> PortingPortabilityContext:
|
||||
"""
|
||||
Constructs a PortingPortabilityContext
|
||||
|
||||
:param phone_number: The phone number which portability is to be checked. Phone numbers are in E.164 format (e.g. +16175551212).
|
||||
"""
|
||||
return PortingPortabilityContext(self._version, phone_number=phone_number)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V1.PortingPortabilityList>"
|
||||
@@ -0,0 +1,66 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Numbers
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
from typing import Optional
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.domain import Domain
|
||||
from twilio.rest.numbers.v2.authorization_document import AuthorizationDocumentList
|
||||
from twilio.rest.numbers.v2.bulk_hosted_number_order import BulkHostedNumberOrderList
|
||||
from twilio.rest.numbers.v2.hosted_number_order import HostedNumberOrderList
|
||||
from twilio.rest.numbers.v2.regulatory_compliance import RegulatoryComplianceList
|
||||
|
||||
|
||||
class V2(Version):
|
||||
def __init__(self, domain: Domain):
|
||||
"""
|
||||
Initialize the V2 version of Numbers
|
||||
|
||||
:param domain: The Twilio.numbers domain
|
||||
"""
|
||||
super().__init__(domain, "v2")
|
||||
self._authorization_documents: Optional[AuthorizationDocumentList] = None
|
||||
self._bulk_hosted_number_orders: Optional[BulkHostedNumberOrderList] = None
|
||||
self._hosted_number_orders: Optional[HostedNumberOrderList] = None
|
||||
self._regulatory_compliance: Optional[RegulatoryComplianceList] = None
|
||||
|
||||
@property
|
||||
def authorization_documents(self) -> AuthorizationDocumentList:
|
||||
if self._authorization_documents is None:
|
||||
self._authorization_documents = AuthorizationDocumentList(self)
|
||||
return self._authorization_documents
|
||||
|
||||
@property
|
||||
def bulk_hosted_number_orders(self) -> BulkHostedNumberOrderList:
|
||||
if self._bulk_hosted_number_orders is None:
|
||||
self._bulk_hosted_number_orders = BulkHostedNumberOrderList(self)
|
||||
return self._bulk_hosted_number_orders
|
||||
|
||||
@property
|
||||
def hosted_number_orders(self) -> HostedNumberOrderList:
|
||||
if self._hosted_number_orders is None:
|
||||
self._hosted_number_orders = HostedNumberOrderList(self)
|
||||
return self._hosted_number_orders
|
||||
|
||||
@property
|
||||
def regulatory_compliance(self) -> RegulatoryComplianceList:
|
||||
if self._regulatory_compliance is None:
|
||||
self._regulatory_compliance = RegulatoryComplianceList(self)
|
||||
return self._regulatory_compliance
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2>"
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+602
@@ -0,0 +1,602 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Numbers
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
|
||||
from twilio.base import deserialize, serialize, values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.page import Page
|
||||
from twilio.rest.numbers.v2.authorization_document.dependent_hosted_number_order import (
|
||||
DependentHostedNumberOrderList,
|
||||
)
|
||||
|
||||
|
||||
class AuthorizationDocumentInstance(InstanceResource):
|
||||
class Status(object):
|
||||
OPENED = "opened"
|
||||
SIGNING = "signing"
|
||||
SIGNED = "signed"
|
||||
CANCELED = "canceled"
|
||||
FAILED = "failed"
|
||||
|
||||
"""
|
||||
:ivar sid: A 34 character string that uniquely identifies this AuthorizationDocument.
|
||||
:ivar address_sid: A 34 character string that uniquely identifies the Address resource that is associated with this AuthorizationDocument.
|
||||
:ivar status:
|
||||
:ivar email: Email that this AuthorizationDocument will be sent to for signing.
|
||||
:ivar cc_emails: Email recipients who will be informed when an Authorization Document has been sent and signed.
|
||||
:ivar date_created: The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format.
|
||||
:ivar date_updated: The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format.
|
||||
:ivar url:
|
||||
:ivar links:
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.address_sid: Optional[str] = payload.get("address_sid")
|
||||
self.status: Optional["AuthorizationDocumentInstance.Status"] = payload.get(
|
||||
"status"
|
||||
)
|
||||
self.email: Optional[str] = payload.get("email")
|
||||
self.cc_emails: Optional[List[str]] = payload.get("cc_emails")
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
self.date_updated: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_updated")
|
||||
)
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
self.links: Optional[Dict[str, object]] = payload.get("links")
|
||||
|
||||
self._solution = {
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[AuthorizationDocumentContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "AuthorizationDocumentContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: AuthorizationDocumentContext for this AuthorizationDocumentInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = AuthorizationDocumentContext(
|
||||
self._version,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the AuthorizationDocumentInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._proxy.delete()
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the AuthorizationDocumentInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._proxy.delete_async()
|
||||
|
||||
def fetch(self) -> "AuthorizationDocumentInstance":
|
||||
"""
|
||||
Fetch the AuthorizationDocumentInstance
|
||||
|
||||
|
||||
:returns: The fetched AuthorizationDocumentInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "AuthorizationDocumentInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the AuthorizationDocumentInstance
|
||||
|
||||
|
||||
:returns: The fetched AuthorizationDocumentInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
@property
|
||||
def dependent_hosted_number_orders(self) -> DependentHostedNumberOrderList:
|
||||
"""
|
||||
Access the dependent_hosted_number_orders
|
||||
"""
|
||||
return self._proxy.dependent_hosted_number_orders
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.AuthorizationDocumentInstance {}>".format(context)
|
||||
|
||||
|
||||
class AuthorizationDocumentContext(InstanceContext):
|
||||
def __init__(self, version: Version, sid: str):
|
||||
"""
|
||||
Initialize the AuthorizationDocumentContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param sid: A 34 character string that uniquely identifies this AuthorizationDocument.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/HostedNumber/AuthorizationDocuments/{sid}".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
self._dependent_hosted_number_orders: Optional[
|
||||
DependentHostedNumberOrderList
|
||||
] = None
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the AuthorizationDocumentInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._version.delete(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the AuthorizationDocumentInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._version.delete_async(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
def fetch(self) -> AuthorizationDocumentInstance:
|
||||
"""
|
||||
Fetch the AuthorizationDocumentInstance
|
||||
|
||||
|
||||
:returns: The fetched AuthorizationDocumentInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return AuthorizationDocumentInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> AuthorizationDocumentInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the AuthorizationDocumentInstance
|
||||
|
||||
|
||||
:returns: The fetched AuthorizationDocumentInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return AuthorizationDocumentInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
@property
|
||||
def dependent_hosted_number_orders(self) -> DependentHostedNumberOrderList:
|
||||
"""
|
||||
Access the dependent_hosted_number_orders
|
||||
"""
|
||||
if self._dependent_hosted_number_orders is None:
|
||||
self._dependent_hosted_number_orders = DependentHostedNumberOrderList(
|
||||
self._version,
|
||||
self._solution["sid"],
|
||||
)
|
||||
return self._dependent_hosted_number_orders
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.AuthorizationDocumentContext {}>".format(context)
|
||||
|
||||
|
||||
class AuthorizationDocumentPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> AuthorizationDocumentInstance:
|
||||
"""
|
||||
Build an instance of AuthorizationDocumentInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return AuthorizationDocumentInstance(self._version, payload)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.AuthorizationDocumentPage>"
|
||||
|
||||
|
||||
class AuthorizationDocumentList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the AuthorizationDocumentList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/HostedNumber/AuthorizationDocuments"
|
||||
|
||||
def create(
|
||||
self,
|
||||
address_sid: str,
|
||||
email: str,
|
||||
contact_phone_number: str,
|
||||
hosted_number_order_sids: List[str],
|
||||
contact_title: Union[str, object] = values.unset,
|
||||
cc_emails: Union[List[str], object] = values.unset,
|
||||
) -> AuthorizationDocumentInstance:
|
||||
"""
|
||||
Create the AuthorizationDocumentInstance
|
||||
|
||||
:param address_sid: A 34 character string that uniquely identifies the Address resource that is associated with this AuthorizationDocument.
|
||||
:param email: Email that this AuthorizationDocument will be sent to for signing.
|
||||
:param contact_phone_number: The contact phone number of the person authorized to sign the Authorization Document.
|
||||
:param hosted_number_order_sids: A list of HostedNumberOrder sids that this AuthorizationDocument will authorize for hosting phone number capabilities on Twilio's platform.
|
||||
:param contact_title: The title of the person authorized to sign the Authorization Document for this phone number.
|
||||
:param cc_emails: Email recipients who will be informed when an Authorization Document has been sent and signed.
|
||||
|
||||
:returns: The created AuthorizationDocumentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"AddressSid": address_sid,
|
||||
"Email": email,
|
||||
"ContactPhoneNumber": contact_phone_number,
|
||||
"HostedNumberOrderSids": serialize.map(
|
||||
hosted_number_order_sids, lambda e: e
|
||||
),
|
||||
"ContactTitle": contact_title,
|
||||
"CcEmails": serialize.map(cc_emails, lambda e: e),
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return AuthorizationDocumentInstance(self._version, payload)
|
||||
|
||||
async def create_async(
|
||||
self,
|
||||
address_sid: str,
|
||||
email: str,
|
||||
contact_phone_number: str,
|
||||
hosted_number_order_sids: List[str],
|
||||
contact_title: Union[str, object] = values.unset,
|
||||
cc_emails: Union[List[str], object] = values.unset,
|
||||
) -> AuthorizationDocumentInstance:
|
||||
"""
|
||||
Asynchronously create the AuthorizationDocumentInstance
|
||||
|
||||
:param address_sid: A 34 character string that uniquely identifies the Address resource that is associated with this AuthorizationDocument.
|
||||
:param email: Email that this AuthorizationDocument will be sent to for signing.
|
||||
:param contact_phone_number: The contact phone number of the person authorized to sign the Authorization Document.
|
||||
:param hosted_number_order_sids: A list of HostedNumberOrder sids that this AuthorizationDocument will authorize for hosting phone number capabilities on Twilio's platform.
|
||||
:param contact_title: The title of the person authorized to sign the Authorization Document for this phone number.
|
||||
:param cc_emails: Email recipients who will be informed when an Authorization Document has been sent and signed.
|
||||
|
||||
:returns: The created AuthorizationDocumentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"AddressSid": address_sid,
|
||||
"Email": email,
|
||||
"ContactPhoneNumber": contact_phone_number,
|
||||
"HostedNumberOrderSids": serialize.map(
|
||||
hosted_number_order_sids, lambda e: e
|
||||
),
|
||||
"ContactTitle": contact_title,
|
||||
"CcEmails": serialize.map(cc_emails, lambda e: e),
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return AuthorizationDocumentInstance(self._version, payload)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
email: Union[str, object] = values.unset,
|
||||
status: Union["AuthorizationDocumentInstance.Status", object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[AuthorizationDocumentInstance]:
|
||||
"""
|
||||
Streams AuthorizationDocumentInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param str email: Email that this AuthorizationDocument will be sent to for signing.
|
||||
:param "AuthorizationDocumentInstance.Status" status: Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses.
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(email=email, status=status, page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
email: Union[str, object] = values.unset,
|
||||
status: Union["AuthorizationDocumentInstance.Status", object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[AuthorizationDocumentInstance]:
|
||||
"""
|
||||
Asynchronously streams AuthorizationDocumentInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param str email: Email that this AuthorizationDocument will be sent to for signing.
|
||||
:param "AuthorizationDocumentInstance.Status" status: Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses.
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(
|
||||
email=email, status=status, page_size=limits["page_size"]
|
||||
)
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
email: Union[str, object] = values.unset,
|
||||
status: Union["AuthorizationDocumentInstance.Status", object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[AuthorizationDocumentInstance]:
|
||||
"""
|
||||
Lists AuthorizationDocumentInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param str email: Email that this AuthorizationDocument will be sent to for signing.
|
||||
:param "AuthorizationDocumentInstance.Status" status: Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses.
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
email=email,
|
||||
status=status,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
email: Union[str, object] = values.unset,
|
||||
status: Union["AuthorizationDocumentInstance.Status", object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[AuthorizationDocumentInstance]:
|
||||
"""
|
||||
Asynchronously lists AuthorizationDocumentInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param str email: Email that this AuthorizationDocument will be sent to for signing.
|
||||
:param "AuthorizationDocumentInstance.Status" status: Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses.
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
email=email,
|
||||
status=status,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
email: Union[str, object] = values.unset,
|
||||
status: Union["AuthorizationDocumentInstance.Status", object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> AuthorizationDocumentPage:
|
||||
"""
|
||||
Retrieve a single page of AuthorizationDocumentInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param email: Email that this AuthorizationDocument will be sent to for signing.
|
||||
:param status: Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses.
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of AuthorizationDocumentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"Email": email,
|
||||
"Status": status,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return AuthorizationDocumentPage(self._version, response)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
email: Union[str, object] = values.unset,
|
||||
status: Union["AuthorizationDocumentInstance.Status", object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> AuthorizationDocumentPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of AuthorizationDocumentInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param email: Email that this AuthorizationDocument will be sent to for signing.
|
||||
:param status: Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses.
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of AuthorizationDocumentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"Email": email,
|
||||
"Status": status,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return AuthorizationDocumentPage(self._version, response)
|
||||
|
||||
def get_page(self, target_url: str) -> AuthorizationDocumentPage:
|
||||
"""
|
||||
Retrieve a specific page of AuthorizationDocumentInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of AuthorizationDocumentInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return AuthorizationDocumentPage(self._version, response)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> AuthorizationDocumentPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of AuthorizationDocumentInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of AuthorizationDocumentInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return AuthorizationDocumentPage(self._version, response)
|
||||
|
||||
def get(self, sid: str) -> AuthorizationDocumentContext:
|
||||
"""
|
||||
Constructs a AuthorizationDocumentContext
|
||||
|
||||
:param sid: A 34 character string that uniquely identifies this AuthorizationDocument.
|
||||
"""
|
||||
return AuthorizationDocumentContext(self._version, sid=sid)
|
||||
|
||||
def __call__(self, sid: str) -> AuthorizationDocumentContext:
|
||||
"""
|
||||
Constructs a AuthorizationDocumentContext
|
||||
|
||||
:param sid: A 34 character string that uniquely identifies this AuthorizationDocument.
|
||||
"""
|
||||
return AuthorizationDocumentContext(self._version, sid=sid)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.AuthorizationDocumentList>"
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
+427
@@ -0,0 +1,427 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Numbers
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
|
||||
from twilio.base import deserialize, values
|
||||
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.page import Page
|
||||
|
||||
|
||||
class DependentHostedNumberOrderInstance(InstanceResource):
|
||||
class Status(object):
|
||||
RECEIVED = "received"
|
||||
VERIFIED = "verified"
|
||||
PENDING_LOA = "pending-loa"
|
||||
CARRIER_PROCESSING = "carrier-processing"
|
||||
COMPLETED = "completed"
|
||||
FAILED = "failed"
|
||||
ACTION_REQUIRED = "action-required"
|
||||
|
||||
"""
|
||||
:ivar sid: A 34 character string that uniquely identifies this Authorization Document
|
||||
:ivar bulk_hosting_request_sid: A 34 character string that uniquely identifies the bulk hosting request associated with this HostedNumberOrder.
|
||||
:ivar next_step: The next step you need to take to complete the hosted number order and request it successfully.
|
||||
:ivar account_sid: The unique SID identifier of the Account.
|
||||
:ivar incoming_phone_number_sid: A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.
|
||||
:ivar address_sid: A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number.
|
||||
:ivar signing_document_sid: A 34 character string that uniquely identifies the LOA document associated with this HostedNumberOrder.
|
||||
:ivar phone_number: An E164 formatted phone number hosted by this HostedNumberOrder.
|
||||
:ivar capabilities:
|
||||
:ivar friendly_name: A human readable description of this resource, up to 128 characters.
|
||||
:ivar status:
|
||||
:ivar failure_reason: A message that explains why a hosted_number_order went to status \"action-required\"
|
||||
:ivar date_created: The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format.
|
||||
:ivar date_updated: The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format.
|
||||
:ivar email: Email of the owner of this phone number that is being hosted.
|
||||
:ivar cc_emails: Email recipients who will be informed when an Authorization Document has been sent and signed
|
||||
:ivar contact_title: The title of the person authorized to sign the Authorization Document for this phone number.
|
||||
:ivar contact_phone_number: The contact phone number of the person authorized to sign the Authorization Document.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, version: Version, payload: Dict[str, Any], signing_document_sid: str
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.bulk_hosting_request_sid: Optional[str] = payload.get(
|
||||
"bulk_hosting_request_sid"
|
||||
)
|
||||
self.next_step: Optional[str] = payload.get("next_step")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.incoming_phone_number_sid: Optional[str] = payload.get(
|
||||
"incoming_phone_number_sid"
|
||||
)
|
||||
self.address_sid: Optional[str] = payload.get("address_sid")
|
||||
self.signing_document_sid: Optional[str] = payload.get("signing_document_sid")
|
||||
self.phone_number: Optional[str] = payload.get("phone_number")
|
||||
self.capabilities: Optional[str] = payload.get("capabilities")
|
||||
self.friendly_name: Optional[str] = payload.get("friendly_name")
|
||||
self.status: Optional[
|
||||
"DependentHostedNumberOrderInstance.Status"
|
||||
] = payload.get("status")
|
||||
self.failure_reason: Optional[str] = payload.get("failure_reason")
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
self.date_updated: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_updated")
|
||||
)
|
||||
self.email: Optional[str] = payload.get("email")
|
||||
self.cc_emails: Optional[List[str]] = payload.get("cc_emails")
|
||||
self.contact_title: Optional[str] = payload.get("contact_title")
|
||||
self.contact_phone_number: Optional[str] = payload.get("contact_phone_number")
|
||||
|
||||
self._solution = {
|
||||
"signing_document_sid": signing_document_sid,
|
||||
}
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.DependentHostedNumberOrderInstance {}>".format(
|
||||
context
|
||||
)
|
||||
|
||||
|
||||
class DependentHostedNumberOrderPage(Page):
|
||||
def get_instance(
|
||||
self, payload: Dict[str, Any]
|
||||
) -> DependentHostedNumberOrderInstance:
|
||||
"""
|
||||
Build an instance of DependentHostedNumberOrderInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return DependentHostedNumberOrderInstance(
|
||||
self._version,
|
||||
payload,
|
||||
signing_document_sid=self._solution["signing_document_sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.DependentHostedNumberOrderPage>"
|
||||
|
||||
|
||||
class DependentHostedNumberOrderList(ListResource):
|
||||
def __init__(self, version: Version, signing_document_sid: str):
|
||||
"""
|
||||
Initialize the DependentHostedNumberOrderList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param signing_document_sid: A 34 character string that uniquely identifies the LOA document associated with this HostedNumberOrder.
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"signing_document_sid": signing_document_sid,
|
||||
}
|
||||
self._uri = "/HostedNumber/AuthorizationDocuments/{signing_document_sid}/DependentHostedNumberOrders".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
status: Union[
|
||||
"DependentHostedNumberOrderInstance.Status", object
|
||||
] = values.unset,
|
||||
phone_number: Union[str, object] = values.unset,
|
||||
incoming_phone_number_sid: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[DependentHostedNumberOrderInstance]:
|
||||
"""
|
||||
Streams DependentHostedNumberOrderInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param "DependentHostedNumberOrderInstance.Status" status: Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses.
|
||||
:param str phone_number: An E164 formatted phone number hosted by this HostedNumberOrder.
|
||||
:param str incoming_phone_number_sid: A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.
|
||||
:param str friendly_name: A human readable description of this resource, up to 128 characters.
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(
|
||||
status=status,
|
||||
phone_number=phone_number,
|
||||
incoming_phone_number_sid=incoming_phone_number_sid,
|
||||
friendly_name=friendly_name,
|
||||
page_size=limits["page_size"],
|
||||
)
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
status: Union[
|
||||
"DependentHostedNumberOrderInstance.Status", object
|
||||
] = values.unset,
|
||||
phone_number: Union[str, object] = values.unset,
|
||||
incoming_phone_number_sid: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[DependentHostedNumberOrderInstance]:
|
||||
"""
|
||||
Asynchronously streams DependentHostedNumberOrderInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param "DependentHostedNumberOrderInstance.Status" status: Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses.
|
||||
:param str phone_number: An E164 formatted phone number hosted by this HostedNumberOrder.
|
||||
:param str incoming_phone_number_sid: A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.
|
||||
:param str friendly_name: A human readable description of this resource, up to 128 characters.
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(
|
||||
status=status,
|
||||
phone_number=phone_number,
|
||||
incoming_phone_number_sid=incoming_phone_number_sid,
|
||||
friendly_name=friendly_name,
|
||||
page_size=limits["page_size"],
|
||||
)
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
status: Union[
|
||||
"DependentHostedNumberOrderInstance.Status", object
|
||||
] = values.unset,
|
||||
phone_number: Union[str, object] = values.unset,
|
||||
incoming_phone_number_sid: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[DependentHostedNumberOrderInstance]:
|
||||
"""
|
||||
Lists DependentHostedNumberOrderInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param "DependentHostedNumberOrderInstance.Status" status: Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses.
|
||||
:param str phone_number: An E164 formatted phone number hosted by this HostedNumberOrder.
|
||||
:param str incoming_phone_number_sid: A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.
|
||||
:param str friendly_name: A human readable description of this resource, up to 128 characters.
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
status=status,
|
||||
phone_number=phone_number,
|
||||
incoming_phone_number_sid=incoming_phone_number_sid,
|
||||
friendly_name=friendly_name,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
status: Union[
|
||||
"DependentHostedNumberOrderInstance.Status", object
|
||||
] = values.unset,
|
||||
phone_number: Union[str, object] = values.unset,
|
||||
incoming_phone_number_sid: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[DependentHostedNumberOrderInstance]:
|
||||
"""
|
||||
Asynchronously lists DependentHostedNumberOrderInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param "DependentHostedNumberOrderInstance.Status" status: Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses.
|
||||
:param str phone_number: An E164 formatted phone number hosted by this HostedNumberOrder.
|
||||
:param str incoming_phone_number_sid: A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.
|
||||
:param str friendly_name: A human readable description of this resource, up to 128 characters.
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
status=status,
|
||||
phone_number=phone_number,
|
||||
incoming_phone_number_sid=incoming_phone_number_sid,
|
||||
friendly_name=friendly_name,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
status: Union[
|
||||
"DependentHostedNumberOrderInstance.Status", object
|
||||
] = values.unset,
|
||||
phone_number: Union[str, object] = values.unset,
|
||||
incoming_phone_number_sid: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> DependentHostedNumberOrderPage:
|
||||
"""
|
||||
Retrieve a single page of DependentHostedNumberOrderInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param status: Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses.
|
||||
:param phone_number: An E164 formatted phone number hosted by this HostedNumberOrder.
|
||||
:param incoming_phone_number_sid: A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.
|
||||
:param friendly_name: A human readable description of this resource, up to 128 characters.
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of DependentHostedNumberOrderInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"Status": status,
|
||||
"PhoneNumber": phone_number,
|
||||
"IncomingPhoneNumberSid": incoming_phone_number_sid,
|
||||
"FriendlyName": friendly_name,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return DependentHostedNumberOrderPage(self._version, response, self._solution)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
status: Union[
|
||||
"DependentHostedNumberOrderInstance.Status", object
|
||||
] = values.unset,
|
||||
phone_number: Union[str, object] = values.unset,
|
||||
incoming_phone_number_sid: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> DependentHostedNumberOrderPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of DependentHostedNumberOrderInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param status: Status of an instance resource. It can hold one of the values: 1. opened 2. signing, 3. signed LOA, 4. canceled, 5. failed. See the section entitled [Status Values](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource#status-values) for more information on each of these statuses.
|
||||
:param phone_number: An E164 formatted phone number hosted by this HostedNumberOrder.
|
||||
:param incoming_phone_number_sid: A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.
|
||||
:param friendly_name: A human readable description of this resource, up to 128 characters.
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of DependentHostedNumberOrderInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"Status": status,
|
||||
"PhoneNumber": phone_number,
|
||||
"IncomingPhoneNumberSid": incoming_phone_number_sid,
|
||||
"FriendlyName": friendly_name,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return DependentHostedNumberOrderPage(self._version, response, self._solution)
|
||||
|
||||
def get_page(self, target_url: str) -> DependentHostedNumberOrderPage:
|
||||
"""
|
||||
Retrieve a specific page of DependentHostedNumberOrderInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of DependentHostedNumberOrderInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return DependentHostedNumberOrderPage(self._version, response, self._solution)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> DependentHostedNumberOrderPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of DependentHostedNumberOrderInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of DependentHostedNumberOrderInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return DependentHostedNumberOrderPage(self._version, response, self._solution)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.DependentHostedNumberOrderList>"
|
||||
@@ -0,0 +1,243 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Numbers
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
from twilio.base import deserialize, values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
|
||||
|
||||
class BulkHostedNumberOrderInstance(InstanceResource):
|
||||
class RequestStatus(object):
|
||||
QUEUED = "QUEUED"
|
||||
IN_PROGRESS = "IN_PROGRESS"
|
||||
PROCESSED = "PROCESSED"
|
||||
|
||||
"""
|
||||
:ivar bulk_hosting_sid: A 34 character string that uniquely identifies this BulkHostedNumberOrder.
|
||||
:ivar request_status:
|
||||
:ivar friendly_name: A 128 character string that is a human-readable text that describes this resource.
|
||||
:ivar notification_email: Email address used for send notifications about this Bulk hosted number request.
|
||||
:ivar date_created: The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format.
|
||||
:ivar date_completed: The date that this resource was completed, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format.
|
||||
:ivar url: The URL of this BulkHostedNumberOrder resource.
|
||||
:ivar total_count: The total count of phone numbers in this Bulk hosting request.
|
||||
:ivar results: Contains a list of all the individual hosting orders and their information, for this Bulk request. Each result object is grouped by its order status. To see a complete list of order status, please check 'https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/hosted-number-order-resource#status-values'.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
bulk_hosting_sid: Optional[str] = None,
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.bulk_hosting_sid: Optional[str] = payload.get("bulk_hosting_sid")
|
||||
self.request_status: Optional[
|
||||
"BulkHostedNumberOrderInstance.RequestStatus"
|
||||
] = payload.get("request_status")
|
||||
self.friendly_name: Optional[str] = payload.get("friendly_name")
|
||||
self.notification_email: Optional[str] = payload.get("notification_email")
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
self.date_completed: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_completed")
|
||||
)
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
self.total_count: Optional[int] = deserialize.integer(
|
||||
payload.get("total_count")
|
||||
)
|
||||
self.results: Optional[List[object]] = payload.get("results")
|
||||
|
||||
self._solution = {
|
||||
"bulk_hosting_sid": bulk_hosting_sid or self.bulk_hosting_sid,
|
||||
}
|
||||
self._context: Optional[BulkHostedNumberOrderContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "BulkHostedNumberOrderContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: BulkHostedNumberOrderContext for this BulkHostedNumberOrderInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = BulkHostedNumberOrderContext(
|
||||
self._version,
|
||||
bulk_hosting_sid=self._solution["bulk_hosting_sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(
|
||||
self, order_status: Union[str, object] = values.unset
|
||||
) -> "BulkHostedNumberOrderInstance":
|
||||
"""
|
||||
Fetch the BulkHostedNumberOrderInstance
|
||||
|
||||
:param order_status: Order status can be used for filtering on Hosted Number Order status values. To see a complete list of order statuses, please check 'https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/hosted-number-order-resource#status-values'.
|
||||
|
||||
:returns: The fetched BulkHostedNumberOrderInstance
|
||||
"""
|
||||
return self._proxy.fetch(
|
||||
order_status=order_status,
|
||||
)
|
||||
|
||||
async def fetch_async(
|
||||
self, order_status: Union[str, object] = values.unset
|
||||
) -> "BulkHostedNumberOrderInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the BulkHostedNumberOrderInstance
|
||||
|
||||
:param order_status: Order status can be used for filtering on Hosted Number Order status values. To see a complete list of order statuses, please check 'https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/hosted-number-order-resource#status-values'.
|
||||
|
||||
:returns: The fetched BulkHostedNumberOrderInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async(
|
||||
order_status=order_status,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.BulkHostedNumberOrderInstance {}>".format(context)
|
||||
|
||||
|
||||
class BulkHostedNumberOrderContext(InstanceContext):
|
||||
def __init__(self, version: Version, bulk_hosting_sid: str):
|
||||
"""
|
||||
Initialize the BulkHostedNumberOrderContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param bulk_hosting_sid: A 34 character string that uniquely identifies this BulkHostedNumberOrder.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"bulk_hosting_sid": bulk_hosting_sid,
|
||||
}
|
||||
self._uri = "/HostedNumber/Orders/Bulk/{bulk_hosting_sid}".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def fetch(
|
||||
self, order_status: Union[str, object] = values.unset
|
||||
) -> BulkHostedNumberOrderInstance:
|
||||
"""
|
||||
Fetch the BulkHostedNumberOrderInstance
|
||||
|
||||
:param order_status: Order status can be used for filtering on Hosted Number Order status values. To see a complete list of order statuses, please check 'https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/hosted-number-order-resource#status-values'.
|
||||
|
||||
:returns: The fetched BulkHostedNumberOrderInstance
|
||||
"""
|
||||
|
||||
data = values.of(
|
||||
{
|
||||
"OrderStatus": order_status,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.fetch(method="GET", uri=self._uri, params=data)
|
||||
|
||||
return BulkHostedNumberOrderInstance(
|
||||
self._version,
|
||||
payload,
|
||||
bulk_hosting_sid=self._solution["bulk_hosting_sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(
|
||||
self, order_status: Union[str, object] = values.unset
|
||||
) -> BulkHostedNumberOrderInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the BulkHostedNumberOrderInstance
|
||||
|
||||
:param order_status: Order status can be used for filtering on Hosted Number Order status values. To see a complete list of order statuses, please check 'https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/hosted-number-order-resource#status-values'.
|
||||
|
||||
:returns: The fetched BulkHostedNumberOrderInstance
|
||||
"""
|
||||
|
||||
data = values.of(
|
||||
{
|
||||
"OrderStatus": order_status,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
|
||||
return BulkHostedNumberOrderInstance(
|
||||
self._version,
|
||||
payload,
|
||||
bulk_hosting_sid=self._solution["bulk_hosting_sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.BulkHostedNumberOrderContext {}>".format(context)
|
||||
|
||||
|
||||
class BulkHostedNumberOrderList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the BulkHostedNumberOrderList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
def get(self, bulk_hosting_sid: str) -> BulkHostedNumberOrderContext:
|
||||
"""
|
||||
Constructs a BulkHostedNumberOrderContext
|
||||
|
||||
:param bulk_hosting_sid: A 34 character string that uniquely identifies this BulkHostedNumberOrder.
|
||||
"""
|
||||
return BulkHostedNumberOrderContext(
|
||||
self._version, bulk_hosting_sid=bulk_hosting_sid
|
||||
)
|
||||
|
||||
def __call__(self, bulk_hosting_sid: str) -> BulkHostedNumberOrderContext:
|
||||
"""
|
||||
Constructs a BulkHostedNumberOrderContext
|
||||
|
||||
:param bulk_hosting_sid: A 34 character string that uniquely identifies this BulkHostedNumberOrder.
|
||||
"""
|
||||
return BulkHostedNumberOrderContext(
|
||||
self._version, bulk_hosting_sid=bulk_hosting_sid
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.BulkHostedNumberOrderList>"
|
||||
@@ -0,0 +1,716 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Numbers
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
|
||||
from twilio.base import deserialize, serialize, values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.page import Page
|
||||
|
||||
|
||||
class HostedNumberOrderInstance(InstanceResource):
|
||||
class Status(object):
|
||||
RECEIVED = "received"
|
||||
VERIFIED = "verified"
|
||||
PENDING_LOA = "pending-loa"
|
||||
CARRIER_PROCESSING = "carrier-processing"
|
||||
COMPLETED = "completed"
|
||||
FAILED = "failed"
|
||||
ACTION_REQUIRED = "action-required"
|
||||
|
||||
"""
|
||||
:ivar sid: A 34 character string that uniquely identifies this HostedNumberOrder.
|
||||
:ivar account_sid: A 34 character string that uniquely identifies the account.
|
||||
:ivar incoming_phone_number_sid: A 34 character string that uniquely identifies the [IncomingPhoneNumber](https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource) resource that represents the phone number being hosted.
|
||||
:ivar address_sid: A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number.
|
||||
:ivar signing_document_sid: A 34 character string that uniquely identifies the [Authorization Document](https://www.twilio.com/docs/phone-numbers/hosted-numbers/hosted-numbers-api/authorization-document-resource) the user needs to sign.
|
||||
:ivar phone_number: Phone number to be hosted. This must be in [E.164](https://en.wikipedia.org/wiki/E.164) format, e.g., +16175551212
|
||||
:ivar capabilities:
|
||||
:ivar friendly_name: A 128 character string that is a human-readable text that describes this resource.
|
||||
:ivar status:
|
||||
:ivar failure_reason: A message that explains why a hosted_number_order went to status \"action-required\"
|
||||
:ivar date_created: The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format.
|
||||
:ivar date_updated: The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format.
|
||||
:ivar email: Email of the owner of this phone number that is being hosted.
|
||||
:ivar cc_emails: A list of emails that LOA document for this HostedNumberOrder will be carbon copied to.
|
||||
:ivar url: The URL of this HostedNumberOrder.
|
||||
:ivar contact_title: The title of the person authorized to sign the Authorization Document for this phone number.
|
||||
:ivar contact_phone_number: The contact phone number of the person authorized to sign the Authorization Document.
|
||||
:ivar bulk_hosting_request_sid: A 34 character string that uniquely identifies the bulk hosting request associated with this HostedNumberOrder.
|
||||
:ivar next_step: The next step you need to take to complete the hosted number order and request it successfully.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.incoming_phone_number_sid: Optional[str] = payload.get(
|
||||
"incoming_phone_number_sid"
|
||||
)
|
||||
self.address_sid: Optional[str] = payload.get("address_sid")
|
||||
self.signing_document_sid: Optional[str] = payload.get("signing_document_sid")
|
||||
self.phone_number: Optional[str] = payload.get("phone_number")
|
||||
self.capabilities: Optional[str] = payload.get("capabilities")
|
||||
self.friendly_name: Optional[str] = payload.get("friendly_name")
|
||||
self.status: Optional["HostedNumberOrderInstance.Status"] = payload.get(
|
||||
"status"
|
||||
)
|
||||
self.failure_reason: Optional[str] = payload.get("failure_reason")
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
self.date_updated: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_updated")
|
||||
)
|
||||
self.email: Optional[str] = payload.get("email")
|
||||
self.cc_emails: Optional[List[str]] = payload.get("cc_emails")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
self.contact_title: Optional[str] = payload.get("contact_title")
|
||||
self.contact_phone_number: Optional[str] = payload.get("contact_phone_number")
|
||||
self.bulk_hosting_request_sid: Optional[str] = payload.get(
|
||||
"bulk_hosting_request_sid"
|
||||
)
|
||||
self.next_step: Optional[str] = payload.get("next_step")
|
||||
|
||||
self._solution = {
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[HostedNumberOrderContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "HostedNumberOrderContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: HostedNumberOrderContext for this HostedNumberOrderInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = HostedNumberOrderContext(
|
||||
self._version,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the HostedNumberOrderInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._proxy.delete()
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the HostedNumberOrderInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._proxy.delete_async()
|
||||
|
||||
def fetch(self) -> "HostedNumberOrderInstance":
|
||||
"""
|
||||
Fetch the HostedNumberOrderInstance
|
||||
|
||||
|
||||
:returns: The fetched HostedNumberOrderInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "HostedNumberOrderInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the HostedNumberOrderInstance
|
||||
|
||||
|
||||
:returns: The fetched HostedNumberOrderInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.HostedNumberOrderInstance {}>".format(context)
|
||||
|
||||
|
||||
class HostedNumberOrderContext(InstanceContext):
|
||||
def __init__(self, version: Version, sid: str):
|
||||
"""
|
||||
Initialize the HostedNumberOrderContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param sid: A 34 character string that uniquely identifies this HostedNumberOrder.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/HostedNumber/Orders/{sid}".format(**self._solution)
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the HostedNumberOrderInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._version.delete(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the HostedNumberOrderInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._version.delete_async(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
def fetch(self) -> HostedNumberOrderInstance:
|
||||
"""
|
||||
Fetch the HostedNumberOrderInstance
|
||||
|
||||
|
||||
:returns: The fetched HostedNumberOrderInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return HostedNumberOrderInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> HostedNumberOrderInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the HostedNumberOrderInstance
|
||||
|
||||
|
||||
:returns: The fetched HostedNumberOrderInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return HostedNumberOrderInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.HostedNumberOrderContext {}>".format(context)
|
||||
|
||||
|
||||
class HostedNumberOrderPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> HostedNumberOrderInstance:
|
||||
"""
|
||||
Build an instance of HostedNumberOrderInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return HostedNumberOrderInstance(self._version, payload)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.HostedNumberOrderPage>"
|
||||
|
||||
|
||||
class HostedNumberOrderList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the HostedNumberOrderList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/HostedNumber/Orders"
|
||||
|
||||
def create(
|
||||
self,
|
||||
phone_number: str,
|
||||
contact_phone_number: str,
|
||||
address_sid: str,
|
||||
email: str,
|
||||
account_sid: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
cc_emails: Union[List[str], object] = values.unset,
|
||||
sms_url: Union[str, object] = values.unset,
|
||||
sms_method: Union[str, object] = values.unset,
|
||||
sms_fallback_url: Union[str, object] = values.unset,
|
||||
sms_capability: Union[bool, object] = values.unset,
|
||||
sms_fallback_method: Union[str, object] = values.unset,
|
||||
status_callback_url: Union[str, object] = values.unset,
|
||||
status_callback_method: Union[str, object] = values.unset,
|
||||
sms_application_sid: Union[str, object] = values.unset,
|
||||
contact_title: Union[str, object] = values.unset,
|
||||
) -> HostedNumberOrderInstance:
|
||||
"""
|
||||
Create the HostedNumberOrderInstance
|
||||
|
||||
:param phone_number: The number to host in [+E.164](https://en.wikipedia.org/wiki/E.164) format
|
||||
:param contact_phone_number: The contact phone number of the person authorized to sign the Authorization Document.
|
||||
:param address_sid: Optional. A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number.
|
||||
:param email: Optional. Email of the owner of this phone number that is being hosted.
|
||||
:param account_sid: This defaults to the AccountSid of the authorization the user is using. This can be provided to specify a subaccount to add the HostedNumberOrder to.
|
||||
:param friendly_name: A 128 character string that is a human readable text that describes this resource.
|
||||
:param cc_emails: Optional. A list of emails that the LOA document for this HostedNumberOrder will be carbon copied to.
|
||||
:param sms_url: The URL that Twilio should request when somebody sends an SMS to the phone number. This will be copied onto the IncomingPhoneNumber resource.
|
||||
:param sms_method: The HTTP method that should be used to request the SmsUrl. Must be either `GET` or `POST`. This will be copied onto the IncomingPhoneNumber resource.
|
||||
:param sms_fallback_url: A URL that Twilio will request if an error occurs requesting or executing the TwiML defined by SmsUrl. This will be copied onto the IncomingPhoneNumber resource.
|
||||
:param sms_capability: Used to specify that the SMS capability will be hosted on Twilio's platform.
|
||||
:param sms_fallback_method: The HTTP method that should be used to request the SmsFallbackUrl. Must be either `GET` or `POST`. This will be copied onto the IncomingPhoneNumber resource.
|
||||
:param status_callback_url: Optional. The Status Callback URL attached to the IncomingPhoneNumber resource.
|
||||
:param status_callback_method: Optional. The Status Callback Method attached to the IncomingPhoneNumber resource.
|
||||
:param sms_application_sid: Optional. The 34 character sid of the application Twilio should use to handle SMS messages sent to this number. If a `SmsApplicationSid` is present, Twilio will ignore all of the SMS urls above and use those set on the application.
|
||||
:param contact_title: The title of the person authorized to sign the Authorization Document for this phone number.
|
||||
|
||||
:returns: The created HostedNumberOrderInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PhoneNumber": phone_number,
|
||||
"ContactPhoneNumber": contact_phone_number,
|
||||
"AddressSid": address_sid,
|
||||
"Email": email,
|
||||
"AccountSid": account_sid,
|
||||
"FriendlyName": friendly_name,
|
||||
"CcEmails": serialize.map(cc_emails, lambda e: e),
|
||||
"SmsUrl": sms_url,
|
||||
"SmsMethod": sms_method,
|
||||
"SmsFallbackUrl": sms_fallback_url,
|
||||
"SmsCapability": sms_capability,
|
||||
"SmsFallbackMethod": sms_fallback_method,
|
||||
"StatusCallbackUrl": status_callback_url,
|
||||
"StatusCallbackMethod": status_callback_method,
|
||||
"SmsApplicationSid": sms_application_sid,
|
||||
"ContactTitle": contact_title,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return HostedNumberOrderInstance(self._version, payload)
|
||||
|
||||
async def create_async(
|
||||
self,
|
||||
phone_number: str,
|
||||
contact_phone_number: str,
|
||||
address_sid: str,
|
||||
email: str,
|
||||
account_sid: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
cc_emails: Union[List[str], object] = values.unset,
|
||||
sms_url: Union[str, object] = values.unset,
|
||||
sms_method: Union[str, object] = values.unset,
|
||||
sms_fallback_url: Union[str, object] = values.unset,
|
||||
sms_capability: Union[bool, object] = values.unset,
|
||||
sms_fallback_method: Union[str, object] = values.unset,
|
||||
status_callback_url: Union[str, object] = values.unset,
|
||||
status_callback_method: Union[str, object] = values.unset,
|
||||
sms_application_sid: Union[str, object] = values.unset,
|
||||
contact_title: Union[str, object] = values.unset,
|
||||
) -> HostedNumberOrderInstance:
|
||||
"""
|
||||
Asynchronously create the HostedNumberOrderInstance
|
||||
|
||||
:param phone_number: The number to host in [+E.164](https://en.wikipedia.org/wiki/E.164) format
|
||||
:param contact_phone_number: The contact phone number of the person authorized to sign the Authorization Document.
|
||||
:param address_sid: Optional. A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number.
|
||||
:param email: Optional. Email of the owner of this phone number that is being hosted.
|
||||
:param account_sid: This defaults to the AccountSid of the authorization the user is using. This can be provided to specify a subaccount to add the HostedNumberOrder to.
|
||||
:param friendly_name: A 128 character string that is a human readable text that describes this resource.
|
||||
:param cc_emails: Optional. A list of emails that the LOA document for this HostedNumberOrder will be carbon copied to.
|
||||
:param sms_url: The URL that Twilio should request when somebody sends an SMS to the phone number. This will be copied onto the IncomingPhoneNumber resource.
|
||||
:param sms_method: The HTTP method that should be used to request the SmsUrl. Must be either `GET` or `POST`. This will be copied onto the IncomingPhoneNumber resource.
|
||||
:param sms_fallback_url: A URL that Twilio will request if an error occurs requesting or executing the TwiML defined by SmsUrl. This will be copied onto the IncomingPhoneNumber resource.
|
||||
:param sms_capability: Used to specify that the SMS capability will be hosted on Twilio's platform.
|
||||
:param sms_fallback_method: The HTTP method that should be used to request the SmsFallbackUrl. Must be either `GET` or `POST`. This will be copied onto the IncomingPhoneNumber resource.
|
||||
:param status_callback_url: Optional. The Status Callback URL attached to the IncomingPhoneNumber resource.
|
||||
:param status_callback_method: Optional. The Status Callback Method attached to the IncomingPhoneNumber resource.
|
||||
:param sms_application_sid: Optional. The 34 character sid of the application Twilio should use to handle SMS messages sent to this number. If a `SmsApplicationSid` is present, Twilio will ignore all of the SMS urls above and use those set on the application.
|
||||
:param contact_title: The title of the person authorized to sign the Authorization Document for this phone number.
|
||||
|
||||
:returns: The created HostedNumberOrderInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PhoneNumber": phone_number,
|
||||
"ContactPhoneNumber": contact_phone_number,
|
||||
"AddressSid": address_sid,
|
||||
"Email": email,
|
||||
"AccountSid": account_sid,
|
||||
"FriendlyName": friendly_name,
|
||||
"CcEmails": serialize.map(cc_emails, lambda e: e),
|
||||
"SmsUrl": sms_url,
|
||||
"SmsMethod": sms_method,
|
||||
"SmsFallbackUrl": sms_fallback_url,
|
||||
"SmsCapability": sms_capability,
|
||||
"SmsFallbackMethod": sms_fallback_method,
|
||||
"StatusCallbackUrl": status_callback_url,
|
||||
"StatusCallbackMethod": status_callback_method,
|
||||
"SmsApplicationSid": sms_application_sid,
|
||||
"ContactTitle": contact_title,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return HostedNumberOrderInstance(self._version, payload)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
status: Union["HostedNumberOrderInstance.Status", object] = values.unset,
|
||||
sms_capability: Union[bool, object] = values.unset,
|
||||
phone_number: Union[str, object] = values.unset,
|
||||
incoming_phone_number_sid: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[HostedNumberOrderInstance]:
|
||||
"""
|
||||
Streams HostedNumberOrderInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param "HostedNumberOrderInstance.Status" status: The Status of this HostedNumberOrder. One of `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`.
|
||||
:param bool sms_capability: Whether the SMS capability will be hosted on our platform. Can be `true` of `false`.
|
||||
:param str phone_number: An E164 formatted phone number hosted by this HostedNumberOrder.
|
||||
:param str incoming_phone_number_sid: A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.
|
||||
:param str friendly_name: A human readable description of this resource, up to 128 characters.
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(
|
||||
status=status,
|
||||
sms_capability=sms_capability,
|
||||
phone_number=phone_number,
|
||||
incoming_phone_number_sid=incoming_phone_number_sid,
|
||||
friendly_name=friendly_name,
|
||||
page_size=limits["page_size"],
|
||||
)
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
status: Union["HostedNumberOrderInstance.Status", object] = values.unset,
|
||||
sms_capability: Union[bool, object] = values.unset,
|
||||
phone_number: Union[str, object] = values.unset,
|
||||
incoming_phone_number_sid: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[HostedNumberOrderInstance]:
|
||||
"""
|
||||
Asynchronously streams HostedNumberOrderInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param "HostedNumberOrderInstance.Status" status: The Status of this HostedNumberOrder. One of `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`.
|
||||
:param bool sms_capability: Whether the SMS capability will be hosted on our platform. Can be `true` of `false`.
|
||||
:param str phone_number: An E164 formatted phone number hosted by this HostedNumberOrder.
|
||||
:param str incoming_phone_number_sid: A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.
|
||||
:param str friendly_name: A human readable description of this resource, up to 128 characters.
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(
|
||||
status=status,
|
||||
sms_capability=sms_capability,
|
||||
phone_number=phone_number,
|
||||
incoming_phone_number_sid=incoming_phone_number_sid,
|
||||
friendly_name=friendly_name,
|
||||
page_size=limits["page_size"],
|
||||
)
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
status: Union["HostedNumberOrderInstance.Status", object] = values.unset,
|
||||
sms_capability: Union[bool, object] = values.unset,
|
||||
phone_number: Union[str, object] = values.unset,
|
||||
incoming_phone_number_sid: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[HostedNumberOrderInstance]:
|
||||
"""
|
||||
Lists HostedNumberOrderInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param "HostedNumberOrderInstance.Status" status: The Status of this HostedNumberOrder. One of `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`.
|
||||
:param bool sms_capability: Whether the SMS capability will be hosted on our platform. Can be `true` of `false`.
|
||||
:param str phone_number: An E164 formatted phone number hosted by this HostedNumberOrder.
|
||||
:param str incoming_phone_number_sid: A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.
|
||||
:param str friendly_name: A human readable description of this resource, up to 128 characters.
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
status=status,
|
||||
sms_capability=sms_capability,
|
||||
phone_number=phone_number,
|
||||
incoming_phone_number_sid=incoming_phone_number_sid,
|
||||
friendly_name=friendly_name,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
status: Union["HostedNumberOrderInstance.Status", object] = values.unset,
|
||||
sms_capability: Union[bool, object] = values.unset,
|
||||
phone_number: Union[str, object] = values.unset,
|
||||
incoming_phone_number_sid: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[HostedNumberOrderInstance]:
|
||||
"""
|
||||
Asynchronously lists HostedNumberOrderInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param "HostedNumberOrderInstance.Status" status: The Status of this HostedNumberOrder. One of `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`.
|
||||
:param bool sms_capability: Whether the SMS capability will be hosted on our platform. Can be `true` of `false`.
|
||||
:param str phone_number: An E164 formatted phone number hosted by this HostedNumberOrder.
|
||||
:param str incoming_phone_number_sid: A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.
|
||||
:param str friendly_name: A human readable description of this resource, up to 128 characters.
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
status=status,
|
||||
sms_capability=sms_capability,
|
||||
phone_number=phone_number,
|
||||
incoming_phone_number_sid=incoming_phone_number_sid,
|
||||
friendly_name=friendly_name,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
status: Union["HostedNumberOrderInstance.Status", object] = values.unset,
|
||||
sms_capability: Union[bool, object] = values.unset,
|
||||
phone_number: Union[str, object] = values.unset,
|
||||
incoming_phone_number_sid: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> HostedNumberOrderPage:
|
||||
"""
|
||||
Retrieve a single page of HostedNumberOrderInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param status: The Status of this HostedNumberOrder. One of `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`.
|
||||
:param sms_capability: Whether the SMS capability will be hosted on our platform. Can be `true` of `false`.
|
||||
:param phone_number: An E164 formatted phone number hosted by this HostedNumberOrder.
|
||||
:param incoming_phone_number_sid: A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.
|
||||
:param friendly_name: A human readable description of this resource, up to 128 characters.
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of HostedNumberOrderInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"Status": status,
|
||||
"SmsCapability": sms_capability,
|
||||
"PhoneNumber": phone_number,
|
||||
"IncomingPhoneNumberSid": incoming_phone_number_sid,
|
||||
"FriendlyName": friendly_name,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return HostedNumberOrderPage(self._version, response)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
status: Union["HostedNumberOrderInstance.Status", object] = values.unset,
|
||||
sms_capability: Union[bool, object] = values.unset,
|
||||
phone_number: Union[str, object] = values.unset,
|
||||
incoming_phone_number_sid: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> HostedNumberOrderPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of HostedNumberOrderInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param status: The Status of this HostedNumberOrder. One of `received`, `pending-verification`, `verified`, `pending-loa`, `carrier-processing`, `testing`, `completed`, `failed`, or `action-required`.
|
||||
:param sms_capability: Whether the SMS capability will be hosted on our platform. Can be `true` of `false`.
|
||||
:param phone_number: An E164 formatted phone number hosted by this HostedNumberOrder.
|
||||
:param incoming_phone_number_sid: A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder.
|
||||
:param friendly_name: A human readable description of this resource, up to 128 characters.
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of HostedNumberOrderInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"Status": status,
|
||||
"SmsCapability": sms_capability,
|
||||
"PhoneNumber": phone_number,
|
||||
"IncomingPhoneNumberSid": incoming_phone_number_sid,
|
||||
"FriendlyName": friendly_name,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return HostedNumberOrderPage(self._version, response)
|
||||
|
||||
def get_page(self, target_url: str) -> HostedNumberOrderPage:
|
||||
"""
|
||||
Retrieve a specific page of HostedNumberOrderInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of HostedNumberOrderInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return HostedNumberOrderPage(self._version, response)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> HostedNumberOrderPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of HostedNumberOrderInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of HostedNumberOrderInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return HostedNumberOrderPage(self._version, response)
|
||||
|
||||
def get(self, sid: str) -> HostedNumberOrderContext:
|
||||
"""
|
||||
Constructs a HostedNumberOrderContext
|
||||
|
||||
:param sid: A 34 character string that uniquely identifies this HostedNumberOrder.
|
||||
"""
|
||||
return HostedNumberOrderContext(self._version, sid=sid)
|
||||
|
||||
def __call__(self, sid: str) -> HostedNumberOrderContext:
|
||||
"""
|
||||
Constructs a HostedNumberOrderContext
|
||||
|
||||
:param sid: A 34 character string that uniquely identifies this HostedNumberOrder.
|
||||
"""
|
||||
return HostedNumberOrderContext(self._version, sid=sid)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.HostedNumberOrderList>"
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Numbers
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from typing import Optional
|
||||
|
||||
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
|
||||
from twilio.rest.numbers.v2.regulatory_compliance.bundle import BundleList
|
||||
from twilio.rest.numbers.v2.regulatory_compliance.end_user import EndUserList
|
||||
from twilio.rest.numbers.v2.regulatory_compliance.end_user_type import EndUserTypeList
|
||||
from twilio.rest.numbers.v2.regulatory_compliance.regulation import RegulationList
|
||||
from twilio.rest.numbers.v2.regulatory_compliance.supporting_document import (
|
||||
SupportingDocumentList,
|
||||
)
|
||||
from twilio.rest.numbers.v2.regulatory_compliance.supporting_document_type import (
|
||||
SupportingDocumentTypeList,
|
||||
)
|
||||
|
||||
|
||||
class RegulatoryComplianceList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the RegulatoryComplianceList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/RegulatoryCompliance"
|
||||
|
||||
self._bundles: Optional[BundleList] = None
|
||||
self._end_users: Optional[EndUserList] = None
|
||||
self._end_user_types: Optional[EndUserTypeList] = None
|
||||
self._regulations: Optional[RegulationList] = None
|
||||
self._supporting_documents: Optional[SupportingDocumentList] = None
|
||||
self._supporting_document_types: Optional[SupportingDocumentTypeList] = None
|
||||
|
||||
@property
|
||||
def bundles(self) -> BundleList:
|
||||
"""
|
||||
Access the bundles
|
||||
"""
|
||||
if self._bundles is None:
|
||||
self._bundles = BundleList(self._version)
|
||||
return self._bundles
|
||||
|
||||
@property
|
||||
def end_users(self) -> EndUserList:
|
||||
"""
|
||||
Access the end_users
|
||||
"""
|
||||
if self._end_users is None:
|
||||
self._end_users = EndUserList(self._version)
|
||||
return self._end_users
|
||||
|
||||
@property
|
||||
def end_user_types(self) -> EndUserTypeList:
|
||||
"""
|
||||
Access the end_user_types
|
||||
"""
|
||||
if self._end_user_types is None:
|
||||
self._end_user_types = EndUserTypeList(self._version)
|
||||
return self._end_user_types
|
||||
|
||||
@property
|
||||
def regulations(self) -> RegulationList:
|
||||
"""
|
||||
Access the regulations
|
||||
"""
|
||||
if self._regulations is None:
|
||||
self._regulations = RegulationList(self._version)
|
||||
return self._regulations
|
||||
|
||||
@property
|
||||
def supporting_documents(self) -> SupportingDocumentList:
|
||||
"""
|
||||
Access the supporting_documents
|
||||
"""
|
||||
if self._supporting_documents is None:
|
||||
self._supporting_documents = SupportingDocumentList(self._version)
|
||||
return self._supporting_documents
|
||||
|
||||
@property
|
||||
def supporting_document_types(self) -> SupportingDocumentTypeList:
|
||||
"""
|
||||
Access the supporting_document_types
|
||||
"""
|
||||
if self._supporting_document_types is None:
|
||||
self._supporting_document_types = SupportingDocumentTypeList(self._version)
|
||||
return self._supporting_document_types
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.RegulatoryComplianceList>"
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+972
@@ -0,0 +1,972 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Numbers
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
|
||||
from twilio.base import deserialize, serialize, values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.page import Page
|
||||
from twilio.rest.numbers.v2.regulatory_compliance.bundle.bundle_copy import (
|
||||
BundleCopyList,
|
||||
)
|
||||
from twilio.rest.numbers.v2.regulatory_compliance.bundle.evaluation import (
|
||||
EvaluationList,
|
||||
)
|
||||
from twilio.rest.numbers.v2.regulatory_compliance.bundle.item_assignment import (
|
||||
ItemAssignmentList,
|
||||
)
|
||||
from twilio.rest.numbers.v2.regulatory_compliance.bundle.replace_items import (
|
||||
ReplaceItemsList,
|
||||
)
|
||||
|
||||
|
||||
class BundleInstance(InstanceResource):
|
||||
class EndUserType(object):
|
||||
INDIVIDUAL = "individual"
|
||||
BUSINESS = "business"
|
||||
|
||||
class SortBy(object):
|
||||
VALID_UNTIL = "valid-until"
|
||||
DATE_UPDATED = "date-updated"
|
||||
|
||||
class SortDirection(object):
|
||||
ASC = "ASC"
|
||||
DESC = "DESC"
|
||||
|
||||
class Status(object):
|
||||
DRAFT = "draft"
|
||||
PENDING_REVIEW = "pending-review"
|
||||
IN_REVIEW = "in-review"
|
||||
TWILIO_REJECTED = "twilio-rejected"
|
||||
TWILIO_APPROVED = "twilio-approved"
|
||||
PROVISIONALLY_APPROVED = "provisionally-approved"
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string that we created to identify the Bundle resource.
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource.
|
||||
:ivar regulation_sid: The unique string of a regulation that is associated to the Bundle resource.
|
||||
:ivar friendly_name: The string that you assigned to describe the resource.
|
||||
:ivar status:
|
||||
:ivar valid_until: The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until.
|
||||
:ivar email: The email address that will receive updates when the Bundle resource changes status.
|
||||
:ivar status_callback: The URL we call to inform your application of status changes.
|
||||
:ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
:ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
:ivar url: The absolute URL of the Bundle resource.
|
||||
:ivar links: The URLs of the Assigned Items of the Bundle resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.regulation_sid: Optional[str] = payload.get("regulation_sid")
|
||||
self.friendly_name: Optional[str] = payload.get("friendly_name")
|
||||
self.status: Optional["BundleInstance.Status"] = payload.get("status")
|
||||
self.valid_until: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("valid_until")
|
||||
)
|
||||
self.email: Optional[str] = payload.get("email")
|
||||
self.status_callback: Optional[str] = payload.get("status_callback")
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
self.date_updated: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_updated")
|
||||
)
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
self.links: Optional[Dict[str, object]] = payload.get("links")
|
||||
|
||||
self._solution = {
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[BundleContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "BundleContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: BundleContext for this BundleInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = BundleContext(
|
||||
self._version,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the BundleInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._proxy.delete()
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the BundleInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._proxy.delete_async()
|
||||
|
||||
def fetch(self) -> "BundleInstance":
|
||||
"""
|
||||
Fetch the BundleInstance
|
||||
|
||||
|
||||
:returns: The fetched BundleInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "BundleInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the BundleInstance
|
||||
|
||||
|
||||
:returns: The fetched BundleInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def update(
|
||||
self,
|
||||
status: Union["BundleInstance.Status", object] = values.unset,
|
||||
status_callback: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
email: Union[str, object] = values.unset,
|
||||
) -> "BundleInstance":
|
||||
"""
|
||||
Update the BundleInstance
|
||||
|
||||
:param status:
|
||||
:param status_callback: The URL we call to inform your application of status changes.
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param email: The email address that will receive updates when the Bundle resource changes status.
|
||||
|
||||
:returns: The updated BundleInstance
|
||||
"""
|
||||
return self._proxy.update(
|
||||
status=status,
|
||||
status_callback=status_callback,
|
||||
friendly_name=friendly_name,
|
||||
email=email,
|
||||
)
|
||||
|
||||
async def update_async(
|
||||
self,
|
||||
status: Union["BundleInstance.Status", object] = values.unset,
|
||||
status_callback: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
email: Union[str, object] = values.unset,
|
||||
) -> "BundleInstance":
|
||||
"""
|
||||
Asynchronous coroutine to update the BundleInstance
|
||||
|
||||
:param status:
|
||||
:param status_callback: The URL we call to inform your application of status changes.
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param email: The email address that will receive updates when the Bundle resource changes status.
|
||||
|
||||
:returns: The updated BundleInstance
|
||||
"""
|
||||
return await self._proxy.update_async(
|
||||
status=status,
|
||||
status_callback=status_callback,
|
||||
friendly_name=friendly_name,
|
||||
email=email,
|
||||
)
|
||||
|
||||
@property
|
||||
def bundle_copies(self) -> BundleCopyList:
|
||||
"""
|
||||
Access the bundle_copies
|
||||
"""
|
||||
return self._proxy.bundle_copies
|
||||
|
||||
@property
|
||||
def evaluations(self) -> EvaluationList:
|
||||
"""
|
||||
Access the evaluations
|
||||
"""
|
||||
return self._proxy.evaluations
|
||||
|
||||
@property
|
||||
def item_assignments(self) -> ItemAssignmentList:
|
||||
"""
|
||||
Access the item_assignments
|
||||
"""
|
||||
return self._proxy.item_assignments
|
||||
|
||||
@property
|
||||
def replace_items(self) -> ReplaceItemsList:
|
||||
"""
|
||||
Access the replace_items
|
||||
"""
|
||||
return self._proxy.replace_items
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.BundleInstance {}>".format(context)
|
||||
|
||||
|
||||
class BundleContext(InstanceContext):
|
||||
def __init__(self, version: Version, sid: str):
|
||||
"""
|
||||
Initialize the BundleContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param sid: The unique string that we created to identify the Bundle resource.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/RegulatoryCompliance/Bundles/{sid}".format(**self._solution)
|
||||
|
||||
self._bundle_copies: Optional[BundleCopyList] = None
|
||||
self._evaluations: Optional[EvaluationList] = None
|
||||
self._item_assignments: Optional[ItemAssignmentList] = None
|
||||
self._replace_items: Optional[ReplaceItemsList] = None
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the BundleInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._version.delete(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the BundleInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._version.delete_async(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
def fetch(self) -> BundleInstance:
|
||||
"""
|
||||
Fetch the BundleInstance
|
||||
|
||||
|
||||
:returns: The fetched BundleInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return BundleInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> BundleInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the BundleInstance
|
||||
|
||||
|
||||
:returns: The fetched BundleInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return BundleInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
def update(
|
||||
self,
|
||||
status: Union["BundleInstance.Status", object] = values.unset,
|
||||
status_callback: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
email: Union[str, object] = values.unset,
|
||||
) -> BundleInstance:
|
||||
"""
|
||||
Update the BundleInstance
|
||||
|
||||
:param status:
|
||||
:param status_callback: The URL we call to inform your application of status changes.
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param email: The email address that will receive updates when the Bundle resource changes status.
|
||||
|
||||
:returns: The updated BundleInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"Status": status,
|
||||
"StatusCallback": status_callback,
|
||||
"FriendlyName": friendly_name,
|
||||
"Email": email,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.update(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return BundleInstance(self._version, payload, sid=self._solution["sid"])
|
||||
|
||||
async def update_async(
|
||||
self,
|
||||
status: Union["BundleInstance.Status", object] = values.unset,
|
||||
status_callback: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
email: Union[str, object] = values.unset,
|
||||
) -> BundleInstance:
|
||||
"""
|
||||
Asynchronous coroutine to update the BundleInstance
|
||||
|
||||
:param status:
|
||||
:param status_callback: The URL we call to inform your application of status changes.
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param email: The email address that will receive updates when the Bundle resource changes status.
|
||||
|
||||
:returns: The updated BundleInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"Status": status,
|
||||
"StatusCallback": status_callback,
|
||||
"FriendlyName": friendly_name,
|
||||
"Email": email,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.update_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return BundleInstance(self._version, payload, sid=self._solution["sid"])
|
||||
|
||||
@property
|
||||
def bundle_copies(self) -> BundleCopyList:
|
||||
"""
|
||||
Access the bundle_copies
|
||||
"""
|
||||
if self._bundle_copies is None:
|
||||
self._bundle_copies = BundleCopyList(
|
||||
self._version,
|
||||
self._solution["sid"],
|
||||
)
|
||||
return self._bundle_copies
|
||||
|
||||
@property
|
||||
def evaluations(self) -> EvaluationList:
|
||||
"""
|
||||
Access the evaluations
|
||||
"""
|
||||
if self._evaluations is None:
|
||||
self._evaluations = EvaluationList(
|
||||
self._version,
|
||||
self._solution["sid"],
|
||||
)
|
||||
return self._evaluations
|
||||
|
||||
@property
|
||||
def item_assignments(self) -> ItemAssignmentList:
|
||||
"""
|
||||
Access the item_assignments
|
||||
"""
|
||||
if self._item_assignments is None:
|
||||
self._item_assignments = ItemAssignmentList(
|
||||
self._version,
|
||||
self._solution["sid"],
|
||||
)
|
||||
return self._item_assignments
|
||||
|
||||
@property
|
||||
def replace_items(self) -> ReplaceItemsList:
|
||||
"""
|
||||
Access the replace_items
|
||||
"""
|
||||
if self._replace_items is None:
|
||||
self._replace_items = ReplaceItemsList(
|
||||
self._version,
|
||||
self._solution["sid"],
|
||||
)
|
||||
return self._replace_items
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.BundleContext {}>".format(context)
|
||||
|
||||
|
||||
class BundlePage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> BundleInstance:
|
||||
"""
|
||||
Build an instance of BundleInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return BundleInstance(self._version, payload)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.BundlePage>"
|
||||
|
||||
|
||||
class BundleList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the BundleList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/RegulatoryCompliance/Bundles"
|
||||
|
||||
def create(
|
||||
self,
|
||||
friendly_name: str,
|
||||
email: str,
|
||||
status_callback: Union[str, object] = values.unset,
|
||||
regulation_sid: Union[str, object] = values.unset,
|
||||
iso_country: Union[str, object] = values.unset,
|
||||
end_user_type: Union["BundleInstance.EndUserType", object] = values.unset,
|
||||
number_type: Union[str, object] = values.unset,
|
||||
) -> BundleInstance:
|
||||
"""
|
||||
Create the BundleInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param email: The email address that will receive updates when the Bundle resource changes status.
|
||||
:param status_callback: The URL we call to inform your application of status changes.
|
||||
:param regulation_sid: The unique string of a regulation that is associated to the Bundle resource.
|
||||
:param iso_country: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle's phone number country ownership request.
|
||||
:param end_user_type:
|
||||
:param number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `toll free`.
|
||||
|
||||
:returns: The created BundleInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FriendlyName": friendly_name,
|
||||
"Email": email,
|
||||
"StatusCallback": status_callback,
|
||||
"RegulationSid": regulation_sid,
|
||||
"IsoCountry": iso_country,
|
||||
"EndUserType": end_user_type,
|
||||
"NumberType": number_type,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return BundleInstance(self._version, payload)
|
||||
|
||||
async def create_async(
|
||||
self,
|
||||
friendly_name: str,
|
||||
email: str,
|
||||
status_callback: Union[str, object] = values.unset,
|
||||
regulation_sid: Union[str, object] = values.unset,
|
||||
iso_country: Union[str, object] = values.unset,
|
||||
end_user_type: Union["BundleInstance.EndUserType", object] = values.unset,
|
||||
number_type: Union[str, object] = values.unset,
|
||||
) -> BundleInstance:
|
||||
"""
|
||||
Asynchronously create the BundleInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param email: The email address that will receive updates when the Bundle resource changes status.
|
||||
:param status_callback: The URL we call to inform your application of status changes.
|
||||
:param regulation_sid: The unique string of a regulation that is associated to the Bundle resource.
|
||||
:param iso_country: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle's phone number country ownership request.
|
||||
:param end_user_type:
|
||||
:param number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `toll free`.
|
||||
|
||||
:returns: The created BundleInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FriendlyName": friendly_name,
|
||||
"Email": email,
|
||||
"StatusCallback": status_callback,
|
||||
"RegulationSid": regulation_sid,
|
||||
"IsoCountry": iso_country,
|
||||
"EndUserType": end_user_type,
|
||||
"NumberType": number_type,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return BundleInstance(self._version, payload)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
status: Union["BundleInstance.Status", object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
regulation_sid: Union[str, object] = values.unset,
|
||||
iso_country: Union[str, object] = values.unset,
|
||||
number_type: Union[str, object] = values.unset,
|
||||
has_valid_until_date: Union[bool, object] = values.unset,
|
||||
sort_by: Union["BundleInstance.SortBy", object] = values.unset,
|
||||
sort_direction: Union["BundleInstance.SortDirection", object] = values.unset,
|
||||
valid_until_date: Union[datetime, object] = values.unset,
|
||||
valid_until_date_before: Union[datetime, object] = values.unset,
|
||||
valid_until_date_after: Union[datetime, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[BundleInstance]:
|
||||
"""
|
||||
Streams BundleInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param "BundleInstance.Status" status: The verification status of the Bundle resource. Please refer to [Bundle Statuses](https://www.twilio.com/docs/phone-numbers/regulatory/api/bundles#bundle-statuses) for more details.
|
||||
:param str friendly_name: The string that you assigned to describe the resource. The column can contain 255 variable characters.
|
||||
:param str regulation_sid: The unique string of a [Regulation resource](https://www.twilio.com/docs/phone-numbers/regulatory/api/regulations) that is associated to the Bundle resource.
|
||||
:param str iso_country: The 2-digit [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle's phone number country ownership request.
|
||||
:param str number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `tollfree`.
|
||||
:param bool has_valid_until_date: Indicates that the Bundle is a valid Bundle until a specified expiration date.
|
||||
:param "BundleInstance.SortBy" sort_by: Can be `valid-until` or `date-updated`. Defaults to `date-created`.
|
||||
:param "BundleInstance.SortDirection" sort_direction: Default is `DESC`. Can be `ASC` or `DESC`.
|
||||
:param datetime valid_until_date: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format.
|
||||
:param datetime valid_until_date_before: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format.
|
||||
:param datetime valid_until_date_after: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format.
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(
|
||||
status=status,
|
||||
friendly_name=friendly_name,
|
||||
regulation_sid=regulation_sid,
|
||||
iso_country=iso_country,
|
||||
number_type=number_type,
|
||||
has_valid_until_date=has_valid_until_date,
|
||||
sort_by=sort_by,
|
||||
sort_direction=sort_direction,
|
||||
valid_until_date=valid_until_date,
|
||||
valid_until_date_before=valid_until_date_before,
|
||||
valid_until_date_after=valid_until_date_after,
|
||||
page_size=limits["page_size"],
|
||||
)
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
status: Union["BundleInstance.Status", object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
regulation_sid: Union[str, object] = values.unset,
|
||||
iso_country: Union[str, object] = values.unset,
|
||||
number_type: Union[str, object] = values.unset,
|
||||
has_valid_until_date: Union[bool, object] = values.unset,
|
||||
sort_by: Union["BundleInstance.SortBy", object] = values.unset,
|
||||
sort_direction: Union["BundleInstance.SortDirection", object] = values.unset,
|
||||
valid_until_date: Union[datetime, object] = values.unset,
|
||||
valid_until_date_before: Union[datetime, object] = values.unset,
|
||||
valid_until_date_after: Union[datetime, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[BundleInstance]:
|
||||
"""
|
||||
Asynchronously streams BundleInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param "BundleInstance.Status" status: The verification status of the Bundle resource. Please refer to [Bundle Statuses](https://www.twilio.com/docs/phone-numbers/regulatory/api/bundles#bundle-statuses) for more details.
|
||||
:param str friendly_name: The string that you assigned to describe the resource. The column can contain 255 variable characters.
|
||||
:param str regulation_sid: The unique string of a [Regulation resource](https://www.twilio.com/docs/phone-numbers/regulatory/api/regulations) that is associated to the Bundle resource.
|
||||
:param str iso_country: The 2-digit [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle's phone number country ownership request.
|
||||
:param str number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `tollfree`.
|
||||
:param bool has_valid_until_date: Indicates that the Bundle is a valid Bundle until a specified expiration date.
|
||||
:param "BundleInstance.SortBy" sort_by: Can be `valid-until` or `date-updated`. Defaults to `date-created`.
|
||||
:param "BundleInstance.SortDirection" sort_direction: Default is `DESC`. Can be `ASC` or `DESC`.
|
||||
:param datetime valid_until_date: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format.
|
||||
:param datetime valid_until_date_before: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format.
|
||||
:param datetime valid_until_date_after: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format.
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(
|
||||
status=status,
|
||||
friendly_name=friendly_name,
|
||||
regulation_sid=regulation_sid,
|
||||
iso_country=iso_country,
|
||||
number_type=number_type,
|
||||
has_valid_until_date=has_valid_until_date,
|
||||
sort_by=sort_by,
|
||||
sort_direction=sort_direction,
|
||||
valid_until_date=valid_until_date,
|
||||
valid_until_date_before=valid_until_date_before,
|
||||
valid_until_date_after=valid_until_date_after,
|
||||
page_size=limits["page_size"],
|
||||
)
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
status: Union["BundleInstance.Status", object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
regulation_sid: Union[str, object] = values.unset,
|
||||
iso_country: Union[str, object] = values.unset,
|
||||
number_type: Union[str, object] = values.unset,
|
||||
has_valid_until_date: Union[bool, object] = values.unset,
|
||||
sort_by: Union["BundleInstance.SortBy", object] = values.unset,
|
||||
sort_direction: Union["BundleInstance.SortDirection", object] = values.unset,
|
||||
valid_until_date: Union[datetime, object] = values.unset,
|
||||
valid_until_date_before: Union[datetime, object] = values.unset,
|
||||
valid_until_date_after: Union[datetime, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[BundleInstance]:
|
||||
"""
|
||||
Lists BundleInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param "BundleInstance.Status" status: The verification status of the Bundle resource. Please refer to [Bundle Statuses](https://www.twilio.com/docs/phone-numbers/regulatory/api/bundles#bundle-statuses) for more details.
|
||||
:param str friendly_name: The string that you assigned to describe the resource. The column can contain 255 variable characters.
|
||||
:param str regulation_sid: The unique string of a [Regulation resource](https://www.twilio.com/docs/phone-numbers/regulatory/api/regulations) that is associated to the Bundle resource.
|
||||
:param str iso_country: The 2-digit [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle's phone number country ownership request.
|
||||
:param str number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `tollfree`.
|
||||
:param bool has_valid_until_date: Indicates that the Bundle is a valid Bundle until a specified expiration date.
|
||||
:param "BundleInstance.SortBy" sort_by: Can be `valid-until` or `date-updated`. Defaults to `date-created`.
|
||||
:param "BundleInstance.SortDirection" sort_direction: Default is `DESC`. Can be `ASC` or `DESC`.
|
||||
:param datetime valid_until_date: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format.
|
||||
:param datetime valid_until_date_before: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format.
|
||||
:param datetime valid_until_date_after: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format.
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
status=status,
|
||||
friendly_name=friendly_name,
|
||||
regulation_sid=regulation_sid,
|
||||
iso_country=iso_country,
|
||||
number_type=number_type,
|
||||
has_valid_until_date=has_valid_until_date,
|
||||
sort_by=sort_by,
|
||||
sort_direction=sort_direction,
|
||||
valid_until_date=valid_until_date,
|
||||
valid_until_date_before=valid_until_date_before,
|
||||
valid_until_date_after=valid_until_date_after,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
status: Union["BundleInstance.Status", object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
regulation_sid: Union[str, object] = values.unset,
|
||||
iso_country: Union[str, object] = values.unset,
|
||||
number_type: Union[str, object] = values.unset,
|
||||
has_valid_until_date: Union[bool, object] = values.unset,
|
||||
sort_by: Union["BundleInstance.SortBy", object] = values.unset,
|
||||
sort_direction: Union["BundleInstance.SortDirection", object] = values.unset,
|
||||
valid_until_date: Union[datetime, object] = values.unset,
|
||||
valid_until_date_before: Union[datetime, object] = values.unset,
|
||||
valid_until_date_after: Union[datetime, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[BundleInstance]:
|
||||
"""
|
||||
Asynchronously lists BundleInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param "BundleInstance.Status" status: The verification status of the Bundle resource. Please refer to [Bundle Statuses](https://www.twilio.com/docs/phone-numbers/regulatory/api/bundles#bundle-statuses) for more details.
|
||||
:param str friendly_name: The string that you assigned to describe the resource. The column can contain 255 variable characters.
|
||||
:param str regulation_sid: The unique string of a [Regulation resource](https://www.twilio.com/docs/phone-numbers/regulatory/api/regulations) that is associated to the Bundle resource.
|
||||
:param str iso_country: The 2-digit [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle's phone number country ownership request.
|
||||
:param str number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `tollfree`.
|
||||
:param bool has_valid_until_date: Indicates that the Bundle is a valid Bundle until a specified expiration date.
|
||||
:param "BundleInstance.SortBy" sort_by: Can be `valid-until` or `date-updated`. Defaults to `date-created`.
|
||||
:param "BundleInstance.SortDirection" sort_direction: Default is `DESC`. Can be `ASC` or `DESC`.
|
||||
:param datetime valid_until_date: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format.
|
||||
:param datetime valid_until_date_before: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format.
|
||||
:param datetime valid_until_date_after: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format.
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
status=status,
|
||||
friendly_name=friendly_name,
|
||||
regulation_sid=regulation_sid,
|
||||
iso_country=iso_country,
|
||||
number_type=number_type,
|
||||
has_valid_until_date=has_valid_until_date,
|
||||
sort_by=sort_by,
|
||||
sort_direction=sort_direction,
|
||||
valid_until_date=valid_until_date,
|
||||
valid_until_date_before=valid_until_date_before,
|
||||
valid_until_date_after=valid_until_date_after,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
status: Union["BundleInstance.Status", object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
regulation_sid: Union[str, object] = values.unset,
|
||||
iso_country: Union[str, object] = values.unset,
|
||||
number_type: Union[str, object] = values.unset,
|
||||
has_valid_until_date: Union[bool, object] = values.unset,
|
||||
sort_by: Union["BundleInstance.SortBy", object] = values.unset,
|
||||
sort_direction: Union["BundleInstance.SortDirection", object] = values.unset,
|
||||
valid_until_date: Union[datetime, object] = values.unset,
|
||||
valid_until_date_before: Union[datetime, object] = values.unset,
|
||||
valid_until_date_after: Union[datetime, object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> BundlePage:
|
||||
"""
|
||||
Retrieve a single page of BundleInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param status: The verification status of the Bundle resource. Please refer to [Bundle Statuses](https://www.twilio.com/docs/phone-numbers/regulatory/api/bundles#bundle-statuses) for more details.
|
||||
:param friendly_name: The string that you assigned to describe the resource. The column can contain 255 variable characters.
|
||||
:param regulation_sid: The unique string of a [Regulation resource](https://www.twilio.com/docs/phone-numbers/regulatory/api/regulations) that is associated to the Bundle resource.
|
||||
:param iso_country: The 2-digit [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle's phone number country ownership request.
|
||||
:param number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `tollfree`.
|
||||
:param has_valid_until_date: Indicates that the Bundle is a valid Bundle until a specified expiration date.
|
||||
:param sort_by: Can be `valid-until` or `date-updated`. Defaults to `date-created`.
|
||||
:param sort_direction: Default is `DESC`. Can be `ASC` or `DESC`.
|
||||
:param valid_until_date: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format.
|
||||
:param valid_until_date_before: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format.
|
||||
:param valid_until_date_after: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format.
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of BundleInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"Status": status,
|
||||
"FriendlyName": friendly_name,
|
||||
"RegulationSid": regulation_sid,
|
||||
"IsoCountry": iso_country,
|
||||
"NumberType": number_type,
|
||||
"HasValidUntilDate": has_valid_until_date,
|
||||
"SortBy": sort_by,
|
||||
"SortDirection": sort_direction,
|
||||
"ValidUntilDate": serialize.iso8601_datetime(valid_until_date),
|
||||
"ValidUntilDate<": serialize.iso8601_datetime(valid_until_date_before),
|
||||
"ValidUntilDate>": serialize.iso8601_datetime(valid_until_date_after),
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return BundlePage(self._version, response)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
status: Union["BundleInstance.Status", object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
regulation_sid: Union[str, object] = values.unset,
|
||||
iso_country: Union[str, object] = values.unset,
|
||||
number_type: Union[str, object] = values.unset,
|
||||
has_valid_until_date: Union[bool, object] = values.unset,
|
||||
sort_by: Union["BundleInstance.SortBy", object] = values.unset,
|
||||
sort_direction: Union["BundleInstance.SortDirection", object] = values.unset,
|
||||
valid_until_date: Union[datetime, object] = values.unset,
|
||||
valid_until_date_before: Union[datetime, object] = values.unset,
|
||||
valid_until_date_after: Union[datetime, object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> BundlePage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of BundleInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param status: The verification status of the Bundle resource. Please refer to [Bundle Statuses](https://www.twilio.com/docs/phone-numbers/regulatory/api/bundles#bundle-statuses) for more details.
|
||||
:param friendly_name: The string that you assigned to describe the resource. The column can contain 255 variable characters.
|
||||
:param regulation_sid: The unique string of a [Regulation resource](https://www.twilio.com/docs/phone-numbers/regulatory/api/regulations) that is associated to the Bundle resource.
|
||||
:param iso_country: The 2-digit [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Bundle's phone number country ownership request.
|
||||
:param number_type: The type of phone number of the Bundle's ownership request. Can be `local`, `mobile`, `national`, or `tollfree`.
|
||||
:param has_valid_until_date: Indicates that the Bundle is a valid Bundle until a specified expiration date.
|
||||
:param sort_by: Can be `valid-until` or `date-updated`. Defaults to `date-created`.
|
||||
:param sort_direction: Default is `DESC`. Can be `ASC` or `DESC`.
|
||||
:param valid_until_date: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format.
|
||||
:param valid_until_date_before: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format.
|
||||
:param valid_until_date_after: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format.
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of BundleInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"Status": status,
|
||||
"FriendlyName": friendly_name,
|
||||
"RegulationSid": regulation_sid,
|
||||
"IsoCountry": iso_country,
|
||||
"NumberType": number_type,
|
||||
"HasValidUntilDate": has_valid_until_date,
|
||||
"SortBy": sort_by,
|
||||
"SortDirection": sort_direction,
|
||||
"ValidUntilDate": serialize.iso8601_datetime(valid_until_date),
|
||||
"ValidUntilDate<": serialize.iso8601_datetime(valid_until_date_before),
|
||||
"ValidUntilDate>": serialize.iso8601_datetime(valid_until_date_after),
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return BundlePage(self._version, response)
|
||||
|
||||
def get_page(self, target_url: str) -> BundlePage:
|
||||
"""
|
||||
Retrieve a specific page of BundleInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of BundleInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return BundlePage(self._version, response)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> BundlePage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of BundleInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of BundleInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return BundlePage(self._version, response)
|
||||
|
||||
def get(self, sid: str) -> BundleContext:
|
||||
"""
|
||||
Constructs a BundleContext
|
||||
|
||||
:param sid: The unique string that we created to identify the Bundle resource.
|
||||
"""
|
||||
return BundleContext(self._version, sid=sid)
|
||||
|
||||
def __call__(self, sid: str) -> BundleContext:
|
||||
"""
|
||||
Constructs a BundleContext
|
||||
|
||||
:param sid: The unique string that we created to identify the Bundle resource.
|
||||
"""
|
||||
return BundleContext(self._version, sid=sid)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.BundleList>"
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+362
@@ -0,0 +1,362 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Numbers
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
|
||||
from twilio.base import deserialize, values
|
||||
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.page import Page
|
||||
|
||||
|
||||
class BundleCopyInstance(InstanceResource):
|
||||
class Status(object):
|
||||
DRAFT = "draft"
|
||||
PENDING_REVIEW = "pending-review"
|
||||
IN_REVIEW = "in-review"
|
||||
TWILIO_REJECTED = "twilio-rejected"
|
||||
TWILIO_APPROVED = "twilio-approved"
|
||||
PROVISIONALLY_APPROVED = "provisionally-approved"
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string that we created to identify the Bundle resource.
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource.
|
||||
:ivar regulation_sid: The unique string of a regulation that is associated to the Bundle resource.
|
||||
:ivar friendly_name: The string that you assigned to describe the resource.
|
||||
:ivar status:
|
||||
:ivar valid_until: The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until.
|
||||
:ivar email: The email address that will receive updates when the Bundle resource changes status.
|
||||
:ivar status_callback: The URL we call to inform your application of status changes.
|
||||
:ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
:ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
"""
|
||||
|
||||
def __init__(self, version: Version, payload: Dict[str, Any], bundle_sid: str):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.regulation_sid: Optional[str] = payload.get("regulation_sid")
|
||||
self.friendly_name: Optional[str] = payload.get("friendly_name")
|
||||
self.status: Optional["BundleCopyInstance.Status"] = payload.get("status")
|
||||
self.valid_until: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("valid_until")
|
||||
)
|
||||
self.email: Optional[str] = payload.get("email")
|
||||
self.status_callback: Optional[str] = payload.get("status_callback")
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
self.date_updated: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_updated")
|
||||
)
|
||||
|
||||
self._solution = {
|
||||
"bundle_sid": bundle_sid,
|
||||
}
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.BundleCopyInstance {}>".format(context)
|
||||
|
||||
|
||||
class BundleCopyPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> BundleCopyInstance:
|
||||
"""
|
||||
Build an instance of BundleCopyInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return BundleCopyInstance(
|
||||
self._version, payload, bundle_sid=self._solution["bundle_sid"]
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.BundleCopyPage>"
|
||||
|
||||
|
||||
class BundleCopyList(ListResource):
|
||||
def __init__(self, version: Version, bundle_sid: str):
|
||||
"""
|
||||
Initialize the BundleCopyList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param bundle_sid: The unique string that we created to identify the Bundle resource.
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"bundle_sid": bundle_sid,
|
||||
}
|
||||
self._uri = "/RegulatoryCompliance/Bundles/{bundle_sid}/Copies".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def create(
|
||||
self, friendly_name: Union[str, object] = values.unset
|
||||
) -> BundleCopyInstance:
|
||||
"""
|
||||
Create the BundleCopyInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the copied bundle.
|
||||
|
||||
:returns: The created BundleCopyInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FriendlyName": friendly_name,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return BundleCopyInstance(
|
||||
self._version, payload, bundle_sid=self._solution["bundle_sid"]
|
||||
)
|
||||
|
||||
async def create_async(
|
||||
self, friendly_name: Union[str, object] = values.unset
|
||||
) -> BundleCopyInstance:
|
||||
"""
|
||||
Asynchronously create the BundleCopyInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the copied bundle.
|
||||
|
||||
:returns: The created BundleCopyInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FriendlyName": friendly_name,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return BundleCopyInstance(
|
||||
self._version, payload, bundle_sid=self._solution["bundle_sid"]
|
||||
)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[BundleCopyInstance]:
|
||||
"""
|
||||
Streams BundleCopyInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[BundleCopyInstance]:
|
||||
"""
|
||||
Asynchronously streams BundleCopyInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[BundleCopyInstance]:
|
||||
"""
|
||||
Lists BundleCopyInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[BundleCopyInstance]:
|
||||
"""
|
||||
Asynchronously lists BundleCopyInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> BundleCopyPage:
|
||||
"""
|
||||
Retrieve a single page of BundleCopyInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of BundleCopyInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return BundleCopyPage(self._version, response, self._solution)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> BundleCopyPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of BundleCopyInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of BundleCopyInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return BundleCopyPage(self._version, response, self._solution)
|
||||
|
||||
def get_page(self, target_url: str) -> BundleCopyPage:
|
||||
"""
|
||||
Retrieve a specific page of BundleCopyInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of BundleCopyInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return BundleCopyPage(self._version, response, self._solution)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> BundleCopyPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of BundleCopyInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of BundleCopyInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return BundleCopyPage(self._version, response, self._solution)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.BundleCopyList>"
|
||||
+466
@@ -0,0 +1,466 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Numbers
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
|
||||
from twilio.base import deserialize, values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.page import Page
|
||||
|
||||
|
||||
class EvaluationInstance(InstanceResource):
|
||||
class Status(object):
|
||||
COMPLIANT = "compliant"
|
||||
NONCOMPLIANT = "noncompliant"
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string that identifies the Evaluation resource.
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource.
|
||||
:ivar regulation_sid: The unique string of a regulation that is associated to the Bundle resource.
|
||||
:ivar bundle_sid: The unique string that we created to identify the Bundle resource.
|
||||
:ivar status:
|
||||
:ivar results: The results of the Evaluation which includes the valid and invalid attributes.
|
||||
:ivar date_created:
|
||||
:ivar url:
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
bundle_sid: str,
|
||||
sid: Optional[str] = None,
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.regulation_sid: Optional[str] = payload.get("regulation_sid")
|
||||
self.bundle_sid: Optional[str] = payload.get("bundle_sid")
|
||||
self.status: Optional["EvaluationInstance.Status"] = payload.get("status")
|
||||
self.results: Optional[List[object]] = payload.get("results")
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"bundle_sid": bundle_sid,
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[EvaluationContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "EvaluationContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: EvaluationContext for this EvaluationInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = EvaluationContext(
|
||||
self._version,
|
||||
bundle_sid=self._solution["bundle_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "EvaluationInstance":
|
||||
"""
|
||||
Fetch the EvaluationInstance
|
||||
|
||||
|
||||
:returns: The fetched EvaluationInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "EvaluationInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the EvaluationInstance
|
||||
|
||||
|
||||
:returns: The fetched EvaluationInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.EvaluationInstance {}>".format(context)
|
||||
|
||||
|
||||
class EvaluationContext(InstanceContext):
|
||||
def __init__(self, version: Version, bundle_sid: str, sid: str):
|
||||
"""
|
||||
Initialize the EvaluationContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param bundle_sid: The unique string that we created to identify the Bundle resource.
|
||||
:param sid: The unique string that identifies the Evaluation resource.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"bundle_sid": bundle_sid,
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = (
|
||||
"/RegulatoryCompliance/Bundles/{bundle_sid}/Evaluations/{sid}".format(
|
||||
**self._solution
|
||||
)
|
||||
)
|
||||
|
||||
def fetch(self) -> EvaluationInstance:
|
||||
"""
|
||||
Fetch the EvaluationInstance
|
||||
|
||||
|
||||
:returns: The fetched EvaluationInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return EvaluationInstance(
|
||||
self._version,
|
||||
payload,
|
||||
bundle_sid=self._solution["bundle_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> EvaluationInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the EvaluationInstance
|
||||
|
||||
|
||||
:returns: The fetched EvaluationInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return EvaluationInstance(
|
||||
self._version,
|
||||
payload,
|
||||
bundle_sid=self._solution["bundle_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.EvaluationContext {}>".format(context)
|
||||
|
||||
|
||||
class EvaluationPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> EvaluationInstance:
|
||||
"""
|
||||
Build an instance of EvaluationInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return EvaluationInstance(
|
||||
self._version, payload, bundle_sid=self._solution["bundle_sid"]
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.EvaluationPage>"
|
||||
|
||||
|
||||
class EvaluationList(ListResource):
|
||||
def __init__(self, version: Version, bundle_sid: str):
|
||||
"""
|
||||
Initialize the EvaluationList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param bundle_sid: The unique string that identifies the Bundle resource.
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"bundle_sid": bundle_sid,
|
||||
}
|
||||
self._uri = "/RegulatoryCompliance/Bundles/{bundle_sid}/Evaluations".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def create(self) -> EvaluationInstance:
|
||||
"""
|
||||
Create the EvaluationInstance
|
||||
|
||||
|
||||
:returns: The created EvaluationInstance
|
||||
"""
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return EvaluationInstance(
|
||||
self._version, payload, bundle_sid=self._solution["bundle_sid"]
|
||||
)
|
||||
|
||||
async def create_async(self) -> EvaluationInstance:
|
||||
"""
|
||||
Asynchronously create the EvaluationInstance
|
||||
|
||||
|
||||
:returns: The created EvaluationInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return EvaluationInstance(
|
||||
self._version, payload, bundle_sid=self._solution["bundle_sid"]
|
||||
)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[EvaluationInstance]:
|
||||
"""
|
||||
Streams EvaluationInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[EvaluationInstance]:
|
||||
"""
|
||||
Asynchronously streams EvaluationInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[EvaluationInstance]:
|
||||
"""
|
||||
Lists EvaluationInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[EvaluationInstance]:
|
||||
"""
|
||||
Asynchronously lists EvaluationInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> EvaluationPage:
|
||||
"""
|
||||
Retrieve a single page of EvaluationInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of EvaluationInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return EvaluationPage(self._version, response, self._solution)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> EvaluationPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of EvaluationInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of EvaluationInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return EvaluationPage(self._version, response, self._solution)
|
||||
|
||||
def get_page(self, target_url: str) -> EvaluationPage:
|
||||
"""
|
||||
Retrieve a specific page of EvaluationInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of EvaluationInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return EvaluationPage(self._version, response, self._solution)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> EvaluationPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of EvaluationInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of EvaluationInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return EvaluationPage(self._version, response, self._solution)
|
||||
|
||||
def get(self, sid: str) -> EvaluationContext:
|
||||
"""
|
||||
Constructs a EvaluationContext
|
||||
|
||||
:param sid: The unique string that identifies the Evaluation resource.
|
||||
"""
|
||||
return EvaluationContext(
|
||||
self._version, bundle_sid=self._solution["bundle_sid"], sid=sid
|
||||
)
|
||||
|
||||
def __call__(self, sid: str) -> EvaluationContext:
|
||||
"""
|
||||
Constructs a EvaluationContext
|
||||
|
||||
:param sid: The unique string that identifies the Evaluation resource.
|
||||
"""
|
||||
return EvaluationContext(
|
||||
self._version, bundle_sid=self._solution["bundle_sid"], sid=sid
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.EvaluationList>"
|
||||
+515
@@ -0,0 +1,515 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Numbers
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
|
||||
from twilio.base import deserialize, values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.page import Page
|
||||
|
||||
|
||||
class ItemAssignmentInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string that we created to identify the Item Assignment resource.
|
||||
:ivar bundle_sid: The unique string that we created to identify the Bundle resource.
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource.
|
||||
:ivar object_sid: The SID of an object bag that holds information of the different items.
|
||||
:ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
:ivar url: The absolute URL of the Identity resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
bundle_sid: str,
|
||||
sid: Optional[str] = None,
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.bundle_sid: Optional[str] = payload.get("bundle_sid")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.object_sid: Optional[str] = payload.get("object_sid")
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"bundle_sid": bundle_sid,
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[ItemAssignmentContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "ItemAssignmentContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: ItemAssignmentContext for this ItemAssignmentInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = ItemAssignmentContext(
|
||||
self._version,
|
||||
bundle_sid=self._solution["bundle_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the ItemAssignmentInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._proxy.delete()
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the ItemAssignmentInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._proxy.delete_async()
|
||||
|
||||
def fetch(self) -> "ItemAssignmentInstance":
|
||||
"""
|
||||
Fetch the ItemAssignmentInstance
|
||||
|
||||
|
||||
:returns: The fetched ItemAssignmentInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "ItemAssignmentInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the ItemAssignmentInstance
|
||||
|
||||
|
||||
:returns: The fetched ItemAssignmentInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.ItemAssignmentInstance {}>".format(context)
|
||||
|
||||
|
||||
class ItemAssignmentContext(InstanceContext):
|
||||
def __init__(self, version: Version, bundle_sid: str, sid: str):
|
||||
"""
|
||||
Initialize the ItemAssignmentContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param bundle_sid: The unique string that we created to identify the Bundle resource.
|
||||
:param sid: The unique string that we created to identify the Identity resource.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"bundle_sid": bundle_sid,
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = (
|
||||
"/RegulatoryCompliance/Bundles/{bundle_sid}/ItemAssignments/{sid}".format(
|
||||
**self._solution
|
||||
)
|
||||
)
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the ItemAssignmentInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._version.delete(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the ItemAssignmentInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._version.delete_async(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
def fetch(self) -> ItemAssignmentInstance:
|
||||
"""
|
||||
Fetch the ItemAssignmentInstance
|
||||
|
||||
|
||||
:returns: The fetched ItemAssignmentInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return ItemAssignmentInstance(
|
||||
self._version,
|
||||
payload,
|
||||
bundle_sid=self._solution["bundle_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> ItemAssignmentInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the ItemAssignmentInstance
|
||||
|
||||
|
||||
:returns: The fetched ItemAssignmentInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return ItemAssignmentInstance(
|
||||
self._version,
|
||||
payload,
|
||||
bundle_sid=self._solution["bundle_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.ItemAssignmentContext {}>".format(context)
|
||||
|
||||
|
||||
class ItemAssignmentPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> ItemAssignmentInstance:
|
||||
"""
|
||||
Build an instance of ItemAssignmentInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return ItemAssignmentInstance(
|
||||
self._version, payload, bundle_sid=self._solution["bundle_sid"]
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.ItemAssignmentPage>"
|
||||
|
||||
|
||||
class ItemAssignmentList(ListResource):
|
||||
def __init__(self, version: Version, bundle_sid: str):
|
||||
"""
|
||||
Initialize the ItemAssignmentList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param bundle_sid: The unique string that we created to identify the Bundle resource.
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"bundle_sid": bundle_sid,
|
||||
}
|
||||
self._uri = "/RegulatoryCompliance/Bundles/{bundle_sid}/ItemAssignments".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def create(self, object_sid: str) -> ItemAssignmentInstance:
|
||||
"""
|
||||
Create the ItemAssignmentInstance
|
||||
|
||||
:param object_sid: The SID of an object bag that holds information of the different items.
|
||||
|
||||
:returns: The created ItemAssignmentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"ObjectSid": object_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return ItemAssignmentInstance(
|
||||
self._version, payload, bundle_sid=self._solution["bundle_sid"]
|
||||
)
|
||||
|
||||
async def create_async(self, object_sid: str) -> ItemAssignmentInstance:
|
||||
"""
|
||||
Asynchronously create the ItemAssignmentInstance
|
||||
|
||||
:param object_sid: The SID of an object bag that holds information of the different items.
|
||||
|
||||
:returns: The created ItemAssignmentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"ObjectSid": object_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return ItemAssignmentInstance(
|
||||
self._version, payload, bundle_sid=self._solution["bundle_sid"]
|
||||
)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[ItemAssignmentInstance]:
|
||||
"""
|
||||
Streams ItemAssignmentInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[ItemAssignmentInstance]:
|
||||
"""
|
||||
Asynchronously streams ItemAssignmentInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[ItemAssignmentInstance]:
|
||||
"""
|
||||
Lists ItemAssignmentInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[ItemAssignmentInstance]:
|
||||
"""
|
||||
Asynchronously lists ItemAssignmentInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> ItemAssignmentPage:
|
||||
"""
|
||||
Retrieve a single page of ItemAssignmentInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of ItemAssignmentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return ItemAssignmentPage(self._version, response, self._solution)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> ItemAssignmentPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of ItemAssignmentInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of ItemAssignmentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return ItemAssignmentPage(self._version, response, self._solution)
|
||||
|
||||
def get_page(self, target_url: str) -> ItemAssignmentPage:
|
||||
"""
|
||||
Retrieve a specific page of ItemAssignmentInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of ItemAssignmentInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return ItemAssignmentPage(self._version, response, self._solution)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> ItemAssignmentPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of ItemAssignmentInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of ItemAssignmentInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return ItemAssignmentPage(self._version, response, self._solution)
|
||||
|
||||
def get(self, sid: str) -> ItemAssignmentContext:
|
||||
"""
|
||||
Constructs a ItemAssignmentContext
|
||||
|
||||
:param sid: The unique string that we created to identify the Identity resource.
|
||||
"""
|
||||
return ItemAssignmentContext(
|
||||
self._version, bundle_sid=self._solution["bundle_sid"], sid=sid
|
||||
)
|
||||
|
||||
def __call__(self, sid: str) -> ItemAssignmentContext:
|
||||
"""
|
||||
Constructs a ItemAssignmentContext
|
||||
|
||||
:param sid: The unique string that we created to identify the Identity resource.
|
||||
"""
|
||||
return ItemAssignmentContext(
|
||||
self._version, bundle_sid=self._solution["bundle_sid"], sid=sid
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.ItemAssignmentList>"
|
||||
+154
@@ -0,0 +1,154 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Numbers
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, Optional
|
||||
from twilio.base import deserialize, values
|
||||
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
|
||||
|
||||
class ReplaceItemsInstance(InstanceResource):
|
||||
class Status(object):
|
||||
DRAFT = "draft"
|
||||
PENDING_REVIEW = "pending-review"
|
||||
IN_REVIEW = "in-review"
|
||||
TWILIO_REJECTED = "twilio-rejected"
|
||||
TWILIO_APPROVED = "twilio-approved"
|
||||
PROVISIONALLY_APPROVED = "provisionally-approved"
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string that we created to identify the Bundle resource.
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource.
|
||||
:ivar regulation_sid: The unique string of a regulation that is associated to the Bundle resource.
|
||||
:ivar friendly_name: The string that you assigned to describe the resource.
|
||||
:ivar status:
|
||||
:ivar valid_until: The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until.
|
||||
:ivar email: The email address that will receive updates when the Bundle resource changes status.
|
||||
:ivar status_callback: The URL we call to inform your application of status changes.
|
||||
:ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
:ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
"""
|
||||
|
||||
def __init__(self, version: Version, payload: Dict[str, Any], bundle_sid: str):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.regulation_sid: Optional[str] = payload.get("regulation_sid")
|
||||
self.friendly_name: Optional[str] = payload.get("friendly_name")
|
||||
self.status: Optional["ReplaceItemsInstance.Status"] = payload.get("status")
|
||||
self.valid_until: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("valid_until")
|
||||
)
|
||||
self.email: Optional[str] = payload.get("email")
|
||||
self.status_callback: Optional[str] = payload.get("status_callback")
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
self.date_updated: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_updated")
|
||||
)
|
||||
|
||||
self._solution = {
|
||||
"bundle_sid": bundle_sid,
|
||||
}
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.ReplaceItemsInstance {}>".format(context)
|
||||
|
||||
|
||||
class ReplaceItemsList(ListResource):
|
||||
def __init__(self, version: Version, bundle_sid: str):
|
||||
"""
|
||||
Initialize the ReplaceItemsList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param bundle_sid: The unique string that identifies the Bundle where the item assignments are going to be replaced.
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"bundle_sid": bundle_sid,
|
||||
}
|
||||
self._uri = "/RegulatoryCompliance/Bundles/{bundle_sid}/ReplaceItems".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def create(self, from_bundle_sid: str) -> ReplaceItemsInstance:
|
||||
"""
|
||||
Create the ReplaceItemsInstance
|
||||
|
||||
:param from_bundle_sid: The source bundle sid to copy the item assignments from.
|
||||
|
||||
:returns: The created ReplaceItemsInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FromBundleSid": from_bundle_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return ReplaceItemsInstance(
|
||||
self._version, payload, bundle_sid=self._solution["bundle_sid"]
|
||||
)
|
||||
|
||||
async def create_async(self, from_bundle_sid: str) -> ReplaceItemsInstance:
|
||||
"""
|
||||
Asynchronously create the ReplaceItemsInstance
|
||||
|
||||
:param from_bundle_sid: The source bundle sid to copy the item assignments from.
|
||||
|
||||
:returns: The created ReplaceItemsInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FromBundleSid": from_bundle_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return ReplaceItemsInstance(
|
||||
self._version, payload, bundle_sid=self._solution["bundle_sid"]
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.ReplaceItemsList>"
|
||||
+603
@@ -0,0 +1,603 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Numbers
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
|
||||
from twilio.base import deserialize, serialize, values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.page import Page
|
||||
|
||||
|
||||
class EndUserInstance(InstanceResource):
|
||||
class Type(object):
|
||||
INDIVIDUAL = "individual"
|
||||
BUSINESS = "business"
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string created by Twilio to identify the End User resource.
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the End User resource.
|
||||
:ivar friendly_name: The string that you assigned to describe the resource.
|
||||
:ivar type:
|
||||
:ivar attributes: The set of parameters that are the attributes of the End Users resource which are listed in the End User Types.
|
||||
:ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
:ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
:ivar url: The absolute URL of the End User resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.friendly_name: Optional[str] = payload.get("friendly_name")
|
||||
self.type: Optional["EndUserInstance.Type"] = payload.get("type")
|
||||
self.attributes: Optional[Dict[str, object]] = payload.get("attributes")
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
self.date_updated: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_updated")
|
||||
)
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[EndUserContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "EndUserContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: EndUserContext for this EndUserInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = EndUserContext(
|
||||
self._version,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the EndUserInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._proxy.delete()
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the EndUserInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._proxy.delete_async()
|
||||
|
||||
def fetch(self) -> "EndUserInstance":
|
||||
"""
|
||||
Fetch the EndUserInstance
|
||||
|
||||
|
||||
:returns: The fetched EndUserInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "EndUserInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the EndUserInstance
|
||||
|
||||
|
||||
:returns: The fetched EndUserInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def update(
|
||||
self,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
attributes: Union[object, object] = values.unset,
|
||||
) -> "EndUserInstance":
|
||||
"""
|
||||
Update the EndUserInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param attributes: The set of parameters that are the attributes of the End User resource which are derived End User Types.
|
||||
|
||||
:returns: The updated EndUserInstance
|
||||
"""
|
||||
return self._proxy.update(
|
||||
friendly_name=friendly_name,
|
||||
attributes=attributes,
|
||||
)
|
||||
|
||||
async def update_async(
|
||||
self,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
attributes: Union[object, object] = values.unset,
|
||||
) -> "EndUserInstance":
|
||||
"""
|
||||
Asynchronous coroutine to update the EndUserInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param attributes: The set of parameters that are the attributes of the End User resource which are derived End User Types.
|
||||
|
||||
:returns: The updated EndUserInstance
|
||||
"""
|
||||
return await self._proxy.update_async(
|
||||
friendly_name=friendly_name,
|
||||
attributes=attributes,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.EndUserInstance {}>".format(context)
|
||||
|
||||
|
||||
class EndUserContext(InstanceContext):
|
||||
def __init__(self, version: Version, sid: str):
|
||||
"""
|
||||
Initialize the EndUserContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param sid: The unique string created by Twilio to identify the End User resource.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/RegulatoryCompliance/EndUsers/{sid}".format(**self._solution)
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the EndUserInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._version.delete(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the EndUserInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._version.delete_async(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
def fetch(self) -> EndUserInstance:
|
||||
"""
|
||||
Fetch the EndUserInstance
|
||||
|
||||
|
||||
:returns: The fetched EndUserInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return EndUserInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> EndUserInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the EndUserInstance
|
||||
|
||||
|
||||
:returns: The fetched EndUserInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return EndUserInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
def update(
|
||||
self,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
attributes: Union[object, object] = values.unset,
|
||||
) -> EndUserInstance:
|
||||
"""
|
||||
Update the EndUserInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param attributes: The set of parameters that are the attributes of the End User resource which are derived End User Types.
|
||||
|
||||
:returns: The updated EndUserInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FriendlyName": friendly_name,
|
||||
"Attributes": serialize.object(attributes),
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.update(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return EndUserInstance(self._version, payload, sid=self._solution["sid"])
|
||||
|
||||
async def update_async(
|
||||
self,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
attributes: Union[object, object] = values.unset,
|
||||
) -> EndUserInstance:
|
||||
"""
|
||||
Asynchronous coroutine to update the EndUserInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param attributes: The set of parameters that are the attributes of the End User resource which are derived End User Types.
|
||||
|
||||
:returns: The updated EndUserInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FriendlyName": friendly_name,
|
||||
"Attributes": serialize.object(attributes),
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.update_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return EndUserInstance(self._version, payload, sid=self._solution["sid"])
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.EndUserContext {}>".format(context)
|
||||
|
||||
|
||||
class EndUserPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> EndUserInstance:
|
||||
"""
|
||||
Build an instance of EndUserInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return EndUserInstance(self._version, payload)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.EndUserPage>"
|
||||
|
||||
|
||||
class EndUserList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the EndUserList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/RegulatoryCompliance/EndUsers"
|
||||
|
||||
def create(
|
||||
self,
|
||||
friendly_name: str,
|
||||
type: "EndUserInstance.Type",
|
||||
attributes: Union[object, object] = values.unset,
|
||||
) -> EndUserInstance:
|
||||
"""
|
||||
Create the EndUserInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param type:
|
||||
:param attributes: The set of parameters that are the attributes of the End User resource which are derived End User Types.
|
||||
|
||||
:returns: The created EndUserInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FriendlyName": friendly_name,
|
||||
"Type": type,
|
||||
"Attributes": serialize.object(attributes),
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return EndUserInstance(self._version, payload)
|
||||
|
||||
async def create_async(
|
||||
self,
|
||||
friendly_name: str,
|
||||
type: "EndUserInstance.Type",
|
||||
attributes: Union[object, object] = values.unset,
|
||||
) -> EndUserInstance:
|
||||
"""
|
||||
Asynchronously create the EndUserInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param type:
|
||||
:param attributes: The set of parameters that are the attributes of the End User resource which are derived End User Types.
|
||||
|
||||
:returns: The created EndUserInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FriendlyName": friendly_name,
|
||||
"Type": type,
|
||||
"Attributes": serialize.object(attributes),
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return EndUserInstance(self._version, payload)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[EndUserInstance]:
|
||||
"""
|
||||
Streams EndUserInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[EndUserInstance]:
|
||||
"""
|
||||
Asynchronously streams EndUserInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[EndUserInstance]:
|
||||
"""
|
||||
Lists EndUserInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[EndUserInstance]:
|
||||
"""
|
||||
Asynchronously lists EndUserInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> EndUserPage:
|
||||
"""
|
||||
Retrieve a single page of EndUserInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of EndUserInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return EndUserPage(self._version, response)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> EndUserPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of EndUserInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of EndUserInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return EndUserPage(self._version, response)
|
||||
|
||||
def get_page(self, target_url: str) -> EndUserPage:
|
||||
"""
|
||||
Retrieve a specific page of EndUserInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of EndUserInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return EndUserPage(self._version, response)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> EndUserPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of EndUserInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of EndUserInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return EndUserPage(self._version, response)
|
||||
|
||||
def get(self, sid: str) -> EndUserContext:
|
||||
"""
|
||||
Constructs a EndUserContext
|
||||
|
||||
:param sid: The unique string created by Twilio to identify the End User resource.
|
||||
"""
|
||||
return EndUserContext(self._version, sid=sid)
|
||||
|
||||
def __call__(self, sid: str) -> EndUserContext:
|
||||
"""
|
||||
Constructs a EndUserContext
|
||||
|
||||
:param sid: The unique string created by Twilio to identify the End User resource.
|
||||
"""
|
||||
return EndUserContext(self._version, sid=sid)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.EndUserList>"
|
||||
+393
@@ -0,0 +1,393 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Numbers
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
|
||||
from twilio.base import values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.page import Page
|
||||
|
||||
|
||||
class EndUserTypeInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string that identifies the End-User Type resource.
|
||||
:ivar friendly_name: A human-readable description that is assigned to describe the End-User Type resource. Examples can include first name, last name, email, business name, etc
|
||||
:ivar machine_name: A machine-readable description of the End-User Type resource. Examples can include first_name, last_name, email, business_name, etc.
|
||||
:ivar fields: The required information for creating an End-User. The required fields will change as regulatory needs change and will differ for businesses and individuals.
|
||||
:ivar url: The absolute URL of the End-User Type resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.friendly_name: Optional[str] = payload.get("friendly_name")
|
||||
self.machine_name: Optional[str] = payload.get("machine_name")
|
||||
self.fields: Optional[List[object]] = payload.get("fields")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[EndUserTypeContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "EndUserTypeContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: EndUserTypeContext for this EndUserTypeInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = EndUserTypeContext(
|
||||
self._version,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "EndUserTypeInstance":
|
||||
"""
|
||||
Fetch the EndUserTypeInstance
|
||||
|
||||
|
||||
:returns: The fetched EndUserTypeInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "EndUserTypeInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the EndUserTypeInstance
|
||||
|
||||
|
||||
:returns: The fetched EndUserTypeInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.EndUserTypeInstance {}>".format(context)
|
||||
|
||||
|
||||
class EndUserTypeContext(InstanceContext):
|
||||
def __init__(self, version: Version, sid: str):
|
||||
"""
|
||||
Initialize the EndUserTypeContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param sid: The unique string that identifies the End-User Type resource.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/RegulatoryCompliance/EndUserTypes/{sid}".format(**self._solution)
|
||||
|
||||
def fetch(self) -> EndUserTypeInstance:
|
||||
"""
|
||||
Fetch the EndUserTypeInstance
|
||||
|
||||
|
||||
:returns: The fetched EndUserTypeInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return EndUserTypeInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> EndUserTypeInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the EndUserTypeInstance
|
||||
|
||||
|
||||
:returns: The fetched EndUserTypeInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return EndUserTypeInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.EndUserTypeContext {}>".format(context)
|
||||
|
||||
|
||||
class EndUserTypePage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> EndUserTypeInstance:
|
||||
"""
|
||||
Build an instance of EndUserTypeInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return EndUserTypeInstance(self._version, payload)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.EndUserTypePage>"
|
||||
|
||||
|
||||
class EndUserTypeList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the EndUserTypeList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/RegulatoryCompliance/EndUserTypes"
|
||||
|
||||
def stream(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[EndUserTypeInstance]:
|
||||
"""
|
||||
Streams EndUserTypeInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[EndUserTypeInstance]:
|
||||
"""
|
||||
Asynchronously streams EndUserTypeInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[EndUserTypeInstance]:
|
||||
"""
|
||||
Lists EndUserTypeInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[EndUserTypeInstance]:
|
||||
"""
|
||||
Asynchronously lists EndUserTypeInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> EndUserTypePage:
|
||||
"""
|
||||
Retrieve a single page of EndUserTypeInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of EndUserTypeInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return EndUserTypePage(self._version, response)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> EndUserTypePage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of EndUserTypeInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of EndUserTypeInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return EndUserTypePage(self._version, response)
|
||||
|
||||
def get_page(self, target_url: str) -> EndUserTypePage:
|
||||
"""
|
||||
Retrieve a specific page of EndUserTypeInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of EndUserTypeInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return EndUserTypePage(self._version, response)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> EndUserTypePage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of EndUserTypeInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of EndUserTypeInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return EndUserTypePage(self._version, response)
|
||||
|
||||
def get(self, sid: str) -> EndUserTypeContext:
|
||||
"""
|
||||
Constructs a EndUserTypeContext
|
||||
|
||||
:param sid: The unique string that identifies the End-User Type resource.
|
||||
"""
|
||||
return EndUserTypeContext(self._version, sid=sid)
|
||||
|
||||
def __call__(self, sid: str) -> EndUserTypeContext:
|
||||
"""
|
||||
Constructs a EndUserTypeContext
|
||||
|
||||
:param sid: The unique string that identifies the End-User Type resource.
|
||||
"""
|
||||
return EndUserTypeContext(self._version, sid=sid)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.EndUserTypeList>"
|
||||
+460
@@ -0,0 +1,460 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Numbers
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
|
||||
from twilio.base import values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.page import Page
|
||||
|
||||
|
||||
class RegulationInstance(InstanceResource):
|
||||
class EndUserType(object):
|
||||
INDIVIDUAL = "individual"
|
||||
BUSINESS = "business"
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string that identifies the Regulation resource.
|
||||
:ivar friendly_name: A human-readable description that is assigned to describe the Regulation resource. Examples can include Germany: Mobile - Business.
|
||||
:ivar iso_country: The ISO country code of the phone number's country.
|
||||
:ivar number_type: The type of phone number restricted by the regulatory requirement. For example, Germany mobile phone numbers provisioned by businesses require a business name with commercial register proof from the Handelsregisterauszug and a proof of address from Handelsregisterauszug or a trade license by Gewerbeanmeldung.
|
||||
:ivar end_user_type:
|
||||
:ivar requirements: The SID of an object that holds the regulatory information of the phone number country, phone number type, and end user type.
|
||||
:ivar url: The absolute URL of the Regulation resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.friendly_name: Optional[str] = payload.get("friendly_name")
|
||||
self.iso_country: Optional[str] = payload.get("iso_country")
|
||||
self.number_type: Optional[str] = payload.get("number_type")
|
||||
self.end_user_type: Optional["RegulationInstance.EndUserType"] = payload.get(
|
||||
"end_user_type"
|
||||
)
|
||||
self.requirements: Optional[Dict[str, object]] = payload.get("requirements")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[RegulationContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "RegulationContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: RegulationContext for this RegulationInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = RegulationContext(
|
||||
self._version,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "RegulationInstance":
|
||||
"""
|
||||
Fetch the RegulationInstance
|
||||
|
||||
|
||||
:returns: The fetched RegulationInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "RegulationInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the RegulationInstance
|
||||
|
||||
|
||||
:returns: The fetched RegulationInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.RegulationInstance {}>".format(context)
|
||||
|
||||
|
||||
class RegulationContext(InstanceContext):
|
||||
def __init__(self, version: Version, sid: str):
|
||||
"""
|
||||
Initialize the RegulationContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param sid: The unique string that identifies the Regulation resource.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/RegulatoryCompliance/Regulations/{sid}".format(**self._solution)
|
||||
|
||||
def fetch(self) -> RegulationInstance:
|
||||
"""
|
||||
Fetch the RegulationInstance
|
||||
|
||||
|
||||
:returns: The fetched RegulationInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return RegulationInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> RegulationInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the RegulationInstance
|
||||
|
||||
|
||||
:returns: The fetched RegulationInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return RegulationInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.RegulationContext {}>".format(context)
|
||||
|
||||
|
||||
class RegulationPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> RegulationInstance:
|
||||
"""
|
||||
Build an instance of RegulationInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return RegulationInstance(self._version, payload)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.RegulationPage>"
|
||||
|
||||
|
||||
class RegulationList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the RegulationList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/RegulatoryCompliance/Regulations"
|
||||
|
||||
def stream(
|
||||
self,
|
||||
end_user_type: Union["RegulationInstance.EndUserType", object] = values.unset,
|
||||
iso_country: Union[str, object] = values.unset,
|
||||
number_type: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[RegulationInstance]:
|
||||
"""
|
||||
Streams RegulationInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param "RegulationInstance.EndUserType" end_user_type: The type of End User the regulation requires - can be `individual` or `business`.
|
||||
:param str iso_country: The ISO country code of the phone number's country.
|
||||
:param str number_type: The type of phone number that the regulatory requiremnt is restricting.
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(
|
||||
end_user_type=end_user_type,
|
||||
iso_country=iso_country,
|
||||
number_type=number_type,
|
||||
page_size=limits["page_size"],
|
||||
)
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
end_user_type: Union["RegulationInstance.EndUserType", object] = values.unset,
|
||||
iso_country: Union[str, object] = values.unset,
|
||||
number_type: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[RegulationInstance]:
|
||||
"""
|
||||
Asynchronously streams RegulationInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param "RegulationInstance.EndUserType" end_user_type: The type of End User the regulation requires - can be `individual` or `business`.
|
||||
:param str iso_country: The ISO country code of the phone number's country.
|
||||
:param str number_type: The type of phone number that the regulatory requiremnt is restricting.
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(
|
||||
end_user_type=end_user_type,
|
||||
iso_country=iso_country,
|
||||
number_type=number_type,
|
||||
page_size=limits["page_size"],
|
||||
)
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
end_user_type: Union["RegulationInstance.EndUserType", object] = values.unset,
|
||||
iso_country: Union[str, object] = values.unset,
|
||||
number_type: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[RegulationInstance]:
|
||||
"""
|
||||
Lists RegulationInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param "RegulationInstance.EndUserType" end_user_type: The type of End User the regulation requires - can be `individual` or `business`.
|
||||
:param str iso_country: The ISO country code of the phone number's country.
|
||||
:param str number_type: The type of phone number that the regulatory requiremnt is restricting.
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
end_user_type=end_user_type,
|
||||
iso_country=iso_country,
|
||||
number_type=number_type,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
end_user_type: Union["RegulationInstance.EndUserType", object] = values.unset,
|
||||
iso_country: Union[str, object] = values.unset,
|
||||
number_type: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[RegulationInstance]:
|
||||
"""
|
||||
Asynchronously lists RegulationInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param "RegulationInstance.EndUserType" end_user_type: The type of End User the regulation requires - can be `individual` or `business`.
|
||||
:param str iso_country: The ISO country code of the phone number's country.
|
||||
:param str number_type: The type of phone number that the regulatory requiremnt is restricting.
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
end_user_type=end_user_type,
|
||||
iso_country=iso_country,
|
||||
number_type=number_type,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
end_user_type: Union["RegulationInstance.EndUserType", object] = values.unset,
|
||||
iso_country: Union[str, object] = values.unset,
|
||||
number_type: Union[str, object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> RegulationPage:
|
||||
"""
|
||||
Retrieve a single page of RegulationInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param end_user_type: The type of End User the regulation requires - can be `individual` or `business`.
|
||||
:param iso_country: The ISO country code of the phone number's country.
|
||||
:param number_type: The type of phone number that the regulatory requiremnt is restricting.
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of RegulationInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"EndUserType": end_user_type,
|
||||
"IsoCountry": iso_country,
|
||||
"NumberType": number_type,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return RegulationPage(self._version, response)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
end_user_type: Union["RegulationInstance.EndUserType", object] = values.unset,
|
||||
iso_country: Union[str, object] = values.unset,
|
||||
number_type: Union[str, object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> RegulationPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of RegulationInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param end_user_type: The type of End User the regulation requires - can be `individual` or `business`.
|
||||
:param iso_country: The ISO country code of the phone number's country.
|
||||
:param number_type: The type of phone number that the regulatory requiremnt is restricting.
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of RegulationInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"EndUserType": end_user_type,
|
||||
"IsoCountry": iso_country,
|
||||
"NumberType": number_type,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return RegulationPage(self._version, response)
|
||||
|
||||
def get_page(self, target_url: str) -> RegulationPage:
|
||||
"""
|
||||
Retrieve a specific page of RegulationInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of RegulationInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return RegulationPage(self._version, response)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> RegulationPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of RegulationInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of RegulationInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return RegulationPage(self._version, response)
|
||||
|
||||
def get(self, sid: str) -> RegulationContext:
|
||||
"""
|
||||
Constructs a RegulationContext
|
||||
|
||||
:param sid: The unique string that identifies the Regulation resource.
|
||||
"""
|
||||
return RegulationContext(self._version, sid=sid)
|
||||
|
||||
def __call__(self, sid: str) -> RegulationContext:
|
||||
"""
|
||||
Constructs a RegulationContext
|
||||
|
||||
:param sid: The unique string that identifies the Regulation resource.
|
||||
"""
|
||||
return RegulationContext(self._version, sid=sid)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.RegulationList>"
|
||||
+621
@@ -0,0 +1,621 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Numbers
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
|
||||
from twilio.base import deserialize, serialize, values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.page import Page
|
||||
|
||||
|
||||
class SupportingDocumentInstance(InstanceResource):
|
||||
class Status(object):
|
||||
DRAFT = "draft"
|
||||
PENDING_REVIEW = "pending-review"
|
||||
REJECTED = "rejected"
|
||||
APPROVED = "approved"
|
||||
EXPIRED = "expired"
|
||||
PROVISIONALLY_APPROVED = "provisionally-approved"
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string created by Twilio to identify the Supporting Document resource.
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Document resource.
|
||||
:ivar friendly_name: The string that you assigned to describe the resource.
|
||||
:ivar mime_type: The image type uploaded in the Supporting Document container.
|
||||
:ivar status:
|
||||
:ivar failure_reason: The failure reason of the Supporting Document Resource.
|
||||
:ivar type: The type of the Supporting Document.
|
||||
:ivar attributes: The set of parameters that are the attributes of the Supporting Documents resource which are listed in the Supporting Document Types.
|
||||
:ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
:ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
:ivar url: The absolute URL of the Supporting Document resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.friendly_name: Optional[str] = payload.get("friendly_name")
|
||||
self.mime_type: Optional[str] = payload.get("mime_type")
|
||||
self.status: Optional["SupportingDocumentInstance.Status"] = payload.get(
|
||||
"status"
|
||||
)
|
||||
self.failure_reason: Optional[str] = payload.get("failure_reason")
|
||||
self.type: Optional[str] = payload.get("type")
|
||||
self.attributes: Optional[Dict[str, object]] = payload.get("attributes")
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
self.date_updated: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_updated")
|
||||
)
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[SupportingDocumentContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "SupportingDocumentContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: SupportingDocumentContext for this SupportingDocumentInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = SupportingDocumentContext(
|
||||
self._version,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the SupportingDocumentInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._proxy.delete()
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the SupportingDocumentInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._proxy.delete_async()
|
||||
|
||||
def fetch(self) -> "SupportingDocumentInstance":
|
||||
"""
|
||||
Fetch the SupportingDocumentInstance
|
||||
|
||||
|
||||
:returns: The fetched SupportingDocumentInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "SupportingDocumentInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the SupportingDocumentInstance
|
||||
|
||||
|
||||
:returns: The fetched SupportingDocumentInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def update(
|
||||
self,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
attributes: Union[object, object] = values.unset,
|
||||
) -> "SupportingDocumentInstance":
|
||||
"""
|
||||
Update the SupportingDocumentInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param attributes: The set of parameters that are the attributes of the Supporting Document resource which are derived Supporting Document Types.
|
||||
|
||||
:returns: The updated SupportingDocumentInstance
|
||||
"""
|
||||
return self._proxy.update(
|
||||
friendly_name=friendly_name,
|
||||
attributes=attributes,
|
||||
)
|
||||
|
||||
async def update_async(
|
||||
self,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
attributes: Union[object, object] = values.unset,
|
||||
) -> "SupportingDocumentInstance":
|
||||
"""
|
||||
Asynchronous coroutine to update the SupportingDocumentInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param attributes: The set of parameters that are the attributes of the Supporting Document resource which are derived Supporting Document Types.
|
||||
|
||||
:returns: The updated SupportingDocumentInstance
|
||||
"""
|
||||
return await self._proxy.update_async(
|
||||
friendly_name=friendly_name,
|
||||
attributes=attributes,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.SupportingDocumentInstance {}>".format(context)
|
||||
|
||||
|
||||
class SupportingDocumentContext(InstanceContext):
|
||||
def __init__(self, version: Version, sid: str):
|
||||
"""
|
||||
Initialize the SupportingDocumentContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param sid: The unique string created by Twilio to identify the Supporting Document resource.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/RegulatoryCompliance/SupportingDocuments/{sid}".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the SupportingDocumentInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._version.delete(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the SupportingDocumentInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._version.delete_async(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
def fetch(self) -> SupportingDocumentInstance:
|
||||
"""
|
||||
Fetch the SupportingDocumentInstance
|
||||
|
||||
|
||||
:returns: The fetched SupportingDocumentInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return SupportingDocumentInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> SupportingDocumentInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the SupportingDocumentInstance
|
||||
|
||||
|
||||
:returns: The fetched SupportingDocumentInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return SupportingDocumentInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
def update(
|
||||
self,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
attributes: Union[object, object] = values.unset,
|
||||
) -> SupportingDocumentInstance:
|
||||
"""
|
||||
Update the SupportingDocumentInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param attributes: The set of parameters that are the attributes of the Supporting Document resource which are derived Supporting Document Types.
|
||||
|
||||
:returns: The updated SupportingDocumentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FriendlyName": friendly_name,
|
||||
"Attributes": serialize.object(attributes),
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.update(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return SupportingDocumentInstance(
|
||||
self._version, payload, sid=self._solution["sid"]
|
||||
)
|
||||
|
||||
async def update_async(
|
||||
self,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
attributes: Union[object, object] = values.unset,
|
||||
) -> SupportingDocumentInstance:
|
||||
"""
|
||||
Asynchronous coroutine to update the SupportingDocumentInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param attributes: The set of parameters that are the attributes of the Supporting Document resource which are derived Supporting Document Types.
|
||||
|
||||
:returns: The updated SupportingDocumentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FriendlyName": friendly_name,
|
||||
"Attributes": serialize.object(attributes),
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.update_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return SupportingDocumentInstance(
|
||||
self._version, payload, sid=self._solution["sid"]
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.SupportingDocumentContext {}>".format(context)
|
||||
|
||||
|
||||
class SupportingDocumentPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> SupportingDocumentInstance:
|
||||
"""
|
||||
Build an instance of SupportingDocumentInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return SupportingDocumentInstance(self._version, payload)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.SupportingDocumentPage>"
|
||||
|
||||
|
||||
class SupportingDocumentList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the SupportingDocumentList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/RegulatoryCompliance/SupportingDocuments"
|
||||
|
||||
def create(
|
||||
self,
|
||||
friendly_name: str,
|
||||
type: str,
|
||||
attributes: Union[object, object] = values.unset,
|
||||
) -> SupportingDocumentInstance:
|
||||
"""
|
||||
Create the SupportingDocumentInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param type: The type of the Supporting Document.
|
||||
:param attributes: The set of parameters that are the attributes of the Supporting Documents resource which are derived Supporting Document Types.
|
||||
|
||||
:returns: The created SupportingDocumentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FriendlyName": friendly_name,
|
||||
"Type": type,
|
||||
"Attributes": serialize.object(attributes),
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return SupportingDocumentInstance(self._version, payload)
|
||||
|
||||
async def create_async(
|
||||
self,
|
||||
friendly_name: str,
|
||||
type: str,
|
||||
attributes: Union[object, object] = values.unset,
|
||||
) -> SupportingDocumentInstance:
|
||||
"""
|
||||
Asynchronously create the SupportingDocumentInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param type: The type of the Supporting Document.
|
||||
:param attributes: The set of parameters that are the attributes of the Supporting Documents resource which are derived Supporting Document Types.
|
||||
|
||||
:returns: The created SupportingDocumentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FriendlyName": friendly_name,
|
||||
"Type": type,
|
||||
"Attributes": serialize.object(attributes),
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return SupportingDocumentInstance(self._version, payload)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[SupportingDocumentInstance]:
|
||||
"""
|
||||
Streams SupportingDocumentInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[SupportingDocumentInstance]:
|
||||
"""
|
||||
Asynchronously streams SupportingDocumentInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[SupportingDocumentInstance]:
|
||||
"""
|
||||
Lists SupportingDocumentInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[SupportingDocumentInstance]:
|
||||
"""
|
||||
Asynchronously lists SupportingDocumentInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> SupportingDocumentPage:
|
||||
"""
|
||||
Retrieve a single page of SupportingDocumentInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of SupportingDocumentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return SupportingDocumentPage(self._version, response)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> SupportingDocumentPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of SupportingDocumentInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of SupportingDocumentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return SupportingDocumentPage(self._version, response)
|
||||
|
||||
def get_page(self, target_url: str) -> SupportingDocumentPage:
|
||||
"""
|
||||
Retrieve a specific page of SupportingDocumentInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of SupportingDocumentInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return SupportingDocumentPage(self._version, response)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> SupportingDocumentPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of SupportingDocumentInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of SupportingDocumentInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return SupportingDocumentPage(self._version, response)
|
||||
|
||||
def get(self, sid: str) -> SupportingDocumentContext:
|
||||
"""
|
||||
Constructs a SupportingDocumentContext
|
||||
|
||||
:param sid: The unique string created by Twilio to identify the Supporting Document resource.
|
||||
"""
|
||||
return SupportingDocumentContext(self._version, sid=sid)
|
||||
|
||||
def __call__(self, sid: str) -> SupportingDocumentContext:
|
||||
"""
|
||||
Constructs a SupportingDocumentContext
|
||||
|
||||
:param sid: The unique string created by Twilio to identify the Supporting Document resource.
|
||||
"""
|
||||
return SupportingDocumentContext(self._version, sid=sid)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.SupportingDocumentList>"
|
||||
+395
@@ -0,0 +1,395 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Numbers
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
|
||||
from twilio.base import values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.page import Page
|
||||
|
||||
|
||||
class SupportingDocumentTypeInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string that identifies the Supporting Document Type resource.
|
||||
:ivar friendly_name: A human-readable description of the Supporting Document Type resource.
|
||||
:ivar machine_name: The machine-readable description of the Supporting Document Type resource.
|
||||
:ivar fields: The required information for creating a Supporting Document. The required fields will change as regulatory needs change and will differ for businesses and individuals.
|
||||
:ivar url: The absolute URL of the Supporting Document Type resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.friendly_name: Optional[str] = payload.get("friendly_name")
|
||||
self.machine_name: Optional[str] = payload.get("machine_name")
|
||||
self.fields: Optional[List[object]] = payload.get("fields")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[SupportingDocumentTypeContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "SupportingDocumentTypeContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: SupportingDocumentTypeContext for this SupportingDocumentTypeInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = SupportingDocumentTypeContext(
|
||||
self._version,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "SupportingDocumentTypeInstance":
|
||||
"""
|
||||
Fetch the SupportingDocumentTypeInstance
|
||||
|
||||
|
||||
:returns: The fetched SupportingDocumentTypeInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "SupportingDocumentTypeInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the SupportingDocumentTypeInstance
|
||||
|
||||
|
||||
:returns: The fetched SupportingDocumentTypeInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.SupportingDocumentTypeInstance {}>".format(context)
|
||||
|
||||
|
||||
class SupportingDocumentTypeContext(InstanceContext):
|
||||
def __init__(self, version: Version, sid: str):
|
||||
"""
|
||||
Initialize the SupportingDocumentTypeContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param sid: The unique string that identifies the Supporting Document Type resource.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/RegulatoryCompliance/SupportingDocumentTypes/{sid}".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def fetch(self) -> SupportingDocumentTypeInstance:
|
||||
"""
|
||||
Fetch the SupportingDocumentTypeInstance
|
||||
|
||||
|
||||
:returns: The fetched SupportingDocumentTypeInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return SupportingDocumentTypeInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> SupportingDocumentTypeInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the SupportingDocumentTypeInstance
|
||||
|
||||
|
||||
:returns: The fetched SupportingDocumentTypeInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return SupportingDocumentTypeInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Numbers.V2.SupportingDocumentTypeContext {}>".format(context)
|
||||
|
||||
|
||||
class SupportingDocumentTypePage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> SupportingDocumentTypeInstance:
|
||||
"""
|
||||
Build an instance of SupportingDocumentTypeInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return SupportingDocumentTypeInstance(self._version, payload)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.SupportingDocumentTypePage>"
|
||||
|
||||
|
||||
class SupportingDocumentTypeList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the SupportingDocumentTypeList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/RegulatoryCompliance/SupportingDocumentTypes"
|
||||
|
||||
def stream(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[SupportingDocumentTypeInstance]:
|
||||
"""
|
||||
Streams SupportingDocumentTypeInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[SupportingDocumentTypeInstance]:
|
||||
"""
|
||||
Asynchronously streams SupportingDocumentTypeInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[SupportingDocumentTypeInstance]:
|
||||
"""
|
||||
Lists SupportingDocumentTypeInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[SupportingDocumentTypeInstance]:
|
||||
"""
|
||||
Asynchronously lists SupportingDocumentTypeInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> SupportingDocumentTypePage:
|
||||
"""
|
||||
Retrieve a single page of SupportingDocumentTypeInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of SupportingDocumentTypeInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return SupportingDocumentTypePage(self._version, response)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> SupportingDocumentTypePage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of SupportingDocumentTypeInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of SupportingDocumentTypeInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return SupportingDocumentTypePage(self._version, response)
|
||||
|
||||
def get_page(self, target_url: str) -> SupportingDocumentTypePage:
|
||||
"""
|
||||
Retrieve a specific page of SupportingDocumentTypeInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of SupportingDocumentTypeInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return SupportingDocumentTypePage(self._version, response)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> SupportingDocumentTypePage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of SupportingDocumentTypeInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of SupportingDocumentTypeInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return SupportingDocumentTypePage(self._version, response)
|
||||
|
||||
def get(self, sid: str) -> SupportingDocumentTypeContext:
|
||||
"""
|
||||
Constructs a SupportingDocumentTypeContext
|
||||
|
||||
:param sid: The unique string that identifies the Supporting Document Type resource.
|
||||
"""
|
||||
return SupportingDocumentTypeContext(self._version, sid=sid)
|
||||
|
||||
def __call__(self, sid: str) -> SupportingDocumentTypeContext:
|
||||
"""
|
||||
Constructs a SupportingDocumentTypeContext
|
||||
|
||||
:param sid: The unique string that identifies the Supporting Document Type resource.
|
||||
"""
|
||||
return SupportingDocumentTypeContext(self._version, sid=sid)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Numbers.V2.SupportingDocumentTypeList>"
|
||||
Reference in New Issue
Block a user