Initial commit: Email alerts application
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
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.messaging.v1 import V1
|
||||
|
||||
|
||||
class MessagingBase(Domain):
|
||||
def __init__(self, twilio: Client):
|
||||
"""
|
||||
Initialize the Messaging Domain
|
||||
|
||||
:returns: Domain for Messaging
|
||||
"""
|
||||
super().__init__(twilio, "https://messaging.twilio.com")
|
||||
self._v1: Optional[V1] = None
|
||||
|
||||
@property
|
||||
def v1(self) -> V1:
|
||||
"""
|
||||
:returns: Versions v1 of Messaging
|
||||
"""
|
||||
if self._v1 is None:
|
||||
self._v1 = V1(self)
|
||||
return self._v1
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging>"
|
||||
@@ -0,0 +1,99 @@
|
||||
from warnings import warn
|
||||
|
||||
from twilio.rest.messaging.MessagingBase import MessagingBase
|
||||
from twilio.rest.messaging.v1.brand_registration import BrandRegistrationList
|
||||
from twilio.rest.messaging.v1.deactivations import DeactivationsList
|
||||
from twilio.rest.messaging.v1.domain_certs import DomainCertsList
|
||||
from twilio.rest.messaging.v1.domain_config import DomainConfigList
|
||||
from twilio.rest.messaging.v1.domain_config_messaging_service import (
|
||||
DomainConfigMessagingServiceList,
|
||||
)
|
||||
from twilio.rest.messaging.v1.external_campaign import ExternalCampaignList
|
||||
from twilio.rest.messaging.v1.linkshortening_messaging_service import (
|
||||
LinkshorteningMessagingServiceList,
|
||||
)
|
||||
from twilio.rest.messaging.v1.service import ServiceList
|
||||
from twilio.rest.messaging.v1.usecase import UsecaseList
|
||||
|
||||
|
||||
class Messaging(MessagingBase):
|
||||
@property
|
||||
def brand_registrations(self) -> BrandRegistrationList:
|
||||
warn(
|
||||
"brand_registrations is deprecated. Use v1.brand_registrations instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.brand_registrations
|
||||
|
||||
@property
|
||||
def deactivations(self) -> DeactivationsList:
|
||||
warn(
|
||||
"deactivations is deprecated. Use v1.deactivations instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.deactivations
|
||||
|
||||
@property
|
||||
def domain_certs(self) -> DomainCertsList:
|
||||
warn(
|
||||
"domain_certs is deprecated. Use v1.domain_certs instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.domain_certs
|
||||
|
||||
@property
|
||||
def domain_config(self) -> DomainConfigList:
|
||||
warn(
|
||||
"domain_config is deprecated. Use v1.domain_config instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.domain_config
|
||||
|
||||
@property
|
||||
def domain_config_messaging_service(self) -> DomainConfigMessagingServiceList:
|
||||
warn(
|
||||
"domain_config_messaging_service is deprecated. Use v1.domain_config_messaging_service instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.domain_config_messaging_service
|
||||
|
||||
@property
|
||||
def external_campaign(self) -> ExternalCampaignList:
|
||||
warn(
|
||||
"external_campaign is deprecated. Use v1.external_campaign instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.external_campaign
|
||||
|
||||
@property
|
||||
def linkshortening_messaging_service(self) -> LinkshorteningMessagingServiceList:
|
||||
warn(
|
||||
"linkshortening_messaging_service is deprecated. Use v1.linkshortening_messaging_service instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.linkshortening_messaging_service
|
||||
|
||||
@property
|
||||
def services(self) -> ServiceList:
|
||||
warn(
|
||||
"services is deprecated. Use v1.services instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.services
|
||||
|
||||
@property
|
||||
def usecases(self) -> UsecaseList:
|
||||
warn(
|
||||
"usecases is deprecated. Use v1.usecases instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.usecases
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,142 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Messaging
|
||||
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.messaging.v1.brand_registration import BrandRegistrationList
|
||||
from twilio.rest.messaging.v1.deactivations import DeactivationsList
|
||||
from twilio.rest.messaging.v1.domain_certs import DomainCertsList
|
||||
from twilio.rest.messaging.v1.domain_config import DomainConfigList
|
||||
from twilio.rest.messaging.v1.domain_config_messaging_service import (
|
||||
DomainConfigMessagingServiceList,
|
||||
)
|
||||
from twilio.rest.messaging.v1.external_campaign import ExternalCampaignList
|
||||
from twilio.rest.messaging.v1.linkshortening_messaging_service import (
|
||||
LinkshorteningMessagingServiceList,
|
||||
)
|
||||
from twilio.rest.messaging.v1.linkshortening_messaging_service_domain_association import (
|
||||
LinkshorteningMessagingServiceDomainAssociationList,
|
||||
)
|
||||
from twilio.rest.messaging.v1.service import ServiceList
|
||||
from twilio.rest.messaging.v1.tollfree_verification import TollfreeVerificationList
|
||||
from twilio.rest.messaging.v1.usecase import UsecaseList
|
||||
|
||||
|
||||
class V1(Version):
|
||||
def __init__(self, domain: Domain):
|
||||
"""
|
||||
Initialize the V1 version of Messaging
|
||||
|
||||
:param domain: The Twilio.messaging domain
|
||||
"""
|
||||
super().__init__(domain, "v1")
|
||||
self._brand_registrations: Optional[BrandRegistrationList] = None
|
||||
self._deactivations: Optional[DeactivationsList] = None
|
||||
self._domain_certs: Optional[DomainCertsList] = None
|
||||
self._domain_config: Optional[DomainConfigList] = None
|
||||
self._domain_config_messaging_service: Optional[
|
||||
DomainConfigMessagingServiceList
|
||||
] = None
|
||||
self._external_campaign: Optional[ExternalCampaignList] = None
|
||||
self._linkshortening_messaging_service: Optional[
|
||||
LinkshorteningMessagingServiceList
|
||||
] = None
|
||||
self._linkshortening_messaging_service_domain_association: Optional[
|
||||
LinkshorteningMessagingServiceDomainAssociationList
|
||||
] = None
|
||||
self._services: Optional[ServiceList] = None
|
||||
self._tollfree_verifications: Optional[TollfreeVerificationList] = None
|
||||
self._usecases: Optional[UsecaseList] = None
|
||||
|
||||
@property
|
||||
def brand_registrations(self) -> BrandRegistrationList:
|
||||
if self._brand_registrations is None:
|
||||
self._brand_registrations = BrandRegistrationList(self)
|
||||
return self._brand_registrations
|
||||
|
||||
@property
|
||||
def deactivations(self) -> DeactivationsList:
|
||||
if self._deactivations is None:
|
||||
self._deactivations = DeactivationsList(self)
|
||||
return self._deactivations
|
||||
|
||||
@property
|
||||
def domain_certs(self) -> DomainCertsList:
|
||||
if self._domain_certs is None:
|
||||
self._domain_certs = DomainCertsList(self)
|
||||
return self._domain_certs
|
||||
|
||||
@property
|
||||
def domain_config(self) -> DomainConfigList:
|
||||
if self._domain_config is None:
|
||||
self._domain_config = DomainConfigList(self)
|
||||
return self._domain_config
|
||||
|
||||
@property
|
||||
def domain_config_messaging_service(self) -> DomainConfigMessagingServiceList:
|
||||
if self._domain_config_messaging_service is None:
|
||||
self._domain_config_messaging_service = DomainConfigMessagingServiceList(
|
||||
self
|
||||
)
|
||||
return self._domain_config_messaging_service
|
||||
|
||||
@property
|
||||
def external_campaign(self) -> ExternalCampaignList:
|
||||
if self._external_campaign is None:
|
||||
self._external_campaign = ExternalCampaignList(self)
|
||||
return self._external_campaign
|
||||
|
||||
@property
|
||||
def linkshortening_messaging_service(self) -> LinkshorteningMessagingServiceList:
|
||||
if self._linkshortening_messaging_service is None:
|
||||
self._linkshortening_messaging_service = LinkshorteningMessagingServiceList(
|
||||
self
|
||||
)
|
||||
return self._linkshortening_messaging_service
|
||||
|
||||
@property
|
||||
def linkshortening_messaging_service_domain_association(
|
||||
self,
|
||||
) -> LinkshorteningMessagingServiceDomainAssociationList:
|
||||
if self._linkshortening_messaging_service_domain_association is None:
|
||||
self._linkshortening_messaging_service_domain_association = (
|
||||
LinkshorteningMessagingServiceDomainAssociationList(self)
|
||||
)
|
||||
return self._linkshortening_messaging_service_domain_association
|
||||
|
||||
@property
|
||||
def services(self) -> ServiceList:
|
||||
if self._services is None:
|
||||
self._services = ServiceList(self)
|
||||
return self._services
|
||||
|
||||
@property
|
||||
def tollfree_verifications(self) -> TollfreeVerificationList:
|
||||
if self._tollfree_verifications is None:
|
||||
self._tollfree_verifications = TollfreeVerificationList(self)
|
||||
return self._tollfree_verifications
|
||||
|
||||
@property
|
||||
def usecases(self) -> UsecaseList:
|
||||
if self._usecases is None:
|
||||
self._usecases = UsecaseList(self)
|
||||
return self._usecases
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging.V1>"
|
||||
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.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+636
@@ -0,0 +1,636 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Messaging
|
||||
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
|
||||
from twilio.rest.messaging.v1.brand_registration.brand_registration_otp import (
|
||||
BrandRegistrationOtpList,
|
||||
)
|
||||
from twilio.rest.messaging.v1.brand_registration.brand_vetting import BrandVettingList
|
||||
|
||||
|
||||
class BrandRegistrationInstance(InstanceResource):
|
||||
class BrandFeedback(object):
|
||||
TAX_ID = "TAX_ID"
|
||||
STOCK_SYMBOL = "STOCK_SYMBOL"
|
||||
NONPROFIT = "NONPROFIT"
|
||||
GOVERNMENT_ENTITY = "GOVERNMENT_ENTITY"
|
||||
OTHERS = "OTHERS"
|
||||
|
||||
class IdentityStatus(object):
|
||||
SELF_DECLARED = "SELF_DECLARED"
|
||||
UNVERIFIED = "UNVERIFIED"
|
||||
VERIFIED = "VERIFIED"
|
||||
VETTED_VERIFIED = "VETTED_VERIFIED"
|
||||
|
||||
class Status(object):
|
||||
PENDING = "PENDING"
|
||||
APPROVED = "APPROVED"
|
||||
FAILED = "FAILED"
|
||||
IN_REVIEW = "IN_REVIEW"
|
||||
DELETED = "DELETED"
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string to identify Brand Registration.
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Brand Registration resource.
|
||||
:ivar customer_profile_bundle_sid: A2P Messaging Profile Bundle BundleSid.
|
||||
:ivar a2p_profile_bundle_sid: A2P Messaging Profile Bundle BundleSid.
|
||||
: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 brand_type: Type of brand. One of: \"STANDARD\", \"SOLE_PROPRIETOR\". SOLE_PROPRIETOR is for the low volume, SOLE_PROPRIETOR campaign use case. There can only be one SOLE_PROPRIETOR campaign created per SOLE_PROPRIETOR brand. STANDARD is for all other campaign use cases. Multiple campaign use cases can be created per STANDARD brand.
|
||||
:ivar status:
|
||||
:ivar tcr_id: Campaign Registry (TCR) Brand ID. Assigned only after successful brand registration.
|
||||
:ivar failure_reason: A reason why brand registration has failed. Only applicable when status is FAILED.
|
||||
:ivar url: The absolute URL of the Brand Registration resource.
|
||||
:ivar brand_score: The secondary vetting score if it was done. Otherwise, it will be the brand score if it's returned from TCR. It may be null if no score is available.
|
||||
:ivar brand_feedback: Feedback on how to improve brand score
|
||||
:ivar identity_status:
|
||||
:ivar russell_3000: Publicly traded company identified in the Russell 3000 Index
|
||||
:ivar government_entity: Identified as a government entity
|
||||
:ivar tax_exempt_status: Nonprofit organization tax-exempt status per section 501 of the U.S. tax code.
|
||||
:ivar skip_automatic_sec_vet: A flag to disable automatic secondary vetting for brands which it would otherwise be done.
|
||||
:ivar mock: A boolean that specifies whether brand should be a mock or not. If true, brand will be registered as a mock brand. Defaults to false if no value is provided.
|
||||
: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.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.customer_profile_bundle_sid: Optional[str] = payload.get(
|
||||
"customer_profile_bundle_sid"
|
||||
)
|
||||
self.a2p_profile_bundle_sid: Optional[str] = payload.get(
|
||||
"a2p_profile_bundle_sid"
|
||||
)
|
||||
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.brand_type: Optional[str] = payload.get("brand_type")
|
||||
self.status: Optional["BrandRegistrationInstance.Status"] = payload.get(
|
||||
"status"
|
||||
)
|
||||
self.tcr_id: Optional[str] = payload.get("tcr_id")
|
||||
self.failure_reason: Optional[str] = payload.get("failure_reason")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
self.brand_score: Optional[int] = deserialize.integer(
|
||||
payload.get("brand_score")
|
||||
)
|
||||
self.brand_feedback: Optional[
|
||||
List["BrandRegistrationInstance.BrandFeedback"]
|
||||
] = payload.get("brand_feedback")
|
||||
self.identity_status: Optional[
|
||||
"BrandRegistrationInstance.IdentityStatus"
|
||||
] = payload.get("identity_status")
|
||||
self.russell_3000: Optional[bool] = payload.get("russell_3000")
|
||||
self.government_entity: Optional[bool] = payload.get("government_entity")
|
||||
self.tax_exempt_status: Optional[str] = payload.get("tax_exempt_status")
|
||||
self.skip_automatic_sec_vet: Optional[bool] = payload.get(
|
||||
"skip_automatic_sec_vet"
|
||||
)
|
||||
self.mock: Optional[bool] = payload.get("mock")
|
||||
self.links: Optional[Dict[str, object]] = payload.get("links")
|
||||
|
||||
self._solution = {
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[BrandRegistrationContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "BrandRegistrationContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: BrandRegistrationContext for this BrandRegistrationInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = BrandRegistrationContext(
|
||||
self._version,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "BrandRegistrationInstance":
|
||||
"""
|
||||
Fetch the BrandRegistrationInstance
|
||||
|
||||
|
||||
:returns: The fetched BrandRegistrationInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "BrandRegistrationInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the BrandRegistrationInstance
|
||||
|
||||
|
||||
:returns: The fetched BrandRegistrationInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def update(self) -> "BrandRegistrationInstance":
|
||||
"""
|
||||
Update the BrandRegistrationInstance
|
||||
|
||||
|
||||
:returns: The updated BrandRegistrationInstance
|
||||
"""
|
||||
return self._proxy.update()
|
||||
|
||||
async def update_async(self) -> "BrandRegistrationInstance":
|
||||
"""
|
||||
Asynchronous coroutine to update the BrandRegistrationInstance
|
||||
|
||||
|
||||
:returns: The updated BrandRegistrationInstance
|
||||
"""
|
||||
return await self._proxy.update_async()
|
||||
|
||||
@property
|
||||
def brand_registration_otps(self) -> BrandRegistrationOtpList:
|
||||
"""
|
||||
Access the brand_registration_otps
|
||||
"""
|
||||
return self._proxy.brand_registration_otps
|
||||
|
||||
@property
|
||||
def brand_vettings(self) -> BrandVettingList:
|
||||
"""
|
||||
Access the brand_vettings
|
||||
"""
|
||||
return self._proxy.brand_vettings
|
||||
|
||||
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.Messaging.V1.BrandRegistrationInstance {}>".format(context)
|
||||
|
||||
|
||||
class BrandRegistrationContext(InstanceContext):
|
||||
def __init__(self, version: Version, sid: str):
|
||||
"""
|
||||
Initialize the BrandRegistrationContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param sid: The SID of the Brand Registration resource to update.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/a2p/BrandRegistrations/{sid}".format(**self._solution)
|
||||
|
||||
self._brand_registration_otps: Optional[BrandRegistrationOtpList] = None
|
||||
self._brand_vettings: Optional[BrandVettingList] = None
|
||||
|
||||
def fetch(self) -> BrandRegistrationInstance:
|
||||
"""
|
||||
Fetch the BrandRegistrationInstance
|
||||
|
||||
|
||||
:returns: The fetched BrandRegistrationInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return BrandRegistrationInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> BrandRegistrationInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the BrandRegistrationInstance
|
||||
|
||||
|
||||
:returns: The fetched BrandRegistrationInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return BrandRegistrationInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
def update(self) -> BrandRegistrationInstance:
|
||||
"""
|
||||
Update the BrandRegistrationInstance
|
||||
|
||||
|
||||
:returns: The updated BrandRegistrationInstance
|
||||
"""
|
||||
data = values.of({})
|
||||
|
||||
payload = self._version.update(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return BrandRegistrationInstance(
|
||||
self._version, payload, sid=self._solution["sid"]
|
||||
)
|
||||
|
||||
async def update_async(self) -> BrandRegistrationInstance:
|
||||
"""
|
||||
Asynchronous coroutine to update the BrandRegistrationInstance
|
||||
|
||||
|
||||
:returns: The updated BrandRegistrationInstance
|
||||
"""
|
||||
data = values.of({})
|
||||
|
||||
payload = await self._version.update_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return BrandRegistrationInstance(
|
||||
self._version, payload, sid=self._solution["sid"]
|
||||
)
|
||||
|
||||
@property
|
||||
def brand_registration_otps(self) -> BrandRegistrationOtpList:
|
||||
"""
|
||||
Access the brand_registration_otps
|
||||
"""
|
||||
if self._brand_registration_otps is None:
|
||||
self._brand_registration_otps = BrandRegistrationOtpList(
|
||||
self._version,
|
||||
self._solution["sid"],
|
||||
)
|
||||
return self._brand_registration_otps
|
||||
|
||||
@property
|
||||
def brand_vettings(self) -> BrandVettingList:
|
||||
"""
|
||||
Access the brand_vettings
|
||||
"""
|
||||
if self._brand_vettings is None:
|
||||
self._brand_vettings = BrandVettingList(
|
||||
self._version,
|
||||
self._solution["sid"],
|
||||
)
|
||||
return self._brand_vettings
|
||||
|
||||
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.Messaging.V1.BrandRegistrationContext {}>".format(context)
|
||||
|
||||
|
||||
class BrandRegistrationPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> BrandRegistrationInstance:
|
||||
"""
|
||||
Build an instance of BrandRegistrationInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return BrandRegistrationInstance(self._version, payload)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging.V1.BrandRegistrationPage>"
|
||||
|
||||
|
||||
class BrandRegistrationList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the BrandRegistrationList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/a2p/BrandRegistrations"
|
||||
|
||||
def create(
|
||||
self,
|
||||
customer_profile_bundle_sid: str,
|
||||
a2p_profile_bundle_sid: str,
|
||||
brand_type: Union[str, object] = values.unset,
|
||||
mock: Union[bool, object] = values.unset,
|
||||
skip_automatic_sec_vet: Union[bool, object] = values.unset,
|
||||
) -> BrandRegistrationInstance:
|
||||
"""
|
||||
Create the BrandRegistrationInstance
|
||||
|
||||
:param customer_profile_bundle_sid: Customer Profile Bundle Sid.
|
||||
:param a2p_profile_bundle_sid: A2P Messaging Profile Bundle Sid.
|
||||
:param brand_type: Type of brand being created. One of: \\\"STANDARD\\\", \\\"SOLE_PROPRIETOR\\\". SOLE_PROPRIETOR is for low volume, SOLE_PROPRIETOR use cases. STANDARD is for all other use cases.
|
||||
:param mock: A boolean that specifies whether brand should be a mock or not. If true, brand will be registered as a mock brand. Defaults to false if no value is provided.
|
||||
:param skip_automatic_sec_vet: A flag to disable automatic secondary vetting for brands which it would otherwise be done.
|
||||
|
||||
:returns: The created BrandRegistrationInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"CustomerProfileBundleSid": customer_profile_bundle_sid,
|
||||
"A2PProfileBundleSid": a2p_profile_bundle_sid,
|
||||
"BrandType": brand_type,
|
||||
"Mock": mock,
|
||||
"SkipAutomaticSecVet": skip_automatic_sec_vet,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return BrandRegistrationInstance(self._version, payload)
|
||||
|
||||
async def create_async(
|
||||
self,
|
||||
customer_profile_bundle_sid: str,
|
||||
a2p_profile_bundle_sid: str,
|
||||
brand_type: Union[str, object] = values.unset,
|
||||
mock: Union[bool, object] = values.unset,
|
||||
skip_automatic_sec_vet: Union[bool, object] = values.unset,
|
||||
) -> BrandRegistrationInstance:
|
||||
"""
|
||||
Asynchronously create the BrandRegistrationInstance
|
||||
|
||||
:param customer_profile_bundle_sid: Customer Profile Bundle Sid.
|
||||
:param a2p_profile_bundle_sid: A2P Messaging Profile Bundle Sid.
|
||||
:param brand_type: Type of brand being created. One of: \\\"STANDARD\\\", \\\"SOLE_PROPRIETOR\\\". SOLE_PROPRIETOR is for low volume, SOLE_PROPRIETOR use cases. STANDARD is for all other use cases.
|
||||
:param mock: A boolean that specifies whether brand should be a mock or not. If true, brand will be registered as a mock brand. Defaults to false if no value is provided.
|
||||
:param skip_automatic_sec_vet: A flag to disable automatic secondary vetting for brands which it would otherwise be done.
|
||||
|
||||
:returns: The created BrandRegistrationInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"CustomerProfileBundleSid": customer_profile_bundle_sid,
|
||||
"A2PProfileBundleSid": a2p_profile_bundle_sid,
|
||||
"BrandType": brand_type,
|
||||
"Mock": mock,
|
||||
"SkipAutomaticSecVet": skip_automatic_sec_vet,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return BrandRegistrationInstance(self._version, payload)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[BrandRegistrationInstance]:
|
||||
"""
|
||||
Streams BrandRegistrationInstance 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[BrandRegistrationInstance]:
|
||||
"""
|
||||
Asynchronously streams BrandRegistrationInstance 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[BrandRegistrationInstance]:
|
||||
"""
|
||||
Lists BrandRegistrationInstance 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[BrandRegistrationInstance]:
|
||||
"""
|
||||
Asynchronously lists BrandRegistrationInstance 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,
|
||||
) -> BrandRegistrationPage:
|
||||
"""
|
||||
Retrieve a single page of BrandRegistrationInstance 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 BrandRegistrationInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return BrandRegistrationPage(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,
|
||||
) -> BrandRegistrationPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of BrandRegistrationInstance 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 BrandRegistrationInstance
|
||||
"""
|
||||
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 BrandRegistrationPage(self._version, response)
|
||||
|
||||
def get_page(self, target_url: str) -> BrandRegistrationPage:
|
||||
"""
|
||||
Retrieve a specific page of BrandRegistrationInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of BrandRegistrationInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return BrandRegistrationPage(self._version, response)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> BrandRegistrationPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of BrandRegistrationInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of BrandRegistrationInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return BrandRegistrationPage(self._version, response)
|
||||
|
||||
def get(self, sid: str) -> BrandRegistrationContext:
|
||||
"""
|
||||
Constructs a BrandRegistrationContext
|
||||
|
||||
:param sid: The SID of the Brand Registration resource to update.
|
||||
"""
|
||||
return BrandRegistrationContext(self._version, sid=sid)
|
||||
|
||||
def __call__(self, sid: str) -> BrandRegistrationContext:
|
||||
"""
|
||||
Constructs a BrandRegistrationContext
|
||||
|
||||
:param sid: The SID of the Brand Registration resource to update.
|
||||
"""
|
||||
return BrandRegistrationContext(self._version, sid=sid)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging.V1.BrandRegistrationList>"
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+117
@@ -0,0 +1,117 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Messaging
|
||||
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
|
||||
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
|
||||
|
||||
class BrandRegistrationOtpInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Brand Registration resource.
|
||||
:ivar brand_registration_sid: The unique string to identify Brand Registration of Sole Proprietor Brand
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, version: Version, payload: Dict[str, Any], brand_registration_sid: str
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.brand_registration_sid: Optional[str] = payload.get(
|
||||
"brand_registration_sid"
|
||||
)
|
||||
|
||||
self._solution = {
|
||||
"brand_registration_sid": brand_registration_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.Messaging.V1.BrandRegistrationOtpInstance {}>".format(context)
|
||||
|
||||
|
||||
class BrandRegistrationOtpList(ListResource):
|
||||
def __init__(self, version: Version, brand_registration_sid: str):
|
||||
"""
|
||||
Initialize the BrandRegistrationOtpList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param brand_registration_sid: Brand Registration Sid of Sole Proprietor Brand.
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"brand_registration_sid": brand_registration_sid,
|
||||
}
|
||||
self._uri = "/a2p/BrandRegistrations/{brand_registration_sid}/SmsOtp".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def create(self) -> BrandRegistrationOtpInstance:
|
||||
"""
|
||||
Create the BrandRegistrationOtpInstance
|
||||
|
||||
|
||||
:returns: The created BrandRegistrationOtpInstance
|
||||
"""
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return BrandRegistrationOtpInstance(
|
||||
self._version,
|
||||
payload,
|
||||
brand_registration_sid=self._solution["brand_registration_sid"],
|
||||
)
|
||||
|
||||
async def create_async(self) -> BrandRegistrationOtpInstance:
|
||||
"""
|
||||
Asynchronously create the BrandRegistrationOtpInstance
|
||||
|
||||
|
||||
:returns: The created BrandRegistrationOtpInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return BrandRegistrationOtpInstance(
|
||||
self._version,
|
||||
payload,
|
||||
brand_registration_sid=self._solution["brand_registration_sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging.V1.BrandRegistrationOtpList>"
|
||||
+535
@@ -0,0 +1,535 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Messaging
|
||||
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 BrandVettingInstance(InstanceResource):
|
||||
class VettingProvider(object):
|
||||
CAMPAIGN_VERIFY = "campaign-verify"
|
||||
|
||||
"""
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the vetting record.
|
||||
:ivar brand_sid: The unique string to identify Brand Registration.
|
||||
:ivar brand_vetting_sid: The Twilio SID of the third-party vetting record.
|
||||
: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 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 vetting_id: The unique identifier of the vetting from the third-party provider.
|
||||
:ivar vetting_class: The type of vetting that has been conducted. One of “STANDARD” (Aegis) or “POLITICAL” (Campaign Verify).
|
||||
:ivar vetting_status: The status of the import vetting attempt. One of “PENDING,” “SUCCESS,” or “FAILED”.
|
||||
:ivar vetting_provider:
|
||||
:ivar url: The absolute URL of the Brand Vetting resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
brand_sid: str,
|
||||
brand_vetting_sid: Optional[str] = None,
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.brand_sid: Optional[str] = payload.get("brand_sid")
|
||||
self.brand_vetting_sid: Optional[str] = payload.get("brand_vetting_sid")
|
||||
self.date_updated: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_updated")
|
||||
)
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
self.vetting_id: Optional[str] = payload.get("vetting_id")
|
||||
self.vetting_class: Optional[str] = payload.get("vetting_class")
|
||||
self.vetting_status: Optional[str] = payload.get("vetting_status")
|
||||
self.vetting_provider: Optional[
|
||||
"BrandVettingInstance.VettingProvider"
|
||||
] = payload.get("vetting_provider")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"brand_sid": brand_sid,
|
||||
"brand_vetting_sid": brand_vetting_sid or self.brand_vetting_sid,
|
||||
}
|
||||
self._context: Optional[BrandVettingContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "BrandVettingContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: BrandVettingContext for this BrandVettingInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = BrandVettingContext(
|
||||
self._version,
|
||||
brand_sid=self._solution["brand_sid"],
|
||||
brand_vetting_sid=self._solution["brand_vetting_sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "BrandVettingInstance":
|
||||
"""
|
||||
Fetch the BrandVettingInstance
|
||||
|
||||
|
||||
:returns: The fetched BrandVettingInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "BrandVettingInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the BrandVettingInstance
|
||||
|
||||
|
||||
:returns: The fetched BrandVettingInstance
|
||||
"""
|
||||
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.Messaging.V1.BrandVettingInstance {}>".format(context)
|
||||
|
||||
|
||||
class BrandVettingContext(InstanceContext):
|
||||
def __init__(self, version: Version, brand_sid: str, brand_vetting_sid: str):
|
||||
"""
|
||||
Initialize the BrandVettingContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param brand_sid: The SID of the Brand Registration resource of the vettings to read .
|
||||
:param brand_vetting_sid: The Twilio SID of the third-party vetting record.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"brand_sid": brand_sid,
|
||||
"brand_vetting_sid": brand_vetting_sid,
|
||||
}
|
||||
self._uri = (
|
||||
"/a2p/BrandRegistrations/{brand_sid}/Vettings/{brand_vetting_sid}".format(
|
||||
**self._solution
|
||||
)
|
||||
)
|
||||
|
||||
def fetch(self) -> BrandVettingInstance:
|
||||
"""
|
||||
Fetch the BrandVettingInstance
|
||||
|
||||
|
||||
:returns: The fetched BrandVettingInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return BrandVettingInstance(
|
||||
self._version,
|
||||
payload,
|
||||
brand_sid=self._solution["brand_sid"],
|
||||
brand_vetting_sid=self._solution["brand_vetting_sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> BrandVettingInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the BrandVettingInstance
|
||||
|
||||
|
||||
:returns: The fetched BrandVettingInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return BrandVettingInstance(
|
||||
self._version,
|
||||
payload,
|
||||
brand_sid=self._solution["brand_sid"],
|
||||
brand_vetting_sid=self._solution["brand_vetting_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.Messaging.V1.BrandVettingContext {}>".format(context)
|
||||
|
||||
|
||||
class BrandVettingPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> BrandVettingInstance:
|
||||
"""
|
||||
Build an instance of BrandVettingInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return BrandVettingInstance(
|
||||
self._version, payload, brand_sid=self._solution["brand_sid"]
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging.V1.BrandVettingPage>"
|
||||
|
||||
|
||||
class BrandVettingList(ListResource):
|
||||
def __init__(self, version: Version, brand_sid: str):
|
||||
"""
|
||||
Initialize the BrandVettingList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param brand_sid: The SID of the Brand Registration resource of the vettings to read .
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"brand_sid": brand_sid,
|
||||
}
|
||||
self._uri = "/a2p/BrandRegistrations/{brand_sid}/Vettings".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def create(
|
||||
self,
|
||||
vetting_provider: "BrandVettingInstance.VettingProvider",
|
||||
vetting_id: Union[str, object] = values.unset,
|
||||
) -> BrandVettingInstance:
|
||||
"""
|
||||
Create the BrandVettingInstance
|
||||
|
||||
:param vetting_provider:
|
||||
:param vetting_id: The unique ID of the vetting
|
||||
|
||||
:returns: The created BrandVettingInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"VettingProvider": vetting_provider,
|
||||
"VettingId": vetting_id,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return BrandVettingInstance(
|
||||
self._version, payload, brand_sid=self._solution["brand_sid"]
|
||||
)
|
||||
|
||||
async def create_async(
|
||||
self,
|
||||
vetting_provider: "BrandVettingInstance.VettingProvider",
|
||||
vetting_id: Union[str, object] = values.unset,
|
||||
) -> BrandVettingInstance:
|
||||
"""
|
||||
Asynchronously create the BrandVettingInstance
|
||||
|
||||
:param vetting_provider:
|
||||
:param vetting_id: The unique ID of the vetting
|
||||
|
||||
:returns: The created BrandVettingInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"VettingProvider": vetting_provider,
|
||||
"VettingId": vetting_id,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return BrandVettingInstance(
|
||||
self._version, payload, brand_sid=self._solution["brand_sid"]
|
||||
)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
vetting_provider: Union[
|
||||
"BrandVettingInstance.VettingProvider", object
|
||||
] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[BrandVettingInstance]:
|
||||
"""
|
||||
Streams BrandVettingInstance 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 "BrandVettingInstance.VettingProvider" vetting_provider: The third-party provider of the vettings to read
|
||||
: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(
|
||||
vetting_provider=vetting_provider, page_size=limits["page_size"]
|
||||
)
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
vetting_provider: Union[
|
||||
"BrandVettingInstance.VettingProvider", object
|
||||
] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[BrandVettingInstance]:
|
||||
"""
|
||||
Asynchronously streams BrandVettingInstance 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 "BrandVettingInstance.VettingProvider" vetting_provider: The third-party provider of the vettings to read
|
||||
: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(
|
||||
vetting_provider=vetting_provider, page_size=limits["page_size"]
|
||||
)
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
vetting_provider: Union[
|
||||
"BrandVettingInstance.VettingProvider", object
|
||||
] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[BrandVettingInstance]:
|
||||
"""
|
||||
Lists BrandVettingInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param "BrandVettingInstance.VettingProvider" vetting_provider: The third-party provider of the vettings to read
|
||||
: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(
|
||||
vetting_provider=vetting_provider,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
vetting_provider: Union[
|
||||
"BrandVettingInstance.VettingProvider", object
|
||||
] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[BrandVettingInstance]:
|
||||
"""
|
||||
Asynchronously lists BrandVettingInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param "BrandVettingInstance.VettingProvider" vetting_provider: The third-party provider of the vettings to read
|
||||
: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(
|
||||
vetting_provider=vetting_provider,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
vetting_provider: Union[
|
||||
"BrandVettingInstance.VettingProvider", object
|
||||
] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> BrandVettingPage:
|
||||
"""
|
||||
Retrieve a single page of BrandVettingInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param vetting_provider: The third-party provider of the vettings to read
|
||||
: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 BrandVettingInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"VettingProvider": vetting_provider,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return BrandVettingPage(self._version, response, self._solution)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
vetting_provider: Union[
|
||||
"BrandVettingInstance.VettingProvider", object
|
||||
] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> BrandVettingPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of BrandVettingInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param vetting_provider: The third-party provider of the vettings to read
|
||||
: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 BrandVettingInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"VettingProvider": vetting_provider,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return BrandVettingPage(self._version, response, self._solution)
|
||||
|
||||
def get_page(self, target_url: str) -> BrandVettingPage:
|
||||
"""
|
||||
Retrieve a specific page of BrandVettingInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of BrandVettingInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return BrandVettingPage(self._version, response, self._solution)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> BrandVettingPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of BrandVettingInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of BrandVettingInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return BrandVettingPage(self._version, response, self._solution)
|
||||
|
||||
def get(self, brand_vetting_sid: str) -> BrandVettingContext:
|
||||
"""
|
||||
Constructs a BrandVettingContext
|
||||
|
||||
:param brand_vetting_sid: The Twilio SID of the third-party vetting record.
|
||||
"""
|
||||
return BrandVettingContext(
|
||||
self._version,
|
||||
brand_sid=self._solution["brand_sid"],
|
||||
brand_vetting_sid=brand_vetting_sid,
|
||||
)
|
||||
|
||||
def __call__(self, brand_vetting_sid: str) -> BrandVettingContext:
|
||||
"""
|
||||
Constructs a BrandVettingContext
|
||||
|
||||
:param brand_vetting_sid: The Twilio SID of the third-party vetting record.
|
||||
"""
|
||||
return BrandVettingContext(
|
||||
self._version,
|
||||
brand_sid=self._solution["brand_sid"],
|
||||
brand_vetting_sid=brand_vetting_sid,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging.V1.BrandVettingList>"
|
||||
@@ -0,0 +1,189 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Messaging
|
||||
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 date
|
||||
from typing import Any, Dict, Optional, Union
|
||||
from twilio.base import 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 DeactivationsInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar redirect_to: Returns an authenticated url that redirects to a file containing the deactivated numbers for the requested day. This url is valid for up to two minutes.
|
||||
"""
|
||||
|
||||
def __init__(self, version: Version, payload: Dict[str, Any]):
|
||||
super().__init__(version)
|
||||
|
||||
self.redirect_to: Optional[str] = payload.get("redirect_to")
|
||||
|
||||
self._context: Optional[DeactivationsContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "DeactivationsContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: DeactivationsContext for this DeactivationsInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = DeactivationsContext(
|
||||
self._version,
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(
|
||||
self, date: Union[date, object] = values.unset
|
||||
) -> "DeactivationsInstance":
|
||||
"""
|
||||
Fetch the DeactivationsInstance
|
||||
|
||||
:param date: The request will return a list of all United States Phone Numbers that were deactivated on the day specified by this parameter. This date should be specified in YYYY-MM-DD format.
|
||||
|
||||
:returns: The fetched DeactivationsInstance
|
||||
"""
|
||||
return self._proxy.fetch(
|
||||
date=date,
|
||||
)
|
||||
|
||||
async def fetch_async(
|
||||
self, date: Union[date, object] = values.unset
|
||||
) -> "DeactivationsInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the DeactivationsInstance
|
||||
|
||||
:param date: The request will return a list of all United States Phone Numbers that were deactivated on the day specified by this parameter. This date should be specified in YYYY-MM-DD format.
|
||||
|
||||
:returns: The fetched DeactivationsInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async(
|
||||
date=date,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
|
||||
return "<Twilio.Messaging.V1.DeactivationsInstance>"
|
||||
|
||||
|
||||
class DeactivationsContext(InstanceContext):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the DeactivationsContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/Deactivations"
|
||||
|
||||
def fetch(self, date: Union[date, object] = values.unset) -> DeactivationsInstance:
|
||||
"""
|
||||
Fetch the DeactivationsInstance
|
||||
|
||||
:param date: The request will return a list of all United States Phone Numbers that were deactivated on the day specified by this parameter. This date should be specified in YYYY-MM-DD format.
|
||||
|
||||
:returns: The fetched DeactivationsInstance
|
||||
"""
|
||||
|
||||
data = values.of(
|
||||
{
|
||||
"Date": serialize.iso8601_date(date),
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.fetch(method="GET", uri=self._uri, params=data)
|
||||
|
||||
return DeactivationsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
)
|
||||
|
||||
async def fetch_async(
|
||||
self, date: Union[date, object] = values.unset
|
||||
) -> DeactivationsInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the DeactivationsInstance
|
||||
|
||||
:param date: The request will return a list of all United States Phone Numbers that were deactivated on the day specified by this parameter. This date should be specified in YYYY-MM-DD format.
|
||||
|
||||
:returns: The fetched DeactivationsInstance
|
||||
"""
|
||||
|
||||
data = values.of(
|
||||
{
|
||||
"Date": serialize.iso8601_date(date),
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
|
||||
return DeactivationsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
|
||||
return "<Twilio.Messaging.V1.DeactivationsContext>"
|
||||
|
||||
|
||||
class DeactivationsList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the DeactivationsList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
def get(self) -> DeactivationsContext:
|
||||
"""
|
||||
Constructs a DeactivationsContext
|
||||
|
||||
"""
|
||||
return DeactivationsContext(self._version)
|
||||
|
||||
def __call__(self) -> DeactivationsContext:
|
||||
"""
|
||||
Constructs a DeactivationsContext
|
||||
|
||||
"""
|
||||
return DeactivationsContext(self._version)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging.V1.DeactivationsList>"
|
||||
@@ -0,0 +1,323 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Messaging
|
||||
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_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
|
||||
|
||||
class DomainCertsInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar domain_sid: The unique string that we created to identify the Domain resource.
|
||||
:ivar date_updated: Date that this Domain was last updated.
|
||||
:ivar date_expires: Date that the private certificate associated with this domain expires. You will need to update the certificate before that date to ensure your shortened links will continue to work.
|
||||
:ivar date_created: Date that this Domain was registered to the Twilio platform to create a new Domain object.
|
||||
:ivar domain_name: Full url path for this domain.
|
||||
:ivar certificate_sid: The unique string that we created to identify this Certificate resource.
|
||||
:ivar url:
|
||||
:ivar cert_in_validation: Optional JSON field describing the status and upload date of a new certificate in the process of validation
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
domain_sid: Optional[str] = None,
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.domain_sid: Optional[str] = payload.get("domain_sid")
|
||||
self.date_updated: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_updated")
|
||||
)
|
||||
self.date_expires: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_expires")
|
||||
)
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
self.domain_name: Optional[str] = payload.get("domain_name")
|
||||
self.certificate_sid: Optional[str] = payload.get("certificate_sid")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
self.cert_in_validation: Optional[Dict[str, object]] = payload.get(
|
||||
"cert_in_validation"
|
||||
)
|
||||
|
||||
self._solution = {
|
||||
"domain_sid": domain_sid or self.domain_sid,
|
||||
}
|
||||
self._context: Optional[DomainCertsContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "DomainCertsContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: DomainCertsContext for this DomainCertsInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = DomainCertsContext(
|
||||
self._version,
|
||||
domain_sid=self._solution["domain_sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the DomainCertsInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._proxy.delete()
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the DomainCertsInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._proxy.delete_async()
|
||||
|
||||
def fetch(self) -> "DomainCertsInstance":
|
||||
"""
|
||||
Fetch the DomainCertsInstance
|
||||
|
||||
|
||||
:returns: The fetched DomainCertsInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "DomainCertsInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the DomainCertsInstance
|
||||
|
||||
|
||||
:returns: The fetched DomainCertsInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def update(self, tls_cert: str) -> "DomainCertsInstance":
|
||||
"""
|
||||
Update the DomainCertsInstance
|
||||
|
||||
:param tls_cert: Contains the full TLS certificate and private for this domain in PEM format: https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail. Twilio uses this information to process HTTPS traffic sent to your domain.
|
||||
|
||||
:returns: The updated DomainCertsInstance
|
||||
"""
|
||||
return self._proxy.update(
|
||||
tls_cert=tls_cert,
|
||||
)
|
||||
|
||||
async def update_async(self, tls_cert: str) -> "DomainCertsInstance":
|
||||
"""
|
||||
Asynchronous coroutine to update the DomainCertsInstance
|
||||
|
||||
:param tls_cert: Contains the full TLS certificate and private for this domain in PEM format: https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail. Twilio uses this information to process HTTPS traffic sent to your domain.
|
||||
|
||||
:returns: The updated DomainCertsInstance
|
||||
"""
|
||||
return await self._proxy.update_async(
|
||||
tls_cert=tls_cert,
|
||||
)
|
||||
|
||||
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.Messaging.V1.DomainCertsInstance {}>".format(context)
|
||||
|
||||
|
||||
class DomainCertsContext(InstanceContext):
|
||||
def __init__(self, version: Version, domain_sid: str):
|
||||
"""
|
||||
Initialize the DomainCertsContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param domain_sid: Unique string used to identify the domain that this certificate should be associated with.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"domain_sid": domain_sid,
|
||||
}
|
||||
self._uri = "/LinkShortening/Domains/{domain_sid}/Certificate".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the DomainCertsInstance
|
||||
|
||||
|
||||
: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 DomainCertsInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._version.delete_async(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
def fetch(self) -> DomainCertsInstance:
|
||||
"""
|
||||
Fetch the DomainCertsInstance
|
||||
|
||||
|
||||
:returns: The fetched DomainCertsInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return DomainCertsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
domain_sid=self._solution["domain_sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> DomainCertsInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the DomainCertsInstance
|
||||
|
||||
|
||||
:returns: The fetched DomainCertsInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return DomainCertsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
domain_sid=self._solution["domain_sid"],
|
||||
)
|
||||
|
||||
def update(self, tls_cert: str) -> DomainCertsInstance:
|
||||
"""
|
||||
Update the DomainCertsInstance
|
||||
|
||||
:param tls_cert: Contains the full TLS certificate and private for this domain in PEM format: https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail. Twilio uses this information to process HTTPS traffic sent to your domain.
|
||||
|
||||
:returns: The updated DomainCertsInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"TlsCert": tls_cert,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.update(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return DomainCertsInstance(
|
||||
self._version, payload, domain_sid=self._solution["domain_sid"]
|
||||
)
|
||||
|
||||
async def update_async(self, tls_cert: str) -> DomainCertsInstance:
|
||||
"""
|
||||
Asynchronous coroutine to update the DomainCertsInstance
|
||||
|
||||
:param tls_cert: Contains the full TLS certificate and private for this domain in PEM format: https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail. Twilio uses this information to process HTTPS traffic sent to your domain.
|
||||
|
||||
:returns: The updated DomainCertsInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"TlsCert": tls_cert,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.update_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return DomainCertsInstance(
|
||||
self._version, payload, domain_sid=self._solution["domain_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.Messaging.V1.DomainCertsContext {}>".format(context)
|
||||
|
||||
|
||||
class DomainCertsList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the DomainCertsList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
def get(self, domain_sid: str) -> DomainCertsContext:
|
||||
"""
|
||||
Constructs a DomainCertsContext
|
||||
|
||||
:param domain_sid: Unique string used to identify the domain that this certificate should be associated with.
|
||||
"""
|
||||
return DomainCertsContext(self._version, domain_sid=domain_sid)
|
||||
|
||||
def __call__(self, domain_sid: str) -> DomainCertsContext:
|
||||
"""
|
||||
Constructs a DomainCertsContext
|
||||
|
||||
:param domain_sid: Unique string used to identify the domain that this certificate should be associated with.
|
||||
"""
|
||||
return DomainCertsContext(self._version, domain_sid=domain_sid)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging.V1.DomainCertsList>"
|
||||
@@ -0,0 +1,327 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Messaging
|
||||
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, 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 DomainConfigInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar domain_sid: The unique string that we created to identify the Domain resource.
|
||||
:ivar config_sid: The unique string that we created to identify the Domain config (prefix ZK).
|
||||
:ivar fallback_url: Any requests we receive to this domain that do not match an existing shortened message will be redirected to the fallback url. These will likely be either expired messages, random misdirected traffic, or intentional scraping.
|
||||
:ivar callback_url: URL to receive click events to your webhook whenever the recipients click on the shortened links.
|
||||
:ivar continue_on_failure: Boolean field to set customer delivery preference when there is a failure in linkShortening service
|
||||
:ivar date_created: Date this Domain Config was created.
|
||||
:ivar date_updated: Date that this Domain Config was last updated.
|
||||
:ivar url:
|
||||
:ivar disable_https: Customer's choice to send links with/without \"https://\" attached to shortened url. If true, messages will not be sent with https:// at the beginning of the url. If false, messages will be sent with https:// at the beginning of the url. False is the default behavior if it is not specified.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
domain_sid: Optional[str] = None,
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.domain_sid: Optional[str] = payload.get("domain_sid")
|
||||
self.config_sid: Optional[str] = payload.get("config_sid")
|
||||
self.fallback_url: Optional[str] = payload.get("fallback_url")
|
||||
self.callback_url: Optional[str] = payload.get("callback_url")
|
||||
self.continue_on_failure: Optional[bool] = payload.get("continue_on_failure")
|
||||
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.disable_https: Optional[bool] = payload.get("disable_https")
|
||||
|
||||
self._solution = {
|
||||
"domain_sid": domain_sid or self.domain_sid,
|
||||
}
|
||||
self._context: Optional[DomainConfigContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "DomainConfigContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: DomainConfigContext for this DomainConfigInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = DomainConfigContext(
|
||||
self._version,
|
||||
domain_sid=self._solution["domain_sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "DomainConfigInstance":
|
||||
"""
|
||||
Fetch the DomainConfigInstance
|
||||
|
||||
|
||||
:returns: The fetched DomainConfigInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "DomainConfigInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the DomainConfigInstance
|
||||
|
||||
|
||||
:returns: The fetched DomainConfigInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def update(
|
||||
self,
|
||||
fallback_url: Union[str, object] = values.unset,
|
||||
callback_url: Union[str, object] = values.unset,
|
||||
continue_on_failure: Union[bool, object] = values.unset,
|
||||
disable_https: Union[bool, object] = values.unset,
|
||||
) -> "DomainConfigInstance":
|
||||
"""
|
||||
Update the DomainConfigInstance
|
||||
|
||||
:param fallback_url: Any requests we receive to this domain that do not match an existing shortened message will be redirected to the fallback url. These will likely be either expired messages, random misdirected traffic, or intentional scraping.
|
||||
:param callback_url: URL to receive click events to your webhook whenever the recipients click on the shortened links
|
||||
:param continue_on_failure: Boolean field to set customer delivery preference when there is a failure in linkShortening service
|
||||
:param disable_https: Customer's choice to send links with/without \\\"https://\\\" attached to shortened url. If true, messages will not be sent with https:// at the beginning of the url. If false, messages will be sent with https:// at the beginning of the url. False is the default behavior if it is not specified.
|
||||
|
||||
:returns: The updated DomainConfigInstance
|
||||
"""
|
||||
return self._proxy.update(
|
||||
fallback_url=fallback_url,
|
||||
callback_url=callback_url,
|
||||
continue_on_failure=continue_on_failure,
|
||||
disable_https=disable_https,
|
||||
)
|
||||
|
||||
async def update_async(
|
||||
self,
|
||||
fallback_url: Union[str, object] = values.unset,
|
||||
callback_url: Union[str, object] = values.unset,
|
||||
continue_on_failure: Union[bool, object] = values.unset,
|
||||
disable_https: Union[bool, object] = values.unset,
|
||||
) -> "DomainConfigInstance":
|
||||
"""
|
||||
Asynchronous coroutine to update the DomainConfigInstance
|
||||
|
||||
:param fallback_url: Any requests we receive to this domain that do not match an existing shortened message will be redirected to the fallback url. These will likely be either expired messages, random misdirected traffic, or intentional scraping.
|
||||
:param callback_url: URL to receive click events to your webhook whenever the recipients click on the shortened links
|
||||
:param continue_on_failure: Boolean field to set customer delivery preference when there is a failure in linkShortening service
|
||||
:param disable_https: Customer's choice to send links with/without \\\"https://\\\" attached to shortened url. If true, messages will not be sent with https:// at the beginning of the url. If false, messages will be sent with https:// at the beginning of the url. False is the default behavior if it is not specified.
|
||||
|
||||
:returns: The updated DomainConfigInstance
|
||||
"""
|
||||
return await self._proxy.update_async(
|
||||
fallback_url=fallback_url,
|
||||
callback_url=callback_url,
|
||||
continue_on_failure=continue_on_failure,
|
||||
disable_https=disable_https,
|
||||
)
|
||||
|
||||
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.Messaging.V1.DomainConfigInstance {}>".format(context)
|
||||
|
||||
|
||||
class DomainConfigContext(InstanceContext):
|
||||
def __init__(self, version: Version, domain_sid: str):
|
||||
"""
|
||||
Initialize the DomainConfigContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param domain_sid: Unique string used to identify the domain that this config should be associated with.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"domain_sid": domain_sid,
|
||||
}
|
||||
self._uri = "/LinkShortening/Domains/{domain_sid}/Config".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def fetch(self) -> DomainConfigInstance:
|
||||
"""
|
||||
Fetch the DomainConfigInstance
|
||||
|
||||
|
||||
:returns: The fetched DomainConfigInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return DomainConfigInstance(
|
||||
self._version,
|
||||
payload,
|
||||
domain_sid=self._solution["domain_sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> DomainConfigInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the DomainConfigInstance
|
||||
|
||||
|
||||
:returns: The fetched DomainConfigInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return DomainConfigInstance(
|
||||
self._version,
|
||||
payload,
|
||||
domain_sid=self._solution["domain_sid"],
|
||||
)
|
||||
|
||||
def update(
|
||||
self,
|
||||
fallback_url: Union[str, object] = values.unset,
|
||||
callback_url: Union[str, object] = values.unset,
|
||||
continue_on_failure: Union[bool, object] = values.unset,
|
||||
disable_https: Union[bool, object] = values.unset,
|
||||
) -> DomainConfigInstance:
|
||||
"""
|
||||
Update the DomainConfigInstance
|
||||
|
||||
:param fallback_url: Any requests we receive to this domain that do not match an existing shortened message will be redirected to the fallback url. These will likely be either expired messages, random misdirected traffic, or intentional scraping.
|
||||
:param callback_url: URL to receive click events to your webhook whenever the recipients click on the shortened links
|
||||
:param continue_on_failure: Boolean field to set customer delivery preference when there is a failure in linkShortening service
|
||||
:param disable_https: Customer's choice to send links with/without \\\"https://\\\" attached to shortened url. If true, messages will not be sent with https:// at the beginning of the url. If false, messages will be sent with https:// at the beginning of the url. False is the default behavior if it is not specified.
|
||||
|
||||
:returns: The updated DomainConfigInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FallbackUrl": fallback_url,
|
||||
"CallbackUrl": callback_url,
|
||||
"ContinueOnFailure": continue_on_failure,
|
||||
"DisableHttps": disable_https,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.update(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return DomainConfigInstance(
|
||||
self._version, payload, domain_sid=self._solution["domain_sid"]
|
||||
)
|
||||
|
||||
async def update_async(
|
||||
self,
|
||||
fallback_url: Union[str, object] = values.unset,
|
||||
callback_url: Union[str, object] = values.unset,
|
||||
continue_on_failure: Union[bool, object] = values.unset,
|
||||
disable_https: Union[bool, object] = values.unset,
|
||||
) -> DomainConfigInstance:
|
||||
"""
|
||||
Asynchronous coroutine to update the DomainConfigInstance
|
||||
|
||||
:param fallback_url: Any requests we receive to this domain that do not match an existing shortened message will be redirected to the fallback url. These will likely be either expired messages, random misdirected traffic, or intentional scraping.
|
||||
:param callback_url: URL to receive click events to your webhook whenever the recipients click on the shortened links
|
||||
:param continue_on_failure: Boolean field to set customer delivery preference when there is a failure in linkShortening service
|
||||
:param disable_https: Customer's choice to send links with/without \\\"https://\\\" attached to shortened url. If true, messages will not be sent with https:// at the beginning of the url. If false, messages will be sent with https:// at the beginning of the url. False is the default behavior if it is not specified.
|
||||
|
||||
:returns: The updated DomainConfigInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FallbackUrl": fallback_url,
|
||||
"CallbackUrl": callback_url,
|
||||
"ContinueOnFailure": continue_on_failure,
|
||||
"DisableHttps": disable_https,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.update_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return DomainConfigInstance(
|
||||
self._version, payload, domain_sid=self._solution["domain_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.Messaging.V1.DomainConfigContext {}>".format(context)
|
||||
|
||||
|
||||
class DomainConfigList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the DomainConfigList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
def get(self, domain_sid: str) -> DomainConfigContext:
|
||||
"""
|
||||
Constructs a DomainConfigContext
|
||||
|
||||
:param domain_sid: Unique string used to identify the domain that this config should be associated with.
|
||||
"""
|
||||
return DomainConfigContext(self._version, domain_sid=domain_sid)
|
||||
|
||||
def __call__(self, domain_sid: str) -> DomainConfigContext:
|
||||
"""
|
||||
Constructs a DomainConfigContext
|
||||
|
||||
:param domain_sid: Unique string used to identify the domain that this config should be associated with.
|
||||
"""
|
||||
return DomainConfigContext(self._version, domain_sid=domain_sid)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging.V1.DomainConfigList>"
|
||||
+218
@@ -0,0 +1,218 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Messaging
|
||||
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
|
||||
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 DomainConfigMessagingServiceInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar domain_sid: The unique string that we created to identify the Domain resource.
|
||||
:ivar config_sid: The unique string that we created to identify the Domain config (prefix ZK).
|
||||
:ivar messaging_service_sid: The unique string that identifies the messaging service
|
||||
:ivar fallback_url: Any requests we receive to this domain that do not match an existing shortened message will be redirected to the fallback url. These will likely be either expired messages, random misdirected traffic, or intentional scraping.
|
||||
:ivar callback_url: URL to receive click events to your webhook whenever the recipients click on the shortened links.
|
||||
:ivar continue_on_failure: Boolean field to set customer delivery preference when there is a failure in linkShortening service
|
||||
:ivar date_created: Date this Domain Config was created.
|
||||
:ivar date_updated: Date that this Domain Config was last updated.
|
||||
:ivar url:
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
messaging_service_sid: Optional[str] = None,
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.domain_sid: Optional[str] = payload.get("domain_sid")
|
||||
self.config_sid: Optional[str] = payload.get("config_sid")
|
||||
self.messaging_service_sid: Optional[str] = payload.get("messaging_service_sid")
|
||||
self.fallback_url: Optional[str] = payload.get("fallback_url")
|
||||
self.callback_url: Optional[str] = payload.get("callback_url")
|
||||
self.continue_on_failure: Optional[bool] = payload.get("continue_on_failure")
|
||||
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 = {
|
||||
"messaging_service_sid": messaging_service_sid
|
||||
or self.messaging_service_sid,
|
||||
}
|
||||
self._context: Optional[DomainConfigMessagingServiceContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "DomainConfigMessagingServiceContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: DomainConfigMessagingServiceContext for this DomainConfigMessagingServiceInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = DomainConfigMessagingServiceContext(
|
||||
self._version,
|
||||
messaging_service_sid=self._solution["messaging_service_sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "DomainConfigMessagingServiceInstance":
|
||||
"""
|
||||
Fetch the DomainConfigMessagingServiceInstance
|
||||
|
||||
|
||||
:returns: The fetched DomainConfigMessagingServiceInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "DomainConfigMessagingServiceInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the DomainConfigMessagingServiceInstance
|
||||
|
||||
|
||||
:returns: The fetched DomainConfigMessagingServiceInstance
|
||||
"""
|
||||
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.Messaging.V1.DomainConfigMessagingServiceInstance {}>".format(
|
||||
context
|
||||
)
|
||||
|
||||
|
||||
class DomainConfigMessagingServiceContext(InstanceContext):
|
||||
def __init__(self, version: Version, messaging_service_sid: str):
|
||||
"""
|
||||
Initialize the DomainConfigMessagingServiceContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param messaging_service_sid: Unique string used to identify the Messaging service that this domain should be associated with.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"messaging_service_sid": messaging_service_sid,
|
||||
}
|
||||
self._uri = "/LinkShortening/MessagingService/{messaging_service_sid}/DomainConfig".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def fetch(self) -> DomainConfigMessagingServiceInstance:
|
||||
"""
|
||||
Fetch the DomainConfigMessagingServiceInstance
|
||||
|
||||
|
||||
:returns: The fetched DomainConfigMessagingServiceInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return DomainConfigMessagingServiceInstance(
|
||||
self._version,
|
||||
payload,
|
||||
messaging_service_sid=self._solution["messaging_service_sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> DomainConfigMessagingServiceInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the DomainConfigMessagingServiceInstance
|
||||
|
||||
|
||||
:returns: The fetched DomainConfigMessagingServiceInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return DomainConfigMessagingServiceInstance(
|
||||
self._version,
|
||||
payload,
|
||||
messaging_service_sid=self._solution["messaging_service_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.Messaging.V1.DomainConfigMessagingServiceContext {}>".format(
|
||||
context
|
||||
)
|
||||
|
||||
|
||||
class DomainConfigMessagingServiceList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the DomainConfigMessagingServiceList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
def get(self, messaging_service_sid: str) -> DomainConfigMessagingServiceContext:
|
||||
"""
|
||||
Constructs a DomainConfigMessagingServiceContext
|
||||
|
||||
:param messaging_service_sid: Unique string used to identify the Messaging service that this domain should be associated with.
|
||||
"""
|
||||
return DomainConfigMessagingServiceContext(
|
||||
self._version, messaging_service_sid=messaging_service_sid
|
||||
)
|
||||
|
||||
def __call__(
|
||||
self, messaging_service_sid: str
|
||||
) -> DomainConfigMessagingServiceContext:
|
||||
"""
|
||||
Constructs a DomainConfigMessagingServiceContext
|
||||
|
||||
:param messaging_service_sid: Unique string used to identify the Messaging service that this domain should be associated with.
|
||||
"""
|
||||
return DomainConfigMessagingServiceContext(
|
||||
self._version, messaging_service_sid=messaging_service_sid
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging.V1.DomainConfigMessagingServiceList>"
|
||||
@@ -0,0 +1,126 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Messaging
|
||||
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 ExternalCampaignInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string that identifies a US A2P Compliance resource `QE2c6890da8086d771620e9b13fadeba0b`.
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Campaign belongs to.
|
||||
:ivar campaign_id: ID of the preregistered campaign.
|
||||
:ivar messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) that the resource is associated with.
|
||||
: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.
|
||||
"""
|
||||
|
||||
def __init__(self, version: Version, payload: Dict[str, Any]):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.campaign_id: Optional[str] = payload.get("campaign_id")
|
||||
self.messaging_service_sid: Optional[str] = payload.get("messaging_service_sid")
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
|
||||
return "<Twilio.Messaging.V1.ExternalCampaignInstance>"
|
||||
|
||||
|
||||
class ExternalCampaignList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the ExternalCampaignList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/Services/PreregisteredUsa2p"
|
||||
|
||||
def create(
|
||||
self, campaign_id: str, messaging_service_sid: str
|
||||
) -> ExternalCampaignInstance:
|
||||
"""
|
||||
Create the ExternalCampaignInstance
|
||||
|
||||
:param campaign_id: ID of the preregistered campaign.
|
||||
:param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) that the resource is associated with.
|
||||
|
||||
:returns: The created ExternalCampaignInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"CampaignId": campaign_id,
|
||||
"MessagingServiceSid": messaging_service_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return ExternalCampaignInstance(self._version, payload)
|
||||
|
||||
async def create_async(
|
||||
self, campaign_id: str, messaging_service_sid: str
|
||||
) -> ExternalCampaignInstance:
|
||||
"""
|
||||
Asynchronously create the ExternalCampaignInstance
|
||||
|
||||
:param campaign_id: ID of the preregistered campaign.
|
||||
:param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) that the resource is associated with.
|
||||
|
||||
:returns: The created ExternalCampaignInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"CampaignId": campaign_id,
|
||||
"MessagingServiceSid": messaging_service_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return ExternalCampaignInstance(self._version, payload)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging.V1.ExternalCampaignList>"
|
||||
+256
@@ -0,0 +1,256 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Messaging
|
||||
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
|
||||
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
|
||||
|
||||
|
||||
class LinkshorteningMessagingServiceInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar domain_sid: The unique string identifies the domain resource
|
||||
:ivar messaging_service_sid: The unique string that identifies the messaging service
|
||||
:ivar url:
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
domain_sid: Optional[str] = None,
|
||||
messaging_service_sid: Optional[str] = None,
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.domain_sid: Optional[str] = payload.get("domain_sid")
|
||||
self.messaging_service_sid: Optional[str] = payload.get("messaging_service_sid")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"domain_sid": domain_sid or self.domain_sid,
|
||||
"messaging_service_sid": messaging_service_sid
|
||||
or self.messaging_service_sid,
|
||||
}
|
||||
self._context: Optional[LinkshorteningMessagingServiceContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "LinkshorteningMessagingServiceContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: LinkshorteningMessagingServiceContext for this LinkshorteningMessagingServiceInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = LinkshorteningMessagingServiceContext(
|
||||
self._version,
|
||||
domain_sid=self._solution["domain_sid"],
|
||||
messaging_service_sid=self._solution["messaging_service_sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def create(self) -> "LinkshorteningMessagingServiceInstance":
|
||||
"""
|
||||
Create the LinkshorteningMessagingServiceInstance
|
||||
|
||||
|
||||
:returns: The created LinkshorteningMessagingServiceInstance
|
||||
"""
|
||||
return self._proxy.create()
|
||||
|
||||
async def create_async(self) -> "LinkshorteningMessagingServiceInstance":
|
||||
"""
|
||||
Asynchronous coroutine to create the LinkshorteningMessagingServiceInstance
|
||||
|
||||
|
||||
:returns: The created LinkshorteningMessagingServiceInstance
|
||||
"""
|
||||
return await self._proxy.create_async()
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the LinkshorteningMessagingServiceInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._proxy.delete()
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the LinkshorteningMessagingServiceInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._proxy.delete_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.Messaging.V1.LinkshorteningMessagingServiceInstance {}>".format(
|
||||
context
|
||||
)
|
||||
|
||||
|
||||
class LinkshorteningMessagingServiceContext(InstanceContext):
|
||||
def __init__(self, version: Version, domain_sid: str, messaging_service_sid: str):
|
||||
"""
|
||||
Initialize the LinkshorteningMessagingServiceContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param domain_sid: The domain SID to dissociate from a messaging service. With URL shortening enabled, links in messages sent with the associated messaging service will be shortened to the provided domain
|
||||
:param messaging_service_sid: A messaging service SID to dissociate from a domain. With URL shortening enabled, links in messages sent with the provided messaging service will be shortened to the associated domain
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"domain_sid": domain_sid,
|
||||
"messaging_service_sid": messaging_service_sid,
|
||||
}
|
||||
self._uri = "/LinkShortening/Domains/{domain_sid}/MessagingServices/{messaging_service_sid}".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def create(self) -> LinkshorteningMessagingServiceInstance:
|
||||
"""
|
||||
Create the LinkshorteningMessagingServiceInstance
|
||||
|
||||
|
||||
:returns: The created LinkshorteningMessagingServiceInstance
|
||||
"""
|
||||
data = values.of({})
|
||||
|
||||
payload = self._version.create(method="POST", uri=self._uri, data=data)
|
||||
|
||||
return LinkshorteningMessagingServiceInstance(
|
||||
self._version,
|
||||
payload,
|
||||
domain_sid=self._solution["domain_sid"],
|
||||
messaging_service_sid=self._solution["messaging_service_sid"],
|
||||
)
|
||||
|
||||
async def create_async(self) -> LinkshorteningMessagingServiceInstance:
|
||||
"""
|
||||
Asynchronous coroutine to create the LinkshorteningMessagingServiceInstance
|
||||
|
||||
|
||||
:returns: The created LinkshorteningMessagingServiceInstance
|
||||
"""
|
||||
data = values.of({})
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST", uri=self._uri, data=data
|
||||
)
|
||||
|
||||
return LinkshorteningMessagingServiceInstance(
|
||||
self._version,
|
||||
payload,
|
||||
domain_sid=self._solution["domain_sid"],
|
||||
messaging_service_sid=self._solution["messaging_service_sid"],
|
||||
)
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the LinkshorteningMessagingServiceInstance
|
||||
|
||||
|
||||
: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 LinkshorteningMessagingServiceInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._version.delete_async(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
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.Messaging.V1.LinkshorteningMessagingServiceContext {}>".format(
|
||||
context
|
||||
)
|
||||
|
||||
|
||||
class LinkshorteningMessagingServiceList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the LinkshorteningMessagingServiceList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
def get(
|
||||
self, domain_sid: str, messaging_service_sid: str
|
||||
) -> LinkshorteningMessagingServiceContext:
|
||||
"""
|
||||
Constructs a LinkshorteningMessagingServiceContext
|
||||
|
||||
:param domain_sid: The domain SID to dissociate from a messaging service. With URL shortening enabled, links in messages sent with the associated messaging service will be shortened to the provided domain
|
||||
:param messaging_service_sid: A messaging service SID to dissociate from a domain. With URL shortening enabled, links in messages sent with the provided messaging service will be shortened to the associated domain
|
||||
"""
|
||||
return LinkshorteningMessagingServiceContext(
|
||||
self._version,
|
||||
domain_sid=domain_sid,
|
||||
messaging_service_sid=messaging_service_sid,
|
||||
)
|
||||
|
||||
def __call__(
|
||||
self, domain_sid: str, messaging_service_sid: str
|
||||
) -> LinkshorteningMessagingServiceContext:
|
||||
"""
|
||||
Constructs a LinkshorteningMessagingServiceContext
|
||||
|
||||
:param domain_sid: The domain SID to dissociate from a messaging service. With URL shortening enabled, links in messages sent with the associated messaging service will be shortened to the provided domain
|
||||
:param messaging_service_sid: A messaging service SID to dissociate from a domain. With URL shortening enabled, links in messages sent with the provided messaging service will be shortened to the associated domain
|
||||
"""
|
||||
return LinkshorteningMessagingServiceContext(
|
||||
self._version,
|
||||
domain_sid=domain_sid,
|
||||
messaging_service_sid=messaging_service_sid,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging.V1.LinkshorteningMessagingServiceList>"
|
||||
+212
@@ -0,0 +1,212 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Messaging
|
||||
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
|
||||
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 LinkshorteningMessagingServiceDomainAssociationInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar domain_sid: The unique string that we created to identify the Domain resource.
|
||||
:ivar messaging_service_sid: The unique string that identifies the messaging service
|
||||
:ivar url:
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
messaging_service_sid: Optional[str] = None,
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.domain_sid: Optional[str] = payload.get("domain_sid")
|
||||
self.messaging_service_sid: Optional[str] = payload.get("messaging_service_sid")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"messaging_service_sid": messaging_service_sid
|
||||
or self.messaging_service_sid,
|
||||
}
|
||||
self._context: Optional[
|
||||
LinkshorteningMessagingServiceDomainAssociationContext
|
||||
] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "LinkshorteningMessagingServiceDomainAssociationContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: LinkshorteningMessagingServiceDomainAssociationContext for this LinkshorteningMessagingServiceDomainAssociationInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = LinkshorteningMessagingServiceDomainAssociationContext(
|
||||
self._version,
|
||||
messaging_service_sid=self._solution["messaging_service_sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "LinkshorteningMessagingServiceDomainAssociationInstance":
|
||||
"""
|
||||
Fetch the LinkshorteningMessagingServiceDomainAssociationInstance
|
||||
|
||||
|
||||
:returns: The fetched LinkshorteningMessagingServiceDomainAssociationInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(
|
||||
self,
|
||||
) -> "LinkshorteningMessagingServiceDomainAssociationInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the LinkshorteningMessagingServiceDomainAssociationInstance
|
||||
|
||||
|
||||
:returns: The fetched LinkshorteningMessagingServiceDomainAssociationInstance
|
||||
"""
|
||||
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.Messaging.V1.LinkshorteningMessagingServiceDomainAssociationInstance {}>".format(
|
||||
context
|
||||
)
|
||||
|
||||
|
||||
class LinkshorteningMessagingServiceDomainAssociationContext(InstanceContext):
|
||||
def __init__(self, version: Version, messaging_service_sid: str):
|
||||
"""
|
||||
Initialize the LinkshorteningMessagingServiceDomainAssociationContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param messaging_service_sid: Unique string used to identify the Messaging service that this domain should be associated with.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"messaging_service_sid": messaging_service_sid,
|
||||
}
|
||||
self._uri = (
|
||||
"/LinkShortening/MessagingServices/{messaging_service_sid}/Domain".format(
|
||||
**self._solution
|
||||
)
|
||||
)
|
||||
|
||||
def fetch(self) -> LinkshorteningMessagingServiceDomainAssociationInstance:
|
||||
"""
|
||||
Fetch the LinkshorteningMessagingServiceDomainAssociationInstance
|
||||
|
||||
|
||||
:returns: The fetched LinkshorteningMessagingServiceDomainAssociationInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return LinkshorteningMessagingServiceDomainAssociationInstance(
|
||||
self._version,
|
||||
payload,
|
||||
messaging_service_sid=self._solution["messaging_service_sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(
|
||||
self,
|
||||
) -> LinkshorteningMessagingServiceDomainAssociationInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the LinkshorteningMessagingServiceDomainAssociationInstance
|
||||
|
||||
|
||||
:returns: The fetched LinkshorteningMessagingServiceDomainAssociationInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return LinkshorteningMessagingServiceDomainAssociationInstance(
|
||||
self._version,
|
||||
payload,
|
||||
messaging_service_sid=self._solution["messaging_service_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.Messaging.V1.LinkshorteningMessagingServiceDomainAssociationContext {}>".format(
|
||||
context
|
||||
)
|
||||
|
||||
|
||||
class LinkshorteningMessagingServiceDomainAssociationList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the LinkshorteningMessagingServiceDomainAssociationList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
def get(
|
||||
self, messaging_service_sid: str
|
||||
) -> LinkshorteningMessagingServiceDomainAssociationContext:
|
||||
"""
|
||||
Constructs a LinkshorteningMessagingServiceDomainAssociationContext
|
||||
|
||||
:param messaging_service_sid: Unique string used to identify the Messaging service that this domain should be associated with.
|
||||
"""
|
||||
return LinkshorteningMessagingServiceDomainAssociationContext(
|
||||
self._version, messaging_service_sid=messaging_service_sid
|
||||
)
|
||||
|
||||
def __call__(
|
||||
self, messaging_service_sid: str
|
||||
) -> LinkshorteningMessagingServiceDomainAssociationContext:
|
||||
"""
|
||||
Constructs a LinkshorteningMessagingServiceDomainAssociationContext
|
||||
|
||||
:param messaging_service_sid: Unique string used to identify the Messaging service that this domain should be associated with.
|
||||
"""
|
||||
return LinkshorteningMessagingServiceDomainAssociationContext(
|
||||
self._version, messaging_service_sid=messaging_service_sid
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return (
|
||||
"<Twilio.Messaging.V1.LinkshorteningMessagingServiceDomainAssociationList>"
|
||||
)
|
||||
File diff suppressed because it is too large
Load Diff
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.
BIN
Binary file not shown.
@@ -0,0 +1,517 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Messaging
|
||||
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 AlphaSenderInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string that we created to identify the AlphaSender resource.
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AlphaSender resource.
|
||||
:ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with.
|
||||
: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 alpha_sender: The Alphanumeric Sender ID string.
|
||||
:ivar capabilities: An array of values that describe whether the number can receive calls or messages. Can be: `SMS`.
|
||||
:ivar url: The absolute URL of the AlphaSender resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
service_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.service_sid: Optional[str] = payload.get("service_sid")
|
||||
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.alpha_sender: Optional[str] = payload.get("alpha_sender")
|
||||
self.capabilities: Optional[List[str]] = payload.get("capabilities")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"service_sid": service_sid,
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[AlphaSenderContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "AlphaSenderContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: AlphaSenderContext for this AlphaSenderInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = AlphaSenderContext(
|
||||
self._version,
|
||||
service_sid=self._solution["service_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the AlphaSenderInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._proxy.delete()
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the AlphaSenderInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._proxy.delete_async()
|
||||
|
||||
def fetch(self) -> "AlphaSenderInstance":
|
||||
"""
|
||||
Fetch the AlphaSenderInstance
|
||||
|
||||
|
||||
:returns: The fetched AlphaSenderInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "AlphaSenderInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the AlphaSenderInstance
|
||||
|
||||
|
||||
:returns: The fetched AlphaSenderInstance
|
||||
"""
|
||||
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.Messaging.V1.AlphaSenderInstance {}>".format(context)
|
||||
|
||||
|
||||
class AlphaSenderContext(InstanceContext):
|
||||
def __init__(self, version: Version, service_sid: str, sid: str):
|
||||
"""
|
||||
Initialize the AlphaSenderContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to fetch the resource from.
|
||||
:param sid: The SID of the AlphaSender resource to fetch.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"service_sid": service_sid,
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/Services/{service_sid}/AlphaSenders/{sid}".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the AlphaSenderInstance
|
||||
|
||||
|
||||
: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 AlphaSenderInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._version.delete_async(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
def fetch(self) -> AlphaSenderInstance:
|
||||
"""
|
||||
Fetch the AlphaSenderInstance
|
||||
|
||||
|
||||
:returns: The fetched AlphaSenderInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return AlphaSenderInstance(
|
||||
self._version,
|
||||
payload,
|
||||
service_sid=self._solution["service_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> AlphaSenderInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the AlphaSenderInstance
|
||||
|
||||
|
||||
:returns: The fetched AlphaSenderInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return AlphaSenderInstance(
|
||||
self._version,
|
||||
payload,
|
||||
service_sid=self._solution["service_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.Messaging.V1.AlphaSenderContext {}>".format(context)
|
||||
|
||||
|
||||
class AlphaSenderPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> AlphaSenderInstance:
|
||||
"""
|
||||
Build an instance of AlphaSenderInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return AlphaSenderInstance(
|
||||
self._version, payload, service_sid=self._solution["service_sid"]
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging.V1.AlphaSenderPage>"
|
||||
|
||||
|
||||
class AlphaSenderList(ListResource):
|
||||
def __init__(self, version: Version, service_sid: str):
|
||||
"""
|
||||
Initialize the AlphaSenderList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to read the resources from.
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"service_sid": service_sid,
|
||||
}
|
||||
self._uri = "/Services/{service_sid}/AlphaSenders".format(**self._solution)
|
||||
|
||||
def create(self, alpha_sender: str) -> AlphaSenderInstance:
|
||||
"""
|
||||
Create the AlphaSenderInstance
|
||||
|
||||
:param alpha_sender: The Alphanumeric Sender ID string. Can be up to 11 characters long. Valid characters are A-Z, a-z, 0-9, space, hyphen `-`, plus `+`, underscore `_` and ampersand `&`. This value cannot contain only numbers.
|
||||
|
||||
:returns: The created AlphaSenderInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"AlphaSender": alpha_sender,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return AlphaSenderInstance(
|
||||
self._version, payload, service_sid=self._solution["service_sid"]
|
||||
)
|
||||
|
||||
async def create_async(self, alpha_sender: str) -> AlphaSenderInstance:
|
||||
"""
|
||||
Asynchronously create the AlphaSenderInstance
|
||||
|
||||
:param alpha_sender: The Alphanumeric Sender ID string. Can be up to 11 characters long. Valid characters are A-Z, a-z, 0-9, space, hyphen `-`, plus `+`, underscore `_` and ampersand `&`. This value cannot contain only numbers.
|
||||
|
||||
:returns: The created AlphaSenderInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"AlphaSender": alpha_sender,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return AlphaSenderInstance(
|
||||
self._version, payload, service_sid=self._solution["service_sid"]
|
||||
)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[AlphaSenderInstance]:
|
||||
"""
|
||||
Streams AlphaSenderInstance 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[AlphaSenderInstance]:
|
||||
"""
|
||||
Asynchronously streams AlphaSenderInstance 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[AlphaSenderInstance]:
|
||||
"""
|
||||
Lists AlphaSenderInstance 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[AlphaSenderInstance]:
|
||||
"""
|
||||
Asynchronously lists AlphaSenderInstance 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,
|
||||
) -> AlphaSenderPage:
|
||||
"""
|
||||
Retrieve a single page of AlphaSenderInstance 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 AlphaSenderInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return AlphaSenderPage(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,
|
||||
) -> AlphaSenderPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of AlphaSenderInstance 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 AlphaSenderInstance
|
||||
"""
|
||||
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 AlphaSenderPage(self._version, response, self._solution)
|
||||
|
||||
def get_page(self, target_url: str) -> AlphaSenderPage:
|
||||
"""
|
||||
Retrieve a specific page of AlphaSenderInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of AlphaSenderInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return AlphaSenderPage(self._version, response, self._solution)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> AlphaSenderPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of AlphaSenderInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of AlphaSenderInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return AlphaSenderPage(self._version, response, self._solution)
|
||||
|
||||
def get(self, sid: str) -> AlphaSenderContext:
|
||||
"""
|
||||
Constructs a AlphaSenderContext
|
||||
|
||||
:param sid: The SID of the AlphaSender resource to fetch.
|
||||
"""
|
||||
return AlphaSenderContext(
|
||||
self._version, service_sid=self._solution["service_sid"], sid=sid
|
||||
)
|
||||
|
||||
def __call__(self, sid: str) -> AlphaSenderContext:
|
||||
"""
|
||||
Constructs a AlphaSenderContext
|
||||
|
||||
:param sid: The SID of the AlphaSender resource to fetch.
|
||||
"""
|
||||
return AlphaSenderContext(
|
||||
self._version, service_sid=self._solution["service_sid"], sid=sid
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging.V1.AlphaSenderList>"
|
||||
@@ -0,0 +1,437 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Messaging
|
||||
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 ChannelSenderInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ChannelSender resource.
|
||||
:ivar messaging_service_sid: The SID of the [Service](https://www.twilio.com/docs/messaging/services) the resource is associated with.
|
||||
:ivar sid: The unique string that we created to identify the ChannelSender resource.
|
||||
:ivar sender: The unique string that identifies the sender e.g whatsapp:+123456XXXX.
|
||||
:ivar sender_type: A string value that identifies the sender type e.g WhatsApp, Messenger.
|
||||
:ivar country_code: The 2-character [ISO Country Code](https://www.iso.org/iso-3166-country-codes.html) of the number.
|
||||
: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:
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
messaging_service_sid: str,
|
||||
sid: Optional[str] = None,
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.messaging_service_sid: Optional[str] = payload.get("messaging_service_sid")
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.sender: Optional[str] = payload.get("sender")
|
||||
self.sender_type: Optional[str] = payload.get("sender_type")
|
||||
self.country_code: Optional[str] = payload.get("country_code")
|
||||
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 = {
|
||||
"messaging_service_sid": messaging_service_sid,
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[ChannelSenderContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "ChannelSenderContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: ChannelSenderContext for this ChannelSenderInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = ChannelSenderContext(
|
||||
self._version,
|
||||
messaging_service_sid=self._solution["messaging_service_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "ChannelSenderInstance":
|
||||
"""
|
||||
Fetch the ChannelSenderInstance
|
||||
|
||||
|
||||
:returns: The fetched ChannelSenderInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "ChannelSenderInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the ChannelSenderInstance
|
||||
|
||||
|
||||
:returns: The fetched ChannelSenderInstance
|
||||
"""
|
||||
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.Messaging.V1.ChannelSenderInstance {}>".format(context)
|
||||
|
||||
|
||||
class ChannelSenderContext(InstanceContext):
|
||||
def __init__(self, version: Version, messaging_service_sid: str, sid: str):
|
||||
"""
|
||||
Initialize the ChannelSenderContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param messaging_service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to fetch the resource from.
|
||||
:param sid: The SID of the ChannelSender resource to fetch.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"messaging_service_sid": messaging_service_sid,
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/Services/{messaging_service_sid}/ChannelSenders/{sid}".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def fetch(self) -> ChannelSenderInstance:
|
||||
"""
|
||||
Fetch the ChannelSenderInstance
|
||||
|
||||
|
||||
:returns: The fetched ChannelSenderInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return ChannelSenderInstance(
|
||||
self._version,
|
||||
payload,
|
||||
messaging_service_sid=self._solution["messaging_service_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> ChannelSenderInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the ChannelSenderInstance
|
||||
|
||||
|
||||
:returns: The fetched ChannelSenderInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return ChannelSenderInstance(
|
||||
self._version,
|
||||
payload,
|
||||
messaging_service_sid=self._solution["messaging_service_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.Messaging.V1.ChannelSenderContext {}>".format(context)
|
||||
|
||||
|
||||
class ChannelSenderPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> ChannelSenderInstance:
|
||||
"""
|
||||
Build an instance of ChannelSenderInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return ChannelSenderInstance(
|
||||
self._version,
|
||||
payload,
|
||||
messaging_service_sid=self._solution["messaging_service_sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging.V1.ChannelSenderPage>"
|
||||
|
||||
|
||||
class ChannelSenderList(ListResource):
|
||||
def __init__(self, version: Version, messaging_service_sid: str):
|
||||
"""
|
||||
Initialize the ChannelSenderList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param messaging_service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to read the resources from.
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"messaging_service_sid": messaging_service_sid,
|
||||
}
|
||||
self._uri = "/Services/{messaging_service_sid}/ChannelSenders".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[ChannelSenderInstance]:
|
||||
"""
|
||||
Streams ChannelSenderInstance 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[ChannelSenderInstance]:
|
||||
"""
|
||||
Asynchronously streams ChannelSenderInstance 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[ChannelSenderInstance]:
|
||||
"""
|
||||
Lists ChannelSenderInstance 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[ChannelSenderInstance]:
|
||||
"""
|
||||
Asynchronously lists ChannelSenderInstance 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,
|
||||
) -> ChannelSenderPage:
|
||||
"""
|
||||
Retrieve a single page of ChannelSenderInstance 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 ChannelSenderInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return ChannelSenderPage(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,
|
||||
) -> ChannelSenderPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of ChannelSenderInstance 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 ChannelSenderInstance
|
||||
"""
|
||||
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 ChannelSenderPage(self._version, response, self._solution)
|
||||
|
||||
def get_page(self, target_url: str) -> ChannelSenderPage:
|
||||
"""
|
||||
Retrieve a specific page of ChannelSenderInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of ChannelSenderInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return ChannelSenderPage(self._version, response, self._solution)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> ChannelSenderPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of ChannelSenderInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of ChannelSenderInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return ChannelSenderPage(self._version, response, self._solution)
|
||||
|
||||
def get(self, sid: str) -> ChannelSenderContext:
|
||||
"""
|
||||
Constructs a ChannelSenderContext
|
||||
|
||||
:param sid: The SID of the ChannelSender resource to fetch.
|
||||
"""
|
||||
return ChannelSenderContext(
|
||||
self._version,
|
||||
messaging_service_sid=self._solution["messaging_service_sid"],
|
||||
sid=sid,
|
||||
)
|
||||
|
||||
def __call__(self, sid: str) -> ChannelSenderContext:
|
||||
"""
|
||||
Constructs a ChannelSenderContext
|
||||
|
||||
:param sid: The SID of the ChannelSender resource to fetch.
|
||||
"""
|
||||
return ChannelSenderContext(
|
||||
self._version,
|
||||
messaging_service_sid=self._solution["messaging_service_sid"],
|
||||
sid=sid,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging.V1.ChannelSenderList>"
|
||||
@@ -0,0 +1,519 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Messaging
|
||||
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 PhoneNumberInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string that we created to identify the PhoneNumber resource.
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PhoneNumber resource.
|
||||
:ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with.
|
||||
: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 phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number.
|
||||
:ivar country_code: The 2-character [ISO Country Code](https://www.iso.org/iso-3166-country-codes.html) of the number.
|
||||
:ivar capabilities: An array of values that describe whether the number can receive calls or messages. Can be: `Voice`, `SMS`, and `MMS`.
|
||||
:ivar url: The absolute URL of the PhoneNumber resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
service_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.service_sid: Optional[str] = payload.get("service_sid")
|
||||
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.phone_number: Optional[str] = payload.get("phone_number")
|
||||
self.country_code: Optional[str] = payload.get("country_code")
|
||||
self.capabilities: Optional[List[str]] = payload.get("capabilities")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"service_sid": service_sid,
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[PhoneNumberContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "PhoneNumberContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: PhoneNumberContext for this PhoneNumberInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = PhoneNumberContext(
|
||||
self._version,
|
||||
service_sid=self._solution["service_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the PhoneNumberInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._proxy.delete()
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the PhoneNumberInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._proxy.delete_async()
|
||||
|
||||
def fetch(self) -> "PhoneNumberInstance":
|
||||
"""
|
||||
Fetch the PhoneNumberInstance
|
||||
|
||||
|
||||
:returns: The fetched PhoneNumberInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "PhoneNumberInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the PhoneNumberInstance
|
||||
|
||||
|
||||
:returns: The fetched PhoneNumberInstance
|
||||
"""
|
||||
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.Messaging.V1.PhoneNumberInstance {}>".format(context)
|
||||
|
||||
|
||||
class PhoneNumberContext(InstanceContext):
|
||||
def __init__(self, version: Version, service_sid: str, sid: str):
|
||||
"""
|
||||
Initialize the PhoneNumberContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to fetch the resource from.
|
||||
:param sid: The SID of the PhoneNumber resource to fetch.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"service_sid": service_sid,
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/Services/{service_sid}/PhoneNumbers/{sid}".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the PhoneNumberInstance
|
||||
|
||||
|
||||
: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 PhoneNumberInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._version.delete_async(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
def fetch(self) -> PhoneNumberInstance:
|
||||
"""
|
||||
Fetch the PhoneNumberInstance
|
||||
|
||||
|
||||
:returns: The fetched PhoneNumberInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return PhoneNumberInstance(
|
||||
self._version,
|
||||
payload,
|
||||
service_sid=self._solution["service_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> PhoneNumberInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the PhoneNumberInstance
|
||||
|
||||
|
||||
:returns: The fetched PhoneNumberInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return PhoneNumberInstance(
|
||||
self._version,
|
||||
payload,
|
||||
service_sid=self._solution["service_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.Messaging.V1.PhoneNumberContext {}>".format(context)
|
||||
|
||||
|
||||
class PhoneNumberPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> PhoneNumberInstance:
|
||||
"""
|
||||
Build an instance of PhoneNumberInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return PhoneNumberInstance(
|
||||
self._version, payload, service_sid=self._solution["service_sid"]
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging.V1.PhoneNumberPage>"
|
||||
|
||||
|
||||
class PhoneNumberList(ListResource):
|
||||
def __init__(self, version: Version, service_sid: str):
|
||||
"""
|
||||
Initialize the PhoneNumberList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to read the resources from.
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"service_sid": service_sid,
|
||||
}
|
||||
self._uri = "/Services/{service_sid}/PhoneNumbers".format(**self._solution)
|
||||
|
||||
def create(self, phone_number_sid: str) -> PhoneNumberInstance:
|
||||
"""
|
||||
Create the PhoneNumberInstance
|
||||
|
||||
:param phone_number_sid: The SID of the Phone Number being added to the Service.
|
||||
|
||||
:returns: The created PhoneNumberInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PhoneNumberSid": phone_number_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return PhoneNumberInstance(
|
||||
self._version, payload, service_sid=self._solution["service_sid"]
|
||||
)
|
||||
|
||||
async def create_async(self, phone_number_sid: str) -> PhoneNumberInstance:
|
||||
"""
|
||||
Asynchronously create the PhoneNumberInstance
|
||||
|
||||
:param phone_number_sid: The SID of the Phone Number being added to the Service.
|
||||
|
||||
:returns: The created PhoneNumberInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PhoneNumberSid": phone_number_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return PhoneNumberInstance(
|
||||
self._version, payload, service_sid=self._solution["service_sid"]
|
||||
)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[PhoneNumberInstance]:
|
||||
"""
|
||||
Streams PhoneNumberInstance 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[PhoneNumberInstance]:
|
||||
"""
|
||||
Asynchronously streams PhoneNumberInstance 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[PhoneNumberInstance]:
|
||||
"""
|
||||
Lists PhoneNumberInstance 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[PhoneNumberInstance]:
|
||||
"""
|
||||
Asynchronously lists PhoneNumberInstance 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,
|
||||
) -> PhoneNumberPage:
|
||||
"""
|
||||
Retrieve a single page of PhoneNumberInstance 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 PhoneNumberInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return PhoneNumberPage(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,
|
||||
) -> PhoneNumberPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of PhoneNumberInstance 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 PhoneNumberInstance
|
||||
"""
|
||||
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 PhoneNumberPage(self._version, response, self._solution)
|
||||
|
||||
def get_page(self, target_url: str) -> PhoneNumberPage:
|
||||
"""
|
||||
Retrieve a specific page of PhoneNumberInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of PhoneNumberInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return PhoneNumberPage(self._version, response, self._solution)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> PhoneNumberPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of PhoneNumberInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of PhoneNumberInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return PhoneNumberPage(self._version, response, self._solution)
|
||||
|
||||
def get(self, sid: str) -> PhoneNumberContext:
|
||||
"""
|
||||
Constructs a PhoneNumberContext
|
||||
|
||||
:param sid: The SID of the PhoneNumber resource to fetch.
|
||||
"""
|
||||
return PhoneNumberContext(
|
||||
self._version, service_sid=self._solution["service_sid"], sid=sid
|
||||
)
|
||||
|
||||
def __call__(self, sid: str) -> PhoneNumberContext:
|
||||
"""
|
||||
Constructs a PhoneNumberContext
|
||||
|
||||
:param sid: The SID of the PhoneNumber resource to fetch.
|
||||
"""
|
||||
return PhoneNumberContext(
|
||||
self._version, service_sid=self._solution["service_sid"], sid=sid
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging.V1.PhoneNumberList>"
|
||||
@@ -0,0 +1,517 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Messaging
|
||||
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 ShortCodeInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string that we created to identify the ShortCode resource.
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ShortCode resource.
|
||||
:ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with.
|
||||
: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 short_code: The [E.164](https://www.twilio.com/docs/glossary/what-e164) format of the short code.
|
||||
:ivar country_code: The 2-character [ISO Country Code](https://www.iso.org/iso-3166-country-codes.html) of the number.
|
||||
:ivar capabilities: An array of values that describe whether the number can receive calls or messages. Can be: `SMS` and `MMS`.
|
||||
:ivar url: The absolute URL of the ShortCode resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
service_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.service_sid: Optional[str] = payload.get("service_sid")
|
||||
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.short_code: Optional[str] = payload.get("short_code")
|
||||
self.country_code: Optional[str] = payload.get("country_code")
|
||||
self.capabilities: Optional[List[str]] = payload.get("capabilities")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"service_sid": service_sid,
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[ShortCodeContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "ShortCodeContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: ShortCodeContext for this ShortCodeInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = ShortCodeContext(
|
||||
self._version,
|
||||
service_sid=self._solution["service_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the ShortCodeInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._proxy.delete()
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the ShortCodeInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._proxy.delete_async()
|
||||
|
||||
def fetch(self) -> "ShortCodeInstance":
|
||||
"""
|
||||
Fetch the ShortCodeInstance
|
||||
|
||||
|
||||
:returns: The fetched ShortCodeInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "ShortCodeInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the ShortCodeInstance
|
||||
|
||||
|
||||
:returns: The fetched ShortCodeInstance
|
||||
"""
|
||||
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.Messaging.V1.ShortCodeInstance {}>".format(context)
|
||||
|
||||
|
||||
class ShortCodeContext(InstanceContext):
|
||||
def __init__(self, version: Version, service_sid: str, sid: str):
|
||||
"""
|
||||
Initialize the ShortCodeContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to fetch the resource from.
|
||||
:param sid: The SID of the ShortCode resource to fetch.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"service_sid": service_sid,
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/Services/{service_sid}/ShortCodes/{sid}".format(**self._solution)
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the ShortCodeInstance
|
||||
|
||||
|
||||
: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 ShortCodeInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._version.delete_async(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
def fetch(self) -> ShortCodeInstance:
|
||||
"""
|
||||
Fetch the ShortCodeInstance
|
||||
|
||||
|
||||
:returns: The fetched ShortCodeInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return ShortCodeInstance(
|
||||
self._version,
|
||||
payload,
|
||||
service_sid=self._solution["service_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> ShortCodeInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the ShortCodeInstance
|
||||
|
||||
|
||||
:returns: The fetched ShortCodeInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return ShortCodeInstance(
|
||||
self._version,
|
||||
payload,
|
||||
service_sid=self._solution["service_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.Messaging.V1.ShortCodeContext {}>".format(context)
|
||||
|
||||
|
||||
class ShortCodePage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> ShortCodeInstance:
|
||||
"""
|
||||
Build an instance of ShortCodeInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return ShortCodeInstance(
|
||||
self._version, payload, service_sid=self._solution["service_sid"]
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging.V1.ShortCodePage>"
|
||||
|
||||
|
||||
class ShortCodeList(ListResource):
|
||||
def __init__(self, version: Version, service_sid: str):
|
||||
"""
|
||||
Initialize the ShortCodeList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to read the resources from.
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"service_sid": service_sid,
|
||||
}
|
||||
self._uri = "/Services/{service_sid}/ShortCodes".format(**self._solution)
|
||||
|
||||
def create(self, short_code_sid: str) -> ShortCodeInstance:
|
||||
"""
|
||||
Create the ShortCodeInstance
|
||||
|
||||
:param short_code_sid: The SID of the ShortCode resource being added to the Service.
|
||||
|
||||
:returns: The created ShortCodeInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"ShortCodeSid": short_code_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return ShortCodeInstance(
|
||||
self._version, payload, service_sid=self._solution["service_sid"]
|
||||
)
|
||||
|
||||
async def create_async(self, short_code_sid: str) -> ShortCodeInstance:
|
||||
"""
|
||||
Asynchronously create the ShortCodeInstance
|
||||
|
||||
:param short_code_sid: The SID of the ShortCode resource being added to the Service.
|
||||
|
||||
:returns: The created ShortCodeInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"ShortCodeSid": short_code_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return ShortCodeInstance(
|
||||
self._version, payload, service_sid=self._solution["service_sid"]
|
||||
)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[ShortCodeInstance]:
|
||||
"""
|
||||
Streams ShortCodeInstance 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[ShortCodeInstance]:
|
||||
"""
|
||||
Asynchronously streams ShortCodeInstance 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[ShortCodeInstance]:
|
||||
"""
|
||||
Lists ShortCodeInstance 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[ShortCodeInstance]:
|
||||
"""
|
||||
Asynchronously lists ShortCodeInstance 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,
|
||||
) -> ShortCodePage:
|
||||
"""
|
||||
Retrieve a single page of ShortCodeInstance 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 ShortCodeInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return ShortCodePage(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,
|
||||
) -> ShortCodePage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of ShortCodeInstance 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 ShortCodeInstance
|
||||
"""
|
||||
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 ShortCodePage(self._version, response, self._solution)
|
||||
|
||||
def get_page(self, target_url: str) -> ShortCodePage:
|
||||
"""
|
||||
Retrieve a specific page of ShortCodeInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of ShortCodeInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return ShortCodePage(self._version, response, self._solution)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> ShortCodePage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of ShortCodeInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of ShortCodeInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return ShortCodePage(self._version, response, self._solution)
|
||||
|
||||
def get(self, sid: str) -> ShortCodeContext:
|
||||
"""
|
||||
Constructs a ShortCodeContext
|
||||
|
||||
:param sid: The SID of the ShortCode resource to fetch.
|
||||
"""
|
||||
return ShortCodeContext(
|
||||
self._version, service_sid=self._solution["service_sid"], sid=sid
|
||||
)
|
||||
|
||||
def __call__(self, sid: str) -> ShortCodeContext:
|
||||
"""
|
||||
Constructs a ShortCodeContext
|
||||
|
||||
:param sid: The SID of the ShortCode resource to fetch.
|
||||
"""
|
||||
return ShortCodeContext(
|
||||
self._version, service_sid=self._solution["service_sid"], sid=sid
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging.V1.ShortCodeList>"
|
||||
+647
@@ -0,0 +1,647 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Messaging
|
||||
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 UsAppToPersonInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string that identifies a US A2P Compliance resource `QE2c6890da8086d771620e9b13fadeba0b`.
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Campaign belongs to.
|
||||
:ivar brand_registration_sid: The unique string to identify the A2P brand.
|
||||
:ivar messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) that the resource is associated with.
|
||||
:ivar description: A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters.
|
||||
:ivar message_samples: An array of sample message strings, min two and max five. Min length for each sample: 20 chars. Max length for each sample: 1024 chars.
|
||||
:ivar us_app_to_person_usecase: A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING, SOLE_PROPRIETOR...]. SOLE_PROPRIETOR campaign use cases can only be created by SOLE_PROPRIETOR Brands, and there can only be one SOLE_PROPRIETOR campaign created per SOLE_PROPRIETOR Brand.
|
||||
:ivar has_embedded_links: Indicate that this SMS campaign will send messages that contain links.
|
||||
:ivar has_embedded_phone: Indicates that this SMS campaign will send messages that contain phone numbers.
|
||||
:ivar campaign_status: Campaign status. Examples: IN_PROGRESS, VERIFIED, FAILED.
|
||||
:ivar campaign_id: The Campaign Registry (TCR) Campaign ID.
|
||||
:ivar is_externally_registered: Indicates whether the campaign was registered externally or not.
|
||||
:ivar rate_limits: Rate limit and/or classification set by each carrier, Ex. AT&T or T-Mobile.
|
||||
:ivar message_flow: Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum.
|
||||
:ivar opt_in_message: If end users can text in a keyword to start receiving messages from this campaign, the auto-reply messages sent to the end users must be provided. The opt-in response should include the Brand name, confirmation of opt-in enrollment to a recurring message campaign, how to get help, and clear description of how to opt-out. This field is required if end users can text in a keyword to start receiving messages from this campaign. 20 character minimum. 320 character maximum.
|
||||
:ivar opt_out_message: Upon receiving the opt-out keywords from the end users, Twilio customers are expected to send back an auto-generated response, which must provide acknowledgment of the opt-out request and confirmation that no further messages will be sent. It is also recommended that these opt-out messages include the brand name. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum.
|
||||
:ivar help_message: When customers receive the help keywords from their end users, Twilio customers are expected to send back an auto-generated response; this may include the brand name and additional support contact information. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum.
|
||||
:ivar opt_in_keywords: If end users can text in a keyword to start receiving messages from this campaign, those keywords must be provided. This field is required if end users can text in a keyword to start receiving messages from this campaign. Values must be alphanumeric. 255 character maximum.
|
||||
:ivar opt_out_keywords: End users should be able to text in a keyword to stop receiving messages from this campaign. Those keywords must be provided. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum.
|
||||
:ivar help_keywords: End users should be able to text in a keyword to receive help. Those keywords must be provided as part of the campaign registration request. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum.
|
||||
: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 US App to Person resource.
|
||||
:ivar mock: A boolean that specifies whether campaign is a mock or not. Mock campaigns will be automatically created if using a mock brand. Mock campaigns should only be used for testing purposes.
|
||||
:ivar errors: Details indicating why a campaign registration failed. These errors can indicate one or more fields that were incorrect or did not meet review requirements.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
messaging_service_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.brand_registration_sid: Optional[str] = payload.get(
|
||||
"brand_registration_sid"
|
||||
)
|
||||
self.messaging_service_sid: Optional[str] = payload.get("messaging_service_sid")
|
||||
self.description: Optional[str] = payload.get("description")
|
||||
self.message_samples: Optional[List[str]] = payload.get("message_samples")
|
||||
self.us_app_to_person_usecase: Optional[str] = payload.get(
|
||||
"us_app_to_person_usecase"
|
||||
)
|
||||
self.has_embedded_links: Optional[bool] = payload.get("has_embedded_links")
|
||||
self.has_embedded_phone: Optional[bool] = payload.get("has_embedded_phone")
|
||||
self.campaign_status: Optional[str] = payload.get("campaign_status")
|
||||
self.campaign_id: Optional[str] = payload.get("campaign_id")
|
||||
self.is_externally_registered: Optional[bool] = payload.get(
|
||||
"is_externally_registered"
|
||||
)
|
||||
self.rate_limits: Optional[Dict[str, object]] = payload.get("rate_limits")
|
||||
self.message_flow: Optional[str] = payload.get("message_flow")
|
||||
self.opt_in_message: Optional[str] = payload.get("opt_in_message")
|
||||
self.opt_out_message: Optional[str] = payload.get("opt_out_message")
|
||||
self.help_message: Optional[str] = payload.get("help_message")
|
||||
self.opt_in_keywords: Optional[List[str]] = payload.get("opt_in_keywords")
|
||||
self.opt_out_keywords: Optional[List[str]] = payload.get("opt_out_keywords")
|
||||
self.help_keywords: Optional[List[str]] = payload.get("help_keywords")
|
||||
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.mock: Optional[bool] = payload.get("mock")
|
||||
self.errors: Optional[List[object]] = payload.get("errors")
|
||||
|
||||
self._solution = {
|
||||
"messaging_service_sid": messaging_service_sid,
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[UsAppToPersonContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "UsAppToPersonContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: UsAppToPersonContext for this UsAppToPersonInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = UsAppToPersonContext(
|
||||
self._version,
|
||||
messaging_service_sid=self._solution["messaging_service_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the UsAppToPersonInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._proxy.delete()
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the UsAppToPersonInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._proxy.delete_async()
|
||||
|
||||
def fetch(self) -> "UsAppToPersonInstance":
|
||||
"""
|
||||
Fetch the UsAppToPersonInstance
|
||||
|
||||
|
||||
:returns: The fetched UsAppToPersonInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "UsAppToPersonInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the UsAppToPersonInstance
|
||||
|
||||
|
||||
:returns: The fetched UsAppToPersonInstance
|
||||
"""
|
||||
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.Messaging.V1.UsAppToPersonInstance {}>".format(context)
|
||||
|
||||
|
||||
class UsAppToPersonContext(InstanceContext):
|
||||
def __init__(self, version: Version, messaging_service_sid: str, sid: str):
|
||||
"""
|
||||
Initialize the UsAppToPersonContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) to fetch the resource from.
|
||||
:param sid: The SID of the US A2P Compliance resource to fetch `QE2c6890da8086d771620e9b13fadeba0b`.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"messaging_service_sid": messaging_service_sid,
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/Services/{messaging_service_sid}/Compliance/Usa2p/{sid}".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the UsAppToPersonInstance
|
||||
|
||||
|
||||
: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 UsAppToPersonInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._version.delete_async(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
def fetch(self) -> UsAppToPersonInstance:
|
||||
"""
|
||||
Fetch the UsAppToPersonInstance
|
||||
|
||||
|
||||
:returns: The fetched UsAppToPersonInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return UsAppToPersonInstance(
|
||||
self._version,
|
||||
payload,
|
||||
messaging_service_sid=self._solution["messaging_service_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> UsAppToPersonInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the UsAppToPersonInstance
|
||||
|
||||
|
||||
:returns: The fetched UsAppToPersonInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return UsAppToPersonInstance(
|
||||
self._version,
|
||||
payload,
|
||||
messaging_service_sid=self._solution["messaging_service_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.Messaging.V1.UsAppToPersonContext {}>".format(context)
|
||||
|
||||
|
||||
class UsAppToPersonPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> UsAppToPersonInstance:
|
||||
"""
|
||||
Build an instance of UsAppToPersonInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return UsAppToPersonInstance(
|
||||
self._version,
|
||||
payload,
|
||||
messaging_service_sid=self._solution["messaging_service_sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging.V1.UsAppToPersonPage>"
|
||||
|
||||
|
||||
class UsAppToPersonList(ListResource):
|
||||
def __init__(self, version: Version, messaging_service_sid: str):
|
||||
"""
|
||||
Initialize the UsAppToPersonList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) to fetch the resource from.
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"messaging_service_sid": messaging_service_sid,
|
||||
}
|
||||
self._uri = "/Services/{messaging_service_sid}/Compliance/Usa2p".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def create(
|
||||
self,
|
||||
brand_registration_sid: str,
|
||||
description: str,
|
||||
message_flow: str,
|
||||
message_samples: List[str],
|
||||
us_app_to_person_usecase: str,
|
||||
has_embedded_links: bool,
|
||||
has_embedded_phone: bool,
|
||||
opt_in_message: Union[str, object] = values.unset,
|
||||
opt_out_message: Union[str, object] = values.unset,
|
||||
help_message: Union[str, object] = values.unset,
|
||||
opt_in_keywords: Union[List[str], object] = values.unset,
|
||||
opt_out_keywords: Union[List[str], object] = values.unset,
|
||||
help_keywords: Union[List[str], object] = values.unset,
|
||||
) -> UsAppToPersonInstance:
|
||||
"""
|
||||
Create the UsAppToPersonInstance
|
||||
|
||||
:param brand_registration_sid: A2P Brand Registration SID
|
||||
:param description: A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters.
|
||||
:param message_flow: Required for all Campaigns. Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum.
|
||||
:param message_samples: An array of sample message strings, min two and max five. Min length for each sample: 20 chars. Max length for each sample: 1024 chars.
|
||||
:param us_app_to_person_usecase: A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING..]
|
||||
:param has_embedded_links: Indicates that this SMS campaign will send messages that contain links.
|
||||
:param has_embedded_phone: Indicates that this SMS campaign will send messages that contain phone numbers.
|
||||
:param opt_in_message: If end users can text in a keyword to start receiving messages from this campaign, the auto-reply messages sent to the end users must be provided. The opt-in response should include the Brand name, confirmation of opt-in enrollment to a recurring message campaign, how to get help, and clear description of how to opt-out. This field is required if end users can text in a keyword to start receiving messages from this campaign. 20 character minimum. 320 character maximum.
|
||||
:param opt_out_message: Upon receiving the opt-out keywords from the end users, Twilio customers are expected to send back an auto-generated response, which must provide acknowledgment of the opt-out request and confirmation that no further messages will be sent. It is also recommended that these opt-out messages include the brand name. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum.
|
||||
:param help_message: When customers receive the help keywords from their end users, Twilio customers are expected to send back an auto-generated response; this may include the brand name and additional support contact information. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum.
|
||||
:param opt_in_keywords: If end users can text in a keyword to start receiving messages from this campaign, those keywords must be provided. This field is required if end users can text in a keyword to start receiving messages from this campaign. Values must be alphanumeric. 255 character maximum.
|
||||
:param opt_out_keywords: End users should be able to text in a keyword to stop receiving messages from this campaign. Those keywords must be provided. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum.
|
||||
:param help_keywords: End users should be able to text in a keyword to receive help. Those keywords must be provided as part of the campaign registration request. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum.
|
||||
|
||||
:returns: The created UsAppToPersonInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"BrandRegistrationSid": brand_registration_sid,
|
||||
"Description": description,
|
||||
"MessageFlow": message_flow,
|
||||
"MessageSamples": serialize.map(message_samples, lambda e: e),
|
||||
"UsAppToPersonUsecase": us_app_to_person_usecase,
|
||||
"HasEmbeddedLinks": has_embedded_links,
|
||||
"HasEmbeddedPhone": has_embedded_phone,
|
||||
"OptInMessage": opt_in_message,
|
||||
"OptOutMessage": opt_out_message,
|
||||
"HelpMessage": help_message,
|
||||
"OptInKeywords": serialize.map(opt_in_keywords, lambda e: e),
|
||||
"OptOutKeywords": serialize.map(opt_out_keywords, lambda e: e),
|
||||
"HelpKeywords": serialize.map(help_keywords, lambda e: e),
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return UsAppToPersonInstance(
|
||||
self._version,
|
||||
payload,
|
||||
messaging_service_sid=self._solution["messaging_service_sid"],
|
||||
)
|
||||
|
||||
async def create_async(
|
||||
self,
|
||||
brand_registration_sid: str,
|
||||
description: str,
|
||||
message_flow: str,
|
||||
message_samples: List[str],
|
||||
us_app_to_person_usecase: str,
|
||||
has_embedded_links: bool,
|
||||
has_embedded_phone: bool,
|
||||
opt_in_message: Union[str, object] = values.unset,
|
||||
opt_out_message: Union[str, object] = values.unset,
|
||||
help_message: Union[str, object] = values.unset,
|
||||
opt_in_keywords: Union[List[str], object] = values.unset,
|
||||
opt_out_keywords: Union[List[str], object] = values.unset,
|
||||
help_keywords: Union[List[str], object] = values.unset,
|
||||
) -> UsAppToPersonInstance:
|
||||
"""
|
||||
Asynchronously create the UsAppToPersonInstance
|
||||
|
||||
:param brand_registration_sid: A2P Brand Registration SID
|
||||
:param description: A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters.
|
||||
:param message_flow: Required for all Campaigns. Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum.
|
||||
:param message_samples: An array of sample message strings, min two and max five. Min length for each sample: 20 chars. Max length for each sample: 1024 chars.
|
||||
:param us_app_to_person_usecase: A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING..]
|
||||
:param has_embedded_links: Indicates that this SMS campaign will send messages that contain links.
|
||||
:param has_embedded_phone: Indicates that this SMS campaign will send messages that contain phone numbers.
|
||||
:param opt_in_message: If end users can text in a keyword to start receiving messages from this campaign, the auto-reply messages sent to the end users must be provided. The opt-in response should include the Brand name, confirmation of opt-in enrollment to a recurring message campaign, how to get help, and clear description of how to opt-out. This field is required if end users can text in a keyword to start receiving messages from this campaign. 20 character minimum. 320 character maximum.
|
||||
:param opt_out_message: Upon receiving the opt-out keywords from the end users, Twilio customers are expected to send back an auto-generated response, which must provide acknowledgment of the opt-out request and confirmation that no further messages will be sent. It is also recommended that these opt-out messages include the brand name. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum.
|
||||
:param help_message: When customers receive the help keywords from their end users, Twilio customers are expected to send back an auto-generated response; this may include the brand name and additional support contact information. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum.
|
||||
:param opt_in_keywords: If end users can text in a keyword to start receiving messages from this campaign, those keywords must be provided. This field is required if end users can text in a keyword to start receiving messages from this campaign. Values must be alphanumeric. 255 character maximum.
|
||||
:param opt_out_keywords: End users should be able to text in a keyword to stop receiving messages from this campaign. Those keywords must be provided. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum.
|
||||
:param help_keywords: End users should be able to text in a keyword to receive help. Those keywords must be provided as part of the campaign registration request. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum.
|
||||
|
||||
:returns: The created UsAppToPersonInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"BrandRegistrationSid": brand_registration_sid,
|
||||
"Description": description,
|
||||
"MessageFlow": message_flow,
|
||||
"MessageSamples": serialize.map(message_samples, lambda e: e),
|
||||
"UsAppToPersonUsecase": us_app_to_person_usecase,
|
||||
"HasEmbeddedLinks": has_embedded_links,
|
||||
"HasEmbeddedPhone": has_embedded_phone,
|
||||
"OptInMessage": opt_in_message,
|
||||
"OptOutMessage": opt_out_message,
|
||||
"HelpMessage": help_message,
|
||||
"OptInKeywords": serialize.map(opt_in_keywords, lambda e: e),
|
||||
"OptOutKeywords": serialize.map(opt_out_keywords, lambda e: e),
|
||||
"HelpKeywords": serialize.map(help_keywords, lambda e: e),
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return UsAppToPersonInstance(
|
||||
self._version,
|
||||
payload,
|
||||
messaging_service_sid=self._solution["messaging_service_sid"],
|
||||
)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[UsAppToPersonInstance]:
|
||||
"""
|
||||
Streams UsAppToPersonInstance 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[UsAppToPersonInstance]:
|
||||
"""
|
||||
Asynchronously streams UsAppToPersonInstance 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[UsAppToPersonInstance]:
|
||||
"""
|
||||
Lists UsAppToPersonInstance 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[UsAppToPersonInstance]:
|
||||
"""
|
||||
Asynchronously lists UsAppToPersonInstance 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,
|
||||
) -> UsAppToPersonPage:
|
||||
"""
|
||||
Retrieve a single page of UsAppToPersonInstance 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 UsAppToPersonInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return UsAppToPersonPage(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,
|
||||
) -> UsAppToPersonPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of UsAppToPersonInstance 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 UsAppToPersonInstance
|
||||
"""
|
||||
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 UsAppToPersonPage(self._version, response, self._solution)
|
||||
|
||||
def get_page(self, target_url: str) -> UsAppToPersonPage:
|
||||
"""
|
||||
Retrieve a specific page of UsAppToPersonInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of UsAppToPersonInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return UsAppToPersonPage(self._version, response, self._solution)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> UsAppToPersonPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of UsAppToPersonInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of UsAppToPersonInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return UsAppToPersonPage(self._version, response, self._solution)
|
||||
|
||||
def get(self, sid: str) -> UsAppToPersonContext:
|
||||
"""
|
||||
Constructs a UsAppToPersonContext
|
||||
|
||||
:param sid: The SID of the US A2P Compliance resource to fetch `QE2c6890da8086d771620e9b13fadeba0b`.
|
||||
"""
|
||||
return UsAppToPersonContext(
|
||||
self._version,
|
||||
messaging_service_sid=self._solution["messaging_service_sid"],
|
||||
sid=sid,
|
||||
)
|
||||
|
||||
def __call__(self, sid: str) -> UsAppToPersonContext:
|
||||
"""
|
||||
Constructs a UsAppToPersonContext
|
||||
|
||||
:param sid: The SID of the US A2P Compliance resource to fetch `QE2c6890da8086d771620e9b13fadeba0b`.
|
||||
"""
|
||||
return UsAppToPersonContext(
|
||||
self._version,
|
||||
messaging_service_sid=self._solution["messaging_service_sid"],
|
||||
sid=sid,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging.V1.UsAppToPersonList>"
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Messaging
|
||||
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
|
||||
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
|
||||
|
||||
class UsAppToPersonUsecaseInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar us_app_to_person_usecases: Human readable name, code, description and post_approval_required (indicates whether or not post approval is required for this Use Case) of A2P Campaign Use Cases.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, version: Version, payload: Dict[str, Any], messaging_service_sid: str
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.us_app_to_person_usecases: Optional[List[object]] = payload.get(
|
||||
"us_app_to_person_usecases"
|
||||
)
|
||||
|
||||
self._solution = {
|
||||
"messaging_service_sid": messaging_service_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.Messaging.V1.UsAppToPersonUsecaseInstance {}>".format(context)
|
||||
|
||||
|
||||
class UsAppToPersonUsecaseList(ListResource):
|
||||
def __init__(self, version: Version, messaging_service_sid: str):
|
||||
"""
|
||||
Initialize the UsAppToPersonUsecaseList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) to fetch the resource from.
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"messaging_service_sid": messaging_service_sid,
|
||||
}
|
||||
self._uri = (
|
||||
"/Services/{messaging_service_sid}/Compliance/Usa2p/Usecases".format(
|
||||
**self._solution
|
||||
)
|
||||
)
|
||||
|
||||
def fetch(self) -> UsAppToPersonUsecaseInstance:
|
||||
"""
|
||||
Asynchronously fetch the UsAppToPersonUsecaseInstance
|
||||
|
||||
:returns: The fetched UsAppToPersonUsecaseInstance
|
||||
"""
|
||||
payload = self._version.fetch(method="GET", uri=self._uri)
|
||||
|
||||
return UsAppToPersonUsecaseInstance(
|
||||
self._version,
|
||||
payload,
|
||||
messaging_service_sid=self._solution["messaging_service_sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> UsAppToPersonUsecaseInstance:
|
||||
"""
|
||||
Asynchronously fetch the UsAppToPersonUsecaseInstance
|
||||
|
||||
:returns: The fetched UsAppToPersonUsecaseInstance
|
||||
"""
|
||||
payload = await self._version.fetch_async(method="GET", uri=self._uri)
|
||||
|
||||
return UsAppToPersonUsecaseInstance(
|
||||
self._version,
|
||||
payload,
|
||||
messaging_service_sid=self._solution["messaging_service_sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging.V1.UsAppToPersonUsecaseList>"
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,82 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Messaging
|
||||
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
|
||||
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
|
||||
|
||||
class UsecaseInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar usecases: Human readable use case details (usecase, description and purpose) of Messaging Service Use Cases.
|
||||
"""
|
||||
|
||||
def __init__(self, version: Version, payload: Dict[str, Any]):
|
||||
super().__init__(version)
|
||||
|
||||
self.usecases: Optional[List[object]] = payload.get("usecases")
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
|
||||
return "<Twilio.Messaging.V1.UsecaseInstance>"
|
||||
|
||||
|
||||
class UsecaseList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the UsecaseList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/Services/Usecases"
|
||||
|
||||
def fetch(self) -> UsecaseInstance:
|
||||
"""
|
||||
Asynchronously fetch the UsecaseInstance
|
||||
|
||||
:returns: The fetched UsecaseInstance
|
||||
"""
|
||||
payload = self._version.fetch(method="GET", uri=self._uri)
|
||||
|
||||
return UsecaseInstance(self._version, payload)
|
||||
|
||||
async def fetch_async(self) -> UsecaseInstance:
|
||||
"""
|
||||
Asynchronously fetch the UsecaseInstance
|
||||
|
||||
:returns: The fetched UsecaseInstance
|
||||
"""
|
||||
payload = await self._version.fetch_async(method="GET", uri=self._uri)
|
||||
|
||||
return UsecaseInstance(self._version, payload)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Messaging.V1.UsecaseList>"
|
||||
Reference in New Issue
Block a user