Initial commit: Email alerts application

This commit is contained in:
Iyeoluwa Akinrinola
2025-07-25 11:31:36 +01:00
commit adfb625ae9
6322 changed files with 2882826 additions and 0 deletions
@@ -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>"
@@ -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 numbers 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>"