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.trusthub.v1 import V1
|
||||
|
||||
|
||||
class TrusthubBase(Domain):
|
||||
def __init__(self, twilio: Client):
|
||||
"""
|
||||
Initialize the Trusthub Domain
|
||||
|
||||
:returns: Domain for Trusthub
|
||||
"""
|
||||
super().__init__(twilio, "https://trusthub.twilio.com")
|
||||
self._v1: Optional[V1] = None
|
||||
|
||||
@property
|
||||
def v1(self) -> V1:
|
||||
"""
|
||||
:returns: Versions v1 of Trusthub
|
||||
"""
|
||||
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.Trusthub>"
|
||||
@@ -0,0 +1,75 @@
|
||||
from warnings import warn
|
||||
|
||||
from twilio.rest.trusthub.TrusthubBase import TrusthubBase
|
||||
from twilio.rest.trusthub.v1.customer_profiles import CustomerProfilesList
|
||||
from twilio.rest.trusthub.v1.end_user import EndUserList
|
||||
from twilio.rest.trusthub.v1.end_user_type import EndUserTypeList
|
||||
from twilio.rest.trusthub.v1.policies import PoliciesList
|
||||
from twilio.rest.trusthub.v1.supporting_document import SupportingDocumentList
|
||||
from twilio.rest.trusthub.v1.supporting_document_type import SupportingDocumentTypeList
|
||||
from twilio.rest.trusthub.v1.trust_products import TrustProductsList
|
||||
|
||||
|
||||
class Trusthub(TrusthubBase):
|
||||
@property
|
||||
def customer_profiles(self) -> CustomerProfilesList:
|
||||
warn(
|
||||
"customer_profiles is deprecated. Use v1.customer_profiles instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.customer_profiles
|
||||
|
||||
@property
|
||||
def end_users(self) -> EndUserList:
|
||||
warn(
|
||||
"end_users is deprecated. Use v1.end_users instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.end_users
|
||||
|
||||
@property
|
||||
def end_user_types(self) -> EndUserTypeList:
|
||||
warn(
|
||||
"end_user_types is deprecated. Use v1.end_user_types instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.end_user_types
|
||||
|
||||
@property
|
||||
def policies(self) -> PoliciesList:
|
||||
warn(
|
||||
"policies is deprecated. Use v1.policies instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.policies
|
||||
|
||||
@property
|
||||
def supporting_documents(self) -> SupportingDocumentList:
|
||||
warn(
|
||||
"supporting_documents is deprecated. Use v1.supporting_documents instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.supporting_documents
|
||||
|
||||
@property
|
||||
def supporting_document_types(self) -> SupportingDocumentTypeList:
|
||||
warn(
|
||||
"supporting_document_types is deprecated. Use v1.supporting_document_types instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.supporting_document_types
|
||||
|
||||
@property
|
||||
def trust_products(self) -> TrustProductsList:
|
||||
warn(
|
||||
"trust_products is deprecated. Use v1.trust_products instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.trust_products
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,98 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Trusthub
|
||||
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.trusthub.v1.compliance_inquiries import ComplianceInquiriesList
|
||||
from twilio.rest.trusthub.v1.customer_profiles import CustomerProfilesList
|
||||
from twilio.rest.trusthub.v1.end_user import EndUserList
|
||||
from twilio.rest.trusthub.v1.end_user_type import EndUserTypeList
|
||||
from twilio.rest.trusthub.v1.policies import PoliciesList
|
||||
from twilio.rest.trusthub.v1.supporting_document import SupportingDocumentList
|
||||
from twilio.rest.trusthub.v1.supporting_document_type import SupportingDocumentTypeList
|
||||
from twilio.rest.trusthub.v1.trust_products import TrustProductsList
|
||||
|
||||
|
||||
class V1(Version):
|
||||
def __init__(self, domain: Domain):
|
||||
"""
|
||||
Initialize the V1 version of Trusthub
|
||||
|
||||
:param domain: The Twilio.trusthub domain
|
||||
"""
|
||||
super().__init__(domain, "v1")
|
||||
self._compliance_inquiries: Optional[ComplianceInquiriesList] = None
|
||||
self._customer_profiles: Optional[CustomerProfilesList] = None
|
||||
self._end_users: Optional[EndUserList] = None
|
||||
self._end_user_types: Optional[EndUserTypeList] = None
|
||||
self._policies: Optional[PoliciesList] = None
|
||||
self._supporting_documents: Optional[SupportingDocumentList] = None
|
||||
self._supporting_document_types: Optional[SupportingDocumentTypeList] = None
|
||||
self._trust_products: Optional[TrustProductsList] = None
|
||||
|
||||
@property
|
||||
def compliance_inquiries(self) -> ComplianceInquiriesList:
|
||||
if self._compliance_inquiries is None:
|
||||
self._compliance_inquiries = ComplianceInquiriesList(self)
|
||||
return self._compliance_inquiries
|
||||
|
||||
@property
|
||||
def customer_profiles(self) -> CustomerProfilesList:
|
||||
if self._customer_profiles is None:
|
||||
self._customer_profiles = CustomerProfilesList(self)
|
||||
return self._customer_profiles
|
||||
|
||||
@property
|
||||
def end_users(self) -> EndUserList:
|
||||
if self._end_users is None:
|
||||
self._end_users = EndUserList(self)
|
||||
return self._end_users
|
||||
|
||||
@property
|
||||
def end_user_types(self) -> EndUserTypeList:
|
||||
if self._end_user_types is None:
|
||||
self._end_user_types = EndUserTypeList(self)
|
||||
return self._end_user_types
|
||||
|
||||
@property
|
||||
def policies(self) -> PoliciesList:
|
||||
if self._policies is None:
|
||||
self._policies = PoliciesList(self)
|
||||
return self._policies
|
||||
|
||||
@property
|
||||
def supporting_documents(self) -> SupportingDocumentList:
|
||||
if self._supporting_documents is None:
|
||||
self._supporting_documents = SupportingDocumentList(self)
|
||||
return self._supporting_documents
|
||||
|
||||
@property
|
||||
def supporting_document_types(self) -> SupportingDocumentTypeList:
|
||||
if self._supporting_document_types is None:
|
||||
self._supporting_document_types = SupportingDocumentTypeList(self)
|
||||
return self._supporting_document_types
|
||||
|
||||
@property
|
||||
def trust_products(self) -> TrustProductsList:
|
||||
if self._trust_products is None:
|
||||
self._trust_products = TrustProductsList(self)
|
||||
return self._trust_products
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.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.
@@ -0,0 +1,260 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Trusthub
|
||||
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 ComplianceInquiriesInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar inquiry_id: The unique ID used to start an embedded compliance registration session.
|
||||
:ivar inquiry_session_token: The session token used to start an embedded compliance registration session.
|
||||
:ivar customer_id: The CustomerID matching the Customer Profile that should be resumed or resubmitted for editing.
|
||||
:ivar url: The URL of this resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
customer_id: Optional[str] = None,
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.inquiry_id: Optional[str] = payload.get("inquiry_id")
|
||||
self.inquiry_session_token: Optional[str] = payload.get("inquiry_session_token")
|
||||
self.customer_id: Optional[str] = payload.get("customer_id")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"customer_id": customer_id or self.customer_id,
|
||||
}
|
||||
self._context: Optional[ComplianceInquiriesContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "ComplianceInquiriesContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: ComplianceInquiriesContext for this ComplianceInquiriesInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = ComplianceInquiriesContext(
|
||||
self._version,
|
||||
customer_id=self._solution["customer_id"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def update(self, primary_profile_sid: str) -> "ComplianceInquiriesInstance":
|
||||
"""
|
||||
Update the ComplianceInquiriesInstance
|
||||
|
||||
:param primary_profile_sid: The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile.
|
||||
|
||||
:returns: The updated ComplianceInquiriesInstance
|
||||
"""
|
||||
return self._proxy.update(
|
||||
primary_profile_sid=primary_profile_sid,
|
||||
)
|
||||
|
||||
async def update_async(
|
||||
self, primary_profile_sid: str
|
||||
) -> "ComplianceInquiriesInstance":
|
||||
"""
|
||||
Asynchronous coroutine to update the ComplianceInquiriesInstance
|
||||
|
||||
:param primary_profile_sid: The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile.
|
||||
|
||||
:returns: The updated ComplianceInquiriesInstance
|
||||
"""
|
||||
return await self._proxy.update_async(
|
||||
primary_profile_sid=primary_profile_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.Trusthub.V1.ComplianceInquiriesInstance {}>".format(context)
|
||||
|
||||
|
||||
class ComplianceInquiriesContext(InstanceContext):
|
||||
def __init__(self, version: Version, customer_id: str):
|
||||
"""
|
||||
Initialize the ComplianceInquiriesContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param customer_id: The unique CustomerId matching the Customer Profile/Compliance Inquiry that should be resumed or resubmitted. This value will have been returned by the initial Compliance Inquiry creation call.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"customer_id": customer_id,
|
||||
}
|
||||
self._uri = "/ComplianceInquiries/Customers/{customer_id}/Initialize".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def update(self, primary_profile_sid: str) -> ComplianceInquiriesInstance:
|
||||
"""
|
||||
Update the ComplianceInquiriesInstance
|
||||
|
||||
:param primary_profile_sid: The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile.
|
||||
|
||||
:returns: The updated ComplianceInquiriesInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PrimaryProfileSid": primary_profile_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.update(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return ComplianceInquiriesInstance(
|
||||
self._version, payload, customer_id=self._solution["customer_id"]
|
||||
)
|
||||
|
||||
async def update_async(
|
||||
self, primary_profile_sid: str
|
||||
) -> ComplianceInquiriesInstance:
|
||||
"""
|
||||
Asynchronous coroutine to update the ComplianceInquiriesInstance
|
||||
|
||||
:param primary_profile_sid: The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile.
|
||||
|
||||
:returns: The updated ComplianceInquiriesInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PrimaryProfileSid": primary_profile_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.update_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return ComplianceInquiriesInstance(
|
||||
self._version, payload, customer_id=self._solution["customer_id"]
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Trusthub.V1.ComplianceInquiriesContext {}>".format(context)
|
||||
|
||||
|
||||
class ComplianceInquiriesList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the ComplianceInquiriesList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/ComplianceInquiries/Customers/Initialize"
|
||||
|
||||
def create(self, primary_profile_sid: str) -> ComplianceInquiriesInstance:
|
||||
"""
|
||||
Create the ComplianceInquiriesInstance
|
||||
|
||||
:param primary_profile_sid: The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile.
|
||||
|
||||
:returns: The created ComplianceInquiriesInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PrimaryProfileSid": primary_profile_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return ComplianceInquiriesInstance(self._version, payload)
|
||||
|
||||
async def create_async(
|
||||
self, primary_profile_sid: str
|
||||
) -> ComplianceInquiriesInstance:
|
||||
"""
|
||||
Asynchronously create the ComplianceInquiriesInstance
|
||||
|
||||
:param primary_profile_sid: The unique SID identifier of the Primary Customer Profile that should be used as a parent. Only necessary when creating a secondary Customer Profile.
|
||||
|
||||
:returns: The created ComplianceInquiriesInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PrimaryProfileSid": primary_profile_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return ComplianceInquiriesInstance(self._version, payload)
|
||||
|
||||
def get(self, customer_id: str) -> ComplianceInquiriesContext:
|
||||
"""
|
||||
Constructs a ComplianceInquiriesContext
|
||||
|
||||
:param customer_id: The unique CustomerId matching the Customer Profile/Compliance Inquiry that should be resumed or resubmitted. This value will have been returned by the initial Compliance Inquiry creation call.
|
||||
"""
|
||||
return ComplianceInquiriesContext(self._version, customer_id=customer_id)
|
||||
|
||||
def __call__(self, customer_id: str) -> ComplianceInquiriesContext:
|
||||
"""
|
||||
Constructs a ComplianceInquiriesContext
|
||||
|
||||
:param customer_id: The unique CustomerId matching the Customer Profile/Compliance Inquiry that should be resumed or resubmitted. This value will have been returned by the initial Compliance Inquiry creation call.
|
||||
"""
|
||||
return ComplianceInquiriesContext(self._version, customer_id=customer_id)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.ComplianceInquiriesList>"
|
||||
+796
@@ -0,0 +1,796 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Trusthub
|
||||
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.trusthub.v1.customer_profiles.customer_profiles_channel_endpoint_assignment import (
|
||||
CustomerProfilesChannelEndpointAssignmentList,
|
||||
)
|
||||
from twilio.rest.trusthub.v1.customer_profiles.customer_profiles_entity_assignments import (
|
||||
CustomerProfilesEntityAssignmentsList,
|
||||
)
|
||||
from twilio.rest.trusthub.v1.customer_profiles.customer_profiles_evaluations import (
|
||||
CustomerProfilesEvaluationsList,
|
||||
)
|
||||
|
||||
|
||||
class CustomerProfilesInstance(InstanceResource):
|
||||
class Status(object):
|
||||
DRAFT = "draft"
|
||||
PENDING_REVIEW = "pending-review"
|
||||
IN_REVIEW = "in-review"
|
||||
TWILIO_REJECTED = "twilio-rejected"
|
||||
TWILIO_APPROVED = "twilio-approved"
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string that we created to identify the Customer-Profile resource.
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Customer-Profile resource.
|
||||
:ivar policy_sid: The unique string of a policy that is associated to the Customer-Profile resource.
|
||||
:ivar friendly_name: The string that you assigned to describe the resource.
|
||||
:ivar status:
|
||||
:ivar valid_until: The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until.
|
||||
:ivar email: The email address that will receive updates when the Customer-Profile resource changes status.
|
||||
:ivar status_callback: The URL we call to inform your application of status changes.
|
||||
:ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
:ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
:ivar url: The absolute URL of the Customer-Profile resource.
|
||||
:ivar links: The URLs of the Assigned Items of the Customer-Profile resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.policy_sid: Optional[str] = payload.get("policy_sid")
|
||||
self.friendly_name: Optional[str] = payload.get("friendly_name")
|
||||
self.status: Optional["CustomerProfilesInstance.Status"] = payload.get("status")
|
||||
self.valid_until: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("valid_until")
|
||||
)
|
||||
self.email: Optional[str] = payload.get("email")
|
||||
self.status_callback: Optional[str] = payload.get("status_callback")
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
self.date_updated: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_updated")
|
||||
)
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
self.links: Optional[Dict[str, object]] = payload.get("links")
|
||||
|
||||
self._solution = {
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[CustomerProfilesContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "CustomerProfilesContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: CustomerProfilesContext for this CustomerProfilesInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = CustomerProfilesContext(
|
||||
self._version,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the CustomerProfilesInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._proxy.delete()
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the CustomerProfilesInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._proxy.delete_async()
|
||||
|
||||
def fetch(self) -> "CustomerProfilesInstance":
|
||||
"""
|
||||
Fetch the CustomerProfilesInstance
|
||||
|
||||
|
||||
:returns: The fetched CustomerProfilesInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "CustomerProfilesInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the CustomerProfilesInstance
|
||||
|
||||
|
||||
:returns: The fetched CustomerProfilesInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def update(
|
||||
self,
|
||||
status: Union["CustomerProfilesInstance.Status", object] = values.unset,
|
||||
status_callback: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
email: Union[str, object] = values.unset,
|
||||
) -> "CustomerProfilesInstance":
|
||||
"""
|
||||
Update the CustomerProfilesInstance
|
||||
|
||||
:param status:
|
||||
:param status_callback: The URL we call to inform your application of status changes.
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param email: The email address that will receive updates when the Customer-Profile resource changes status.
|
||||
|
||||
:returns: The updated CustomerProfilesInstance
|
||||
"""
|
||||
return self._proxy.update(
|
||||
status=status,
|
||||
status_callback=status_callback,
|
||||
friendly_name=friendly_name,
|
||||
email=email,
|
||||
)
|
||||
|
||||
async def update_async(
|
||||
self,
|
||||
status: Union["CustomerProfilesInstance.Status", object] = values.unset,
|
||||
status_callback: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
email: Union[str, object] = values.unset,
|
||||
) -> "CustomerProfilesInstance":
|
||||
"""
|
||||
Asynchronous coroutine to update the CustomerProfilesInstance
|
||||
|
||||
:param status:
|
||||
:param status_callback: The URL we call to inform your application of status changes.
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param email: The email address that will receive updates when the Customer-Profile resource changes status.
|
||||
|
||||
:returns: The updated CustomerProfilesInstance
|
||||
"""
|
||||
return await self._proxy.update_async(
|
||||
status=status,
|
||||
status_callback=status_callback,
|
||||
friendly_name=friendly_name,
|
||||
email=email,
|
||||
)
|
||||
|
||||
@property
|
||||
def customer_profiles_channel_endpoint_assignment(
|
||||
self,
|
||||
) -> CustomerProfilesChannelEndpointAssignmentList:
|
||||
"""
|
||||
Access the customer_profiles_channel_endpoint_assignment
|
||||
"""
|
||||
return self._proxy.customer_profiles_channel_endpoint_assignment
|
||||
|
||||
@property
|
||||
def customer_profiles_entity_assignments(
|
||||
self,
|
||||
) -> CustomerProfilesEntityAssignmentsList:
|
||||
"""
|
||||
Access the customer_profiles_entity_assignments
|
||||
"""
|
||||
return self._proxy.customer_profiles_entity_assignments
|
||||
|
||||
@property
|
||||
def customer_profiles_evaluations(self) -> CustomerProfilesEvaluationsList:
|
||||
"""
|
||||
Access the customer_profiles_evaluations
|
||||
"""
|
||||
return self._proxy.customer_profiles_evaluations
|
||||
|
||||
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.Trusthub.V1.CustomerProfilesInstance {}>".format(context)
|
||||
|
||||
|
||||
class CustomerProfilesContext(InstanceContext):
|
||||
def __init__(self, version: Version, sid: str):
|
||||
"""
|
||||
Initialize the CustomerProfilesContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param sid: The unique string that we created to identify the Customer-Profile resource.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/CustomerProfiles/{sid}".format(**self._solution)
|
||||
|
||||
self._customer_profiles_channel_endpoint_assignment: Optional[
|
||||
CustomerProfilesChannelEndpointAssignmentList
|
||||
] = None
|
||||
self._customer_profiles_entity_assignments: Optional[
|
||||
CustomerProfilesEntityAssignmentsList
|
||||
] = None
|
||||
self._customer_profiles_evaluations: Optional[
|
||||
CustomerProfilesEvaluationsList
|
||||
] = None
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the CustomerProfilesInstance
|
||||
|
||||
|
||||
: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 CustomerProfilesInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._version.delete_async(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
def fetch(self) -> CustomerProfilesInstance:
|
||||
"""
|
||||
Fetch the CustomerProfilesInstance
|
||||
|
||||
|
||||
:returns: The fetched CustomerProfilesInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return CustomerProfilesInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> CustomerProfilesInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the CustomerProfilesInstance
|
||||
|
||||
|
||||
:returns: The fetched CustomerProfilesInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return CustomerProfilesInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
def update(
|
||||
self,
|
||||
status: Union["CustomerProfilesInstance.Status", object] = values.unset,
|
||||
status_callback: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
email: Union[str, object] = values.unset,
|
||||
) -> CustomerProfilesInstance:
|
||||
"""
|
||||
Update the CustomerProfilesInstance
|
||||
|
||||
:param status:
|
||||
:param status_callback: The URL we call to inform your application of status changes.
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param email: The email address that will receive updates when the Customer-Profile resource changes status.
|
||||
|
||||
:returns: The updated CustomerProfilesInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"Status": status,
|
||||
"StatusCallback": status_callback,
|
||||
"FriendlyName": friendly_name,
|
||||
"Email": email,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.update(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return CustomerProfilesInstance(
|
||||
self._version, payload, sid=self._solution["sid"]
|
||||
)
|
||||
|
||||
async def update_async(
|
||||
self,
|
||||
status: Union["CustomerProfilesInstance.Status", object] = values.unset,
|
||||
status_callback: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
email: Union[str, object] = values.unset,
|
||||
) -> CustomerProfilesInstance:
|
||||
"""
|
||||
Asynchronous coroutine to update the CustomerProfilesInstance
|
||||
|
||||
:param status:
|
||||
:param status_callback: The URL we call to inform your application of status changes.
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param email: The email address that will receive updates when the Customer-Profile resource changes status.
|
||||
|
||||
:returns: The updated CustomerProfilesInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"Status": status,
|
||||
"StatusCallback": status_callback,
|
||||
"FriendlyName": friendly_name,
|
||||
"Email": email,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.update_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return CustomerProfilesInstance(
|
||||
self._version, payload, sid=self._solution["sid"]
|
||||
)
|
||||
|
||||
@property
|
||||
def customer_profiles_channel_endpoint_assignment(
|
||||
self,
|
||||
) -> CustomerProfilesChannelEndpointAssignmentList:
|
||||
"""
|
||||
Access the customer_profiles_channel_endpoint_assignment
|
||||
"""
|
||||
if self._customer_profiles_channel_endpoint_assignment is None:
|
||||
self._customer_profiles_channel_endpoint_assignment = (
|
||||
CustomerProfilesChannelEndpointAssignmentList(
|
||||
self._version,
|
||||
self._solution["sid"],
|
||||
)
|
||||
)
|
||||
return self._customer_profiles_channel_endpoint_assignment
|
||||
|
||||
@property
|
||||
def customer_profiles_entity_assignments(
|
||||
self,
|
||||
) -> CustomerProfilesEntityAssignmentsList:
|
||||
"""
|
||||
Access the customer_profiles_entity_assignments
|
||||
"""
|
||||
if self._customer_profiles_entity_assignments is None:
|
||||
self._customer_profiles_entity_assignments = (
|
||||
CustomerProfilesEntityAssignmentsList(
|
||||
self._version,
|
||||
self._solution["sid"],
|
||||
)
|
||||
)
|
||||
return self._customer_profiles_entity_assignments
|
||||
|
||||
@property
|
||||
def customer_profiles_evaluations(self) -> CustomerProfilesEvaluationsList:
|
||||
"""
|
||||
Access the customer_profiles_evaluations
|
||||
"""
|
||||
if self._customer_profiles_evaluations is None:
|
||||
self._customer_profiles_evaluations = CustomerProfilesEvaluationsList(
|
||||
self._version,
|
||||
self._solution["sid"],
|
||||
)
|
||||
return self._customer_profiles_evaluations
|
||||
|
||||
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.Trusthub.V1.CustomerProfilesContext {}>".format(context)
|
||||
|
||||
|
||||
class CustomerProfilesPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> CustomerProfilesInstance:
|
||||
"""
|
||||
Build an instance of CustomerProfilesInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return CustomerProfilesInstance(self._version, payload)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.CustomerProfilesPage>"
|
||||
|
||||
|
||||
class CustomerProfilesList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the CustomerProfilesList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/CustomerProfiles"
|
||||
|
||||
def create(
|
||||
self,
|
||||
friendly_name: str,
|
||||
email: str,
|
||||
policy_sid: str,
|
||||
status_callback: Union[str, object] = values.unset,
|
||||
) -> CustomerProfilesInstance:
|
||||
"""
|
||||
Create the CustomerProfilesInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param email: The email address that will receive updates when the Customer-Profile resource changes status.
|
||||
:param policy_sid: The unique string of a policy that is associated to the Customer-Profile resource.
|
||||
:param status_callback: The URL we call to inform your application of status changes.
|
||||
|
||||
:returns: The created CustomerProfilesInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FriendlyName": friendly_name,
|
||||
"Email": email,
|
||||
"PolicySid": policy_sid,
|
||||
"StatusCallback": status_callback,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return CustomerProfilesInstance(self._version, payload)
|
||||
|
||||
async def create_async(
|
||||
self,
|
||||
friendly_name: str,
|
||||
email: str,
|
||||
policy_sid: str,
|
||||
status_callback: Union[str, object] = values.unset,
|
||||
) -> CustomerProfilesInstance:
|
||||
"""
|
||||
Asynchronously create the CustomerProfilesInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param email: The email address that will receive updates when the Customer-Profile resource changes status.
|
||||
:param policy_sid: The unique string of a policy that is associated to the Customer-Profile resource.
|
||||
:param status_callback: The URL we call to inform your application of status changes.
|
||||
|
||||
:returns: The created CustomerProfilesInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FriendlyName": friendly_name,
|
||||
"Email": email,
|
||||
"PolicySid": policy_sid,
|
||||
"StatusCallback": status_callback,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return CustomerProfilesInstance(self._version, payload)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
status: Union["CustomerProfilesInstance.Status", object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
policy_sid: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[CustomerProfilesInstance]:
|
||||
"""
|
||||
Streams CustomerProfilesInstance 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 "CustomerProfilesInstance.Status" status: The verification status of the Customer-Profile resource.
|
||||
:param str friendly_name: The string that you assigned to describe the resource.
|
||||
:param str policy_sid: The unique string of a policy that is associated to the Customer-Profile resource.
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(
|
||||
status=status,
|
||||
friendly_name=friendly_name,
|
||||
policy_sid=policy_sid,
|
||||
page_size=limits["page_size"],
|
||||
)
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
status: Union["CustomerProfilesInstance.Status", object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
policy_sid: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[CustomerProfilesInstance]:
|
||||
"""
|
||||
Asynchronously streams CustomerProfilesInstance 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 "CustomerProfilesInstance.Status" status: The verification status of the Customer-Profile resource.
|
||||
:param str friendly_name: The string that you assigned to describe the resource.
|
||||
:param str policy_sid: The unique string of a policy that is associated to the Customer-Profile resource.
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(
|
||||
status=status,
|
||||
friendly_name=friendly_name,
|
||||
policy_sid=policy_sid,
|
||||
page_size=limits["page_size"],
|
||||
)
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
status: Union["CustomerProfilesInstance.Status", object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
policy_sid: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[CustomerProfilesInstance]:
|
||||
"""
|
||||
Lists CustomerProfilesInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param "CustomerProfilesInstance.Status" status: The verification status of the Customer-Profile resource.
|
||||
:param str friendly_name: The string that you assigned to describe the resource.
|
||||
:param str policy_sid: The unique string of a policy that is associated to the Customer-Profile resource.
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
status=status,
|
||||
friendly_name=friendly_name,
|
||||
policy_sid=policy_sid,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
status: Union["CustomerProfilesInstance.Status", object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
policy_sid: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[CustomerProfilesInstance]:
|
||||
"""
|
||||
Asynchronously lists CustomerProfilesInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param "CustomerProfilesInstance.Status" status: The verification status of the Customer-Profile resource.
|
||||
:param str friendly_name: The string that you assigned to describe the resource.
|
||||
:param str policy_sid: The unique string of a policy that is associated to the Customer-Profile resource.
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
status=status,
|
||||
friendly_name=friendly_name,
|
||||
policy_sid=policy_sid,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
status: Union["CustomerProfilesInstance.Status", object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
policy_sid: Union[str, object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> CustomerProfilesPage:
|
||||
"""
|
||||
Retrieve a single page of CustomerProfilesInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param status: The verification status of the Customer-Profile resource.
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param policy_sid: The unique string of a policy that is associated to the Customer-Profile resource.
|
||||
: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 CustomerProfilesInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"Status": status,
|
||||
"FriendlyName": friendly_name,
|
||||
"PolicySid": policy_sid,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return CustomerProfilesPage(self._version, response)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
status: Union["CustomerProfilesInstance.Status", object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
policy_sid: Union[str, object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> CustomerProfilesPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of CustomerProfilesInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param status: The verification status of the Customer-Profile resource.
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param policy_sid: The unique string of a policy that is associated to the Customer-Profile resource.
|
||||
: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 CustomerProfilesInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"Status": status,
|
||||
"FriendlyName": friendly_name,
|
||||
"PolicySid": policy_sid,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return CustomerProfilesPage(self._version, response)
|
||||
|
||||
def get_page(self, target_url: str) -> CustomerProfilesPage:
|
||||
"""
|
||||
Retrieve a specific page of CustomerProfilesInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of CustomerProfilesInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return CustomerProfilesPage(self._version, response)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> CustomerProfilesPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of CustomerProfilesInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of CustomerProfilesInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return CustomerProfilesPage(self._version, response)
|
||||
|
||||
def get(self, sid: str) -> CustomerProfilesContext:
|
||||
"""
|
||||
Constructs a CustomerProfilesContext
|
||||
|
||||
:param sid: The unique string that we created to identify the Customer-Profile resource.
|
||||
"""
|
||||
return CustomerProfilesContext(self._version, sid=sid)
|
||||
|
||||
def __call__(self, sid: str) -> CustomerProfilesContext:
|
||||
"""
|
||||
Constructs a CustomerProfilesContext
|
||||
|
||||
:param sid: The unique string that we created to identify the Customer-Profile resource.
|
||||
"""
|
||||
return CustomerProfilesContext(self._version, sid=sid)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.CustomerProfilesList>"
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+591
@@ -0,0 +1,591 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Trusthub
|
||||
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 CustomerProfilesChannelEndpointAssignmentInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string that we created to identify the Item Assignment resource.
|
||||
:ivar customer_profile_sid: The unique string that we created to identify the CustomerProfile resource.
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource.
|
||||
:ivar channel_endpoint_type: The type of channel endpoint. eg: phone-number
|
||||
:ivar channel_endpoint_sid: The SID of an channel endpoint
|
||||
:ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
:ivar url: The absolute URL of the Identity resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
customer_profile_sid: str,
|
||||
sid: Optional[str] = None,
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.customer_profile_sid: Optional[str] = payload.get("customer_profile_sid")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.channel_endpoint_type: Optional[str] = payload.get("channel_endpoint_type")
|
||||
self.channel_endpoint_sid: Optional[str] = payload.get("channel_endpoint_sid")
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"customer_profile_sid": customer_profile_sid,
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[CustomerProfilesChannelEndpointAssignmentContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "CustomerProfilesChannelEndpointAssignmentContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: CustomerProfilesChannelEndpointAssignmentContext for this CustomerProfilesChannelEndpointAssignmentInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = CustomerProfilesChannelEndpointAssignmentContext(
|
||||
self._version,
|
||||
customer_profile_sid=self._solution["customer_profile_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the CustomerProfilesChannelEndpointAssignmentInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._proxy.delete()
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the CustomerProfilesChannelEndpointAssignmentInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._proxy.delete_async()
|
||||
|
||||
def fetch(self) -> "CustomerProfilesChannelEndpointAssignmentInstance":
|
||||
"""
|
||||
Fetch the CustomerProfilesChannelEndpointAssignmentInstance
|
||||
|
||||
|
||||
:returns: The fetched CustomerProfilesChannelEndpointAssignmentInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "CustomerProfilesChannelEndpointAssignmentInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the CustomerProfilesChannelEndpointAssignmentInstance
|
||||
|
||||
|
||||
:returns: The fetched CustomerProfilesChannelEndpointAssignmentInstance
|
||||
"""
|
||||
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.Trusthub.V1.CustomerProfilesChannelEndpointAssignmentInstance {}>".format(
|
||||
context
|
||||
)
|
||||
|
||||
|
||||
class CustomerProfilesChannelEndpointAssignmentContext(InstanceContext):
|
||||
def __init__(self, version: Version, customer_profile_sid: str, sid: str):
|
||||
"""
|
||||
Initialize the CustomerProfilesChannelEndpointAssignmentContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param customer_profile_sid: The unique string that we created to identify the CustomerProfile resource.
|
||||
:param sid: The unique string that we created to identify the resource.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"customer_profile_sid": customer_profile_sid,
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/CustomerProfiles/{customer_profile_sid}/ChannelEndpointAssignments/{sid}".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the CustomerProfilesChannelEndpointAssignmentInstance
|
||||
|
||||
|
||||
: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 CustomerProfilesChannelEndpointAssignmentInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._version.delete_async(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
def fetch(self) -> CustomerProfilesChannelEndpointAssignmentInstance:
|
||||
"""
|
||||
Fetch the CustomerProfilesChannelEndpointAssignmentInstance
|
||||
|
||||
|
||||
:returns: The fetched CustomerProfilesChannelEndpointAssignmentInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return CustomerProfilesChannelEndpointAssignmentInstance(
|
||||
self._version,
|
||||
payload,
|
||||
customer_profile_sid=self._solution["customer_profile_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> CustomerProfilesChannelEndpointAssignmentInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the CustomerProfilesChannelEndpointAssignmentInstance
|
||||
|
||||
|
||||
:returns: The fetched CustomerProfilesChannelEndpointAssignmentInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return CustomerProfilesChannelEndpointAssignmentInstance(
|
||||
self._version,
|
||||
payload,
|
||||
customer_profile_sid=self._solution["customer_profile_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.Trusthub.V1.CustomerProfilesChannelEndpointAssignmentContext {}>".format(
|
||||
context
|
||||
)
|
||||
|
||||
|
||||
class CustomerProfilesChannelEndpointAssignmentPage(Page):
|
||||
def get_instance(
|
||||
self, payload: Dict[str, Any]
|
||||
) -> CustomerProfilesChannelEndpointAssignmentInstance:
|
||||
"""
|
||||
Build an instance of CustomerProfilesChannelEndpointAssignmentInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return CustomerProfilesChannelEndpointAssignmentInstance(
|
||||
self._version,
|
||||
payload,
|
||||
customer_profile_sid=self._solution["customer_profile_sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.CustomerProfilesChannelEndpointAssignmentPage>"
|
||||
|
||||
|
||||
class CustomerProfilesChannelEndpointAssignmentList(ListResource):
|
||||
def __init__(self, version: Version, customer_profile_sid: str):
|
||||
"""
|
||||
Initialize the CustomerProfilesChannelEndpointAssignmentList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param customer_profile_sid: The unique string that we created to identify the CustomerProfile resource.
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"customer_profile_sid": customer_profile_sid,
|
||||
}
|
||||
self._uri = "/CustomerProfiles/{customer_profile_sid}/ChannelEndpointAssignments".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def create(
|
||||
self, channel_endpoint_type: str, channel_endpoint_sid: str
|
||||
) -> CustomerProfilesChannelEndpointAssignmentInstance:
|
||||
"""
|
||||
Create the CustomerProfilesChannelEndpointAssignmentInstance
|
||||
|
||||
:param channel_endpoint_type: The type of channel endpoint. eg: phone-number
|
||||
:param channel_endpoint_sid: The SID of an channel endpoint
|
||||
|
||||
:returns: The created CustomerProfilesChannelEndpointAssignmentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"ChannelEndpointType": channel_endpoint_type,
|
||||
"ChannelEndpointSid": channel_endpoint_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return CustomerProfilesChannelEndpointAssignmentInstance(
|
||||
self._version,
|
||||
payload,
|
||||
customer_profile_sid=self._solution["customer_profile_sid"],
|
||||
)
|
||||
|
||||
async def create_async(
|
||||
self, channel_endpoint_type: str, channel_endpoint_sid: str
|
||||
) -> CustomerProfilesChannelEndpointAssignmentInstance:
|
||||
"""
|
||||
Asynchronously create the CustomerProfilesChannelEndpointAssignmentInstance
|
||||
|
||||
:param channel_endpoint_type: The type of channel endpoint. eg: phone-number
|
||||
:param channel_endpoint_sid: The SID of an channel endpoint
|
||||
|
||||
:returns: The created CustomerProfilesChannelEndpointAssignmentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"ChannelEndpointType": channel_endpoint_type,
|
||||
"ChannelEndpointSid": channel_endpoint_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return CustomerProfilesChannelEndpointAssignmentInstance(
|
||||
self._version,
|
||||
payload,
|
||||
customer_profile_sid=self._solution["customer_profile_sid"],
|
||||
)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
channel_endpoint_sid: Union[str, object] = values.unset,
|
||||
channel_endpoint_sids: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[CustomerProfilesChannelEndpointAssignmentInstance]:
|
||||
"""
|
||||
Streams CustomerProfilesChannelEndpointAssignmentInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param str channel_endpoint_sid: The SID of an channel endpoint
|
||||
:param str channel_endpoint_sids: comma separated list of channel endpoint sids
|
||||
: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(
|
||||
channel_endpoint_sid=channel_endpoint_sid,
|
||||
channel_endpoint_sids=channel_endpoint_sids,
|
||||
page_size=limits["page_size"],
|
||||
)
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
channel_endpoint_sid: Union[str, object] = values.unset,
|
||||
channel_endpoint_sids: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[CustomerProfilesChannelEndpointAssignmentInstance]:
|
||||
"""
|
||||
Asynchronously streams CustomerProfilesChannelEndpointAssignmentInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param str channel_endpoint_sid: The SID of an channel endpoint
|
||||
:param str channel_endpoint_sids: comma separated list of channel endpoint sids
|
||||
: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(
|
||||
channel_endpoint_sid=channel_endpoint_sid,
|
||||
channel_endpoint_sids=channel_endpoint_sids,
|
||||
page_size=limits["page_size"],
|
||||
)
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
channel_endpoint_sid: Union[str, object] = values.unset,
|
||||
channel_endpoint_sids: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[CustomerProfilesChannelEndpointAssignmentInstance]:
|
||||
"""
|
||||
Lists CustomerProfilesChannelEndpointAssignmentInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param str channel_endpoint_sid: The SID of an channel endpoint
|
||||
:param str channel_endpoint_sids: comma separated list of channel endpoint sids
|
||||
: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(
|
||||
channel_endpoint_sid=channel_endpoint_sid,
|
||||
channel_endpoint_sids=channel_endpoint_sids,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
channel_endpoint_sid: Union[str, object] = values.unset,
|
||||
channel_endpoint_sids: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[CustomerProfilesChannelEndpointAssignmentInstance]:
|
||||
"""
|
||||
Asynchronously lists CustomerProfilesChannelEndpointAssignmentInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param str channel_endpoint_sid: The SID of an channel endpoint
|
||||
:param str channel_endpoint_sids: comma separated list of channel endpoint sids
|
||||
: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(
|
||||
channel_endpoint_sid=channel_endpoint_sid,
|
||||
channel_endpoint_sids=channel_endpoint_sids,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
channel_endpoint_sid: Union[str, object] = values.unset,
|
||||
channel_endpoint_sids: Union[str, object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> CustomerProfilesChannelEndpointAssignmentPage:
|
||||
"""
|
||||
Retrieve a single page of CustomerProfilesChannelEndpointAssignmentInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param channel_endpoint_sid: The SID of an channel endpoint
|
||||
:param channel_endpoint_sids: comma separated list of channel endpoint sids
|
||||
: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 CustomerProfilesChannelEndpointAssignmentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"ChannelEndpointSid": channel_endpoint_sid,
|
||||
"ChannelEndpointSids": channel_endpoint_sids,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return CustomerProfilesChannelEndpointAssignmentPage(
|
||||
self._version, response, self._solution
|
||||
)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
channel_endpoint_sid: Union[str, object] = values.unset,
|
||||
channel_endpoint_sids: Union[str, object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> CustomerProfilesChannelEndpointAssignmentPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of CustomerProfilesChannelEndpointAssignmentInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param channel_endpoint_sid: The SID of an channel endpoint
|
||||
:param channel_endpoint_sids: comma separated list of channel endpoint sids
|
||||
: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 CustomerProfilesChannelEndpointAssignmentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"ChannelEndpointSid": channel_endpoint_sid,
|
||||
"ChannelEndpointSids": channel_endpoint_sids,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return CustomerProfilesChannelEndpointAssignmentPage(
|
||||
self._version, response, self._solution
|
||||
)
|
||||
|
||||
def get_page(
|
||||
self, target_url: str
|
||||
) -> CustomerProfilesChannelEndpointAssignmentPage:
|
||||
"""
|
||||
Retrieve a specific page of CustomerProfilesChannelEndpointAssignmentInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of CustomerProfilesChannelEndpointAssignmentInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return CustomerProfilesChannelEndpointAssignmentPage(
|
||||
self._version, response, self._solution
|
||||
)
|
||||
|
||||
async def get_page_async(
|
||||
self, target_url: str
|
||||
) -> CustomerProfilesChannelEndpointAssignmentPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of CustomerProfilesChannelEndpointAssignmentInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of CustomerProfilesChannelEndpointAssignmentInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return CustomerProfilesChannelEndpointAssignmentPage(
|
||||
self._version, response, self._solution
|
||||
)
|
||||
|
||||
def get(self, sid: str) -> CustomerProfilesChannelEndpointAssignmentContext:
|
||||
"""
|
||||
Constructs a CustomerProfilesChannelEndpointAssignmentContext
|
||||
|
||||
:param sid: The unique string that we created to identify the resource.
|
||||
"""
|
||||
return CustomerProfilesChannelEndpointAssignmentContext(
|
||||
self._version,
|
||||
customer_profile_sid=self._solution["customer_profile_sid"],
|
||||
sid=sid,
|
||||
)
|
||||
|
||||
def __call__(self, sid: str) -> CustomerProfilesChannelEndpointAssignmentContext:
|
||||
"""
|
||||
Constructs a CustomerProfilesChannelEndpointAssignmentContext
|
||||
|
||||
:param sid: The unique string that we created to identify the resource.
|
||||
"""
|
||||
return CustomerProfilesChannelEndpointAssignmentContext(
|
||||
self._version,
|
||||
customer_profile_sid=self._solution["customer_profile_sid"],
|
||||
sid=sid,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.CustomerProfilesChannelEndpointAssignmentList>"
|
||||
+547
@@ -0,0 +1,547 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Trusthub
|
||||
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 CustomerProfilesEntityAssignmentsInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string that we created to identify the Item Assignment resource.
|
||||
:ivar customer_profile_sid: The unique string that we created to identify the CustomerProfile resource.
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource.
|
||||
:ivar object_sid: The SID of an object bag that holds information of the different items.
|
||||
:ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
:ivar url: The absolute URL of the Identity resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
customer_profile_sid: str,
|
||||
sid: Optional[str] = None,
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.customer_profile_sid: Optional[str] = payload.get("customer_profile_sid")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.object_sid: Optional[str] = payload.get("object_sid")
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"customer_profile_sid": customer_profile_sid,
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[CustomerProfilesEntityAssignmentsContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "CustomerProfilesEntityAssignmentsContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: CustomerProfilesEntityAssignmentsContext for this CustomerProfilesEntityAssignmentsInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = CustomerProfilesEntityAssignmentsContext(
|
||||
self._version,
|
||||
customer_profile_sid=self._solution["customer_profile_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the CustomerProfilesEntityAssignmentsInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._proxy.delete()
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the CustomerProfilesEntityAssignmentsInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._proxy.delete_async()
|
||||
|
||||
def fetch(self) -> "CustomerProfilesEntityAssignmentsInstance":
|
||||
"""
|
||||
Fetch the CustomerProfilesEntityAssignmentsInstance
|
||||
|
||||
|
||||
:returns: The fetched CustomerProfilesEntityAssignmentsInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "CustomerProfilesEntityAssignmentsInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the CustomerProfilesEntityAssignmentsInstance
|
||||
|
||||
|
||||
:returns: The fetched CustomerProfilesEntityAssignmentsInstance
|
||||
"""
|
||||
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.Trusthub.V1.CustomerProfilesEntityAssignmentsInstance {}>".format(
|
||||
context
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class CustomerProfilesEntityAssignmentsContext(InstanceContext):
|
||||
def __init__(self, version: Version, customer_profile_sid: str, sid: str):
|
||||
"""
|
||||
Initialize the CustomerProfilesEntityAssignmentsContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param customer_profile_sid: The unique string that we created to identify the CustomerProfile resource.
|
||||
:param sid: The unique string that we created to identify the Identity resource.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"customer_profile_sid": customer_profile_sid,
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = (
|
||||
"/CustomerProfiles/{customer_profile_sid}/EntityAssignments/{sid}".format(
|
||||
**self._solution
|
||||
)
|
||||
)
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the CustomerProfilesEntityAssignmentsInstance
|
||||
|
||||
|
||||
: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 CustomerProfilesEntityAssignmentsInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._version.delete_async(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
def fetch(self) -> CustomerProfilesEntityAssignmentsInstance:
|
||||
"""
|
||||
Fetch the CustomerProfilesEntityAssignmentsInstance
|
||||
|
||||
|
||||
:returns: The fetched CustomerProfilesEntityAssignmentsInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return CustomerProfilesEntityAssignmentsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
customer_profile_sid=self._solution["customer_profile_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> CustomerProfilesEntityAssignmentsInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the CustomerProfilesEntityAssignmentsInstance
|
||||
|
||||
|
||||
:returns: The fetched CustomerProfilesEntityAssignmentsInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return CustomerProfilesEntityAssignmentsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
customer_profile_sid=self._solution["customer_profile_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.Trusthub.V1.CustomerProfilesEntityAssignmentsContext {}>".format(
|
||||
context
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class CustomerProfilesEntityAssignmentsPage(Page):
|
||||
def get_instance(
|
||||
self, payload: Dict[str, Any]
|
||||
) -> CustomerProfilesEntityAssignmentsInstance:
|
||||
"""
|
||||
Build an instance of CustomerProfilesEntityAssignmentsInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return CustomerProfilesEntityAssignmentsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
customer_profile_sid=self._solution["customer_profile_sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.CustomerProfilesEntityAssignmentsPage>"
|
||||
|
||||
|
||||
class CustomerProfilesEntityAssignmentsList(ListResource):
|
||||
def __init__(self, version: Version, customer_profile_sid: str):
|
||||
"""
|
||||
Initialize the CustomerProfilesEntityAssignmentsList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param customer_profile_sid: The unique string that we created to identify the CustomerProfile resource.
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"customer_profile_sid": customer_profile_sid,
|
||||
}
|
||||
self._uri = "/CustomerProfiles/{customer_profile_sid}/EntityAssignments".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def create(self, object_sid: str) -> CustomerProfilesEntityAssignmentsInstance:
|
||||
"""
|
||||
Create the CustomerProfilesEntityAssignmentsInstance
|
||||
|
||||
:param object_sid: The SID of an object bag that holds information of the different items.
|
||||
|
||||
:returns: The created CustomerProfilesEntityAssignmentsInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"ObjectSid": object_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return CustomerProfilesEntityAssignmentsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
customer_profile_sid=self._solution["customer_profile_sid"],
|
||||
)
|
||||
|
||||
async def create_async(
|
||||
self, object_sid: str
|
||||
) -> CustomerProfilesEntityAssignmentsInstance:
|
||||
"""
|
||||
Asynchronously create the CustomerProfilesEntityAssignmentsInstance
|
||||
|
||||
:param object_sid: The SID of an object bag that holds information of the different items.
|
||||
|
||||
:returns: The created CustomerProfilesEntityAssignmentsInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"ObjectSid": object_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return CustomerProfilesEntityAssignmentsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
customer_profile_sid=self._solution["customer_profile_sid"],
|
||||
)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[CustomerProfilesEntityAssignmentsInstance]:
|
||||
"""
|
||||
Streams CustomerProfilesEntityAssignmentsInstance 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[CustomerProfilesEntityAssignmentsInstance]:
|
||||
"""
|
||||
Asynchronously streams CustomerProfilesEntityAssignmentsInstance 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[CustomerProfilesEntityAssignmentsInstance]:
|
||||
"""
|
||||
Lists CustomerProfilesEntityAssignmentsInstance 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[CustomerProfilesEntityAssignmentsInstance]:
|
||||
"""
|
||||
Asynchronously lists CustomerProfilesEntityAssignmentsInstance 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,
|
||||
) -> CustomerProfilesEntityAssignmentsPage:
|
||||
"""
|
||||
Retrieve a single page of CustomerProfilesEntityAssignmentsInstance 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 CustomerProfilesEntityAssignmentsInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return CustomerProfilesEntityAssignmentsPage(
|
||||
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,
|
||||
) -> CustomerProfilesEntityAssignmentsPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of CustomerProfilesEntityAssignmentsInstance 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 CustomerProfilesEntityAssignmentsInstance
|
||||
"""
|
||||
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 CustomerProfilesEntityAssignmentsPage(
|
||||
self._version, response, self._solution
|
||||
)
|
||||
|
||||
def get_page(self, target_url: str) -> CustomerProfilesEntityAssignmentsPage:
|
||||
"""
|
||||
Retrieve a specific page of CustomerProfilesEntityAssignmentsInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of CustomerProfilesEntityAssignmentsInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return CustomerProfilesEntityAssignmentsPage(
|
||||
self._version, response, self._solution
|
||||
)
|
||||
|
||||
async def get_page_async(
|
||||
self, target_url: str
|
||||
) -> CustomerProfilesEntityAssignmentsPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of CustomerProfilesEntityAssignmentsInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of CustomerProfilesEntityAssignmentsInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return CustomerProfilesEntityAssignmentsPage(
|
||||
self._version, response, self._solution
|
||||
)
|
||||
|
||||
def get(self, sid: str) -> CustomerProfilesEntityAssignmentsContext:
|
||||
"""
|
||||
Constructs a CustomerProfilesEntityAssignmentsContext
|
||||
|
||||
:param sid: The unique string that we created to identify the Identity resource.
|
||||
"""
|
||||
return CustomerProfilesEntityAssignmentsContext(
|
||||
self._version,
|
||||
customer_profile_sid=self._solution["customer_profile_sid"],
|
||||
sid=sid,
|
||||
)
|
||||
|
||||
def __call__(self, sid: str) -> CustomerProfilesEntityAssignmentsContext:
|
||||
"""
|
||||
Constructs a CustomerProfilesEntityAssignmentsContext
|
||||
|
||||
:param sid: The unique string that we created to identify the Identity resource.
|
||||
"""
|
||||
return CustomerProfilesEntityAssignmentsContext(
|
||||
self._version,
|
||||
customer_profile_sid=self._solution["customer_profile_sid"],
|
||||
sid=sid,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.CustomerProfilesEntityAssignmentsList>"
|
||||
+498
@@ -0,0 +1,498 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Trusthub
|
||||
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 CustomerProfilesEvaluationsInstance(InstanceResource):
|
||||
class Status(object):
|
||||
COMPLIANT = "compliant"
|
||||
NONCOMPLIANT = "noncompliant"
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string that identifies the Evaluation resource.
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the customer_profile resource.
|
||||
:ivar policy_sid: The unique string of a policy that is associated to the customer_profile resource.
|
||||
:ivar customer_profile_sid: The unique string that we created to identify the customer_profile resource.
|
||||
:ivar status:
|
||||
:ivar results: The results of the Evaluation which includes the valid and invalid attributes.
|
||||
:ivar date_created:
|
||||
:ivar url:
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
customer_profile_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.policy_sid: Optional[str] = payload.get("policy_sid")
|
||||
self.customer_profile_sid: Optional[str] = payload.get("customer_profile_sid")
|
||||
self.status: Optional[
|
||||
"CustomerProfilesEvaluationsInstance.Status"
|
||||
] = payload.get("status")
|
||||
self.results: Optional[List[object]] = payload.get("results")
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"customer_profile_sid": customer_profile_sid,
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[CustomerProfilesEvaluationsContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "CustomerProfilesEvaluationsContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: CustomerProfilesEvaluationsContext for this CustomerProfilesEvaluationsInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = CustomerProfilesEvaluationsContext(
|
||||
self._version,
|
||||
customer_profile_sid=self._solution["customer_profile_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "CustomerProfilesEvaluationsInstance":
|
||||
"""
|
||||
Fetch the CustomerProfilesEvaluationsInstance
|
||||
|
||||
|
||||
:returns: The fetched CustomerProfilesEvaluationsInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "CustomerProfilesEvaluationsInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the CustomerProfilesEvaluationsInstance
|
||||
|
||||
|
||||
:returns: The fetched CustomerProfilesEvaluationsInstance
|
||||
"""
|
||||
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.Trusthub.V1.CustomerProfilesEvaluationsInstance {}>".format(
|
||||
context
|
||||
)
|
||||
|
||||
|
||||
class CustomerProfilesEvaluationsContext(InstanceContext):
|
||||
def __init__(self, version: Version, customer_profile_sid: str, sid: str):
|
||||
"""
|
||||
Initialize the CustomerProfilesEvaluationsContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param customer_profile_sid: The unique string that we created to identify the customer_profile resource.
|
||||
:param sid: The unique string that identifies the Evaluation resource.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"customer_profile_sid": customer_profile_sid,
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/CustomerProfiles/{customer_profile_sid}/Evaluations/{sid}".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def fetch(self) -> CustomerProfilesEvaluationsInstance:
|
||||
"""
|
||||
Fetch the CustomerProfilesEvaluationsInstance
|
||||
|
||||
|
||||
:returns: The fetched CustomerProfilesEvaluationsInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return CustomerProfilesEvaluationsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
customer_profile_sid=self._solution["customer_profile_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> CustomerProfilesEvaluationsInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the CustomerProfilesEvaluationsInstance
|
||||
|
||||
|
||||
:returns: The fetched CustomerProfilesEvaluationsInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return CustomerProfilesEvaluationsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
customer_profile_sid=self._solution["customer_profile_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.Trusthub.V1.CustomerProfilesEvaluationsContext {}>".format(
|
||||
context
|
||||
)
|
||||
|
||||
|
||||
class CustomerProfilesEvaluationsPage(Page):
|
||||
def get_instance(
|
||||
self, payload: Dict[str, Any]
|
||||
) -> CustomerProfilesEvaluationsInstance:
|
||||
"""
|
||||
Build an instance of CustomerProfilesEvaluationsInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return CustomerProfilesEvaluationsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
customer_profile_sid=self._solution["customer_profile_sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.CustomerProfilesEvaluationsPage>"
|
||||
|
||||
|
||||
class CustomerProfilesEvaluationsList(ListResource):
|
||||
def __init__(self, version: Version, customer_profile_sid: str):
|
||||
"""
|
||||
Initialize the CustomerProfilesEvaluationsList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param customer_profile_sid: The unique string that we created to identify the CustomerProfile resource.
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"customer_profile_sid": customer_profile_sid,
|
||||
}
|
||||
self._uri = "/CustomerProfiles/{customer_profile_sid}/Evaluations".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def create(self, policy_sid: str) -> CustomerProfilesEvaluationsInstance:
|
||||
"""
|
||||
Create the CustomerProfilesEvaluationsInstance
|
||||
|
||||
:param policy_sid: The unique string of a policy that is associated to the customer_profile resource.
|
||||
|
||||
:returns: The created CustomerProfilesEvaluationsInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PolicySid": policy_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return CustomerProfilesEvaluationsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
customer_profile_sid=self._solution["customer_profile_sid"],
|
||||
)
|
||||
|
||||
async def create_async(
|
||||
self, policy_sid: str
|
||||
) -> CustomerProfilesEvaluationsInstance:
|
||||
"""
|
||||
Asynchronously create the CustomerProfilesEvaluationsInstance
|
||||
|
||||
:param policy_sid: The unique string of a policy that is associated to the customer_profile resource.
|
||||
|
||||
:returns: The created CustomerProfilesEvaluationsInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PolicySid": policy_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return CustomerProfilesEvaluationsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
customer_profile_sid=self._solution["customer_profile_sid"],
|
||||
)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[CustomerProfilesEvaluationsInstance]:
|
||||
"""
|
||||
Streams CustomerProfilesEvaluationsInstance 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[CustomerProfilesEvaluationsInstance]:
|
||||
"""
|
||||
Asynchronously streams CustomerProfilesEvaluationsInstance 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[CustomerProfilesEvaluationsInstance]:
|
||||
"""
|
||||
Lists CustomerProfilesEvaluationsInstance 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[CustomerProfilesEvaluationsInstance]:
|
||||
"""
|
||||
Asynchronously lists CustomerProfilesEvaluationsInstance 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,
|
||||
) -> CustomerProfilesEvaluationsPage:
|
||||
"""
|
||||
Retrieve a single page of CustomerProfilesEvaluationsInstance 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 CustomerProfilesEvaluationsInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return CustomerProfilesEvaluationsPage(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,
|
||||
) -> CustomerProfilesEvaluationsPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of CustomerProfilesEvaluationsInstance 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 CustomerProfilesEvaluationsInstance
|
||||
"""
|
||||
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 CustomerProfilesEvaluationsPage(self._version, response, self._solution)
|
||||
|
||||
def get_page(self, target_url: str) -> CustomerProfilesEvaluationsPage:
|
||||
"""
|
||||
Retrieve a specific page of CustomerProfilesEvaluationsInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of CustomerProfilesEvaluationsInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return CustomerProfilesEvaluationsPage(self._version, response, self._solution)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> CustomerProfilesEvaluationsPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of CustomerProfilesEvaluationsInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of CustomerProfilesEvaluationsInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return CustomerProfilesEvaluationsPage(self._version, response, self._solution)
|
||||
|
||||
def get(self, sid: str) -> CustomerProfilesEvaluationsContext:
|
||||
"""
|
||||
Constructs a CustomerProfilesEvaluationsContext
|
||||
|
||||
:param sid: The unique string that identifies the Evaluation resource.
|
||||
"""
|
||||
return CustomerProfilesEvaluationsContext(
|
||||
self._version,
|
||||
customer_profile_sid=self._solution["customer_profile_sid"],
|
||||
sid=sid,
|
||||
)
|
||||
|
||||
def __call__(self, sid: str) -> CustomerProfilesEvaluationsContext:
|
||||
"""
|
||||
Constructs a CustomerProfilesEvaluationsContext
|
||||
|
||||
:param sid: The unique string that identifies the Evaluation resource.
|
||||
"""
|
||||
return CustomerProfilesEvaluationsContext(
|
||||
self._version,
|
||||
customer_profile_sid=self._solution["customer_profile_sid"],
|
||||
sid=sid,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.CustomerProfilesEvaluationsList>"
|
||||
@@ -0,0 +1,600 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Trusthub
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
|
||||
from twilio.base import deserialize, serialize, values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.page import Page
|
||||
|
||||
|
||||
class EndUserInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string created by Twilio to identify the End User resource.
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the End User resource.
|
||||
:ivar friendly_name: The string that you assigned to describe the resource.
|
||||
:ivar type: The type of end user of the Bundle resource - can be `individual` or `business`.
|
||||
:ivar attributes: The set of parameters that are the attributes of the End Users resource which are listed in the End User Types.
|
||||
:ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
:ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
:ivar url: The absolute URL of the End User resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.friendly_name: Optional[str] = payload.get("friendly_name")
|
||||
self.type: Optional[str] = payload.get("type")
|
||||
self.attributes: Optional[Dict[str, object]] = payload.get("attributes")
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
self.date_updated: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_updated")
|
||||
)
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[EndUserContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "EndUserContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: EndUserContext for this EndUserInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = EndUserContext(
|
||||
self._version,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the EndUserInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._proxy.delete()
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the EndUserInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._proxy.delete_async()
|
||||
|
||||
def fetch(self) -> "EndUserInstance":
|
||||
"""
|
||||
Fetch the EndUserInstance
|
||||
|
||||
|
||||
:returns: The fetched EndUserInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "EndUserInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the EndUserInstance
|
||||
|
||||
|
||||
:returns: The fetched EndUserInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def update(
|
||||
self,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
attributes: Union[object, object] = values.unset,
|
||||
) -> "EndUserInstance":
|
||||
"""
|
||||
Update the EndUserInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param attributes: The set of parameters that are the attributes of the End User resource which are derived End User Types.
|
||||
|
||||
:returns: The updated EndUserInstance
|
||||
"""
|
||||
return self._proxy.update(
|
||||
friendly_name=friendly_name,
|
||||
attributes=attributes,
|
||||
)
|
||||
|
||||
async def update_async(
|
||||
self,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
attributes: Union[object, object] = values.unset,
|
||||
) -> "EndUserInstance":
|
||||
"""
|
||||
Asynchronous coroutine to update the EndUserInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param attributes: The set of parameters that are the attributes of the End User resource which are derived End User Types.
|
||||
|
||||
:returns: The updated EndUserInstance
|
||||
"""
|
||||
return await self._proxy.update_async(
|
||||
friendly_name=friendly_name,
|
||||
attributes=attributes,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Trusthub.V1.EndUserInstance {}>".format(context)
|
||||
|
||||
|
||||
class EndUserContext(InstanceContext):
|
||||
def __init__(self, version: Version, sid: str):
|
||||
"""
|
||||
Initialize the EndUserContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param sid: The unique string created by Twilio to identify the End User resource.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/EndUsers/{sid}".format(**self._solution)
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the EndUserInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._version.delete(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the EndUserInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._version.delete_async(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
def fetch(self) -> EndUserInstance:
|
||||
"""
|
||||
Fetch the EndUserInstance
|
||||
|
||||
|
||||
:returns: The fetched EndUserInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return EndUserInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> EndUserInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the EndUserInstance
|
||||
|
||||
|
||||
:returns: The fetched EndUserInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return EndUserInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
def update(
|
||||
self,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
attributes: Union[object, object] = values.unset,
|
||||
) -> EndUserInstance:
|
||||
"""
|
||||
Update the EndUserInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param attributes: The set of parameters that are the attributes of the End User resource which are derived End User Types.
|
||||
|
||||
:returns: The updated EndUserInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FriendlyName": friendly_name,
|
||||
"Attributes": serialize.object(attributes),
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.update(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return EndUserInstance(self._version, payload, sid=self._solution["sid"])
|
||||
|
||||
async def update_async(
|
||||
self,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
attributes: Union[object, object] = values.unset,
|
||||
) -> EndUserInstance:
|
||||
"""
|
||||
Asynchronous coroutine to update the EndUserInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param attributes: The set of parameters that are the attributes of the End User resource which are derived End User Types.
|
||||
|
||||
:returns: The updated EndUserInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FriendlyName": friendly_name,
|
||||
"Attributes": serialize.object(attributes),
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.update_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return EndUserInstance(self._version, payload, sid=self._solution["sid"])
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Trusthub.V1.EndUserContext {}>".format(context)
|
||||
|
||||
|
||||
class EndUserPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> EndUserInstance:
|
||||
"""
|
||||
Build an instance of EndUserInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return EndUserInstance(self._version, payload)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.EndUserPage>"
|
||||
|
||||
|
||||
class EndUserList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the EndUserList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/EndUsers"
|
||||
|
||||
def create(
|
||||
self,
|
||||
friendly_name: str,
|
||||
type: str,
|
||||
attributes: Union[object, object] = values.unset,
|
||||
) -> EndUserInstance:
|
||||
"""
|
||||
Create the EndUserInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param type: The type of end user of the Bundle resource - can be `individual` or `business`.
|
||||
:param attributes: The set of parameters that are the attributes of the End User resource which are derived End User Types.
|
||||
|
||||
:returns: The created EndUserInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FriendlyName": friendly_name,
|
||||
"Type": type,
|
||||
"Attributes": serialize.object(attributes),
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return EndUserInstance(self._version, payload)
|
||||
|
||||
async def create_async(
|
||||
self,
|
||||
friendly_name: str,
|
||||
type: str,
|
||||
attributes: Union[object, object] = values.unset,
|
||||
) -> EndUserInstance:
|
||||
"""
|
||||
Asynchronously create the EndUserInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param type: The type of end user of the Bundle resource - can be `individual` or `business`.
|
||||
:param attributes: The set of parameters that are the attributes of the End User resource which are derived End User Types.
|
||||
|
||||
:returns: The created EndUserInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FriendlyName": friendly_name,
|
||||
"Type": type,
|
||||
"Attributes": serialize.object(attributes),
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return EndUserInstance(self._version, payload)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[EndUserInstance]:
|
||||
"""
|
||||
Streams EndUserInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[EndUserInstance]:
|
||||
"""
|
||||
Asynchronously streams EndUserInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[EndUserInstance]:
|
||||
"""
|
||||
Lists EndUserInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[EndUserInstance]:
|
||||
"""
|
||||
Asynchronously lists EndUserInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> EndUserPage:
|
||||
"""
|
||||
Retrieve a single page of EndUserInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of EndUserInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return EndUserPage(self._version, response)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> EndUserPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of EndUserInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of EndUserInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return EndUserPage(self._version, response)
|
||||
|
||||
def get_page(self, target_url: str) -> EndUserPage:
|
||||
"""
|
||||
Retrieve a specific page of EndUserInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of EndUserInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return EndUserPage(self._version, response)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> EndUserPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of EndUserInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of EndUserInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return EndUserPage(self._version, response)
|
||||
|
||||
def get(self, sid: str) -> EndUserContext:
|
||||
"""
|
||||
Constructs a EndUserContext
|
||||
|
||||
:param sid: The unique string created by Twilio to identify the End User resource.
|
||||
"""
|
||||
return EndUserContext(self._version, sid=sid)
|
||||
|
||||
def __call__(self, sid: str) -> EndUserContext:
|
||||
"""
|
||||
Constructs a EndUserContext
|
||||
|
||||
:param sid: The unique string created by Twilio to identify the End User resource.
|
||||
"""
|
||||
return EndUserContext(self._version, sid=sid)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.EndUserList>"
|
||||
@@ -0,0 +1,393 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Trusthub
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
|
||||
from twilio.base import values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.page import Page
|
||||
|
||||
|
||||
class EndUserTypeInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string that identifies the End-User Type resource.
|
||||
:ivar friendly_name: A human-readable description that is assigned to describe the End-User Type resource. Examples can include first name, last name, email, business name, etc
|
||||
:ivar machine_name: A machine-readable description of the End-User Type resource. Examples can include first_name, last_name, email, business_name, etc.
|
||||
:ivar fields: The required information for creating an End-User. The required fields will change as regulatory needs change and will differ for businesses and individuals.
|
||||
:ivar url: The absolute URL of the End-User Type resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.friendly_name: Optional[str] = payload.get("friendly_name")
|
||||
self.machine_name: Optional[str] = payload.get("machine_name")
|
||||
self.fields: Optional[List[object]] = payload.get("fields")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[EndUserTypeContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "EndUserTypeContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: EndUserTypeContext for this EndUserTypeInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = EndUserTypeContext(
|
||||
self._version,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "EndUserTypeInstance":
|
||||
"""
|
||||
Fetch the EndUserTypeInstance
|
||||
|
||||
|
||||
:returns: The fetched EndUserTypeInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "EndUserTypeInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the EndUserTypeInstance
|
||||
|
||||
|
||||
:returns: The fetched EndUserTypeInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Trusthub.V1.EndUserTypeInstance {}>".format(context)
|
||||
|
||||
|
||||
class EndUserTypeContext(InstanceContext):
|
||||
def __init__(self, version: Version, sid: str):
|
||||
"""
|
||||
Initialize the EndUserTypeContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param sid: The unique string that identifies the End-User Type resource.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/EndUserTypes/{sid}".format(**self._solution)
|
||||
|
||||
def fetch(self) -> EndUserTypeInstance:
|
||||
"""
|
||||
Fetch the EndUserTypeInstance
|
||||
|
||||
|
||||
:returns: The fetched EndUserTypeInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return EndUserTypeInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> EndUserTypeInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the EndUserTypeInstance
|
||||
|
||||
|
||||
:returns: The fetched EndUserTypeInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return EndUserTypeInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Trusthub.V1.EndUserTypeContext {}>".format(context)
|
||||
|
||||
|
||||
class EndUserTypePage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> EndUserTypeInstance:
|
||||
"""
|
||||
Build an instance of EndUserTypeInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return EndUserTypeInstance(self._version, payload)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.EndUserTypePage>"
|
||||
|
||||
|
||||
class EndUserTypeList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the EndUserTypeList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/EndUserTypes"
|
||||
|
||||
def stream(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[EndUserTypeInstance]:
|
||||
"""
|
||||
Streams EndUserTypeInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[EndUserTypeInstance]:
|
||||
"""
|
||||
Asynchronously streams EndUserTypeInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[EndUserTypeInstance]:
|
||||
"""
|
||||
Lists EndUserTypeInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[EndUserTypeInstance]:
|
||||
"""
|
||||
Asynchronously lists EndUserTypeInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> EndUserTypePage:
|
||||
"""
|
||||
Retrieve a single page of EndUserTypeInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of EndUserTypeInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return EndUserTypePage(self._version, response)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> EndUserTypePage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of EndUserTypeInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of EndUserTypeInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return EndUserTypePage(self._version, response)
|
||||
|
||||
def get_page(self, target_url: str) -> EndUserTypePage:
|
||||
"""
|
||||
Retrieve a specific page of EndUserTypeInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of EndUserTypeInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return EndUserTypePage(self._version, response)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> EndUserTypePage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of EndUserTypeInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of EndUserTypeInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return EndUserTypePage(self._version, response)
|
||||
|
||||
def get(self, sid: str) -> EndUserTypeContext:
|
||||
"""
|
||||
Constructs a EndUserTypeContext
|
||||
|
||||
:param sid: The unique string that identifies the End-User Type resource.
|
||||
"""
|
||||
return EndUserTypeContext(self._version, sid=sid)
|
||||
|
||||
def __call__(self, sid: str) -> EndUserTypeContext:
|
||||
"""
|
||||
Constructs a EndUserTypeContext
|
||||
|
||||
:param sid: The unique string that identifies the End-User Type resource.
|
||||
"""
|
||||
return EndUserTypeContext(self._version, sid=sid)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.EndUserTypeList>"
|
||||
@@ -0,0 +1,391 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Trusthub
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
|
||||
from twilio.base import values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.page import Page
|
||||
|
||||
|
||||
class PoliciesInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string that identifies the Policy resource.
|
||||
:ivar friendly_name: A human-readable description that is assigned to describe the Policy resource. Examples can include Primary Customer profile policy
|
||||
:ivar requirements: The SID of an object that holds the policy information
|
||||
:ivar url: The absolute URL of the Policy resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.friendly_name: Optional[str] = payload.get("friendly_name")
|
||||
self.requirements: Optional[Dict[str, object]] = payload.get("requirements")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[PoliciesContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "PoliciesContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: PoliciesContext for this PoliciesInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = PoliciesContext(
|
||||
self._version,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "PoliciesInstance":
|
||||
"""
|
||||
Fetch the PoliciesInstance
|
||||
|
||||
|
||||
:returns: The fetched PoliciesInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "PoliciesInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the PoliciesInstance
|
||||
|
||||
|
||||
:returns: The fetched PoliciesInstance
|
||||
"""
|
||||
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.Trusthub.V1.PoliciesInstance {}>".format(context)
|
||||
|
||||
|
||||
class PoliciesContext(InstanceContext):
|
||||
def __init__(self, version: Version, sid: str):
|
||||
"""
|
||||
Initialize the PoliciesContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param sid: The unique string that identifies the Policy resource.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/Policies/{sid}".format(**self._solution)
|
||||
|
||||
def fetch(self) -> PoliciesInstance:
|
||||
"""
|
||||
Fetch the PoliciesInstance
|
||||
|
||||
|
||||
:returns: The fetched PoliciesInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return PoliciesInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> PoliciesInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the PoliciesInstance
|
||||
|
||||
|
||||
:returns: The fetched PoliciesInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return PoliciesInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Trusthub.V1.PoliciesContext {}>".format(context)
|
||||
|
||||
|
||||
class PoliciesPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> PoliciesInstance:
|
||||
"""
|
||||
Build an instance of PoliciesInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return PoliciesInstance(self._version, payload)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.PoliciesPage>"
|
||||
|
||||
|
||||
class PoliciesList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the PoliciesList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/Policies"
|
||||
|
||||
def stream(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[PoliciesInstance]:
|
||||
"""
|
||||
Streams PoliciesInstance 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[PoliciesInstance]:
|
||||
"""
|
||||
Asynchronously streams PoliciesInstance 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[PoliciesInstance]:
|
||||
"""
|
||||
Lists PoliciesInstance 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[PoliciesInstance]:
|
||||
"""
|
||||
Asynchronously lists PoliciesInstance 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,
|
||||
) -> PoliciesPage:
|
||||
"""
|
||||
Retrieve a single page of PoliciesInstance 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 PoliciesInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return PoliciesPage(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,
|
||||
) -> PoliciesPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of PoliciesInstance 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 PoliciesInstance
|
||||
"""
|
||||
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 PoliciesPage(self._version, response)
|
||||
|
||||
def get_page(self, target_url: str) -> PoliciesPage:
|
||||
"""
|
||||
Retrieve a specific page of PoliciesInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of PoliciesInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return PoliciesPage(self._version, response)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> PoliciesPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of PoliciesInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of PoliciesInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return PoliciesPage(self._version, response)
|
||||
|
||||
def get(self, sid: str) -> PoliciesContext:
|
||||
"""
|
||||
Constructs a PoliciesContext
|
||||
|
||||
:param sid: The unique string that identifies the Policy resource.
|
||||
"""
|
||||
return PoliciesContext(self._version, sid=sid)
|
||||
|
||||
def __call__(self, sid: str) -> PoliciesContext:
|
||||
"""
|
||||
Constructs a PoliciesContext
|
||||
|
||||
:param sid: The unique string that identifies the Policy resource.
|
||||
"""
|
||||
return PoliciesContext(self._version, sid=sid)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.PoliciesList>"
|
||||
@@ -0,0 +1,617 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Trusthub
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
|
||||
from twilio.base import deserialize, serialize, values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.page import Page
|
||||
|
||||
|
||||
class SupportingDocumentInstance(InstanceResource):
|
||||
class Status(object):
|
||||
DRAFT = "draft"
|
||||
PENDING_REVIEW = "pending-review"
|
||||
REJECTED = "rejected"
|
||||
APPROVED = "approved"
|
||||
EXPIRED = "expired"
|
||||
PROVISIONALLY_APPROVED = "provisionally-approved"
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string created by Twilio to identify the Supporting Document resource.
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Document resource.
|
||||
:ivar friendly_name: The string that you assigned to describe the resource.
|
||||
:ivar mime_type: The image type uploaded in the Supporting Document container.
|
||||
:ivar status:
|
||||
:ivar type: The type of the Supporting Document.
|
||||
:ivar attributes: The set of parameters that are the attributes of the Supporting Documents resource which are listed in the Supporting Document Types.
|
||||
:ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
:ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
:ivar url: The absolute URL of the Supporting Document resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.friendly_name: Optional[str] = payload.get("friendly_name")
|
||||
self.mime_type: Optional[str] = payload.get("mime_type")
|
||||
self.status: Optional["SupportingDocumentInstance.Status"] = payload.get(
|
||||
"status"
|
||||
)
|
||||
self.type: Optional[str] = payload.get("type")
|
||||
self.attributes: Optional[Dict[str, object]] = payload.get("attributes")
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
self.date_updated: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_updated")
|
||||
)
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[SupportingDocumentContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "SupportingDocumentContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: SupportingDocumentContext for this SupportingDocumentInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = SupportingDocumentContext(
|
||||
self._version,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the SupportingDocumentInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._proxy.delete()
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the SupportingDocumentInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._proxy.delete_async()
|
||||
|
||||
def fetch(self) -> "SupportingDocumentInstance":
|
||||
"""
|
||||
Fetch the SupportingDocumentInstance
|
||||
|
||||
|
||||
:returns: The fetched SupportingDocumentInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "SupportingDocumentInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the SupportingDocumentInstance
|
||||
|
||||
|
||||
:returns: The fetched SupportingDocumentInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def update(
|
||||
self,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
attributes: Union[object, object] = values.unset,
|
||||
) -> "SupportingDocumentInstance":
|
||||
"""
|
||||
Update the SupportingDocumentInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param attributes: The set of parameters that are the attributes of the Supporting Document resource which are derived Supporting Document Types.
|
||||
|
||||
:returns: The updated SupportingDocumentInstance
|
||||
"""
|
||||
return self._proxy.update(
|
||||
friendly_name=friendly_name,
|
||||
attributes=attributes,
|
||||
)
|
||||
|
||||
async def update_async(
|
||||
self,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
attributes: Union[object, object] = values.unset,
|
||||
) -> "SupportingDocumentInstance":
|
||||
"""
|
||||
Asynchronous coroutine to update the SupportingDocumentInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param attributes: The set of parameters that are the attributes of the Supporting Document resource which are derived Supporting Document Types.
|
||||
|
||||
:returns: The updated SupportingDocumentInstance
|
||||
"""
|
||||
return await self._proxy.update_async(
|
||||
friendly_name=friendly_name,
|
||||
attributes=attributes,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Trusthub.V1.SupportingDocumentInstance {}>".format(context)
|
||||
|
||||
|
||||
class SupportingDocumentContext(InstanceContext):
|
||||
def __init__(self, version: Version, sid: str):
|
||||
"""
|
||||
Initialize the SupportingDocumentContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param sid: The unique string created by Twilio to identify the Supporting Document resource.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/SupportingDocuments/{sid}".format(**self._solution)
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the SupportingDocumentInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._version.delete(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the SupportingDocumentInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._version.delete_async(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
def fetch(self) -> SupportingDocumentInstance:
|
||||
"""
|
||||
Fetch the SupportingDocumentInstance
|
||||
|
||||
|
||||
:returns: The fetched SupportingDocumentInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return SupportingDocumentInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> SupportingDocumentInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the SupportingDocumentInstance
|
||||
|
||||
|
||||
:returns: The fetched SupportingDocumentInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return SupportingDocumentInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
def update(
|
||||
self,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
attributes: Union[object, object] = values.unset,
|
||||
) -> SupportingDocumentInstance:
|
||||
"""
|
||||
Update the SupportingDocumentInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param attributes: The set of parameters that are the attributes of the Supporting Document resource which are derived Supporting Document Types.
|
||||
|
||||
:returns: The updated SupportingDocumentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FriendlyName": friendly_name,
|
||||
"Attributes": serialize.object(attributes),
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.update(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return SupportingDocumentInstance(
|
||||
self._version, payload, sid=self._solution["sid"]
|
||||
)
|
||||
|
||||
async def update_async(
|
||||
self,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
attributes: Union[object, object] = values.unset,
|
||||
) -> SupportingDocumentInstance:
|
||||
"""
|
||||
Asynchronous coroutine to update the SupportingDocumentInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param attributes: The set of parameters that are the attributes of the Supporting Document resource which are derived Supporting Document Types.
|
||||
|
||||
:returns: The updated SupportingDocumentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FriendlyName": friendly_name,
|
||||
"Attributes": serialize.object(attributes),
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.update_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return SupportingDocumentInstance(
|
||||
self._version, payload, sid=self._solution["sid"]
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Trusthub.V1.SupportingDocumentContext {}>".format(context)
|
||||
|
||||
|
||||
class SupportingDocumentPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> SupportingDocumentInstance:
|
||||
"""
|
||||
Build an instance of SupportingDocumentInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return SupportingDocumentInstance(self._version, payload)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.SupportingDocumentPage>"
|
||||
|
||||
|
||||
class SupportingDocumentList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the SupportingDocumentList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/SupportingDocuments"
|
||||
|
||||
def create(
|
||||
self,
|
||||
friendly_name: str,
|
||||
type: str,
|
||||
attributes: Union[object, object] = values.unset,
|
||||
) -> SupportingDocumentInstance:
|
||||
"""
|
||||
Create the SupportingDocumentInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param type: The type of the Supporting Document.
|
||||
:param attributes: The set of parameters that are the attributes of the Supporting Documents resource which are derived Supporting Document Types.
|
||||
|
||||
:returns: The created SupportingDocumentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FriendlyName": friendly_name,
|
||||
"Type": type,
|
||||
"Attributes": serialize.object(attributes),
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return SupportingDocumentInstance(self._version, payload)
|
||||
|
||||
async def create_async(
|
||||
self,
|
||||
friendly_name: str,
|
||||
type: str,
|
||||
attributes: Union[object, object] = values.unset,
|
||||
) -> SupportingDocumentInstance:
|
||||
"""
|
||||
Asynchronously create the SupportingDocumentInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param type: The type of the Supporting Document.
|
||||
:param attributes: The set of parameters that are the attributes of the Supporting Documents resource which are derived Supporting Document Types.
|
||||
|
||||
:returns: The created SupportingDocumentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FriendlyName": friendly_name,
|
||||
"Type": type,
|
||||
"Attributes": serialize.object(attributes),
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return SupportingDocumentInstance(self._version, payload)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[SupportingDocumentInstance]:
|
||||
"""
|
||||
Streams SupportingDocumentInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[SupportingDocumentInstance]:
|
||||
"""
|
||||
Asynchronously streams SupportingDocumentInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[SupportingDocumentInstance]:
|
||||
"""
|
||||
Lists SupportingDocumentInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[SupportingDocumentInstance]:
|
||||
"""
|
||||
Asynchronously lists SupportingDocumentInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> SupportingDocumentPage:
|
||||
"""
|
||||
Retrieve a single page of SupportingDocumentInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of SupportingDocumentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return SupportingDocumentPage(self._version, response)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> SupportingDocumentPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of SupportingDocumentInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of SupportingDocumentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return SupportingDocumentPage(self._version, response)
|
||||
|
||||
def get_page(self, target_url: str) -> SupportingDocumentPage:
|
||||
"""
|
||||
Retrieve a specific page of SupportingDocumentInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of SupportingDocumentInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return SupportingDocumentPage(self._version, response)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> SupportingDocumentPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of SupportingDocumentInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of SupportingDocumentInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return SupportingDocumentPage(self._version, response)
|
||||
|
||||
def get(self, sid: str) -> SupportingDocumentContext:
|
||||
"""
|
||||
Constructs a SupportingDocumentContext
|
||||
|
||||
:param sid: The unique string created by Twilio to identify the Supporting Document resource.
|
||||
"""
|
||||
return SupportingDocumentContext(self._version, sid=sid)
|
||||
|
||||
def __call__(self, sid: str) -> SupportingDocumentContext:
|
||||
"""
|
||||
Constructs a SupportingDocumentContext
|
||||
|
||||
:param sid: The unique string created by Twilio to identify the Supporting Document resource.
|
||||
"""
|
||||
return SupportingDocumentContext(self._version, sid=sid)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.SupportingDocumentList>"
|
||||
+393
@@ -0,0 +1,393 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Trusthub
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator
|
||||
from twilio.base import values
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.page import Page
|
||||
|
||||
|
||||
class SupportingDocumentTypeInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string that identifies the Supporting Document Type resource.
|
||||
:ivar friendly_name: A human-readable description of the Supporting Document Type resource.
|
||||
:ivar machine_name: The machine-readable description of the Supporting Document Type resource.
|
||||
:ivar fields: The required information for creating a Supporting Document. The required fields will change as regulatory needs change and will differ for businesses and individuals.
|
||||
:ivar url: The absolute URL of the Supporting Document Type resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.friendly_name: Optional[str] = payload.get("friendly_name")
|
||||
self.machine_name: Optional[str] = payload.get("machine_name")
|
||||
self.fields: Optional[List[object]] = payload.get("fields")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[SupportingDocumentTypeContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "SupportingDocumentTypeContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: SupportingDocumentTypeContext for this SupportingDocumentTypeInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = SupportingDocumentTypeContext(
|
||||
self._version,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "SupportingDocumentTypeInstance":
|
||||
"""
|
||||
Fetch the SupportingDocumentTypeInstance
|
||||
|
||||
|
||||
:returns: The fetched SupportingDocumentTypeInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "SupportingDocumentTypeInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the SupportingDocumentTypeInstance
|
||||
|
||||
|
||||
:returns: The fetched SupportingDocumentTypeInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Trusthub.V1.SupportingDocumentTypeInstance {}>".format(context)
|
||||
|
||||
|
||||
class SupportingDocumentTypeContext(InstanceContext):
|
||||
def __init__(self, version: Version, sid: str):
|
||||
"""
|
||||
Initialize the SupportingDocumentTypeContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param sid: The unique string that identifies the Supporting Document Type resource.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/SupportingDocumentTypes/{sid}".format(**self._solution)
|
||||
|
||||
def fetch(self) -> SupportingDocumentTypeInstance:
|
||||
"""
|
||||
Fetch the SupportingDocumentTypeInstance
|
||||
|
||||
|
||||
:returns: The fetched SupportingDocumentTypeInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return SupportingDocumentTypeInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> SupportingDocumentTypeInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the SupportingDocumentTypeInstance
|
||||
|
||||
|
||||
:returns: The fetched SupportingDocumentTypeInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return SupportingDocumentTypeInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
|
||||
return "<Twilio.Trusthub.V1.SupportingDocumentTypeContext {}>".format(context)
|
||||
|
||||
|
||||
class SupportingDocumentTypePage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> SupportingDocumentTypeInstance:
|
||||
"""
|
||||
Build an instance of SupportingDocumentTypeInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return SupportingDocumentTypeInstance(self._version, payload)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.SupportingDocumentTypePage>"
|
||||
|
||||
|
||||
class SupportingDocumentTypeList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the SupportingDocumentTypeList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/SupportingDocumentTypes"
|
||||
|
||||
def stream(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[SupportingDocumentTypeInstance]:
|
||||
"""
|
||||
Streams SupportingDocumentTypeInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[SupportingDocumentTypeInstance]:
|
||||
"""
|
||||
Asynchronously streams SupportingDocumentTypeInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(page_size=limits["page_size"])
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[SupportingDocumentTypeInstance]:
|
||||
"""
|
||||
Lists SupportingDocumentTypeInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[SupportingDocumentTypeInstance]:
|
||||
"""
|
||||
Asynchronously lists SupportingDocumentTypeInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> SupportingDocumentTypePage:
|
||||
"""
|
||||
Retrieve a single page of SupportingDocumentTypeInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of SupportingDocumentTypeInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return SupportingDocumentTypePage(self._version, response)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> SupportingDocumentTypePage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of SupportingDocumentTypeInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param page_token: PageToken provided by the API
|
||||
:param page_number: Page Number, this value is simply for client state
|
||||
:param page_size: Number of records to return, defaults to 50
|
||||
|
||||
:returns: Page of SupportingDocumentTypeInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return SupportingDocumentTypePage(self._version, response)
|
||||
|
||||
def get_page(self, target_url: str) -> SupportingDocumentTypePage:
|
||||
"""
|
||||
Retrieve a specific page of SupportingDocumentTypeInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of SupportingDocumentTypeInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return SupportingDocumentTypePage(self._version, response)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> SupportingDocumentTypePage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of SupportingDocumentTypeInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of SupportingDocumentTypeInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return SupportingDocumentTypePage(self._version, response)
|
||||
|
||||
def get(self, sid: str) -> SupportingDocumentTypeContext:
|
||||
"""
|
||||
Constructs a SupportingDocumentTypeContext
|
||||
|
||||
:param sid: The unique string that identifies the Supporting Document Type resource.
|
||||
"""
|
||||
return SupportingDocumentTypeContext(self._version, sid=sid)
|
||||
|
||||
def __call__(self, sid: str) -> SupportingDocumentTypeContext:
|
||||
"""
|
||||
Constructs a SupportingDocumentTypeContext
|
||||
|
||||
:param sid: The unique string that identifies the Supporting Document Type resource.
|
||||
"""
|
||||
return SupportingDocumentTypeContext(self._version, sid=sid)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.SupportingDocumentTypeList>"
|
||||
@@ -0,0 +1,786 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Trusthub
|
||||
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.trusthub.v1.trust_products.trust_products_channel_endpoint_assignment import (
|
||||
TrustProductsChannelEndpointAssignmentList,
|
||||
)
|
||||
from twilio.rest.trusthub.v1.trust_products.trust_products_entity_assignments import (
|
||||
TrustProductsEntityAssignmentsList,
|
||||
)
|
||||
from twilio.rest.trusthub.v1.trust_products.trust_products_evaluations import (
|
||||
TrustProductsEvaluationsList,
|
||||
)
|
||||
|
||||
|
||||
class TrustProductsInstance(InstanceResource):
|
||||
class Status(object):
|
||||
DRAFT = "draft"
|
||||
PENDING_REVIEW = "pending-review"
|
||||
IN_REVIEW = "in-review"
|
||||
TWILIO_REJECTED = "twilio-rejected"
|
||||
TWILIO_APPROVED = "twilio-approved"
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string that we created to identify the Customer-Profile resource.
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Customer-Profile resource.
|
||||
:ivar policy_sid: The unique string of a policy that is associated to the Customer-Profile resource.
|
||||
:ivar friendly_name: The string that you assigned to describe the resource.
|
||||
:ivar status:
|
||||
:ivar valid_until: The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until.
|
||||
:ivar email: The email address that will receive updates when the Customer-Profile resource changes status.
|
||||
:ivar status_callback: The URL we call to inform your application of status changes.
|
||||
:ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
:ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
:ivar url: The absolute URL of the Customer-Profile resource.
|
||||
:ivar links: The URLs of the Assigned Items of the Customer-Profile resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.policy_sid: Optional[str] = payload.get("policy_sid")
|
||||
self.friendly_name: Optional[str] = payload.get("friendly_name")
|
||||
self.status: Optional["TrustProductsInstance.Status"] = payload.get("status")
|
||||
self.valid_until: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("valid_until")
|
||||
)
|
||||
self.email: Optional[str] = payload.get("email")
|
||||
self.status_callback: Optional[str] = payload.get("status_callback")
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
self.date_updated: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_updated")
|
||||
)
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
self.links: Optional[Dict[str, object]] = payload.get("links")
|
||||
|
||||
self._solution = {
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[TrustProductsContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "TrustProductsContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: TrustProductsContext for this TrustProductsInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = TrustProductsContext(
|
||||
self._version,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the TrustProductsInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._proxy.delete()
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the TrustProductsInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._proxy.delete_async()
|
||||
|
||||
def fetch(self) -> "TrustProductsInstance":
|
||||
"""
|
||||
Fetch the TrustProductsInstance
|
||||
|
||||
|
||||
:returns: The fetched TrustProductsInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "TrustProductsInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the TrustProductsInstance
|
||||
|
||||
|
||||
:returns: The fetched TrustProductsInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def update(
|
||||
self,
|
||||
status: Union["TrustProductsInstance.Status", object] = values.unset,
|
||||
status_callback: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
email: Union[str, object] = values.unset,
|
||||
) -> "TrustProductsInstance":
|
||||
"""
|
||||
Update the TrustProductsInstance
|
||||
|
||||
:param status:
|
||||
:param status_callback: The URL we call to inform your application of status changes.
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param email: The email address that will receive updates when the Customer-Profile resource changes status.
|
||||
|
||||
:returns: The updated TrustProductsInstance
|
||||
"""
|
||||
return self._proxy.update(
|
||||
status=status,
|
||||
status_callback=status_callback,
|
||||
friendly_name=friendly_name,
|
||||
email=email,
|
||||
)
|
||||
|
||||
async def update_async(
|
||||
self,
|
||||
status: Union["TrustProductsInstance.Status", object] = values.unset,
|
||||
status_callback: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
email: Union[str, object] = values.unset,
|
||||
) -> "TrustProductsInstance":
|
||||
"""
|
||||
Asynchronous coroutine to update the TrustProductsInstance
|
||||
|
||||
:param status:
|
||||
:param status_callback: The URL we call to inform your application of status changes.
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param email: The email address that will receive updates when the Customer-Profile resource changes status.
|
||||
|
||||
:returns: The updated TrustProductsInstance
|
||||
"""
|
||||
return await self._proxy.update_async(
|
||||
status=status,
|
||||
status_callback=status_callback,
|
||||
friendly_name=friendly_name,
|
||||
email=email,
|
||||
)
|
||||
|
||||
@property
|
||||
def trust_products_channel_endpoint_assignment(
|
||||
self,
|
||||
) -> TrustProductsChannelEndpointAssignmentList:
|
||||
"""
|
||||
Access the trust_products_channel_endpoint_assignment
|
||||
"""
|
||||
return self._proxy.trust_products_channel_endpoint_assignment
|
||||
|
||||
@property
|
||||
def trust_products_entity_assignments(self) -> TrustProductsEntityAssignmentsList:
|
||||
"""
|
||||
Access the trust_products_entity_assignments
|
||||
"""
|
||||
return self._proxy.trust_products_entity_assignments
|
||||
|
||||
@property
|
||||
def trust_products_evaluations(self) -> TrustProductsEvaluationsList:
|
||||
"""
|
||||
Access the trust_products_evaluations
|
||||
"""
|
||||
return self._proxy.trust_products_evaluations
|
||||
|
||||
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.Trusthub.V1.TrustProductsInstance {}>".format(context)
|
||||
|
||||
|
||||
class TrustProductsContext(InstanceContext):
|
||||
def __init__(self, version: Version, sid: str):
|
||||
"""
|
||||
Initialize the TrustProductsContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param sid: The unique string that we created to identify the Customer-Profile resource.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/TrustProducts/{sid}".format(**self._solution)
|
||||
|
||||
self._trust_products_channel_endpoint_assignment: Optional[
|
||||
TrustProductsChannelEndpointAssignmentList
|
||||
] = None
|
||||
self._trust_products_entity_assignments: Optional[
|
||||
TrustProductsEntityAssignmentsList
|
||||
] = None
|
||||
self._trust_products_evaluations: Optional[TrustProductsEvaluationsList] = None
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the TrustProductsInstance
|
||||
|
||||
|
||||
: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 TrustProductsInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._version.delete_async(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
def fetch(self) -> TrustProductsInstance:
|
||||
"""
|
||||
Fetch the TrustProductsInstance
|
||||
|
||||
|
||||
:returns: The fetched TrustProductsInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return TrustProductsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> TrustProductsInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the TrustProductsInstance
|
||||
|
||||
|
||||
:returns: The fetched TrustProductsInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return TrustProductsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
def update(
|
||||
self,
|
||||
status: Union["TrustProductsInstance.Status", object] = values.unset,
|
||||
status_callback: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
email: Union[str, object] = values.unset,
|
||||
) -> TrustProductsInstance:
|
||||
"""
|
||||
Update the TrustProductsInstance
|
||||
|
||||
:param status:
|
||||
:param status_callback: The URL we call to inform your application of status changes.
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param email: The email address that will receive updates when the Customer-Profile resource changes status.
|
||||
|
||||
:returns: The updated TrustProductsInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"Status": status,
|
||||
"StatusCallback": status_callback,
|
||||
"FriendlyName": friendly_name,
|
||||
"Email": email,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.update(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return TrustProductsInstance(self._version, payload, sid=self._solution["sid"])
|
||||
|
||||
async def update_async(
|
||||
self,
|
||||
status: Union["TrustProductsInstance.Status", object] = values.unset,
|
||||
status_callback: Union[str, object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
email: Union[str, object] = values.unset,
|
||||
) -> TrustProductsInstance:
|
||||
"""
|
||||
Asynchronous coroutine to update the TrustProductsInstance
|
||||
|
||||
:param status:
|
||||
:param status_callback: The URL we call to inform your application of status changes.
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param email: The email address that will receive updates when the Customer-Profile resource changes status.
|
||||
|
||||
:returns: The updated TrustProductsInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"Status": status,
|
||||
"StatusCallback": status_callback,
|
||||
"FriendlyName": friendly_name,
|
||||
"Email": email,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.update_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return TrustProductsInstance(self._version, payload, sid=self._solution["sid"])
|
||||
|
||||
@property
|
||||
def trust_products_channel_endpoint_assignment(
|
||||
self,
|
||||
) -> TrustProductsChannelEndpointAssignmentList:
|
||||
"""
|
||||
Access the trust_products_channel_endpoint_assignment
|
||||
"""
|
||||
if self._trust_products_channel_endpoint_assignment is None:
|
||||
self._trust_products_channel_endpoint_assignment = (
|
||||
TrustProductsChannelEndpointAssignmentList(
|
||||
self._version,
|
||||
self._solution["sid"],
|
||||
)
|
||||
)
|
||||
return self._trust_products_channel_endpoint_assignment
|
||||
|
||||
@property
|
||||
def trust_products_entity_assignments(self) -> TrustProductsEntityAssignmentsList:
|
||||
"""
|
||||
Access the trust_products_entity_assignments
|
||||
"""
|
||||
if self._trust_products_entity_assignments is None:
|
||||
self._trust_products_entity_assignments = (
|
||||
TrustProductsEntityAssignmentsList(
|
||||
self._version,
|
||||
self._solution["sid"],
|
||||
)
|
||||
)
|
||||
return self._trust_products_entity_assignments
|
||||
|
||||
@property
|
||||
def trust_products_evaluations(self) -> TrustProductsEvaluationsList:
|
||||
"""
|
||||
Access the trust_products_evaluations
|
||||
"""
|
||||
if self._trust_products_evaluations is None:
|
||||
self._trust_products_evaluations = TrustProductsEvaluationsList(
|
||||
self._version,
|
||||
self._solution["sid"],
|
||||
)
|
||||
return self._trust_products_evaluations
|
||||
|
||||
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.Trusthub.V1.TrustProductsContext {}>".format(context)
|
||||
|
||||
|
||||
class TrustProductsPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> TrustProductsInstance:
|
||||
"""
|
||||
Build an instance of TrustProductsInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return TrustProductsInstance(self._version, payload)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.TrustProductsPage>"
|
||||
|
||||
|
||||
class TrustProductsList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the TrustProductsList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/TrustProducts"
|
||||
|
||||
def create(
|
||||
self,
|
||||
friendly_name: str,
|
||||
email: str,
|
||||
policy_sid: str,
|
||||
status_callback: Union[str, object] = values.unset,
|
||||
) -> TrustProductsInstance:
|
||||
"""
|
||||
Create the TrustProductsInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param email: The email address that will receive updates when the Customer-Profile resource changes status.
|
||||
:param policy_sid: The unique string of a policy that is associated to the Customer-Profile resource.
|
||||
:param status_callback: The URL we call to inform your application of status changes.
|
||||
|
||||
:returns: The created TrustProductsInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FriendlyName": friendly_name,
|
||||
"Email": email,
|
||||
"PolicySid": policy_sid,
|
||||
"StatusCallback": status_callback,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return TrustProductsInstance(self._version, payload)
|
||||
|
||||
async def create_async(
|
||||
self,
|
||||
friendly_name: str,
|
||||
email: str,
|
||||
policy_sid: str,
|
||||
status_callback: Union[str, object] = values.unset,
|
||||
) -> TrustProductsInstance:
|
||||
"""
|
||||
Asynchronously create the TrustProductsInstance
|
||||
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param email: The email address that will receive updates when the Customer-Profile resource changes status.
|
||||
:param policy_sid: The unique string of a policy that is associated to the Customer-Profile resource.
|
||||
:param status_callback: The URL we call to inform your application of status changes.
|
||||
|
||||
:returns: The created TrustProductsInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"FriendlyName": friendly_name,
|
||||
"Email": email,
|
||||
"PolicySid": policy_sid,
|
||||
"StatusCallback": status_callback,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return TrustProductsInstance(self._version, payload)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
status: Union["TrustProductsInstance.Status", object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
policy_sid: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[TrustProductsInstance]:
|
||||
"""
|
||||
Streams TrustProductsInstance 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 "TrustProductsInstance.Status" status: The verification status of the Customer-Profile resource.
|
||||
:param str friendly_name: The string that you assigned to describe the resource.
|
||||
:param str policy_sid: The unique string of a policy that is associated to the Customer-Profile resource.
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = self.page(
|
||||
status=status,
|
||||
friendly_name=friendly_name,
|
||||
policy_sid=policy_sid,
|
||||
page_size=limits["page_size"],
|
||||
)
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
status: Union["TrustProductsInstance.Status", object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
policy_sid: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[TrustProductsInstance]:
|
||||
"""
|
||||
Asynchronously streams TrustProductsInstance 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 "TrustProductsInstance.Status" status: The verification status of the Customer-Profile resource.
|
||||
:param str friendly_name: The string that you assigned to describe the resource.
|
||||
:param str policy_sid: The unique string of a policy that is associated to the Customer-Profile resource.
|
||||
:param limit: Upper limit for the number of records to return. stream()
|
||||
guarantees to never return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, stream() will attempt to read the
|
||||
limit with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: Generator that will yield up to limit results
|
||||
"""
|
||||
limits = self._version.read_limits(limit, page_size)
|
||||
page = await self.page_async(
|
||||
status=status,
|
||||
friendly_name=friendly_name,
|
||||
policy_sid=policy_sid,
|
||||
page_size=limits["page_size"],
|
||||
)
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
status: Union["TrustProductsInstance.Status", object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
policy_sid: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[TrustProductsInstance]:
|
||||
"""
|
||||
Lists TrustProductsInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param "TrustProductsInstance.Status" status: The verification status of the Customer-Profile resource.
|
||||
:param str friendly_name: The string that you assigned to describe the resource.
|
||||
:param str policy_sid: The unique string of a policy that is associated to the Customer-Profile resource.
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return list(
|
||||
self.stream(
|
||||
status=status,
|
||||
friendly_name=friendly_name,
|
||||
policy_sid=policy_sid,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
status: Union["TrustProductsInstance.Status", object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
policy_sid: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[TrustProductsInstance]:
|
||||
"""
|
||||
Asynchronously lists TrustProductsInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param "TrustProductsInstance.Status" status: The verification status of the Customer-Profile resource.
|
||||
:param str friendly_name: The string that you assigned to describe the resource.
|
||||
:param str policy_sid: The unique string of a policy that is associated to the Customer-Profile resource.
|
||||
:param limit: Upper limit for the number of records to return. list() guarantees
|
||||
never to return more than limit. Default is no limit
|
||||
:param page_size: Number of records to fetch per request, when not set will use
|
||||
the default value of 50 records. If no page_size is defined
|
||||
but a limit is defined, list() will attempt to read the limit
|
||||
with the most efficient page size, i.e. min(limit, 1000)
|
||||
|
||||
:returns: list that will contain up to limit results
|
||||
"""
|
||||
return [
|
||||
record
|
||||
async for record in await self.stream_async(
|
||||
status=status,
|
||||
friendly_name=friendly_name,
|
||||
policy_sid=policy_sid,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
status: Union["TrustProductsInstance.Status", object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
policy_sid: Union[str, object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> TrustProductsPage:
|
||||
"""
|
||||
Retrieve a single page of TrustProductsInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param status: The verification status of the Customer-Profile resource.
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param policy_sid: The unique string of a policy that is associated to the Customer-Profile resource.
|
||||
: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 TrustProductsInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"Status": status,
|
||||
"FriendlyName": friendly_name,
|
||||
"PolicySid": policy_sid,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return TrustProductsPage(self._version, response)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
status: Union["TrustProductsInstance.Status", object] = values.unset,
|
||||
friendly_name: Union[str, object] = values.unset,
|
||||
policy_sid: Union[str, object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> TrustProductsPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of TrustProductsInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param status: The verification status of the Customer-Profile resource.
|
||||
:param friendly_name: The string that you assigned to describe the resource.
|
||||
:param policy_sid: The unique string of a policy that is associated to the Customer-Profile resource.
|
||||
: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 TrustProductsInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"Status": status,
|
||||
"FriendlyName": friendly_name,
|
||||
"PolicySid": policy_sid,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return TrustProductsPage(self._version, response)
|
||||
|
||||
def get_page(self, target_url: str) -> TrustProductsPage:
|
||||
"""
|
||||
Retrieve a specific page of TrustProductsInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of TrustProductsInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return TrustProductsPage(self._version, response)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> TrustProductsPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of TrustProductsInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of TrustProductsInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return TrustProductsPage(self._version, response)
|
||||
|
||||
def get(self, sid: str) -> TrustProductsContext:
|
||||
"""
|
||||
Constructs a TrustProductsContext
|
||||
|
||||
:param sid: The unique string that we created to identify the Customer-Profile resource.
|
||||
"""
|
||||
return TrustProductsContext(self._version, sid=sid)
|
||||
|
||||
def __call__(self, sid: str) -> TrustProductsContext:
|
||||
"""
|
||||
Constructs a TrustProductsContext
|
||||
|
||||
:param sid: The unique string that we created to identify the Customer-Profile resource.
|
||||
"""
|
||||
return TrustProductsContext(self._version, sid=sid)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.TrustProductsList>"
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+591
@@ -0,0 +1,591 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Trusthub
|
||||
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 TrustProductsChannelEndpointAssignmentInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string that we created to identify the Item Assignment resource.
|
||||
:ivar trust_product_sid: The unique string that we created to identify the CustomerProfile resource.
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource.
|
||||
:ivar channel_endpoint_type: The type of channel endpoint. eg: phone-number
|
||||
:ivar channel_endpoint_sid: The SID of an channel endpoint
|
||||
:ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
:ivar url: The absolute URL of the Identity resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
trust_product_sid: str,
|
||||
sid: Optional[str] = None,
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.trust_product_sid: Optional[str] = payload.get("trust_product_sid")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.channel_endpoint_type: Optional[str] = payload.get("channel_endpoint_type")
|
||||
self.channel_endpoint_sid: Optional[str] = payload.get("channel_endpoint_sid")
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"trust_product_sid": trust_product_sid,
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[TrustProductsChannelEndpointAssignmentContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "TrustProductsChannelEndpointAssignmentContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: TrustProductsChannelEndpointAssignmentContext for this TrustProductsChannelEndpointAssignmentInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = TrustProductsChannelEndpointAssignmentContext(
|
||||
self._version,
|
||||
trust_product_sid=self._solution["trust_product_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the TrustProductsChannelEndpointAssignmentInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._proxy.delete()
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the TrustProductsChannelEndpointAssignmentInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._proxy.delete_async()
|
||||
|
||||
def fetch(self) -> "TrustProductsChannelEndpointAssignmentInstance":
|
||||
"""
|
||||
Fetch the TrustProductsChannelEndpointAssignmentInstance
|
||||
|
||||
|
||||
:returns: The fetched TrustProductsChannelEndpointAssignmentInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "TrustProductsChannelEndpointAssignmentInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the TrustProductsChannelEndpointAssignmentInstance
|
||||
|
||||
|
||||
:returns: The fetched TrustProductsChannelEndpointAssignmentInstance
|
||||
"""
|
||||
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.Trusthub.V1.TrustProductsChannelEndpointAssignmentInstance {}>".format(
|
||||
context
|
||||
)
|
||||
|
||||
|
||||
class TrustProductsChannelEndpointAssignmentContext(InstanceContext):
|
||||
def __init__(self, version: Version, trust_product_sid: str, sid: str):
|
||||
"""
|
||||
Initialize the TrustProductsChannelEndpointAssignmentContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param trust_product_sid: The unique string that we created to identify the CustomerProfile resource.
|
||||
:param sid: The unique string that we created to identify the resource.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"trust_product_sid": trust_product_sid,
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/TrustProducts/{trust_product_sid}/ChannelEndpointAssignments/{sid}".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the TrustProductsChannelEndpointAssignmentInstance
|
||||
|
||||
|
||||
: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 TrustProductsChannelEndpointAssignmentInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._version.delete_async(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
def fetch(self) -> TrustProductsChannelEndpointAssignmentInstance:
|
||||
"""
|
||||
Fetch the TrustProductsChannelEndpointAssignmentInstance
|
||||
|
||||
|
||||
:returns: The fetched TrustProductsChannelEndpointAssignmentInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return TrustProductsChannelEndpointAssignmentInstance(
|
||||
self._version,
|
||||
payload,
|
||||
trust_product_sid=self._solution["trust_product_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> TrustProductsChannelEndpointAssignmentInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the TrustProductsChannelEndpointAssignmentInstance
|
||||
|
||||
|
||||
:returns: The fetched TrustProductsChannelEndpointAssignmentInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return TrustProductsChannelEndpointAssignmentInstance(
|
||||
self._version,
|
||||
payload,
|
||||
trust_product_sid=self._solution["trust_product_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.Trusthub.V1.TrustProductsChannelEndpointAssignmentContext {}>".format(
|
||||
context
|
||||
)
|
||||
|
||||
|
||||
class TrustProductsChannelEndpointAssignmentPage(Page):
|
||||
def get_instance(
|
||||
self, payload: Dict[str, Any]
|
||||
) -> TrustProductsChannelEndpointAssignmentInstance:
|
||||
"""
|
||||
Build an instance of TrustProductsChannelEndpointAssignmentInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return TrustProductsChannelEndpointAssignmentInstance(
|
||||
self._version,
|
||||
payload,
|
||||
trust_product_sid=self._solution["trust_product_sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.TrustProductsChannelEndpointAssignmentPage>"
|
||||
|
||||
|
||||
class TrustProductsChannelEndpointAssignmentList(ListResource):
|
||||
def __init__(self, version: Version, trust_product_sid: str):
|
||||
"""
|
||||
Initialize the TrustProductsChannelEndpointAssignmentList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param trust_product_sid: The unique string that we created to identify the CustomerProfile resource.
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"trust_product_sid": trust_product_sid,
|
||||
}
|
||||
self._uri = (
|
||||
"/TrustProducts/{trust_product_sid}/ChannelEndpointAssignments".format(
|
||||
**self._solution
|
||||
)
|
||||
)
|
||||
|
||||
def create(
|
||||
self, channel_endpoint_type: str, channel_endpoint_sid: str
|
||||
) -> TrustProductsChannelEndpointAssignmentInstance:
|
||||
"""
|
||||
Create the TrustProductsChannelEndpointAssignmentInstance
|
||||
|
||||
:param channel_endpoint_type: The type of channel endpoint. eg: phone-number
|
||||
:param channel_endpoint_sid: The SID of an channel endpoint
|
||||
|
||||
:returns: The created TrustProductsChannelEndpointAssignmentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"ChannelEndpointType": channel_endpoint_type,
|
||||
"ChannelEndpointSid": channel_endpoint_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return TrustProductsChannelEndpointAssignmentInstance(
|
||||
self._version,
|
||||
payload,
|
||||
trust_product_sid=self._solution["trust_product_sid"],
|
||||
)
|
||||
|
||||
async def create_async(
|
||||
self, channel_endpoint_type: str, channel_endpoint_sid: str
|
||||
) -> TrustProductsChannelEndpointAssignmentInstance:
|
||||
"""
|
||||
Asynchronously create the TrustProductsChannelEndpointAssignmentInstance
|
||||
|
||||
:param channel_endpoint_type: The type of channel endpoint. eg: phone-number
|
||||
:param channel_endpoint_sid: The SID of an channel endpoint
|
||||
|
||||
:returns: The created TrustProductsChannelEndpointAssignmentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"ChannelEndpointType": channel_endpoint_type,
|
||||
"ChannelEndpointSid": channel_endpoint_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return TrustProductsChannelEndpointAssignmentInstance(
|
||||
self._version,
|
||||
payload,
|
||||
trust_product_sid=self._solution["trust_product_sid"],
|
||||
)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
channel_endpoint_sid: Union[str, object] = values.unset,
|
||||
channel_endpoint_sids: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[TrustProductsChannelEndpointAssignmentInstance]:
|
||||
"""
|
||||
Streams TrustProductsChannelEndpointAssignmentInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param str channel_endpoint_sid: The SID of an channel endpoint
|
||||
:param str channel_endpoint_sids: comma separated list of channel endpoint sids
|
||||
: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(
|
||||
channel_endpoint_sid=channel_endpoint_sid,
|
||||
channel_endpoint_sids=channel_endpoint_sids,
|
||||
page_size=limits["page_size"],
|
||||
)
|
||||
|
||||
return self._version.stream(page, limits["limit"])
|
||||
|
||||
async def stream_async(
|
||||
self,
|
||||
channel_endpoint_sid: Union[str, object] = values.unset,
|
||||
channel_endpoint_sids: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> AsyncIterator[TrustProductsChannelEndpointAssignmentInstance]:
|
||||
"""
|
||||
Asynchronously streams TrustProductsChannelEndpointAssignmentInstance records from the API as a generator stream.
|
||||
This operation lazily loads records as efficiently as possible until the limit
|
||||
is reached.
|
||||
The results are returned as a generator, so this operation is memory efficient.
|
||||
|
||||
:param str channel_endpoint_sid: The SID of an channel endpoint
|
||||
:param str channel_endpoint_sids: comma separated list of channel endpoint sids
|
||||
: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(
|
||||
channel_endpoint_sid=channel_endpoint_sid,
|
||||
channel_endpoint_sids=channel_endpoint_sids,
|
||||
page_size=limits["page_size"],
|
||||
)
|
||||
|
||||
return self._version.stream_async(page, limits["limit"])
|
||||
|
||||
def list(
|
||||
self,
|
||||
channel_endpoint_sid: Union[str, object] = values.unset,
|
||||
channel_endpoint_sids: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[TrustProductsChannelEndpointAssignmentInstance]:
|
||||
"""
|
||||
Lists TrustProductsChannelEndpointAssignmentInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param str channel_endpoint_sid: The SID of an channel endpoint
|
||||
:param str channel_endpoint_sids: comma separated list of channel endpoint sids
|
||||
: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(
|
||||
channel_endpoint_sid=channel_endpoint_sid,
|
||||
channel_endpoint_sids=channel_endpoint_sids,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
)
|
||||
|
||||
async def list_async(
|
||||
self,
|
||||
channel_endpoint_sid: Union[str, object] = values.unset,
|
||||
channel_endpoint_sids: Union[str, object] = values.unset,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> List[TrustProductsChannelEndpointAssignmentInstance]:
|
||||
"""
|
||||
Asynchronously lists TrustProductsChannelEndpointAssignmentInstance records from the API as a list.
|
||||
Unlike stream(), this operation is eager and will load `limit` records into
|
||||
memory before returning.
|
||||
|
||||
:param str channel_endpoint_sid: The SID of an channel endpoint
|
||||
:param str channel_endpoint_sids: comma separated list of channel endpoint sids
|
||||
: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(
|
||||
channel_endpoint_sid=channel_endpoint_sid,
|
||||
channel_endpoint_sids=channel_endpoint_sids,
|
||||
limit=limit,
|
||||
page_size=page_size,
|
||||
)
|
||||
]
|
||||
|
||||
def page(
|
||||
self,
|
||||
channel_endpoint_sid: Union[str, object] = values.unset,
|
||||
channel_endpoint_sids: Union[str, object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> TrustProductsChannelEndpointAssignmentPage:
|
||||
"""
|
||||
Retrieve a single page of TrustProductsChannelEndpointAssignmentInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param channel_endpoint_sid: The SID of an channel endpoint
|
||||
:param channel_endpoint_sids: comma separated list of channel endpoint sids
|
||||
: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 TrustProductsChannelEndpointAssignmentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"ChannelEndpointSid": channel_endpoint_sid,
|
||||
"ChannelEndpointSids": channel_endpoint_sids,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return TrustProductsChannelEndpointAssignmentPage(
|
||||
self._version, response, self._solution
|
||||
)
|
||||
|
||||
async def page_async(
|
||||
self,
|
||||
channel_endpoint_sid: Union[str, object] = values.unset,
|
||||
channel_endpoint_sids: Union[str, object] = values.unset,
|
||||
page_token: Union[str, object] = values.unset,
|
||||
page_number: Union[int, object] = values.unset,
|
||||
page_size: Union[int, object] = values.unset,
|
||||
) -> TrustProductsChannelEndpointAssignmentPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of TrustProductsChannelEndpointAssignmentInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param channel_endpoint_sid: The SID of an channel endpoint
|
||||
:param channel_endpoint_sids: comma separated list of channel endpoint sids
|
||||
: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 TrustProductsChannelEndpointAssignmentInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"ChannelEndpointSid": channel_endpoint_sid,
|
||||
"ChannelEndpointSids": channel_endpoint_sids,
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = await self._version.page_async(
|
||||
method="GET", uri=self._uri, params=data
|
||||
)
|
||||
return TrustProductsChannelEndpointAssignmentPage(
|
||||
self._version, response, self._solution
|
||||
)
|
||||
|
||||
def get_page(self, target_url: str) -> TrustProductsChannelEndpointAssignmentPage:
|
||||
"""
|
||||
Retrieve a specific page of TrustProductsChannelEndpointAssignmentInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of TrustProductsChannelEndpointAssignmentInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return TrustProductsChannelEndpointAssignmentPage(
|
||||
self._version, response, self._solution
|
||||
)
|
||||
|
||||
async def get_page_async(
|
||||
self, target_url: str
|
||||
) -> TrustProductsChannelEndpointAssignmentPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of TrustProductsChannelEndpointAssignmentInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of TrustProductsChannelEndpointAssignmentInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return TrustProductsChannelEndpointAssignmentPage(
|
||||
self._version, response, self._solution
|
||||
)
|
||||
|
||||
def get(self, sid: str) -> TrustProductsChannelEndpointAssignmentContext:
|
||||
"""
|
||||
Constructs a TrustProductsChannelEndpointAssignmentContext
|
||||
|
||||
:param sid: The unique string that we created to identify the resource.
|
||||
"""
|
||||
return TrustProductsChannelEndpointAssignmentContext(
|
||||
self._version,
|
||||
trust_product_sid=self._solution["trust_product_sid"],
|
||||
sid=sid,
|
||||
)
|
||||
|
||||
def __call__(self, sid: str) -> TrustProductsChannelEndpointAssignmentContext:
|
||||
"""
|
||||
Constructs a TrustProductsChannelEndpointAssignmentContext
|
||||
|
||||
:param sid: The unique string that we created to identify the resource.
|
||||
"""
|
||||
return TrustProductsChannelEndpointAssignmentContext(
|
||||
self._version,
|
||||
trust_product_sid=self._solution["trust_product_sid"],
|
||||
sid=sid,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.TrustProductsChannelEndpointAssignmentList>"
|
||||
+541
@@ -0,0 +1,541 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Trusthub
|
||||
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 TrustProductsEntityAssignmentsInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string that we created to identify the Item Assignment resource.
|
||||
:ivar trust_product_sid: The unique string that we created to identify the TrustProduct resource.
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource.
|
||||
:ivar object_sid: The SID of an object bag that holds information of the different items.
|
||||
:ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
||||
:ivar url: The absolute URL of the Identity resource.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
trust_product_sid: str,
|
||||
sid: Optional[str] = None,
|
||||
):
|
||||
super().__init__(version)
|
||||
|
||||
self.sid: Optional[str] = payload.get("sid")
|
||||
self.trust_product_sid: Optional[str] = payload.get("trust_product_sid")
|
||||
self.account_sid: Optional[str] = payload.get("account_sid")
|
||||
self.object_sid: Optional[str] = payload.get("object_sid")
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"trust_product_sid": trust_product_sid,
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[TrustProductsEntityAssignmentsContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "TrustProductsEntityAssignmentsContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: TrustProductsEntityAssignmentsContext for this TrustProductsEntityAssignmentsInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = TrustProductsEntityAssignmentsContext(
|
||||
self._version,
|
||||
trust_product_sid=self._solution["trust_product_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the TrustProductsEntityAssignmentsInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return self._proxy.delete()
|
||||
|
||||
async def delete_async(self) -> bool:
|
||||
"""
|
||||
Asynchronous coroutine that deletes the TrustProductsEntityAssignmentsInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._proxy.delete_async()
|
||||
|
||||
def fetch(self) -> "TrustProductsEntityAssignmentsInstance":
|
||||
"""
|
||||
Fetch the TrustProductsEntityAssignmentsInstance
|
||||
|
||||
|
||||
:returns: The fetched TrustProductsEntityAssignmentsInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "TrustProductsEntityAssignmentsInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the TrustProductsEntityAssignmentsInstance
|
||||
|
||||
|
||||
:returns: The fetched TrustProductsEntityAssignmentsInstance
|
||||
"""
|
||||
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.Trusthub.V1.TrustProductsEntityAssignmentsInstance {}>".format(
|
||||
context
|
||||
)
|
||||
|
||||
|
||||
class TrustProductsEntityAssignmentsContext(InstanceContext):
|
||||
def __init__(self, version: Version, trust_product_sid: str, sid: str):
|
||||
"""
|
||||
Initialize the TrustProductsEntityAssignmentsContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param trust_product_sid: The unique string that we created to identify the TrustProduct resource.
|
||||
:param sid: The unique string that we created to identify the Identity resource.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"trust_product_sid": trust_product_sid,
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/TrustProducts/{trust_product_sid}/EntityAssignments/{sid}".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def delete(self) -> bool:
|
||||
"""
|
||||
Deletes the TrustProductsEntityAssignmentsInstance
|
||||
|
||||
|
||||
: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 TrustProductsEntityAssignmentsInstance
|
||||
|
||||
|
||||
:returns: True if delete succeeds, False otherwise
|
||||
"""
|
||||
return await self._version.delete_async(
|
||||
method="DELETE",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
def fetch(self) -> TrustProductsEntityAssignmentsInstance:
|
||||
"""
|
||||
Fetch the TrustProductsEntityAssignmentsInstance
|
||||
|
||||
|
||||
:returns: The fetched TrustProductsEntityAssignmentsInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return TrustProductsEntityAssignmentsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
trust_product_sid=self._solution["trust_product_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> TrustProductsEntityAssignmentsInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the TrustProductsEntityAssignmentsInstance
|
||||
|
||||
|
||||
:returns: The fetched TrustProductsEntityAssignmentsInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return TrustProductsEntityAssignmentsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
trust_product_sid=self._solution["trust_product_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.Trusthub.V1.TrustProductsEntityAssignmentsContext {}>".format(
|
||||
context
|
||||
)
|
||||
|
||||
|
||||
class TrustProductsEntityAssignmentsPage(Page):
|
||||
def get_instance(
|
||||
self, payload: Dict[str, Any]
|
||||
) -> TrustProductsEntityAssignmentsInstance:
|
||||
"""
|
||||
Build an instance of TrustProductsEntityAssignmentsInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return TrustProductsEntityAssignmentsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
trust_product_sid=self._solution["trust_product_sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.TrustProductsEntityAssignmentsPage>"
|
||||
|
||||
|
||||
class TrustProductsEntityAssignmentsList(ListResource):
|
||||
def __init__(self, version: Version, trust_product_sid: str):
|
||||
"""
|
||||
Initialize the TrustProductsEntityAssignmentsList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param trust_product_sid: The unique string that we created to identify the TrustProduct resource.
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"trust_product_sid": trust_product_sid,
|
||||
}
|
||||
self._uri = "/TrustProducts/{trust_product_sid}/EntityAssignments".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def create(self, object_sid: str) -> TrustProductsEntityAssignmentsInstance:
|
||||
"""
|
||||
Create the TrustProductsEntityAssignmentsInstance
|
||||
|
||||
:param object_sid: The SID of an object bag that holds information of the different items.
|
||||
|
||||
:returns: The created TrustProductsEntityAssignmentsInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"ObjectSid": object_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return TrustProductsEntityAssignmentsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
trust_product_sid=self._solution["trust_product_sid"],
|
||||
)
|
||||
|
||||
async def create_async(
|
||||
self, object_sid: str
|
||||
) -> TrustProductsEntityAssignmentsInstance:
|
||||
"""
|
||||
Asynchronously create the TrustProductsEntityAssignmentsInstance
|
||||
|
||||
:param object_sid: The SID of an object bag that holds information of the different items.
|
||||
|
||||
:returns: The created TrustProductsEntityAssignmentsInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"ObjectSid": object_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return TrustProductsEntityAssignmentsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
trust_product_sid=self._solution["trust_product_sid"],
|
||||
)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[TrustProductsEntityAssignmentsInstance]:
|
||||
"""
|
||||
Streams TrustProductsEntityAssignmentsInstance 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[TrustProductsEntityAssignmentsInstance]:
|
||||
"""
|
||||
Asynchronously streams TrustProductsEntityAssignmentsInstance 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[TrustProductsEntityAssignmentsInstance]:
|
||||
"""
|
||||
Lists TrustProductsEntityAssignmentsInstance 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[TrustProductsEntityAssignmentsInstance]:
|
||||
"""
|
||||
Asynchronously lists TrustProductsEntityAssignmentsInstance 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,
|
||||
) -> TrustProductsEntityAssignmentsPage:
|
||||
"""
|
||||
Retrieve a single page of TrustProductsEntityAssignmentsInstance 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 TrustProductsEntityAssignmentsInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return TrustProductsEntityAssignmentsPage(
|
||||
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,
|
||||
) -> TrustProductsEntityAssignmentsPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of TrustProductsEntityAssignmentsInstance 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 TrustProductsEntityAssignmentsInstance
|
||||
"""
|
||||
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 TrustProductsEntityAssignmentsPage(
|
||||
self._version, response, self._solution
|
||||
)
|
||||
|
||||
def get_page(self, target_url: str) -> TrustProductsEntityAssignmentsPage:
|
||||
"""
|
||||
Retrieve a specific page of TrustProductsEntityAssignmentsInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of TrustProductsEntityAssignmentsInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return TrustProductsEntityAssignmentsPage(
|
||||
self._version, response, self._solution
|
||||
)
|
||||
|
||||
async def get_page_async(
|
||||
self, target_url: str
|
||||
) -> TrustProductsEntityAssignmentsPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of TrustProductsEntityAssignmentsInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of TrustProductsEntityAssignmentsInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return TrustProductsEntityAssignmentsPage(
|
||||
self._version, response, self._solution
|
||||
)
|
||||
|
||||
def get(self, sid: str) -> TrustProductsEntityAssignmentsContext:
|
||||
"""
|
||||
Constructs a TrustProductsEntityAssignmentsContext
|
||||
|
||||
:param sid: The unique string that we created to identify the Identity resource.
|
||||
"""
|
||||
return TrustProductsEntityAssignmentsContext(
|
||||
self._version,
|
||||
trust_product_sid=self._solution["trust_product_sid"],
|
||||
sid=sid,
|
||||
)
|
||||
|
||||
def __call__(self, sid: str) -> TrustProductsEntityAssignmentsContext:
|
||||
"""
|
||||
Constructs a TrustProductsEntityAssignmentsContext
|
||||
|
||||
:param sid: The unique string that we created to identify the Identity resource.
|
||||
"""
|
||||
return TrustProductsEntityAssignmentsContext(
|
||||
self._version,
|
||||
trust_product_sid=self._solution["trust_product_sid"],
|
||||
sid=sid,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.TrustProductsEntityAssignmentsList>"
|
||||
+492
@@ -0,0 +1,492 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Trusthub
|
||||
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 TrustProductsEvaluationsInstance(InstanceResource):
|
||||
class Status(object):
|
||||
COMPLIANT = "compliant"
|
||||
NONCOMPLIANT = "noncompliant"
|
||||
|
||||
"""
|
||||
:ivar sid: The unique string that identifies the Evaluation resource.
|
||||
:ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the trust_product resource.
|
||||
:ivar policy_sid: The unique string of a policy that is associated to the trust_product resource.
|
||||
:ivar trust_product_sid: The unique string that we created to identify the trust_product resource.
|
||||
:ivar status:
|
||||
:ivar results: The results of the Evaluation which includes the valid and invalid attributes.
|
||||
:ivar date_created:
|
||||
:ivar url:
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
version: Version,
|
||||
payload: Dict[str, Any],
|
||||
trust_product_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.policy_sid: Optional[str] = payload.get("policy_sid")
|
||||
self.trust_product_sid: Optional[str] = payload.get("trust_product_sid")
|
||||
self.status: Optional["TrustProductsEvaluationsInstance.Status"] = payload.get(
|
||||
"status"
|
||||
)
|
||||
self.results: Optional[List[object]] = payload.get("results")
|
||||
self.date_created: Optional[datetime] = deserialize.iso8601_datetime(
|
||||
payload.get("date_created")
|
||||
)
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._solution = {
|
||||
"trust_product_sid": trust_product_sid,
|
||||
"sid": sid or self.sid,
|
||||
}
|
||||
self._context: Optional[TrustProductsEvaluationsContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "TrustProductsEvaluationsContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: TrustProductsEvaluationsContext for this TrustProductsEvaluationsInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = TrustProductsEvaluationsContext(
|
||||
self._version,
|
||||
trust_product_sid=self._solution["trust_product_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "TrustProductsEvaluationsInstance":
|
||||
"""
|
||||
Fetch the TrustProductsEvaluationsInstance
|
||||
|
||||
|
||||
:returns: The fetched TrustProductsEvaluationsInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "TrustProductsEvaluationsInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the TrustProductsEvaluationsInstance
|
||||
|
||||
|
||||
:returns: The fetched TrustProductsEvaluationsInstance
|
||||
"""
|
||||
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.Trusthub.V1.TrustProductsEvaluationsInstance {}>".format(
|
||||
context
|
||||
)
|
||||
|
||||
|
||||
class TrustProductsEvaluationsContext(InstanceContext):
|
||||
def __init__(self, version: Version, trust_product_sid: str, sid: str):
|
||||
"""
|
||||
Initialize the TrustProductsEvaluationsContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param trust_product_sid: The unique string that we created to identify the trust_product resource.
|
||||
:param sid: The unique string that identifies the Evaluation resource.
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"trust_product_sid": trust_product_sid,
|
||||
"sid": sid,
|
||||
}
|
||||
self._uri = "/TrustProducts/{trust_product_sid}/Evaluations/{sid}".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def fetch(self) -> TrustProductsEvaluationsInstance:
|
||||
"""
|
||||
Fetch the TrustProductsEvaluationsInstance
|
||||
|
||||
|
||||
:returns: The fetched TrustProductsEvaluationsInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return TrustProductsEvaluationsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
trust_product_sid=self._solution["trust_product_sid"],
|
||||
sid=self._solution["sid"],
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> TrustProductsEvaluationsInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the TrustProductsEvaluationsInstance
|
||||
|
||||
|
||||
:returns: The fetched TrustProductsEvaluationsInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return TrustProductsEvaluationsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
trust_product_sid=self._solution["trust_product_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.Trusthub.V1.TrustProductsEvaluationsContext {}>".format(context)
|
||||
|
||||
|
||||
class TrustProductsEvaluationsPage(Page):
|
||||
def get_instance(self, payload: Dict[str, Any]) -> TrustProductsEvaluationsInstance:
|
||||
"""
|
||||
Build an instance of TrustProductsEvaluationsInstance
|
||||
|
||||
:param payload: Payload response from the API
|
||||
"""
|
||||
return TrustProductsEvaluationsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
trust_product_sid=self._solution["trust_product_sid"],
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.TrustProductsEvaluationsPage>"
|
||||
|
||||
|
||||
class TrustProductsEvaluationsList(ListResource):
|
||||
def __init__(self, version: Version, trust_product_sid: str):
|
||||
"""
|
||||
Initialize the TrustProductsEvaluationsList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
:param trust_product_sid: The unique string that we created to identify the trust_product resource.
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
# Path Solution
|
||||
self._solution = {
|
||||
"trust_product_sid": trust_product_sid,
|
||||
}
|
||||
self._uri = "/TrustProducts/{trust_product_sid}/Evaluations".format(
|
||||
**self._solution
|
||||
)
|
||||
|
||||
def create(self, policy_sid: str) -> TrustProductsEvaluationsInstance:
|
||||
"""
|
||||
Create the TrustProductsEvaluationsInstance
|
||||
|
||||
:param policy_sid: The unique string of a policy that is associated to the customer_profile resource.
|
||||
|
||||
:returns: The created TrustProductsEvaluationsInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PolicySid": policy_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return TrustProductsEvaluationsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
trust_product_sid=self._solution["trust_product_sid"],
|
||||
)
|
||||
|
||||
async def create_async(self, policy_sid: str) -> TrustProductsEvaluationsInstance:
|
||||
"""
|
||||
Asynchronously create the TrustProductsEvaluationsInstance
|
||||
|
||||
:param policy_sid: The unique string of a policy that is associated to the customer_profile resource.
|
||||
|
||||
:returns: The created TrustProductsEvaluationsInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PolicySid": policy_sid,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return TrustProductsEvaluationsInstance(
|
||||
self._version,
|
||||
payload,
|
||||
trust_product_sid=self._solution["trust_product_sid"],
|
||||
)
|
||||
|
||||
def stream(
|
||||
self,
|
||||
limit: Optional[int] = None,
|
||||
page_size: Optional[int] = None,
|
||||
) -> Iterator[TrustProductsEvaluationsInstance]:
|
||||
"""
|
||||
Streams TrustProductsEvaluationsInstance 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[TrustProductsEvaluationsInstance]:
|
||||
"""
|
||||
Asynchronously streams TrustProductsEvaluationsInstance 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[TrustProductsEvaluationsInstance]:
|
||||
"""
|
||||
Lists TrustProductsEvaluationsInstance 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[TrustProductsEvaluationsInstance]:
|
||||
"""
|
||||
Asynchronously lists TrustProductsEvaluationsInstance 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,
|
||||
) -> TrustProductsEvaluationsPage:
|
||||
"""
|
||||
Retrieve a single page of TrustProductsEvaluationsInstance 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 TrustProductsEvaluationsInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"PageToken": page_token,
|
||||
"Page": page_number,
|
||||
"PageSize": page_size,
|
||||
}
|
||||
)
|
||||
|
||||
response = self._version.page(method="GET", uri=self._uri, params=data)
|
||||
return TrustProductsEvaluationsPage(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,
|
||||
) -> TrustProductsEvaluationsPage:
|
||||
"""
|
||||
Asynchronously retrieve a single page of TrustProductsEvaluationsInstance 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 TrustProductsEvaluationsInstance
|
||||
"""
|
||||
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 TrustProductsEvaluationsPage(self._version, response, self._solution)
|
||||
|
||||
def get_page(self, target_url: str) -> TrustProductsEvaluationsPage:
|
||||
"""
|
||||
Retrieve a specific page of TrustProductsEvaluationsInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of TrustProductsEvaluationsInstance
|
||||
"""
|
||||
response = self._version.domain.twilio.request("GET", target_url)
|
||||
return TrustProductsEvaluationsPage(self._version, response, self._solution)
|
||||
|
||||
async def get_page_async(self, target_url: str) -> TrustProductsEvaluationsPage:
|
||||
"""
|
||||
Asynchronously retrieve a specific page of TrustProductsEvaluationsInstance records from the API.
|
||||
Request is executed immediately
|
||||
|
||||
:param target_url: API-generated URL for the requested results page
|
||||
|
||||
:returns: Page of TrustProductsEvaluationsInstance
|
||||
"""
|
||||
response = await self._version.domain.twilio.request_async("GET", target_url)
|
||||
return TrustProductsEvaluationsPage(self._version, response, self._solution)
|
||||
|
||||
def get(self, sid: str) -> TrustProductsEvaluationsContext:
|
||||
"""
|
||||
Constructs a TrustProductsEvaluationsContext
|
||||
|
||||
:param sid: The unique string that identifies the Evaluation resource.
|
||||
"""
|
||||
return TrustProductsEvaluationsContext(
|
||||
self._version,
|
||||
trust_product_sid=self._solution["trust_product_sid"],
|
||||
sid=sid,
|
||||
)
|
||||
|
||||
def __call__(self, sid: str) -> TrustProductsEvaluationsContext:
|
||||
"""
|
||||
Constructs a TrustProductsEvaluationsContext
|
||||
|
||||
:param sid: The unique string that identifies the Evaluation resource.
|
||||
"""
|
||||
return TrustProductsEvaluationsContext(
|
||||
self._version,
|
||||
trust_product_sid=self._solution["trust_product_sid"],
|
||||
sid=sid,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Trusthub.V1.TrustProductsEvaluationsList>"
|
||||
Reference in New Issue
Block a user