diff --git a/twilio/rest/accounts/v1/auth_token_promotion.py b/twilio/rest/accounts/v1/auth_token_promotion.py index c80cdc24c..7626046d1 100644 --- a/twilio/rest/accounts/v1/auth_token_promotion.py +++ b/twilio/rest/accounts/v1/auth_token_promotion.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Optional +from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,19 +23,27 @@ class AuthTokenPromotionInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the AuthTokenPromotionInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the secondary Auth Token was created for. + :ivar auth_token: The promoted Auth Token that must be used to authenticate future API requests. + :ivar date_created: The date and time in UTC 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 URI for this resource, relative to `https://accounts.twilio.com` + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "auth_token": payload.get("auth_token"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.auth_token: Optional[str] = payload.get("auth_token") + 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 = {} self._context: Optional[AuthTokenPromotionContext] = None @@ -54,41 +62,6 @@ def _proxy(self) -> "AuthTokenPromotionContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the secondary Auth Token was created for. - """ - return self._properties["account_sid"] - - @property - def auth_token(self) -> str: - """ - :returns: The promoted Auth Token that must be used to authenticate future API requests. - """ - return self._properties["auth_token"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in UTC when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The URI for this resource, relative to `https://accounts.twilio.com` - """ - return self._properties["url"] - def update(self) -> "AuthTokenPromotionInstance": """ Update the AuthTokenPromotionInstance diff --git a/twilio/rest/accounts/v1/credential/aws.py b/twilio/rest/accounts/v1/credential/aws.py index 5d85daee4..284722567 100644 --- a/twilio/rest/accounts/v1/credential/aws.py +++ b/twilio/rest/accounts/v1/credential/aws.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,23 +24,34 @@ class AwsInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the AwsInstance - """ + + """ + :ivar sid: The unique string that we created to identify the AWS resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AWS resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar url: The URI for this resource, relative to `https://accounts.twilio.com` + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + 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.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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[AwsContext] = None @@ -59,48 +70,6 @@ def _proxy(self) -> "AwsContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the AWS resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AWS resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The URI for this resource, relative to `https://accounts.twilio.com` - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the AwsInstance diff --git a/twilio/rest/accounts/v1/credential/public_key.py b/twilio/rest/accounts/v1/credential/public_key.py index 995e00d47..3e0b70171 100644 --- a/twilio/rest/accounts/v1/credential/public_key.py +++ b/twilio/rest/accounts/v1/credential/public_key.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,23 +24,34 @@ class PublicKeyInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the PublicKeyInstance - """ + + """ + :ivar sid: The unique string that that we created to identify the PublicKey resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Credential that the PublicKey resource belongs to. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar url: The URI for this resource, relative to `https://accounts.twilio.com` + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + 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.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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[PublicKeyContext] = None @@ -59,48 +70,6 @@ def _proxy(self) -> "PublicKeyContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the PublicKey resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Credential that the PublicKey resource belongs to. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The URI for this resource, relative to `https://accounts.twilio.com` - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the PublicKeyInstance diff --git a/twilio/rest/accounts/v1/secondary_auth_token.py b/twilio/rest/accounts/v1/secondary_auth_token.py index f0192d545..d394f2a0a 100644 --- a/twilio/rest/accounts/v1/secondary_auth_token.py +++ b/twilio/rest/accounts/v1/secondary_auth_token.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Optional +from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,19 +23,27 @@ class SecondaryAuthTokenInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the SecondaryAuthTokenInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the secondary Auth Token was created for. + :ivar date_created: The date and time in UTC 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 UTC when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar secondary_auth_token: The generated secondary Auth Token that can be used to authenticate future API requests. + :ivar url: The URI for this resource, relative to `https://accounts.twilio.com` + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "secondary_auth_token": payload.get("secondary_auth_token"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.secondary_auth_token: Optional[str] = payload.get("secondary_auth_token") + self.url: Optional[str] = payload.get("url") self._solution = {} self._context: Optional[SecondaryAuthTokenContext] = None @@ -54,41 +62,6 @@ def _proxy(self) -> "SecondaryAuthTokenContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the secondary Auth Token was created for. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in UTC when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in UTC when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def secondary_auth_token(self) -> str: - """ - :returns: The generated secondary Auth Token that can be used to authenticate future API requests. - """ - return self._properties["secondary_auth_token"] - - @property - def url(self) -> str: - """ - :returns: The URI for this resource, relative to `https://accounts.twilio.com` - """ - return self._properties["url"] - def create(self) -> "SecondaryAuthTokenInstance": """ Create the SecondaryAuthTokenInstance diff --git a/twilio/rest/api/v2010/account/__init__.py b/twilio/rest/api/v2010/account/__init__.py index 15e0f7f5c..b9d2c9c31 100644 --- a/twilio/rest/api/v2010/account/__init__.py +++ b/twilio/rest/api/v2010/account/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -61,27 +61,43 @@ class Type(object): TRIAL = "Trial" FULL = "Full" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the AccountInstance - """ + """ + :ivar auth_token: The authorization token for this account. This token should be kept a secret, so no sharing. + :ivar date_created: The date that this account was created, in GMT in RFC 2822 format + :ivar date_updated: The date that this account was last updated, in GMT in RFC 2822 format. + :ivar friendly_name: A human readable description of this account, up to 64 characters long. By default the FriendlyName is your email address. + :ivar owner_account_sid: The unique 34 character id that represents the parent of this account. The OwnerAccountSid of a parent account is it's own sid. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar status: + :ivar subresource_uris: A Map of various subresources available for the given Account Instance + :ivar type: + :ivar uri: The URI for this resource, relative to `https://api.twilio.com` + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "auth_token": payload.get("auth_token"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "owner_account_sid": payload.get("owner_account_sid"), - "sid": payload.get("sid"), - "status": payload.get("status"), - "subresource_uris": payload.get("subresource_uris"), - "type": payload.get("type"), - "uri": payload.get("uri"), - } + self.auth_token: Optional[str] = payload.get("auth_token") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.owner_account_sid: Optional[str] = payload.get("owner_account_sid") + self.sid: Optional[str] = payload.get("sid") + self.status: Optional["AccountInstance.Status"] = payload.get("status") + self.subresource_uris: Optional[Dict[str, object]] = payload.get( + "subresource_uris" + ) + self.type: Optional["AccountInstance.Type"] = payload.get("type") + self.uri: Optional[str] = payload.get("uri") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[AccountContext] = None @@ -100,76 +116,6 @@ def _proxy(self) -> "AccountContext": ) return self._context - @property - def auth_token(self) -> str: - """ - :returns: The authorization token for this account. This token should be kept a secret, so no sharing. - """ - return self._properties["auth_token"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this account was created, in GMT in RFC 2822 format - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this account was last updated, in GMT in RFC 2822 format. - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: A human readable description of this account, up to 64 characters long. By default the FriendlyName is your email address. - """ - return self._properties["friendly_name"] - - @property - def owner_account_sid(self) -> str: - """ - :returns: The unique 34 character id that represents the parent of this account. The OwnerAccountSid of a parent account is it's own sid. - """ - return self._properties["owner_account_sid"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def status(self) -> "AccountInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def subresource_uris(self) -> Dict[str, object]: - """ - :returns: A Map of various subresources available for the given Account Instance - """ - return self._properties["subresource_uris"] - - @property - def type(self) -> "AccountInstance.Type": - """ - :returns: - """ - return self._properties["type"] - - @property - def uri(self) -> str: - """ - :returns: The URI for this resource, relative to `https://api.twilio.com` - """ - return self._properties["uri"] - def fetch(self) -> "AccountInstance": """ Fetch the AccountInstance diff --git a/twilio/rest/api/v2010/account/address/__init__.py b/twilio/rest/api/v2010/account/address/__init__.py index dbc81f5e1..076de3019 100644 --- a/twilio/rest/api/v2010/account/address/__init__.py +++ b/twilio/rest/api/v2010/account/address/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,34 +27,59 @@ class AddressInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, sid: Optional[str] = None): - """ - Initialize the AddressInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that is responsible for the Address resource. + :ivar city: The city in which the address is located. + :ivar customer_name: The name associated with the address.This property has a maximum length of 16 4-byte characters, or 21 3-byte characters. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar iso_country: The ISO country code of the address. + :ivar postal_code: The postal code of the address. + :ivar region: The state or region of the address. + :ivar sid: The unique string that that we created to identify the Address resource. + :ivar street: The number and street address of the address. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + :ivar emergency_enabled: Whether emergency calling has been enabled on this number. + :ivar validated: Whether the address has been validated to comply with local regulation. In countries that require valid addresses, an invalid address will not be accepted. `true` indicates the Address has been validated. `false` indicate the country doesn't require validation or the Address is not valid. + :ivar verified: Whether the address has been verified to comply with regulation. In countries that require valid addresses, an invalid address will not be accepted. `true` indicates the Address has been verified. `false` indicate the country doesn't require verified or the Address is not valid. + :ivar street_secondary: The additional number and street address of the address. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "city": payload.get("city"), - "customer_name": payload.get("customer_name"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "iso_country": payload.get("iso_country"), - "postal_code": payload.get("postal_code"), - "region": payload.get("region"), - "sid": payload.get("sid"), - "street": payload.get("street"), - "uri": payload.get("uri"), - "emergency_enabled": payload.get("emergency_enabled"), - "validated": payload.get("validated"), - "verified": payload.get("verified"), - "street_secondary": payload.get("street_secondary"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.city: Optional[str] = payload.get("city") + self.customer_name: Optional[str] = payload.get("customer_name") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.iso_country: Optional[str] = payload.get("iso_country") + self.postal_code: Optional[str] = payload.get("postal_code") + self.region: Optional[str] = payload.get("region") + self.sid: Optional[str] = payload.get("sid") + self.street: Optional[str] = payload.get("street") + self.uri: Optional[str] = payload.get("uri") + self.emergency_enabled: Optional[bool] = payload.get("emergency_enabled") + self.validated: Optional[bool] = payload.get("validated") + self.verified: Optional[bool] = payload.get("verified") + self.street_secondary: Optional[str] = payload.get("street_secondary") self._solution = { "account_sid": account_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[AddressContext] = None @@ -74,118 +99,6 @@ def _proxy(self) -> "AddressContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that is responsible for the Address resource. - """ - return self._properties["account_sid"] - - @property - def city(self) -> str: - """ - :returns: The city in which the address is located. - """ - return self._properties["city"] - - @property - def customer_name(self) -> str: - """ - :returns: The name associated with the address.This property has a maximum length of 16 4-byte characters, or 21 3-byte characters. - """ - return self._properties["customer_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def iso_country(self) -> str: - """ - :returns: The ISO country code of the address. - """ - return self._properties["iso_country"] - - @property - def postal_code(self) -> str: - """ - :returns: The postal code of the address. - """ - return self._properties["postal_code"] - - @property - def region(self) -> str: - """ - :returns: The state or region of the address. - """ - return self._properties["region"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the Address resource. - """ - return self._properties["sid"] - - @property - def street(self) -> str: - """ - :returns: The number and street address of the address. - """ - return self._properties["street"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def emergency_enabled(self) -> bool: - """ - :returns: Whether emergency calling has been enabled on this number. - """ - return self._properties["emergency_enabled"] - - @property - def validated(self) -> bool: - """ - :returns: Whether the address has been validated to comply with local regulation. In countries that require valid addresses, an invalid address will not be accepted. `true` indicates the Address has been validated. `false` indicate the country doesn't require validation or the Address is not valid. - """ - return self._properties["validated"] - - @property - def verified(self) -> bool: - """ - :returns: Whether the address has been verified to comply with regulation. In countries that require valid addresses, an invalid address will not be accepted. `true` indicates the Address has been verified. `false` indicate the country doesn't require verified or the Address is not valid. - """ - return self._properties["verified"] - - @property - def street_secondary(self) -> str: - """ - :returns: The additional number and street address of the address. - """ - return self._properties["street_secondary"] - def delete(self) -> bool: """ Deletes the AddressInstance diff --git a/twilio/rest/api/v2010/account/address/dependent_phone_number.py b/twilio/rest/api/v2010/account/address/dependent_phone_number.py index 7cd2a1cb5..5118cf3b7 100644 --- a/twilio/rest/api/v2010/account/address/dependent_phone_number.py +++ b/twilio/rest/api/v2010/account/address/dependent_phone_number.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -34,228 +34,88 @@ class EmergencyStatus(object): ACTIVE = "Active" INACTIVE = "Inactive" - def __init__(self, version, payload, account_sid: str, address_sid: str): - """ - Initialize the DependentPhoneNumberInstance - """ + """ + :ivar sid: The unique string that that we created to identify the DependentPhoneNumber resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the DependentPhoneNumber resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + :ivar voice_url: The URL we call when the phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. + :ivar voice_method: The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. + :ivar voice_fallback_method: The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. + :ivar voice_fallback_url: The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. + :ivar voice_caller_id_lookup: Whether we look up the caller's caller-ID name from the CNAM database. Can be: `true` or `false`. Caller ID lookups can cost $0.01 each. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar sms_fallback_method: The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. + :ivar sms_fallback_url: The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. + :ivar sms_method: The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. + :ivar sms_url: The URL we call when the phone number receives an incoming SMS message. + :ivar address_requirements: + :ivar capabilities: The set of Boolean properties that indicates whether a phone number can receive calls or messages. Capabilities are `Voice`, `SMS`, and `MMS` and each capability can be: `true` or `false`. + :ivar status_callback: The URL we call using the `status_callback_method` to send status information to your application. + :ivar status_callback_method: The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. + :ivar api_version: The API version used to start a new TwiML session. + :ivar sms_application_sid: The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. + :ivar voice_application_sid: The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. + :ivar trunk_sid: The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. + :ivar emergency_status: + :ivar emergency_address_sid: The SID of the emergency address configuration that we use for emergency calling from the phone number. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + address_sid: str, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "phone_number": payload.get("phone_number"), - "voice_url": payload.get("voice_url"), - "voice_method": payload.get("voice_method"), - "voice_fallback_method": payload.get("voice_fallback_method"), - "voice_fallback_url": payload.get("voice_fallback_url"), - "voice_caller_id_lookup": payload.get("voice_caller_id_lookup"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "sms_fallback_method": payload.get("sms_fallback_method"), - "sms_fallback_url": payload.get("sms_fallback_url"), - "sms_method": payload.get("sms_method"), - "sms_url": payload.get("sms_url"), - "address_requirements": payload.get("address_requirements"), - "capabilities": payload.get("capabilities"), - "status_callback": payload.get("status_callback"), - "status_callback_method": payload.get("status_callback_method"), - "api_version": payload.get("api_version"), - "sms_application_sid": payload.get("sms_application_sid"), - "voice_application_sid": payload.get("voice_application_sid"), - "trunk_sid": payload.get("trunk_sid"), - "emergency_status": payload.get("emergency_status"), - "emergency_address_sid": payload.get("emergency_address_sid"), - "uri": payload.get("uri"), - } + 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.phone_number: Optional[str] = payload.get("phone_number") + self.voice_url: Optional[str] = payload.get("voice_url") + self.voice_method: Optional[str] = payload.get("voice_method") + self.voice_fallback_method: Optional[str] = payload.get("voice_fallback_method") + self.voice_fallback_url: Optional[str] = payload.get("voice_fallback_url") + self.voice_caller_id_lookup: Optional[bool] = payload.get( + "voice_caller_id_lookup" + ) + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.sms_fallback_method: Optional[str] = payload.get("sms_fallback_method") + self.sms_fallback_url: Optional[str] = payload.get("sms_fallback_url") + self.sms_method: Optional[str] = payload.get("sms_method") + self.sms_url: Optional[str] = payload.get("sms_url") + self.address_requirements: Optional[ + "DependentPhoneNumberInstance.AddressRequirement" + ] = payload.get("address_requirements") + self.capabilities: Optional[Dict[str, object]] = payload.get("capabilities") + self.status_callback: Optional[str] = payload.get("status_callback") + self.status_callback_method: Optional[str] = payload.get( + "status_callback_method" + ) + self.api_version: Optional[str] = payload.get("api_version") + self.sms_application_sid: Optional[str] = payload.get("sms_application_sid") + self.voice_application_sid: Optional[str] = payload.get("voice_application_sid") + self.trunk_sid: Optional[str] = payload.get("trunk_sid") + self.emergency_status: Optional[ + "DependentPhoneNumberInstance.EmergencyStatus" + ] = payload.get("emergency_status") + self.emergency_address_sid: Optional[str] = payload.get("emergency_address_sid") + self.uri: Optional[str] = payload.get("uri") self._solution = { "account_sid": account_sid, "address_sid": address_sid, } - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the DependentPhoneNumber resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the DependentPhoneNumber resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def phone_number(self) -> str: - """ - :returns: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. - """ - return self._properties["phone_number"] - - @property - def voice_url(self) -> str: - """ - :returns: The URL we call when the phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. - """ - return self._properties["voice_url"] - - @property - def voice_method(self) -> str: - """ - :returns: The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. - """ - return self._properties["voice_method"] - - @property - def voice_fallback_method(self) -> str: - """ - :returns: The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. - """ - return self._properties["voice_fallback_method"] - - @property - def voice_fallback_url(self) -> str: - """ - :returns: The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. - """ - return self._properties["voice_fallback_url"] - - @property - def voice_caller_id_lookup(self) -> bool: - """ - :returns: Whether we look up the caller's caller-ID name from the CNAM database. Can be: `true` or `false`. Caller ID lookups can cost $0.01 each. - """ - return self._properties["voice_caller_id_lookup"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def sms_fallback_method(self) -> str: - """ - :returns: The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. - """ - return self._properties["sms_fallback_method"] - - @property - def sms_fallback_url(self) -> str: - """ - :returns: The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. - """ - return self._properties["sms_fallback_url"] - - @property - def sms_method(self) -> str: - """ - :returns: The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. - """ - return self._properties["sms_method"] - - @property - def sms_url(self) -> str: - """ - :returns: The URL we call when the phone number receives an incoming SMS message. - """ - return self._properties["sms_url"] - - @property - def address_requirements(self) -> "DependentPhoneNumberInstance.AddressRequirement": - """ - :returns: - """ - return self._properties["address_requirements"] - - @property - def capabilities(self) -> Dict[str, object]: - """ - :returns: The set of Boolean properties that indicates whether a phone number can receive calls or messages. Capabilities are `Voice`, `SMS`, and `MMS` and each capability can be: `true` or `false`. - """ - return self._properties["capabilities"] - - @property - def status_callback(self) -> str: - """ - :returns: The URL we call using the `status_callback_method` to send status information to your application. - """ - return self._properties["status_callback"] - - @property - def status_callback_method(self) -> str: - """ - :returns: The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. - """ - return self._properties["status_callback_method"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to start a new TwiML session. - """ - return self._properties["api_version"] - - @property - def sms_application_sid(self) -> str: - """ - :returns: The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. - """ - return self._properties["sms_application_sid"] - - @property - def voice_application_sid(self) -> str: - """ - :returns: The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. - """ - return self._properties["voice_application_sid"] - - @property - def trunk_sid(self) -> str: - """ - :returns: The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. - """ - return self._properties["trunk_sid"] - - @property - def emergency_status(self) -> "DependentPhoneNumberInstance.EmergencyStatus": - """ - :returns: - """ - return self._properties["emergency_status"] - - @property - def emergency_address_sid(self) -> str: - """ - :returns: The SID of the emergency address configuration that we use for emergency calling from the phone number. - """ - return self._properties["emergency_address_sid"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/application.py b/twilio/rest/api/v2010/account/application.py index 85353bec4..0eb304d6b 100644 --- a/twilio/rest/api/v2010/account/application.py +++ b/twilio/rest/api/v2010/account/application.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,41 +24,77 @@ class ApplicationInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, sid: Optional[str] = None): - """ - Initialize the ApplicationInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Application resource. + :ivar api_version: The API version used to start a new TwiML session. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar message_status_callback: The URL we call using a POST method to send message status information to your application. + :ivar sid: The unique string that that we created to identify the Application resource. + :ivar sms_fallback_method: The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. + :ivar sms_fallback_url: The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. + :ivar sms_method: The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. + :ivar sms_status_callback: The URL we call using a POST method to send status information to your application about SMS messages that refer to the application. + :ivar sms_url: The URL we call when the phone number receives an incoming SMS message. + :ivar status_callback: The URL we call using the `status_callback_method` to send status information to your application. + :ivar status_callback_method: The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + :ivar voice_caller_id_lookup: Whether we look up the caller's caller-ID name from the CNAM database (additional charges apply). Can be: `true` or `false`. + :ivar voice_fallback_method: The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. + :ivar voice_fallback_url: The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. + :ivar voice_method: The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. + :ivar voice_url: The URL we call when the phone number assigned to this application receives a call. + :ivar public_application_connect_enabled: Whether to allow other Twilio accounts to dial this applicaton using Dial verb. Can be: `true` or `false`. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "api_version": payload.get("api_version"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "message_status_callback": payload.get("message_status_callback"), - "sid": payload.get("sid"), - "sms_fallback_method": payload.get("sms_fallback_method"), - "sms_fallback_url": payload.get("sms_fallback_url"), - "sms_method": payload.get("sms_method"), - "sms_status_callback": payload.get("sms_status_callback"), - "sms_url": payload.get("sms_url"), - "status_callback": payload.get("status_callback"), - "status_callback_method": payload.get("status_callback_method"), - "uri": payload.get("uri"), - "voice_caller_id_lookup": payload.get("voice_caller_id_lookup"), - "voice_fallback_method": payload.get("voice_fallback_method"), - "voice_fallback_url": payload.get("voice_fallback_url"), - "voice_method": payload.get("voice_method"), - "voice_url": payload.get("voice_url"), - "public_application_connect_enabled": payload.get( - "public_application_connect_enabled" - ), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.api_version: Optional[str] = payload.get("api_version") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.message_status_callback: Optional[str] = payload.get( + "message_status_callback" + ) + self.sid: Optional[str] = payload.get("sid") + self.sms_fallback_method: Optional[str] = payload.get("sms_fallback_method") + self.sms_fallback_url: Optional[str] = payload.get("sms_fallback_url") + self.sms_method: Optional[str] = payload.get("sms_method") + self.sms_status_callback: Optional[str] = payload.get("sms_status_callback") + self.sms_url: Optional[str] = payload.get("sms_url") + self.status_callback: Optional[str] = payload.get("status_callback") + self.status_callback_method: Optional[str] = payload.get( + "status_callback_method" + ) + self.uri: Optional[str] = payload.get("uri") + self.voice_caller_id_lookup: Optional[bool] = payload.get( + "voice_caller_id_lookup" + ) + self.voice_fallback_method: Optional[str] = payload.get("voice_fallback_method") + self.voice_fallback_url: Optional[str] = payload.get("voice_fallback_url") + self.voice_method: Optional[str] = payload.get("voice_method") + self.voice_url: Optional[str] = payload.get("voice_url") + self.public_application_connect_enabled: Optional[bool] = payload.get( + "public_application_connect_enabled" + ) self._solution = { "account_sid": account_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ApplicationContext] = None @@ -78,153 +114,6 @@ def _proxy(self) -> "ApplicationContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Application resource. - """ - return self._properties["account_sid"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to start a new TwiML session. - """ - return self._properties["api_version"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def message_status_callback(self) -> str: - """ - :returns: The URL we call using a POST method to send message status information to your application. - """ - return self._properties["message_status_callback"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the Application resource. - """ - return self._properties["sid"] - - @property - def sms_fallback_method(self) -> str: - """ - :returns: The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. - """ - return self._properties["sms_fallback_method"] - - @property - def sms_fallback_url(self) -> str: - """ - :returns: The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. - """ - return self._properties["sms_fallback_url"] - - @property - def sms_method(self) -> str: - """ - :returns: The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. - """ - return self._properties["sms_method"] - - @property - def sms_status_callback(self) -> str: - """ - :returns: The URL we call using a POST method to send status information to your application about SMS messages that refer to the application. - """ - return self._properties["sms_status_callback"] - - @property - def sms_url(self) -> str: - """ - :returns: The URL we call when the phone number receives an incoming SMS message. - """ - return self._properties["sms_url"] - - @property - def status_callback(self) -> str: - """ - :returns: The URL we call using the `status_callback_method` to send status information to your application. - """ - return self._properties["status_callback"] - - @property - def status_callback_method(self) -> str: - """ - :returns: The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. - """ - return self._properties["status_callback_method"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def voice_caller_id_lookup(self) -> bool: - """ - :returns: Whether we look up the caller's caller-ID name from the CNAM database (additional charges apply). Can be: `true` or `false`. - """ - return self._properties["voice_caller_id_lookup"] - - @property - def voice_fallback_method(self) -> str: - """ - :returns: The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. - """ - return self._properties["voice_fallback_method"] - - @property - def voice_fallback_url(self) -> str: - """ - :returns: The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. - """ - return self._properties["voice_fallback_url"] - - @property - def voice_method(self) -> str: - """ - :returns: The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. - """ - return self._properties["voice_method"] - - @property - def voice_url(self) -> str: - """ - :returns: The URL we call when the phone number assigned to this application receives a call. - """ - return self._properties["voice_url"] - - @property - def public_application_connect_enabled(self) -> bool: - """ - :returns: Whether to allow other Twilio accounts to dial this applicaton using Dial verb. Can be: `true` or `false`. - """ - return self._properties["public_application_connect_enabled"] - def delete(self) -> bool: """ Deletes the ApplicationInstance diff --git a/twilio/rest/api/v2010/account/authorized_connect_app.py b/twilio/rest/api/v2010/account/authorized_connect_app.py index d555b81cd..e4589aa91 100644 --- a/twilio/rest/api/v2010/account/authorized_connect_app.py +++ b/twilio/rest/api/v2010/account/authorized_connect_app.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,30 +28,56 @@ class Permission(object): GET_ALL = "get-all" POST_ALL = "post-all" + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AuthorizedConnectApp resource. + :ivar connect_app_company_name: The company name set for the Connect App. + :ivar connect_app_description: A detailed description of the Connect App. + :ivar connect_app_friendly_name: The name of the Connect App. + :ivar connect_app_homepage_url: The public URL for the Connect App. + :ivar connect_app_sid: The SID that we assigned to the Connect App. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar permissions: The set of permissions that you authorized for the Connect App. Can be: `get-all` or `post-all`. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + """ + def __init__( - self, version, payload, account_sid: str, connect_app_sid: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + connect_app_sid: Optional[str] = None, ): - """ - Initialize the AuthorizedConnectAppInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "connect_app_company_name": payload.get("connect_app_company_name"), - "connect_app_description": payload.get("connect_app_description"), - "connect_app_friendly_name": payload.get("connect_app_friendly_name"), - "connect_app_homepage_url": payload.get("connect_app_homepage_url"), - "connect_app_sid": payload.get("connect_app_sid"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "permissions": payload.get("permissions"), - "uri": payload.get("uri"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.connect_app_company_name: Optional[str] = payload.get( + "connect_app_company_name" + ) + self.connect_app_description: Optional[str] = payload.get( + "connect_app_description" + ) + self.connect_app_friendly_name: Optional[str] = payload.get( + "connect_app_friendly_name" + ) + self.connect_app_homepage_url: Optional[str] = payload.get( + "connect_app_homepage_url" + ) + self.connect_app_sid: Optional[str] = payload.get("connect_app_sid") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.permissions: Optional[ + List["AuthorizedConnectAppInstance.Permission"] + ] = payload.get("permissions") + self.uri: Optional[str] = payload.get("uri") self._solution = { "account_sid": account_sid, - "connect_app_sid": connect_app_sid or self._properties["connect_app_sid"], + "connect_app_sid": connect_app_sid or self.connect_app_sid, } self._context: Optional[AuthorizedConnectAppContext] = None @@ -71,76 +97,6 @@ def _proxy(self) -> "AuthorizedConnectAppContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AuthorizedConnectApp resource. - """ - return self._properties["account_sid"] - - @property - def connect_app_company_name(self) -> str: - """ - :returns: The company name set for the Connect App. - """ - return self._properties["connect_app_company_name"] - - @property - def connect_app_description(self) -> str: - """ - :returns: A detailed description of the Connect App. - """ - return self._properties["connect_app_description"] - - @property - def connect_app_friendly_name(self) -> str: - """ - :returns: The name of the Connect App. - """ - return self._properties["connect_app_friendly_name"] - - @property - def connect_app_homepage_url(self) -> str: - """ - :returns: The public URL for the Connect App. - """ - return self._properties["connect_app_homepage_url"] - - @property - def connect_app_sid(self) -> str: - """ - :returns: The SID that we assigned to the Connect App. - """ - return self._properties["connect_app_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def permissions(self) -> List["AuthorizedConnectAppInstance.Permission"]: - """ - :returns: The set of permissions that you authorized for the Connect App. Can be: `get-all` or `post-all`. - """ - return self._properties["permissions"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - def fetch(self) -> "AuthorizedConnectAppInstance": """ Fetch the AuthorizedConnectAppInstance diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/__init__.py b/twilio/rest/api/v2010/account/available_phone_number_country/__init__.py index 964f87911..c7f2a1f99 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/__init__.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/__init__.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -40,25 +40,35 @@ class AvailablePhoneNumberCountryInstance(InstanceResource): + + """ + :ivar country_code: The [ISO-3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code of the country. + :ivar country: The name of the country. + :ivar uri: The URI of the Country resource, relative to `https://api.twilio.com`. + :ivar beta: Whether all phone numbers available in the country are new to the Twilio platform. `true` if they are and `false` if all numbers are not in the Twilio Phone Number Beta program. + :ivar subresource_uris: A list of related AvailablePhoneNumber resources identified by their URIs relative to `https://api.twilio.com`. + """ + def __init__( - self, version, payload, account_sid: str, country_code: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + country_code: Optional[str] = None, ): - """ - Initialize the AvailablePhoneNumberCountryInstance - """ super().__init__(version) - self._properties = { - "country_code": payload.get("country_code"), - "country": payload.get("country"), - "uri": payload.get("uri"), - "beta": payload.get("beta"), - "subresource_uris": payload.get("subresource_uris"), - } + self.country_code: Optional[str] = payload.get("country_code") + self.country: Optional[str] = payload.get("country") + self.uri: Optional[str] = payload.get("uri") + self.beta: Optional[bool] = payload.get("beta") + self.subresource_uris: Optional[Dict[str, object]] = payload.get( + "subresource_uris" + ) self._solution = { "account_sid": account_sid, - "country_code": country_code or self._properties["country_code"], + "country_code": country_code or self.country_code, } self._context: Optional[AvailablePhoneNumberCountryContext] = None @@ -78,41 +88,6 @@ def _proxy(self) -> "AvailablePhoneNumberCountryContext": ) return self._context - @property - def country_code(self) -> str: - """ - :returns: The [ISO-3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code of the country. - """ - return self._properties["country_code"] - - @property - def country(self) -> str: - """ - :returns: The name of the country. - """ - return self._properties["country"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the Country resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def beta(self) -> bool: - """ - :returns: Whether all phone numbers available in the country are new to the Twilio platform. `true` if they are and `false` if all numbers are not in the Twilio Phone Number Beta program. - """ - return self._properties["beta"] - - @property - def subresource_uris(self) -> Dict[str, object]: - """ - :returns: A list of related AvailablePhoneNumber resources identified by their URIs relative to `https://api.twilio.com`. - """ - return self._properties["subresource_uris"] - def fetch(self) -> "AvailablePhoneNumberCountryInstance": """ Fetch the AvailablePhoneNumberCountryInstance diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/local.py b/twilio/rest/api/v2010/account/available_phone_number_country/local.py index 059438d0d..6c779292f 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/local.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/local.py @@ -13,7 +13,7 @@ """ -from typing import List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -23,124 +23,51 @@ class LocalInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, country_code: str): - """ - Initialize the LocalInstance - """ + + """ + :ivar friendly_name: A formatted version of the phone number. + :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + :ivar lata: The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. + :ivar locality: The locality or city of this phone number's location. + :ivar rate_center: The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. + :ivar latitude: The latitude of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar longitude: The longitude of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar region: The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar postal_code: The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar iso_country: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. + :ivar address_requirements: The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. + :ivar beta: Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. + :ivar capabilities: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + country_code: str, + ): super().__init__(version) - self._properties = { - "friendly_name": payload.get("friendly_name"), - "phone_number": payload.get("phone_number"), - "lata": payload.get("lata"), - "locality": payload.get("locality"), - "rate_center": payload.get("rate_center"), - "latitude": deserialize.decimal(payload.get("latitude")), - "longitude": deserialize.decimal(payload.get("longitude")), - "region": payload.get("region"), - "postal_code": payload.get("postal_code"), - "iso_country": payload.get("iso_country"), - "address_requirements": payload.get("address_requirements"), - "beta": payload.get("beta"), - "capabilities": payload.get("capabilities"), - } + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.phone_number: Optional[str] = payload.get("phone_number") + self.lata: Optional[str] = payload.get("lata") + self.locality: Optional[str] = payload.get("locality") + self.rate_center: Optional[str] = payload.get("rate_center") + self.latitude: Optional[float] = deserialize.decimal(payload.get("latitude")) + self.longitude: Optional[float] = deserialize.decimal(payload.get("longitude")) + self.region: Optional[str] = payload.get("region") + self.postal_code: Optional[str] = payload.get("postal_code") + self.iso_country: Optional[str] = payload.get("iso_country") + self.address_requirements: Optional[str] = payload.get("address_requirements") + self.beta: Optional[bool] = payload.get("beta") + self.capabilities: Optional[str] = payload.get("capabilities") self._solution = { "account_sid": account_sid, "country_code": country_code, } - @property - def friendly_name(self) -> str: - """ - :returns: A formatted version of the phone number. - """ - return self._properties["friendly_name"] - - @property - def phone_number(self) -> str: - """ - :returns: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. - """ - return self._properties["phone_number"] - - @property - def lata(self) -> str: - """ - :returns: The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. - """ - return self._properties["lata"] - - @property - def locality(self) -> str: - """ - :returns: The locality or city of this phone number's location. - """ - return self._properties["locality"] - - @property - def rate_center(self) -> str: - """ - :returns: The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. - """ - return self._properties["rate_center"] - - @property - def latitude(self) -> float: - """ - :returns: The latitude of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["latitude"] - - @property - def longitude(self) -> float: - """ - :returns: The longitude of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["longitude"] - - @property - def region(self) -> str: - """ - :returns: The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["region"] - - @property - def postal_code(self) -> str: - """ - :returns: The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["postal_code"] - - @property - def iso_country(self) -> str: - """ - :returns: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. - """ - return self._properties["iso_country"] - - @property - def address_requirements(self) -> str: - """ - :returns: The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. - """ - return self._properties["address_requirements"] - - @property - def beta(self) -> bool: - """ - :returns: Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. - """ - return self._properties["beta"] - - @property - def capabilities(self) -> str: - """ - :returns: - """ - return self._properties["capabilities"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/machine_to_machine.py b/twilio/rest/api/v2010/account/available_phone_number_country/machine_to_machine.py index 2866b2699..763fea83c 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/machine_to_machine.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/machine_to_machine.py @@ -13,7 +13,7 @@ """ -from typing import List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -23,124 +23,51 @@ class MachineToMachineInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, country_code: str): - """ - Initialize the MachineToMachineInstance - """ + + """ + :ivar friendly_name: A formatted version of the phone number. + :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + :ivar lata: The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. + :ivar locality: The locality or city of this phone number's location. + :ivar rate_center: The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. + :ivar latitude: The latitude of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar longitude: The longitude of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar region: The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar postal_code: The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar iso_country: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. + :ivar address_requirements: The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. + :ivar beta: Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. + :ivar capabilities: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + country_code: str, + ): super().__init__(version) - self._properties = { - "friendly_name": payload.get("friendly_name"), - "phone_number": payload.get("phone_number"), - "lata": payload.get("lata"), - "locality": payload.get("locality"), - "rate_center": payload.get("rate_center"), - "latitude": deserialize.decimal(payload.get("latitude")), - "longitude": deserialize.decimal(payload.get("longitude")), - "region": payload.get("region"), - "postal_code": payload.get("postal_code"), - "iso_country": payload.get("iso_country"), - "address_requirements": payload.get("address_requirements"), - "beta": payload.get("beta"), - "capabilities": payload.get("capabilities"), - } + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.phone_number: Optional[str] = payload.get("phone_number") + self.lata: Optional[str] = payload.get("lata") + self.locality: Optional[str] = payload.get("locality") + self.rate_center: Optional[str] = payload.get("rate_center") + self.latitude: Optional[float] = deserialize.decimal(payload.get("latitude")) + self.longitude: Optional[float] = deserialize.decimal(payload.get("longitude")) + self.region: Optional[str] = payload.get("region") + self.postal_code: Optional[str] = payload.get("postal_code") + self.iso_country: Optional[str] = payload.get("iso_country") + self.address_requirements: Optional[str] = payload.get("address_requirements") + self.beta: Optional[bool] = payload.get("beta") + self.capabilities: Optional[str] = payload.get("capabilities") self._solution = { "account_sid": account_sid, "country_code": country_code, } - @property - def friendly_name(self) -> str: - """ - :returns: A formatted version of the phone number. - """ - return self._properties["friendly_name"] - - @property - def phone_number(self) -> str: - """ - :returns: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. - """ - return self._properties["phone_number"] - - @property - def lata(self) -> str: - """ - :returns: The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. - """ - return self._properties["lata"] - - @property - def locality(self) -> str: - """ - :returns: The locality or city of this phone number's location. - """ - return self._properties["locality"] - - @property - def rate_center(self) -> str: - """ - :returns: The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. - """ - return self._properties["rate_center"] - - @property - def latitude(self) -> float: - """ - :returns: The latitude of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["latitude"] - - @property - def longitude(self) -> float: - """ - :returns: The longitude of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["longitude"] - - @property - def region(self) -> str: - """ - :returns: The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["region"] - - @property - def postal_code(self) -> str: - """ - :returns: The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["postal_code"] - - @property - def iso_country(self) -> str: - """ - :returns: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. - """ - return self._properties["iso_country"] - - @property - def address_requirements(self) -> str: - """ - :returns: The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. - """ - return self._properties["address_requirements"] - - @property - def beta(self) -> bool: - """ - :returns: Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. - """ - return self._properties["beta"] - - @property - def capabilities(self) -> str: - """ - :returns: - """ - return self._properties["capabilities"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/mobile.py b/twilio/rest/api/v2010/account/available_phone_number_country/mobile.py index c85f269cf..7966dbd85 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/mobile.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/mobile.py @@ -13,7 +13,7 @@ """ -from typing import List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -23,124 +23,51 @@ class MobileInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, country_code: str): - """ - Initialize the MobileInstance - """ + + """ + :ivar friendly_name: A formatted version of the phone number. + :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + :ivar lata: The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. + :ivar locality: The locality or city of this phone number's location. + :ivar rate_center: The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. + :ivar latitude: The latitude of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar longitude: The longitude of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar region: The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar postal_code: The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar iso_country: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. + :ivar address_requirements: The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. + :ivar beta: Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. + :ivar capabilities: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + country_code: str, + ): super().__init__(version) - self._properties = { - "friendly_name": payload.get("friendly_name"), - "phone_number": payload.get("phone_number"), - "lata": payload.get("lata"), - "locality": payload.get("locality"), - "rate_center": payload.get("rate_center"), - "latitude": deserialize.decimal(payload.get("latitude")), - "longitude": deserialize.decimal(payload.get("longitude")), - "region": payload.get("region"), - "postal_code": payload.get("postal_code"), - "iso_country": payload.get("iso_country"), - "address_requirements": payload.get("address_requirements"), - "beta": payload.get("beta"), - "capabilities": payload.get("capabilities"), - } + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.phone_number: Optional[str] = payload.get("phone_number") + self.lata: Optional[str] = payload.get("lata") + self.locality: Optional[str] = payload.get("locality") + self.rate_center: Optional[str] = payload.get("rate_center") + self.latitude: Optional[float] = deserialize.decimal(payload.get("latitude")) + self.longitude: Optional[float] = deserialize.decimal(payload.get("longitude")) + self.region: Optional[str] = payload.get("region") + self.postal_code: Optional[str] = payload.get("postal_code") + self.iso_country: Optional[str] = payload.get("iso_country") + self.address_requirements: Optional[str] = payload.get("address_requirements") + self.beta: Optional[bool] = payload.get("beta") + self.capabilities: Optional[str] = payload.get("capabilities") self._solution = { "account_sid": account_sid, "country_code": country_code, } - @property - def friendly_name(self) -> str: - """ - :returns: A formatted version of the phone number. - """ - return self._properties["friendly_name"] - - @property - def phone_number(self) -> str: - """ - :returns: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. - """ - return self._properties["phone_number"] - - @property - def lata(self) -> str: - """ - :returns: The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. - """ - return self._properties["lata"] - - @property - def locality(self) -> str: - """ - :returns: The locality or city of this phone number's location. - """ - return self._properties["locality"] - - @property - def rate_center(self) -> str: - """ - :returns: The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. - """ - return self._properties["rate_center"] - - @property - def latitude(self) -> float: - """ - :returns: The latitude of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["latitude"] - - @property - def longitude(self) -> float: - """ - :returns: The longitude of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["longitude"] - - @property - def region(self) -> str: - """ - :returns: The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["region"] - - @property - def postal_code(self) -> str: - """ - :returns: The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["postal_code"] - - @property - def iso_country(self) -> str: - """ - :returns: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. - """ - return self._properties["iso_country"] - - @property - def address_requirements(self) -> str: - """ - :returns: The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. - """ - return self._properties["address_requirements"] - - @property - def beta(self) -> bool: - """ - :returns: Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. - """ - return self._properties["beta"] - - @property - def capabilities(self) -> str: - """ - :returns: - """ - return self._properties["capabilities"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/national.py b/twilio/rest/api/v2010/account/available_phone_number_country/national.py index 4632f3448..2fc08a946 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/national.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/national.py @@ -13,7 +13,7 @@ """ -from typing import List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -23,124 +23,51 @@ class NationalInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, country_code: str): - """ - Initialize the NationalInstance - """ + + """ + :ivar friendly_name: A formatted version of the phone number. + :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + :ivar lata: The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. + :ivar locality: The locality or city of this phone number's location. + :ivar rate_center: The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. + :ivar latitude: The latitude of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar longitude: The longitude of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar region: The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar postal_code: The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar iso_country: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. + :ivar address_requirements: The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. + :ivar beta: Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. + :ivar capabilities: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + country_code: str, + ): super().__init__(version) - self._properties = { - "friendly_name": payload.get("friendly_name"), - "phone_number": payload.get("phone_number"), - "lata": payload.get("lata"), - "locality": payload.get("locality"), - "rate_center": payload.get("rate_center"), - "latitude": deserialize.decimal(payload.get("latitude")), - "longitude": deserialize.decimal(payload.get("longitude")), - "region": payload.get("region"), - "postal_code": payload.get("postal_code"), - "iso_country": payload.get("iso_country"), - "address_requirements": payload.get("address_requirements"), - "beta": payload.get("beta"), - "capabilities": payload.get("capabilities"), - } + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.phone_number: Optional[str] = payload.get("phone_number") + self.lata: Optional[str] = payload.get("lata") + self.locality: Optional[str] = payload.get("locality") + self.rate_center: Optional[str] = payload.get("rate_center") + self.latitude: Optional[float] = deserialize.decimal(payload.get("latitude")) + self.longitude: Optional[float] = deserialize.decimal(payload.get("longitude")) + self.region: Optional[str] = payload.get("region") + self.postal_code: Optional[str] = payload.get("postal_code") + self.iso_country: Optional[str] = payload.get("iso_country") + self.address_requirements: Optional[str] = payload.get("address_requirements") + self.beta: Optional[bool] = payload.get("beta") + self.capabilities: Optional[str] = payload.get("capabilities") self._solution = { "account_sid": account_sid, "country_code": country_code, } - @property - def friendly_name(self) -> str: - """ - :returns: A formatted version of the phone number. - """ - return self._properties["friendly_name"] - - @property - def phone_number(self) -> str: - """ - :returns: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. - """ - return self._properties["phone_number"] - - @property - def lata(self) -> str: - """ - :returns: The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. - """ - return self._properties["lata"] - - @property - def locality(self) -> str: - """ - :returns: The locality or city of this phone number's location. - """ - return self._properties["locality"] - - @property - def rate_center(self) -> str: - """ - :returns: The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. - """ - return self._properties["rate_center"] - - @property - def latitude(self) -> float: - """ - :returns: The latitude of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["latitude"] - - @property - def longitude(self) -> float: - """ - :returns: The longitude of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["longitude"] - - @property - def region(self) -> str: - """ - :returns: The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["region"] - - @property - def postal_code(self) -> str: - """ - :returns: The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["postal_code"] - - @property - def iso_country(self) -> str: - """ - :returns: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. - """ - return self._properties["iso_country"] - - @property - def address_requirements(self) -> str: - """ - :returns: The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. - """ - return self._properties["address_requirements"] - - @property - def beta(self) -> bool: - """ - :returns: Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. - """ - return self._properties["beta"] - - @property - def capabilities(self) -> str: - """ - :returns: - """ - return self._properties["capabilities"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/shared_cost.py b/twilio/rest/api/v2010/account/available_phone_number_country/shared_cost.py index 07b9925e7..61483efca 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/shared_cost.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/shared_cost.py @@ -13,7 +13,7 @@ """ -from typing import List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -23,124 +23,51 @@ class SharedCostInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, country_code: str): - """ - Initialize the SharedCostInstance - """ + + """ + :ivar friendly_name: A formatted version of the phone number. + :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + :ivar lata: The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. + :ivar locality: The locality or city of this phone number's location. + :ivar rate_center: The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. + :ivar latitude: The latitude of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar longitude: The longitude of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar region: The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar postal_code: The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar iso_country: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. + :ivar address_requirements: The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. + :ivar beta: Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. + :ivar capabilities: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + country_code: str, + ): super().__init__(version) - self._properties = { - "friendly_name": payload.get("friendly_name"), - "phone_number": payload.get("phone_number"), - "lata": payload.get("lata"), - "locality": payload.get("locality"), - "rate_center": payload.get("rate_center"), - "latitude": deserialize.decimal(payload.get("latitude")), - "longitude": deserialize.decimal(payload.get("longitude")), - "region": payload.get("region"), - "postal_code": payload.get("postal_code"), - "iso_country": payload.get("iso_country"), - "address_requirements": payload.get("address_requirements"), - "beta": payload.get("beta"), - "capabilities": payload.get("capabilities"), - } + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.phone_number: Optional[str] = payload.get("phone_number") + self.lata: Optional[str] = payload.get("lata") + self.locality: Optional[str] = payload.get("locality") + self.rate_center: Optional[str] = payload.get("rate_center") + self.latitude: Optional[float] = deserialize.decimal(payload.get("latitude")) + self.longitude: Optional[float] = deserialize.decimal(payload.get("longitude")) + self.region: Optional[str] = payload.get("region") + self.postal_code: Optional[str] = payload.get("postal_code") + self.iso_country: Optional[str] = payload.get("iso_country") + self.address_requirements: Optional[str] = payload.get("address_requirements") + self.beta: Optional[bool] = payload.get("beta") + self.capabilities: Optional[str] = payload.get("capabilities") self._solution = { "account_sid": account_sid, "country_code": country_code, } - @property - def friendly_name(self) -> str: - """ - :returns: A formatted version of the phone number. - """ - return self._properties["friendly_name"] - - @property - def phone_number(self) -> str: - """ - :returns: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. - """ - return self._properties["phone_number"] - - @property - def lata(self) -> str: - """ - :returns: The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. - """ - return self._properties["lata"] - - @property - def locality(self) -> str: - """ - :returns: The locality or city of this phone number's location. - """ - return self._properties["locality"] - - @property - def rate_center(self) -> str: - """ - :returns: The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. - """ - return self._properties["rate_center"] - - @property - def latitude(self) -> float: - """ - :returns: The latitude of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["latitude"] - - @property - def longitude(self) -> float: - """ - :returns: The longitude of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["longitude"] - - @property - def region(self) -> str: - """ - :returns: The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["region"] - - @property - def postal_code(self) -> str: - """ - :returns: The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["postal_code"] - - @property - def iso_country(self) -> str: - """ - :returns: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. - """ - return self._properties["iso_country"] - - @property - def address_requirements(self) -> str: - """ - :returns: The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. - """ - return self._properties["address_requirements"] - - @property - def beta(self) -> bool: - """ - :returns: Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. - """ - return self._properties["beta"] - - @property - def capabilities(self) -> str: - """ - :returns: - """ - return self._properties["capabilities"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/toll_free.py b/twilio/rest/api/v2010/account/available_phone_number_country/toll_free.py index da1106fe4..3a49d0744 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/toll_free.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/toll_free.py @@ -13,7 +13,7 @@ """ -from typing import List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -23,124 +23,51 @@ class TollFreeInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, country_code: str): - """ - Initialize the TollFreeInstance - """ + + """ + :ivar friendly_name: A formatted version of the phone number. + :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + :ivar lata: The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. + :ivar locality: The locality or city of this phone number's location. + :ivar rate_center: The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. + :ivar latitude: The latitude of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar longitude: The longitude of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar region: The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar postal_code: The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar iso_country: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. + :ivar address_requirements: The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. + :ivar beta: Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. + :ivar capabilities: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + country_code: str, + ): super().__init__(version) - self._properties = { - "friendly_name": payload.get("friendly_name"), - "phone_number": payload.get("phone_number"), - "lata": payload.get("lata"), - "locality": payload.get("locality"), - "rate_center": payload.get("rate_center"), - "latitude": deserialize.decimal(payload.get("latitude")), - "longitude": deserialize.decimal(payload.get("longitude")), - "region": payload.get("region"), - "postal_code": payload.get("postal_code"), - "iso_country": payload.get("iso_country"), - "address_requirements": payload.get("address_requirements"), - "beta": payload.get("beta"), - "capabilities": payload.get("capabilities"), - } + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.phone_number: Optional[str] = payload.get("phone_number") + self.lata: Optional[str] = payload.get("lata") + self.locality: Optional[str] = payload.get("locality") + self.rate_center: Optional[str] = payload.get("rate_center") + self.latitude: Optional[float] = deserialize.decimal(payload.get("latitude")) + self.longitude: Optional[float] = deserialize.decimal(payload.get("longitude")) + self.region: Optional[str] = payload.get("region") + self.postal_code: Optional[str] = payload.get("postal_code") + self.iso_country: Optional[str] = payload.get("iso_country") + self.address_requirements: Optional[str] = payload.get("address_requirements") + self.beta: Optional[bool] = payload.get("beta") + self.capabilities: Optional[str] = payload.get("capabilities") self._solution = { "account_sid": account_sid, "country_code": country_code, } - @property - def friendly_name(self) -> str: - """ - :returns: A formatted version of the phone number. - """ - return self._properties["friendly_name"] - - @property - def phone_number(self) -> str: - """ - :returns: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. - """ - return self._properties["phone_number"] - - @property - def lata(self) -> str: - """ - :returns: The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. - """ - return self._properties["lata"] - - @property - def locality(self) -> str: - """ - :returns: The locality or city of this phone number's location. - """ - return self._properties["locality"] - - @property - def rate_center(self) -> str: - """ - :returns: The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. - """ - return self._properties["rate_center"] - - @property - def latitude(self) -> float: - """ - :returns: The latitude of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["latitude"] - - @property - def longitude(self) -> float: - """ - :returns: The longitude of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["longitude"] - - @property - def region(self) -> str: - """ - :returns: The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["region"] - - @property - def postal_code(self) -> str: - """ - :returns: The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["postal_code"] - - @property - def iso_country(self) -> str: - """ - :returns: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. - """ - return self._properties["iso_country"] - - @property - def address_requirements(self) -> str: - """ - :returns: The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. - """ - return self._properties["address_requirements"] - - @property - def beta(self) -> bool: - """ - :returns: Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. - """ - return self._properties["beta"] - - @property - def capabilities(self) -> str: - """ - :returns: - """ - return self._properties["capabilities"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/available_phone_number_country/voip.py b/twilio/rest/api/v2010/account/available_phone_number_country/voip.py index 611b9d82a..ffbf0ee82 100644 --- a/twilio/rest/api/v2010/account/available_phone_number_country/voip.py +++ b/twilio/rest/api/v2010/account/available_phone_number_country/voip.py @@ -13,7 +13,7 @@ """ -from typing import List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -23,124 +23,51 @@ class VoipInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, country_code: str): - """ - Initialize the VoipInstance - """ + + """ + :ivar friendly_name: A formatted version of the phone number. + :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + :ivar lata: The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. + :ivar locality: The locality or city of this phone number's location. + :ivar rate_center: The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. + :ivar latitude: The latitude of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar longitude: The longitude of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar region: The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar postal_code: The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. + :ivar iso_country: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. + :ivar address_requirements: The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. + :ivar beta: Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. + :ivar capabilities: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + country_code: str, + ): super().__init__(version) - self._properties = { - "friendly_name": payload.get("friendly_name"), - "phone_number": payload.get("phone_number"), - "lata": payload.get("lata"), - "locality": payload.get("locality"), - "rate_center": payload.get("rate_center"), - "latitude": deserialize.decimal(payload.get("latitude")), - "longitude": deserialize.decimal(payload.get("longitude")), - "region": payload.get("region"), - "postal_code": payload.get("postal_code"), - "iso_country": payload.get("iso_country"), - "address_requirements": payload.get("address_requirements"), - "beta": payload.get("beta"), - "capabilities": payload.get("capabilities"), - } + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.phone_number: Optional[str] = payload.get("phone_number") + self.lata: Optional[str] = payload.get("lata") + self.locality: Optional[str] = payload.get("locality") + self.rate_center: Optional[str] = payload.get("rate_center") + self.latitude: Optional[float] = deserialize.decimal(payload.get("latitude")) + self.longitude: Optional[float] = deserialize.decimal(payload.get("longitude")) + self.region: Optional[str] = payload.get("region") + self.postal_code: Optional[str] = payload.get("postal_code") + self.iso_country: Optional[str] = payload.get("iso_country") + self.address_requirements: Optional[str] = payload.get("address_requirements") + self.beta: Optional[bool] = payload.get("beta") + self.capabilities: Optional[str] = payload.get("capabilities") self._solution = { "account_sid": account_sid, "country_code": country_code, } - @property - def friendly_name(self) -> str: - """ - :returns: A formatted version of the phone number. - """ - return self._properties["friendly_name"] - - @property - def phone_number(self) -> str: - """ - :returns: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. - """ - return self._properties["phone_number"] - - @property - def lata(self) -> str: - """ - :returns: The [LATA](https://en.wikipedia.org/wiki/Local_access_and_transport_area) of this phone number. Available for only phone numbers from the US and Canada. - """ - return self._properties["lata"] - - @property - def locality(self) -> str: - """ - :returns: The locality or city of this phone number's location. - """ - return self._properties["locality"] - - @property - def rate_center(self) -> str: - """ - :returns: The [rate center](https://en.wikipedia.org/wiki/Telephone_exchange) of this phone number. Available for only phone numbers from the US and Canada. - """ - return self._properties["rate_center"] - - @property - def latitude(self) -> float: - """ - :returns: The latitude of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["latitude"] - - @property - def longitude(self) -> float: - """ - :returns: The longitude of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["longitude"] - - @property - def region(self) -> str: - """ - :returns: The two-letter state or province abbreviation of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["region"] - - @property - def postal_code(self) -> str: - """ - :returns: The postal or ZIP code of this phone number's location. Available for only phone numbers from the US and Canada. - """ - return self._properties["postal_code"] - - @property - def iso_country(self) -> str: - """ - :returns: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of this phone number. - """ - return self._properties["iso_country"] - - @property - def address_requirements(self) -> str: - """ - :returns: The type of [Address](https://www.twilio.com/docs/usage/api/address) resource the phone number requires. Can be: `none`, `any`, `local`, or `foreign`. `none` means no address is required. `any` means an address is required, but it can be anywhere in the world. `local` means an address in the phone number's country is required. `foreign` means an address outside of the phone number's country is required. - """ - return self._properties["address_requirements"] - - @property - def beta(self) -> bool: - """ - :returns: Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. - """ - return self._properties["beta"] - - @property - def capabilities(self) -> str: - """ - :returns: - """ - return self._properties["capabilities"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/balance.py b/twilio/rest/api/v2010/account/balance.py index da717de58..e3c2d5e7e 100644 --- a/twilio/rest/api/v2010/account/balance.py +++ b/twilio/rest/api/v2010/account/balance.py @@ -13,49 +13,32 @@ """ +from typing import Any, Dict, Optional + from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.version import Version class BalanceInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str): - """ - Initialize the BalanceInstance - """ + + """ + :ivar account_sid: The unique SID identifier of the Account. + :ivar balance: The balance of the Account, in units specified by the unit parameter. Balance changes may not be reflected immediately. Child accounts do not contain balance information + :ivar currency: The units of currency for the account balance + """ + + def __init__(self, version: Version, payload: Dict[str, Any], account_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "balance": payload.get("balance"), - "currency": payload.get("currency"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.balance: Optional[str] = payload.get("balance") + self.currency: Optional[str] = payload.get("currency") self._solution = { "account_sid": account_sid, } - @property - def account_sid(self) -> str: - """ - :returns: The unique SID identifier of the Account. - """ - return self._properties["account_sid"] - - @property - def balance(self) -> str: - """ - :returns: The balance of the Account, in units specified by the unit parameter. Balance changes may not be reflected immediately. Child accounts do not contain balance information - """ - return self._properties["balance"] - - @property - def currency(self) -> str: - """ - :returns: The units of currency for the account balance - """ - return self._properties["currency"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/call/__init__.py b/twilio/rest/api/v2010/account/call/__init__.py index d2496fbcd..811e0a2ad 100644 --- a/twilio/rest/api/v2010/account/call/__init__.py +++ b/twilio/rest/api/v2010/account/call/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -48,44 +48,84 @@ class Status(object): NO_ANSWER = "no-answer" CANCELED = "canceled" - def __init__(self, version, payload, account_sid: str, sid: Optional[str] = None): - """ - Initialize the CallInstance - """ + """ + :ivar sid: The unique string that we created to identify this Call resource. + :ivar date_created: The date and time in GMT that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar parent_call_sid: The SID that identifies the call that created this leg. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Call resource. + :ivar to: The phone number, SIP address, Client identifier or SIM SID that received this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. SIM SIDs are formatted as `sim:sid`. + :ivar to_formatted: The phone number, SIP address or Client identifier that received this call. Formatted for display. Non-North American phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +442071838750). + :ivar _from: The phone number, SIP address, Client identifier or SIM SID that made this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. SIM SIDs are formatted as `sim:sid`. + :ivar from_formatted: The calling phone number, SIP address, or Client identifier formatted for display. Non-North American phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +442071838750). + :ivar phone_number_sid: If the call was inbound, this is the SID of the IncomingPhoneNumber resource that received the call. If the call was outbound, it is the SID of the OutgoingCallerId resource from which the call was placed. + :ivar status: + :ivar start_time: The start time of the call, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. Empty if the call has not yet been dialed. + :ivar end_time: The time the call ended, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. Empty if the call did not complete successfully. + :ivar duration: The length of the call in seconds. This value is empty for busy, failed, unanswered, or ongoing calls. + :ivar price: The charge for this call, in the currency associated with the account. Populated after the call is completed. May not be immediately available. + :ivar price_unit: The currency in which `Price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g., `USD`, `EUR`, `JPY`). Always capitalized for calls. + :ivar direction: A string describing the direction of the call. Can be: `inbound` for inbound calls, `outbound-api` for calls initiated via the REST API or `outbound-dial` for calls initiated by a `` verb. Using [Elastic SIP Trunking](https://www.twilio.com/docs/sip-trunking), the values can be [`trunking-terminating`](https://www.twilio.com/docs/sip-trunking#termination) for outgoing calls from your communications infrastructure to the PSTN or [`trunking-originating`](https://www.twilio.com/docs/sip-trunking#origination) for incoming calls to your communications infrastructure from the PSTN. + :ivar answered_by: Either `human` or `machine` if this call was initiated with answering machine detection. Empty otherwise. + :ivar api_version: The API version used to create the call. + :ivar forwarded_from: The forwarding phone number if this call was an incoming call forwarded from another number (depends on carrier supporting forwarding). Otherwise, empty. + :ivar group_sid: The Group SID associated with this call. If no Group is associated with the call, the field is empty. + :ivar caller_name: The caller's name if this call was an incoming call to a phone number with caller ID Lookup enabled. Otherwise, empty. + :ivar queue_time: The wait time in milliseconds before the call is placed. + :ivar trunk_sid: The unique identifier of the trunk resource that was used for this call. The field is empty if the call was not made using a SIP trunk or if the call is not terminated. + :ivar uri: The URI of this resource, relative to `https://api.twilio.com`. + :ivar subresource_uris: A list of subresources available to this call, identified by their URIs relative to `https://api.twilio.com`. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "parent_call_sid": payload.get("parent_call_sid"), - "account_sid": payload.get("account_sid"), - "to": payload.get("to"), - "to_formatted": payload.get("to_formatted"), - "_from": payload.get("from"), - "from_formatted": payload.get("from_formatted"), - "phone_number_sid": payload.get("phone_number_sid"), - "status": payload.get("status"), - "start_time": deserialize.rfc2822_datetime(payload.get("start_time")), - "end_time": deserialize.rfc2822_datetime(payload.get("end_time")), - "duration": payload.get("duration"), - "price": payload.get("price"), - "price_unit": payload.get("price_unit"), - "direction": payload.get("direction"), - "answered_by": payload.get("answered_by"), - "api_version": payload.get("api_version"), - "forwarded_from": payload.get("forwarded_from"), - "group_sid": payload.get("group_sid"), - "caller_name": payload.get("caller_name"), - "queue_time": payload.get("queue_time"), - "trunk_sid": payload.get("trunk_sid"), - "uri": payload.get("uri"), - "subresource_uris": payload.get("subresource_uris"), - } + self.sid: Optional[str] = payload.get("sid") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.parent_call_sid: Optional[str] = payload.get("parent_call_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.to: Optional[str] = payload.get("to") + self.to_formatted: Optional[str] = payload.get("to_formatted") + self._from: Optional[str] = payload.get("from") + self.from_formatted: Optional[str] = payload.get("from_formatted") + self.phone_number_sid: Optional[str] = payload.get("phone_number_sid") + self.status: Optional["CallInstance.Status"] = payload.get("status") + self.start_time: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("start_time") + ) + self.end_time: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("end_time") + ) + self.duration: Optional[str] = payload.get("duration") + self.price: Optional[str] = payload.get("price") + self.price_unit: Optional[str] = payload.get("price_unit") + self.direction: Optional[str] = payload.get("direction") + self.answered_by: Optional[str] = payload.get("answered_by") + self.api_version: Optional[str] = payload.get("api_version") + self.forwarded_from: Optional[str] = payload.get("forwarded_from") + self.group_sid: Optional[str] = payload.get("group_sid") + self.caller_name: Optional[str] = payload.get("caller_name") + self.queue_time: Optional[str] = payload.get("queue_time") + self.trunk_sid: Optional[str] = payload.get("trunk_sid") + self.uri: Optional[str] = payload.get("uri") + self.subresource_uris: Optional[Dict[str, object]] = payload.get( + "subresource_uris" + ) self._solution = { "account_sid": account_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[CallContext] = None @@ -105,188 +145,6 @@ def _proxy(self) -> "CallContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify this Call resource. - """ - return self._properties["sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def parent_call_sid(self) -> str: - """ - :returns: The SID that identifies the call that created this leg. - """ - return self._properties["parent_call_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Call resource. - """ - return self._properties["account_sid"] - - @property - def to(self) -> str: - """ - :returns: The phone number, SIP address, Client identifier or SIM SID that received this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. SIM SIDs are formatted as `sim:sid`. - """ - return self._properties["to"] - - @property - def to_formatted(self) -> str: - """ - :returns: The phone number, SIP address or Client identifier that received this call. Formatted for display. Non-North American phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +442071838750). - """ - return self._properties["to_formatted"] - - @property - def _from(self) -> str: - """ - :returns: The phone number, SIP address, Client identifier or SIM SID that made this call. Phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. SIM SIDs are formatted as `sim:sid`. - """ - return self._properties["_from"] - - @property - def from_formatted(self) -> str: - """ - :returns: The calling phone number, SIP address, or Client identifier formatted for display. Non-North American phone numbers are in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (e.g., +442071838750). - """ - return self._properties["from_formatted"] - - @property - def phone_number_sid(self) -> str: - """ - :returns: If the call was inbound, this is the SID of the IncomingPhoneNumber resource that received the call. If the call was outbound, it is the SID of the OutgoingCallerId resource from which the call was placed. - """ - return self._properties["phone_number_sid"] - - @property - def status(self) -> "CallInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def start_time(self) -> datetime: - """ - :returns: The start time of the call, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. Empty if the call has not yet been dialed. - """ - return self._properties["start_time"] - - @property - def end_time(self) -> datetime: - """ - :returns: The time the call ended, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. Empty if the call did not complete successfully. - """ - return self._properties["end_time"] - - @property - def duration(self) -> str: - """ - :returns: The length of the call in seconds. This value is empty for busy, failed, unanswered, or ongoing calls. - """ - return self._properties["duration"] - - @property - def price(self) -> str: - """ - :returns: The charge for this call, in the currency associated with the account. Populated after the call is completed. May not be immediately available. - """ - return self._properties["price"] - - @property - def price_unit(self) -> str: - """ - :returns: The currency in which `Price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g., `USD`, `EUR`, `JPY`). Always capitalized for calls. - """ - return self._properties["price_unit"] - - @property - def direction(self) -> str: - """ - :returns: A string describing the direction of the call. Can be: `inbound` for inbound calls, `outbound-api` for calls initiated via the REST API or `outbound-dial` for calls initiated by a `` verb. Using [Elastic SIP Trunking](https://www.twilio.com/docs/sip-trunking), the values can be [`trunking-terminating`](https://www.twilio.com/docs/sip-trunking#termination) for outgoing calls from your communications infrastructure to the PSTN or [`trunking-originating`](https://www.twilio.com/docs/sip-trunking#origination) for incoming calls to your communications infrastructure from the PSTN. - """ - return self._properties["direction"] - - @property - def answered_by(self) -> str: - """ - :returns: Either `human` or `machine` if this call was initiated with answering machine detection. Empty otherwise. - """ - return self._properties["answered_by"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to create the call. - """ - return self._properties["api_version"] - - @property - def forwarded_from(self) -> str: - """ - :returns: The forwarding phone number if this call was an incoming call forwarded from another number (depends on carrier supporting forwarding). Otherwise, empty. - """ - return self._properties["forwarded_from"] - - @property - def group_sid(self) -> str: - """ - :returns: The Group SID associated with this call. If no Group is associated with the call, the field is empty. - """ - return self._properties["group_sid"] - - @property - def caller_name(self) -> str: - """ - :returns: The caller's name if this call was an incoming call to a phone number with caller ID Lookup enabled. Otherwise, empty. - """ - return self._properties["caller_name"] - - @property - def queue_time(self) -> str: - """ - :returns: The wait time in milliseconds before the call is placed. - """ - return self._properties["queue_time"] - - @property - def trunk_sid(self) -> str: - """ - :returns: The unique identifier of the trunk resource that was used for this call. The field is empty if the call was not made using a SIP trunk or if the call is not terminated. - """ - return self._properties["trunk_sid"] - - @property - def uri(self) -> str: - """ - :returns: The URI of this resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def subresource_uris(self) -> Dict[str, object]: - """ - :returns: A list of subresources available to this call, identified by their URIs relative to `https://api.twilio.com`. - """ - return self._properties["subresource_uris"] - def delete(self) -> bool: """ Deletes the CallInstance diff --git a/twilio/rest/api/v2010/account/call/event.py b/twilio/rest/api/v2010/account/call/event.py index 3eb68ce26..e99458558 100644 --- a/twilio/rest/api/v2010/account/call/event.py +++ b/twilio/rest/api/v2010/account/call/event.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_resource import InstanceResource @@ -23,36 +23,25 @@ class EventInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, call_sid: str): - """ - Initialize the EventInstance - """ + + """ + :ivar request: Contains a dictionary representing the request of the call. + :ivar response: Contains a dictionary representing the call response, including a list of the call events. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], account_sid: str, call_sid: str + ): super().__init__(version) - self._properties = { - "request": payload.get("request"), - "response": payload.get("response"), - } + self.request: Optional[Dict[str, object]] = payload.get("request") + self.response: Optional[Dict[str, object]] = payload.get("response") self._solution = { "account_sid": account_sid, "call_sid": call_sid, } - @property - def request(self) -> Dict[str, object]: - """ - :returns: Contains a dictionary representing the request of the call. - """ - return self._properties["request"] - - @property - def response(self) -> Dict[str, object]: - """ - :returns: Contains a dictionary representing the call response, including a list of the call events. - """ - return self._properties["response"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/call/feedback.py b/twilio/rest/api/v2010/account/call/feedback.py index 09c745ddd..c2ef4584e 100644 --- a/twilio/rest/api/v2010/account/call/feedback.py +++ b/twilio/rest/api/v2010/account/call/feedback.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -33,20 +33,32 @@ class Issues(object): POST_DIAL_DELAY = "post-dial-delay" UNSOLICITED_CALL = "unsolicited-call" - def __init__(self, version, payload, account_sid: str, call_sid: str): - """ - Initialize the FeedbackInstance - """ + """ + :ivar account_sid: The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. + :ivar date_created: The date that this resource was created, given in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + :ivar date_updated: The date that this resource was last updated, given in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + :ivar issues: A list of issues experienced during the call. The issues can be: `imperfect-audio`, `dropped-call`, `incorrect-caller-id`, `post-dial-delay`, `digits-not-captured`, `audio-latency`, `unsolicited-call`, or `one-way-audio`. + :ivar quality_score: `1` to `5` quality score where `1` represents imperfect experience and `5` represents a perfect call. + :ivar sid: A 34 character string that uniquely identifies this resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], account_sid: str, call_sid: str + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "issues": payload.get("issues"), - "quality_score": deserialize.integer(payload.get("quality_score")), - "sid": payload.get("sid"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.issues: Optional[List["FeedbackInstance.Issues"]] = payload.get("issues") + self.quality_score: Optional[int] = deserialize.integer( + payload.get("quality_score") + ) + self.sid: Optional[str] = payload.get("sid") self._solution = { "account_sid": account_sid, @@ -70,48 +82,6 @@ def _proxy(self) -> "FeedbackContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created, given in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated, given in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. - """ - return self._properties["date_updated"] - - @property - def issues(self) -> List["FeedbackInstance.Issues"]: - """ - :returns: A list of issues experienced during the call. The issues can be: `imperfect-audio`, `dropped-call`, `incorrect-caller-id`, `post-dial-delay`, `digits-not-captured`, `audio-latency`, `unsolicited-call`, or `one-way-audio`. - """ - return self._properties["issues"] - - @property - def quality_score(self) -> int: - """ - :returns: `1` to `5` quality score where `1` represents imperfect experience and `5` represents a perfect call. - """ - return self._properties["quality_score"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - def fetch(self) -> "FeedbackInstance": """ Fetch the FeedbackInstance diff --git a/twilio/rest/api/v2010/account/call/feedback_summary.py b/twilio/rest/api/v2010/account/call/feedback_summary.py index e1d324c5d..972d19a0b 100644 --- a/twilio/rest/api/v2010/account/call/feedback_summary.py +++ b/twilio/rest/api/v2010/account/call/feedback_summary.py @@ -14,7 +14,7 @@ from datetime import date, datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -29,40 +29,66 @@ class Status(object): COMPLETED = "completed" FAILED = "failed" - def __init__(self, version, payload, account_sid: str, sid: Optional[str] = None): - """ - Initialize the FeedbackSummaryInstance - """ + """ + :ivar account_sid: The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. + :ivar call_count: The total number of calls. + :ivar call_feedback_count: The total number of calls with a feedback entry. + :ivar date_created: The date that this resource was created, given in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + :ivar date_updated: The date that this resource was last updated, given in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + :ivar end_date: The last date for which feedback entries are included in this Feedback Summary, formatted as `YYYY-MM-DD` and specified in UTC. + :ivar include_subaccounts: Whether the feedback summary includes subaccounts; `true` if it does, otherwise `false`. + :ivar issues: A list of issues experienced during the call. The issues can be: `imperfect-audio`, `dropped-call`, `incorrect-caller-id`, `post-dial-delay`, `digits-not-captured`, `audio-latency`, or `one-way-audio`. + :ivar quality_score_average: The average QualityScore of the feedback entries. + :ivar quality_score_median: The median QualityScore of the feedback entries. + :ivar quality_score_standard_deviation: The standard deviation of the quality scores. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar start_date: The first date for which feedback entries are included in this feedback summary, formatted as `YYYY-MM-DD` and specified in UTC. + :ivar status: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "call_count": deserialize.integer(payload.get("call_count")), - "call_feedback_count": deserialize.integer( - payload.get("call_feedback_count") - ), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "end_date": deserialize.iso8601_date(payload.get("end_date")), - "include_subaccounts": payload.get("include_subaccounts"), - "issues": payload.get("issues"), - "quality_score_average": deserialize.decimal( - payload.get("quality_score_average") - ), - "quality_score_median": deserialize.decimal( - payload.get("quality_score_median") - ), - "quality_score_standard_deviation": deserialize.decimal( - payload.get("quality_score_standard_deviation") - ), - "sid": payload.get("sid"), - "start_date": deserialize.iso8601_date(payload.get("start_date")), - "status": payload.get("status"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.call_count: Optional[int] = deserialize.integer(payload.get("call_count")) + self.call_feedback_count: Optional[int] = deserialize.integer( + payload.get("call_feedback_count") + ) + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.end_date: Optional[date] = deserialize.iso8601_date( + payload.get("end_date") + ) + self.include_subaccounts: Optional[bool] = payload.get("include_subaccounts") + self.issues: Optional[List[object]] = payload.get("issues") + self.quality_score_average: Optional[float] = deserialize.decimal( + payload.get("quality_score_average") + ) + self.quality_score_median: Optional[float] = deserialize.decimal( + payload.get("quality_score_median") + ) + self.quality_score_standard_deviation: Optional[float] = deserialize.decimal( + payload.get("quality_score_standard_deviation") + ) + self.sid: Optional[str] = payload.get("sid") + self.start_date: Optional[date] = deserialize.iso8601_date( + payload.get("start_date") + ) + self.status: Optional["FeedbackSummaryInstance.Status"] = payload.get("status") self._solution = { "account_sid": account_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[FeedbackSummaryContext] = None @@ -82,104 +108,6 @@ def _proxy(self) -> "FeedbackSummaryContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this resource. - """ - return self._properties["account_sid"] - - @property - def call_count(self) -> int: - """ - :returns: The total number of calls. - """ - return self._properties["call_count"] - - @property - def call_feedback_count(self) -> int: - """ - :returns: The total number of calls with a feedback entry. - """ - return self._properties["call_feedback_count"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created, given in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated, given in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. - """ - return self._properties["date_updated"] - - @property - def end_date(self) -> date: - """ - :returns: The last date for which feedback entries are included in this Feedback Summary, formatted as `YYYY-MM-DD` and specified in UTC. - """ - return self._properties["end_date"] - - @property - def include_subaccounts(self) -> bool: - """ - :returns: Whether the feedback summary includes subaccounts; `true` if it does, otherwise `false`. - """ - return self._properties["include_subaccounts"] - - @property - def issues(self) -> List[object]: - """ - :returns: A list of issues experienced during the call. The issues can be: `imperfect-audio`, `dropped-call`, `incorrect-caller-id`, `post-dial-delay`, `digits-not-captured`, `audio-latency`, or `one-way-audio`. - """ - return self._properties["issues"] - - @property - def quality_score_average(self) -> float: - """ - :returns: The average QualityScore of the feedback entries. - """ - return self._properties["quality_score_average"] - - @property - def quality_score_median(self) -> float: - """ - :returns: The median QualityScore of the feedback entries. - """ - return self._properties["quality_score_median"] - - @property - def quality_score_standard_deviation(self) -> float: - """ - :returns: The standard deviation of the quality scores. - """ - return self._properties["quality_score_standard_deviation"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def start_date(self) -> date: - """ - :returns: The first date for which feedback entries are included in this feedback summary, formatted as `YYYY-MM-DD` and specified in UTC. - """ - return self._properties["start_date"] - - @property - def status(self) -> "FeedbackSummaryInstance.Status": - """ - :returns: - """ - return self._properties["status"] - def delete(self) -> bool: """ Deletes the FeedbackSummaryInstance diff --git a/twilio/rest/api/v2010/account/call/notification.py b/twilio/rest/api/v2010/account/call/notification.py index 653650629..ef1825039 100644 --- a/twilio/rest/api/v2010/account/call/notification.py +++ b/twilio/rest/api/v2010/account/call/notification.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,43 +24,65 @@ class NotificationInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Call Notification resource. + :ivar api_version: The API version used to create the Call Notification resource. + :ivar call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Call Notification resource is associated with. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar error_code: A unique error code for the error condition that is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). + :ivar log: An integer log level that corresponds to the type of notification: `0` is ERROR, `1` is WARNING. + :ivar message_date: The date the notification was actually generated in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. Message buffering can cause this value to differ from `date_created`. + :ivar message_text: The text of the notification. + :ivar more_info: The URL for more information about the error condition. This value is a page in our [Error Dictionary](https://www.twilio.com/docs/api/errors). + :ivar request_method: The HTTP method used to generate the notification. If the notification was generated during a phone call, this is the HTTP Method used to request the resource on your server. If the notification was generated by your use of our REST API, this is the HTTP method used to call the resource on our servers. + :ivar request_url: The URL of the resource that generated the notification. If the notification was generated during a phone call, this is the URL of the resource on your server that caused the notification. If the notification was generated by your use of our REST API, this is the URL of the resource you called. + :ivar request_variables: The HTTP GET or POST variables we sent to your server. However, if the notification was generated by our REST API, this contains the HTTP POST or PUT variables you sent to our API. + :ivar response_body: The HTTP body returned by your server. + :ivar response_headers: The HTTP headers returned by your server. + :ivar sid: The unique string that that we created to identify the Call Notification resource. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], account_sid: str, call_sid: str, sid: Optional[str] = None, ): - """ - Initialize the NotificationInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "api_version": payload.get("api_version"), - "call_sid": payload.get("call_sid"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "error_code": payload.get("error_code"), - "log": payload.get("log"), - "message_date": deserialize.rfc2822_datetime(payload.get("message_date")), - "message_text": payload.get("message_text"), - "more_info": payload.get("more_info"), - "request_method": payload.get("request_method"), - "request_url": payload.get("request_url"), - "request_variables": payload.get("request_variables"), - "response_body": payload.get("response_body"), - "response_headers": payload.get("response_headers"), - "sid": payload.get("sid"), - "uri": payload.get("uri"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.api_version: Optional[str] = payload.get("api_version") + self.call_sid: Optional[str] = payload.get("call_sid") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.error_code: Optional[str] = payload.get("error_code") + self.log: Optional[str] = payload.get("log") + self.message_date: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("message_date") + ) + self.message_text: Optional[str] = payload.get("message_text") + self.more_info: Optional[str] = payload.get("more_info") + self.request_method: Optional[str] = payload.get("request_method") + self.request_url: Optional[str] = payload.get("request_url") + self.request_variables: Optional[str] = payload.get("request_variables") + self.response_body: Optional[str] = payload.get("response_body") + self.response_headers: Optional[str] = payload.get("response_headers") + self.sid: Optional[str] = payload.get("sid") + self.uri: Optional[str] = payload.get("uri") self._solution = { "account_sid": account_sid, "call_sid": call_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[NotificationContext] = None @@ -81,125 +103,6 @@ def _proxy(self) -> "NotificationContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Call Notification resource. - """ - return self._properties["account_sid"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to create the Call Notification resource. - """ - return self._properties["api_version"] - - @property - def call_sid(self) -> str: - """ - :returns: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Call Notification resource is associated with. - """ - return self._properties["call_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def error_code(self) -> str: - """ - :returns: A unique error code for the error condition that is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). - """ - return self._properties["error_code"] - - @property - def log(self) -> str: - """ - :returns: An integer log level that corresponds to the type of notification: `0` is ERROR, `1` is WARNING. - """ - return self._properties["log"] - - @property - def message_date(self) -> datetime: - """ - :returns: The date the notification was actually generated in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. Message buffering can cause this value to differ from `date_created`. - """ - return self._properties["message_date"] - - @property - def message_text(self) -> str: - """ - :returns: The text of the notification. - """ - return self._properties["message_text"] - - @property - def more_info(self) -> str: - """ - :returns: The URL for more information about the error condition. This value is a page in our [Error Dictionary](https://www.twilio.com/docs/api/errors). - """ - return self._properties["more_info"] - - @property - def request_method(self) -> str: - """ - :returns: The HTTP method used to generate the notification. If the notification was generated during a phone call, this is the HTTP Method used to request the resource on your server. If the notification was generated by your use of our REST API, this is the HTTP method used to call the resource on our servers. - """ - return self._properties["request_method"] - - @property - def request_url(self) -> str: - """ - :returns: The URL of the resource that generated the notification. If the notification was generated during a phone call, this is the URL of the resource on your server that caused the notification. If the notification was generated by your use of our REST API, this is the URL of the resource you called. - """ - return self._properties["request_url"] - - @property - def request_variables(self) -> str: - """ - :returns: The HTTP GET or POST variables we sent to your server. However, if the notification was generated by our REST API, this contains the HTTP POST or PUT variables you sent to our API. - """ - return self._properties["request_variables"] - - @property - def response_body(self) -> str: - """ - :returns: The HTTP body returned by your server. - """ - return self._properties["response_body"] - - @property - def response_headers(self) -> str: - """ - :returns: The HTTP headers returned by your server. - """ - return self._properties["response_headers"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the Call Notification resource. - """ - return self._properties["sid"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - def fetch(self) -> "NotificationInstance": """ Fetch the NotificationInstance diff --git a/twilio/rest/api/v2010/account/call/payment.py b/twilio/rest/api/v2010/account/call/payment.py index ee894a322..f3d4db662 100644 --- a/twilio/rest/api/v2010/account/call/payment.py +++ b/twilio/rest/api/v2010/account/call/payment.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Optional +from typing import Any, Dict, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,32 +23,41 @@ class PaymentInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. + :ivar call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Payments resource is associated with. This will refer to the call sid that is producing the payment card (credit/ACH) information thru DTMF. + :ivar sid: The SID of the Payments resource. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], account_sid: str, call_sid: str, sid: Optional[str] = None, ): - """ - Initialize the PaymentInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "call_sid": payload.get("call_sid"), - "sid": payload.get("sid"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "uri": payload.get("uri"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.call_sid: Optional[str] = payload.get("call_sid") + self.sid: Optional[str] = payload.get("sid") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.uri: Optional[str] = payload.get("uri") self._solution = { "account_sid": account_sid, "call_sid": call_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[PaymentContext] = None @@ -69,48 +78,6 @@ def _proxy(self) -> "PaymentContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Payments resource. - """ - return self._properties["account_sid"] - - @property - def call_sid(self) -> str: - """ - :returns: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Payments resource is associated with. This will refer to the call sid that is producing the payment card (credit/ACH) information thru DTMF. - """ - return self._properties["call_sid"] - - @property - def sid(self) -> str: - """ - :returns: The SID of the Payments resource. - """ - return self._properties["sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - def update( self, idempotency_key, diff --git a/twilio/rest/api/v2010/account/call/recording.py b/twilio/rest/api/v2010/account/call/recording.py index 4c91327de..3a270e03a 100644 --- a/twilio/rest/api/v2010/account/call/recording.py +++ b/twilio/rest/api/v2010/account/call/recording.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -41,44 +41,68 @@ class Status(object): COMPLETED = "completed" ABSENT = "absent" + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource. + :ivar api_version: The API version used to make the recording. + :ivar call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Recording resource is associated with. + :ivar conference_sid: The Conference SID that identifies the conference associated with the recording, if a conference recording. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar start_time: The start time of the recording in GMT and in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + :ivar duration: The length of the recording in seconds. + :ivar sid: The unique string that that we created to identify the Recording resource. + :ivar price: The one-time cost of creating the recording in the `price_unit` currency. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + :ivar encryption_details: How to decrypt the recording if it was encrypted using [Call Recording Encryption](https://www.twilio.com/docs/voice/tutorials/voice-recording-encryption) feature. + :ivar price_unit: The currency used in the `price` property. Example: `USD`. + :ivar status: + :ivar channels: The number of channels in the final recording file. Can be: `1`, or `2`. Separating a two leg call into two separate channels of the recording file is supported in [Dial](https://www.twilio.com/docs/voice/twiml/dial#attributes-record) and [Outbound Rest API](https://www.twilio.com/docs/voice/make-calls) record options. + :ivar source: + :ivar error_code: The error code that describes why the recording is `absent`. The error code is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). This value is null if the recording `status` is not `absent`. + :ivar track: The recorded track. Can be: `inbound`, `outbound`, or `both`. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], account_sid: str, call_sid: str, sid: Optional[str] = None, ): - """ - Initialize the RecordingInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "api_version": payload.get("api_version"), - "call_sid": payload.get("call_sid"), - "conference_sid": payload.get("conference_sid"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "start_time": deserialize.rfc2822_datetime(payload.get("start_time")), - "duration": payload.get("duration"), - "sid": payload.get("sid"), - "price": deserialize.decimal(payload.get("price")), - "uri": payload.get("uri"), - "encryption_details": payload.get("encryption_details"), - "price_unit": payload.get("price_unit"), - "status": payload.get("status"), - "channels": deserialize.integer(payload.get("channels")), - "source": payload.get("source"), - "error_code": deserialize.integer(payload.get("error_code")), - "track": payload.get("track"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.api_version: Optional[str] = payload.get("api_version") + self.call_sid: Optional[str] = payload.get("call_sid") + self.conference_sid: Optional[str] = payload.get("conference_sid") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.start_time: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("start_time") + ) + self.duration: Optional[str] = payload.get("duration") + self.sid: Optional[str] = payload.get("sid") + self.price: Optional[float] = deserialize.decimal(payload.get("price")) + self.uri: Optional[str] = payload.get("uri") + self.encryption_details: Optional[Dict[str, object]] = payload.get( + "encryption_details" + ) + self.price_unit: Optional[str] = payload.get("price_unit") + self.status: Optional["RecordingInstance.Status"] = payload.get("status") + self.channels: Optional[int] = deserialize.integer(payload.get("channels")) + self.source: Optional["RecordingInstance.Source"] = payload.get("source") + self.error_code: Optional[int] = deserialize.integer(payload.get("error_code")) + self.track: Optional[str] = payload.get("track") self._solution = { "account_sid": account_sid, "call_sid": call_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[RecordingContext] = None @@ -99,132 +123,6 @@ def _proxy(self) -> "RecordingContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource. - """ - return self._properties["account_sid"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to make the recording. - """ - return self._properties["api_version"] - - @property - def call_sid(self) -> str: - """ - :returns: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Recording resource is associated with. - """ - return self._properties["call_sid"] - - @property - def conference_sid(self) -> str: - """ - :returns: The Conference SID that identifies the conference associated with the recording, if a conference recording. - """ - return self._properties["conference_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def start_time(self) -> datetime: - """ - :returns: The start time of the recording in GMT and in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. - """ - return self._properties["start_time"] - - @property - def duration(self) -> str: - """ - :returns: The length of the recording in seconds. - """ - return self._properties["duration"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the Recording resource. - """ - return self._properties["sid"] - - @property - def price(self) -> float: - """ - :returns: The one-time cost of creating the recording in the `price_unit` currency. - """ - return self._properties["price"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def encryption_details(self) -> Dict[str, object]: - """ - :returns: How to decrypt the recording if it was encrypted using [Call Recording Encryption](https://www.twilio.com/docs/voice/tutorials/voice-recording-encryption) feature. - """ - return self._properties["encryption_details"] - - @property - def price_unit(self) -> str: - """ - :returns: The currency used in the `price` property. Example: `USD`. - """ - return self._properties["price_unit"] - - @property - def status(self) -> "RecordingInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def channels(self) -> int: - """ - :returns: The number of channels in the final recording file. Can be: `1`, or `2`. Separating a two leg call into two separate channels of the recording file is supported in [Dial](https://www.twilio.com/docs/voice/twiml/dial#attributes-record) and [Outbound Rest API](https://www.twilio.com/docs/voice/make-calls) record options. - """ - return self._properties["channels"] - - @property - def source(self) -> "RecordingInstance.Source": - """ - :returns: - """ - return self._properties["source"] - - @property - def error_code(self) -> int: - """ - :returns: The error code that describes why the recording is `absent`. The error code is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). This value is null if the recording `status` is not `absent`. - """ - return self._properties["error_code"] - - @property - def track(self) -> str: - """ - :returns: The recorded track. Can be: `inbound`, `outbound`, or `both`. - """ - return self._properties["track"] - def delete(self) -> bool: """ Deletes the RecordingInstance diff --git a/twilio/rest/api/v2010/account/call/siprec.py b/twilio/rest/api/v2010/account/call/siprec.py index c59690e34..3b7a6502c 100644 --- a/twilio/rest/api/v2010/account/call/siprec.py +++ b/twilio/rest/api/v2010/account/call/siprec.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Optional +from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,33 +27,40 @@ class Status(object): IN_PROGRESS = "in-progress" STOPPED = "stopped" + """ + :ivar sid: The SID of the Siprec resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Siprec resource. + :ivar call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Siprec resource is associated with. + :ivar name: The user-specified name of this Siprec, if one was given when the Siprec was created. This may be used to stop the Siprec. + :ivar status: + :ivar date_updated: The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], account_sid: str, call_sid: str, sid: Optional[str] = None, ): - """ - Initialize the SiprecInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "call_sid": payload.get("call_sid"), - "name": payload.get("name"), - "status": payload.get("status"), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "uri": payload.get("uri"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.call_sid: Optional[str] = payload.get("call_sid") + self.name: Optional[str] = payload.get("name") + self.status: Optional["SiprecInstance.Status"] = payload.get("status") + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.uri: Optional[str] = payload.get("uri") self._solution = { "account_sid": account_sid, "call_sid": call_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[SiprecContext] = None @@ -74,55 +81,6 @@ def _proxy(self) -> "SiprecContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The SID of the Siprec resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Siprec resource. - """ - return self._properties["account_sid"] - - @property - def call_sid(self) -> str: - """ - :returns: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Siprec resource is associated with. - """ - return self._properties["call_sid"] - - @property - def name(self) -> str: - """ - :returns: The user-specified name of this Siprec, if one was given when the Siprec was created. This may be used to stop the Siprec. - """ - return self._properties["name"] - - @property - def status(self) -> "SiprecInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - def update(self, status) -> "SiprecInstance": """ Update the SiprecInstance diff --git a/twilio/rest/api/v2010/account/call/stream.py b/twilio/rest/api/v2010/account/call/stream.py index e6e02788a..b2ba09edd 100644 --- a/twilio/rest/api/v2010/account/call/stream.py +++ b/twilio/rest/api/v2010/account/call/stream.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Optional +from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,33 +27,40 @@ class Status(object): IN_PROGRESS = "in-progress" STOPPED = "stopped" + """ + :ivar sid: The SID of the Stream resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Stream resource. + :ivar call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Stream resource is associated with. + :ivar name: The user-specified name of this Stream, if one was given when the Stream was created. This may be used to stop the Stream. + :ivar status: + :ivar date_updated: The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], account_sid: str, call_sid: str, sid: Optional[str] = None, ): - """ - Initialize the StreamInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "call_sid": payload.get("call_sid"), - "name": payload.get("name"), - "status": payload.get("status"), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "uri": payload.get("uri"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.call_sid: Optional[str] = payload.get("call_sid") + self.name: Optional[str] = payload.get("name") + self.status: Optional["StreamInstance.Status"] = payload.get("status") + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.uri: Optional[str] = payload.get("uri") self._solution = { "account_sid": account_sid, "call_sid": call_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[StreamContext] = None @@ -74,55 +81,6 @@ def _proxy(self) -> "StreamContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The SID of the Stream resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Stream resource. - """ - return self._properties["account_sid"] - - @property - def call_sid(self) -> str: - """ - :returns: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Stream resource is associated with. - """ - return self._properties["call_sid"] - - @property - def name(self) -> str: - """ - :returns: The user-specified name of this Stream, if one was given when the Stream was created. This may be used to stop the Stream. - """ - return self._properties["name"] - - @property - def status(self) -> "StreamInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - def update(self, status) -> "StreamInstance": """ Update the StreamInstance diff --git a/twilio/rest/api/v2010/account/call/user_defined_message.py b/twilio/rest/api/v2010/account/call/user_defined_message.py index 3c7176859..61fef700a 100644 --- a/twilio/rest/api/v2010/account/call/user_defined_message.py +++ b/twilio/rest/api/v2010/account/call/user_defined_message.py @@ -14,6 +14,7 @@ from datetime import datetime +from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -22,52 +23,31 @@ class UserDefinedMessageInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, call_sid: str): - """ - Initialize the UserDefinedMessageInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created User Defined Message. + :ivar call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the User Defined Message is associated with. + :ivar sid: The SID that uniquely identifies this User Defined Message. + :ivar date_created: The date that this User Defined Message was created, given in RFC 2822 format. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], account_sid: str, call_sid: str + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "call_sid": payload.get("call_sid"), - "sid": payload.get("sid"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.call_sid: Optional[str] = payload.get("call_sid") + self.sid: Optional[str] = payload.get("sid") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) self._solution = { "account_sid": account_sid, "call_sid": call_sid, } - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created User Defined Message. - """ - return self._properties["account_sid"] - - @property - def call_sid(self) -> str: - """ - :returns: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the User Defined Message is associated with. - """ - return self._properties["call_sid"] - - @property - def sid(self) -> str: - """ - :returns: The SID that uniquely identifies this User Defined Message. - """ - return self._properties["sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this User Defined Message was created, given in RFC 2822 format. - """ - return self._properties["date_created"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/call/user_defined_message_subscription.py b/twilio/rest/api/v2010/account/call/user_defined_message_subscription.py index a4351ccc8..f75bb2930 100644 --- a/twilio/rest/api/v2010/account/call/user_defined_message_subscription.py +++ b/twilio/rest/api/v2010/account/call/user_defined_message_subscription.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Optional +from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,31 +23,37 @@ class UserDefinedMessageSubscriptionInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that subscribed to the User Defined Messages. + :ivar call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the User Defined Message Subscription is associated with. This refers to the Call SID that is producing the User Defined Messages. + :ivar sid: The SID that uniquely identifies this User Defined Message Subscription. + :ivar date_created: The date that this User Defined Message Subscription was created, given in RFC 2822 format. + :ivar uri: The URI of the User Defined Message Subscription Resource, relative to `https://api.twilio.com`. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], account_sid: str, call_sid: str, sid: Optional[str] = None, ): - """ - Initialize the UserDefinedMessageSubscriptionInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "call_sid": payload.get("call_sid"), - "sid": payload.get("sid"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "uri": payload.get("uri"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.call_sid: Optional[str] = payload.get("call_sid") + self.sid: Optional[str] = payload.get("sid") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.uri: Optional[str] = payload.get("uri") self._solution = { "account_sid": account_sid, "call_sid": call_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[UserDefinedMessageSubscriptionContext] = None @@ -68,41 +74,6 @@ def _proxy(self) -> "UserDefinedMessageSubscriptionContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that subscribed to the User Defined Messages. - """ - return self._properties["account_sid"] - - @property - def call_sid(self) -> str: - """ - :returns: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the User Defined Message Subscription is associated with. This refers to the Call SID that is producing the User Defined Messages. - """ - return self._properties["call_sid"] - - @property - def sid(self) -> str: - """ - :returns: The SID that uniquely identifies this User Defined Message Subscription. - """ - return self._properties["sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this User Defined Message Subscription was created, given in RFC 2822 format. - """ - return self._properties["date_created"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the User Defined Message Subscription Resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - def delete(self) -> bool: """ Deletes the UserDefinedMessageSubscriptionInstance diff --git a/twilio/rest/api/v2010/account/conference/__init__.py b/twilio/rest/api/v2010/account/conference/__init__.py index 3dfab11e8..d6a2c1297 100644 --- a/twilio/rest/api/v2010/account/conference/__init__.py +++ b/twilio/rest/api/v2010/account/conference/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -42,30 +42,56 @@ class Status(object): IN_PROGRESS = "in-progress" COMPLETED = "completed" - def __init__(self, version, payload, account_sid: str, sid: Optional[str] = None): - """ - Initialize the ConferenceInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Conference resource. + :ivar date_created: The date and time in GMT that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar api_version: The API version used to create this conference. + :ivar friendly_name: A string that you assigned to describe this conference room. Maxiumum length is 128 characters. + :ivar region: A string that represents the Twilio Region where the conference audio was mixed. May be `us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, and `jp1`. Basic conference audio will always be mixed in `us1`. Global Conference audio will be mixed nearest to the majority of participants. + :ivar sid: The unique string that that we created to identify this Conference resource. + :ivar status: + :ivar uri: The URI of this resource, relative to `https://api.twilio.com`. + :ivar subresource_uris: A list of related resources identified by their URIs relative to `https://api.twilio.com`. + :ivar reason_conference_ended: + :ivar call_sid_ending_conference: The call SID that caused the conference to end. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "api_version": payload.get("api_version"), - "friendly_name": payload.get("friendly_name"), - "region": payload.get("region"), - "sid": payload.get("sid"), - "status": payload.get("status"), - "uri": payload.get("uri"), - "subresource_uris": payload.get("subresource_uris"), - "reason_conference_ended": payload.get("reason_conference_ended"), - "call_sid_ending_conference": payload.get("call_sid_ending_conference"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.api_version: Optional[str] = payload.get("api_version") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.region: Optional[str] = payload.get("region") + self.sid: Optional[str] = payload.get("sid") + self.status: Optional["ConferenceInstance.Status"] = payload.get("status") + self.uri: Optional[str] = payload.get("uri") + self.subresource_uris: Optional[Dict[str, object]] = payload.get( + "subresource_uris" + ) + self.reason_conference_ended: Optional[ + "ConferenceInstance.ReasonConferenceEnded" + ] = payload.get("reason_conference_ended") + self.call_sid_ending_conference: Optional[str] = payload.get( + "call_sid_ending_conference" + ) self._solution = { "account_sid": account_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ConferenceContext] = None @@ -85,90 +111,6 @@ def _proxy(self) -> "ConferenceContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Conference resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to create this conference. - """ - return self._properties["api_version"] - - @property - def friendly_name(self) -> str: - """ - :returns: A string that you assigned to describe this conference room. Maxiumum length is 128 characters. - """ - return self._properties["friendly_name"] - - @property - def region(self) -> str: - """ - :returns: A string that represents the Twilio Region where the conference audio was mixed. May be `us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, and `jp1`. Basic conference audio will always be mixed in `us1`. Global Conference audio will be mixed nearest to the majority of participants. - """ - return self._properties["region"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify this Conference resource. - """ - return self._properties["sid"] - - @property - def status(self) -> "ConferenceInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def uri(self) -> str: - """ - :returns: The URI of this resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def subresource_uris(self) -> Dict[str, object]: - """ - :returns: A list of related resources identified by their URIs relative to `https://api.twilio.com`. - """ - return self._properties["subresource_uris"] - - @property - def reason_conference_ended(self) -> "ConferenceInstance.ReasonConferenceEnded": - """ - :returns: - """ - return self._properties["reason_conference_ended"] - - @property - def call_sid_ending_conference(self) -> str: - """ - :returns: The call SID that caused the conference to end. - """ - return self._properties["call_sid_ending_conference"] - def fetch(self) -> "ConferenceInstance": """ Fetch the ConferenceInstance diff --git a/twilio/rest/api/v2010/account/conference/participant.py b/twilio/rest/api/v2010/account/conference/participant.py index c42252cb4..e79050dbb 100644 --- a/twilio/rest/api/v2010/account/conference/participant.py +++ b/twilio/rest/api/v2010/account/conference/participant.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -32,40 +32,60 @@ class Status(object): COMPLETE = "complete" FAILED = "failed" + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Participant resource. + :ivar call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Participant resource is associated with. + :ivar label: The user-specified label of this participant, if one was given when the participant was created. This may be used to fetch, update or delete the participant. + :ivar call_sid_to_coach: The SID of the participant who is being `coached`. The participant being coached is the only participant who can hear the participant who is `coaching`. + :ivar coaching: Whether the participant is coaching another call. Can be: `true` or `false`. If not present, defaults to `false` unless `call_sid_to_coach` is defined. If `true`, `call_sid_to_coach` must be defined. + :ivar conference_sid: The SID of the conference the participant is in. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar end_conference_on_exit: Whether the conference ends when the participant leaves. Can be: `true` or `false` and the default is `false`. If `true`, the conference ends and all other participants drop out when the participant leaves. + :ivar muted: Whether the participant is muted. Can be `true` or `false`. + :ivar hold: Whether the participant is on hold. Can be `true` or `false`. + :ivar start_conference_on_enter: Whether the conference starts when the participant joins the conference, if it has not already started. Can be: `true` or `false` and the default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference. + :ivar status: + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], account_sid: str, conference_sid: str, call_sid: Optional[str] = None, ): - """ - Initialize the ParticipantInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "call_sid": payload.get("call_sid"), - "label": payload.get("label"), - "call_sid_to_coach": payload.get("call_sid_to_coach"), - "coaching": payload.get("coaching"), - "conference_sid": payload.get("conference_sid"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "end_conference_on_exit": payload.get("end_conference_on_exit"), - "muted": payload.get("muted"), - "hold": payload.get("hold"), - "start_conference_on_enter": payload.get("start_conference_on_enter"), - "status": payload.get("status"), - "uri": payload.get("uri"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.call_sid: Optional[str] = payload.get("call_sid") + self.label: Optional[str] = payload.get("label") + self.call_sid_to_coach: Optional[str] = payload.get("call_sid_to_coach") + self.coaching: Optional[bool] = payload.get("coaching") + self.conference_sid: Optional[str] = payload.get("conference_sid") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.end_conference_on_exit: Optional[bool] = payload.get( + "end_conference_on_exit" + ) + self.muted: Optional[bool] = payload.get("muted") + self.hold: Optional[bool] = payload.get("hold") + self.start_conference_on_enter: Optional[bool] = payload.get( + "start_conference_on_enter" + ) + self.status: Optional["ParticipantInstance.Status"] = payload.get("status") + self.uri: Optional[str] = payload.get("uri") self._solution = { "account_sid": account_sid, "conference_sid": conference_sid, - "call_sid": call_sid or self._properties["call_sid"], + "call_sid": call_sid or self.call_sid, } self._context: Optional[ParticipantContext] = None @@ -86,104 +106,6 @@ def _proxy(self) -> "ParticipantContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Participant resource. - """ - return self._properties["account_sid"] - - @property - def call_sid(self) -> str: - """ - :returns: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Participant resource is associated with. - """ - return self._properties["call_sid"] - - @property - def label(self) -> str: - """ - :returns: The user-specified label of this participant, if one was given when the participant was created. This may be used to fetch, update or delete the participant. - """ - return self._properties["label"] - - @property - def call_sid_to_coach(self) -> str: - """ - :returns: The SID of the participant who is being `coached`. The participant being coached is the only participant who can hear the participant who is `coaching`. - """ - return self._properties["call_sid_to_coach"] - - @property - def coaching(self) -> bool: - """ - :returns: Whether the participant is coaching another call. Can be: `true` or `false`. If not present, defaults to `false` unless `call_sid_to_coach` is defined. If `true`, `call_sid_to_coach` must be defined. - """ - return self._properties["coaching"] - - @property - def conference_sid(self) -> str: - """ - :returns: The SID of the conference the participant is in. - """ - return self._properties["conference_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def end_conference_on_exit(self) -> bool: - """ - :returns: Whether the conference ends when the participant leaves. Can be: `true` or `false` and the default is `false`. If `true`, the conference ends and all other participants drop out when the participant leaves. - """ - return self._properties["end_conference_on_exit"] - - @property - def muted(self) -> bool: - """ - :returns: Whether the participant is muted. Can be `true` or `false`. - """ - return self._properties["muted"] - - @property - def hold(self) -> bool: - """ - :returns: Whether the participant is on hold. Can be `true` or `false`. - """ - return self._properties["hold"] - - @property - def start_conference_on_enter(self) -> bool: - """ - :returns: Whether the conference starts when the participant joins the conference, if it has not already started. Can be: `true` or `false` and the default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference. - """ - return self._properties["start_conference_on_enter"] - - @property - def status(self) -> "ParticipantInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - def delete(self) -> bool: """ Deletes the ParticipantInstance diff --git a/twilio/rest/api/v2010/account/conference/recording.py b/twilio/rest/api/v2010/account/conference/recording.py index e016905cd..ec6394f04 100644 --- a/twilio/rest/api/v2010/account/conference/recording.py +++ b/twilio/rest/api/v2010/account/conference/recording.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -41,43 +41,66 @@ class Status(object): COMPLETED = "completed" ABSENT = "absent" + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Conference Recording resource. + :ivar api_version: The API version used to create the recording. + :ivar call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Conference Recording resource is associated with. + :ivar conference_sid: The Conference SID that identifies the conference associated with the recording. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar start_time: The start time of the recording in GMT and in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + :ivar duration: The length of the recording in seconds. + :ivar sid: The unique string that that we created to identify the Conference Recording resource. + :ivar price: The one-time cost of creating the recording in the `price_unit` currency. + :ivar price_unit: The currency used in the `price` property. Example: `USD`. + :ivar status: + :ivar channels: The number of channels in the final recording file. Can be: `1`, or `2`. Separating a two leg call into two separate channels of the recording file is supported in [Dial](https://www.twilio.com/docs/voice/twiml/dial#attributes-record) and [Outbound Rest API](https://www.twilio.com/docs/voice/make-calls) record options. + :ivar source: + :ivar error_code: The error code that describes why the recording is `absent`. The error code is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). This value is null if the recording `status` is not `absent`. + :ivar encryption_details: How to decrypt the recording if it was encrypted using [Call Recording Encryption](https://www.twilio.com/docs/voice/tutorials/voice-recording-encryption) feature. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], account_sid: str, conference_sid: str, sid: Optional[str] = None, ): - """ - Initialize the RecordingInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "api_version": payload.get("api_version"), - "call_sid": payload.get("call_sid"), - "conference_sid": payload.get("conference_sid"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "start_time": deserialize.rfc2822_datetime(payload.get("start_time")), - "duration": payload.get("duration"), - "sid": payload.get("sid"), - "price": payload.get("price"), - "price_unit": payload.get("price_unit"), - "status": payload.get("status"), - "channels": deserialize.integer(payload.get("channels")), - "source": payload.get("source"), - "error_code": deserialize.integer(payload.get("error_code")), - "encryption_details": payload.get("encryption_details"), - "uri": payload.get("uri"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.api_version: Optional[str] = payload.get("api_version") + self.call_sid: Optional[str] = payload.get("call_sid") + self.conference_sid: Optional[str] = payload.get("conference_sid") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.start_time: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("start_time") + ) + self.duration: Optional[str] = payload.get("duration") + self.sid: Optional[str] = payload.get("sid") + self.price: Optional[str] = payload.get("price") + self.price_unit: Optional[str] = payload.get("price_unit") + self.status: Optional["RecordingInstance.Status"] = payload.get("status") + self.channels: Optional[int] = deserialize.integer(payload.get("channels")) + self.source: Optional["RecordingInstance.Source"] = payload.get("source") + self.error_code: Optional[int] = deserialize.integer(payload.get("error_code")) + self.encryption_details: Optional[Dict[str, object]] = payload.get( + "encryption_details" + ) + self.uri: Optional[str] = payload.get("uri") self._solution = { "account_sid": account_sid, "conference_sid": conference_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[RecordingContext] = None @@ -98,125 +121,6 @@ def _proxy(self) -> "RecordingContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Conference Recording resource. - """ - return self._properties["account_sid"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to create the recording. - """ - return self._properties["api_version"] - - @property - def call_sid(self) -> str: - """ - :returns: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Conference Recording resource is associated with. - """ - return self._properties["call_sid"] - - @property - def conference_sid(self) -> str: - """ - :returns: The Conference SID that identifies the conference associated with the recording. - """ - return self._properties["conference_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def start_time(self) -> datetime: - """ - :returns: The start time of the recording in GMT and in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. - """ - return self._properties["start_time"] - - @property - def duration(self) -> str: - """ - :returns: The length of the recording in seconds. - """ - return self._properties["duration"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the Conference Recording resource. - """ - return self._properties["sid"] - - @property - def price(self) -> str: - """ - :returns: The one-time cost of creating the recording in the `price_unit` currency. - """ - return self._properties["price"] - - @property - def price_unit(self) -> str: - """ - :returns: The currency used in the `price` property. Example: `USD`. - """ - return self._properties["price_unit"] - - @property - def status(self) -> "RecordingInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def channels(self) -> int: - """ - :returns: The number of channels in the final recording file. Can be: `1`, or `2`. Separating a two leg call into two separate channels of the recording file is supported in [Dial](https://www.twilio.com/docs/voice/twiml/dial#attributes-record) and [Outbound Rest API](https://www.twilio.com/docs/voice/make-calls) record options. - """ - return self._properties["channels"] - - @property - def source(self) -> "RecordingInstance.Source": - """ - :returns: - """ - return self._properties["source"] - - @property - def error_code(self) -> int: - """ - :returns: The error code that describes why the recording is `absent`. The error code is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). This value is null if the recording `status` is not `absent`. - """ - return self._properties["error_code"] - - @property - def encryption_details(self) -> Dict[str, object]: - """ - :returns: How to decrypt the recording if it was encrypted using [Call Recording Encryption](https://www.twilio.com/docs/voice/tutorials/voice-recording-encryption) feature. - """ - return self._properties["encryption_details"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - def delete(self) -> bool: """ Deletes the RecordingInstance diff --git a/twilio/rest/api/v2010/account/connect_app.py b/twilio/rest/api/v2010/account/connect_app.py index caea487d9..dec44a85d 100644 --- a/twilio/rest/api/v2010/account/connect_app.py +++ b/twilio/rest/api/v2010/account/connect_app.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,29 +27,52 @@ class Permission(object): GET_ALL = "get-all" POST_ALL = "post-all" - def __init__(self, version, payload, account_sid: str, sid: Optional[str] = None): - """ - Initialize the ConnectAppInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ConnectApp resource. + :ivar authorize_redirect_url: The URL we redirect the user to after we authenticate the user and obtain authorization to access the Connect App. + :ivar company_name: The company name set for the Connect App. + :ivar deauthorize_callback_method: The HTTP method we use to call `deauthorize_callback_url`. + :ivar deauthorize_callback_url: The URL we call using the `deauthorize_callback_method` to de-authorize the Connect App. + :ivar description: The description of the Connect App. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar homepage_url: The public URL where users can obtain more information about this Connect App. + :ivar permissions: The set of permissions that your ConnectApp requests. + :ivar sid: The unique string that that we created to identify the ConnectApp resource. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "authorize_redirect_url": payload.get("authorize_redirect_url"), - "company_name": payload.get("company_name"), - "deauthorize_callback_method": payload.get("deauthorize_callback_method"), - "deauthorize_callback_url": payload.get("deauthorize_callback_url"), - "description": payload.get("description"), - "friendly_name": payload.get("friendly_name"), - "homepage_url": payload.get("homepage_url"), - "permissions": payload.get("permissions"), - "sid": payload.get("sid"), - "uri": payload.get("uri"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.authorize_redirect_url: Optional[str] = payload.get( + "authorize_redirect_url" + ) + self.company_name: Optional[str] = payload.get("company_name") + self.deauthorize_callback_method: Optional[str] = payload.get( + "deauthorize_callback_method" + ) + self.deauthorize_callback_url: Optional[str] = payload.get( + "deauthorize_callback_url" + ) + self.description: Optional[str] = payload.get("description") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.homepage_url: Optional[str] = payload.get("homepage_url") + self.permissions: Optional[List["ConnectAppInstance.Permission"]] = payload.get( + "permissions" + ) + self.sid: Optional[str] = payload.get("sid") + self.uri: Optional[str] = payload.get("uri") self._solution = { "account_sid": account_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ConnectAppContext] = None @@ -69,83 +92,6 @@ def _proxy(self) -> "ConnectAppContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ConnectApp resource. - """ - return self._properties["account_sid"] - - @property - def authorize_redirect_url(self) -> str: - """ - :returns: The URL we redirect the user to after we authenticate the user and obtain authorization to access the Connect App. - """ - return self._properties["authorize_redirect_url"] - - @property - def company_name(self) -> str: - """ - :returns: The company name set for the Connect App. - """ - return self._properties["company_name"] - - @property - def deauthorize_callback_method(self) -> str: - """ - :returns: The HTTP method we use to call `deauthorize_callback_url`. - """ - return self._properties["deauthorize_callback_method"] - - @property - def deauthorize_callback_url(self) -> str: - """ - :returns: The URL we call using the `deauthorize_callback_method` to de-authorize the Connect App. - """ - return self._properties["deauthorize_callback_url"] - - @property - def description(self) -> str: - """ - :returns: The description of the Connect App. - """ - return self._properties["description"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def homepage_url(self) -> str: - """ - :returns: The public URL where users can obtain more information about this Connect App. - """ - return self._properties["homepage_url"] - - @property - def permissions(self) -> List["ConnectAppInstance.Permission"]: - """ - :returns: The set of permissions that your ConnectApp requests. - """ - return self._properties["permissions"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the ConnectApp resource. - """ - return self._properties["sid"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - def delete(self) -> bool: """ Deletes the ConnectAppInstance diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py b/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py index c13b5c8a2..c5cce7c12 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -52,52 +52,106 @@ class VoiceReceiveMode(object): VOICE = "voice" FAX = "fax" - def __init__(self, version, payload, account_sid: str, sid: Optional[str] = None): - """ - Initialize the IncomingPhoneNumberInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this IncomingPhoneNumber resource. + :ivar address_sid: The SID of the Address resource associated with the phone number. + :ivar address_requirements: + :ivar api_version: The API version used to start a new TwiML session. + :ivar beta: Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. + :ivar capabilities: + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar identity_sid: The SID of the Identity resource that we associate with the phone number. Some regions require an Identity to meet local regulations. + :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + :ivar origin: The phone number's origin. `twilio` identifies Twilio-owned phone numbers and `hosted` identifies hosted phone numbers. + :ivar sid: The unique string that that we created to identify this IncomingPhoneNumber resource. + :ivar sms_application_sid: The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. + :ivar sms_fallback_method: The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. + :ivar sms_fallback_url: The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. + :ivar sms_method: The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. + :ivar sms_url: The URL we call when the phone number receives an incoming SMS message. + :ivar status_callback: The URL we call using the `status_callback_method` to send status information to your application. + :ivar status_callback_method: The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. + :ivar trunk_sid: The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + :ivar voice_receive_mode: + :ivar voice_application_sid: The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. + :ivar voice_caller_id_lookup: Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. + :ivar voice_fallback_method: The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. + :ivar voice_fallback_url: The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. + :ivar voice_method: The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. + :ivar voice_url: The URL we call when the phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. + :ivar emergency_status: + :ivar emergency_address_sid: The SID of the emergency address configuration that we use for emergency calling from this phone number. + :ivar emergency_address_status: + :ivar bundle_sid: The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. + :ivar status: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "address_sid": payload.get("address_sid"), - "address_requirements": payload.get("address_requirements"), - "api_version": payload.get("api_version"), - "beta": payload.get("beta"), - "capabilities": payload.get("capabilities"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "identity_sid": payload.get("identity_sid"), - "phone_number": payload.get("phone_number"), - "origin": payload.get("origin"), - "sid": payload.get("sid"), - "sms_application_sid": payload.get("sms_application_sid"), - "sms_fallback_method": payload.get("sms_fallback_method"), - "sms_fallback_url": payload.get("sms_fallback_url"), - "sms_method": payload.get("sms_method"), - "sms_url": payload.get("sms_url"), - "status_callback": payload.get("status_callback"), - "status_callback_method": payload.get("status_callback_method"), - "trunk_sid": payload.get("trunk_sid"), - "uri": payload.get("uri"), - "voice_receive_mode": payload.get("voice_receive_mode"), - "voice_application_sid": payload.get("voice_application_sid"), - "voice_caller_id_lookup": payload.get("voice_caller_id_lookup"), - "voice_fallback_method": payload.get("voice_fallback_method"), - "voice_fallback_url": payload.get("voice_fallback_url"), - "voice_method": payload.get("voice_method"), - "voice_url": payload.get("voice_url"), - "emergency_status": payload.get("emergency_status"), - "emergency_address_sid": payload.get("emergency_address_sid"), - "emergency_address_status": payload.get("emergency_address_status"), - "bundle_sid": payload.get("bundle_sid"), - "status": payload.get("status"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.address_sid: Optional[str] = payload.get("address_sid") + self.address_requirements: Optional[ + "IncomingPhoneNumberInstance.AddressRequirement" + ] = payload.get("address_requirements") + self.api_version: Optional[str] = payload.get("api_version") + self.beta: Optional[bool] = payload.get("beta") + self.capabilities: Optional[str] = payload.get("capabilities") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.identity_sid: Optional[str] = payload.get("identity_sid") + self.phone_number: Optional[str] = payload.get("phone_number") + self.origin: Optional[str] = payload.get("origin") + self.sid: Optional[str] = payload.get("sid") + self.sms_application_sid: Optional[str] = payload.get("sms_application_sid") + self.sms_fallback_method: Optional[str] = payload.get("sms_fallback_method") + self.sms_fallback_url: Optional[str] = payload.get("sms_fallback_url") + self.sms_method: Optional[str] = payload.get("sms_method") + self.sms_url: Optional[str] = payload.get("sms_url") + self.status_callback: Optional[str] = payload.get("status_callback") + self.status_callback_method: Optional[str] = payload.get( + "status_callback_method" + ) + self.trunk_sid: Optional[str] = payload.get("trunk_sid") + self.uri: Optional[str] = payload.get("uri") + self.voice_receive_mode: Optional[ + "IncomingPhoneNumberInstance.VoiceReceiveMode" + ] = payload.get("voice_receive_mode") + self.voice_application_sid: Optional[str] = payload.get("voice_application_sid") + self.voice_caller_id_lookup: Optional[bool] = payload.get( + "voice_caller_id_lookup" + ) + self.voice_fallback_method: Optional[str] = payload.get("voice_fallback_method") + self.voice_fallback_url: Optional[str] = payload.get("voice_fallback_url") + self.voice_method: Optional[str] = payload.get("voice_method") + self.voice_url: Optional[str] = payload.get("voice_url") + self.emergency_status: Optional[ + "IncomingPhoneNumberInstance.EmergencyStatus" + ] = payload.get("emergency_status") + self.emergency_address_sid: Optional[str] = payload.get("emergency_address_sid") + self.emergency_address_status: Optional[ + "IncomingPhoneNumberInstance.EmergencyAddressStatus" + ] = payload.get("emergency_address_status") + self.bundle_sid: Optional[str] = payload.get("bundle_sid") + self.status: Optional[str] = payload.get("status") self._solution = { "account_sid": account_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[IncomingPhoneNumberContext] = None @@ -117,246 +171,6 @@ def _proxy(self) -> "IncomingPhoneNumberContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this IncomingPhoneNumber resource. - """ - return self._properties["account_sid"] - - @property - def address_sid(self) -> str: - """ - :returns: The SID of the Address resource associated with the phone number. - """ - return self._properties["address_sid"] - - @property - def address_requirements(self) -> "IncomingPhoneNumberInstance.AddressRequirement": - """ - :returns: - """ - return self._properties["address_requirements"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to start a new TwiML session. - """ - return self._properties["api_version"] - - @property - def beta(self) -> bool: - """ - :returns: Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. - """ - return self._properties["beta"] - - @property - def capabilities(self) -> str: - """ - :returns: - """ - return self._properties["capabilities"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def identity_sid(self) -> str: - """ - :returns: The SID of the Identity resource that we associate with the phone number. Some regions require an Identity to meet local regulations. - """ - return self._properties["identity_sid"] - - @property - def phone_number(self) -> str: - """ - :returns: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. - """ - return self._properties["phone_number"] - - @property - def origin(self) -> str: - """ - :returns: The phone number's origin. `twilio` identifies Twilio-owned phone numbers and `hosted` identifies hosted phone numbers. - """ - return self._properties["origin"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify this IncomingPhoneNumber resource. - """ - return self._properties["sid"] - - @property - def sms_application_sid(self) -> str: - """ - :returns: The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. - """ - return self._properties["sms_application_sid"] - - @property - def sms_fallback_method(self) -> str: - """ - :returns: The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. - """ - return self._properties["sms_fallback_method"] - - @property - def sms_fallback_url(self) -> str: - """ - :returns: The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. - """ - return self._properties["sms_fallback_url"] - - @property - def sms_method(self) -> str: - """ - :returns: The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. - """ - return self._properties["sms_method"] - - @property - def sms_url(self) -> str: - """ - :returns: The URL we call when the phone number receives an incoming SMS message. - """ - return self._properties["sms_url"] - - @property - def status_callback(self) -> str: - """ - :returns: The URL we call using the `status_callback_method` to send status information to your application. - """ - return self._properties["status_callback"] - - @property - def status_callback_method(self) -> str: - """ - :returns: The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. - """ - return self._properties["status_callback_method"] - - @property - def trunk_sid(self) -> str: - """ - :returns: The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. - """ - return self._properties["trunk_sid"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def voice_receive_mode(self) -> "IncomingPhoneNumberInstance.VoiceReceiveMode": - """ - :returns: - """ - return self._properties["voice_receive_mode"] - - @property - def voice_application_sid(self) -> str: - """ - :returns: The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. - """ - return self._properties["voice_application_sid"] - - @property - def voice_caller_id_lookup(self) -> bool: - """ - :returns: Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. - """ - return self._properties["voice_caller_id_lookup"] - - @property - def voice_fallback_method(self) -> str: - """ - :returns: The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. - """ - return self._properties["voice_fallback_method"] - - @property - def voice_fallback_url(self) -> str: - """ - :returns: The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. - """ - return self._properties["voice_fallback_url"] - - @property - def voice_method(self) -> str: - """ - :returns: The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. - """ - return self._properties["voice_method"] - - @property - def voice_url(self) -> str: - """ - :returns: The URL we call when the phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. - """ - return self._properties["voice_url"] - - @property - def emergency_status(self) -> "IncomingPhoneNumberInstance.EmergencyStatus": - """ - :returns: - """ - return self._properties["emergency_status"] - - @property - def emergency_address_sid(self) -> str: - """ - :returns: The SID of the emergency address configuration that we use for emergency calling from this phone number. - """ - return self._properties["emergency_address_sid"] - - @property - def emergency_address_status( - self, - ) -> "IncomingPhoneNumberInstance.EmergencyAddressStatus": - """ - :returns: - """ - return self._properties["emergency_address_status"] - - @property - def bundle_sid(self) -> str: - """ - :returns: The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. - """ - return self._properties["bundle_sid"] - - @property - def status(self) -> str: - """ - :returns: - """ - return self._properties["status"] - def delete(self) -> bool: """ Deletes the IncomingPhoneNumberInstance diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__init__.py b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__init__.py index de3da6223..b40c641c5 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__init__.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,37 +27,53 @@ class AssignedAddOnInstance(InstanceResource): + + """ + :ivar sid: The unique string that that we created to identify the resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. + :ivar resource_sid: The SID of the Phone Number to which the Add-on is assigned. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar description: A short description of the functionality that the Add-on provides. + :ivar configuration: A JSON string that represents the current configuration of this Add-on installation. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + :ivar subresource_uris: A list of related resources identified by their relative URIs. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], account_sid: str, resource_sid: str, sid: Optional[str] = None, ): - """ - Initialize the AssignedAddOnInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "resource_sid": payload.get("resource_sid"), - "friendly_name": payload.get("friendly_name"), - "description": payload.get("description"), - "configuration": payload.get("configuration"), - "unique_name": payload.get("unique_name"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "uri": payload.get("uri"), - "subresource_uris": payload.get("subresource_uris"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.resource_sid: Optional[str] = payload.get("resource_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.description: Optional[str] = payload.get("description") + self.configuration: Optional[Dict[str, object]] = payload.get("configuration") + self.unique_name: Optional[str] = payload.get("unique_name") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.uri: Optional[str] = payload.get("uri") + self.subresource_uris: Optional[Dict[str, object]] = payload.get( + "subresource_uris" + ) self._solution = { "account_sid": account_sid, "resource_sid": resource_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[AssignedAddOnContext] = None @@ -78,83 +94,6 @@ def _proxy(self) -> "AssignedAddOnContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. - """ - return self._properties["account_sid"] - - @property - def resource_sid(self) -> str: - """ - :returns: The SID of the Phone Number to which the Add-on is assigned. - """ - return self._properties["resource_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def description(self) -> str: - """ - :returns: A short description of the functionality that the Add-on provides. - """ - return self._properties["description"] - - @property - def configuration(self) -> Dict[str, object]: - """ - :returns: A JSON string that represents the current configuration of this Add-on installation. - """ - return self._properties["configuration"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - """ - return self._properties["unique_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def subresource_uris(self) -> Dict[str, object]: - """ - :returns: A list of related resources identified by their relative URIs. - """ - return self._properties["subresource_uris"] - def delete(self) -> bool: """ Deletes the AssignedAddOnInstance diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py index 10695812a..4aada4361 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/assigned_add_on/assigned_add_on_extension.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,37 +23,45 @@ class AssignedAddOnExtensionInstance(InstanceResource): + + """ + :ivar sid: The unique string that that we created to identify the resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. + :ivar resource_sid: The SID of the Phone Number to which the Add-on is assigned. + :ivar assigned_add_on_sid: The SID that uniquely identifies the assigned Add-on installation. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar product_name: A string that you assigned to describe the Product this Extension is used within. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + :ivar enabled: Whether the Extension will be invoked. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], account_sid: str, resource_sid: str, assigned_add_on_sid: str, sid: Optional[str] = None, ): - """ - Initialize the AssignedAddOnExtensionInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "resource_sid": payload.get("resource_sid"), - "assigned_add_on_sid": payload.get("assigned_add_on_sid"), - "friendly_name": payload.get("friendly_name"), - "product_name": payload.get("product_name"), - "unique_name": payload.get("unique_name"), - "uri": payload.get("uri"), - "enabled": payload.get("enabled"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.resource_sid: Optional[str] = payload.get("resource_sid") + self.assigned_add_on_sid: Optional[str] = payload.get("assigned_add_on_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.product_name: Optional[str] = payload.get("product_name") + self.unique_name: Optional[str] = payload.get("unique_name") + self.uri: Optional[str] = payload.get("uri") + self.enabled: Optional[bool] = payload.get("enabled") self._solution = { "account_sid": account_sid, "resource_sid": resource_sid, "assigned_add_on_sid": assigned_add_on_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[AssignedAddOnExtensionContext] = None @@ -75,69 +83,6 @@ def _proxy(self) -> "AssignedAddOnExtensionContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. - """ - return self._properties["account_sid"] - - @property - def resource_sid(self) -> str: - """ - :returns: The SID of the Phone Number to which the Add-on is assigned. - """ - return self._properties["resource_sid"] - - @property - def assigned_add_on_sid(self) -> str: - """ - :returns: The SID that uniquely identifies the assigned Add-on installation. - """ - return self._properties["assigned_add_on_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def product_name(self) -> str: - """ - :returns: A string that you assigned to describe the Product this Extension is used within. - """ - return self._properties["product_name"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - """ - return self._properties["unique_name"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def enabled(self) -> bool: - """ - :returns: Whether the Extension will be invoked. - """ - return self._properties["enabled"] - def fetch(self) -> "AssignedAddOnExtensionInstance": """ Fetch the AssignedAddOnExtensionInstance diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/local.py b/twilio/rest/api/v2010/account/incoming_phone_number/local.py index e32aa5985..7c588a7cc 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/local.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/local.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -46,291 +46,101 @@ class VoiceReceiveMode(object): VOICE = "voice" FAX = "fax" - def __init__(self, version, payload, account_sid: str): - """ - Initialize the LocalInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. + :ivar address_sid: The SID of the Address resource associated with the phone number. + :ivar address_requirements: + :ivar api_version: The API version used to start a new TwiML session. + :ivar beta: Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. + :ivar capabilities: + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar identity_sid: The SID of the Identity resource that we associate with the phone number. Some regions require an Identity to meet local regulations. + :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + :ivar origin: The phone number's origin. `twilio` identifies Twilio-owned phone numbers and `hosted` identifies hosted phone numbers. + :ivar sid: The unique string that that we created to identify the resource. + :ivar sms_application_sid: The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. + :ivar sms_fallback_method: The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. + :ivar sms_fallback_url: The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. + :ivar sms_method: The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. + :ivar sms_url: The URL we call when the phone number receives an incoming SMS message. + :ivar status_callback: The URL we call using the `status_callback_method` to send status information to your application. + :ivar status_callback_method: The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. + :ivar trunk_sid: The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + :ivar voice_receive_mode: + :ivar voice_application_sid: The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. + :ivar voice_caller_id_lookup: Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. + :ivar voice_fallback_method: The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. + :ivar voice_fallback_url: The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. + :ivar voice_method: The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. + :ivar voice_url: The URL we call when this phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. + :ivar emergency_status: + :ivar emergency_address_sid: The SID of the emergency address configuration that we use for emergency calling from this phone number. + :ivar emergency_address_status: + :ivar bundle_sid: The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. + :ivar status: + """ + + def __init__(self, version: Version, payload: Dict[str, Any], account_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "address_sid": payload.get("address_sid"), - "address_requirements": payload.get("address_requirements"), - "api_version": payload.get("api_version"), - "beta": payload.get("beta"), - "capabilities": payload.get("capabilities"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "identity_sid": payload.get("identity_sid"), - "phone_number": payload.get("phone_number"), - "origin": payload.get("origin"), - "sid": payload.get("sid"), - "sms_application_sid": payload.get("sms_application_sid"), - "sms_fallback_method": payload.get("sms_fallback_method"), - "sms_fallback_url": payload.get("sms_fallback_url"), - "sms_method": payload.get("sms_method"), - "sms_url": payload.get("sms_url"), - "status_callback": payload.get("status_callback"), - "status_callback_method": payload.get("status_callback_method"), - "trunk_sid": payload.get("trunk_sid"), - "uri": payload.get("uri"), - "voice_receive_mode": payload.get("voice_receive_mode"), - "voice_application_sid": payload.get("voice_application_sid"), - "voice_caller_id_lookup": payload.get("voice_caller_id_lookup"), - "voice_fallback_method": payload.get("voice_fallback_method"), - "voice_fallback_url": payload.get("voice_fallback_url"), - "voice_method": payload.get("voice_method"), - "voice_url": payload.get("voice_url"), - "emergency_status": payload.get("emergency_status"), - "emergency_address_sid": payload.get("emergency_address_sid"), - "emergency_address_status": payload.get("emergency_address_status"), - "bundle_sid": payload.get("bundle_sid"), - "status": payload.get("status"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.address_sid: Optional[str] = payload.get("address_sid") + self.address_requirements: Optional[ + "LocalInstance.AddressRequirement" + ] = payload.get("address_requirements") + self.api_version: Optional[str] = payload.get("api_version") + self.beta: Optional[bool] = payload.get("beta") + self.capabilities: Optional[str] = payload.get("capabilities") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.identity_sid: Optional[str] = payload.get("identity_sid") + self.phone_number: Optional[str] = payload.get("phone_number") + self.origin: Optional[str] = payload.get("origin") + self.sid: Optional[str] = payload.get("sid") + self.sms_application_sid: Optional[str] = payload.get("sms_application_sid") + self.sms_fallback_method: Optional[str] = payload.get("sms_fallback_method") + self.sms_fallback_url: Optional[str] = payload.get("sms_fallback_url") + self.sms_method: Optional[str] = payload.get("sms_method") + self.sms_url: Optional[str] = payload.get("sms_url") + self.status_callback: Optional[str] = payload.get("status_callback") + self.status_callback_method: Optional[str] = payload.get( + "status_callback_method" + ) + self.trunk_sid: Optional[str] = payload.get("trunk_sid") + self.uri: Optional[str] = payload.get("uri") + self.voice_receive_mode: Optional[ + "LocalInstance.VoiceReceiveMode" + ] = payload.get("voice_receive_mode") + self.voice_application_sid: Optional[str] = payload.get("voice_application_sid") + self.voice_caller_id_lookup: Optional[bool] = payload.get( + "voice_caller_id_lookup" + ) + self.voice_fallback_method: Optional[str] = payload.get("voice_fallback_method") + self.voice_fallback_url: Optional[str] = payload.get("voice_fallback_url") + self.voice_method: Optional[str] = payload.get("voice_method") + self.voice_url: Optional[str] = payload.get("voice_url") + self.emergency_status: Optional["LocalInstance.EmergencyStatus"] = payload.get( + "emergency_status" + ) + self.emergency_address_sid: Optional[str] = payload.get("emergency_address_sid") + self.emergency_address_status: Optional[ + "LocalInstance.EmergencyAddressStatus" + ] = payload.get("emergency_address_status") + self.bundle_sid: Optional[str] = payload.get("bundle_sid") + self.status: Optional[str] = payload.get("status") self._solution = { "account_sid": account_sid, } - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. - """ - return self._properties["account_sid"] - - @property - def address_sid(self) -> str: - """ - :returns: The SID of the Address resource associated with the phone number. - """ - return self._properties["address_sid"] - - @property - def address_requirements(self) -> "LocalInstance.AddressRequirement": - """ - :returns: - """ - return self._properties["address_requirements"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to start a new TwiML session. - """ - return self._properties["api_version"] - - @property - def beta(self) -> bool: - """ - :returns: Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. - """ - return self._properties["beta"] - - @property - def capabilities(self) -> str: - """ - :returns: - """ - return self._properties["capabilities"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def identity_sid(self) -> str: - """ - :returns: The SID of the Identity resource that we associate with the phone number. Some regions require an Identity to meet local regulations. - """ - return self._properties["identity_sid"] - - @property - def phone_number(self) -> str: - """ - :returns: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. - """ - return self._properties["phone_number"] - - @property - def origin(self) -> str: - """ - :returns: The phone number's origin. `twilio` identifies Twilio-owned phone numbers and `hosted` identifies hosted phone numbers. - """ - return self._properties["origin"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the resource. - """ - return self._properties["sid"] - - @property - def sms_application_sid(self) -> str: - """ - :returns: The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. - """ - return self._properties["sms_application_sid"] - - @property - def sms_fallback_method(self) -> str: - """ - :returns: The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. - """ - return self._properties["sms_fallback_method"] - - @property - def sms_fallback_url(self) -> str: - """ - :returns: The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. - """ - return self._properties["sms_fallback_url"] - - @property - def sms_method(self) -> str: - """ - :returns: The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. - """ - return self._properties["sms_method"] - - @property - def sms_url(self) -> str: - """ - :returns: The URL we call when the phone number receives an incoming SMS message. - """ - return self._properties["sms_url"] - - @property - def status_callback(self) -> str: - """ - :returns: The URL we call using the `status_callback_method` to send status information to your application. - """ - return self._properties["status_callback"] - - @property - def status_callback_method(self) -> str: - """ - :returns: The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. - """ - return self._properties["status_callback_method"] - - @property - def trunk_sid(self) -> str: - """ - :returns: The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. - """ - return self._properties["trunk_sid"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def voice_receive_mode(self) -> "LocalInstance.VoiceReceiveMode": - """ - :returns: - """ - return self._properties["voice_receive_mode"] - - @property - def voice_application_sid(self) -> str: - """ - :returns: The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. - """ - return self._properties["voice_application_sid"] - - @property - def voice_caller_id_lookup(self) -> bool: - """ - :returns: Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. - """ - return self._properties["voice_caller_id_lookup"] - - @property - def voice_fallback_method(self) -> str: - """ - :returns: The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. - """ - return self._properties["voice_fallback_method"] - - @property - def voice_fallback_url(self) -> str: - """ - :returns: The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. - """ - return self._properties["voice_fallback_url"] - - @property - def voice_method(self) -> str: - """ - :returns: The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. - """ - return self._properties["voice_method"] - - @property - def voice_url(self) -> str: - """ - :returns: The URL we call when this phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. - """ - return self._properties["voice_url"] - - @property - def emergency_status(self) -> "LocalInstance.EmergencyStatus": - """ - :returns: - """ - return self._properties["emergency_status"] - - @property - def emergency_address_sid(self) -> str: - """ - :returns: The SID of the emergency address configuration that we use for emergency calling from this phone number. - """ - return self._properties["emergency_address_sid"] - - @property - def emergency_address_status(self) -> "LocalInstance.EmergencyAddressStatus": - """ - :returns: - """ - return self._properties["emergency_address_status"] - - @property - def bundle_sid(self) -> str: - """ - :returns: The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. - """ - return self._properties["bundle_sid"] - - @property - def status(self) -> str: - """ - :returns: - """ - return self._properties["status"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py b/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py index 9122be963..ade7396be 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/mobile.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -46,291 +46,101 @@ class VoiceReceiveMode(object): VOICE = "voice" FAX = "fax" - def __init__(self, version, payload, account_sid: str): - """ - Initialize the MobileInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. + :ivar address_sid: The SID of the Address resource associated with the phone number. + :ivar address_requirements: + :ivar api_version: The API version used to start a new TwiML session. + :ivar beta: Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. + :ivar capabilities: + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar identity_sid: The SID of the Identity resource that we associate with the phone number. Some regions require an Identity to meet local regulations. + :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + :ivar origin: The phone number's origin. `twilio` identifies Twilio-owned phone numbers and `hosted` identifies hosted phone numbers. + :ivar sid: The unique string that that we created to identify the resource. + :ivar sms_application_sid: The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. + :ivar sms_fallback_method: The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. + :ivar sms_fallback_url: The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. + :ivar sms_method: The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. + :ivar sms_url: The URL we call when the phone number receives an incoming SMS message. + :ivar status_callback: The URL we call using the `status_callback_method` to send status information to your application. + :ivar status_callback_method: The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. + :ivar trunk_sid: The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + :ivar voice_receive_mode: + :ivar voice_application_sid: The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. + :ivar voice_caller_id_lookup: Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. + :ivar voice_fallback_method: The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. + :ivar voice_fallback_url: The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. + :ivar voice_method: The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. + :ivar voice_url: The URL we call when the phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. + :ivar emergency_status: + :ivar emergency_address_sid: The SID of the emergency address configuration that we use for emergency calling from this phone number. + :ivar emergency_address_status: + :ivar bundle_sid: The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. + :ivar status: + """ + + def __init__(self, version: Version, payload: Dict[str, Any], account_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "address_sid": payload.get("address_sid"), - "address_requirements": payload.get("address_requirements"), - "api_version": payload.get("api_version"), - "beta": payload.get("beta"), - "capabilities": payload.get("capabilities"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "identity_sid": payload.get("identity_sid"), - "phone_number": payload.get("phone_number"), - "origin": payload.get("origin"), - "sid": payload.get("sid"), - "sms_application_sid": payload.get("sms_application_sid"), - "sms_fallback_method": payload.get("sms_fallback_method"), - "sms_fallback_url": payload.get("sms_fallback_url"), - "sms_method": payload.get("sms_method"), - "sms_url": payload.get("sms_url"), - "status_callback": payload.get("status_callback"), - "status_callback_method": payload.get("status_callback_method"), - "trunk_sid": payload.get("trunk_sid"), - "uri": payload.get("uri"), - "voice_receive_mode": payload.get("voice_receive_mode"), - "voice_application_sid": payload.get("voice_application_sid"), - "voice_caller_id_lookup": payload.get("voice_caller_id_lookup"), - "voice_fallback_method": payload.get("voice_fallback_method"), - "voice_fallback_url": payload.get("voice_fallback_url"), - "voice_method": payload.get("voice_method"), - "voice_url": payload.get("voice_url"), - "emergency_status": payload.get("emergency_status"), - "emergency_address_sid": payload.get("emergency_address_sid"), - "emergency_address_status": payload.get("emergency_address_status"), - "bundle_sid": payload.get("bundle_sid"), - "status": payload.get("status"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.address_sid: Optional[str] = payload.get("address_sid") + self.address_requirements: Optional[ + "MobileInstance.AddressRequirement" + ] = payload.get("address_requirements") + self.api_version: Optional[str] = payload.get("api_version") + self.beta: Optional[bool] = payload.get("beta") + self.capabilities: Optional[str] = payload.get("capabilities") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.identity_sid: Optional[str] = payload.get("identity_sid") + self.phone_number: Optional[str] = payload.get("phone_number") + self.origin: Optional[str] = payload.get("origin") + self.sid: Optional[str] = payload.get("sid") + self.sms_application_sid: Optional[str] = payload.get("sms_application_sid") + self.sms_fallback_method: Optional[str] = payload.get("sms_fallback_method") + self.sms_fallback_url: Optional[str] = payload.get("sms_fallback_url") + self.sms_method: Optional[str] = payload.get("sms_method") + self.sms_url: Optional[str] = payload.get("sms_url") + self.status_callback: Optional[str] = payload.get("status_callback") + self.status_callback_method: Optional[str] = payload.get( + "status_callback_method" + ) + self.trunk_sid: Optional[str] = payload.get("trunk_sid") + self.uri: Optional[str] = payload.get("uri") + self.voice_receive_mode: Optional[ + "MobileInstance.VoiceReceiveMode" + ] = payload.get("voice_receive_mode") + self.voice_application_sid: Optional[str] = payload.get("voice_application_sid") + self.voice_caller_id_lookup: Optional[bool] = payload.get( + "voice_caller_id_lookup" + ) + self.voice_fallback_method: Optional[str] = payload.get("voice_fallback_method") + self.voice_fallback_url: Optional[str] = payload.get("voice_fallback_url") + self.voice_method: Optional[str] = payload.get("voice_method") + self.voice_url: Optional[str] = payload.get("voice_url") + self.emergency_status: Optional["MobileInstance.EmergencyStatus"] = payload.get( + "emergency_status" + ) + self.emergency_address_sid: Optional[str] = payload.get("emergency_address_sid") + self.emergency_address_status: Optional[ + "MobileInstance.EmergencyAddressStatus" + ] = payload.get("emergency_address_status") + self.bundle_sid: Optional[str] = payload.get("bundle_sid") + self.status: Optional[str] = payload.get("status") self._solution = { "account_sid": account_sid, } - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. - """ - return self._properties["account_sid"] - - @property - def address_sid(self) -> str: - """ - :returns: The SID of the Address resource associated with the phone number. - """ - return self._properties["address_sid"] - - @property - def address_requirements(self) -> "MobileInstance.AddressRequirement": - """ - :returns: - """ - return self._properties["address_requirements"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to start a new TwiML session. - """ - return self._properties["api_version"] - - @property - def beta(self) -> bool: - """ - :returns: Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. - """ - return self._properties["beta"] - - @property - def capabilities(self) -> str: - """ - :returns: - """ - return self._properties["capabilities"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def identity_sid(self) -> str: - """ - :returns: The SID of the Identity resource that we associate with the phone number. Some regions require an Identity to meet local regulations. - """ - return self._properties["identity_sid"] - - @property - def phone_number(self) -> str: - """ - :returns: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. - """ - return self._properties["phone_number"] - - @property - def origin(self) -> str: - """ - :returns: The phone number's origin. `twilio` identifies Twilio-owned phone numbers and `hosted` identifies hosted phone numbers. - """ - return self._properties["origin"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the resource. - """ - return self._properties["sid"] - - @property - def sms_application_sid(self) -> str: - """ - :returns: The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. - """ - return self._properties["sms_application_sid"] - - @property - def sms_fallback_method(self) -> str: - """ - :returns: The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. - """ - return self._properties["sms_fallback_method"] - - @property - def sms_fallback_url(self) -> str: - """ - :returns: The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. - """ - return self._properties["sms_fallback_url"] - - @property - def sms_method(self) -> str: - """ - :returns: The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. - """ - return self._properties["sms_method"] - - @property - def sms_url(self) -> str: - """ - :returns: The URL we call when the phone number receives an incoming SMS message. - """ - return self._properties["sms_url"] - - @property - def status_callback(self) -> str: - """ - :returns: The URL we call using the `status_callback_method` to send status information to your application. - """ - return self._properties["status_callback"] - - @property - def status_callback_method(self) -> str: - """ - :returns: The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. - """ - return self._properties["status_callback_method"] - - @property - def trunk_sid(self) -> str: - """ - :returns: The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. - """ - return self._properties["trunk_sid"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def voice_receive_mode(self) -> "MobileInstance.VoiceReceiveMode": - """ - :returns: - """ - return self._properties["voice_receive_mode"] - - @property - def voice_application_sid(self) -> str: - """ - :returns: The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. - """ - return self._properties["voice_application_sid"] - - @property - def voice_caller_id_lookup(self) -> bool: - """ - :returns: Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. - """ - return self._properties["voice_caller_id_lookup"] - - @property - def voice_fallback_method(self) -> str: - """ - :returns: The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. - """ - return self._properties["voice_fallback_method"] - - @property - def voice_fallback_url(self) -> str: - """ - :returns: The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. - """ - return self._properties["voice_fallback_url"] - - @property - def voice_method(self) -> str: - """ - :returns: The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. - """ - return self._properties["voice_method"] - - @property - def voice_url(self) -> str: - """ - :returns: The URL we call when the phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. - """ - return self._properties["voice_url"] - - @property - def emergency_status(self) -> "MobileInstance.EmergencyStatus": - """ - :returns: - """ - return self._properties["emergency_status"] - - @property - def emergency_address_sid(self) -> str: - """ - :returns: The SID of the emergency address configuration that we use for emergency calling from this phone number. - """ - return self._properties["emergency_address_sid"] - - @property - def emergency_address_status(self) -> "MobileInstance.EmergencyAddressStatus": - """ - :returns: - """ - return self._properties["emergency_address_status"] - - @property - def bundle_sid(self) -> str: - """ - :returns: The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. - """ - return self._properties["bundle_sid"] - - @property - def status(self) -> str: - """ - :returns: - """ - return self._properties["status"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py b/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py index d3ba28ef9..b863d3ccb 100644 --- a/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py +++ b/twilio/rest/api/v2010/account/incoming_phone_number/toll_free.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -46,291 +46,101 @@ class VoiceReceiveMode(object): VOICE = "voice" FAX = "fax" - def __init__(self, version, payload, account_sid: str): - """ - Initialize the TollFreeInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. + :ivar address_sid: The SID of the Address resource associated with the phone number. + :ivar address_requirements: + :ivar api_version: The API version used to start a new TwiML session. + :ivar beta: Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. + :ivar capabilities: + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar identity_sid: The SID of the Identity resource that we associate with the phone number. Some regions require an Identity to meet local regulations. + :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + :ivar origin: The phone number's origin. `twilio` identifies Twilio-owned phone numbers and `hosted` identifies hosted phone numbers. + :ivar sid: The unique string that that we created to identify the resource. + :ivar sms_application_sid: The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. + :ivar sms_fallback_method: The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. + :ivar sms_fallback_url: The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. + :ivar sms_method: The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. + :ivar sms_url: The URL we call when the phone number receives an incoming SMS message. + :ivar status_callback: The URL we call using the `status_callback_method` to send status information to your application. + :ivar status_callback_method: The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. + :ivar trunk_sid: The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + :ivar voice_receive_mode: + :ivar voice_application_sid: The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. + :ivar voice_caller_id_lookup: Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. + :ivar voice_fallback_method: The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. + :ivar voice_fallback_url: The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. + :ivar voice_method: The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. + :ivar voice_url: The URL we call when the phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. + :ivar emergency_status: + :ivar emergency_address_sid: The SID of the emergency address configuration that we use for emergency calling from this phone number. + :ivar emergency_address_status: + :ivar bundle_sid: The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. + :ivar status: + """ + + def __init__(self, version: Version, payload: Dict[str, Any], account_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "address_sid": payload.get("address_sid"), - "address_requirements": payload.get("address_requirements"), - "api_version": payload.get("api_version"), - "beta": payload.get("beta"), - "capabilities": payload.get("capabilities"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "identity_sid": payload.get("identity_sid"), - "phone_number": payload.get("phone_number"), - "origin": payload.get("origin"), - "sid": payload.get("sid"), - "sms_application_sid": payload.get("sms_application_sid"), - "sms_fallback_method": payload.get("sms_fallback_method"), - "sms_fallback_url": payload.get("sms_fallback_url"), - "sms_method": payload.get("sms_method"), - "sms_url": payload.get("sms_url"), - "status_callback": payload.get("status_callback"), - "status_callback_method": payload.get("status_callback_method"), - "trunk_sid": payload.get("trunk_sid"), - "uri": payload.get("uri"), - "voice_receive_mode": payload.get("voice_receive_mode"), - "voice_application_sid": payload.get("voice_application_sid"), - "voice_caller_id_lookup": payload.get("voice_caller_id_lookup"), - "voice_fallback_method": payload.get("voice_fallback_method"), - "voice_fallback_url": payload.get("voice_fallback_url"), - "voice_method": payload.get("voice_method"), - "voice_url": payload.get("voice_url"), - "emergency_status": payload.get("emergency_status"), - "emergency_address_sid": payload.get("emergency_address_sid"), - "emergency_address_status": payload.get("emergency_address_status"), - "bundle_sid": payload.get("bundle_sid"), - "status": payload.get("status"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.address_sid: Optional[str] = payload.get("address_sid") + self.address_requirements: Optional[ + "TollFreeInstance.AddressRequirement" + ] = payload.get("address_requirements") + self.api_version: Optional[str] = payload.get("api_version") + self.beta: Optional[bool] = payload.get("beta") + self.capabilities: Optional[str] = payload.get("capabilities") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.identity_sid: Optional[str] = payload.get("identity_sid") + self.phone_number: Optional[str] = payload.get("phone_number") + self.origin: Optional[str] = payload.get("origin") + self.sid: Optional[str] = payload.get("sid") + self.sms_application_sid: Optional[str] = payload.get("sms_application_sid") + self.sms_fallback_method: Optional[str] = payload.get("sms_fallback_method") + self.sms_fallback_url: Optional[str] = payload.get("sms_fallback_url") + self.sms_method: Optional[str] = payload.get("sms_method") + self.sms_url: Optional[str] = payload.get("sms_url") + self.status_callback: Optional[str] = payload.get("status_callback") + self.status_callback_method: Optional[str] = payload.get( + "status_callback_method" + ) + self.trunk_sid: Optional[str] = payload.get("trunk_sid") + self.uri: Optional[str] = payload.get("uri") + self.voice_receive_mode: Optional[ + "TollFreeInstance.VoiceReceiveMode" + ] = payload.get("voice_receive_mode") + self.voice_application_sid: Optional[str] = payload.get("voice_application_sid") + self.voice_caller_id_lookup: Optional[bool] = payload.get( + "voice_caller_id_lookup" + ) + self.voice_fallback_method: Optional[str] = payload.get("voice_fallback_method") + self.voice_fallback_url: Optional[str] = payload.get("voice_fallback_url") + self.voice_method: Optional[str] = payload.get("voice_method") + self.voice_url: Optional[str] = payload.get("voice_url") + self.emergency_status: Optional[ + "TollFreeInstance.EmergencyStatus" + ] = payload.get("emergency_status") + self.emergency_address_sid: Optional[str] = payload.get("emergency_address_sid") + self.emergency_address_status: Optional[ + "TollFreeInstance.EmergencyAddressStatus" + ] = payload.get("emergency_address_status") + self.bundle_sid: Optional[str] = payload.get("bundle_sid") + self.status: Optional[str] = payload.get("status") self._solution = { "account_sid": account_sid, } - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the resource. - """ - return self._properties["account_sid"] - - @property - def address_sid(self) -> str: - """ - :returns: The SID of the Address resource associated with the phone number. - """ - return self._properties["address_sid"] - - @property - def address_requirements(self) -> "TollFreeInstance.AddressRequirement": - """ - :returns: - """ - return self._properties["address_requirements"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to start a new TwiML session. - """ - return self._properties["api_version"] - - @property - def beta(self) -> bool: - """ - :returns: Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. - """ - return self._properties["beta"] - - @property - def capabilities(self) -> str: - """ - :returns: - """ - return self._properties["capabilities"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def identity_sid(self) -> str: - """ - :returns: The SID of the Identity resource that we associate with the phone number. Some regions require an Identity to meet local regulations. - """ - return self._properties["identity_sid"] - - @property - def phone_number(self) -> str: - """ - :returns: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. - """ - return self._properties["phone_number"] - - @property - def origin(self) -> str: - """ - :returns: The phone number's origin. `twilio` identifies Twilio-owned phone numbers and `hosted` identifies hosted phone numbers. - """ - return self._properties["origin"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the resource. - """ - return self._properties["sid"] - - @property - def sms_application_sid(self) -> str: - """ - :returns: The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. - """ - return self._properties["sms_application_sid"] - - @property - def sms_fallback_method(self) -> str: - """ - :returns: The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. - """ - return self._properties["sms_fallback_method"] - - @property - def sms_fallback_url(self) -> str: - """ - :returns: The URL that we call when an error occurs while retrieving or executing the TwiML from `sms_url`. - """ - return self._properties["sms_fallback_url"] - - @property - def sms_method(self) -> str: - """ - :returns: The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. - """ - return self._properties["sms_method"] - - @property - def sms_url(self) -> str: - """ - :returns: The URL we call when the phone number receives an incoming SMS message. - """ - return self._properties["sms_url"] - - @property - def status_callback(self) -> str: - """ - :returns: The URL we call using the `status_callback_method` to send status information to your application. - """ - return self._properties["status_callback"] - - @property - def status_callback_method(self) -> str: - """ - :returns: The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. - """ - return self._properties["status_callback_method"] - - @property - def trunk_sid(self) -> str: - """ - :returns: The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. - """ - return self._properties["trunk_sid"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def voice_receive_mode(self) -> "TollFreeInstance.VoiceReceiveMode": - """ - :returns: - """ - return self._properties["voice_receive_mode"] - - @property - def voice_application_sid(self) -> str: - """ - :returns: The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. - """ - return self._properties["voice_application_sid"] - - @property - def voice_caller_id_lookup(self) -> bool: - """ - :returns: Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. - """ - return self._properties["voice_caller_id_lookup"] - - @property - def voice_fallback_method(self) -> str: - """ - :returns: The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. - """ - return self._properties["voice_fallback_method"] - - @property - def voice_fallback_url(self) -> str: - """ - :returns: The URL that we call when an error occurs retrieving or executing the TwiML requested by `url`. - """ - return self._properties["voice_fallback_url"] - - @property - def voice_method(self) -> str: - """ - :returns: The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. - """ - return self._properties["voice_method"] - - @property - def voice_url(self) -> str: - """ - :returns: The URL we call when the phone number receives a call. The `voice_url` will not be used if a `voice_application_sid` or a `trunk_sid` is set. - """ - return self._properties["voice_url"] - - @property - def emergency_status(self) -> "TollFreeInstance.EmergencyStatus": - """ - :returns: - """ - return self._properties["emergency_status"] - - @property - def emergency_address_sid(self) -> str: - """ - :returns: The SID of the emergency address configuration that we use for emergency calling from this phone number. - """ - return self._properties["emergency_address_sid"] - - @property - def emergency_address_status(self) -> "TollFreeInstance.EmergencyAddressStatus": - """ - :returns: - """ - return self._properties["emergency_address_status"] - - @property - def bundle_sid(self) -> str: - """ - :returns: The SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations. - """ - return self._properties["bundle_sid"] - - @property - def status(self) -> str: - """ - :returns: - """ - return self._properties["status"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/key.py b/twilio/rest/api/v2010/account/key.py index 2566e3b71..26e1004c1 100644 --- a/twilio/rest/api/v2010/account/key.py +++ b/twilio/rest/api/v2010/account/key.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,22 +24,35 @@ class KeyInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, sid: Optional[str] = None): - """ - Initialize the KeyInstance - """ + + """ + :ivar sid: The unique string that that we created to identify the Key resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "friendly_name": payload.get("friendly_name"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - } + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) self._solution = { "account_sid": account_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[KeyContext] = None @@ -59,34 +72,6 @@ def _proxy(self) -> "KeyContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the Key resource. - """ - return self._properties["sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - def delete(self) -> bool: """ Deletes the KeyInstance diff --git a/twilio/rest/api/v2010/account/message/__init__.py b/twilio/rest/api/v2010/account/message/__init__.py index 6c44df436..ade3ace01 100644 --- a/twilio/rest/api/v2010/account/message/__init__.py +++ b/twilio/rest/api/v2010/account/message/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -47,38 +47,70 @@ class Status(object): PARTIALLY_DELIVERED = "partially_delivered" CANCELED = "canceled" - def __init__(self, version, payload, account_sid: str, sid: Optional[str] = None): - """ - Initialize the MessageInstance - """ + """ + :ivar body: The message text. Can be up to 1,600 characters long. + :ivar num_segments: The number of segments that make up the complete message. A message body that is too large to be sent in a single SMS message is segmented and charged as multiple messages. Inbound messages over 160 characters are reassembled when the message is received. Note: When using a Messaging Service to send messages, `num_segments` will always be 0 in Twilio's response to your API request. + :ivar direction: + :ivar _from: The phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format), [alphanumeric sender ID](https://www.twilio.com/docs/sms/send-messages#use-an-alphanumeric-sender-id), or [Wireless SIM](https://www.twilio.com/docs/wireless/tutorials/communications-guides/how-to-send-and-receive-text-messages) that initiated the message. For incoming messages, this will be the number of the sending phone. For outgoing messages, this value will be one of your Twilio phone numbers or the alphanumeric sender ID used. + :ivar to: The phone number in [E.164](https://en.wikipedia.org/wiki/E.164) format that received the message. For incoming messages, this will be one of your Twilio phone numbers. For outgoing messages, this will be the sending phone. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar price: The amount billed for the message, in the currency specified by `price_unit`. Note that your account is charged for each segment we send to the handset. Populated after the message has been sent. May not be immediately available. + :ivar error_message: The description of the `error_code` if your message `status` is `failed` or `undelivered`. If the message was successful, this value is null. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that sent the message that created the resource. + :ivar num_media: The number of media files associated with the message. A message can send up to 10 media files. + :ivar status: + :ivar messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/sms/services/api) used with the message. The value is null if a Messaging Service was not used. + :ivar sid: The unique string that that we created to identify the Message resource. + :ivar date_sent: The date and time in GMT that the resource was sent specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. For outgoing messages, this is when we sent the message. For incoming messages, this is when we made the HTTP request to your application. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar error_code: The error code returned if your message `status` is `failed` or `undelivered`. The error_code provides more information about the failure. If the message was successful, this value is null. + :ivar price_unit: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). + :ivar api_version: The API version used to process the message. + :ivar subresource_uris: A list of related resources identified by their URIs relative to `https://api.twilio.com` + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "body": payload.get("body"), - "num_segments": payload.get("num_segments"), - "direction": payload.get("direction"), - "_from": payload.get("from"), - "to": payload.get("to"), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "price": payload.get("price"), - "error_message": payload.get("error_message"), - "uri": payload.get("uri"), - "account_sid": payload.get("account_sid"), - "num_media": payload.get("num_media"), - "status": payload.get("status"), - "messaging_service_sid": payload.get("messaging_service_sid"), - "sid": payload.get("sid"), - "date_sent": deserialize.rfc2822_datetime(payload.get("date_sent")), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "error_code": deserialize.integer(payload.get("error_code")), - "price_unit": payload.get("price_unit"), - "api_version": payload.get("api_version"), - "subresource_uris": payload.get("subresource_uris"), - } + self.body: Optional[str] = payload.get("body") + self.num_segments: Optional[str] = payload.get("num_segments") + self.direction: Optional["MessageInstance.Direction"] = payload.get("direction") + self._from: Optional[str] = payload.get("from") + self.to: Optional[str] = payload.get("to") + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.price: Optional[str] = payload.get("price") + self.error_message: Optional[str] = payload.get("error_message") + self.uri: Optional[str] = payload.get("uri") + self.account_sid: Optional[str] = payload.get("account_sid") + self.num_media: Optional[str] = payload.get("num_media") + self.status: Optional["MessageInstance.Status"] = payload.get("status") + self.messaging_service_sid: Optional[str] = payload.get("messaging_service_sid") + self.sid: Optional[str] = payload.get("sid") + self.date_sent: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_sent") + ) + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.error_code: Optional[int] = deserialize.integer(payload.get("error_code")) + self.price_unit: Optional[str] = payload.get("price_unit") + self.api_version: Optional[str] = payload.get("api_version") + self.subresource_uris: Optional[Dict[str, object]] = payload.get( + "subresource_uris" + ) self._solution = { "account_sid": account_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[MessageContext] = None @@ -98,146 +130,6 @@ def _proxy(self) -> "MessageContext": ) return self._context - @property - def body(self) -> str: - """ - :returns: The message text. Can be up to 1,600 characters long. - """ - return self._properties["body"] - - @property - def num_segments(self) -> str: - """ - :returns: The number of segments that make up the complete message. A message body that is too large to be sent in a single SMS message is segmented and charged as multiple messages. Inbound messages over 160 characters are reassembled when the message is received. Note: When using a Messaging Service to send messages, `num_segments` will always be 0 in Twilio's response to your API request. - """ - return self._properties["num_segments"] - - @property - def direction(self) -> "MessageInstance.Direction": - """ - :returns: - """ - return self._properties["direction"] - - @property - def _from(self) -> str: - """ - :returns: The phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format), [alphanumeric sender ID](https://www.twilio.com/docs/sms/send-messages#use-an-alphanumeric-sender-id), or [Wireless SIM](https://www.twilio.com/docs/wireless/tutorials/communications-guides/how-to-send-and-receive-text-messages) that initiated the message. For incoming messages, this will be the number of the sending phone. For outgoing messages, this value will be one of your Twilio phone numbers or the alphanumeric sender ID used. - """ - return self._properties["_from"] - - @property - def to(self) -> str: - """ - :returns: The phone number in [E.164](https://en.wikipedia.org/wiki/E.164) format that received the message. For incoming messages, this will be one of your Twilio phone numbers. For outgoing messages, this will be the sending phone. - """ - return self._properties["to"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def price(self) -> str: - """ - :returns: The amount billed for the message, in the currency specified by `price_unit`. Note that your account is charged for each segment we send to the handset. Populated after the message has been sent. May not be immediately available. - """ - return self._properties["price"] - - @property - def error_message(self) -> str: - """ - :returns: The description of the `error_code` if your message `status` is `failed` or `undelivered`. If the message was successful, this value is null. - """ - return self._properties["error_message"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that sent the message that created the resource. - """ - return self._properties["account_sid"] - - @property - def num_media(self) -> str: - """ - :returns: The number of media files associated with the message. A message can send up to 10 media files. - """ - return self._properties["num_media"] - - @property - def status(self) -> "MessageInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def messaging_service_sid(self) -> str: - """ - :returns: The SID of the [Messaging Service](https://www.twilio.com/docs/sms/services/api) used with the message. The value is null if a Messaging Service was not used. - """ - return self._properties["messaging_service_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the Message resource. - """ - return self._properties["sid"] - - @property - def date_sent(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was sent specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. For outgoing messages, this is when we sent the message. For incoming messages, this is when we made the HTTP request to your application. - """ - return self._properties["date_sent"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def error_code(self) -> int: - """ - :returns: The error code returned if your message `status` is `failed` or `undelivered`. The error_code provides more information about the failure. If the message was successful, this value is null. - """ - return self._properties["error_code"] - - @property - def price_unit(self) -> str: - """ - :returns: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). - """ - return self._properties["price_unit"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to process the message. - """ - return self._properties["api_version"] - - @property - def subresource_uris(self) -> Dict[str, object]: - """ - :returns: A list of related resources identified by their URIs relative to `https://api.twilio.com` - """ - return self._properties["subresource_uris"] - def delete(self) -> bool: """ Deletes the MessageInstance diff --git a/twilio/rest/api/v2010/account/message/feedback.py b/twilio/rest/api/v2010/account/message/feedback.py index 8820b82a8..398f4956d 100644 --- a/twilio/rest/api/v2010/account/message/feedback.py +++ b/twilio/rest/api/v2010/account/message/feedback.py @@ -14,6 +14,7 @@ from datetime import datetime +from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -26,68 +27,40 @@ class Outcome(object): CONFIRMED = "confirmed" UNCONFIRMED = "unconfirmed" - def __init__(self, version, payload, account_sid: str, message_sid: str): - """ - Initialize the FeedbackInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the MessageFeedback resource. + :ivar message_sid: The SID of the Message resource for which the feedback was provided. + :ivar outcome: + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + message_sid: str, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "message_sid": payload.get("message_sid"), - "outcome": payload.get("outcome"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "uri": payload.get("uri"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.message_sid: Optional[str] = payload.get("message_sid") + self.outcome: Optional["FeedbackInstance.Outcome"] = payload.get("outcome") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.uri: Optional[str] = payload.get("uri") self._solution = { "account_sid": account_sid, "message_sid": message_sid, } - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the MessageFeedback resource. - """ - return self._properties["account_sid"] - - @property - def message_sid(self) -> str: - """ - :returns: The SID of the Message resource for which the feedback was provided. - """ - return self._properties["message_sid"] - - @property - def outcome(self) -> "FeedbackInstance.Outcome": - """ - :returns: - """ - return self._properties["outcome"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/message/media.py b/twilio/rest/api/v2010/account/message/media.py index 9c50303fb..41cbdfe38 100644 --- a/twilio/rest/api/v2010/account/message/media.py +++ b/twilio/rest/api/v2010/account/message/media.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,33 +24,43 @@ class MediaInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Media resource. + :ivar content_type: The default [mime-type](https://en.wikipedia.org/wiki/Internet_media_type) of the media, for example `image/jpeg`, `image/png`, or `image/gif` + :ivar date_created: The date and time in GMT that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar parent_sid: The SID of the resource that created the media. + :ivar sid: The unique string that that we created to identify this Media resource. + :ivar uri: The URI of this resource, relative to `https://api.twilio.com`. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], account_sid: str, message_sid: str, sid: Optional[str] = None, ): - """ - Initialize the MediaInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "content_type": payload.get("content_type"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "parent_sid": payload.get("parent_sid"), - "sid": payload.get("sid"), - "uri": payload.get("uri"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.content_type: Optional[str] = payload.get("content_type") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.parent_sid: Optional[str] = payload.get("parent_sid") + self.sid: Optional[str] = payload.get("sid") + self.uri: Optional[str] = payload.get("uri") self._solution = { "account_sid": account_sid, "message_sid": message_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[MediaContext] = None @@ -71,55 +81,6 @@ def _proxy(self) -> "MediaContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Media resource. - """ - return self._properties["account_sid"] - - @property - def content_type(self) -> str: - """ - :returns: The default [mime-type](https://en.wikipedia.org/wiki/Internet_media_type) of the media, for example `image/jpeg`, `image/png`, or `image/gif` - """ - return self._properties["content_type"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def parent_sid(self) -> str: - """ - :returns: The SID of the resource that created the media. - """ - return self._properties["parent_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify this Media resource. - """ - return self._properties["sid"] - - @property - def uri(self) -> str: - """ - :returns: The URI of this resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - def delete(self) -> bool: """ Deletes the MediaInstance diff --git a/twilio/rest/api/v2010/account/new_key.py b/twilio/rest/api/v2010/account/new_key.py index 05c960dfe..5d0ac74bf 100644 --- a/twilio/rest/api/v2010/account/new_key.py +++ b/twilio/rest/api/v2010/account/new_key.py @@ -14,6 +14,7 @@ from datetime import datetime +from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -22,59 +23,32 @@ class NewKeyInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str): - """ - Initialize the NewKeyInstance - """ + + """ + :ivar sid: The unique string that that we created to identify the NewKey resource. You will use this as the basic-auth `user` when authenticating to the API. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar date_created: The date and time in GMT that the API Key was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the new API Key was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar secret: The secret your application uses to sign Access Tokens and to authenticate to the REST API (you will use this as the basic-auth `password`). **Note that for security reasons, this field is ONLY returned when the API Key is first created.** + """ + + def __init__(self, version: Version, payload: Dict[str, Any], account_sid: str): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "friendly_name": payload.get("friendly_name"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "secret": payload.get("secret"), - } + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.secret: Optional[str] = payload.get("secret") self._solution = { "account_sid": account_sid, } - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the NewKey resource. You will use this as the basic-auth `user` when authenticating to the API. - """ - return self._properties["sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the API Key was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the new API Key was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def secret(self) -> str: - """ - :returns: The secret your application uses to sign Access Tokens and to authenticate to the REST API (you will use this as the basic-auth `password`). **Note that for security reasons, this field is ONLY returned when the API Key is first created.** - """ - return self._properties["secret"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/new_signing_key.py b/twilio/rest/api/v2010/account/new_signing_key.py index a314a6262..3cf7bfebb 100644 --- a/twilio/rest/api/v2010/account/new_signing_key.py +++ b/twilio/rest/api/v2010/account/new_signing_key.py @@ -14,6 +14,7 @@ from datetime import datetime +from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -22,59 +23,32 @@ class NewSigningKeyInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str): - """ - Initialize the NewSigningKeyInstance - """ + + """ + :ivar sid: The unique string that that we created to identify the NewSigningKey resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar secret: The secret your application uses to sign Access Tokens and to authenticate to the REST API (you will use this as the basic-auth `password`). **Note that for security reasons, this field is ONLY returned when the API Key is first created.** + """ + + def __init__(self, version: Version, payload: Dict[str, Any], account_sid: str): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "friendly_name": payload.get("friendly_name"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "secret": payload.get("secret"), - } + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.secret: Optional[str] = payload.get("secret") self._solution = { "account_sid": account_sid, } - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the NewSigningKey resource. - """ - return self._properties["sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def secret(self) -> str: - """ - :returns: The secret your application uses to sign Access Tokens and to authenticate to the REST API (you will use this as the basic-auth `password`). **Note that for security reasons, this field is ONLY returned when the API Key is first created.** - """ - return self._properties["secret"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/notification.py b/twilio/rest/api/v2010/account/notification.py index 279ef311f..c3e860317 100644 --- a/twilio/rest/api/v2010/account/notification.py +++ b/twilio/rest/api/v2010/account/notification.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,35 +24,63 @@ class NotificationInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, sid: Optional[str] = None): - """ - Initialize the NotificationInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Notification resource. + :ivar api_version: The API version used to generate the notification. Can be empty for events that don't have a specific API version, such as incoming phone calls. + :ivar call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Notification resource is associated with. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar error_code: A unique error code for the error condition that is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). + :ivar log: An integer log level that corresponds to the type of notification: `0` is ERROR, `1` is WARNING. + :ivar message_date: The date the notification was actually generated in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. Message buffering can cause this value to differ from `date_created`. + :ivar message_text: The text of the notification. + :ivar more_info: The URL for more information about the error condition. This value is a page in our [Error Dictionary](https://www.twilio.com/docs/api/errors). + :ivar request_method: The HTTP method used to generate the notification. If the notification was generated during a phone call, this is the HTTP Method used to request the resource on your server. If the notification was generated by your use of our REST API, this is the HTTP method used to call the resource on our servers. + :ivar request_url: The URL of the resource that generated the notification. If the notification was generated during a phone call, this is the URL of the resource on your server that caused the notification. If the notification was generated by your use of our REST API, this is the URL of the resource you called. + :ivar request_variables: The HTTP GET or POST variables we sent to your server. However, if the notification was generated by our REST API, this contains the HTTP POST or PUT variables you sent to our API. + :ivar response_body: The HTTP body returned by your server. + :ivar response_headers: The HTTP headers returned by your server. + :ivar sid: The unique string that that we created to identify the Notification resource. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "api_version": payload.get("api_version"), - "call_sid": payload.get("call_sid"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "error_code": payload.get("error_code"), - "log": payload.get("log"), - "message_date": deserialize.rfc2822_datetime(payload.get("message_date")), - "message_text": payload.get("message_text"), - "more_info": payload.get("more_info"), - "request_method": payload.get("request_method"), - "request_url": payload.get("request_url"), - "request_variables": payload.get("request_variables"), - "response_body": payload.get("response_body"), - "response_headers": payload.get("response_headers"), - "sid": payload.get("sid"), - "uri": payload.get("uri"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.api_version: Optional[str] = payload.get("api_version") + self.call_sid: Optional[str] = payload.get("call_sid") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.error_code: Optional[str] = payload.get("error_code") + self.log: Optional[str] = payload.get("log") + self.message_date: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("message_date") + ) + self.message_text: Optional[str] = payload.get("message_text") + self.more_info: Optional[str] = payload.get("more_info") + self.request_method: Optional[str] = payload.get("request_method") + self.request_url: Optional[str] = payload.get("request_url") + self.request_variables: Optional[str] = payload.get("request_variables") + self.response_body: Optional[str] = payload.get("response_body") + self.response_headers: Optional[str] = payload.get("response_headers") + self.sid: Optional[str] = payload.get("sid") + self.uri: Optional[str] = payload.get("uri") self._solution = { "account_sid": account_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[NotificationContext] = None @@ -72,125 +100,6 @@ def _proxy(self) -> "NotificationContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Notification resource. - """ - return self._properties["account_sid"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to generate the notification. Can be empty for events that don't have a specific API version, such as incoming phone calls. - """ - return self._properties["api_version"] - - @property - def call_sid(self) -> str: - """ - :returns: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Notification resource is associated with. - """ - return self._properties["call_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def error_code(self) -> str: - """ - :returns: A unique error code for the error condition that is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). - """ - return self._properties["error_code"] - - @property - def log(self) -> str: - """ - :returns: An integer log level that corresponds to the type of notification: `0` is ERROR, `1` is WARNING. - """ - return self._properties["log"] - - @property - def message_date(self) -> datetime: - """ - :returns: The date the notification was actually generated in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. Message buffering can cause this value to differ from `date_created`. - """ - return self._properties["message_date"] - - @property - def message_text(self) -> str: - """ - :returns: The text of the notification. - """ - return self._properties["message_text"] - - @property - def more_info(self) -> str: - """ - :returns: The URL for more information about the error condition. This value is a page in our [Error Dictionary](https://www.twilio.com/docs/api/errors). - """ - return self._properties["more_info"] - - @property - def request_method(self) -> str: - """ - :returns: The HTTP method used to generate the notification. If the notification was generated during a phone call, this is the HTTP Method used to request the resource on your server. If the notification was generated by your use of our REST API, this is the HTTP method used to call the resource on our servers. - """ - return self._properties["request_method"] - - @property - def request_url(self) -> str: - """ - :returns: The URL of the resource that generated the notification. If the notification was generated during a phone call, this is the URL of the resource on your server that caused the notification. If the notification was generated by your use of our REST API, this is the URL of the resource you called. - """ - return self._properties["request_url"] - - @property - def request_variables(self) -> str: - """ - :returns: The HTTP GET or POST variables we sent to your server. However, if the notification was generated by our REST API, this contains the HTTP POST or PUT variables you sent to our API. - """ - return self._properties["request_variables"] - - @property - def response_body(self) -> str: - """ - :returns: The HTTP body returned by your server. - """ - return self._properties["response_body"] - - @property - def response_headers(self) -> str: - """ - :returns: The HTTP headers returned by your server. - """ - return self._properties["response_headers"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the Notification resource. - """ - return self._properties["sid"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - def fetch(self) -> "NotificationInstance": """ Fetch the NotificationInstance diff --git a/twilio/rest/api/v2010/account/outgoing_caller_id.py b/twilio/rest/api/v2010/account/outgoing_caller_id.py index 3e2937456..0c25b8635 100644 --- a/twilio/rest/api/v2010/account/outgoing_caller_id.py +++ b/twilio/rest/api/v2010/account/outgoing_caller_id.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,25 +24,41 @@ class OutgoingCallerIdInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, sid: Optional[str] = None): - """ - Initialize the OutgoingCallerIdInstance - """ + + """ + :ivar sid: The unique string that that we created to identify the OutgoingCallerId resource. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the OutgoingCallerId resource. + :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "account_sid": payload.get("account_sid"), - "phone_number": payload.get("phone_number"), - "uri": payload.get("uri"), - } + self.sid: Optional[str] = payload.get("sid") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.account_sid: Optional[str] = payload.get("account_sid") + self.phone_number: Optional[str] = payload.get("phone_number") + self.uri: Optional[str] = payload.get("uri") self._solution = { "account_sid": account_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[OutgoingCallerIdContext] = None @@ -62,55 +78,6 @@ def _proxy(self) -> "OutgoingCallerIdContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the OutgoingCallerId resource. - """ - return self._properties["sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the OutgoingCallerId resource. - """ - return self._properties["account_sid"] - - @property - def phone_number(self) -> str: - """ - :returns: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. - """ - return self._properties["phone_number"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - def delete(self) -> bool: """ Deletes the OutgoingCallerIdInstance diff --git a/twilio/rest/api/v2010/account/queue/__init__.py b/twilio/rest/api/v2010/account/queue/__init__.py index bf7a6620c..a96c7af56 100644 --- a/twilio/rest/api/v2010/account/queue/__init__.py +++ b/twilio/rest/api/v2010/account/queue/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -25,27 +25,49 @@ class QueueInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, sid: Optional[str] = None): - """ - Initialize the QueueInstance - """ + + """ + :ivar date_updated: The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar current_size: The number of calls currently in the queue. + :ivar friendly_name: A string that you assigned to describe this resource. + :ivar uri: The URI of this resource, relative to `https://api.twilio.com`. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Queue resource. + :ivar average_wait_time: The average wait time in seconds of the members in this queue. This is calculated at the time of the request. + :ivar sid: The unique string that that we created to identify this Queue resource. + :ivar date_created: The date and time in GMT that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar max_size: The maximum number of calls that can be in the queue. The default is 1000 and the maximum is 5000. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "current_size": deserialize.integer(payload.get("current_size")), - "friendly_name": payload.get("friendly_name"), - "uri": payload.get("uri"), - "account_sid": payload.get("account_sid"), - "average_wait_time": deserialize.integer(payload.get("average_wait_time")), - "sid": payload.get("sid"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "max_size": deserialize.integer(payload.get("max_size")), - } + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.current_size: Optional[int] = deserialize.integer( + payload.get("current_size") + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.uri: Optional[str] = payload.get("uri") + self.account_sid: Optional[str] = payload.get("account_sid") + self.average_wait_time: Optional[int] = deserialize.integer( + payload.get("average_wait_time") + ) + self.sid: Optional[str] = payload.get("sid") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.max_size: Optional[int] = deserialize.integer(payload.get("max_size")) self._solution = { "account_sid": account_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[QueueContext] = None @@ -65,69 +87,6 @@ def _proxy(self) -> "QueueContext": ) return self._context - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def current_size(self) -> int: - """ - :returns: The number of calls currently in the queue. - """ - return self._properties["current_size"] - - @property - def friendly_name(self) -> str: - """ - :returns: A string that you assigned to describe this resource. - """ - return self._properties["friendly_name"] - - @property - def uri(self) -> str: - """ - :returns: The URI of this resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this Queue resource. - """ - return self._properties["account_sid"] - - @property - def average_wait_time(self) -> int: - """ - :returns: The average wait time in seconds of the members in this queue. This is calculated at the time of the request. - """ - return self._properties["average_wait_time"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify this Queue resource. - """ - return self._properties["sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def max_size(self) -> int: - """ - :returns: The maximum number of calls that can be in the queue. The default is 1000 and the maximum is 5000. - """ - return self._properties["max_size"] - def delete(self) -> bool: """ Deletes the QueueInstance diff --git a/twilio/rest/api/v2010/account/queue/member.py b/twilio/rest/api/v2010/account/queue/member.py index 38fe2a6d5..f0fa04adc 100644 --- a/twilio/rest/api/v2010/account/queue/member.py +++ b/twilio/rest/api/v2010/account/queue/member.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,32 +24,39 @@ class MemberInstance(InstanceResource): + + """ + :ivar call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Member resource is associated with. + :ivar date_enqueued: The date that the member was enqueued, given in RFC 2822 format. + :ivar position: This member's current position in the queue. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + :ivar wait_time: The number of seconds the member has been in the queue. + :ivar queue_sid: The SID of the Queue the member is in. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], account_sid: str, queue_sid: str, call_sid: Optional[str] = None, ): - """ - Initialize the MemberInstance - """ super().__init__(version) - self._properties = { - "call_sid": payload.get("call_sid"), - "date_enqueued": deserialize.rfc2822_datetime(payload.get("date_enqueued")), - "position": deserialize.integer(payload.get("position")), - "uri": payload.get("uri"), - "wait_time": deserialize.integer(payload.get("wait_time")), - "queue_sid": payload.get("queue_sid"), - } + self.call_sid: Optional[str] = payload.get("call_sid") + self.date_enqueued: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_enqueued") + ) + self.position: Optional[int] = deserialize.integer(payload.get("position")) + self.uri: Optional[str] = payload.get("uri") + self.wait_time: Optional[int] = deserialize.integer(payload.get("wait_time")) + self.queue_sid: Optional[str] = payload.get("queue_sid") self._solution = { "account_sid": account_sid, "queue_sid": queue_sid, - "call_sid": call_sid or self._properties["call_sid"], + "call_sid": call_sid or self.call_sid, } self._context: Optional[MemberContext] = None @@ -70,48 +77,6 @@ def _proxy(self) -> "MemberContext": ) return self._context - @property - def call_sid(self) -> str: - """ - :returns: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Member resource is associated with. - """ - return self._properties["call_sid"] - - @property - def date_enqueued(self) -> datetime: - """ - :returns: The date that the member was enqueued, given in RFC 2822 format. - """ - return self._properties["date_enqueued"] - - @property - def position(self) -> int: - """ - :returns: This member's current position in the queue. - """ - return self._properties["position"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def wait_time(self) -> int: - """ - :returns: The number of seconds the member has been in the queue. - """ - return self._properties["wait_time"] - - @property - def queue_sid(self) -> str: - """ - :returns: The SID of the Queue the member is in. - """ - return self._properties["queue_sid"] - def fetch(self) -> "MemberInstance": """ Fetch the MemberInstance diff --git a/twilio/rest/api/v2010/account/recording/__init__.py b/twilio/rest/api/v2010/account/recording/__init__.py index 33376ae01..c2a3995e4 100644 --- a/twilio/rest/api/v2010/account/recording/__init__.py +++ b/twilio/rest/api/v2010/account/recording/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -44,37 +44,70 @@ class Status(object): ABSENT = "absent" DELETED = "deleted" - def __init__(self, version, payload, account_sid: str, sid: Optional[str] = None): - """ - Initialize the RecordingInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource. + :ivar api_version: The API version used during the recording. + :ivar call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Recording resource is associated with. This will always refer to the parent leg of a two-leg call. + :ivar conference_sid: The Conference SID that identifies the conference associated with the recording, if a conference recording. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar start_time: The start time of the recording in GMT and in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + :ivar duration: The length of the recording in seconds. + :ivar sid: The unique string that that we created to identify the Recording resource. + :ivar price: The one-time cost of creating the recording in the `price_unit` currency. + :ivar price_unit: The currency used in the `price` property. Example: `USD`. + :ivar status: + :ivar channels: The number of channels in the final recording file. Can be: `1` or `2`. You can split a call with two legs into two separate recording channels if you record using [TwiML Dial](https://www.twilio.com/docs/voice/twiml/dial#record) or the [Outbound Rest API](https://www.twilio.com/docs/voice/make-calls#manage-your-outbound-call). + :ivar source: + :ivar error_code: The error code that describes why the recording is `absent`. The error code is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). This value is null if the recording `status` is not `absent`. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + :ivar encryption_details: How to decrypt the recording if it was encrypted using [Call Recording Encryption](https://www.twilio.com/docs/voice/tutorials/voice-recording-encryption) feature. + :ivar subresource_uris: A list of related resources identified by their relative URIs. + :ivar media_url: The URL of the media file associated with this recording resource. When stored externally, this is the full URL location of the media file. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "api_version": payload.get("api_version"), - "call_sid": payload.get("call_sid"), - "conference_sid": payload.get("conference_sid"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "start_time": deserialize.rfc2822_datetime(payload.get("start_time")), - "duration": payload.get("duration"), - "sid": payload.get("sid"), - "price": payload.get("price"), - "price_unit": payload.get("price_unit"), - "status": payload.get("status"), - "channels": deserialize.integer(payload.get("channels")), - "source": payload.get("source"), - "error_code": deserialize.integer(payload.get("error_code")), - "uri": payload.get("uri"), - "encryption_details": payload.get("encryption_details"), - "subresource_uris": payload.get("subresource_uris"), - "media_url": payload.get("media_url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.api_version: Optional[str] = payload.get("api_version") + self.call_sid: Optional[str] = payload.get("call_sid") + self.conference_sid: Optional[str] = payload.get("conference_sid") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.start_time: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("start_time") + ) + self.duration: Optional[str] = payload.get("duration") + self.sid: Optional[str] = payload.get("sid") + self.price: Optional[str] = payload.get("price") + self.price_unit: Optional[str] = payload.get("price_unit") + self.status: Optional["RecordingInstance.Status"] = payload.get("status") + self.channels: Optional[int] = deserialize.integer(payload.get("channels")) + self.source: Optional["RecordingInstance.Source"] = payload.get("source") + self.error_code: Optional[int] = deserialize.integer(payload.get("error_code")) + self.uri: Optional[str] = payload.get("uri") + self.encryption_details: Optional[Dict[str, object]] = payload.get( + "encryption_details" + ) + self.subresource_uris: Optional[Dict[str, object]] = payload.get( + "subresource_uris" + ) + self.media_url: Optional[str] = payload.get("media_url") self._solution = { "account_sid": account_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[RecordingContext] = None @@ -94,139 +127,6 @@ def _proxy(self) -> "RecordingContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource. - """ - return self._properties["account_sid"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used during the recording. - """ - return self._properties["api_version"] - - @property - def call_sid(self) -> str: - """ - :returns: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Recording resource is associated with. This will always refer to the parent leg of a two-leg call. - """ - return self._properties["call_sid"] - - @property - def conference_sid(self) -> str: - """ - :returns: The Conference SID that identifies the conference associated with the recording, if a conference recording. - """ - return self._properties["conference_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def start_time(self) -> datetime: - """ - :returns: The start time of the recording in GMT and in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. - """ - return self._properties["start_time"] - - @property - def duration(self) -> str: - """ - :returns: The length of the recording in seconds. - """ - return self._properties["duration"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the Recording resource. - """ - return self._properties["sid"] - - @property - def price(self) -> str: - """ - :returns: The one-time cost of creating the recording in the `price_unit` currency. - """ - return self._properties["price"] - - @property - def price_unit(self) -> str: - """ - :returns: The currency used in the `price` property. Example: `USD`. - """ - return self._properties["price_unit"] - - @property - def status(self) -> "RecordingInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def channels(self) -> int: - """ - :returns: The number of channels in the final recording file. Can be: `1` or `2`. You can split a call with two legs into two separate recording channels if you record using [TwiML Dial](https://www.twilio.com/docs/voice/twiml/dial#record) or the [Outbound Rest API](https://www.twilio.com/docs/voice/make-calls#manage-your-outbound-call). - """ - return self._properties["channels"] - - @property - def source(self) -> "RecordingInstance.Source": - """ - :returns: - """ - return self._properties["source"] - - @property - def error_code(self) -> int: - """ - :returns: The error code that describes why the recording is `absent`. The error code is described in our [Error Dictionary](https://www.twilio.com/docs/api/errors). This value is null if the recording `status` is not `absent`. - """ - return self._properties["error_code"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def encryption_details(self) -> Dict[str, object]: - """ - :returns: How to decrypt the recording if it was encrypted using [Call Recording Encryption](https://www.twilio.com/docs/voice/tutorials/voice-recording-encryption) feature. - """ - return self._properties["encryption_details"] - - @property - def subresource_uris(self) -> Dict[str, object]: - """ - :returns: A list of related resources identified by their relative URIs. - """ - return self._properties["subresource_uris"] - - @property - def media_url(self) -> str: - """ - :returns: The URL of the media file associated with this recording resource. When stored externally, this is the full URL location of the media file. - """ - return self._properties["media_url"] - def delete(self) -> bool: """ Deletes the RecordingInstance diff --git a/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py b/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py index 784c806bc..8ecc0ffff 100644 --- a/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py +++ b/twilio/rest/api/v2010/account/recording/add_on_result/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -35,38 +35,54 @@ class Status(object): PROCESSING = "processing" QUEUED = "queued" + """ + :ivar sid: The unique string that that we created to identify the Recording AddOnResult resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording AddOnResult resource. + :ivar status: + :ivar add_on_sid: The SID of the Add-on to which the result belongs. + :ivar add_on_configuration_sid: The SID of the Add-on configuration. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_completed: The date and time in GMT that the result was completed specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar reference_sid: The SID of the recording to which the AddOnResult resource belongs. + :ivar subresource_uris: A list of related resources identified by their relative URIs. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], account_sid: str, reference_sid: str, sid: Optional[str] = None, ): - """ - Initialize the AddOnResultInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "status": payload.get("status"), - "add_on_sid": payload.get("add_on_sid"), - "add_on_configuration_sid": payload.get("add_on_configuration_sid"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "date_completed": deserialize.rfc2822_datetime( - payload.get("date_completed") - ), - "reference_sid": payload.get("reference_sid"), - "subresource_uris": payload.get("subresource_uris"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.status: Optional["AddOnResultInstance.Status"] = payload.get("status") + self.add_on_sid: Optional[str] = payload.get("add_on_sid") + self.add_on_configuration_sid: Optional[str] = payload.get( + "add_on_configuration_sid" + ) + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.date_completed: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_completed") + ) + self.reference_sid: Optional[str] = payload.get("reference_sid") + self.subresource_uris: Optional[Dict[str, object]] = payload.get( + "subresource_uris" + ) self._solution = { "account_sid": account_sid, "reference_sid": reference_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[AddOnResultContext] = None @@ -87,76 +103,6 @@ def _proxy(self) -> "AddOnResultContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the Recording AddOnResult resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording AddOnResult resource. - """ - return self._properties["account_sid"] - - @property - def status(self) -> "AddOnResultInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def add_on_sid(self) -> str: - """ - :returns: The SID of the Add-on to which the result belongs. - """ - return self._properties["add_on_sid"] - - @property - def add_on_configuration_sid(self) -> str: - """ - :returns: The SID of the Add-on configuration. - """ - return self._properties["add_on_configuration_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def date_completed(self) -> datetime: - """ - :returns: The date and time in GMT that the result was completed specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_completed"] - - @property - def reference_sid(self) -> str: - """ - :returns: The SID of the recording to which the AddOnResult resource belongs. - """ - return self._properties["reference_sid"] - - @property - def subresource_uris(self) -> Dict[str, object]: - """ - :returns: A list of related resources identified by their relative URIs. - """ - return self._properties["subresource_uris"] - def delete(self) -> bool: """ Deletes the AddOnResultInstance diff --git a/twilio/rest/api/v2010/account/recording/add_on_result/payload.py b/twilio/rest/api/v2010/account/recording/add_on_result/payload.py index 26585659f..db9cde9eb 100644 --- a/twilio/rest/api/v2010/account/recording/add_on_result/payload.py +++ b/twilio/rest/api/v2010/account/recording/add_on_result/payload.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,39 +24,57 @@ class PayloadInstance(InstanceResource): + + """ + :ivar sid: The unique string that that we created to identify the Recording AddOnResult Payload resource. + :ivar add_on_result_sid: The SID of the AddOnResult to which the payload belongs. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording AddOnResult Payload resource. + :ivar label: The string provided by the vendor that describes the payload. + :ivar add_on_sid: The SID of the Add-on to which the result belongs. + :ivar add_on_configuration_sid: The SID of the Add-on configuration. + :ivar content_type: The MIME type of the payload. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar reference_sid: The SID of the recording to which the AddOnResult resource that contains the payload belongs. + :ivar subresource_uris: A list of related resources identified by their relative URIs. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], account_sid: str, reference_sid: str, add_on_result_sid: str, sid: Optional[str] = None, ): - """ - Initialize the PayloadInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "add_on_result_sid": payload.get("add_on_result_sid"), - "account_sid": payload.get("account_sid"), - "label": payload.get("label"), - "add_on_sid": payload.get("add_on_sid"), - "add_on_configuration_sid": payload.get("add_on_configuration_sid"), - "content_type": payload.get("content_type"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "reference_sid": payload.get("reference_sid"), - "subresource_uris": payload.get("subresource_uris"), - } + self.sid: Optional[str] = payload.get("sid") + self.add_on_result_sid: Optional[str] = payload.get("add_on_result_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.label: Optional[str] = payload.get("label") + self.add_on_sid: Optional[str] = payload.get("add_on_sid") + self.add_on_configuration_sid: Optional[str] = payload.get( + "add_on_configuration_sid" + ) + self.content_type: Optional[str] = payload.get("content_type") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.reference_sid: Optional[str] = payload.get("reference_sid") + self.subresource_uris: Optional[Dict[str, object]] = payload.get( + "subresource_uris" + ) self._solution = { "account_sid": account_sid, "reference_sid": reference_sid, "add_on_result_sid": add_on_result_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[PayloadContext] = None @@ -78,83 +96,6 @@ def _proxy(self) -> "PayloadContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the Recording AddOnResult Payload resource. - """ - return self._properties["sid"] - - @property - def add_on_result_sid(self) -> str: - """ - :returns: The SID of the AddOnResult to which the payload belongs. - """ - return self._properties["add_on_result_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording AddOnResult Payload resource. - """ - return self._properties["account_sid"] - - @property - def label(self) -> str: - """ - :returns: The string provided by the vendor that describes the payload. - """ - return self._properties["label"] - - @property - def add_on_sid(self) -> str: - """ - :returns: The SID of the Add-on to which the result belongs. - """ - return self._properties["add_on_sid"] - - @property - def add_on_configuration_sid(self) -> str: - """ - :returns: The SID of the Add-on configuration. - """ - return self._properties["add_on_configuration_sid"] - - @property - def content_type(self) -> str: - """ - :returns: The MIME type of the payload. - """ - return self._properties["content_type"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def reference_sid(self) -> str: - """ - :returns: The SID of the recording to which the AddOnResult resource that contains the payload belongs. - """ - return self._properties["reference_sid"] - - @property - def subresource_uris(self) -> Dict[str, object]: - """ - :returns: A list of related resources identified by their relative URIs. - """ - return self._properties["subresource_uris"] - def delete(self) -> bool: """ Deletes the PayloadInstance diff --git a/twilio/rest/api/v2010/account/recording/transcription.py b/twilio/rest/api/v2010/account/recording/transcription.py index c6d1cba37..86ab9f5f6 100644 --- a/twilio/rest/api/v2010/account/recording/transcription.py +++ b/twilio/rest/api/v2010/account/recording/transcription.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -29,39 +29,54 @@ class Status(object): COMPLETED = "completed" FAILED = "failed" + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resource. + :ivar api_version: The API version used to create the transcription. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar duration: The duration of the transcribed audio in seconds. + :ivar price: The charge for the transcript in the currency associated with the account. This value is populated after the transcript is complete so it may not be available immediately. + :ivar price_unit: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). + :ivar recording_sid: The SID of the [Recording](https://www.twilio.com/docs/voice/api/recording) from which the transcription was created. + :ivar sid: The unique string that that we created to identify the Transcription resource. + :ivar status: + :ivar transcription_text: The text content of the transcription. + :ivar type: The transcription type. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], account_sid: str, recording_sid: str, sid: Optional[str] = None, ): - """ - Initialize the TranscriptionInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "api_version": payload.get("api_version"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "duration": payload.get("duration"), - "price": deserialize.decimal(payload.get("price")), - "price_unit": payload.get("price_unit"), - "recording_sid": payload.get("recording_sid"), - "sid": payload.get("sid"), - "status": payload.get("status"), - "transcription_text": payload.get("transcription_text"), - "type": payload.get("type"), - "uri": payload.get("uri"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.api_version: Optional[str] = payload.get("api_version") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.duration: Optional[str] = payload.get("duration") + self.price: Optional[float] = deserialize.decimal(payload.get("price")) + self.price_unit: Optional[str] = payload.get("price_unit") + self.recording_sid: Optional[str] = payload.get("recording_sid") + self.sid: Optional[str] = payload.get("sid") + self.status: Optional["TranscriptionInstance.Status"] = payload.get("status") + self.transcription_text: Optional[str] = payload.get("transcription_text") + self.type: Optional[str] = payload.get("type") + self.uri: Optional[str] = payload.get("uri") self._solution = { "account_sid": account_sid, "recording_sid": recording_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[TranscriptionContext] = None @@ -82,97 +97,6 @@ def _proxy(self) -> "TranscriptionContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resource. - """ - return self._properties["account_sid"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to create the transcription. - """ - return self._properties["api_version"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def duration(self) -> str: - """ - :returns: The duration of the transcribed audio in seconds. - """ - return self._properties["duration"] - - @property - def price(self) -> float: - """ - :returns: The charge for the transcript in the currency associated with the account. This value is populated after the transcript is complete so it may not be available immediately. - """ - return self._properties["price"] - - @property - def price_unit(self) -> str: - """ - :returns: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). - """ - return self._properties["price_unit"] - - @property - def recording_sid(self) -> str: - """ - :returns: The SID of the [Recording](https://www.twilio.com/docs/voice/api/recording) from which the transcription was created. - """ - return self._properties["recording_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the Transcription resource. - """ - return self._properties["sid"] - - @property - def status(self) -> "TranscriptionInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def transcription_text(self) -> str: - """ - :returns: The text content of the transcription. - """ - return self._properties["transcription_text"] - - @property - def type(self) -> str: - """ - :returns: The transcription type. - """ - return self._properties["type"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - def delete(self) -> bool: """ Deletes the TranscriptionInstance diff --git a/twilio/rest/api/v2010/account/short_code.py b/twilio/rest/api/v2010/account/short_code.py index ccdf53338..332d3102d 100644 --- a/twilio/rest/api/v2010/account/short_code.py +++ b/twilio/rest/api/v2010/account/short_code.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,30 +24,51 @@ class ShortCodeInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, sid: Optional[str] = None): - """ - Initialize the ShortCodeInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this ShortCode resource. + :ivar api_version: The API version used to start a new TwiML session when an SMS message is sent to this short code. + :ivar date_created: The date and time in GMT that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar friendly_name: A string that you assigned to describe this resource. By default, the `FriendlyName` is the short code. + :ivar short_code: The short code. e.g., 894546. + :ivar sid: The unique string that that we created to identify this ShortCode resource. + :ivar sms_fallback_method: The HTTP method we use to call the `sms_fallback_url`. Can be: `GET` or `POST`. + :ivar sms_fallback_url: The URL that we call if an error occurs while retrieving or executing the TwiML from `sms_url`. + :ivar sms_method: The HTTP method we use to call the `sms_url`. Can be: `GET` or `POST`. + :ivar sms_url: The URL we call when receiving an incoming SMS message to this short code. + :ivar uri: The URI of this resource, relative to `https://api.twilio.com`. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "api_version": payload.get("api_version"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "short_code": payload.get("short_code"), - "sid": payload.get("sid"), - "sms_fallback_method": payload.get("sms_fallback_method"), - "sms_fallback_url": payload.get("sms_fallback_url"), - "sms_method": payload.get("sms_method"), - "sms_url": payload.get("sms_url"), - "uri": payload.get("uri"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.api_version: Optional[str] = payload.get("api_version") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.short_code: Optional[str] = payload.get("short_code") + self.sid: Optional[str] = payload.get("sid") + self.sms_fallback_method: Optional[str] = payload.get("sms_fallback_method") + self.sms_fallback_url: Optional[str] = payload.get("sms_fallback_url") + self.sms_method: Optional[str] = payload.get("sms_method") + self.sms_url: Optional[str] = payload.get("sms_url") + self.uri: Optional[str] = payload.get("uri") self._solution = { "account_sid": account_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ShortCodeContext] = None @@ -67,90 +88,6 @@ def _proxy(self) -> "ShortCodeContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this ShortCode resource. - """ - return self._properties["account_sid"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to start a new TwiML session when an SMS message is sent to this short code. - """ - return self._properties["api_version"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that this resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that this resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: A string that you assigned to describe this resource. By default, the `FriendlyName` is the short code. - """ - return self._properties["friendly_name"] - - @property - def short_code(self) -> str: - """ - :returns: The short code. e.g., 894546. - """ - return self._properties["short_code"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify this ShortCode resource. - """ - return self._properties["sid"] - - @property - def sms_fallback_method(self) -> str: - """ - :returns: The HTTP method we use to call the `sms_fallback_url`. Can be: `GET` or `POST`. - """ - return self._properties["sms_fallback_method"] - - @property - def sms_fallback_url(self) -> str: - """ - :returns: The URL that we call if an error occurs while retrieving or executing the TwiML from `sms_url`. - """ - return self._properties["sms_fallback_url"] - - @property - def sms_method(self) -> str: - """ - :returns: The HTTP method we use to call the `sms_url`. Can be: `GET` or `POST`. - """ - return self._properties["sms_method"] - - @property - def sms_url(self) -> str: - """ - :returns: The URL we call when receiving an incoming SMS message to this short code. - """ - return self._properties["sms_url"] - - @property - def uri(self) -> str: - """ - :returns: The URI of this resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - def fetch(self) -> "ShortCodeInstance": """ Fetch the ShortCodeInstance diff --git a/twilio/rest/api/v2010/account/signing_key.py b/twilio/rest/api/v2010/account/signing_key.py index 20a07d1cd..9a87d6d84 100644 --- a/twilio/rest/api/v2010/account/signing_key.py +++ b/twilio/rest/api/v2010/account/signing_key.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,22 +24,35 @@ class SigningKeyInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, sid: Optional[str] = None): - """ - Initialize the SigningKeyInstance - """ + + """ + :ivar sid: + :ivar friendly_name: + :ivar date_created: + :ivar date_updated: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "friendly_name": payload.get("friendly_name"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - } + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) self._solution = { "account_sid": account_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[SigningKeyContext] = None @@ -59,34 +72,6 @@ def _proxy(self) -> "SigningKeyContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: - """ - return self._properties["friendly_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - def delete(self) -> bool: """ Deletes the SigningKeyInstance diff --git a/twilio/rest/api/v2010/account/sip/credential_list/__init__.py b/twilio/rest/api/v2010/account/sip/credential_list/__init__.py index fb52ba52e..a1c6d666c 100644 --- a/twilio/rest/api/v2010/account/sip/credential_list/__init__.py +++ b/twilio/rest/api/v2010/account/sip/credential_list/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -25,25 +25,43 @@ class CredentialListInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, sid: Optional[str] = None): - """ - Initialize the CredentialListInstance - """ + + """ + :ivar account_sid: The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) that owns this resource. + :ivar date_created: The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + :ivar date_updated: The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + :ivar friendly_name: A human readable descriptive text that describes the CredentialList, up to 64 characters long. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar subresource_uris: A list of credentials associated with this credential list. + :ivar uri: The URI for this resource, relative to `https://api.twilio.com`. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "sid": payload.get("sid"), - "subresource_uris": payload.get("subresource_uris"), - "uri": payload.get("uri"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.sid: Optional[str] = payload.get("sid") + self.subresource_uris: Optional[Dict[str, object]] = payload.get( + "subresource_uris" + ) + self.uri: Optional[str] = payload.get("uri") self._solution = { "account_sid": account_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[CredentialListContext] = None @@ -63,55 +81,6 @@ def _proxy(self) -> "CredentialListContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) that owns this resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: A human readable descriptive text that describes the CredentialList, up to 64 characters long. - """ - return self._properties["friendly_name"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def subresource_uris(self) -> Dict[str, object]: - """ - :returns: A list of credentials associated with this credential list. - """ - return self._properties["subresource_uris"] - - @property - def uri(self) -> str: - """ - :returns: The URI for this resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - def delete(self) -> bool: """ Deletes the CredentialListInstance diff --git a/twilio/rest/api/v2010/account/sip/credential_list/credential.py b/twilio/rest/api/v2010/account/sip/credential_list/credential.py index 967852bf2..2aa15903e 100644 --- a/twilio/rest/api/v2010/account/sip/credential_list/credential.py +++ b/twilio/rest/api/v2010/account/sip/credential_list/credential.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,33 +24,43 @@ class CredentialInstance(InstanceResource): + + """ + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar account_sid: The unique id of the Account that is responsible for this resource. + :ivar credential_list_sid: The unique id that identifies the credential list that includes this credential. + :ivar username: The username for this credential. + :ivar date_created: The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + :ivar date_updated: The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + :ivar uri: The URI for this resource, relative to `https://api.twilio.com` + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], account_sid: str, credential_list_sid: str, sid: Optional[str] = None, ): - """ - Initialize the CredentialInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "credential_list_sid": payload.get("credential_list_sid"), - "username": payload.get("username"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "uri": payload.get("uri"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.credential_list_sid: Optional[str] = payload.get("credential_list_sid") + self.username: Optional[str] = payload.get("username") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.uri: Optional[str] = payload.get("uri") self._solution = { "account_sid": account_sid, "credential_list_sid": credential_list_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[CredentialContext] = None @@ -71,55 +81,6 @@ def _proxy(self) -> "CredentialContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The unique id of the Account that is responsible for this resource. - """ - return self._properties["account_sid"] - - @property - def credential_list_sid(self) -> str: - """ - :returns: The unique id that identifies the credential list that includes this credential. - """ - return self._properties["credential_list_sid"] - - @property - def username(self) -> str: - """ - :returns: The username for this credential. - """ - return self._properties["username"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. - """ - return self._properties["date_updated"] - - @property - def uri(self) -> str: - """ - :returns: The URI for this resource, relative to `https://api.twilio.com` - """ - return self._properties["uri"] - def delete(self) -> bool: """ Deletes the CredentialInstance diff --git a/twilio/rest/api/v2010/account/sip/domain/__init__.py b/twilio/rest/api/v2010/account/sip/domain/__init__.py index 0a48451bc..181fb406a 100644 --- a/twilio/rest/api/v2010/account/sip/domain/__init__.py +++ b/twilio/rest/api/v2010/account/sip/domain/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -31,39 +31,77 @@ class DomainInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, sid: Optional[str] = None): - """ - Initialize the DomainInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the SipDomain resource. + :ivar api_version: The API version used to process the call. + :ivar auth_type: The types of authentication you have mapped to your domain. Can be: `IP_ACL` and `CREDENTIAL_LIST`. If you have both defined for your domain, both will be returned in a comma delimited string. If `auth_type` is not defined, the domain will not be able to receive any traffic. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar domain_name: The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and \"-\" and must end with `sip.twilio.com`. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar sid: The unique string that that we created to identify the SipDomain resource. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + :ivar voice_fallback_method: The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. + :ivar voice_fallback_url: The URL that we call when an error occurs while retrieving or executing the TwiML requested from `voice_url`. + :ivar voice_method: The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. + :ivar voice_status_callback_method: The HTTP method we use to call `voice_status_callback_url`. Either `GET` or `POST`. + :ivar voice_status_callback_url: The URL that we call to pass status parameters (such as call ended) to your application. + :ivar voice_url: The URL we call using the `voice_method` when the domain receives a call. + :ivar subresource_uris: A list of mapping resources associated with the SIP Domain resource identified by their relative URIs. + :ivar sip_registration: Whether to allow SIP Endpoints to register with the domain to receive calls. + :ivar emergency_calling_enabled: Whether emergency calling is enabled for the domain. If enabled, allows emergency calls on the domain from phone numbers with validated addresses. + :ivar secure: Whether secure SIP is enabled for the domain. If enabled, TLS will be enforced and SRTP will be negotiated on all incoming calls to this sip domain. + :ivar byoc_trunk_sid: The SID of the BYOC Trunk(Bring Your Own Carrier) resource that the Sip Domain will be associated with. + :ivar emergency_caller_sid: Whether an emergency caller sid is configured for the domain. If present, this phone number will be used as the callback for the emergency call. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "api_version": payload.get("api_version"), - "auth_type": payload.get("auth_type"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "domain_name": payload.get("domain_name"), - "friendly_name": payload.get("friendly_name"), - "sid": payload.get("sid"), - "uri": payload.get("uri"), - "voice_fallback_method": payload.get("voice_fallback_method"), - "voice_fallback_url": payload.get("voice_fallback_url"), - "voice_method": payload.get("voice_method"), - "voice_status_callback_method": payload.get("voice_status_callback_method"), - "voice_status_callback_url": payload.get("voice_status_callback_url"), - "voice_url": payload.get("voice_url"), - "subresource_uris": payload.get("subresource_uris"), - "sip_registration": payload.get("sip_registration"), - "emergency_calling_enabled": payload.get("emergency_calling_enabled"), - "secure": payload.get("secure"), - "byoc_trunk_sid": payload.get("byoc_trunk_sid"), - "emergency_caller_sid": payload.get("emergency_caller_sid"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.api_version: Optional[str] = payload.get("api_version") + self.auth_type: Optional[str] = payload.get("auth_type") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.domain_name: Optional[str] = payload.get("domain_name") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.sid: Optional[str] = payload.get("sid") + self.uri: Optional[str] = payload.get("uri") + self.voice_fallback_method: Optional[str] = payload.get("voice_fallback_method") + self.voice_fallback_url: Optional[str] = payload.get("voice_fallback_url") + self.voice_method: Optional[str] = payload.get("voice_method") + self.voice_status_callback_method: Optional[str] = payload.get( + "voice_status_callback_method" + ) + self.voice_status_callback_url: Optional[str] = payload.get( + "voice_status_callback_url" + ) + self.voice_url: Optional[str] = payload.get("voice_url") + self.subresource_uris: Optional[Dict[str, object]] = payload.get( + "subresource_uris" + ) + self.sip_registration: Optional[bool] = payload.get("sip_registration") + self.emergency_calling_enabled: Optional[bool] = payload.get( + "emergency_calling_enabled" + ) + self.secure: Optional[bool] = payload.get("secure") + self.byoc_trunk_sid: Optional[str] = payload.get("byoc_trunk_sid") + self.emergency_caller_sid: Optional[str] = payload.get("emergency_caller_sid") self._solution = { "account_sid": account_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[DomainContext] = None @@ -83,153 +121,6 @@ def _proxy(self) -> "DomainContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the SipDomain resource. - """ - return self._properties["account_sid"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to process the call. - """ - return self._properties["api_version"] - - @property - def auth_type(self) -> str: - """ - :returns: The types of authentication you have mapped to your domain. Can be: `IP_ACL` and `CREDENTIAL_LIST`. If you have both defined for your domain, both will be returned in a comma delimited string. If `auth_type` is not defined, the domain will not be able to receive any traffic. - """ - return self._properties["auth_type"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def domain_name(self) -> str: - """ - :returns: The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and \"-\" and must end with `sip.twilio.com`. - """ - return self._properties["domain_name"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the SipDomain resource. - """ - return self._properties["sid"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def voice_fallback_method(self) -> str: - """ - :returns: The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. - """ - return self._properties["voice_fallback_method"] - - @property - def voice_fallback_url(self) -> str: - """ - :returns: The URL that we call when an error occurs while retrieving or executing the TwiML requested from `voice_url`. - """ - return self._properties["voice_fallback_url"] - - @property - def voice_method(self) -> str: - """ - :returns: The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. - """ - return self._properties["voice_method"] - - @property - def voice_status_callback_method(self) -> str: - """ - :returns: The HTTP method we use to call `voice_status_callback_url`. Either `GET` or `POST`. - """ - return self._properties["voice_status_callback_method"] - - @property - def voice_status_callback_url(self) -> str: - """ - :returns: The URL that we call to pass status parameters (such as call ended) to your application. - """ - return self._properties["voice_status_callback_url"] - - @property - def voice_url(self) -> str: - """ - :returns: The URL we call using the `voice_method` when the domain receives a call. - """ - return self._properties["voice_url"] - - @property - def subresource_uris(self) -> Dict[str, object]: - """ - :returns: A list of mapping resources associated with the SIP Domain resource identified by their relative URIs. - """ - return self._properties["subresource_uris"] - - @property - def sip_registration(self) -> bool: - """ - :returns: Whether to allow SIP Endpoints to register with the domain to receive calls. - """ - return self._properties["sip_registration"] - - @property - def emergency_calling_enabled(self) -> bool: - """ - :returns: Whether emergency calling is enabled for the domain. If enabled, allows emergency calls on the domain from phone numbers with validated addresses. - """ - return self._properties["emergency_calling_enabled"] - - @property - def secure(self) -> bool: - """ - :returns: Whether secure SIP is enabled for the domain. If enabled, TLS will be enforced and SRTP will be negotiated on all incoming calls to this sip domain. - """ - return self._properties["secure"] - - @property - def byoc_trunk_sid(self) -> str: - """ - :returns: The SID of the BYOC Trunk(Bring Your Own Carrier) resource that the Sip Domain will be associated with. - """ - return self._properties["byoc_trunk_sid"] - - @property - def emergency_caller_sid(self) -> str: - """ - :returns: Whether an emergency caller sid is configured for the domain. If present, this phone number will be used as the callback for the emergency call. - """ - return self._properties["emergency_caller_sid"] - def delete(self) -> bool: """ Deletes the DomainInstance diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_credential_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_credential_list_mapping.py index e1a8a6290..824dd5037 100644 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_credential_list_mapping.py +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_credential_list_mapping.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,31 +24,39 @@ class AuthCallsCredentialListMappingInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialListMapping resource. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar sid: The unique string that that we created to identify the CredentialListMapping resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], account_sid: str, domain_sid: str, sid: Optional[str] = None, ): - """ - Initialize the AuthCallsCredentialListMappingInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "sid": payload.get("sid"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.sid: Optional[str] = payload.get("sid") self._solution = { "account_sid": account_sid, "domain_sid": domain_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[AuthCallsCredentialListMappingContext] = None @@ -69,41 +77,6 @@ def _proxy(self) -> "AuthCallsCredentialListMappingContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialListMapping resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the CredentialListMapping resource. - """ - return self._properties["sid"] - def delete(self) -> bool: """ Deletes the AuthCallsCredentialListMappingInstance diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_ip_access_control_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_ip_access_control_list_mapping.py index ac4844073..8a7bf8f69 100644 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_ip_access_control_list_mapping.py +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_calls/auth_calls_ip_access_control_list_mapping.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,31 +24,39 @@ class AuthCallsIpAccessControlListMappingInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IpAccessControlListMapping resource. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar sid: The unique string that that we created to identify the IpAccessControlListMapping resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], account_sid: str, domain_sid: str, sid: Optional[str] = None, ): - """ - Initialize the AuthCallsIpAccessControlListMappingInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "sid": payload.get("sid"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.sid: Optional[str] = payload.get("sid") self._solution = { "account_sid": account_sid, "domain_sid": domain_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[AuthCallsIpAccessControlListMappingContext] = None @@ -69,41 +77,6 @@ def _proxy(self) -> "AuthCallsIpAccessControlListMappingContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IpAccessControlListMapping resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the IpAccessControlListMapping resource. - """ - return self._properties["sid"] - def delete(self) -> bool: """ Deletes the AuthCallsIpAccessControlListMappingInstance diff --git a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/auth_registrations_credential_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/auth_registrations_credential_list_mapping.py index d48cde46a..a04ca49bc 100644 --- a/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/auth_registrations_credential_list_mapping.py +++ b/twilio/rest/api/v2010/account/sip/domain/auth_types/auth_type_registrations/auth_registrations_credential_list_mapping.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,31 +24,39 @@ class AuthRegistrationsCredentialListMappingInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialListMapping resource. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar sid: The unique string that that we created to identify the CredentialListMapping resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], account_sid: str, domain_sid: str, sid: Optional[str] = None, ): - """ - Initialize the AuthRegistrationsCredentialListMappingInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "sid": payload.get("sid"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.sid: Optional[str] = payload.get("sid") self._solution = { "account_sid": account_sid, "domain_sid": domain_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[AuthRegistrationsCredentialListMappingContext] = None @@ -69,41 +77,6 @@ def _proxy(self) -> "AuthRegistrationsCredentialListMappingContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialListMapping resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the CredentialListMapping resource. - """ - return self._properties["sid"] - def delete(self) -> bool: """ Deletes the AuthRegistrationsCredentialListMappingInstance diff --git a/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py index 11207135f..bd108b698 100644 --- a/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py +++ b/twilio/rest/api/v2010/account/sip/domain/credential_list_mapping.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,33 +24,43 @@ class CredentialListMappingInstance(InstanceResource): + + """ + :ivar account_sid: The unique id of the Account that is responsible for this resource. + :ivar date_created: The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + :ivar date_updated: The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + :ivar domain_sid: The unique string that is created to identify the SipDomain resource. + :ivar friendly_name: A human readable descriptive text for this resource, up to 64 characters long. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar uri: The URI for this resource, relative to `https://api.twilio.com` + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], account_sid: str, domain_sid: str, sid: Optional[str] = None, ): - """ - Initialize the CredentialListMappingInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "domain_sid": payload.get("domain_sid"), - "friendly_name": payload.get("friendly_name"), - "sid": payload.get("sid"), - "uri": payload.get("uri"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.domain_sid: Optional[str] = payload.get("domain_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.sid: Optional[str] = payload.get("sid") + self.uri: Optional[str] = payload.get("uri") self._solution = { "account_sid": account_sid, "domain_sid": domain_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[CredentialListMappingContext] = None @@ -71,55 +81,6 @@ def _proxy(self) -> "CredentialListMappingContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique id of the Account that is responsible for this resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. - """ - return self._properties["date_updated"] - - @property - def domain_sid(self) -> str: - """ - :returns: The unique string that is created to identify the SipDomain resource. - """ - return self._properties["domain_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: A human readable descriptive text for this resource, up to 64 characters long. - """ - return self._properties["friendly_name"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def uri(self) -> str: - """ - :returns: The URI for this resource, relative to `https://api.twilio.com` - """ - return self._properties["uri"] - def delete(self) -> bool: """ Deletes the CredentialListMappingInstance diff --git a/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py b/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py index fc9d0e51e..d5bcc4d50 100644 --- a/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py +++ b/twilio/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,33 +24,43 @@ class IpAccessControlListMappingInstance(InstanceResource): + + """ + :ivar account_sid: The unique id of the Account that is responsible for this resource. + :ivar date_created: The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + :ivar date_updated: The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + :ivar domain_sid: The unique string that is created to identify the SipDomain resource. + :ivar friendly_name: A human readable descriptive text for this resource, up to 64 characters long. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar uri: The URI for this resource, relative to `https://api.twilio.com` + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], account_sid: str, domain_sid: str, sid: Optional[str] = None, ): - """ - Initialize the IpAccessControlListMappingInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "domain_sid": payload.get("domain_sid"), - "friendly_name": payload.get("friendly_name"), - "sid": payload.get("sid"), - "uri": payload.get("uri"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.domain_sid: Optional[str] = payload.get("domain_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.sid: Optional[str] = payload.get("sid") + self.uri: Optional[str] = payload.get("uri") self._solution = { "account_sid": account_sid, "domain_sid": domain_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[IpAccessControlListMappingContext] = None @@ -71,55 +81,6 @@ def _proxy(self) -> "IpAccessControlListMappingContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique id of the Account that is responsible for this resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. - """ - return self._properties["date_updated"] - - @property - def domain_sid(self) -> str: - """ - :returns: The unique string that is created to identify the SipDomain resource. - """ - return self._properties["domain_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: A human readable descriptive text for this resource, up to 64 characters long. - """ - return self._properties["friendly_name"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def uri(self) -> str: - """ - :returns: The URI for this resource, relative to `https://api.twilio.com` - """ - return self._properties["uri"] - def delete(self) -> bool: """ Deletes the IpAccessControlListMappingInstance diff --git a/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py b/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py index e4d35742a..86abbd2dd 100644 --- a/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py +++ b/twilio/rest/api/v2010/account/sip/ip_access_control_list/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,25 +27,43 @@ class IpAccessControlListInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str, sid: Optional[str] = None): - """ - Initialize the IpAccessControlListInstance - """ + + """ + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar account_sid: The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) that owns this resource. + :ivar friendly_name: A human readable descriptive text, up to 255 characters long. + :ivar date_created: The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + :ivar date_updated: The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + :ivar subresource_uris: A list of the IpAddress resources associated with this IP access control list resource. + :ivar uri: The URI for this resource, relative to `https://api.twilio.com` + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "subresource_uris": payload.get("subresource_uris"), - "uri": payload.get("uri"), - } + 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.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.subresource_uris: Optional[Dict[str, object]] = payload.get( + "subresource_uris" + ) + self.uri: Optional[str] = payload.get("uri") self._solution = { "account_sid": account_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[IpAccessControlListContext] = None @@ -65,55 +83,6 @@ def _proxy(self) -> "IpAccessControlListContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The unique id of the [Account](https://www.twilio.com/docs/iam/api/account) that owns this resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: A human readable descriptive text, up to 255 characters long. - """ - return self._properties["friendly_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. - """ - return self._properties["date_updated"] - - @property - def subresource_uris(self) -> Dict[str, object]: - """ - :returns: A list of the IpAddress resources associated with this IP access control list resource. - """ - return self._properties["subresource_uris"] - - @property - def uri(self) -> str: - """ - :returns: The URI for this resource, relative to `https://api.twilio.com` - """ - return self._properties["uri"] - def delete(self) -> bool: """ Deletes the IpAccessControlListInstance diff --git a/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py b/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py index 43cdfdf18..bf2b3903f 100644 --- a/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py +++ b/twilio/rest/api/v2010/account/sip/ip_access_control_list/ip_address.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,37 +24,51 @@ class IpAddressInstance(InstanceResource): + + """ + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar account_sid: The unique id of the Account that is responsible for this resource. + :ivar friendly_name: A human readable descriptive text for this resource, up to 255 characters long. + :ivar ip_address: An IP address in dotted decimal notation from which you want to accept traffic. Any SIP requests from this IP address will be allowed by Twilio. IPv4 only supported today. + :ivar cidr_prefix_length: An integer representing the length of the CIDR prefix to use with this IP address when accepting traffic. By default the entire IP address is used. + :ivar ip_access_control_list_sid: The unique id of the IpAccessControlList resource that includes this resource. + :ivar date_created: The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + :ivar date_updated: The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. + :ivar uri: The URI for this resource, relative to `https://api.twilio.com` + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], account_sid: str, ip_access_control_list_sid: str, sid: Optional[str] = None, ): - """ - Initialize the IpAddressInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "ip_address": payload.get("ip_address"), - "cidr_prefix_length": deserialize.integer( - payload.get("cidr_prefix_length") - ), - "ip_access_control_list_sid": payload.get("ip_access_control_list_sid"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "uri": payload.get("uri"), - } + 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.ip_address: Optional[str] = payload.get("ip_address") + self.cidr_prefix_length: Optional[int] = deserialize.integer( + payload.get("cidr_prefix_length") + ) + self.ip_access_control_list_sid: Optional[str] = payload.get( + "ip_access_control_list_sid" + ) + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.uri: Optional[str] = payload.get("uri") self._solution = { "account_sid": account_sid, "ip_access_control_list_sid": ip_access_control_list_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[IpAddressContext] = None @@ -75,69 +89,6 @@ def _proxy(self) -> "IpAddressContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The unique id of the Account that is responsible for this resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: A human readable descriptive text for this resource, up to 255 characters long. - """ - return self._properties["friendly_name"] - - @property - def ip_address(self) -> str: - """ - :returns: An IP address in dotted decimal notation from which you want to accept traffic. Any SIP requests from this IP address will be allowed by Twilio. IPv4 only supported today. - """ - return self._properties["ip_address"] - - @property - def cidr_prefix_length(self) -> int: - """ - :returns: An integer representing the length of the CIDR prefix to use with this IP address when accepting traffic. By default the entire IP address is used. - """ - return self._properties["cidr_prefix_length"] - - @property - def ip_access_control_list_sid(self) -> str: - """ - :returns: The unique id of the IpAccessControlList resource that includes this resource. - """ - return self._properties["ip_access_control_list_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated, given as GMT in [RFC 2822](https://www.php.net/manual/en/class.datetime.php#datetime.constants.rfc2822) format. - """ - return self._properties["date_updated"] - - @property - def uri(self) -> str: - """ - :returns: The URI for this resource, relative to `https://api.twilio.com` - """ - return self._properties["uri"] - def delete(self) -> bool: """ Deletes the IpAddressInstance diff --git a/twilio/rest/api/v2010/account/token.py b/twilio/rest/api/v2010/account/token.py index 6418f8a14..b5b8a4497 100644 --- a/twilio/rest/api/v2010/account/token.py +++ b/twilio/rest/api/v2010/account/token.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -23,75 +23,36 @@ class TokenInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str): - """ - Initialize the TokenInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Token resource. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar ice_servers: An array representing the ephemeral credentials and the STUN and TURN server URIs. + :ivar password: The temporary password that the username will use when authenticating with Twilio. + :ivar ttl: The duration in seconds for which the username and password are valid. + :ivar username: The temporary username that uniquely identifies a Token. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], account_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "ice_servers": payload.get("ice_servers"), - "password": payload.get("password"), - "ttl": payload.get("ttl"), - "username": payload.get("username"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.ice_servers: Optional[List[str]] = payload.get("ice_servers") + self.password: Optional[str] = payload.get("password") + self.ttl: Optional[str] = payload.get("ttl") + self.username: Optional[str] = payload.get("username") self._solution = { "account_sid": account_sid, } - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Token resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def ice_servers(self) -> List[str]: - """ - :returns: An array representing the ephemeral credentials and the STUN and TURN server URIs. - """ - return self._properties["ice_servers"] - - @property - def password(self) -> str: - """ - :returns: The temporary password that the username will use when authenticating with Twilio. - """ - return self._properties["password"] - - @property - def ttl(self) -> str: - """ - :returns: The duration in seconds for which the username and password are valid. - """ - return self._properties["ttl"] - - @property - def username(self) -> str: - """ - :returns: The temporary username that uniquely identifies a Token. - """ - return self._properties["username"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/transcription.py b/twilio/rest/api/v2010/account/transcription.py index e73e2020a..035fb215e 100644 --- a/twilio/rest/api/v2010/account/transcription.py +++ b/twilio/rest/api/v2010/account/transcription.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -29,31 +29,52 @@ class Status(object): COMPLETED = "completed" FAILED = "failed" - def __init__(self, version, payload, account_sid: str, sid: Optional[str] = None): - """ - Initialize the TranscriptionInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resource. + :ivar api_version: The API version used to create the transcription. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar duration: The duration of the transcribed audio in seconds. + :ivar price: The charge for the transcript in the currency associated with the account. This value is populated after the transcript is complete so it may not be available immediately. + :ivar price_unit: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). + :ivar recording_sid: The SID of the [Recording](https://www.twilio.com/docs/voice/api/recording) from which the transcription was created. + :ivar sid: The unique string that that we created to identify the Transcription resource. + :ivar status: + :ivar transcription_text: The text content of the transcription. + :ivar type: The transcription type. Can only be: `fast`. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "api_version": payload.get("api_version"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "duration": payload.get("duration"), - "price": deserialize.decimal(payload.get("price")), - "price_unit": payload.get("price_unit"), - "recording_sid": payload.get("recording_sid"), - "sid": payload.get("sid"), - "status": payload.get("status"), - "transcription_text": payload.get("transcription_text"), - "type": payload.get("type"), - "uri": payload.get("uri"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.api_version: Optional[str] = payload.get("api_version") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.duration: Optional[str] = payload.get("duration") + self.price: Optional[float] = deserialize.decimal(payload.get("price")) + self.price_unit: Optional[str] = payload.get("price_unit") + self.recording_sid: Optional[str] = payload.get("recording_sid") + self.sid: Optional[str] = payload.get("sid") + self.status: Optional["TranscriptionInstance.Status"] = payload.get("status") + self.transcription_text: Optional[str] = payload.get("transcription_text") + self.type: Optional[str] = payload.get("type") + self.uri: Optional[str] = payload.get("uri") self._solution = { "account_sid": account_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[TranscriptionContext] = None @@ -73,97 +94,6 @@ def _proxy(self) -> "TranscriptionContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Transcription resource. - """ - return self._properties["account_sid"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to create the transcription. - """ - return self._properties["api_version"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def duration(self) -> str: - """ - :returns: The duration of the transcribed audio in seconds. - """ - return self._properties["duration"] - - @property - def price(self) -> float: - """ - :returns: The charge for the transcript in the currency associated with the account. This value is populated after the transcript is complete so it may not be available immediately. - """ - return self._properties["price"] - - @property - def price_unit(self) -> str: - """ - :returns: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). - """ - return self._properties["price_unit"] - - @property - def recording_sid(self) -> str: - """ - :returns: The SID of the [Recording](https://www.twilio.com/docs/voice/api/recording) from which the transcription was created. - """ - return self._properties["recording_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the Transcription resource. - """ - return self._properties["sid"] - - @property - def status(self) -> "TranscriptionInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def transcription_text(self) -> str: - """ - :returns: The text content of the transcription. - """ - return self._properties["transcription_text"] - - @property - def type(self) -> str: - """ - :returns: The transcription type. Can only be: `fast`. - """ - return self._properties["type"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - def delete(self) -> bool: """ Deletes the TranscriptionInstance diff --git a/twilio/rest/api/v2010/account/usage/record/__init__.py b/twilio/rest/api/v2010/account/usage/record/__init__.py index 51b40c410..7f981ff4b 100644 --- a/twilio/rest/api/v2010/account/usage/record/__init__.py +++ b/twilio/rest/api/v2010/account/usage/record/__init__.py @@ -14,7 +14,7 @@ from datetime import date -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource @@ -351,139 +351,53 @@ class Category(object): WIRELESS_USAGE_SMS = "wireless-usage-sms" WIRELESS_USAGE_VOICE = "wireless-usage-voice" - def __init__(self, version, payload, account_sid: str): - """ - Initialize the RecordInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. + :ivar api_version: The API version used to create the resource. + :ivar as_of: Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT + :ivar category: + :ivar count: The number of usage events, such as the number of calls. + :ivar count_unit: The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. + :ivar description: A plain-language description of the usage category. + :ivar end_date: The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + :ivar price: The total price of the usage in the currency specified in `price_unit` and associated with the account. + :ivar price_unit: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. + :ivar start_date: The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + :ivar subresource_uris: A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + :ivar usage: The amount used to bill usage and measured in units described in `usage_unit`. + :ivar usage_unit: The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], account_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "api_version": payload.get("api_version"), - "as_of": payload.get("as_of"), - "category": payload.get("category"), - "count": payload.get("count"), - "count_unit": payload.get("count_unit"), - "description": payload.get("description"), - "end_date": deserialize.iso8601_date(payload.get("end_date")), - "price": deserialize.decimal(payload.get("price")), - "price_unit": payload.get("price_unit"), - "start_date": deserialize.iso8601_date(payload.get("start_date")), - "subresource_uris": payload.get("subresource_uris"), - "uri": payload.get("uri"), - "usage": payload.get("usage"), - "usage_unit": payload.get("usage_unit"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.api_version: Optional[str] = payload.get("api_version") + self.as_of: Optional[str] = payload.get("as_of") + self.category: Optional["RecordInstance.Category"] = payload.get("category") + self.count: Optional[str] = payload.get("count") + self.count_unit: Optional[str] = payload.get("count_unit") + self.description: Optional[str] = payload.get("description") + self.end_date: Optional[date] = deserialize.iso8601_date( + payload.get("end_date") + ) + self.price: Optional[float] = deserialize.decimal(payload.get("price")) + self.price_unit: Optional[str] = payload.get("price_unit") + self.start_date: Optional[date] = deserialize.iso8601_date( + payload.get("start_date") + ) + self.subresource_uris: Optional[Dict[str, object]] = payload.get( + "subresource_uris" + ) + self.uri: Optional[str] = payload.get("uri") + self.usage: Optional[str] = payload.get("usage") + self.usage_unit: Optional[str] = payload.get("usage_unit") self._solution = { "account_sid": account_sid, } - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. - """ - return self._properties["account_sid"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to create the resource. - """ - return self._properties["api_version"] - - @property - def as_of(self) -> str: - """ - :returns: Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT - """ - return self._properties["as_of"] - - @property - def category(self) -> "RecordInstance.Category": - """ - :returns: - """ - return self._properties["category"] - - @property - def count(self) -> str: - """ - :returns: The number of usage events, such as the number of calls. - """ - return self._properties["count"] - - @property - def count_unit(self) -> str: - """ - :returns: The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. - """ - return self._properties["count_unit"] - - @property - def description(self) -> str: - """ - :returns: A plain-language description of the usage category. - """ - return self._properties["description"] - - @property - def end_date(self) -> date: - """ - :returns: The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. - """ - return self._properties["end_date"] - - @property - def price(self) -> float: - """ - :returns: The total price of the usage in the currency specified in `price_unit` and associated with the account. - """ - return self._properties["price"] - - @property - def price_unit(self) -> str: - """ - :returns: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. - """ - return self._properties["price_unit"] - - @property - def start_date(self) -> date: - """ - :returns: The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. - """ - return self._properties["start_date"] - - @property - def subresource_uris(self) -> Dict[str, object]: - """ - :returns: A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). - """ - return self._properties["subresource_uris"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def usage(self) -> str: - """ - :returns: The amount used to bill usage and measured in units described in `usage_unit`. - """ - return self._properties["usage"] - - @property - def usage_unit(self) -> str: - """ - :returns: The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. - """ - return self._properties["usage_unit"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/usage/record/all_time.py b/twilio/rest/api/v2010/account/usage/record/all_time.py index 8db8463e2..9a13d4d66 100644 --- a/twilio/rest/api/v2010/account/usage/record/all_time.py +++ b/twilio/rest/api/v2010/account/usage/record/all_time.py @@ -14,7 +14,7 @@ from datetime import date -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource @@ -343,139 +343,53 @@ class Category(object): WIRELESS_USAGE_SMS = "wireless-usage-sms" WIRELESS_USAGE_VOICE = "wireless-usage-voice" - def __init__(self, version, payload, account_sid: str): - """ - Initialize the AllTimeInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. + :ivar api_version: The API version used to create the resource. + :ivar as_of: Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT + :ivar category: + :ivar count: The number of usage events, such as the number of calls. + :ivar count_unit: The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. + :ivar description: A plain-language description of the usage category. + :ivar end_date: The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + :ivar price: The total price of the usage in the currency specified in `price_unit` and associated with the account. + :ivar price_unit: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. + :ivar start_date: The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + :ivar subresource_uris: A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + :ivar usage: The amount used to bill usage and measured in units described in `usage_unit`. + :ivar usage_unit: The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], account_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "api_version": payload.get("api_version"), - "as_of": payload.get("as_of"), - "category": payload.get("category"), - "count": payload.get("count"), - "count_unit": payload.get("count_unit"), - "description": payload.get("description"), - "end_date": deserialize.iso8601_date(payload.get("end_date")), - "price": deserialize.decimal(payload.get("price")), - "price_unit": payload.get("price_unit"), - "start_date": deserialize.iso8601_date(payload.get("start_date")), - "subresource_uris": payload.get("subresource_uris"), - "uri": payload.get("uri"), - "usage": payload.get("usage"), - "usage_unit": payload.get("usage_unit"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.api_version: Optional[str] = payload.get("api_version") + self.as_of: Optional[str] = payload.get("as_of") + self.category: Optional["AllTimeInstance.Category"] = payload.get("category") + self.count: Optional[str] = payload.get("count") + self.count_unit: Optional[str] = payload.get("count_unit") + self.description: Optional[str] = payload.get("description") + self.end_date: Optional[date] = deserialize.iso8601_date( + payload.get("end_date") + ) + self.price: Optional[float] = deserialize.decimal(payload.get("price")) + self.price_unit: Optional[str] = payload.get("price_unit") + self.start_date: Optional[date] = deserialize.iso8601_date( + payload.get("start_date") + ) + self.subresource_uris: Optional[Dict[str, object]] = payload.get( + "subresource_uris" + ) + self.uri: Optional[str] = payload.get("uri") + self.usage: Optional[str] = payload.get("usage") + self.usage_unit: Optional[str] = payload.get("usage_unit") self._solution = { "account_sid": account_sid, } - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. - """ - return self._properties["account_sid"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to create the resource. - """ - return self._properties["api_version"] - - @property - def as_of(self) -> str: - """ - :returns: Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT - """ - return self._properties["as_of"] - - @property - def category(self) -> "AllTimeInstance.Category": - """ - :returns: - """ - return self._properties["category"] - - @property - def count(self) -> str: - """ - :returns: The number of usage events, such as the number of calls. - """ - return self._properties["count"] - - @property - def count_unit(self) -> str: - """ - :returns: The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. - """ - return self._properties["count_unit"] - - @property - def description(self) -> str: - """ - :returns: A plain-language description of the usage category. - """ - return self._properties["description"] - - @property - def end_date(self) -> date: - """ - :returns: The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. - """ - return self._properties["end_date"] - - @property - def price(self) -> float: - """ - :returns: The total price of the usage in the currency specified in `price_unit` and associated with the account. - """ - return self._properties["price"] - - @property - def price_unit(self) -> str: - """ - :returns: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. - """ - return self._properties["price_unit"] - - @property - def start_date(self) -> date: - """ - :returns: The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. - """ - return self._properties["start_date"] - - @property - def subresource_uris(self) -> Dict[str, object]: - """ - :returns: A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). - """ - return self._properties["subresource_uris"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def usage(self) -> str: - """ - :returns: The amount used to bill usage and measured in units described in `usage_unit`. - """ - return self._properties["usage"] - - @property - def usage_unit(self) -> str: - """ - :returns: The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. - """ - return self._properties["usage_unit"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/usage/record/daily.py b/twilio/rest/api/v2010/account/usage/record/daily.py index 63958ecc6..b6c86b336 100644 --- a/twilio/rest/api/v2010/account/usage/record/daily.py +++ b/twilio/rest/api/v2010/account/usage/record/daily.py @@ -14,7 +14,7 @@ from datetime import date -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource @@ -343,139 +343,53 @@ class Category(object): WIRELESS_USAGE_SMS = "wireless-usage-sms" WIRELESS_USAGE_VOICE = "wireless-usage-voice" - def __init__(self, version, payload, account_sid: str): - """ - Initialize the DailyInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. + :ivar api_version: The API version used to create the resource. + :ivar as_of: Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT + :ivar category: + :ivar count: The number of usage events, such as the number of calls. + :ivar count_unit: The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. + :ivar description: A plain-language description of the usage category. + :ivar end_date: The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + :ivar price: The total price of the usage in the currency specified in `price_unit` and associated with the account. + :ivar price_unit: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. + :ivar start_date: The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + :ivar subresource_uris: A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + :ivar usage: The amount used to bill usage and measured in units described in `usage_unit`. + :ivar usage_unit: The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], account_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "api_version": payload.get("api_version"), - "as_of": payload.get("as_of"), - "category": payload.get("category"), - "count": payload.get("count"), - "count_unit": payload.get("count_unit"), - "description": payload.get("description"), - "end_date": deserialize.iso8601_date(payload.get("end_date")), - "price": deserialize.decimal(payload.get("price")), - "price_unit": payload.get("price_unit"), - "start_date": deserialize.iso8601_date(payload.get("start_date")), - "subresource_uris": payload.get("subresource_uris"), - "uri": payload.get("uri"), - "usage": payload.get("usage"), - "usage_unit": payload.get("usage_unit"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.api_version: Optional[str] = payload.get("api_version") + self.as_of: Optional[str] = payload.get("as_of") + self.category: Optional["DailyInstance.Category"] = payload.get("category") + self.count: Optional[str] = payload.get("count") + self.count_unit: Optional[str] = payload.get("count_unit") + self.description: Optional[str] = payload.get("description") + self.end_date: Optional[date] = deserialize.iso8601_date( + payload.get("end_date") + ) + self.price: Optional[float] = deserialize.decimal(payload.get("price")) + self.price_unit: Optional[str] = payload.get("price_unit") + self.start_date: Optional[date] = deserialize.iso8601_date( + payload.get("start_date") + ) + self.subresource_uris: Optional[Dict[str, object]] = payload.get( + "subresource_uris" + ) + self.uri: Optional[str] = payload.get("uri") + self.usage: Optional[str] = payload.get("usage") + self.usage_unit: Optional[str] = payload.get("usage_unit") self._solution = { "account_sid": account_sid, } - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. - """ - return self._properties["account_sid"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to create the resource. - """ - return self._properties["api_version"] - - @property - def as_of(self) -> str: - """ - :returns: Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT - """ - return self._properties["as_of"] - - @property - def category(self) -> "DailyInstance.Category": - """ - :returns: - """ - return self._properties["category"] - - @property - def count(self) -> str: - """ - :returns: The number of usage events, such as the number of calls. - """ - return self._properties["count"] - - @property - def count_unit(self) -> str: - """ - :returns: The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. - """ - return self._properties["count_unit"] - - @property - def description(self) -> str: - """ - :returns: A plain-language description of the usage category. - """ - return self._properties["description"] - - @property - def end_date(self) -> date: - """ - :returns: The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. - """ - return self._properties["end_date"] - - @property - def price(self) -> float: - """ - :returns: The total price of the usage in the currency specified in `price_unit` and associated with the account. - """ - return self._properties["price"] - - @property - def price_unit(self) -> str: - """ - :returns: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. - """ - return self._properties["price_unit"] - - @property - def start_date(self) -> date: - """ - :returns: The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. - """ - return self._properties["start_date"] - - @property - def subresource_uris(self) -> Dict[str, object]: - """ - :returns: A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). - """ - return self._properties["subresource_uris"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def usage(self) -> str: - """ - :returns: The amount used to bill usage and measured in units described in `usage_unit`. - """ - return self._properties["usage"] - - @property - def usage_unit(self) -> str: - """ - :returns: The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. - """ - return self._properties["usage_unit"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/usage/record/last_month.py b/twilio/rest/api/v2010/account/usage/record/last_month.py index bf990a5a1..3deb2ca11 100644 --- a/twilio/rest/api/v2010/account/usage/record/last_month.py +++ b/twilio/rest/api/v2010/account/usage/record/last_month.py @@ -14,7 +14,7 @@ from datetime import date -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource @@ -343,139 +343,53 @@ class Category(object): WIRELESS_USAGE_SMS = "wireless-usage-sms" WIRELESS_USAGE_VOICE = "wireless-usage-voice" - def __init__(self, version, payload, account_sid: str): - """ - Initialize the LastMonthInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. + :ivar api_version: The API version used to create the resource. + :ivar as_of: Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT + :ivar category: + :ivar count: The number of usage events, such as the number of calls. + :ivar count_unit: The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. + :ivar description: A plain-language description of the usage category. + :ivar end_date: The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + :ivar price: The total price of the usage in the currency specified in `price_unit` and associated with the account. + :ivar price_unit: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. + :ivar start_date: The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + :ivar subresource_uris: A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + :ivar usage: The amount used to bill usage and measured in units described in `usage_unit`. + :ivar usage_unit: The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], account_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "api_version": payload.get("api_version"), - "as_of": payload.get("as_of"), - "category": payload.get("category"), - "count": payload.get("count"), - "count_unit": payload.get("count_unit"), - "description": payload.get("description"), - "end_date": deserialize.iso8601_date(payload.get("end_date")), - "price": deserialize.decimal(payload.get("price")), - "price_unit": payload.get("price_unit"), - "start_date": deserialize.iso8601_date(payload.get("start_date")), - "subresource_uris": payload.get("subresource_uris"), - "uri": payload.get("uri"), - "usage": payload.get("usage"), - "usage_unit": payload.get("usage_unit"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.api_version: Optional[str] = payload.get("api_version") + self.as_of: Optional[str] = payload.get("as_of") + self.category: Optional["LastMonthInstance.Category"] = payload.get("category") + self.count: Optional[str] = payload.get("count") + self.count_unit: Optional[str] = payload.get("count_unit") + self.description: Optional[str] = payload.get("description") + self.end_date: Optional[date] = deserialize.iso8601_date( + payload.get("end_date") + ) + self.price: Optional[float] = deserialize.decimal(payload.get("price")) + self.price_unit: Optional[str] = payload.get("price_unit") + self.start_date: Optional[date] = deserialize.iso8601_date( + payload.get("start_date") + ) + self.subresource_uris: Optional[Dict[str, object]] = payload.get( + "subresource_uris" + ) + self.uri: Optional[str] = payload.get("uri") + self.usage: Optional[str] = payload.get("usage") + self.usage_unit: Optional[str] = payload.get("usage_unit") self._solution = { "account_sid": account_sid, } - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. - """ - return self._properties["account_sid"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to create the resource. - """ - return self._properties["api_version"] - - @property - def as_of(self) -> str: - """ - :returns: Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT - """ - return self._properties["as_of"] - - @property - def category(self) -> "LastMonthInstance.Category": - """ - :returns: - """ - return self._properties["category"] - - @property - def count(self) -> str: - """ - :returns: The number of usage events, such as the number of calls. - """ - return self._properties["count"] - - @property - def count_unit(self) -> str: - """ - :returns: The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. - """ - return self._properties["count_unit"] - - @property - def description(self) -> str: - """ - :returns: A plain-language description of the usage category. - """ - return self._properties["description"] - - @property - def end_date(self) -> date: - """ - :returns: The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. - """ - return self._properties["end_date"] - - @property - def price(self) -> float: - """ - :returns: The total price of the usage in the currency specified in `price_unit` and associated with the account. - """ - return self._properties["price"] - - @property - def price_unit(self) -> str: - """ - :returns: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. - """ - return self._properties["price_unit"] - - @property - def start_date(self) -> date: - """ - :returns: The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. - """ - return self._properties["start_date"] - - @property - def subresource_uris(self) -> Dict[str, object]: - """ - :returns: A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). - """ - return self._properties["subresource_uris"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def usage(self) -> str: - """ - :returns: The amount used to bill usage and measured in units described in `usage_unit`. - """ - return self._properties["usage"] - - @property - def usage_unit(self) -> str: - """ - :returns: The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. - """ - return self._properties["usage_unit"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/usage/record/monthly.py b/twilio/rest/api/v2010/account/usage/record/monthly.py index cfff3de39..4dc609093 100644 --- a/twilio/rest/api/v2010/account/usage/record/monthly.py +++ b/twilio/rest/api/v2010/account/usage/record/monthly.py @@ -14,7 +14,7 @@ from datetime import date -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource @@ -343,139 +343,53 @@ class Category(object): WIRELESS_USAGE_SMS = "wireless-usage-sms" WIRELESS_USAGE_VOICE = "wireless-usage-voice" - def __init__(self, version, payload, account_sid: str): - """ - Initialize the MonthlyInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. + :ivar api_version: The API version used to create the resource. + :ivar as_of: Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT + :ivar category: + :ivar count: The number of usage events, such as the number of calls. + :ivar count_unit: The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. + :ivar description: A plain-language description of the usage category. + :ivar end_date: The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + :ivar price: The total price of the usage in the currency specified in `price_unit` and associated with the account. + :ivar price_unit: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. + :ivar start_date: The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + :ivar subresource_uris: A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + :ivar usage: The amount used to bill usage and measured in units described in `usage_unit`. + :ivar usage_unit: The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], account_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "api_version": payload.get("api_version"), - "as_of": payload.get("as_of"), - "category": payload.get("category"), - "count": payload.get("count"), - "count_unit": payload.get("count_unit"), - "description": payload.get("description"), - "end_date": deserialize.iso8601_date(payload.get("end_date")), - "price": deserialize.decimal(payload.get("price")), - "price_unit": payload.get("price_unit"), - "start_date": deserialize.iso8601_date(payload.get("start_date")), - "subresource_uris": payload.get("subresource_uris"), - "uri": payload.get("uri"), - "usage": payload.get("usage"), - "usage_unit": payload.get("usage_unit"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.api_version: Optional[str] = payload.get("api_version") + self.as_of: Optional[str] = payload.get("as_of") + self.category: Optional["MonthlyInstance.Category"] = payload.get("category") + self.count: Optional[str] = payload.get("count") + self.count_unit: Optional[str] = payload.get("count_unit") + self.description: Optional[str] = payload.get("description") + self.end_date: Optional[date] = deserialize.iso8601_date( + payload.get("end_date") + ) + self.price: Optional[float] = deserialize.decimal(payload.get("price")) + self.price_unit: Optional[str] = payload.get("price_unit") + self.start_date: Optional[date] = deserialize.iso8601_date( + payload.get("start_date") + ) + self.subresource_uris: Optional[Dict[str, object]] = payload.get( + "subresource_uris" + ) + self.uri: Optional[str] = payload.get("uri") + self.usage: Optional[str] = payload.get("usage") + self.usage_unit: Optional[str] = payload.get("usage_unit") self._solution = { "account_sid": account_sid, } - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. - """ - return self._properties["account_sid"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to create the resource. - """ - return self._properties["api_version"] - - @property - def as_of(self) -> str: - """ - :returns: Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT - """ - return self._properties["as_of"] - - @property - def category(self) -> "MonthlyInstance.Category": - """ - :returns: - """ - return self._properties["category"] - - @property - def count(self) -> str: - """ - :returns: The number of usage events, such as the number of calls. - """ - return self._properties["count"] - - @property - def count_unit(self) -> str: - """ - :returns: The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. - """ - return self._properties["count_unit"] - - @property - def description(self) -> str: - """ - :returns: A plain-language description of the usage category. - """ - return self._properties["description"] - - @property - def end_date(self) -> date: - """ - :returns: The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. - """ - return self._properties["end_date"] - - @property - def price(self) -> float: - """ - :returns: The total price of the usage in the currency specified in `price_unit` and associated with the account. - """ - return self._properties["price"] - - @property - def price_unit(self) -> str: - """ - :returns: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. - """ - return self._properties["price_unit"] - - @property - def start_date(self) -> date: - """ - :returns: The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. - """ - return self._properties["start_date"] - - @property - def subresource_uris(self) -> Dict[str, object]: - """ - :returns: A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). - """ - return self._properties["subresource_uris"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def usage(self) -> str: - """ - :returns: The amount used to bill usage and measured in units described in `usage_unit`. - """ - return self._properties["usage"] - - @property - def usage_unit(self) -> str: - """ - :returns: The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. - """ - return self._properties["usage_unit"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/usage/record/this_month.py b/twilio/rest/api/v2010/account/usage/record/this_month.py index 3a205eba5..4e70a6896 100644 --- a/twilio/rest/api/v2010/account/usage/record/this_month.py +++ b/twilio/rest/api/v2010/account/usage/record/this_month.py @@ -14,7 +14,7 @@ from datetime import date -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource @@ -343,139 +343,53 @@ class Category(object): WIRELESS_USAGE_SMS = "wireless-usage-sms" WIRELESS_USAGE_VOICE = "wireless-usage-voice" - def __init__(self, version, payload, account_sid: str): - """ - Initialize the ThisMonthInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. + :ivar api_version: The API version used to create the resource. + :ivar as_of: Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT + :ivar category: + :ivar count: The number of usage events, such as the number of calls. + :ivar count_unit: The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. + :ivar description: A plain-language description of the usage category. + :ivar end_date: The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + :ivar price: The total price of the usage in the currency specified in `price_unit` and associated with the account. + :ivar price_unit: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. + :ivar start_date: The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + :ivar subresource_uris: A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + :ivar usage: The amount used to bill usage and measured in units described in `usage_unit`. + :ivar usage_unit: The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], account_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "api_version": payload.get("api_version"), - "as_of": payload.get("as_of"), - "category": payload.get("category"), - "count": payload.get("count"), - "count_unit": payload.get("count_unit"), - "description": payload.get("description"), - "end_date": deserialize.iso8601_date(payload.get("end_date")), - "price": deserialize.decimal(payload.get("price")), - "price_unit": payload.get("price_unit"), - "start_date": deserialize.iso8601_date(payload.get("start_date")), - "subresource_uris": payload.get("subresource_uris"), - "uri": payload.get("uri"), - "usage": payload.get("usage"), - "usage_unit": payload.get("usage_unit"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.api_version: Optional[str] = payload.get("api_version") + self.as_of: Optional[str] = payload.get("as_of") + self.category: Optional["ThisMonthInstance.Category"] = payload.get("category") + self.count: Optional[str] = payload.get("count") + self.count_unit: Optional[str] = payload.get("count_unit") + self.description: Optional[str] = payload.get("description") + self.end_date: Optional[date] = deserialize.iso8601_date( + payload.get("end_date") + ) + self.price: Optional[float] = deserialize.decimal(payload.get("price")) + self.price_unit: Optional[str] = payload.get("price_unit") + self.start_date: Optional[date] = deserialize.iso8601_date( + payload.get("start_date") + ) + self.subresource_uris: Optional[Dict[str, object]] = payload.get( + "subresource_uris" + ) + self.uri: Optional[str] = payload.get("uri") + self.usage: Optional[str] = payload.get("usage") + self.usage_unit: Optional[str] = payload.get("usage_unit") self._solution = { "account_sid": account_sid, } - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. - """ - return self._properties["account_sid"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to create the resource. - """ - return self._properties["api_version"] - - @property - def as_of(self) -> str: - """ - :returns: Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT - """ - return self._properties["as_of"] - - @property - def category(self) -> "ThisMonthInstance.Category": - """ - :returns: - """ - return self._properties["category"] - - @property - def count(self) -> str: - """ - :returns: The number of usage events, such as the number of calls. - """ - return self._properties["count"] - - @property - def count_unit(self) -> str: - """ - :returns: The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. - """ - return self._properties["count_unit"] - - @property - def description(self) -> str: - """ - :returns: A plain-language description of the usage category. - """ - return self._properties["description"] - - @property - def end_date(self) -> date: - """ - :returns: The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. - """ - return self._properties["end_date"] - - @property - def price(self) -> float: - """ - :returns: The total price of the usage in the currency specified in `price_unit` and associated with the account. - """ - return self._properties["price"] - - @property - def price_unit(self) -> str: - """ - :returns: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. - """ - return self._properties["price_unit"] - - @property - def start_date(self) -> date: - """ - :returns: The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. - """ - return self._properties["start_date"] - - @property - def subresource_uris(self) -> Dict[str, object]: - """ - :returns: A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). - """ - return self._properties["subresource_uris"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def usage(self) -> str: - """ - :returns: The amount used to bill usage and measured in units described in `usage_unit`. - """ - return self._properties["usage"] - - @property - def usage_unit(self) -> str: - """ - :returns: The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. - """ - return self._properties["usage_unit"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/usage/record/today.py b/twilio/rest/api/v2010/account/usage/record/today.py index 4c7dd7f7f..ce917f30d 100644 --- a/twilio/rest/api/v2010/account/usage/record/today.py +++ b/twilio/rest/api/v2010/account/usage/record/today.py @@ -14,7 +14,7 @@ from datetime import date -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource @@ -343,139 +343,53 @@ class Category(object): WIRELESS_USAGE_SMS = "wireless-usage-sms" WIRELESS_USAGE_VOICE = "wireless-usage-voice" - def __init__(self, version, payload, account_sid: str): - """ - Initialize the TodayInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. + :ivar api_version: The API version used to create the resource. + :ivar as_of: Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT + :ivar category: + :ivar count: The number of usage events, such as the number of calls. + :ivar count_unit: The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. + :ivar description: A plain-language description of the usage category. + :ivar end_date: The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + :ivar price: The total price of the usage in the currency specified in `price_unit` and associated with the account. + :ivar price_unit: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. + :ivar start_date: The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + :ivar subresource_uris: A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + :ivar usage: The amount used to bill usage and measured in units described in `usage_unit`. + :ivar usage_unit: The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], account_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "api_version": payload.get("api_version"), - "as_of": payload.get("as_of"), - "category": payload.get("category"), - "count": payload.get("count"), - "count_unit": payload.get("count_unit"), - "description": payload.get("description"), - "end_date": deserialize.iso8601_date(payload.get("end_date")), - "price": deserialize.decimal(payload.get("price")), - "price_unit": payload.get("price_unit"), - "start_date": deserialize.iso8601_date(payload.get("start_date")), - "subresource_uris": payload.get("subresource_uris"), - "uri": payload.get("uri"), - "usage": payload.get("usage"), - "usage_unit": payload.get("usage_unit"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.api_version: Optional[str] = payload.get("api_version") + self.as_of: Optional[str] = payload.get("as_of") + self.category: Optional["TodayInstance.Category"] = payload.get("category") + self.count: Optional[str] = payload.get("count") + self.count_unit: Optional[str] = payload.get("count_unit") + self.description: Optional[str] = payload.get("description") + self.end_date: Optional[date] = deserialize.iso8601_date( + payload.get("end_date") + ) + self.price: Optional[float] = deserialize.decimal(payload.get("price")) + self.price_unit: Optional[str] = payload.get("price_unit") + self.start_date: Optional[date] = deserialize.iso8601_date( + payload.get("start_date") + ) + self.subresource_uris: Optional[Dict[str, object]] = payload.get( + "subresource_uris" + ) + self.uri: Optional[str] = payload.get("uri") + self.usage: Optional[str] = payload.get("usage") + self.usage_unit: Optional[str] = payload.get("usage_unit") self._solution = { "account_sid": account_sid, } - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. - """ - return self._properties["account_sid"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to create the resource. - """ - return self._properties["api_version"] - - @property - def as_of(self) -> str: - """ - :returns: Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT - """ - return self._properties["as_of"] - - @property - def category(self) -> "TodayInstance.Category": - """ - :returns: - """ - return self._properties["category"] - - @property - def count(self) -> str: - """ - :returns: The number of usage events, such as the number of calls. - """ - return self._properties["count"] - - @property - def count_unit(self) -> str: - """ - :returns: The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. - """ - return self._properties["count_unit"] - - @property - def description(self) -> str: - """ - :returns: A plain-language description of the usage category. - """ - return self._properties["description"] - - @property - def end_date(self) -> date: - """ - :returns: The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. - """ - return self._properties["end_date"] - - @property - def price(self) -> float: - """ - :returns: The total price of the usage in the currency specified in `price_unit` and associated with the account. - """ - return self._properties["price"] - - @property - def price_unit(self) -> str: - """ - :returns: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. - """ - return self._properties["price_unit"] - - @property - def start_date(self) -> date: - """ - :returns: The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. - """ - return self._properties["start_date"] - - @property - def subresource_uris(self) -> Dict[str, object]: - """ - :returns: A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). - """ - return self._properties["subresource_uris"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def usage(self) -> str: - """ - :returns: The amount used to bill usage and measured in units described in `usage_unit`. - """ - return self._properties["usage"] - - @property - def usage_unit(self) -> str: - """ - :returns: The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. - """ - return self._properties["usage_unit"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/usage/record/yearly.py b/twilio/rest/api/v2010/account/usage/record/yearly.py index a0e83f96b..36b306559 100644 --- a/twilio/rest/api/v2010/account/usage/record/yearly.py +++ b/twilio/rest/api/v2010/account/usage/record/yearly.py @@ -14,7 +14,7 @@ from datetime import date -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource @@ -343,139 +343,53 @@ class Category(object): WIRELESS_USAGE_SMS = "wireless-usage-sms" WIRELESS_USAGE_VOICE = "wireless-usage-voice" - def __init__(self, version, payload, account_sid: str): - """ - Initialize the YearlyInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. + :ivar api_version: The API version used to create the resource. + :ivar as_of: Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT + :ivar category: + :ivar count: The number of usage events, such as the number of calls. + :ivar count_unit: The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. + :ivar description: A plain-language description of the usage category. + :ivar end_date: The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + :ivar price: The total price of the usage in the currency specified in `price_unit` and associated with the account. + :ivar price_unit: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. + :ivar start_date: The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + :ivar subresource_uris: A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + :ivar usage: The amount used to bill usage and measured in units described in `usage_unit`. + :ivar usage_unit: The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], account_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "api_version": payload.get("api_version"), - "as_of": payload.get("as_of"), - "category": payload.get("category"), - "count": payload.get("count"), - "count_unit": payload.get("count_unit"), - "description": payload.get("description"), - "end_date": deserialize.iso8601_date(payload.get("end_date")), - "price": deserialize.decimal(payload.get("price")), - "price_unit": payload.get("price_unit"), - "start_date": deserialize.iso8601_date(payload.get("start_date")), - "subresource_uris": payload.get("subresource_uris"), - "uri": payload.get("uri"), - "usage": payload.get("usage"), - "usage_unit": payload.get("usage_unit"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.api_version: Optional[str] = payload.get("api_version") + self.as_of: Optional[str] = payload.get("as_of") + self.category: Optional["YearlyInstance.Category"] = payload.get("category") + self.count: Optional[str] = payload.get("count") + self.count_unit: Optional[str] = payload.get("count_unit") + self.description: Optional[str] = payload.get("description") + self.end_date: Optional[date] = deserialize.iso8601_date( + payload.get("end_date") + ) + self.price: Optional[float] = deserialize.decimal(payload.get("price")) + self.price_unit: Optional[str] = payload.get("price_unit") + self.start_date: Optional[date] = deserialize.iso8601_date( + payload.get("start_date") + ) + self.subresource_uris: Optional[Dict[str, object]] = payload.get( + "subresource_uris" + ) + self.uri: Optional[str] = payload.get("uri") + self.usage: Optional[str] = payload.get("usage") + self.usage_unit: Optional[str] = payload.get("usage_unit") self._solution = { "account_sid": account_sid, } - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. - """ - return self._properties["account_sid"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to create the resource. - """ - return self._properties["api_version"] - - @property - def as_of(self) -> str: - """ - :returns: Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT - """ - return self._properties["as_of"] - - @property - def category(self) -> "YearlyInstance.Category": - """ - :returns: - """ - return self._properties["category"] - - @property - def count(self) -> str: - """ - :returns: The number of usage events, such as the number of calls. - """ - return self._properties["count"] - - @property - def count_unit(self) -> str: - """ - :returns: The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. - """ - return self._properties["count_unit"] - - @property - def description(self) -> str: - """ - :returns: A plain-language description of the usage category. - """ - return self._properties["description"] - - @property - def end_date(self) -> date: - """ - :returns: The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. - """ - return self._properties["end_date"] - - @property - def price(self) -> float: - """ - :returns: The total price of the usage in the currency specified in `price_unit` and associated with the account. - """ - return self._properties["price"] - - @property - def price_unit(self) -> str: - """ - :returns: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. - """ - return self._properties["price_unit"] - - @property - def start_date(self) -> date: - """ - :returns: The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. - """ - return self._properties["start_date"] - - @property - def subresource_uris(self) -> Dict[str, object]: - """ - :returns: A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). - """ - return self._properties["subresource_uris"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def usage(self) -> str: - """ - :returns: The amount used to bill usage and measured in units described in `usage_unit`. - """ - return self._properties["usage"] - - @property - def usage_unit(self) -> str: - """ - :returns: The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. - """ - return self._properties["usage_unit"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/usage/record/yesterday.py b/twilio/rest/api/v2010/account/usage/record/yesterday.py index caa7dd0dc..8616b8eee 100644 --- a/twilio/rest/api/v2010/account/usage/record/yesterday.py +++ b/twilio/rest/api/v2010/account/usage/record/yesterday.py @@ -14,7 +14,7 @@ from datetime import date -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource @@ -343,139 +343,53 @@ class Category(object): WIRELESS_USAGE_SMS = "wireless-usage-sms" WIRELESS_USAGE_VOICE = "wireless-usage-voice" - def __init__(self, version, payload, account_sid: str): - """ - Initialize the YesterdayInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. + :ivar api_version: The API version used to create the resource. + :ivar as_of: Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT + :ivar category: + :ivar count: The number of usage events, such as the number of calls. + :ivar count_unit: The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. + :ivar description: A plain-language description of the usage category. + :ivar end_date: The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + :ivar price: The total price of the usage in the currency specified in `price_unit` and associated with the account. + :ivar price_unit: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. + :ivar start_date: The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. + :ivar subresource_uris: A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + :ivar usage: The amount used to bill usage and measured in units described in `usage_unit`. + :ivar usage_unit: The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], account_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "api_version": payload.get("api_version"), - "as_of": payload.get("as_of"), - "category": payload.get("category"), - "count": payload.get("count"), - "count_unit": payload.get("count_unit"), - "description": payload.get("description"), - "end_date": deserialize.iso8601_date(payload.get("end_date")), - "price": deserialize.decimal(payload.get("price")), - "price_unit": payload.get("price_unit"), - "start_date": deserialize.iso8601_date(payload.get("start_date")), - "subresource_uris": payload.get("subresource_uris"), - "uri": payload.get("uri"), - "usage": payload.get("usage"), - "usage_unit": payload.get("usage_unit"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.api_version: Optional[str] = payload.get("api_version") + self.as_of: Optional[str] = payload.get("as_of") + self.category: Optional["YesterdayInstance.Category"] = payload.get("category") + self.count: Optional[str] = payload.get("count") + self.count_unit: Optional[str] = payload.get("count_unit") + self.description: Optional[str] = payload.get("description") + self.end_date: Optional[date] = deserialize.iso8601_date( + payload.get("end_date") + ) + self.price: Optional[float] = deserialize.decimal(payload.get("price")) + self.price_unit: Optional[str] = payload.get("price_unit") + self.start_date: Optional[date] = deserialize.iso8601_date( + payload.get("start_date") + ) + self.subresource_uris: Optional[Dict[str, object]] = payload.get( + "subresource_uris" + ) + self.uri: Optional[str] = payload.get("uri") + self.usage: Optional[str] = payload.get("usage") + self.usage_unit: Optional[str] = payload.get("usage_unit") self._solution = { "account_sid": account_sid, } - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that accrued the usage. - """ - return self._properties["account_sid"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to create the resource. - """ - return self._properties["api_version"] - - @property - def as_of(self) -> str: - """ - :returns: Usage records up to date as of this timestamp, formatted as YYYY-MM-DDTHH:MM:SS+00:00. All timestamps are in GMT - """ - return self._properties["as_of"] - - @property - def category(self) -> "YesterdayInstance.Category": - """ - :returns: - """ - return self._properties["category"] - - @property - def count(self) -> str: - """ - :returns: The number of usage events, such as the number of calls. - """ - return self._properties["count"] - - @property - def count_unit(self) -> str: - """ - :returns: The units in which `count` is measured, such as `calls` for calls or `messages` for SMS. - """ - return self._properties["count_unit"] - - @property - def description(self) -> str: - """ - :returns: A plain-language description of the usage category. - """ - return self._properties["description"] - - @property - def end_date(self) -> date: - """ - :returns: The last date for which usage is included in the UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. - """ - return self._properties["end_date"] - - @property - def price(self) -> float: - """ - :returns: The total price of the usage in the currency specified in `price_unit` and associated with the account. - """ - return self._properties["price"] - - @property - def price_unit(self) -> str: - """ - :returns: The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format, such as `usd`, `eur`, and `jpy`. - """ - return self._properties["price_unit"] - - @property - def start_date(self) -> date: - """ - :returns: The first date for which usage is included in this UsageRecord. The date is specified in GMT and formatted as `YYYY-MM-DD`. - """ - return self._properties["start_date"] - - @property - def subresource_uris(self) -> Dict[str, object]: - """ - :returns: A list of related resources identified by their URIs. For more information, see [List Subresources](https://www.twilio.com/docs/usage/api/usage-record#list-subresources). - """ - return self._properties["subresource_uris"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def usage(self) -> str: - """ - :returns: The amount used to bill usage and measured in units described in `usage_unit`. - """ - return self._properties["usage"] - - @property - def usage_unit(self) -> str: - """ - :returns: The units in which `usage` is measured, such as `minutes` for calls or `messages` for SMS. - """ - return self._properties["usage_unit"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/api/v2010/account/usage/trigger.py b/twilio/rest/api/v2010/account/usage/trigger.py index 54ca25164..c5ec4f5c8 100644 --- a/twilio/rest/api/v2010/account/usage/trigger.py +++ b/twilio/rest/api/v2010/account/usage/trigger.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -354,34 +354,64 @@ class UsageCategory(object): WIRELESS_USAGE_SMS = "wireless-usage-sms" WIRELESS_USAGE_VOICE = "wireless-usage-voice" - def __init__(self, version, payload, account_sid: str, sid: Optional[str] = None): - """ - Initialize the TriggerInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the trigger monitors. + :ivar api_version: The API version used to create the resource. + :ivar callback_method: The HTTP method we use to call `callback_url`. Can be: `GET` or `POST`. + :ivar callback_url: The URL we call using the `callback_method` when the trigger fires. + :ivar current_value: The current value of the field the trigger is watching. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_fired: The date and time in GMT that the trigger was last fired specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar friendly_name: The string that you assigned to describe the trigger. + :ivar recurring: + :ivar sid: The unique string that that we created to identify the UsageTrigger resource. + :ivar trigger_by: + :ivar trigger_value: The value at which the trigger will fire. Must be a positive, numeric value. + :ivar uri: The URI of the resource, relative to `https://api.twilio.com`. + :ivar usage_category: + :ivar usage_record_uri: The URI of the [UsageRecord](https://www.twilio.com/docs/usage/api/usage-record) resource this trigger watches, relative to `https://api.twilio.com`. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + account_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "api_version": payload.get("api_version"), - "callback_method": payload.get("callback_method"), - "callback_url": payload.get("callback_url"), - "current_value": payload.get("current_value"), - "date_created": deserialize.rfc2822_datetime(payload.get("date_created")), - "date_fired": deserialize.rfc2822_datetime(payload.get("date_fired")), - "date_updated": deserialize.rfc2822_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "recurring": payload.get("recurring"), - "sid": payload.get("sid"), - "trigger_by": payload.get("trigger_by"), - "trigger_value": payload.get("trigger_value"), - "uri": payload.get("uri"), - "usage_category": payload.get("usage_category"), - "usage_record_uri": payload.get("usage_record_uri"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.api_version: Optional[str] = payload.get("api_version") + self.callback_method: Optional[str] = payload.get("callback_method") + self.callback_url: Optional[str] = payload.get("callback_url") + self.current_value: Optional[str] = payload.get("current_value") + self.date_created: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_created") + ) + self.date_fired: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_fired") + ) + self.date_updated: Optional[datetime] = deserialize.rfc2822_datetime( + payload.get("date_updated") + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.recurring: Optional["TriggerInstance.Recurring"] = payload.get("recurring") + self.sid: Optional[str] = payload.get("sid") + self.trigger_by: Optional["TriggerInstance.TriggerField"] = payload.get( + "trigger_by" + ) + self.trigger_value: Optional[str] = payload.get("trigger_value") + self.uri: Optional[str] = payload.get("uri") + self.usage_category: Optional["TriggerInstance.UsageCategory"] = payload.get( + "usage_category" + ) + self.usage_record_uri: Optional[str] = payload.get("usage_record_uri") self._solution = { "account_sid": account_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[TriggerContext] = None @@ -401,118 +431,6 @@ def _proxy(self) -> "TriggerContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the trigger monitors. - """ - return self._properties["account_sid"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to create the resource. - """ - return self._properties["api_version"] - - @property - def callback_method(self) -> str: - """ - :returns: The HTTP method we use to call `callback_url`. Can be: `GET` or `POST`. - """ - return self._properties["callback_method"] - - @property - def callback_url(self) -> str: - """ - :returns: The URL we call using the `callback_method` when the trigger fires. - """ - return self._properties["callback_url"] - - @property - def current_value(self) -> str: - """ - :returns: The current value of the field the trigger is watching. - """ - return self._properties["current_value"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_fired(self) -> datetime: - """ - :returns: The date and time in GMT that the trigger was last fired specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_fired"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the trigger. - """ - return self._properties["friendly_name"] - - @property - def recurring(self) -> "TriggerInstance.Recurring": - """ - :returns: - """ - return self._properties["recurring"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the UsageTrigger resource. - """ - return self._properties["sid"] - - @property - def trigger_by(self) -> "TriggerInstance.TriggerField": - """ - :returns: - """ - return self._properties["trigger_by"] - - @property - def trigger_value(self) -> str: - """ - :returns: The value at which the trigger will fire. Must be a positive, numeric value. - """ - return self._properties["trigger_value"] - - @property - def uri(self) -> str: - """ - :returns: The URI of the resource, relative to `https://api.twilio.com`. - """ - return self._properties["uri"] - - @property - def usage_category(self) -> "TriggerInstance.UsageCategory": - """ - :returns: - """ - return self._properties["usage_category"] - - @property - def usage_record_uri(self) -> str: - """ - :returns: The URI of the [UsageRecord](https://www.twilio.com/docs/usage/api/usage-record) resource this trigger watches, relative to `https://api.twilio.com`. - """ - return self._properties["usage_record_uri"] - def delete(self) -> bool: """ Deletes the TriggerInstance diff --git a/twilio/rest/api/v2010/account/validation_request.py b/twilio/rest/api/v2010/account/validation_request.py index 2d2202c13..648e90324 100644 --- a/twilio/rest/api/v2010/account/validation_request.py +++ b/twilio/rest/api/v2010/account/validation_request.py @@ -13,6 +13,7 @@ """ +from typing import Any, Dict, Optional from twilio.base import values from twilio.base.instance_resource import InstanceResource @@ -21,59 +22,28 @@ class ValidationRequestInstance(InstanceResource): - def __init__(self, version, payload, account_sid: str): - """ - Initialize the ValidationRequestInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for the Caller ID. + :ivar call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Caller ID is associated with. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar phone_number: The phone number to verify in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + :ivar validation_code: The 6 digit validation code that someone must enter to validate the Caller ID when `phone_number` is called. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], account_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "call_sid": payload.get("call_sid"), - "friendly_name": payload.get("friendly_name"), - "phone_number": payload.get("phone_number"), - "validation_code": payload.get("validation_code"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.call_sid: Optional[str] = payload.get("call_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.phone_number: Optional[str] = payload.get("phone_number") + self.validation_code: Optional[str] = payload.get("validation_code") self._solution = { "account_sid": account_sid, } - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for the Caller ID. - """ - return self._properties["account_sid"] - - @property - def call_sid(self) -> str: - """ - :returns: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Caller ID is associated with. - """ - return self._properties["call_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def phone_number(self) -> str: - """ - :returns: The phone number to verify in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. - """ - return self._properties["phone_number"] - - @property - def validation_code(self) -> str: - """ - :returns: The 6 digit validation code that someone must enter to validate the Caller ID when `phone_number` is called. - """ - return self._properties["validation_code"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/autopilot/v1/assistant/__init__.py b/twilio/rest/autopilot/v1/assistant/__init__.py index 1f434c1c5..82d0ce70d 100644 --- a/twilio/rest/autopilot/v1/assistant/__init__.py +++ b/twilio/rest/autopilot/v1/assistant/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -32,31 +32,52 @@ class AssistantInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the AssistantInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Assistant resource. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar friendly_name: The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. + :ivar latest_model_build_sid: Reserved. + :ivar links: A list of the URLs of the Assistant's related resources. + :ivar log_queries: Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. + :ivar development_stage: A string describing the state of the assistant. + :ivar needs_model_build: Whether model needs to be rebuilt. + :ivar sid: The unique string that we created to identify the Assistant resource. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. It can be up to 64 characters long. + :ivar url: The absolute URL of the Assistant resource. + :ivar callback_url: Reserved. + :ivar callback_events: Reserved. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "latest_model_build_sid": payload.get("latest_model_build_sid"), - "links": payload.get("links"), - "log_queries": payload.get("log_queries"), - "development_stage": payload.get("development_stage"), - "needs_model_build": payload.get("needs_model_build"), - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "url": payload.get("url"), - "callback_url": payload.get("callback_url"), - "callback_events": payload.get("callback_events"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.latest_model_build_sid: Optional[str] = payload.get( + "latest_model_build_sid" + ) + self.links: Optional[Dict[str, object]] = payload.get("links") + self.log_queries: Optional[bool] = payload.get("log_queries") + self.development_stage: Optional[str] = payload.get("development_stage") + self.needs_model_build: Optional[bool] = payload.get("needs_model_build") + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.url: Optional[str] = payload.get("url") + self.callback_url: Optional[str] = payload.get("callback_url") + self.callback_events: Optional[str] = payload.get("callback_events") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[AssistantContext] = None @@ -75,104 +96,6 @@ def _proxy(self) -> "AssistantContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Assistant resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. - """ - return self._properties["friendly_name"] - - @property - def latest_model_build_sid(self) -> str: - """ - :returns: Reserved. - """ - return self._properties["latest_model_build_sid"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: A list of the URLs of the Assistant's related resources. - """ - return self._properties["links"] - - @property - def log_queries(self) -> bool: - """ - :returns: Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. - """ - return self._properties["log_queries"] - - @property - def development_stage(self) -> str: - """ - :returns: A string describing the state of the assistant. - """ - return self._properties["development_stage"] - - @property - def needs_model_build(self) -> bool: - """ - :returns: Whether model needs to be rebuilt. - """ - return self._properties["needs_model_build"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Assistant resource. - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. It can be up to 64 characters long. - """ - return self._properties["unique_name"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Assistant resource. - """ - return self._properties["url"] - - @property - def callback_url(self) -> str: - """ - :returns: Reserved. - """ - return self._properties["callback_url"] - - @property - def callback_events(self) -> str: - """ - :returns: Reserved. - """ - return self._properties["callback_events"] - def delete(self) -> bool: """ Deletes the AssistantInstance diff --git a/twilio/rest/autopilot/v1/assistant/defaults.py b/twilio/rest/autopilot/v1/assistant/defaults.py index 0d4e00f6d..5a8e2f8e7 100644 --- a/twilio/rest/autopilot/v1/assistant/defaults.py +++ b/twilio/rest/autopilot/v1/assistant/defaults.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -22,18 +22,21 @@ class DefaultsInstance(InstanceResource): - def __init__(self, version, payload, assistant_sid: str): - """ - Initialize the DefaultsInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Defaults resource. + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. + :ivar url: The absolute URL of the Defaults resource. + :ivar data: The JSON string that describes the default task links for the `assistant_initiation`, `collect`, and `fallback` situations. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], assistant_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "assistant_sid": payload.get("assistant_sid"), - "url": payload.get("url"), - "data": payload.get("data"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.url: Optional[str] = payload.get("url") + self.data: Optional[Dict[str, object]] = payload.get("data") self._solution = { "assistant_sid": assistant_sid, @@ -55,34 +58,6 @@ def _proxy(self) -> "DefaultsContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Defaults resource. - """ - return self._properties["account_sid"] - - @property - def assistant_sid(self) -> str: - """ - :returns: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. - """ - return self._properties["assistant_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Defaults resource. - """ - return self._properties["url"] - - @property - def data(self) -> Dict[str, object]: - """ - :returns: The JSON string that describes the default task links for the `assistant_initiation`, `collect`, and `fallback` situations. - """ - return self._properties["data"] - def fetch(self) -> "DefaultsInstance": """ Fetch the DefaultsInstance diff --git a/twilio/rest/autopilot/v1/assistant/dialogue.py b/twilio/rest/autopilot/v1/assistant/dialogue.py index 8df56953d..76e3e3e84 100644 --- a/twilio/rest/autopilot/v1/assistant/dialogue.py +++ b/twilio/rest/autopilot/v1/assistant/dialogue.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -21,23 +21,33 @@ class DialogueInstance(InstanceResource): - def __init__(self, version, payload, assistant_sid: str, sid: Optional[str] = None): - """ - Initialize the DialogueInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Dialogue resource. + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. + :ivar sid: The unique string that we created to identify the Dialogue resource. + :ivar data: The JSON string that describes the dialogue session object. + :ivar url: The absolute URL of the Dialogue resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "assistant_sid": payload.get("assistant_sid"), - "sid": payload.get("sid"), - "data": payload.get("data"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.data: Optional[Dict[str, object]] = payload.get("data") + self.url: Optional[str] = payload.get("url") self._solution = { "assistant_sid": assistant_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[DialogueContext] = None @@ -57,41 +67,6 @@ def _proxy(self) -> "DialogueContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Dialogue resource. - """ - return self._properties["account_sid"] - - @property - def assistant_sid(self) -> str: - """ - :returns: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. - """ - return self._properties["assistant_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Dialogue resource. - """ - return self._properties["sid"] - - @property - def data(self) -> Dict[str, object]: - """ - :returns: The JSON string that describes the dialogue session object. - """ - return self._properties["data"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Dialogue resource. - """ - return self._properties["url"] - def fetch(self) -> "DialogueInstance": """ Fetch the DialogueInstance diff --git a/twilio/rest/autopilot/v1/assistant/field_type/__init__.py b/twilio/rest/autopilot/v1/assistant/field_type/__init__.py index 7aece0269..9d9453bbf 100644 --- a/twilio/rest/autopilot/v1/assistant/field_type/__init__.py +++ b/twilio/rest/autopilot/v1/assistant/field_type/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -25,27 +25,45 @@ class FieldTypeInstance(InstanceResource): - def __init__(self, version, payload, assistant_sid: str, sid: Optional[str] = None): - """ - Initialize the FieldTypeInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the FieldType resource. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar friendly_name: The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. + :ivar links: A list of the URLs of related resources. + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. + :ivar sid: The unique string that we created to identify the FieldType resource. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + :ivar url: The absolute URL of the FieldType resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "links": payload.get("links"), - "assistant_sid": payload.get("assistant_sid"), - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.url: Optional[str] = payload.get("url") self._solution = { "assistant_sid": assistant_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[FieldTypeContext] = None @@ -65,69 +83,6 @@ def _proxy(self) -> "FieldTypeContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the FieldType resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. - """ - return self._properties["friendly_name"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: A list of the URLs of related resources. - """ - return self._properties["links"] - - @property - def assistant_sid(self) -> str: - """ - :returns: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. - """ - return self._properties["assistant_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the FieldType resource. - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - """ - return self._properties["unique_name"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the FieldType resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the FieldTypeInstance diff --git a/twilio/rest/autopilot/v1/assistant/field_type/field_value.py b/twilio/rest/autopilot/v1/assistant/field_type/field_value.py index 529aa3b15..a2c081591 100644 --- a/twilio/rest/autopilot/v1/assistant/field_type/field_value.py +++ b/twilio/rest/autopilot/v1/assistant/field_type/field_value.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,36 +24,49 @@ class FieldValueInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the FieldValue resource. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar field_type_sid: The SID of the Field Type associated with the Field Value. + :ivar language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the FieldType associated with the resource. + :ivar sid: The unique string that we created to identify the FieldValue resource. + :ivar value: The Field Value data. + :ivar url: The absolute URL of the FieldValue resource. + :ivar synonym_of: The word for which the field value is a synonym of. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], assistant_sid: str, field_type_sid: str, sid: Optional[str] = None, ): - """ - Initialize the FieldValueInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "field_type_sid": payload.get("field_type_sid"), - "language": payload.get("language"), - "assistant_sid": payload.get("assistant_sid"), - "sid": payload.get("sid"), - "value": payload.get("value"), - "url": payload.get("url"), - "synonym_of": payload.get("synonym_of"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.field_type_sid: Optional[str] = payload.get("field_type_sid") + self.language: Optional[str] = payload.get("language") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.value: Optional[str] = payload.get("value") + self.url: Optional[str] = payload.get("url") + self.synonym_of: Optional[str] = payload.get("synonym_of") self._solution = { "assistant_sid": assistant_sid, "field_type_sid": field_type_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[FieldValueContext] = None @@ -74,76 +87,6 @@ def _proxy(self) -> "FieldValueContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the FieldValue resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def field_type_sid(self) -> str: - """ - :returns: The SID of the Field Type associated with the Field Value. - """ - return self._properties["field_type_sid"] - - @property - def language(self) -> str: - """ - :returns: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` - """ - return self._properties["language"] - - @property - def assistant_sid(self) -> str: - """ - :returns: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the FieldType associated with the resource. - """ - return self._properties["assistant_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the FieldValue resource. - """ - return self._properties["sid"] - - @property - def value(self) -> str: - """ - :returns: The Field Value data. - """ - return self._properties["value"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the FieldValue resource. - """ - return self._properties["url"] - - @property - def synonym_of(self) -> str: - """ - :returns: The word for which the field value is a synonym of. - """ - return self._properties["synonym_of"] - def delete(self) -> bool: """ Deletes the FieldValueInstance diff --git a/twilio/rest/autopilot/v1/assistant/model_build.py b/twilio/rest/autopilot/v1/assistant/model_build.py index 56fff5981..2cd96e11a 100644 --- a/twilio/rest/autopilot/v1/assistant/model_build.py +++ b/twilio/rest/autopilot/v1/assistant/model_build.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -31,28 +31,48 @@ class Status(object): FAILED = "failed" CANCELED = "canceled" - def __init__(self, version, payload, assistant_sid: str, sid: Optional[str] = None): - """ - Initialize the ModelBuildInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ModelBuild resource. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. + :ivar sid: The unique string that we created to identify the ModelBuild resource. + :ivar status: + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. + :ivar url: The absolute URL of the ModelBuild resource. + :ivar build_duration: The time in seconds it took to build the model. + :ivar error_code: If the `status` for the model build is `failed`, this value is a code to more information about the failure. This value will be null for all other statuses. See [error code dictionary](https://www.twilio.com/docs/api/errors) for a description of the error. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "assistant_sid": payload.get("assistant_sid"), - "sid": payload.get("sid"), - "status": payload.get("status"), - "unique_name": payload.get("unique_name"), - "url": payload.get("url"), - "build_duration": deserialize.integer(payload.get("build_duration")), - "error_code": deserialize.integer(payload.get("error_code")), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.status: Optional["ModelBuildInstance.Status"] = payload.get("status") + self.unique_name: Optional[str] = payload.get("unique_name") + self.url: Optional[str] = payload.get("url") + self.build_duration: Optional[int] = deserialize.integer( + payload.get("build_duration") + ) + self.error_code: Optional[int] = deserialize.integer(payload.get("error_code")) self._solution = { "assistant_sid": assistant_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ModelBuildContext] = None @@ -72,76 +92,6 @@ def _proxy(self) -> "ModelBuildContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ModelBuild resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def assistant_sid(self) -> str: - """ - :returns: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. - """ - return self._properties["assistant_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the ModelBuild resource. - """ - return self._properties["sid"] - - @property - def status(self) -> "ModelBuildInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. - """ - return self._properties["unique_name"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the ModelBuild resource. - """ - return self._properties["url"] - - @property - def build_duration(self) -> int: - """ - :returns: The time in seconds it took to build the model. - """ - return self._properties["build_duration"] - - @property - def error_code(self) -> int: - """ - :returns: If the `status` for the model build is `failed`, this value is a code to more information about the failure. This value will be null for all other statuses. See [error code dictionary](https://www.twilio.com/docs/api/errors) for a description of the error. - """ - return self._properties["error_code"] - def delete(self) -> bool: """ Deletes the ModelBuildInstance diff --git a/twilio/rest/autopilot/v1/assistant/query.py b/twilio/rest/autopilot/v1/assistant/query.py index 25963079d..707ba6285 100644 --- a/twilio/rest/autopilot/v1/assistant/query.py +++ b/twilio/rest/autopilot/v1/assistant/query.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,32 +24,55 @@ class QueryInstance(InstanceResource): - def __init__(self, version, payload, assistant_sid: str, sid: Optional[str] = None): - """ - Initialize the QueryInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Query resource. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar results: The natural language analysis results that include the [Task](https://www.twilio.com/docs/autopilot/api/task) recognized and a list of identified [Fields](https://www.twilio.com/docs/autopilot/api/task-field). + :ivar language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query. For example: `en-US`. + :ivar model_build_sid: The SID of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) queried. + :ivar query: The end-user's natural language input. + :ivar sample_sid: The SID of an optional reference to the [Sample](https://www.twilio.com/docs/autopilot/api/task-sample) created from the query. + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. + :ivar sid: The unique string that we created to identify the Query resource. + :ivar status: The status of the Query. Can be: `pending-review`, `reviewed`, or `discarded` + :ivar url: The absolute URL of the Query resource. + :ivar source_channel: The communication channel from where the end-user input came. + :ivar dialogue_sid: The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue). + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "results": payload.get("results"), - "language": payload.get("language"), - "model_build_sid": payload.get("model_build_sid"), - "query": payload.get("query"), - "sample_sid": payload.get("sample_sid"), - "assistant_sid": payload.get("assistant_sid"), - "sid": payload.get("sid"), - "status": payload.get("status"), - "url": payload.get("url"), - "source_channel": payload.get("source_channel"), - "dialogue_sid": payload.get("dialogue_sid"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.results: Optional[Dict[str, object]] = payload.get("results") + self.language: Optional[str] = payload.get("language") + self.model_build_sid: Optional[str] = payload.get("model_build_sid") + self.query: Optional[str] = payload.get("query") + self.sample_sid: Optional[str] = payload.get("sample_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.status: Optional[str] = payload.get("status") + self.url: Optional[str] = payload.get("url") + self.source_channel: Optional[str] = payload.get("source_channel") + self.dialogue_sid: Optional[str] = payload.get("dialogue_sid") self._solution = { "assistant_sid": assistant_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[QueryContext] = None @@ -69,104 +92,6 @@ def _proxy(self) -> "QueryContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Query resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def results(self) -> Dict[str, object]: - """ - :returns: The natural language analysis results that include the [Task](https://www.twilio.com/docs/autopilot/api/task) recognized and a list of identified [Fields](https://www.twilio.com/docs/autopilot/api/task-field). - """ - return self._properties["results"] - - @property - def language(self) -> str: - """ - :returns: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query. For example: `en-US`. - """ - return self._properties["language"] - - @property - def model_build_sid(self) -> str: - """ - :returns: The SID of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) queried. - """ - return self._properties["model_build_sid"] - - @property - def query(self) -> str: - """ - :returns: The end-user's natural language input. - """ - return self._properties["query"] - - @property - def sample_sid(self) -> str: - """ - :returns: The SID of an optional reference to the [Sample](https://www.twilio.com/docs/autopilot/api/task-sample) created from the query. - """ - return self._properties["sample_sid"] - - @property - def assistant_sid(self) -> str: - """ - :returns: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. - """ - return self._properties["assistant_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Query resource. - """ - return self._properties["sid"] - - @property - def status(self) -> str: - """ - :returns: The status of the Query. Can be: `pending-review`, `reviewed`, or `discarded` - """ - return self._properties["status"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Query resource. - """ - return self._properties["url"] - - @property - def source_channel(self) -> str: - """ - :returns: The communication channel from where the end-user input came. - """ - return self._properties["source_channel"] - - @property - def dialogue_sid(self) -> str: - """ - :returns: The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue). - """ - return self._properties["dialogue_sid"] - def delete(self) -> bool: """ Deletes the QueryInstance diff --git a/twilio/rest/autopilot/v1/assistant/style_sheet.py b/twilio/rest/autopilot/v1/assistant/style_sheet.py index b79e557bd..cfbb97722 100644 --- a/twilio/rest/autopilot/v1/assistant/style_sheet.py +++ b/twilio/rest/autopilot/v1/assistant/style_sheet.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -22,18 +22,21 @@ class StyleSheetInstance(InstanceResource): - def __init__(self, version, payload, assistant_sid: str): - """ - Initialize the StyleSheetInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the StyleSheet resource. + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. + :ivar url: The absolute URL of the StyleSheet resource. + :ivar data: The JSON string that describes the style sheet object. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], assistant_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "assistant_sid": payload.get("assistant_sid"), - "url": payload.get("url"), - "data": payload.get("data"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.url: Optional[str] = payload.get("url") + self.data: Optional[Dict[str, object]] = payload.get("data") self._solution = { "assistant_sid": assistant_sid, @@ -55,34 +58,6 @@ def _proxy(self) -> "StyleSheetContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the StyleSheet resource. - """ - return self._properties["account_sid"] - - @property - def assistant_sid(self) -> str: - """ - :returns: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. - """ - return self._properties["assistant_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the StyleSheet resource. - """ - return self._properties["url"] - - @property - def data(self) -> Dict[str, object]: - """ - :returns: The JSON string that describes the style sheet object. - """ - return self._properties["data"] - def fetch(self) -> "StyleSheetInstance": """ Fetch the StyleSheetInstance diff --git a/twilio/rest/autopilot/v1/assistant/task/__init__.py b/twilio/rest/autopilot/v1/assistant/task/__init__.py index 93689530c..5e69c43a7 100644 --- a/twilio/rest/autopilot/v1/assistant/task/__init__.py +++ b/twilio/rest/autopilot/v1/assistant/task/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,28 +28,47 @@ class TaskInstance(InstanceResource): - def __init__(self, version, payload, assistant_sid: str, sid: Optional[str] = None): - """ - Initialize the TaskInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Task resource. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar friendly_name: The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. + :ivar links: A list of the URLs of related resources. + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. + :ivar sid: The unique string that we created to identify the Task resource. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + :ivar actions_url: The URL from which the Assistant can fetch actions. + :ivar url: The absolute URL of the Task resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "links": payload.get("links"), - "assistant_sid": payload.get("assistant_sid"), - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "actions_url": payload.get("actions_url"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.actions_url: Optional[str] = payload.get("actions_url") + self.url: Optional[str] = payload.get("url") self._solution = { "assistant_sid": assistant_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[TaskContext] = None @@ -69,76 +88,6 @@ def _proxy(self) -> "TaskContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Task resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. - """ - return self._properties["friendly_name"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: A list of the URLs of related resources. - """ - return self._properties["links"] - - @property - def assistant_sid(self) -> str: - """ - :returns: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. - """ - return self._properties["assistant_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Task resource. - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - """ - return self._properties["unique_name"] - - @property - def actions_url(self) -> str: - """ - :returns: The URL from which the Assistant can fetch actions. - """ - return self._properties["actions_url"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Task resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the TaskInstance diff --git a/twilio/rest/autopilot/v1/assistant/task/field.py b/twilio/rest/autopilot/v1/assistant/task/field.py index 4e358aee4..5c56f0807 100644 --- a/twilio/rest/autopilot/v1/assistant/task/field.py +++ b/twilio/rest/autopilot/v1/assistant/task/field.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,35 +24,47 @@ class FieldInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Field resource. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar field_type: The Field Type of the field. Can be: a [Built-in Field Type](https://www.twilio.com/docs/autopilot/built-in-field-types), the unique_name, or the SID of a custom Field Type. + :ivar task_sid: The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) resource associated with this Field. + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. + :ivar sid: The unique string that we created to identify the Field resource. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + :ivar url: The absolute URL of the Field resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], assistant_sid: str, task_sid: str, sid: Optional[str] = None, ): - """ - Initialize the FieldInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "field_type": payload.get("field_type"), - "task_sid": payload.get("task_sid"), - "assistant_sid": payload.get("assistant_sid"), - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.field_type: Optional[str] = payload.get("field_type") + self.task_sid: Optional[str] = payload.get("task_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.url: Optional[str] = payload.get("url") self._solution = { "assistant_sid": assistant_sid, "task_sid": task_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[FieldContext] = None @@ -73,69 +85,6 @@ def _proxy(self) -> "FieldContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Field resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def field_type(self) -> str: - """ - :returns: The Field Type of the field. Can be: a [Built-in Field Type](https://www.twilio.com/docs/autopilot/built-in-field-types), the unique_name, or the SID of a custom Field Type. - """ - return self._properties["field_type"] - - @property - def task_sid(self) -> str: - """ - :returns: The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) resource associated with this Field. - """ - return self._properties["task_sid"] - - @property - def assistant_sid(self) -> str: - """ - :returns: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. - """ - return self._properties["assistant_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Field resource. - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - """ - return self._properties["unique_name"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Field resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the FieldInstance diff --git a/twilio/rest/autopilot/v1/assistant/task/sample.py b/twilio/rest/autopilot/v1/assistant/task/sample.py index 4304f61bb..05b7e33f0 100644 --- a/twilio/rest/autopilot/v1/assistant/task/sample.py +++ b/twilio/rest/autopilot/v1/assistant/task/sample.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,36 +24,49 @@ class SampleInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sample resource. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar task_sid: The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) associated with the resource. + :ivar language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. + :ivar sid: The unique string that we created to identify the Sample resource. + :ivar tagged_text: The text example of how end users might express the task. The sample can contain [Field tag blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging). + :ivar url: The absolute URL of the Sample resource. + :ivar source_channel: The communication channel from which the sample was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], assistant_sid: str, task_sid: str, sid: Optional[str] = None, ): - """ - Initialize the SampleInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "task_sid": payload.get("task_sid"), - "language": payload.get("language"), - "assistant_sid": payload.get("assistant_sid"), - "sid": payload.get("sid"), - "tagged_text": payload.get("tagged_text"), - "url": payload.get("url"), - "source_channel": payload.get("source_channel"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.task_sid: Optional[str] = payload.get("task_sid") + self.language: Optional[str] = payload.get("language") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.tagged_text: Optional[str] = payload.get("tagged_text") + self.url: Optional[str] = payload.get("url") + self.source_channel: Optional[str] = payload.get("source_channel") self._solution = { "assistant_sid": assistant_sid, "task_sid": task_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[SampleContext] = None @@ -74,76 +87,6 @@ def _proxy(self) -> "SampleContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sample resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def task_sid(self) -> str: - """ - :returns: The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) associated with the resource. - """ - return self._properties["task_sid"] - - @property - def language(self) -> str: - """ - :returns: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. - """ - return self._properties["language"] - - @property - def assistant_sid(self) -> str: - """ - :returns: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. - """ - return self._properties["assistant_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Sample resource. - """ - return self._properties["sid"] - - @property - def tagged_text(self) -> str: - """ - :returns: The text example of how end users might express the task. The sample can contain [Field tag blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging). - """ - return self._properties["tagged_text"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Sample resource. - """ - return self._properties["url"] - - @property - def source_channel(self) -> str: - """ - :returns: The communication channel from which the sample was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included. - """ - return self._properties["source_channel"] - def delete(self) -> bool: """ Deletes the SampleInstance diff --git a/twilio/rest/autopilot/v1/assistant/task/task_actions.py b/twilio/rest/autopilot/v1/assistant/task/task_actions.py index fb48a8c8a..498a6b528 100644 --- a/twilio/rest/autopilot/v1/assistant/task/task_actions.py +++ b/twilio/rest/autopilot/v1/assistant/task/task_actions.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -22,19 +22,29 @@ class TaskActionsInstance(InstanceResource): - def __init__(self, version, payload, assistant_sid: str, task_sid: str): - """ - Initialize the TaskActionsInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskActions resource. + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. + :ivar task_sid: The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) associated with the resource. + :ivar url: The absolute URL of the TaskActions resource. + :ivar data: The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + task_sid: str, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "assistant_sid": payload.get("assistant_sid"), - "task_sid": payload.get("task_sid"), - "url": payload.get("url"), - "data": payload.get("data"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.task_sid: Optional[str] = payload.get("task_sid") + self.url: Optional[str] = payload.get("url") + self.data: Optional[Dict[str, object]] = payload.get("data") self._solution = { "assistant_sid": assistant_sid, @@ -58,41 +68,6 @@ def _proxy(self) -> "TaskActionsContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskActions resource. - """ - return self._properties["account_sid"] - - @property - def assistant_sid(self) -> str: - """ - :returns: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. - """ - return self._properties["assistant_sid"] - - @property - def task_sid(self) -> str: - """ - :returns: The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) associated with the resource. - """ - return self._properties["task_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the TaskActions resource. - """ - return self._properties["url"] - - @property - def data(self) -> Dict[str, object]: - """ - :returns: The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. - """ - return self._properties["data"] - def fetch(self) -> "TaskActionsInstance": """ Fetch the TaskActionsInstance diff --git a/twilio/rest/autopilot/v1/assistant/task/task_statistics.py b/twilio/rest/autopilot/v1/assistant/task/task_statistics.py index be3de5069..3d92b05cb 100644 --- a/twilio/rest/autopilot/v1/assistant/task/task_statistics.py +++ b/twilio/rest/autopilot/v1/assistant/task/task_statistics.py @@ -13,7 +13,7 @@ """ -from typing import Optional +from typing import Any, Dict, Optional from twilio.base import deserialize from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -22,20 +22,35 @@ class TaskStatisticsInstance(InstanceResource): - def __init__(self, version, payload, assistant_sid: str, task_sid: str): - """ - Initialize the TaskStatisticsInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskStatistics resource. + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. + :ivar task_sid: The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) for which the statistics were collected. + :ivar samples_count: The total number of [Samples](https://www.twilio.com/docs/autopilot/api/task-sample) associated with the Task. + :ivar fields_count: The total number of [Fields](https://www.twilio.com/docs/autopilot/api/task-field) associated with the Task. + :ivar url: The absolute URL of the TaskStatistics resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + task_sid: str, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "assistant_sid": payload.get("assistant_sid"), - "task_sid": payload.get("task_sid"), - "samples_count": deserialize.integer(payload.get("samples_count")), - "fields_count": deserialize.integer(payload.get("fields_count")), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.task_sid: Optional[str] = payload.get("task_sid") + self.samples_count: Optional[int] = deserialize.integer( + payload.get("samples_count") + ) + self.fields_count: Optional[int] = deserialize.integer( + payload.get("fields_count") + ) + self.url: Optional[str] = payload.get("url") self._solution = { "assistant_sid": assistant_sid, @@ -59,48 +74,6 @@ def _proxy(self) -> "TaskStatisticsContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskStatistics resource. - """ - return self._properties["account_sid"] - - @property - def assistant_sid(self) -> str: - """ - :returns: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. - """ - return self._properties["assistant_sid"] - - @property - def task_sid(self) -> str: - """ - :returns: The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) for which the statistics were collected. - """ - return self._properties["task_sid"] - - @property - def samples_count(self) -> int: - """ - :returns: The total number of [Samples](https://www.twilio.com/docs/autopilot/api/task-sample) associated with the Task. - """ - return self._properties["samples_count"] - - @property - def fields_count(self) -> int: - """ - :returns: The total number of [Fields](https://www.twilio.com/docs/autopilot/api/task-field) associated with the Task. - """ - return self._properties["fields_count"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the TaskStatistics resource. - """ - return self._properties["url"] - def fetch(self) -> "TaskStatisticsInstance": """ Fetch the TaskStatisticsInstance diff --git a/twilio/rest/autopilot/v1/assistant/webhook.py b/twilio/rest/autopilot/v1/assistant/webhook.py index 2c9494d91..e2b3e05b9 100644 --- a/twilio/rest/autopilot/v1/assistant/webhook.py +++ b/twilio/rest/autopilot/v1/assistant/webhook.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,28 +24,47 @@ class WebhookInstance(InstanceResource): - def __init__(self, version, payload, assistant_sid: str, sid: Optional[str] = None): - """ - Initialize the WebhookInstance - """ + + """ + :ivar url: The absolute URL of the Webhook resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Webhook resource. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. + :ivar sid: The unique string that we created to identify the Webhook resource. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + :ivar events: The list of space-separated events that this Webhook is subscribed to. + :ivar webhook_url: The URL associated with this Webhook. + :ivar webhook_method: The method used when calling the webhook's URL. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "url": payload.get("url"), - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "assistant_sid": payload.get("assistant_sid"), - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "events": payload.get("events"), - "webhook_url": payload.get("webhook_url"), - "webhook_method": payload.get("webhook_method"), - } + self.url: Optional[str] = payload.get("url") + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.events: Optional[str] = payload.get("events") + self.webhook_url: Optional[str] = payload.get("webhook_url") + self.webhook_method: Optional[str] = payload.get("webhook_method") self._solution = { "assistant_sid": assistant_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[WebhookContext] = None @@ -65,76 +84,6 @@ def _proxy(self) -> "WebhookContext": ) return self._context - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Webhook resource. - """ - return self._properties["url"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Webhook resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def assistant_sid(self) -> str: - """ - :returns: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. - """ - return self._properties["assistant_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Webhook resource. - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - """ - return self._properties["unique_name"] - - @property - def events(self) -> str: - """ - :returns: The list of space-separated events that this Webhook is subscribed to. - """ - return self._properties["events"] - - @property - def webhook_url(self) -> str: - """ - :returns: The URL associated with this Webhook. - """ - return self._properties["webhook_url"] - - @property - def webhook_method(self) -> str: - """ - :returns: The method used when calling the webhook's URL. - """ - return self._properties["webhook_method"] - def delete(self) -> bool: """ Deletes the WebhookInstance diff --git a/twilio/rest/autopilot/v1/restore_assistant.py b/twilio/rest/autopilot/v1/restore_assistant.py index 35ca37d7d..0ddf3ecbc 100644 --- a/twilio/rest/autopilot/v1/restore_assistant.py +++ b/twilio/rest/autopilot/v1/restore_assistant.py @@ -14,6 +14,7 @@ from datetime import datetime +from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -22,113 +23,46 @@ class RestoreAssistantInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the RestoreAssistantInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Assistant resource. + :ivar sid: The unique string that we created to identify the Assistant resource. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + :ivar friendly_name: The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. + :ivar needs_model_build: Whether model needs to be rebuilt. + :ivar latest_model_build_sid: Reserved. + :ivar log_queries: Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. + :ivar development_stage: A string describing the state of the assistant. + :ivar callback_url: Reserved. + :ivar callback_events: Reserved. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "sid": payload.get("sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "unique_name": payload.get("unique_name"), - "friendly_name": payload.get("friendly_name"), - "needs_model_build": payload.get("needs_model_build"), - "latest_model_build_sid": payload.get("latest_model_build_sid"), - "log_queries": payload.get("log_queries"), - "development_stage": payload.get("development_stage"), - "callback_url": payload.get("callback_url"), - "callback_events": payload.get("callback_events"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.sid: Optional[str] = payload.get("sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.unique_name: Optional[str] = payload.get("unique_name") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.needs_model_build: Optional[bool] = payload.get("needs_model_build") + self.latest_model_build_sid: Optional[str] = payload.get( + "latest_model_build_sid" + ) + self.log_queries: Optional[bool] = payload.get("log_queries") + self.development_stage: Optional[str] = payload.get("development_stage") + self.callback_url: Optional[str] = payload.get("callback_url") + self.callback_events: Optional[str] = payload.get("callback_events") self._solution = {} - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Assistant resource. - """ - return self._properties["account_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Assistant resource. - """ - return self._properties["sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - """ - return self._properties["unique_name"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. - """ - return self._properties["friendly_name"] - - @property - def needs_model_build(self) -> bool: - """ - :returns: Whether model needs to be rebuilt. - """ - return self._properties["needs_model_build"] - - @property - def latest_model_build_sid(self) -> str: - """ - :returns: Reserved. - """ - return self._properties["latest_model_build_sid"] - - @property - def log_queries(self) -> bool: - """ - :returns: Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. - """ - return self._properties["log_queries"] - - @property - def development_stage(self) -> str: - """ - :returns: A string describing the state of the assistant. - """ - return self._properties["development_stage"] - - @property - def callback_url(self) -> str: - """ - :returns: Reserved. - """ - return self._properties["callback_url"] - - @property - def callback_events(self) -> str: - """ - :returns: Reserved. - """ - return self._properties["callback_events"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/bulkexports/v1/export/__init__.py b/twilio/rest/bulkexports/v1/export/__init__.py index 2d8857477..e5c6f470a 100644 --- a/twilio/rest/bulkexports/v1/export/__init__.py +++ b/twilio/rest/bulkexports/v1/export/__init__.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -25,20 +25,27 @@ class ExportInstance(InstanceResource): - def __init__(self, version, payload, resource_type: Optional[str] = None): - """ - Initialize the ExportInstance - """ + + """ + :ivar resource_type: The type of communication – Messages, Calls, Conferences, and Participants + :ivar url: The URL of this resource. + :ivar links: Contains a dictionary of URL links to nested resources of this Export. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + resource_type: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "resource_type": payload.get("resource_type"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.resource_type: Optional[str] = payload.get("resource_type") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "resource_type": resource_type or self._properties["resource_type"], + "resource_type": resource_type or self.resource_type, } self._context: Optional[ExportContext] = None @@ -57,27 +64,6 @@ def _proxy(self) -> "ExportContext": ) return self._context - @property - def resource_type(self) -> str: - """ - :returns: The type of communication – Messages, Calls, Conferences, and Participants - """ - return self._properties["resource_type"] - - @property - def url(self) -> str: - """ - :returns: The URL of this resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: Contains a dictionary of URL links to nested resources of this Export. - """ - return self._properties["links"] - def fetch(self) -> "ExportInstance": """ Fetch the ExportInstance diff --git a/twilio/rest/bulkexports/v1/export/day.py b/twilio/rest/bulkexports/v1/export/day.py index 5f54ebda5..67c97279c 100644 --- a/twilio/rest/bulkexports/v1/export/day.py +++ b/twilio/rest/bulkexports/v1/export/day.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,24 +23,35 @@ class DayInstance(InstanceResource): - def __init__(self, version, payload, resource_type: str, day: Optional[str] = None): - """ - Initialize the DayInstance - """ + + """ + :ivar redirect_to: + :ivar day: The ISO 8601 format date of the resources in the file, for a UTC day + :ivar size: The size of the day's data file in bytes + :ivar create_date: The ISO 8601 format date when resources is created + :ivar friendly_name: The friendly name specified when creating the job + :ivar resource_type: The type of communication – Messages, Calls, Conferences, and Participants + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + resource_type: str, + day: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "redirect_to": payload.get("redirect_to"), - "day": payload.get("day"), - "size": deserialize.integer(payload.get("size")), - "create_date": payload.get("create_date"), - "friendly_name": payload.get("friendly_name"), - "resource_type": payload.get("resource_type"), - } + self.redirect_to: Optional[str] = payload.get("redirect_to") + self.day: Optional[str] = payload.get("day") + self.size: Optional[int] = deserialize.integer(payload.get("size")) + self.create_date: Optional[str] = payload.get("create_date") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.resource_type: Optional[str] = payload.get("resource_type") self._solution = { "resource_type": resource_type, - "day": day or self._properties["day"], + "day": day or self.day, } self._context: Optional[DayContext] = None @@ -60,48 +71,6 @@ def _proxy(self) -> "DayContext": ) return self._context - @property - def redirect_to(self) -> str: - """ - :returns: - """ - return self._properties["redirect_to"] - - @property - def day(self) -> str: - """ - :returns: The ISO 8601 format date of the resources in the file, for a UTC day - """ - return self._properties["day"] - - @property - def size(self) -> int: - """ - :returns: The size of the day's data file in bytes - """ - return self._properties["size"] - - @property - def create_date(self) -> str: - """ - :returns: The ISO 8601 format date when resources is created - """ - return self._properties["create_date"] - - @property - def friendly_name(self) -> str: - """ - :returns: The friendly name specified when creating the job - """ - return self._properties["friendly_name"] - - @property - def resource_type(self) -> str: - """ - :returns: The type of communication – Messages, Calls, Conferences, and Participants - """ - return self._properties["resource_type"] - def fetch(self) -> "DayInstance": """ Fetch the DayInstance diff --git a/twilio/rest/bulkexports/v1/export/export_custom_job.py b/twilio/rest/bulkexports/v1/export/export_custom_job.py index 2ec712696..5314e87c1 100644 --- a/twilio/rest/bulkexports/v1/export/export_custom_job.py +++ b/twilio/rest/bulkexports/v1/export/export_custom_job.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_resource import InstanceResource @@ -23,107 +23,42 @@ class ExportCustomJobInstance(InstanceResource): - def __init__(self, version, payload, resource_type: str): - """ - Initialize the ExportCustomJobInstance - """ + + """ + :ivar friendly_name: The friendly name specified when creating the job + :ivar resource_type: The type of communication – Messages, Calls, Conferences, and Participants + :ivar start_day: The start day for the custom export specified when creating the job + :ivar end_day: The end day for the export specified when creating the job + :ivar webhook_url: The optional webhook url called on completion of the job. If this is supplied, `WebhookMethod` must also be supplied. + :ivar webhook_method: This is the method used to call the webhook on completion of the job. If this is supplied, `WebhookUrl` must also be supplied. + :ivar email: The optional email to send the completion notification to + :ivar job_sid: The unique job_sid returned when the custom export was created + :ivar details: The details of a job which is an object that contains an array of status grouped by `status` state. Each `status` object has a `status` string, a count which is the number of days in that `status`, and list of days in that `status`. The day strings are in the format yyyy-MM-dd. As an example, a currently running job may have a status object for COMPLETED and a `status` object for SUBMITTED each with its own count and list of days. + :ivar job_queue_position: This is the job position from the 1st in line. Your queue position will never increase. As jobs ahead of yours in the queue are processed, the queue position number will decrease + :ivar estimated_completion_time: this is the time estimated until your job is complete. This is calculated each time you request the job list. The time is calculated based on the current rate of job completion (which may vary) and your job queue position + """ + + def __init__(self, version: Version, payload: Dict[str, Any], resource_type: str): super().__init__(version) - self._properties = { - "friendly_name": payload.get("friendly_name"), - "resource_type": payload.get("resource_type"), - "start_day": payload.get("start_day"), - "end_day": payload.get("end_day"), - "webhook_url": payload.get("webhook_url"), - "webhook_method": payload.get("webhook_method"), - "email": payload.get("email"), - "job_sid": payload.get("job_sid"), - "details": payload.get("details"), - "job_queue_position": payload.get("job_queue_position"), - "estimated_completion_time": payload.get("estimated_completion_time"), - } + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.resource_type: Optional[str] = payload.get("resource_type") + self.start_day: Optional[str] = payload.get("start_day") + self.end_day: Optional[str] = payload.get("end_day") + self.webhook_url: Optional[str] = payload.get("webhook_url") + self.webhook_method: Optional[str] = payload.get("webhook_method") + self.email: Optional[str] = payload.get("email") + self.job_sid: Optional[str] = payload.get("job_sid") + self.details: Optional[Dict[str, object]] = payload.get("details") + self.job_queue_position: Optional[str] = payload.get("job_queue_position") + self.estimated_completion_time: Optional[str] = payload.get( + "estimated_completion_time" + ) self._solution = { "resource_type": resource_type, } - @property - def friendly_name(self) -> str: - """ - :returns: The friendly name specified when creating the job - """ - return self._properties["friendly_name"] - - @property - def resource_type(self) -> str: - """ - :returns: The type of communication – Messages, Calls, Conferences, and Participants - """ - return self._properties["resource_type"] - - @property - def start_day(self) -> str: - """ - :returns: The start day for the custom export specified when creating the job - """ - return self._properties["start_day"] - - @property - def end_day(self) -> str: - """ - :returns: The end day for the export specified when creating the job - """ - return self._properties["end_day"] - - @property - def webhook_url(self) -> str: - """ - :returns: The optional webhook url called on completion of the job. If this is supplied, `WebhookMethod` must also be supplied. - """ - return self._properties["webhook_url"] - - @property - def webhook_method(self) -> str: - """ - :returns: This is the method used to call the webhook on completion of the job. If this is supplied, `WebhookUrl` must also be supplied. - """ - return self._properties["webhook_method"] - - @property - def email(self) -> str: - """ - :returns: The optional email to send the completion notification to - """ - return self._properties["email"] - - @property - def job_sid(self) -> str: - """ - :returns: The unique job_sid returned when the custom export was created - """ - return self._properties["job_sid"] - - @property - def details(self) -> Dict[str, object]: - """ - :returns: The details of a job which is an object that contains an array of status grouped by `status` state. Each `status` object has a `status` string, a count which is the number of days in that `status`, and list of days in that `status`. The day strings are in the format yyyy-MM-dd. As an example, a currently running job may have a status object for COMPLETED and a `status` object for SUBMITTED each with its own count and list of days. - """ - return self._properties["details"] - - @property - def job_queue_position(self) -> str: - """ - :returns: This is the job position from the 1st in line. Your queue position will never increase. As jobs ahead of yours in the queue are processed, the queue position number will decrease - """ - return self._properties["job_queue_position"] - - @property - def estimated_completion_time(self) -> str: - """ - :returns: this is the time estimated until your job is complete. This is calculated each time you request the job list. The time is calculated based on the current rate of job completion (which may vary) and your job queue position - """ - return self._properties["estimated_completion_time"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/bulkexports/v1/export/job.py b/twilio/rest/bulkexports/v1/export/job.py index 79dc157a1..9df81579a 100644 --- a/twilio/rest/bulkexports/v1/export/job.py +++ b/twilio/rest/bulkexports/v1/export/job.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -21,29 +21,44 @@ class JobInstance(InstanceResource): - def __init__(self, version, payload, job_sid: Optional[str] = None): - """ - Initialize the JobInstance - """ + + """ + :ivar resource_type: The type of communication – Messages, Calls, Conferences, and Participants + :ivar friendly_name: The friendly name specified when creating the job + :ivar details: The details of a job which is an object that contains an array of status grouped by `status` state. Each `status` object has a `status` string, a count which is the number of days in that `status`, and list of days in that `status`. The day strings are in the format yyyy-MM-dd. As an example, a currently running job may have a status object for COMPLETED and a `status` object for SUBMITTED each with its own count and list of days. + :ivar start_day: The start time for the export specified when creating the job + :ivar end_day: The end time for the export specified when creating the job + :ivar job_sid: The job_sid returned when the export was created + :ivar webhook_url: The optional webhook url called on completion + :ivar webhook_method: This is the method used to call the webhook + :ivar email: The optional email to send the completion notification to + :ivar url: + :ivar job_queue_position: This is the job position from the 1st in line. Your queue position will never increase. As jobs ahead of yours in the queue are processed, the queue position number will decrease + :ivar estimated_completion_time: this is the time estimated until your job is complete. This is calculated each time you request the job list. The time is calculated based on the current rate of job completion (which may vary) and your job queue position + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], job_sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "resource_type": payload.get("resource_type"), - "friendly_name": payload.get("friendly_name"), - "details": payload.get("details"), - "start_day": payload.get("start_day"), - "end_day": payload.get("end_day"), - "job_sid": payload.get("job_sid"), - "webhook_url": payload.get("webhook_url"), - "webhook_method": payload.get("webhook_method"), - "email": payload.get("email"), - "url": payload.get("url"), - "job_queue_position": payload.get("job_queue_position"), - "estimated_completion_time": payload.get("estimated_completion_time"), - } + self.resource_type: Optional[str] = payload.get("resource_type") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.details: Optional[Dict[str, object]] = payload.get("details") + self.start_day: Optional[str] = payload.get("start_day") + self.end_day: Optional[str] = payload.get("end_day") + self.job_sid: Optional[str] = payload.get("job_sid") + self.webhook_url: Optional[str] = payload.get("webhook_url") + self.webhook_method: Optional[str] = payload.get("webhook_method") + self.email: Optional[str] = payload.get("email") + self.url: Optional[str] = payload.get("url") + self.job_queue_position: Optional[str] = payload.get("job_queue_position") + self.estimated_completion_time: Optional[str] = payload.get( + "estimated_completion_time" + ) self._solution = { - "job_sid": job_sid or self._properties["job_sid"], + "job_sid": job_sid or self.job_sid, } self._context: Optional[JobContext] = None @@ -62,90 +77,6 @@ def _proxy(self) -> "JobContext": ) return self._context - @property - def resource_type(self) -> str: - """ - :returns: The type of communication – Messages, Calls, Conferences, and Participants - """ - return self._properties["resource_type"] - - @property - def friendly_name(self) -> str: - """ - :returns: The friendly name specified when creating the job - """ - return self._properties["friendly_name"] - - @property - def details(self) -> Dict[str, object]: - """ - :returns: The details of a job which is an object that contains an array of status grouped by `status` state. Each `status` object has a `status` string, a count which is the number of days in that `status`, and list of days in that `status`. The day strings are in the format yyyy-MM-dd. As an example, a currently running job may have a status object for COMPLETED and a `status` object for SUBMITTED each with its own count and list of days. - """ - return self._properties["details"] - - @property - def start_day(self) -> str: - """ - :returns: The start time for the export specified when creating the job - """ - return self._properties["start_day"] - - @property - def end_day(self) -> str: - """ - :returns: The end time for the export specified when creating the job - """ - return self._properties["end_day"] - - @property - def job_sid(self) -> str: - """ - :returns: The job_sid returned when the export was created - """ - return self._properties["job_sid"] - - @property - def webhook_url(self) -> str: - """ - :returns: The optional webhook url called on completion - """ - return self._properties["webhook_url"] - - @property - def webhook_method(self) -> str: - """ - :returns: This is the method used to call the webhook - """ - return self._properties["webhook_method"] - - @property - def email(self) -> str: - """ - :returns: The optional email to send the completion notification to - """ - return self._properties["email"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def job_queue_position(self) -> str: - """ - :returns: This is the job position from the 1st in line. Your queue position will never increase. As jobs ahead of yours in the queue are processed, the queue position number will decrease - """ - return self._properties["job_queue_position"] - - @property - def estimated_completion_time(self) -> str: - """ - :returns: this is the time estimated until your job is complete. This is calculated each time you request the job list. The time is calculated based on the current rate of job completion (which may vary) and your job queue position - """ - return self._properties["estimated_completion_time"] - def delete(self) -> bool: """ Deletes the JobInstance diff --git a/twilio/rest/bulkexports/v1/export_configuration.py b/twilio/rest/bulkexports/v1/export_configuration.py index 38c9eb77c..aeaeaba56 100644 --- a/twilio/rest/bulkexports/v1/export_configuration.py +++ b/twilio/rest/bulkexports/v1/export_configuration.py @@ -13,7 +13,7 @@ """ -from typing import Optional +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 @@ -22,22 +22,31 @@ class ExportConfigurationInstance(InstanceResource): - def __init__(self, version, payload, resource_type: Optional[str] = None): - """ - Initialize the ExportConfigurationInstance - """ + + """ + :ivar enabled: If true, Twilio will automatically generate every day's file when the day is over. + :ivar webhook_url: Stores the URL destination for the method specified in webhook_method. + :ivar webhook_method: Sets whether Twilio should call a webhook URL when the automatic generation is complete, using GET or POST. The actual destination is set in the webhook_url + :ivar resource_type: The type of communication – Messages, Calls, Conferences, and Participants + :ivar url: The URL of this resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + resource_type: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "enabled": payload.get("enabled"), - "webhook_url": payload.get("webhook_url"), - "webhook_method": payload.get("webhook_method"), - "resource_type": payload.get("resource_type"), - "url": payload.get("url"), - } + self.enabled: Optional[bool] = payload.get("enabled") + self.webhook_url: Optional[str] = payload.get("webhook_url") + self.webhook_method: Optional[str] = payload.get("webhook_method") + self.resource_type: Optional[str] = payload.get("resource_type") + self.url: Optional[str] = payload.get("url") self._solution = { - "resource_type": resource_type or self._properties["resource_type"], + "resource_type": resource_type or self.resource_type, } self._context: Optional[ExportConfigurationContext] = None @@ -56,41 +65,6 @@ def _proxy(self) -> "ExportConfigurationContext": ) return self._context - @property - def enabled(self) -> bool: - """ - :returns: If true, Twilio will automatically generate every day's file when the day is over. - """ - return self._properties["enabled"] - - @property - def webhook_url(self) -> str: - """ - :returns: Stores the URL destination for the method specified in webhook_method. - """ - return self._properties["webhook_url"] - - @property - def webhook_method(self) -> str: - """ - :returns: Sets whether Twilio should call a webhook URL when the automatic generation is complete, using GET or POST. The actual destination is set in the webhook_url - """ - return self._properties["webhook_method"] - - @property - def resource_type(self) -> str: - """ - :returns: The type of communication – Messages, Calls, Conferences, and Participants - """ - return self._properties["resource_type"] - - @property - def url(self) -> str: - """ - :returns: The URL of this resource. - """ - return self._properties["url"] - def fetch(self) -> "ExportConfigurationInstance": """ Fetch the ExportConfigurationInstance diff --git a/twilio/rest/chat/v1/credential.py b/twilio/rest/chat/v1/credential.py index 124225514..0cfa585c5 100644 --- a/twilio/rest/chat/v1/credential.py +++ b/twilio/rest/chat/v1/credential.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -29,25 +29,37 @@ class PushService(object): APN = "apn" FCM = "fcm" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the CredentialInstance - """ + """ + :ivar sid: The unique string that we created to identify the Credential resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Credential resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar type: + :ivar sandbox: [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + :ivar url: The absolute URL of the Credential resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "type": payload.get("type"), - "sandbox": payload.get("sandbox"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + 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["CredentialInstance.PushService"] = payload.get("type") + self.sandbox: Optional[str] = payload.get("sandbox") + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[CredentialContext] = None @@ -66,62 +78,6 @@ def _proxy(self) -> "CredentialContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Credential resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Credential resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def type(self) -> "CredentialInstance.PushService": - """ - :returns: - """ - return self._properties["type"] - - @property - def sandbox(self) -> str: - """ - :returns: [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. - """ - return self._properties["sandbox"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Credential resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the CredentialInstance diff --git a/twilio/rest/chat/v1/service/__init__.py b/twilio/rest/chat/v1/service/__init__.py index a65b4f610..f2042c1f4 100644 --- a/twilio/rest/chat/v1/service/__init__.py +++ b/twilio/rest/chat/v1/service/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,44 +27,74 @@ class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the ServiceInstance - """ + + """ + :ivar sid: The unique string that we created to identify the Service resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Service resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + :ivar default_service_role_sid: The service role assigned to users when they are added to the service. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. + :ivar default_channel_role_sid: The channel role assigned to users when they are added to a channel. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. + :ivar default_channel_creator_role_sid: The channel role assigned to a channel creator when they join a new channel. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. + :ivar read_status_enabled: Whether the [Message Consumption Horizon](https://www.twilio.com/docs/chat/consumption-horizon) feature is enabled. The default is `true`. + :ivar reachability_enabled: Whether the [Reachability Indicator](https://www.twilio.com/docs/chat/reachability-indicator) is enabled for this Service instance. The default is `false`. + :ivar typing_indicator_timeout: How long in seconds after a `started typing` event until clients should assume that user is no longer typing, even if no `ended typing` message was received. The default is 5 seconds. + :ivar consumption_report_interval: DEPRECATED. The interval in seconds between consumption reports submission batches from client endpoints. + :ivar limits: An object that describes the limits of the service instance. The `limits` object contains `channel_members` to describe the members/channel limit and `user_channels` to describe the channels/user limit. `channel_members` can be 1,000 or less, with a default of 250. `user_channels` can be 1,000 or less, with a default value of 100. + :ivar webhooks: An object that contains information about the webhooks configured for this service. + :ivar pre_webhook_url: The URL for pre-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/api/chat/webhooks) for more details. + :ivar post_webhook_url: The URL for post-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/api/chat/webhooks) for more details. + :ivar webhook_method: The HTTP method to use for calls to the `pre_webhook_url` and `post_webhook_url` webhooks. Can be: `POST` or `GET` and the default is `POST`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. + :ivar webhook_filters: The list of WebHook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. + :ivar notifications: The notification configuration for the Service instance. See [Push Notification Configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more information. + :ivar url: The absolute URL of the Service resource. + :ivar links: The absolute URLs of the Service's [Channels](https://www.twilio.com/docs/chat/api/channels), [Roles](https://www.twilio.com/docs/chat/api/roles), and [Users](https://www.twilio.com/docs/chat/api/users). + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "default_service_role_sid": payload.get("default_service_role_sid"), - "default_channel_role_sid": payload.get("default_channel_role_sid"), - "default_channel_creator_role_sid": payload.get( - "default_channel_creator_role_sid" - ), - "read_status_enabled": payload.get("read_status_enabled"), - "reachability_enabled": payload.get("reachability_enabled"), - "typing_indicator_timeout": deserialize.integer( - payload.get("typing_indicator_timeout") - ), - "consumption_report_interval": deserialize.integer( - payload.get("consumption_report_interval") - ), - "limits": payload.get("limits"), - "webhooks": payload.get("webhooks"), - "pre_webhook_url": payload.get("pre_webhook_url"), - "post_webhook_url": payload.get("post_webhook_url"), - "webhook_method": payload.get("webhook_method"), - "webhook_filters": payload.get("webhook_filters"), - "notifications": payload.get("notifications"), - "url": payload.get("url"), - "links": payload.get("links"), - } + 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.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.default_service_role_sid: Optional[str] = payload.get( + "default_service_role_sid" + ) + self.default_channel_role_sid: Optional[str] = payload.get( + "default_channel_role_sid" + ) + self.default_channel_creator_role_sid: Optional[str] = payload.get( + "default_channel_creator_role_sid" + ) + self.read_status_enabled: Optional[bool] = payload.get("read_status_enabled") + self.reachability_enabled: Optional[bool] = payload.get("reachability_enabled") + self.typing_indicator_timeout: Optional[int] = deserialize.integer( + payload.get("typing_indicator_timeout") + ) + self.consumption_report_interval: Optional[int] = deserialize.integer( + payload.get("consumption_report_interval") + ) + self.limits: Optional[Dict[str, object]] = payload.get("limits") + self.webhooks: Optional[Dict[str, object]] = payload.get("webhooks") + self.pre_webhook_url: Optional[str] = payload.get("pre_webhook_url") + self.post_webhook_url: Optional[str] = payload.get("post_webhook_url") + self.webhook_method: Optional[str] = payload.get("webhook_method") + self.webhook_filters: Optional[List[str]] = payload.get("webhook_filters") + self.notifications: Optional[Dict[str, object]] = payload.get("notifications") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ServiceContext] = None @@ -83,153 +113,6 @@ def _proxy(self) -> "ServiceContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Service resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Service resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def default_service_role_sid(self) -> str: - """ - :returns: The service role assigned to users when they are added to the service. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. - """ - return self._properties["default_service_role_sid"] - - @property - def default_channel_role_sid(self) -> str: - """ - :returns: The channel role assigned to users when they are added to a channel. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. - """ - return self._properties["default_channel_role_sid"] - - @property - def default_channel_creator_role_sid(self) -> str: - """ - :returns: The channel role assigned to a channel creator when they join a new channel. See the [Roles endpoint](https://www.twilio.com/docs/chat/api/roles) for more details. - """ - return self._properties["default_channel_creator_role_sid"] - - @property - def read_status_enabled(self) -> bool: - """ - :returns: Whether the [Message Consumption Horizon](https://www.twilio.com/docs/chat/consumption-horizon) feature is enabled. The default is `true`. - """ - return self._properties["read_status_enabled"] - - @property - def reachability_enabled(self) -> bool: - """ - :returns: Whether the [Reachability Indicator](https://www.twilio.com/docs/chat/reachability-indicator) is enabled for this Service instance. The default is `false`. - """ - return self._properties["reachability_enabled"] - - @property - def typing_indicator_timeout(self) -> int: - """ - :returns: How long in seconds after a `started typing` event until clients should assume that user is no longer typing, even if no `ended typing` message was received. The default is 5 seconds. - """ - return self._properties["typing_indicator_timeout"] - - @property - def consumption_report_interval(self) -> int: - """ - :returns: DEPRECATED. The interval in seconds between consumption reports submission batches from client endpoints. - """ - return self._properties["consumption_report_interval"] - - @property - def limits(self) -> Dict[str, object]: - """ - :returns: An object that describes the limits of the service instance. The `limits` object contains `channel_members` to describe the members/channel limit and `user_channels` to describe the channels/user limit. `channel_members` can be 1,000 or less, with a default of 250. `user_channels` can be 1,000 or less, with a default value of 100. - """ - return self._properties["limits"] - - @property - def webhooks(self) -> Dict[str, object]: - """ - :returns: An object that contains information about the webhooks configured for this service. - """ - return self._properties["webhooks"] - - @property - def pre_webhook_url(self) -> str: - """ - :returns: The URL for pre-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/api/chat/webhooks) for more details. - """ - return self._properties["pre_webhook_url"] - - @property - def post_webhook_url(self) -> str: - """ - :returns: The URL for post-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/api/chat/webhooks) for more details. - """ - return self._properties["post_webhook_url"] - - @property - def webhook_method(self) -> str: - """ - :returns: The HTTP method to use for calls to the `pre_webhook_url` and `post_webhook_url` webhooks. Can be: `POST` or `GET` and the default is `POST`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. - """ - return self._properties["webhook_method"] - - @property - def webhook_filters(self) -> List[str]: - """ - :returns: The list of WebHook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. - """ - return self._properties["webhook_filters"] - - @property - def notifications(self) -> Dict[str, object]: - """ - :returns: The notification configuration for the Service instance. See [Push Notification Configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more information. - """ - return self._properties["notifications"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Service resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The absolute URLs of the Service's [Channels](https://www.twilio.com/docs/chat/api/channels), [Roles](https://www.twilio.com/docs/chat/api/roles), and [Users](https://www.twilio.com/docs/chat/api/users). - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the ServiceInstance diff --git a/twilio/rest/chat/v1/service/channel/__init__.py b/twilio/rest/chat/v1/service/channel/__init__.py index 27db8bbba..8b2c5c91a 100644 --- a/twilio/rest/chat/v1/service/channel/__init__.py +++ b/twilio/rest/chat/v1/service/channel/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -31,32 +31,58 @@ class ChannelType(object): PUBLIC = "public" PRIVATE = "private" - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the ChannelInstance - """ + """ + :ivar sid: The unique string that we created to identify the Channel resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Channel resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + :ivar attributes: The JSON string that stores application-specific data. **Note** If this property has been assigned a value, it's only displayed in a FETCH action that returns a single resource; otherwise, it's null. If the attributes have not been set, `{}` is returned. + :ivar type: + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + :ivar created_by: The `identity` of the User that created the channel. If the Channel was created by using the API, the value is `system`. + :ivar members_count: The number of Members in the Channel. + :ivar messages_count: The number of Messages in the Channel. + :ivar url: The absolute URL of the Channel resource. + :ivar links: The absolute URLs of the [Members](https://www.twilio.com/docs/chat/api/members), [Messages](https://www.twilio.com/docs/chat/api/messages) , [Invites](https://www.twilio.com/docs/chat/api/invites) and, if it exists, the last [Message](https://www.twilio.com/docs/chat/api/messages) for the Channel. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "friendly_name": payload.get("friendly_name"), - "unique_name": payload.get("unique_name"), - "attributes": payload.get("attributes"), - "type": payload.get("type"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "created_by": payload.get("created_by"), - "members_count": deserialize.integer(payload.get("members_count")), - "messages_count": deserialize.integer(payload.get("messages_count")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.unique_name: Optional[str] = payload.get("unique_name") + self.attributes: Optional[str] = payload.get("attributes") + self.type: Optional["ChannelInstance.ChannelType"] = payload.get("type") + 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.created_by: Optional[str] = payload.get("created_by") + self.members_count: Optional[int] = deserialize.integer( + payload.get("members_count") + ) + self.messages_count: Optional[int] = deserialize.integer( + payload.get("messages_count") + ) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ChannelContext] = None @@ -76,104 +102,6 @@ def _proxy(self) -> "ChannelContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Channel resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Channel resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. - """ - return self._properties["unique_name"] - - @property - def attributes(self) -> str: - """ - :returns: The JSON string that stores application-specific data. **Note** If this property has been assigned a value, it's only displayed in a FETCH action that returns a single resource; otherwise, it's null. If the attributes have not been set, `{}` is returned. - """ - return self._properties["attributes"] - - @property - def type(self) -> "ChannelInstance.ChannelType": - """ - :returns: - """ - return self._properties["type"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def created_by(self) -> str: - """ - :returns: The `identity` of the User that created the channel. If the Channel was created by using the API, the value is `system`. - """ - return self._properties["created_by"] - - @property - def members_count(self) -> int: - """ - :returns: The number of Members in the Channel. - """ - return self._properties["members_count"] - - @property - def messages_count(self) -> int: - """ - :returns: The number of Messages in the Channel. - """ - return self._properties["messages_count"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Channel resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The absolute URLs of the [Members](https://www.twilio.com/docs/chat/api/members), [Messages](https://www.twilio.com/docs/chat/api/messages) , [Invites](https://www.twilio.com/docs/chat/api/invites) and, if it exists, the last [Message](https://www.twilio.com/docs/chat/api/messages) for the Channel. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the ChannelInstance diff --git a/twilio/rest/chat/v1/service/channel/invite.py b/twilio/rest/chat/v1/service/channel/invite.py index ccb60f630..0fe62c0ca 100644 --- a/twilio/rest/chat/v1/service/channel/invite.py +++ b/twilio/rest/chat/v1/service/channel/invite.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,36 +24,49 @@ class InviteInstance(InstanceResource): + + """ + :ivar sid: The unique string that we created to identify the Invite resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Invite resource. + :ivar channel_sid: The SID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) the resource belongs to. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. + :ivar identity: The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/api/chat/rest/users) within the [Service](https://www.twilio.com/docs/api/chat/rest/services). See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more info. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + :ivar role_sid: The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to the resource. + :ivar created_by: The `identity` of the User that created the invite. + :ivar url: The absolute URL of the Invite resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, channel_sid: str, sid: Optional[str] = None, ): - """ - Initialize the InviteInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "channel_sid": payload.get("channel_sid"), - "service_sid": payload.get("service_sid"), - "identity": payload.get("identity"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "role_sid": payload.get("role_sid"), - "created_by": payload.get("created_by"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.channel_sid: Optional[str] = payload.get("channel_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.identity: Optional[str] = payload.get("identity") + 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.role_sid: Optional[str] = payload.get("role_sid") + self.created_by: Optional[str] = payload.get("created_by") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, "channel_sid": channel_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[InviteContext] = None @@ -74,76 +87,6 @@ def _proxy(self) -> "InviteContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Invite resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Invite resource. - """ - return self._properties["account_sid"] - - @property - def channel_sid(self) -> str: - """ - :returns: The SID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) the resource belongs to. - """ - return self._properties["channel_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def identity(self) -> str: - """ - :returns: The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/api/chat/rest/users) within the [Service](https://www.twilio.com/docs/api/chat/rest/services). See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more info. - """ - return self._properties["identity"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def role_sid(self) -> str: - """ - :returns: The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to the resource. - """ - return self._properties["role_sid"] - - @property - def created_by(self) -> str: - """ - :returns: The `identity` of the User that created the invite. - """ - return self._properties["created_by"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Invite resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the InviteInstance diff --git a/twilio/rest/chat/v1/service/channel/member.py b/twilio/rest/chat/v1/service/channel/member.py index 18166a8ee..ac44a230d 100644 --- a/twilio/rest/chat/v1/service/channel/member.py +++ b/twilio/rest/chat/v1/service/channel/member.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,41 +24,55 @@ class MemberInstance(InstanceResource): + + """ + :ivar sid: The unique string that we created to identify the Member resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Member resource. + :ivar channel_sid: The unique ID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) for the member. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. + :ivar identity: The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/api/chat/rest/users) within the [Service](https://www.twilio.com/docs/api/chat/rest/services). See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more info. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + :ivar role_sid: The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to the member. + :ivar last_consumed_message_index: The index of the last [Message](https://www.twilio.com/docs/api/chat/rest/messages) in the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) that the Member has read. + :ivar last_consumption_timestamp: The ISO 8601 timestamp string that represents the date-time of the last [Message](https://www.twilio.com/docs/api/chat/rest/messages) read event for the Member within the [Channel](https://www.twilio.com/docs/api/chat/rest/channels). + :ivar url: The absolute URL of the Member resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, channel_sid: str, sid: Optional[str] = None, ): - """ - Initialize the MemberInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "channel_sid": payload.get("channel_sid"), - "service_sid": payload.get("service_sid"), - "identity": payload.get("identity"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "role_sid": payload.get("role_sid"), - "last_consumed_message_index": deserialize.integer( - payload.get("last_consumed_message_index") - ), - "last_consumption_timestamp": deserialize.iso8601_datetime( - payload.get("last_consumption_timestamp") - ), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.channel_sid: Optional[str] = payload.get("channel_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.identity: Optional[str] = payload.get("identity") + 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.role_sid: Optional[str] = payload.get("role_sid") + self.last_consumed_message_index: Optional[int] = deserialize.integer( + payload.get("last_consumed_message_index") + ) + self.last_consumption_timestamp: Optional[ + datetime + ] = deserialize.iso8601_datetime(payload.get("last_consumption_timestamp")) + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, "channel_sid": channel_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[MemberContext] = None @@ -79,83 +93,6 @@ def _proxy(self) -> "MemberContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Member resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Member resource. - """ - return self._properties["account_sid"] - - @property - def channel_sid(self) -> str: - """ - :returns: The unique ID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) for the member. - """ - return self._properties["channel_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def identity(self) -> str: - """ - :returns: The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/api/chat/rest/users) within the [Service](https://www.twilio.com/docs/api/chat/rest/services). See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more info. - """ - return self._properties["identity"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def role_sid(self) -> str: - """ - :returns: The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to the member. - """ - return self._properties["role_sid"] - - @property - def last_consumed_message_index(self) -> int: - """ - :returns: The index of the last [Message](https://www.twilio.com/docs/api/chat/rest/messages) in the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) that the Member has read. - """ - return self._properties["last_consumed_message_index"] - - @property - def last_consumption_timestamp(self) -> datetime: - """ - :returns: The ISO 8601 timestamp string that represents the date-time of the last [Message](https://www.twilio.com/docs/api/chat/rest/messages) read event for the Member within the [Channel](https://www.twilio.com/docs/api/chat/rest/channels). - """ - return self._properties["last_consumption_timestamp"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Member resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the MemberInstance diff --git a/twilio/rest/chat/v1/service/channel/message.py b/twilio/rest/chat/v1/service/channel/message.py index 812e50cf0..81fa1473c 100644 --- a/twilio/rest/chat/v1/service/channel/message.py +++ b/twilio/rest/chat/v1/service/channel/message.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,39 +28,54 @@ class OrderType(object): ASC = "asc" DESC = "desc" + """ + :ivar sid: The unique string that we created to identify the Message resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Message resource. + :ivar attributes: The JSON string that stores application-specific data. **Note** If this property has been assigned a value, it's only displayed in a FETCH action that returns a single resource; otherwise, it's null. If the attributes have not been set, `{}` is returned. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. + :ivar to: The SID of the [Channel](https://www.twilio.com/docs/chat/api/channels) that the message was sent to. + :ivar channel_sid: The unique ID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) the Message resource belongs to. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + :ivar was_edited: Whether the message has been edited since it was created. + :ivar _from: The [identity](https://www.twilio.com/docs/api/chat/guides/identity) of the message's author. The default value is `system`. + :ivar body: The content of the message. + :ivar index: The index of the message within the [Channel](https://www.twilio.com/docs/chat/api/channels). + :ivar url: The absolute URL of the Message resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, channel_sid: str, sid: Optional[str] = None, ): - """ - Initialize the MessageInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "attributes": payload.get("attributes"), - "service_sid": payload.get("service_sid"), - "to": payload.get("to"), - "channel_sid": payload.get("channel_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "was_edited": payload.get("was_edited"), - "_from": payload.get("from"), - "body": payload.get("body"), - "index": deserialize.integer(payload.get("index")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.attributes: Optional[str] = payload.get("attributes") + self.service_sid: Optional[str] = payload.get("service_sid") + self.to: Optional[str] = payload.get("to") + self.channel_sid: Optional[str] = payload.get("channel_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.was_edited: Optional[bool] = payload.get("was_edited") + self._from: Optional[str] = payload.get("from") + self.body: Optional[str] = payload.get("body") + self.index: Optional[int] = deserialize.integer(payload.get("index")) + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, "channel_sid": channel_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[MessageContext] = None @@ -81,97 +96,6 @@ def _proxy(self) -> "MessageContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Message resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Message resource. - """ - return self._properties["account_sid"] - - @property - def attributes(self) -> str: - """ - :returns: The JSON string that stores application-specific data. **Note** If this property has been assigned a value, it's only displayed in a FETCH action that returns a single resource; otherwise, it's null. If the attributes have not been set, `{}` is returned. - """ - return self._properties["attributes"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def to(self) -> str: - """ - :returns: The SID of the [Channel](https://www.twilio.com/docs/chat/api/channels) that the message was sent to. - """ - return self._properties["to"] - - @property - def channel_sid(self) -> str: - """ - :returns: The unique ID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) the Message resource belongs to. - """ - return self._properties["channel_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def was_edited(self) -> bool: - """ - :returns: Whether the message has been edited since it was created. - """ - return self._properties["was_edited"] - - @property - def _from(self) -> str: - """ - :returns: The [identity](https://www.twilio.com/docs/api/chat/guides/identity) of the message's author. The default value is `system`. - """ - return self._properties["_from"] - - @property - def body(self) -> str: - """ - :returns: The content of the message. - """ - return self._properties["body"] - - @property - def index(self) -> int: - """ - :returns: The index of the message within the [Channel](https://www.twilio.com/docs/chat/api/channels). - """ - return self._properties["index"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Message resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the MessageInstance diff --git a/twilio/rest/chat/v1/service/role.py b/twilio/rest/chat/v1/service/role.py index e2e07595c..da5024980 100644 --- a/twilio/rest/chat/v1/service/role.py +++ b/twilio/rest/chat/v1/service/role.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,27 +28,44 @@ class RoleType(object): CHANNEL = "channel" DEPLOYMENT = "deployment" - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the RoleInstance - """ + """ + :ivar sid: The unique string that we created to identify the Role resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Role resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar type: + :ivar permissions: An array of the permissions the role has been granted, formatted as a JSON string. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + :ivar url: The absolute URL of the Role resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "friendly_name": payload.get("friendly_name"), - "type": payload.get("type"), - "permissions": payload.get("permissions"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.type: Optional["RoleInstance.RoleType"] = payload.get("type") + self.permissions: Optional[List[str]] = payload.get("permissions") + 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 = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[RoleContext] = None @@ -68,69 +85,6 @@ def _proxy(self) -> "RoleContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Role resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Role resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def type(self) -> "RoleInstance.RoleType": - """ - :returns: - """ - return self._properties["type"] - - @property - def permissions(self) -> List[str]: - """ - :returns: An array of the permissions the role has been granted, formatted as a JSON string. - """ - return self._properties["permissions"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Role resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the RoleInstance diff --git a/twilio/rest/chat/v1/service/user/__init__.py b/twilio/rest/chat/v1/service/user/__init__.py index 054067161..637c909d5 100644 --- a/twilio/rest/chat/v1/service/user/__init__.py +++ b/twilio/rest/chat/v1/service/user/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -25,34 +25,57 @@ class UserInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the UserInstance - """ + + """ + :ivar sid: The unique string that we created to identify the User resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the User resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. + :ivar attributes: The JSON string that stores application-specific data. **Note** If this property has been assigned a value, it's only displayed in a FETCH action that returns a single resource; otherwise, it's null. If the attributes have not been set, `{}` is returned. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar role_sid: The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to the user. + :ivar identity: The application-defined string that uniquely identifies the resource's User within the [Service](https://www.twilio.com/docs/api/chat/rest/services). This value is often a username or an email address. See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more info. + :ivar is_online: Whether the User is actively connected to the Service instance and online. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, if the User has never been online for the Service instance, even if the Service's `reachability_enabled` is `true`. + :ivar is_notifiable: Whether the User has a potentially valid Push Notification registration (APN or GCM) for the Service instance. If at least one registration exists, `true`; otherwise `false`. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, and if the User has never had a notification registration, even if the Service's `reachability_enabled` is `true`. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + :ivar joined_channels_count: The number of Channels this User is a Member of. + :ivar links: The absolute URLs of the [Channel](https://www.twilio.com/docs/chat/api/channels) and [Binding](https://www.twilio.com/docs/chat/rest/bindings-resource) resources related to the user. + :ivar url: The absolute URL of the User resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "attributes": payload.get("attributes"), - "friendly_name": payload.get("friendly_name"), - "role_sid": payload.get("role_sid"), - "identity": payload.get("identity"), - "is_online": payload.get("is_online"), - "is_notifiable": payload.get("is_notifiable"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "joined_channels_count": deserialize.integer( - payload.get("joined_channels_count") - ), - "links": payload.get("links"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.attributes: Optional[str] = payload.get("attributes") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.role_sid: Optional[str] = payload.get("role_sid") + self.identity: Optional[str] = payload.get("identity") + self.is_online: Optional[bool] = payload.get("is_online") + self.is_notifiable: Optional[bool] = payload.get("is_notifiable") + 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.joined_channels_count: Optional[int] = deserialize.integer( + payload.get("joined_channels_count") + ) + self.links: Optional[Dict[str, object]] = payload.get("links") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[UserContext] = None @@ -72,104 +95,6 @@ def _proxy(self) -> "UserContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the User resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the User resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def attributes(self) -> str: - """ - :returns: The JSON string that stores application-specific data. **Note** If this property has been assigned a value, it's only displayed in a FETCH action that returns a single resource; otherwise, it's null. If the attributes have not been set, `{}` is returned. - """ - return self._properties["attributes"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def role_sid(self) -> str: - """ - :returns: The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to the user. - """ - return self._properties["role_sid"] - - @property - def identity(self) -> str: - """ - :returns: The application-defined string that uniquely identifies the resource's User within the [Service](https://www.twilio.com/docs/api/chat/rest/services). This value is often a username or an email address. See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more info. - """ - return self._properties["identity"] - - @property - def is_online(self) -> bool: - """ - :returns: Whether the User is actively connected to the Service instance and online. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, if the User has never been online for the Service instance, even if the Service's `reachability_enabled` is `true`. - """ - return self._properties["is_online"] - - @property - def is_notifiable(self) -> bool: - """ - :returns: Whether the User has a potentially valid Push Notification registration (APN or GCM) for the Service instance. If at least one registration exists, `true`; otherwise `false`. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, and if the User has never had a notification registration, even if the Service's `reachability_enabled` is `true`. - """ - return self._properties["is_notifiable"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def joined_channels_count(self) -> int: - """ - :returns: The number of Channels this User is a Member of. - """ - return self._properties["joined_channels_count"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The absolute URLs of the [Channel](https://www.twilio.com/docs/chat/api/channels) and [Binding](https://www.twilio.com/docs/chat/rest/bindings-resource) resources related to the user. - """ - return self._properties["links"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the User resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the UserInstance diff --git a/twilio/rest/chat/v1/service/user/user_channel.py b/twilio/rest/chat/v1/service/user/user_channel.py index 2a7f2f156..b1d72a8ee 100644 --- a/twilio/rest/chat/v1/service/user/user_channel.py +++ b/twilio/rest/chat/v1/service/user/user_channel.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -28,88 +28,42 @@ class ChannelStatus(object): INVITED = "invited" NOT_PARTICIPATING = "not_participating" - def __init__(self, version, payload, service_sid: str, user_sid: str): - """ - Initialize the UserChannelInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the User Channel resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. + :ivar channel_sid: The SID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) the resource belongs to. + :ivar member_sid: The SID of a [Member](https://www.twilio.com/docs/api/chat/rest/members) that represents the User on the Channel. + :ivar status: + :ivar last_consumed_message_index: The index of the last [Message](https://www.twilio.com/docs/api/chat/rest/messages) in the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) that the Member has read. + :ivar unread_messages_count: The number of unread Messages in the Channel for the User. Note that retrieving messages on a client endpoint does not mean that messages are consumed or read. See [Consumption Horizon feature](/docs/api/chat/guides/consumption-horizon) to learn how to mark messages as consumed. + :ivar links: The absolute URLs of the [Members](https://www.twilio.com/docs/chat/api/members), [Messages](https://www.twilio.com/docs/chat/api/messages) , [Invites](https://www.twilio.com/docs/chat/api/invites) and, if it exists, the last [Message](https://www.twilio.com/docs/chat/api/messages) for the Channel. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], service_sid: str, user_sid: str + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "channel_sid": payload.get("channel_sid"), - "member_sid": payload.get("member_sid"), - "status": payload.get("status"), - "last_consumed_message_index": deserialize.integer( - payload.get("last_consumed_message_index") - ), - "unread_messages_count": deserialize.integer( - payload.get("unread_messages_count") - ), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.channel_sid: Optional[str] = payload.get("channel_sid") + self.member_sid: Optional[str] = payload.get("member_sid") + self.status: Optional["UserChannelInstance.ChannelStatus"] = payload.get( + "status" + ) + self.last_consumed_message_index: Optional[int] = deserialize.integer( + payload.get("last_consumed_message_index") + ) + self.unread_messages_count: Optional[int] = deserialize.integer( + payload.get("unread_messages_count") + ) + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "service_sid": service_sid, "user_sid": user_sid, } - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the User Channel resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def channel_sid(self) -> str: - """ - :returns: The SID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) the resource belongs to. - """ - return self._properties["channel_sid"] - - @property - def member_sid(self) -> str: - """ - :returns: The SID of a [Member](https://www.twilio.com/docs/api/chat/rest/members) that represents the User on the Channel. - """ - return self._properties["member_sid"] - - @property - def status(self) -> "UserChannelInstance.ChannelStatus": - """ - :returns: - """ - return self._properties["status"] - - @property - def last_consumed_message_index(self) -> int: - """ - :returns: The index of the last [Message](https://www.twilio.com/docs/api/chat/rest/messages) in the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) that the Member has read. - """ - return self._properties["last_consumed_message_index"] - - @property - def unread_messages_count(self) -> int: - """ - :returns: The number of unread Messages in the Channel for the User. Note that retrieving messages on a client endpoint does not mean that messages are consumed or read. See [Consumption Horizon feature](/docs/api/chat/guides/consumption-horizon) to learn how to mark messages as consumed. - """ - return self._properties["unread_messages_count"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The absolute URLs of the [Members](https://www.twilio.com/docs/chat/api/members), [Messages](https://www.twilio.com/docs/chat/api/messages) , [Invites](https://www.twilio.com/docs/chat/api/invites) and, if it exists, the last [Message](https://www.twilio.com/docs/chat/api/messages) for the Channel. - """ - return self._properties["links"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/chat/v2/credential.py b/twilio/rest/chat/v2/credential.py index c81d4b559..b601bb376 100644 --- a/twilio/rest/chat/v2/credential.py +++ b/twilio/rest/chat/v2/credential.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -29,25 +29,37 @@ class PushService(object): APN = "apn" FCM = "fcm" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the CredentialInstance - """ + """ + :ivar sid: The unique string that we created to identify the Credential resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Credential resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar type: + :ivar sandbox: [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. + :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 Credential resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "type": payload.get("type"), - "sandbox": payload.get("sandbox"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + 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["CredentialInstance.PushService"] = payload.get("type") + self.sandbox: Optional[str] = payload.get("sandbox") + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[CredentialContext] = None @@ -66,62 +78,6 @@ def _proxy(self) -> "CredentialContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Credential resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Credential resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def type(self) -> "CredentialInstance.PushService": - """ - :returns: - """ - return self._properties["type"] - - @property - def sandbox(self) -> str: - """ - :returns: [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. - """ - return self._properties["sandbox"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Credential resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the CredentialInstance diff --git a/twilio/rest/chat/v2/service/__init__.py b/twilio/rest/chat/v2/service/__init__.py index dd9279e53..8c58340fe 100644 --- a/twilio/rest/chat/v2/service/__init__.py +++ b/twilio/rest/chat/v2/service/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,50 +28,82 @@ class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the ServiceInstance - """ + + """ + :ivar sid: The unique string that we created to identify the Service resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :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 default_service_role_sid: The service role assigned to users when they are added to the service. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. + :ivar default_channel_role_sid: The channel role assigned to users when they are added to a channel. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. + :ivar default_channel_creator_role_sid: The channel role assigned to a channel creator when they join a new channel. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. + :ivar read_status_enabled: Whether the [Message Consumption Horizon](https://www.twilio.com/docs/chat/consumption-horizon) feature is enabled. The default is `true`. + :ivar reachability_enabled: Whether the [Reachability Indicator](https://www.twilio.com/docs/chat/reachability-indicator) is enabled for this Service instance. The default is `false`. + :ivar typing_indicator_timeout: How long in seconds after a `started typing` event until clients should assume that user is no longer typing, even if no `ended typing` message was received. The default is 5 seconds. + :ivar consumption_report_interval: DEPRECATED. The interval in seconds between consumption reports submission batches from client endpoints. + :ivar limits: An object that describes the limits of the service instance. The `limits` object contains `channel_members` to describe the members/channel limit and `user_channels` to describe the channels/user limit. `channel_members` can be 1,000 or less, with a default of 250. `user_channels` can be 1,000 or less, with a default value of 100. + :ivar pre_webhook_url: The URL for pre-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. + :ivar post_webhook_url: The URL for post-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. + :ivar webhook_method: The HTTP method to use for calls to the `pre_webhook_url` and `post_webhook_url` webhooks. Can be: `POST` or `GET` and the default is `POST`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. + :ivar webhook_filters: The list of webhook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. + :ivar pre_webhook_retry_count: The number of times to retry a call to the `pre_webhook_url` if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. Default retry count is 0 times, which means the call won't be retried. + :ivar post_webhook_retry_count: The number of times to retry a call to the `post_webhook_url` if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. The default is 0, which means the call won't be retried. + :ivar notifications: The notification configuration for the Service instance. See [Push Notification Configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. + :ivar media: An object that describes the properties of media that the service supports. The object contains the `size_limit_mb` property, which describes the size of the largest media file in MB; and the `compatibility_message` property, which contains the message text to send when a media message does not have any text. + :ivar url: The absolute URL of the Service resource. + :ivar links: The absolute URLs of the Service's [Channels](https://www.twilio.com/docs/chat/channels), [Roles](https://www.twilio.com/docs/chat/rest/role-resource), [Bindings](https://www.twilio.com/docs/chat/rest/binding-resource), and [Users](https://www.twilio.com/docs/chat/rest/user-resource). + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "default_service_role_sid": payload.get("default_service_role_sid"), - "default_channel_role_sid": payload.get("default_channel_role_sid"), - "default_channel_creator_role_sid": payload.get( - "default_channel_creator_role_sid" - ), - "read_status_enabled": payload.get("read_status_enabled"), - "reachability_enabled": payload.get("reachability_enabled"), - "typing_indicator_timeout": deserialize.integer( - payload.get("typing_indicator_timeout") - ), - "consumption_report_interval": deserialize.integer( - payload.get("consumption_report_interval") - ), - "limits": payload.get("limits"), - "pre_webhook_url": payload.get("pre_webhook_url"), - "post_webhook_url": payload.get("post_webhook_url"), - "webhook_method": payload.get("webhook_method"), - "webhook_filters": payload.get("webhook_filters"), - "pre_webhook_retry_count": deserialize.integer( - payload.get("pre_webhook_retry_count") - ), - "post_webhook_retry_count": deserialize.integer( - payload.get("post_webhook_retry_count") - ), - "notifications": payload.get("notifications"), - "media": payload.get("media"), - "url": payload.get("url"), - "links": payload.get("links"), - } + 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.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.default_service_role_sid: Optional[str] = payload.get( + "default_service_role_sid" + ) + self.default_channel_role_sid: Optional[str] = payload.get( + "default_channel_role_sid" + ) + self.default_channel_creator_role_sid: Optional[str] = payload.get( + "default_channel_creator_role_sid" + ) + self.read_status_enabled: Optional[bool] = payload.get("read_status_enabled") + self.reachability_enabled: Optional[bool] = payload.get("reachability_enabled") + self.typing_indicator_timeout: Optional[int] = deserialize.integer( + payload.get("typing_indicator_timeout") + ) + self.consumption_report_interval: Optional[int] = deserialize.integer( + payload.get("consumption_report_interval") + ) + self.limits: Optional[Dict[str, object]] = payload.get("limits") + self.pre_webhook_url: Optional[str] = payload.get("pre_webhook_url") + self.post_webhook_url: Optional[str] = payload.get("post_webhook_url") + self.webhook_method: Optional[str] = payload.get("webhook_method") + self.webhook_filters: Optional[List[str]] = payload.get("webhook_filters") + self.pre_webhook_retry_count: Optional[int] = deserialize.integer( + payload.get("pre_webhook_retry_count") + ) + self.post_webhook_retry_count: Optional[int] = deserialize.integer( + payload.get("post_webhook_retry_count") + ) + self.notifications: Optional[Dict[str, object]] = payload.get("notifications") + self.media: Optional[Dict[str, object]] = payload.get("media") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ServiceContext] = None @@ -90,167 +122,6 @@ def _proxy(self) -> "ServiceContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Service resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def default_service_role_sid(self) -> str: - """ - :returns: The service role assigned to users when they are added to the service. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. - """ - return self._properties["default_service_role_sid"] - - @property - def default_channel_role_sid(self) -> str: - """ - :returns: The channel role assigned to users when they are added to a channel. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. - """ - return self._properties["default_channel_role_sid"] - - @property - def default_channel_creator_role_sid(self) -> str: - """ - :returns: The channel role assigned to a channel creator when they join a new channel. See the [Role resource](https://www.twilio.com/docs/chat/rest/role-resource) for more info about roles. - """ - return self._properties["default_channel_creator_role_sid"] - - @property - def read_status_enabled(self) -> bool: - """ - :returns: Whether the [Message Consumption Horizon](https://www.twilio.com/docs/chat/consumption-horizon) feature is enabled. The default is `true`. - """ - return self._properties["read_status_enabled"] - - @property - def reachability_enabled(self) -> bool: - """ - :returns: Whether the [Reachability Indicator](https://www.twilio.com/docs/chat/reachability-indicator) is enabled for this Service instance. The default is `false`. - """ - return self._properties["reachability_enabled"] - - @property - def typing_indicator_timeout(self) -> int: - """ - :returns: How long in seconds after a `started typing` event until clients should assume that user is no longer typing, even if no `ended typing` message was received. The default is 5 seconds. - """ - return self._properties["typing_indicator_timeout"] - - @property - def consumption_report_interval(self) -> int: - """ - :returns: DEPRECATED. The interval in seconds between consumption reports submission batches from client endpoints. - """ - return self._properties["consumption_report_interval"] - - @property - def limits(self) -> Dict[str, object]: - """ - :returns: An object that describes the limits of the service instance. The `limits` object contains `channel_members` to describe the members/channel limit and `user_channels` to describe the channels/user limit. `channel_members` can be 1,000 or less, with a default of 250. `user_channels` can be 1,000 or less, with a default value of 100. - """ - return self._properties["limits"] - - @property - def pre_webhook_url(self) -> str: - """ - :returns: The URL for pre-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. - """ - return self._properties["pre_webhook_url"] - - @property - def post_webhook_url(self) -> str: - """ - :returns: The URL for post-event webhooks, which are called by using the `webhook_method`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. - """ - return self._properties["post_webhook_url"] - - @property - def webhook_method(self) -> str: - """ - :returns: The HTTP method to use for calls to the `pre_webhook_url` and `post_webhook_url` webhooks. Can be: `POST` or `GET` and the default is `POST`. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. - """ - return self._properties["webhook_method"] - - @property - def webhook_filters(self) -> List[str]: - """ - :returns: The list of webhook events that are enabled for this Service instance. See [Webhook Events](https://www.twilio.com/docs/chat/webhook-events) for more details. - """ - return self._properties["webhook_filters"] - - @property - def pre_webhook_retry_count(self) -> int: - """ - :returns: The number of times to retry a call to the `pre_webhook_url` if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. Default retry count is 0 times, which means the call won't be retried. - """ - return self._properties["pre_webhook_retry_count"] - - @property - def post_webhook_retry_count(self) -> int: - """ - :returns: The number of times to retry a call to the `post_webhook_url` if the request times out (after 5 seconds) or it receives a 429, 503, or 504 HTTP response. The default is 0, which means the call won't be retried. - """ - return self._properties["post_webhook_retry_count"] - - @property - def notifications(self) -> Dict[str, object]: - """ - :returns: The notification configuration for the Service instance. See [Push Notification Configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. - """ - return self._properties["notifications"] - - @property - def media(self) -> Dict[str, object]: - """ - :returns: An object that describes the properties of media that the service supports. The object contains the `size_limit_mb` property, which describes the size of the largest media file in MB; and the `compatibility_message` property, which contains the message text to send when a media message does not have any text. - """ - return self._properties["media"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Service resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The absolute URLs of the Service's [Channels](https://www.twilio.com/docs/chat/channels), [Roles](https://www.twilio.com/docs/chat/rest/role-resource), [Bindings](https://www.twilio.com/docs/chat/rest/binding-resource), and [Users](https://www.twilio.com/docs/chat/rest/user-resource). - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the ServiceInstance diff --git a/twilio/rest/chat/v2/service/binding.py b/twilio/rest/chat/v2/service/binding.py index 537139a1d..c6af3eb65 100644 --- a/twilio/rest/chat/v2/service/binding.py +++ b/twilio/rest/chat/v2/service/binding.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -29,30 +29,52 @@ class BindingType(object): APN = "apn" FCM = "fcm" - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the BindingInstance - """ + """ + :ivar sid: The unique string that we created to identify the Binding resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Binding resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Binding resource is associated with. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar endpoint: The unique endpoint identifier for the Binding. The format of this value depends on the `binding_type`. + :ivar identity: The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + :ivar credential_sid: The SID of the [Credential](https://www.twilio.com/docs/chat/rest/credential-resource) for the binding. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. + :ivar binding_type: + :ivar message_types: The [Programmable Chat message types](https://www.twilio.com/docs/chat/push-notification-configuration#push-types) the binding is subscribed to. + :ivar url: The absolute URL of the Binding resource. + :ivar links: The absolute URLs of the Binding's [User](https://www.twilio.com/docs/chat/rest/user-resource). + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "endpoint": payload.get("endpoint"), - "identity": payload.get("identity"), - "credential_sid": payload.get("credential_sid"), - "binding_type": payload.get("binding_type"), - "message_types": payload.get("message_types"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.endpoint: Optional[str] = payload.get("endpoint") + self.identity: Optional[str] = payload.get("identity") + self.credential_sid: Optional[str] = payload.get("credential_sid") + self.binding_type: Optional["BindingInstance.BindingType"] = payload.get( + "binding_type" + ) + self.message_types: Optional[List[str]] = payload.get("message_types") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[BindingContext] = None @@ -72,90 +94,6 @@ def _proxy(self) -> "BindingContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Binding resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Binding resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Binding resource is associated with. - """ - return self._properties["service_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def endpoint(self) -> str: - """ - :returns: The unique endpoint identifier for the Binding. The format of this value depends on the `binding_type`. - """ - return self._properties["endpoint"] - - @property - def identity(self) -> str: - """ - :returns: The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. - """ - return self._properties["identity"] - - @property - def credential_sid(self) -> str: - """ - :returns: The SID of the [Credential](https://www.twilio.com/docs/chat/rest/credential-resource) for the binding. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. - """ - return self._properties["credential_sid"] - - @property - def binding_type(self) -> "BindingInstance.BindingType": - """ - :returns: - """ - return self._properties["binding_type"] - - @property - def message_types(self) -> List[str]: - """ - :returns: The [Programmable Chat message types](https://www.twilio.com/docs/chat/push-notification-configuration#push-types) the binding is subscribed to. - """ - return self._properties["message_types"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Binding resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The absolute URLs of the Binding's [User](https://www.twilio.com/docs/chat/rest/user-resource). - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the BindingInstance diff --git a/twilio/rest/chat/v2/service/channel/__init__.py b/twilio/rest/chat/v2/service/channel/__init__.py index 05e36741a..e18ce8319 100644 --- a/twilio/rest/chat/v2/service/channel/__init__.py +++ b/twilio/rest/chat/v2/service/channel/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -36,32 +36,58 @@ class WebhookEnabledType(object): TRUE = "true" FALSE = "false" - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the ChannelInstance - """ + """ + :ivar sid: The unique string that we created to identify the Channel resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Channel resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Channel resource is associated with. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + :ivar attributes: The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. + :ivar type: + :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 created_by: The `identity` of the User that created the channel. If the Channel was created by using the API, the value is `system`. + :ivar members_count: The number of Members in the Channel. + :ivar messages_count: The number of Messages that have been passed in the Channel. + :ivar url: The absolute URL of the Channel resource. + :ivar links: The absolute URLs of the [Members](https://www.twilio.com/docs/chat/rest/member-resource), [Messages](https://www.twilio.com/docs/chat/rest/message-resource), [Invites](https://www.twilio.com/docs/chat/rest/invite-resource), Webhooks and, if it exists, the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) for the Channel. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "friendly_name": payload.get("friendly_name"), - "unique_name": payload.get("unique_name"), - "attributes": payload.get("attributes"), - "type": payload.get("type"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "created_by": payload.get("created_by"), - "members_count": deserialize.integer(payload.get("members_count")), - "messages_count": deserialize.integer(payload.get("messages_count")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.unique_name: Optional[str] = payload.get("unique_name") + self.attributes: Optional[str] = payload.get("attributes") + self.type: Optional["ChannelInstance.ChannelType"] = payload.get("type") + 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.created_by: Optional[str] = payload.get("created_by") + self.members_count: Optional[int] = deserialize.integer( + payload.get("members_count") + ) + self.messages_count: Optional[int] = deserialize.integer( + payload.get("messages_count") + ) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ChannelContext] = None @@ -81,104 +107,6 @@ def _proxy(self) -> "ChannelContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Channel resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Channel resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Channel resource is associated with. - """ - return self._properties["service_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. - """ - return self._properties["unique_name"] - - @property - def attributes(self) -> str: - """ - :returns: The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. - """ - return self._properties["attributes"] - - @property - def type(self) -> "ChannelInstance.ChannelType": - """ - :returns: - """ - return self._properties["type"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def created_by(self) -> str: - """ - :returns: The `identity` of the User that created the channel. If the Channel was created by using the API, the value is `system`. - """ - return self._properties["created_by"] - - @property - def members_count(self) -> int: - """ - :returns: The number of Members in the Channel. - """ - return self._properties["members_count"] - - @property - def messages_count(self) -> int: - """ - :returns: The number of Messages that have been passed in the Channel. - """ - return self._properties["messages_count"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Channel resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The absolute URLs of the [Members](https://www.twilio.com/docs/chat/rest/member-resource), [Messages](https://www.twilio.com/docs/chat/rest/message-resource), [Invites](https://www.twilio.com/docs/chat/rest/invite-resource), Webhooks and, if it exists, the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) for the Channel. - """ - return self._properties["links"] - def delete(self, x_twilio_webhook_enabled=values.unset) -> bool: """ Deletes the ChannelInstance diff --git a/twilio/rest/chat/v2/service/channel/invite.py b/twilio/rest/chat/v2/service/channel/invite.py index 4f77f489f..b23feaae9 100644 --- a/twilio/rest/chat/v2/service/channel/invite.py +++ b/twilio/rest/chat/v2/service/channel/invite.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,36 +24,49 @@ class InviteInstance(InstanceResource): + + """ + :ivar sid: The unique string that we created to identify the Invite resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Invite resource. + :ivar channel_sid: The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Invite resource belongs to. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Invite resource is associated with. + :ivar identity: The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + :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 role_sid: The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) assigned to the resource. + :ivar created_by: The `identity` of the User that created the invite. + :ivar url: The absolute URL of the Invite resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, channel_sid: str, sid: Optional[str] = None, ): - """ - Initialize the InviteInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "channel_sid": payload.get("channel_sid"), - "service_sid": payload.get("service_sid"), - "identity": payload.get("identity"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "role_sid": payload.get("role_sid"), - "created_by": payload.get("created_by"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.channel_sid: Optional[str] = payload.get("channel_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.identity: Optional[str] = payload.get("identity") + 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.role_sid: Optional[str] = payload.get("role_sid") + self.created_by: Optional[str] = payload.get("created_by") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, "channel_sid": channel_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[InviteContext] = None @@ -74,76 +87,6 @@ def _proxy(self) -> "InviteContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Invite resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Invite resource. - """ - return self._properties["account_sid"] - - @property - def channel_sid(self) -> str: - """ - :returns: The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Invite resource belongs to. - """ - return self._properties["channel_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Invite resource is associated with. - """ - return self._properties["service_sid"] - - @property - def identity(self) -> str: - """ - :returns: The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. - """ - return self._properties["identity"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def role_sid(self) -> str: - """ - :returns: The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) assigned to the resource. - """ - return self._properties["role_sid"] - - @property - def created_by(self) -> str: - """ - :returns: The `identity` of the User that created the invite. - """ - return self._properties["created_by"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Invite resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the InviteInstance diff --git a/twilio/rest/chat/v2/service/channel/member.py b/twilio/rest/chat/v2/service/channel/member.py index 523becb6c..5cb34bae5 100644 --- a/twilio/rest/chat/v2/service/channel/member.py +++ b/twilio/rest/chat/v2/service/channel/member.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,42 +28,56 @@ class WebhookEnabledType(object): TRUE = "true" FALSE = "false" + """ + :ivar sid: The unique string that we created to identify the Member resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Member resource. + :ivar channel_sid: The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Member resource belongs to. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Member resource is associated with. + :ivar identity: The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + :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 role_sid: The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) assigned to the member. + :ivar last_consumed_message_index: The index of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) in the [Channel](https://www.twilio.com/docs/chat/channels) that the Member has read. + :ivar last_consumption_timestamp: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) read event for the Member within the [Channel](https://www.twilio.com/docs/chat/channels). + :ivar url: The absolute URL of the Member resource. + :ivar attributes: The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, channel_sid: str, sid: Optional[str] = None, ): - """ - Initialize the MemberInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "channel_sid": payload.get("channel_sid"), - "service_sid": payload.get("service_sid"), - "identity": payload.get("identity"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "role_sid": payload.get("role_sid"), - "last_consumed_message_index": deserialize.integer( - payload.get("last_consumed_message_index") - ), - "last_consumption_timestamp": deserialize.iso8601_datetime( - payload.get("last_consumption_timestamp") - ), - "url": payload.get("url"), - "attributes": payload.get("attributes"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.channel_sid: Optional[str] = payload.get("channel_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.identity: Optional[str] = payload.get("identity") + 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.role_sid: Optional[str] = payload.get("role_sid") + self.last_consumed_message_index: Optional[int] = deserialize.integer( + payload.get("last_consumed_message_index") + ) + self.last_consumption_timestamp: Optional[ + datetime + ] = deserialize.iso8601_datetime(payload.get("last_consumption_timestamp")) + self.url: Optional[str] = payload.get("url") + self.attributes: Optional[str] = payload.get("attributes") self._solution = { "service_sid": service_sid, "channel_sid": channel_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[MemberContext] = None @@ -84,90 +98,6 @@ def _proxy(self) -> "MemberContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Member resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Member resource. - """ - return self._properties["account_sid"] - - @property - def channel_sid(self) -> str: - """ - :returns: The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Member resource belongs to. - """ - return self._properties["channel_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Member resource is associated with. - """ - return self._properties["service_sid"] - - @property - def identity(self) -> str: - """ - :returns: The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. - """ - return self._properties["identity"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def role_sid(self) -> str: - """ - :returns: The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) assigned to the member. - """ - return self._properties["role_sid"] - - @property - def last_consumed_message_index(self) -> int: - """ - :returns: The index of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) in the [Channel](https://www.twilio.com/docs/chat/channels) that the Member has read. - """ - return self._properties["last_consumed_message_index"] - - @property - def last_consumption_timestamp(self) -> datetime: - """ - :returns: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) read event for the Member within the [Channel](https://www.twilio.com/docs/chat/channels). - """ - return self._properties["last_consumption_timestamp"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Member resource. - """ - return self._properties["url"] - - @property - def attributes(self) -> str: - """ - :returns: The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. - """ - return self._properties["attributes"] - def delete(self, x_twilio_webhook_enabled=values.unset) -> bool: """ Deletes the MemberInstance diff --git a/twilio/rest/chat/v2/service/channel/message.py b/twilio/rest/chat/v2/service/channel/message.py index 039d8f2d9..6de058ee4 100644 --- a/twilio/rest/chat/v2/service/channel/message.py +++ b/twilio/rest/chat/v2/service/channel/message.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -32,42 +32,60 @@ class WebhookEnabledType(object): TRUE = "true" FALSE = "false" + """ + :ivar sid: The unique string that we created to identify the Message resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Message resource. + :ivar attributes: The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Message resource is associated with. + :ivar to: The SID of the [Channel](https://www.twilio.com/docs/chat/channels) that the message was sent to. + :ivar channel_sid: The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Message resource belongs to. + :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 last_updated_by: The [Identity](https://www.twilio.com/docs/chat/identity) of the User who last updated the Message, if applicable. + :ivar was_edited: Whether the message has been edited since it was created. + :ivar _from: The [Identity](https://www.twilio.com/docs/chat/identity) of the message's author. The default value is `system`. + :ivar body: The content of the message. + :ivar index: The index of the message within the [Channel](https://www.twilio.com/docs/chat/channels). Indices may skip numbers, but will always be in order of when the message was received. + :ivar type: The Message type. Can be: `text` or `media`. + :ivar media: An object that describes the Message's media, if the message contains media. The object contains these fields: `content_type` with the MIME type of the media, `filename` with the name of the media, `sid` with the SID of the Media resource, and `size` with the media object's file size in bytes. If the Message has no media, this value is `null`. + :ivar url: The absolute URL of the Message resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, channel_sid: str, sid: Optional[str] = None, ): - """ - Initialize the MessageInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "attributes": payload.get("attributes"), - "service_sid": payload.get("service_sid"), - "to": payload.get("to"), - "channel_sid": payload.get("channel_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "last_updated_by": payload.get("last_updated_by"), - "was_edited": payload.get("was_edited"), - "_from": payload.get("from"), - "body": payload.get("body"), - "index": deserialize.integer(payload.get("index")), - "type": payload.get("type"), - "media": payload.get("media"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.attributes: Optional[str] = payload.get("attributes") + self.service_sid: Optional[str] = payload.get("service_sid") + self.to: Optional[str] = payload.get("to") + self.channel_sid: Optional[str] = payload.get("channel_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.last_updated_by: Optional[str] = payload.get("last_updated_by") + self.was_edited: Optional[bool] = payload.get("was_edited") + self._from: Optional[str] = payload.get("from") + self.body: Optional[str] = payload.get("body") + self.index: Optional[int] = deserialize.integer(payload.get("index")) + self.type: Optional[str] = payload.get("type") + self.media: Optional[Dict[str, object]] = payload.get("media") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, "channel_sid": channel_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[MessageContext] = None @@ -88,118 +106,6 @@ def _proxy(self) -> "MessageContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Message resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Message resource. - """ - return self._properties["account_sid"] - - @property - def attributes(self) -> str: - """ - :returns: The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. - """ - return self._properties["attributes"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Message resource is associated with. - """ - return self._properties["service_sid"] - - @property - def to(self) -> str: - """ - :returns: The SID of the [Channel](https://www.twilio.com/docs/chat/channels) that the message was sent to. - """ - return self._properties["to"] - - @property - def channel_sid(self) -> str: - """ - :returns: The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Message resource belongs to. - """ - return self._properties["channel_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def last_updated_by(self) -> str: - """ - :returns: The [Identity](https://www.twilio.com/docs/chat/identity) of the User who last updated the Message, if applicable. - """ - return self._properties["last_updated_by"] - - @property - def was_edited(self) -> bool: - """ - :returns: Whether the message has been edited since it was created. - """ - return self._properties["was_edited"] - - @property - def _from(self) -> str: - """ - :returns: The [Identity](https://www.twilio.com/docs/chat/identity) of the message's author. The default value is `system`. - """ - return self._properties["_from"] - - @property - def body(self) -> str: - """ - :returns: The content of the message. - """ - return self._properties["body"] - - @property - def index(self) -> int: - """ - :returns: The index of the message within the [Channel](https://www.twilio.com/docs/chat/channels). Indices may skip numbers, but will always be in order of when the message was received. - """ - return self._properties["index"] - - @property - def type(self) -> str: - """ - :returns: The Message type. Can be: `text` or `media`. - """ - return self._properties["type"] - - @property - def media(self) -> Dict[str, object]: - """ - :returns: An object that describes the Message's media, if the message contains media. The object contains these fields: `content_type` with the MIME type of the media, `filename` with the name of the media, `sid` with the SID of the Media resource, and `size` with the media object's file size in bytes. If the Message has no media, this value is `null`. - """ - return self._properties["media"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Message resource. - """ - return self._properties["url"] - def delete(self, x_twilio_webhook_enabled=values.unset) -> bool: """ Deletes the MessageInstance diff --git a/twilio/rest/chat/v2/service/channel/webhook.py b/twilio/rest/chat/v2/service/channel/webhook.py index a9a6692af..a923fbc46 100644 --- a/twilio/rest/chat/v2/service/channel/webhook.py +++ b/twilio/rest/chat/v2/service/channel/webhook.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,35 +24,47 @@ class WebhookInstance(InstanceResource): + + """ + :ivar sid: The unique string that we created to identify the Channel Webhook resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Channel Webhook resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Channel Webhook resource is associated with. + :ivar channel_sid: The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Channel Webhook resource belongs to. + :ivar type: The type of webhook. Can be: `webhook`, `studio`, or `trigger`. + :ivar url: The absolute URL of the Channel Webhook resource. + :ivar configuration: The JSON string that describes how the channel webhook is configured. The configuration object contains the `url`, `method`, `filters`, and `retry_count` values that are configured by the create and update actions. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, channel_sid: str, sid: Optional[str] = None, ): - """ - Initialize the WebhookInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "channel_sid": payload.get("channel_sid"), - "type": payload.get("type"), - "url": payload.get("url"), - "configuration": payload.get("configuration"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.channel_sid: Optional[str] = payload.get("channel_sid") + self.type: Optional[str] = payload.get("type") + self.url: Optional[str] = payload.get("url") + self.configuration: Optional[Dict[str, object]] = payload.get("configuration") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) self._solution = { "service_sid": service_sid, "channel_sid": channel_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[WebhookContext] = None @@ -73,69 +85,6 @@ def _proxy(self) -> "WebhookContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Channel Webhook resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Channel Webhook resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Channel Webhook resource is associated with. - """ - return self._properties["service_sid"] - - @property - def channel_sid(self) -> str: - """ - :returns: The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Channel Webhook resource belongs to. - """ - return self._properties["channel_sid"] - - @property - def type(self) -> str: - """ - :returns: The type of webhook. Can be: `webhook`, `studio`, or `trigger`. - """ - return self._properties["type"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Channel Webhook resource. - """ - return self._properties["url"] - - @property - def configuration(self) -> Dict[str, object]: - """ - :returns: The JSON string that describes how the channel webhook is configured. The configuration object contains the `url`, `method`, `filters`, and `retry_count` values that are configured by the create and update actions. - """ - return self._properties["configuration"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - def delete(self) -> bool: """ Deletes the WebhookInstance diff --git a/twilio/rest/chat/v2/service/role.py b/twilio/rest/chat/v2/service/role.py index de17ed058..391ba18b6 100644 --- a/twilio/rest/chat/v2/service/role.py +++ b/twilio/rest/chat/v2/service/role.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,27 +28,44 @@ class RoleType(object): CHANNEL = "channel" DEPLOYMENT = "deployment" - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the RoleInstance - """ + """ + :ivar sid: The unique string that we created to identify the Role resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Role resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Role resource is associated with. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar type: + :ivar permissions: An array of the permissions the role has been granted. + :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 Role resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "friendly_name": payload.get("friendly_name"), - "type": payload.get("type"), - "permissions": payload.get("permissions"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.type: Optional["RoleInstance.RoleType"] = payload.get("type") + self.permissions: Optional[List[str]] = payload.get("permissions") + 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 = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[RoleContext] = None @@ -68,69 +85,6 @@ def _proxy(self) -> "RoleContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Role resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Role resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Role resource is associated with. - """ - return self._properties["service_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def type(self) -> "RoleInstance.RoleType": - """ - :returns: - """ - return self._properties["type"] - - @property - def permissions(self) -> List[str]: - """ - :returns: An array of the permissions the role has been granted. - """ - return self._properties["permissions"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Role resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the RoleInstance diff --git a/twilio/rest/chat/v2/service/user/__init__.py b/twilio/rest/chat/v2/service/user/__init__.py index 5dc3b7c9b..cfcdcde91 100644 --- a/twilio/rest/chat/v2/service/user/__init__.py +++ b/twilio/rest/chat/v2/service/user/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -30,34 +30,56 @@ class WebhookEnabledType(object): TRUE = "true" FALSE = "false" - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the UserInstance - """ + """ + :ivar sid: The unique string that we created to identify the User resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the User resource is associated with. + :ivar attributes: The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar role_sid: The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) assigned to the user. + :ivar identity: The application-defined string that uniquely identifies the resource's User within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). This value is often a username or an email address, and is case-sensitive. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + :ivar is_online: Whether the User is actively connected to the Service instance and online. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, if the User has never been online for the Service instance, even if the Service's `reachability_enabled` is `true`. + :ivar is_notifiable: Whether the User has a potentially valid Push Notification registration (APN or GCM) for the Service instance. If at least one registration exists, `true`; otherwise `false`. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, and if the User has never had a notification registration, even if the Service's `reachability_enabled` is `true`. + :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 joined_channels_count: The number of Channels the User is a Member of. + :ivar links: The absolute URLs of the [Channel](https://www.twilio.com/docs/chat/channels) and [Binding](https://www.twilio.com/docs/chat/rest/binding-resource) resources related to the user. + :ivar url: The absolute URL of the User resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "attributes": payload.get("attributes"), - "friendly_name": payload.get("friendly_name"), - "role_sid": payload.get("role_sid"), - "identity": payload.get("identity"), - "is_online": payload.get("is_online"), - "is_notifiable": payload.get("is_notifiable"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "joined_channels_count": deserialize.integer( - payload.get("joined_channels_count") - ), - "links": payload.get("links"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.attributes: Optional[str] = payload.get("attributes") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.role_sid: Optional[str] = payload.get("role_sid") + self.identity: Optional[str] = payload.get("identity") + self.is_online: Optional[bool] = payload.get("is_online") + self.is_notifiable: Optional[bool] = payload.get("is_notifiable") + 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.joined_channels_count: Optional[int] = deserialize.integer( + payload.get("joined_channels_count") + ) + self.links: Optional[Dict[str, object]] = payload.get("links") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[UserContext] = None @@ -77,104 +99,6 @@ def _proxy(self) -> "UserContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the User resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the User resource is associated with. - """ - return self._properties["service_sid"] - - @property - def attributes(self) -> str: - """ - :returns: The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. - """ - return self._properties["attributes"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def role_sid(self) -> str: - """ - :returns: The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) assigned to the user. - """ - return self._properties["role_sid"] - - @property - def identity(self) -> str: - """ - :returns: The application-defined string that uniquely identifies the resource's User within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). This value is often a username or an email address, and is case-sensitive. See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. - """ - return self._properties["identity"] - - @property - def is_online(self) -> bool: - """ - :returns: Whether the User is actively connected to the Service instance and online. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, if the User has never been online for the Service instance, even if the Service's `reachability_enabled` is `true`. - """ - return self._properties["is_online"] - - @property - def is_notifiable(self) -> bool: - """ - :returns: Whether the User has a potentially valid Push Notification registration (APN or GCM) for the Service instance. If at least one registration exists, `true`; otherwise `false`. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, and if the User has never had a notification registration, even if the Service's `reachability_enabled` is `true`. - """ - return self._properties["is_notifiable"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def joined_channels_count(self) -> int: - """ - :returns: The number of Channels the User is a Member of. - """ - return self._properties["joined_channels_count"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The absolute URLs of the [Channel](https://www.twilio.com/docs/chat/channels) and [Binding](https://www.twilio.com/docs/chat/rest/binding-resource) resources related to the user. - """ - return self._properties["links"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the User resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the UserInstance diff --git a/twilio/rest/chat/v2/service/user/user_binding.py b/twilio/rest/chat/v2/service/user/user_binding.py index 54c750173..e3a4b0ec9 100644 --- a/twilio/rest/chat/v2/service/user/user_binding.py +++ b/twilio/rest/chat/v2/service/user/user_binding.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -29,38 +29,54 @@ class BindingType(object): APN = "apn" FCM = "fcm" + """ + :ivar sid: The unique string that we created to identify the User Binding resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User Binding resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the User Binding resource is associated with. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar endpoint: The unique endpoint identifier for the User Binding. The format of the value depends on the `binding_type`. + :ivar identity: The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. + :ivar user_sid: The SID of the [User](https://www.twilio.com/docs/chat/rest/user-resource) with the User Binding resource. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. + :ivar credential_sid: The SID of the [Credential](https://www.twilio.com/docs/chat/rest/credential-resource) for the binding. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. + :ivar binding_type: + :ivar message_types: The [Programmable Chat message types](https://www.twilio.com/docs/chat/push-notification-configuration#push-types) the binding is subscribed to. + :ivar url: The absolute URL of the User Binding resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, user_sid: str, sid: Optional[str] = None, ): - """ - Initialize the UserBindingInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "endpoint": payload.get("endpoint"), - "identity": payload.get("identity"), - "user_sid": payload.get("user_sid"), - "credential_sid": payload.get("credential_sid"), - "binding_type": payload.get("binding_type"), - "message_types": payload.get("message_types"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.endpoint: Optional[str] = payload.get("endpoint") + self.identity: Optional[str] = payload.get("identity") + self.user_sid: Optional[str] = payload.get("user_sid") + self.credential_sid: Optional[str] = payload.get("credential_sid") + self.binding_type: Optional["UserBindingInstance.BindingType"] = payload.get( + "binding_type" + ) + self.message_types: Optional[List[str]] = payload.get("message_types") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, "user_sid": user_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[UserBindingContext] = None @@ -81,90 +97,6 @@ def _proxy(self) -> "UserBindingContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the User Binding resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User Binding resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the User Binding resource is associated with. - """ - return self._properties["service_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def endpoint(self) -> str: - """ - :returns: The unique endpoint identifier for the User Binding. The format of the value depends on the `binding_type`. - """ - return self._properties["endpoint"] - - @property - def identity(self) -> str: - """ - :returns: The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info. - """ - return self._properties["identity"] - - @property - def user_sid(self) -> str: - """ - :returns: The SID of the [User](https://www.twilio.com/docs/chat/rest/user-resource) with the User Binding resource. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. - """ - return self._properties["user_sid"] - - @property - def credential_sid(self) -> str: - """ - :returns: The SID of the [Credential](https://www.twilio.com/docs/chat/rest/credential-resource) for the binding. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. - """ - return self._properties["credential_sid"] - - @property - def binding_type(self) -> "UserBindingInstance.BindingType": - """ - :returns: - """ - return self._properties["binding_type"] - - @property - def message_types(self) -> List[str]: - """ - :returns: The [Programmable Chat message types](https://www.twilio.com/docs/chat/push-notification-configuration#push-types) the binding is subscribed to. - """ - return self._properties["message_types"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the User Binding resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the UserBindingInstance diff --git a/twilio/rest/chat/v2/service/user/user_channel.py b/twilio/rest/chat/v2/service/user/user_channel.py index b877e6d9d..9aac750df 100644 --- a/twilio/rest/chat/v2/service/user/user_channel.py +++ b/twilio/rest/chat/v2/service/user/user_channel.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -36,41 +36,54 @@ class WebhookEnabledType(object): TRUE = "true" FALSE = "false" + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User Channel resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the User Channel resource is associated with. + :ivar channel_sid: The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the User Channel resource belongs to. + :ivar user_sid: The SID of the [User](https://www.twilio.com/docs/chat/rest/user-resource) the User Channel belongs to. + :ivar member_sid: The SID of a [Member](https://www.twilio.com/docs/chat/rest/member-resource) that represents the User on the Channel. + :ivar status: + :ivar last_consumed_message_index: The index of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) in the [Channel](https://www.twilio.com/docs/chat/channels) that the Member has read. + :ivar unread_messages_count: The number of unread Messages in the Channel for the User. Note that retrieving messages on a client endpoint does not mean that messages are consumed or read. See [Consumption Horizon feature](https://www.twilio.com/docs/chat/consumption-horizon) to learn how to mark messages as consumed. + :ivar links: The absolute URLs of the [Members](https://www.twilio.com/docs/chat/rest/member-resource), [Messages](https://www.twilio.com/docs/chat/rest/message-resource) , [Invites](https://www.twilio.com/docs/chat/rest/invite-resource) and, if it exists, the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) for the Channel. + :ivar url: The absolute URL of the User Channel resource. + :ivar notification_level: + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, user_sid: str, channel_sid: Optional[str] = None, ): - """ - Initialize the UserChannelInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "channel_sid": payload.get("channel_sid"), - "user_sid": payload.get("user_sid"), - "member_sid": payload.get("member_sid"), - "status": payload.get("status"), - "last_consumed_message_index": deserialize.integer( - payload.get("last_consumed_message_index") - ), - "unread_messages_count": deserialize.integer( - payload.get("unread_messages_count") - ), - "links": payload.get("links"), - "url": payload.get("url"), - "notification_level": payload.get("notification_level"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.channel_sid: Optional[str] = payload.get("channel_sid") + self.user_sid: Optional[str] = payload.get("user_sid") + self.member_sid: Optional[str] = payload.get("member_sid") + self.status: Optional["UserChannelInstance.ChannelStatus"] = payload.get( + "status" + ) + self.last_consumed_message_index: Optional[int] = deserialize.integer( + payload.get("last_consumed_message_index") + ) + self.unread_messages_count: Optional[int] = deserialize.integer( + payload.get("unread_messages_count") + ) + self.links: Optional[Dict[str, object]] = payload.get("links") + self.url: Optional[str] = payload.get("url") + self.notification_level: Optional[ + "UserChannelInstance.NotificationLevel" + ] = payload.get("notification_level") self._solution = { "service_sid": service_sid, "user_sid": user_sid, - "channel_sid": channel_sid or self._properties["channel_sid"], + "channel_sid": channel_sid or self.channel_sid, } self._context: Optional[UserChannelContext] = None @@ -91,83 +104,6 @@ def _proxy(self) -> "UserChannelContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User Channel resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the User Channel resource is associated with. - """ - return self._properties["service_sid"] - - @property - def channel_sid(self) -> str: - """ - :returns: The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the User Channel resource belongs to. - """ - return self._properties["channel_sid"] - - @property - def user_sid(self) -> str: - """ - :returns: The SID of the [User](https://www.twilio.com/docs/chat/rest/user-resource) the User Channel belongs to. - """ - return self._properties["user_sid"] - - @property - def member_sid(self) -> str: - """ - :returns: The SID of a [Member](https://www.twilio.com/docs/chat/rest/member-resource) that represents the User on the Channel. - """ - return self._properties["member_sid"] - - @property - def status(self) -> "UserChannelInstance.ChannelStatus": - """ - :returns: - """ - return self._properties["status"] - - @property - def last_consumed_message_index(self) -> int: - """ - :returns: The index of the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) in the [Channel](https://www.twilio.com/docs/chat/channels) that the Member has read. - """ - return self._properties["last_consumed_message_index"] - - @property - def unread_messages_count(self) -> int: - """ - :returns: The number of unread Messages in the Channel for the User. Note that retrieving messages on a client endpoint does not mean that messages are consumed or read. See [Consumption Horizon feature](https://www.twilio.com/docs/chat/consumption-horizon) to learn how to mark messages as consumed. - """ - return self._properties["unread_messages_count"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The absolute URLs of the [Members](https://www.twilio.com/docs/chat/rest/member-resource), [Messages](https://www.twilio.com/docs/chat/rest/message-resource) , [Invites](https://www.twilio.com/docs/chat/rest/invite-resource) and, if it exists, the last [Message](https://www.twilio.com/docs/chat/rest/message-resource) for the Channel. - """ - return self._properties["links"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the User Channel resource. - """ - return self._properties["url"] - - @property - def notification_level(self) -> "UserChannelInstance.NotificationLevel": - """ - :returns: - """ - return self._properties["notification_level"] - def delete(self, x_twilio_webhook_enabled=values.unset) -> bool: """ Deletes the UserChannelInstance diff --git a/twilio/rest/chat/v3/channel.py b/twilio/rest/chat/v3/channel.py index 146698f79..1e09d2604 100644 --- a/twilio/rest/chat/v3/channel.py +++ b/twilio/rest/chat/v3/channel.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Optional +from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -31,38 +31,58 @@ class WebhookEnabledType(object): TRUE = "true" FALSE = "false" + """ + :ivar sid: The unique string that we created to identify the Channel resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Channel resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Channel resource is associated with. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + :ivar attributes: The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. + :ivar type: + :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 created_by: The `identity` of the User that created the channel. If the Channel was created by using the API, the value is `system`. + :ivar members_count: The number of Members in the Channel. + :ivar messages_count: The number of Messages that have been passed in the Channel. + :ivar messaging_service_sid: The unique ID of the [Messaging Service](https://www.twilio.com/docs/sms/services/api) this channel belongs to. + :ivar url: The absolute URL of the Channel resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: Optional[str] = None, sid: Optional[str] = None, ): - """ - Initialize the ChannelInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "friendly_name": payload.get("friendly_name"), - "unique_name": payload.get("unique_name"), - "attributes": payload.get("attributes"), - "type": payload.get("type"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "created_by": payload.get("created_by"), - "members_count": deserialize.integer(payload.get("members_count")), - "messages_count": deserialize.integer(payload.get("messages_count")), - "messaging_service_sid": payload.get("messaging_service_sid"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.unique_name: Optional[str] = payload.get("unique_name") + self.attributes: Optional[str] = payload.get("attributes") + self.type: Optional["ChannelInstance.ChannelType"] = payload.get("type") + 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.created_by: Optional[str] = payload.get("created_by") + self.members_count: Optional[int] = deserialize.integer( + payload.get("members_count") + ) + self.messages_count: Optional[int] = deserialize.integer( + payload.get("messages_count") + ) + self.messaging_service_sid: Optional[str] = payload.get("messaging_service_sid") + self.url: Optional[str] = payload.get("url") self._solution = { - "service_sid": service_sid or self._properties["service_sid"], - "sid": sid or self._properties["sid"], + "service_sid": service_sid or self.service_sid, + "sid": sid or self.sid, } self._context: Optional[ChannelContext] = None @@ -82,104 +102,6 @@ def _proxy(self) -> "ChannelContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Channel resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Channel resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Channel resource is associated with. - """ - return self._properties["service_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. - """ - return self._properties["unique_name"] - - @property - def attributes(self) -> str: - """ - :returns: The JSON string that stores application-specific data. If attributes have not been set, `{}` is returned. - """ - return self._properties["attributes"] - - @property - def type(self) -> "ChannelInstance.ChannelType": - """ - :returns: - """ - return self._properties["type"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def created_by(self) -> str: - """ - :returns: The `identity` of the User that created the channel. If the Channel was created by using the API, the value is `system`. - """ - return self._properties["created_by"] - - @property - def members_count(self) -> int: - """ - :returns: The number of Members in the Channel. - """ - return self._properties["members_count"] - - @property - def messages_count(self) -> int: - """ - :returns: The number of Messages that have been passed in the Channel. - """ - return self._properties["messages_count"] - - @property - def messaging_service_sid(self) -> str: - """ - :returns: The unique ID of the [Messaging Service](https://www.twilio.com/docs/sms/services/api) this channel belongs to. - """ - return self._properties["messaging_service_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Channel resource. - """ - return self._properties["url"] - def update( self, x_twilio_webhook_enabled=values.unset, diff --git a/twilio/rest/content/v1/content/__init__.py b/twilio/rest/content/v1/content/__init__.py index 6e8396913..6f2176f5f 100644 --- a/twilio/rest/content/v1/content/__init__.py +++ b/twilio/rest/content/v1/content/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -25,27 +25,42 @@ class ContentInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the ContentInstance - """ + + """ + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar sid: The unique string that that we created to identify the Content resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. + :ivar friendly_name: A string name used to describe the Content resource. Not visible to the end recipient. + :ivar language: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. + :ivar variables: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. + :ivar types: The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. + :ivar url: The URL of the resource, relative to `https://content.twilio.com`. + :ivar links: A list of links related to the Content resource, such as approval_fetch and approval_create + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "language": payload.get("language"), - "variables": payload.get("variables"), - "types": payload.get("types"), - "url": payload.get("url"), - "links": payload.get("links"), - } + 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.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.language: Optional[str] = payload.get("language") + self.variables: Optional[Dict[str, object]] = payload.get("variables") + self.types: Optional[Dict[str, object]] = payload.get("types") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ContentContext] = None @@ -64,76 +79,6 @@ def _proxy(self) -> "ContentContext": ) return self._context - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the Content resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: A string name used to describe the Content resource. Not visible to the end recipient. - """ - return self._properties["friendly_name"] - - @property - def language(self) -> str: - """ - :returns: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. - """ - return self._properties["language"] - - @property - def variables(self) -> Dict[str, object]: - """ - :returns: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. - """ - return self._properties["variables"] - - @property - def types(self) -> Dict[str, object]: - """ - :returns: The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. - """ - return self._properties["types"] - - @property - def url(self) -> str: - """ - :returns: The URL of the resource, relative to `https://content.twilio.com`. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: A list of links related to the Content resource, such as approval_fetch and approval_create - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the ContentInstance diff --git a/twilio/rest/content/v1/content/approval_fetch.py b/twilio/rest/content/v1/content/approval_fetch.py index f69027209..ccd3b96d8 100644 --- a/twilio/rest/content/v1/content/approval_fetch.py +++ b/twilio/rest/content/v1/content/approval_fetch.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -21,18 +21,21 @@ class ApprovalFetchInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - """ - Initialize the ApprovalFetchInstance - """ + + """ + :ivar sid: The unique string that that we created to identify the Content resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. + :ivar whatsapp: Contains the whatsapp approval information for the Content resource, with fields such as approval status, rejection reason, and category, amongst others. + :ivar url: The URL of the resource, relative to `https://content.twilio.com`. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], sid: str): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "whatsapp": payload.get("whatsapp"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.whatsapp: Optional[Dict[str, object]] = payload.get("whatsapp") + self.url: Optional[str] = payload.get("url") self._solution = { "sid": sid, @@ -54,34 +57,6 @@ def _proxy(self) -> "ApprovalFetchContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the Content resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. - """ - return self._properties["account_sid"] - - @property - def whatsapp(self) -> Dict[str, object]: - """ - :returns: Contains the whatsapp approval information for the Content resource, with fields such as approval status, rejection reason, and category, amongst others. - """ - return self._properties["whatsapp"] - - @property - def url(self) -> str: - """ - :returns: The URL of the resource, relative to `https://content.twilio.com`. - """ - return self._properties["url"] - def fetch(self) -> "ApprovalFetchInstance": """ Fetch the ApprovalFetchInstance diff --git a/twilio/rest/content/v1/content_and_approvals.py b/twilio/rest/content/v1/content_and_approvals.py index 59657dc1b..5d9e224f5 100644 --- a/twilio/rest/content/v1/content_and_approvals.py +++ b/twilio/rest/content/v1/content_and_approvals.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -24,89 +24,40 @@ class ContentAndApprovalsInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the ContentAndApprovalsInstance - """ + + """ + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar sid: The unique string that that we created to identify the Content resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. + :ivar friendly_name: A string name used to describe the Content resource. Not visible to the end recipient. + :ivar language: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. + :ivar variables: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. + :ivar types: The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. + :ivar approval_requests: The submitted information and approval request status of the Content resource. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "language": payload.get("language"), - "variables": payload.get("variables"), - "types": payload.get("types"), - "approval_requests": payload.get("approval_requests"), - } + 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.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.language: Optional[str] = payload.get("language") + self.variables: Optional[Dict[str, object]] = payload.get("variables") + self.types: Optional[Dict[str, object]] = payload.get("types") + self.approval_requests: Optional[Dict[str, object]] = payload.get( + "approval_requests" + ) self._solution = {} - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the Content resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: A string name used to describe the Content resource. Not visible to the end recipient. - """ - return self._properties["friendly_name"] - - @property - def language(self) -> str: - """ - :returns: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. - """ - return self._properties["language"] - - @property - def variables(self) -> Dict[str, object]: - """ - :returns: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. - """ - return self._properties["variables"] - - @property - def types(self) -> Dict[str, object]: - """ - :returns: The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. - """ - return self._properties["types"] - - @property - def approval_requests(self) -> Dict[str, object]: - """ - :returns: The submitted information and approval request status of the Content resource. - """ - return self._properties["approval_requests"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/content/v1/legacy_content.py b/twilio/rest/content/v1/legacy_content.py index b6f16d535..c7454d5e0 100644 --- a/twilio/rest/content/v1/legacy_content.py +++ b/twilio/rest/content/v1/legacy_content.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -24,105 +24,42 @@ class LegacyContentInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the LegacyContentInstance - """ + + """ + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar sid: The unique string that that we created to identify the Content resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. + :ivar friendly_name: A string name used to describe the Content resource. Not visible to the end recipient. + :ivar language: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. + :ivar variables: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. + :ivar types: The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. + :ivar legacy_template_name: The string name of the legacy content template associated with this Content resource, unique across all template names for its account. Only lowercase letters, numbers and underscores are allowed + :ivar legacy_body: The string body field of the legacy content template associated with this Content resource + :ivar url: The URL of the resource, relative to `https://content.twilio.com`. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "language": payload.get("language"), - "variables": payload.get("variables"), - "types": payload.get("types"), - "legacy_template_name": payload.get("legacy_template_name"), - "legacy_body": payload.get("legacy_body"), - "url": payload.get("url"), - } + 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.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.language: Optional[str] = payload.get("language") + self.variables: Optional[Dict[str, object]] = payload.get("variables") + self.types: Optional[Dict[str, object]] = payload.get("types") + self.legacy_template_name: Optional[str] = payload.get("legacy_template_name") + self.legacy_body: Optional[str] = payload.get("legacy_body") + self.url: Optional[str] = payload.get("url") self._solution = {} - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the Content resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: A string name used to describe the Content resource. Not visible to the end recipient. - """ - return self._properties["friendly_name"] - - @property - def language(self) -> str: - """ - :returns: Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. - """ - return self._properties["language"] - - @property - def variables(self) -> Dict[str, object]: - """ - :returns: Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. - """ - return self._properties["variables"] - - @property - def types(self) -> Dict[str, object]: - """ - :returns: The [Content types](https://www.twilio.com/docs/content-api/content-types-overview) (e.g. twilio/text) for this Content resource. - """ - return self._properties["types"] - - @property - def legacy_template_name(self) -> str: - """ - :returns: The string name of the legacy content template associated with this Content resource, unique across all template names for its account. Only lowercase letters, numbers and underscores are allowed - """ - return self._properties["legacy_template_name"] - - @property - def legacy_body(self) -> str: - """ - :returns: The string body field of the legacy content template associated with this Content resource - """ - return self._properties["legacy_body"] - - @property - def url(self) -> str: - """ - :returns: The URL of the resource, relative to `https://content.twilio.com`. - """ - return self._properties["url"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/conversations/v1/address_configuration.py b/twilio/rest/conversations/v1/address_configuration.py index bf3194206..d58fea840 100644 --- a/twilio/rest/conversations/v1/address_configuration.py +++ b/twilio/rest/conversations/v1/address_configuration.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,26 +24,40 @@ class AddressConfigurationInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the AddressConfigurationInstance - """ + + """ + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) the address belongs to + :ivar type: Type of Address, value can be `whatsapp` or `sms`. + :ivar address: The unique address to be configured. The address can be a whatsapp address or phone number + :ivar friendly_name: The human-readable name of this configuration, limited to 256 characters. Optional. + :ivar auto_creation: Auto Creation configuration for the address. + :ivar date_created: The date that this resource was created. + :ivar date_updated: The date that this resource was last updated. + :ivar url: An absolute API resource URL for this address configuration. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "type": payload.get("type"), - "address": payload.get("address"), - "friendly_name": payload.get("friendly_name"), - "auto_creation": payload.get("auto_creation"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.type: Optional[str] = payload.get("type") + self.address: Optional[str] = payload.get("address") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.auto_creation: Optional[Dict[str, object]] = payload.get("auto_creation") + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[AddressConfigurationContext] = None @@ -62,69 +76,6 @@ def _proxy(self) -> "AddressConfigurationContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) the address belongs to - """ - return self._properties["account_sid"] - - @property - def type(self) -> str: - """ - :returns: Type of Address, value can be `whatsapp` or `sms`. - """ - return self._properties["type"] - - @property - def address(self) -> str: - """ - :returns: The unique address to be configured. The address can be a whatsapp address or phone number - """ - return self._properties["address"] - - @property - def friendly_name(self) -> str: - """ - :returns: The human-readable name of this configuration, limited to 256 characters. Optional. - """ - return self._properties["friendly_name"] - - @property - def auto_creation(self) -> Dict[str, object]: - """ - :returns: Auto Creation configuration for the address. - """ - return self._properties["auto_creation"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: An absolute API resource URL for this address configuration. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the AddressConfigurationInstance diff --git a/twilio/rest/conversations/v1/configuration/__init__.py b/twilio/rest/conversations/v1/configuration/__init__.py index 80bafbd27..62ca3007f 100644 --- a/twilio/rest/conversations/v1/configuration/__init__.py +++ b/twilio/rest/conversations/v1/configuration/__init__.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +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 @@ -24,23 +24,33 @@ class ConfigurationInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the ConfigurationInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this configuration. + :ivar default_chat_service_sid: The SID of the default [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) used when creating a conversation. + :ivar default_messaging_service_sid: The SID of the default [Messaging Service](https://www.twilio.com/docs/sms/services/api) used when creating a conversation. + :ivar default_inactive_timer: Default ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. + :ivar default_closed_timer: Default ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. + :ivar url: An absolute API resource URL for this global configuration. + :ivar links: Contains absolute API resource URLs to access the webhook and default service configurations. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "default_chat_service_sid": payload.get("default_chat_service_sid"), - "default_messaging_service_sid": payload.get( - "default_messaging_service_sid" - ), - "default_inactive_timer": payload.get("default_inactive_timer"), - "default_closed_timer": payload.get("default_closed_timer"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.default_chat_service_sid: Optional[str] = payload.get( + "default_chat_service_sid" + ) + self.default_messaging_service_sid: Optional[str] = payload.get( + "default_messaging_service_sid" + ) + self.default_inactive_timer: Optional[str] = payload.get( + "default_inactive_timer" + ) + self.default_closed_timer: Optional[str] = payload.get("default_closed_timer") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = {} self._context: Optional[ConfigurationContext] = None @@ -59,55 +69,6 @@ def _proxy(self) -> "ConfigurationContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this configuration. - """ - return self._properties["account_sid"] - - @property - def default_chat_service_sid(self) -> str: - """ - :returns: The SID of the default [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) used when creating a conversation. - """ - return self._properties["default_chat_service_sid"] - - @property - def default_messaging_service_sid(self) -> str: - """ - :returns: The SID of the default [Messaging Service](https://www.twilio.com/docs/sms/services/api) used when creating a conversation. - """ - return self._properties["default_messaging_service_sid"] - - @property - def default_inactive_timer(self) -> str: - """ - :returns: Default ISO8601 duration when conversation will be switched to `inactive` state. Minimum value for this timer is 1 minute. - """ - return self._properties["default_inactive_timer"] - - @property - def default_closed_timer(self) -> str: - """ - :returns: Default ISO8601 duration when conversation will be switched to `closed` state. Minimum value for this timer is 10 minutes. - """ - return self._properties["default_closed_timer"] - - @property - def url(self) -> str: - """ - :returns: An absolute API resource URL for this global configuration. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: Contains absolute API resource URLs to access the webhook and default service configurations. - """ - return self._properties["links"] - def fetch(self) -> "ConfigurationInstance": """ Fetch the ConfigurationInstance diff --git a/twilio/rest/conversations/v1/configuration/webhook.py b/twilio/rest/conversations/v1/configuration/webhook.py index ff7f7b4a3..ce3455587 100644 --- a/twilio/rest/conversations/v1/configuration/webhook.py +++ b/twilio/rest/conversations/v1/configuration/webhook.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -30,21 +30,26 @@ class Target(object): WEBHOOK = "webhook" FLEX = "flex" - def __init__(self, version, payload): - """ - Initialize the WebhookInstance - """ + """ + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + :ivar method: + :ivar filters: The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved` + :ivar pre_webhook_url: The absolute url the pre-event webhook request should be sent to. + :ivar post_webhook_url: The absolute url the post-event webhook request should be sent to. + :ivar target: + :ivar url: An absolute API resource API resource URL for this webhook. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "method": payload.get("method"), - "filters": payload.get("filters"), - "pre_webhook_url": payload.get("pre_webhook_url"), - "post_webhook_url": payload.get("post_webhook_url"), - "target": payload.get("target"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.method: Optional["WebhookInstance.Method"] = payload.get("method") + self.filters: Optional[List[str]] = payload.get("filters") + self.pre_webhook_url: Optional[str] = payload.get("pre_webhook_url") + self.post_webhook_url: Optional[str] = payload.get("post_webhook_url") + self.target: Optional["WebhookInstance.Target"] = payload.get("target") + self.url: Optional[str] = payload.get("url") self._solution = {} self._context: Optional[WebhookContext] = None @@ -63,55 +68,6 @@ def _proxy(self) -> "WebhookContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. - """ - return self._properties["account_sid"] - - @property - def method(self) -> "WebhookInstance.Method": - """ - :returns: - """ - return self._properties["method"] - - @property - def filters(self) -> List[str]: - """ - :returns: The list of webhook event triggers that are enabled for this Service: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved` - """ - return self._properties["filters"] - - @property - def pre_webhook_url(self) -> str: - """ - :returns: The absolute url the pre-event webhook request should be sent to. - """ - return self._properties["pre_webhook_url"] - - @property - def post_webhook_url(self) -> str: - """ - :returns: The absolute url the post-event webhook request should be sent to. - """ - return self._properties["post_webhook_url"] - - @property - def target(self) -> "WebhookInstance.Target": - """ - :returns: - """ - return self._properties["target"] - - @property - def url(self) -> str: - """ - :returns: An absolute API resource API resource URL for this webhook. - """ - return self._properties["url"] - def fetch(self) -> "WebhookInstance": """ Fetch the WebhookInstance diff --git a/twilio/rest/conversations/v1/conversation/__init__.py b/twilio/rest/conversations/v1/conversation/__init__.py index ccd28b382..9c2ea5643 100644 --- a/twilio/rest/conversations/v1/conversation/__init__.py +++ b/twilio/rest/conversations/v1/conversation/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -36,31 +36,49 @@ class WebhookEnabledType(object): TRUE = "true" FALSE = "false" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the ConversationInstance - """ + """ + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + :ivar chat_service_sid: The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. + :ivar messaging_service_sid: The unique ID of the [Messaging Service](https://www.twilio.com/docs/sms/services/api) this conversation belongs to. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar friendly_name: The human-readable name of this conversation, limited to 256 characters. Optional. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + :ivar attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + :ivar state: + :ivar date_created: The date that this resource was created. + :ivar date_updated: The date that this resource was last updated. + :ivar timers: Timer date values representing state update for this conversation. + :ivar url: An absolute API resource URL for this conversation. + :ivar links: Contains absolute URLs to access the [participants](https://www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](https://www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](https://www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation. + :ivar bindings: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "chat_service_sid": payload.get("chat_service_sid"), - "messaging_service_sid": payload.get("messaging_service_sid"), - "sid": payload.get("sid"), - "friendly_name": payload.get("friendly_name"), - "unique_name": payload.get("unique_name"), - "attributes": payload.get("attributes"), - "state": payload.get("state"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "timers": payload.get("timers"), - "url": payload.get("url"), - "links": payload.get("links"), - "bindings": payload.get("bindings"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.messaging_service_sid: Optional[str] = payload.get("messaging_service_sid") + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.unique_name: Optional[str] = payload.get("unique_name") + self.attributes: Optional[str] = payload.get("attributes") + self.state: Optional["ConversationInstance.State"] = payload.get("state") + 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.timers: Optional[Dict[str, object]] = payload.get("timers") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.bindings: Optional[Dict[str, object]] = payload.get("bindings") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ConversationContext] = None @@ -79,104 +97,6 @@ def _proxy(self) -> "ConversationContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. - """ - return self._properties["account_sid"] - - @property - def chat_service_sid(self) -> str: - """ - :returns: The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. - """ - return self._properties["chat_service_sid"] - - @property - def messaging_service_sid(self) -> str: - """ - :returns: The unique ID of the [Messaging Service](https://www.twilio.com/docs/sms/services/api) this conversation belongs to. - """ - return self._properties["messaging_service_sid"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The human-readable name of this conversation, limited to 256 characters. Optional. - """ - return self._properties["friendly_name"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. - """ - return self._properties["unique_name"] - - @property - def attributes(self) -> str: - """ - :returns: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. - """ - return self._properties["attributes"] - - @property - def state(self) -> "ConversationInstance.State": - """ - :returns: - """ - return self._properties["state"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated. - """ - return self._properties["date_updated"] - - @property - def timers(self) -> Dict[str, object]: - """ - :returns: Timer date values representing state update for this conversation. - """ - return self._properties["timers"] - - @property - def url(self) -> str: - """ - :returns: An absolute API resource URL for this conversation. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: Contains absolute URLs to access the [participants](https://www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](https://www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](https://www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation. - """ - return self._properties["links"] - - @property - def bindings(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["bindings"] - def delete(self, x_twilio_webhook_enabled=values.unset) -> bool: """ Deletes the ConversationInstance diff --git a/twilio/rest/conversations/v1/conversation/message/__init__.py b/twilio/rest/conversations/v1/conversation/message/__init__.py index 830982dce..a0df10df2 100644 --- a/twilio/rest/conversations/v1/conversation/message/__init__.py +++ b/twilio/rest/conversations/v1/conversation/message/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -35,35 +35,56 @@ class WebhookEnabledType(object): TRUE = "true" FALSE = "false" + """ + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this message. + :ivar conversation_sid: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this message. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar index: The index of the message within the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource). Indices may skip numbers, but will always be in order of when the message was received. + :ivar author: The channel specific identifier of the message's author. Defaults to `system`. + :ivar body: The content of the message, can be up to 1,600 characters long. + :ivar media: An array of objects that describe the Message's media, if the message contains media. Each object contains these fields: `content_type` with the MIME type of the media, `filename` with the name of the media, `sid` with the SID of the Media resource, and `size` with the media object's file size in bytes. If the Message has no media, this value is `null`. + :ivar attributes: A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + :ivar participant_sid: The unique ID of messages's author participant. Null in case of `system` sent message. + :ivar date_created: The date that this resource was created. + :ivar date_updated: The date that this resource was last updated. `null` if the message has not been edited. + :ivar url: An absolute API resource API URL for this message. + :ivar delivery: An object that contains the summary of delivery statuses for the message to non-chat participants. + :ivar links: Contains an absolute API resource URL to access the delivery & read receipts of this message. + :ivar content_sid: The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content-api) template. + """ + def __init__( - self, version, payload, conversation_sid: str, sid: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + conversation_sid: str, + sid: Optional[str] = None, ): - """ - Initialize the MessageInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "conversation_sid": payload.get("conversation_sid"), - "sid": payload.get("sid"), - "index": deserialize.integer(payload.get("index")), - "author": payload.get("author"), - "body": payload.get("body"), - "media": payload.get("media"), - "attributes": payload.get("attributes"), - "participant_sid": payload.get("participant_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "delivery": payload.get("delivery"), - "links": payload.get("links"), - "content_sid": payload.get("content_sid"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.conversation_sid: Optional[str] = payload.get("conversation_sid") + self.sid: Optional[str] = payload.get("sid") + self.index: Optional[int] = deserialize.integer(payload.get("index")) + self.author: Optional[str] = payload.get("author") + self.body: Optional[str] = payload.get("body") + self.media: Optional[List[object]] = payload.get("media") + self.attributes: Optional[str] = payload.get("attributes") + self.participant_sid: Optional[str] = payload.get("participant_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") + self.delivery: Optional[Dict[str, object]] = payload.get("delivery") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.content_sid: Optional[str] = payload.get("content_sid") self._solution = { "conversation_sid": conversation_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[MessageContext] = None @@ -83,111 +104,6 @@ def _proxy(self) -> "MessageContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this message. - """ - return self._properties["account_sid"] - - @property - def conversation_sid(self) -> str: - """ - :returns: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this message. - """ - return self._properties["conversation_sid"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def index(self) -> int: - """ - :returns: The index of the message within the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource). Indices may skip numbers, but will always be in order of when the message was received. - """ - return self._properties["index"] - - @property - def author(self) -> str: - """ - :returns: The channel specific identifier of the message's author. Defaults to `system`. - """ - return self._properties["author"] - - @property - def body(self) -> str: - """ - :returns: The content of the message, can be up to 1,600 characters long. - """ - return self._properties["body"] - - @property - def media(self) -> List[object]: - """ - :returns: An array of objects that describe the Message's media, if the message contains media. Each object contains these fields: `content_type` with the MIME type of the media, `filename` with the name of the media, `sid` with the SID of the Media resource, and `size` with the media object's file size in bytes. If the Message has no media, this value is `null`. - """ - return self._properties["media"] - - @property - def attributes(self) -> str: - """ - :returns: A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. - """ - return self._properties["attributes"] - - @property - def participant_sid(self) -> str: - """ - :returns: The unique ID of messages's author participant. Null in case of `system` sent message. - """ - return self._properties["participant_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated. `null` if the message has not been edited. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: An absolute API resource API URL for this message. - """ - return self._properties["url"] - - @property - def delivery(self) -> Dict[str, object]: - """ - :returns: An object that contains the summary of delivery statuses for the message to non-chat participants. - """ - return self._properties["delivery"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: Contains an absolute API resource URL to access the delivery & read receipts of this message. - """ - return self._properties["links"] - - @property - def content_sid(self) -> str: - """ - :returns: The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content-api) template. - """ - return self._properties["content_sid"] - def delete(self, x_twilio_webhook_enabled=values.unset) -> bool: """ Deletes the MessageInstance diff --git a/twilio/rest/conversations/v1/conversation/message/delivery_receipt.py b/twilio/rest/conversations/v1/conversation/message/delivery_receipt.py index d51702305..c49e0dc35 100644 --- a/twilio/rest/conversations/v1/conversation/message/delivery_receipt.py +++ b/twilio/rest/conversations/v1/conversation/message/delivery_receipt.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -31,37 +31,52 @@ class DeliveryStatus(object): UNDELIVERED = "undelivered" SENT = "sent" + """ + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this participant. + :ivar conversation_sid: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this message. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar message_sid: The SID of the message within a [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) the delivery receipt belongs to + :ivar channel_message_sid: A messaging channel-specific identifier for the message delivered to participant e.g. `SMxx` for SMS, `WAxx` for Whatsapp etc. + :ivar participant_sid: The unique ID of the participant the delivery receipt belongs to. + :ivar status: + :ivar error_code: The message [delivery error code](https://www.twilio.com/docs/sms/api/message-resource#delivery-related-errors) for a `failed` status, + :ivar date_created: The date that this resource was created. + :ivar date_updated: The date that this resource was last updated. `null` if the delivery receipt has not been updated. + :ivar url: An absolute API resource URL for this delivery receipt. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], conversation_sid: str, message_sid: str, sid: Optional[str] = None, ): - """ - Initialize the DeliveryReceiptInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "conversation_sid": payload.get("conversation_sid"), - "sid": payload.get("sid"), - "message_sid": payload.get("message_sid"), - "channel_message_sid": payload.get("channel_message_sid"), - "participant_sid": payload.get("participant_sid"), - "status": payload.get("status"), - "error_code": deserialize.integer(payload.get("error_code")), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.conversation_sid: Optional[str] = payload.get("conversation_sid") + self.sid: Optional[str] = payload.get("sid") + self.message_sid: Optional[str] = payload.get("message_sid") + self.channel_message_sid: Optional[str] = payload.get("channel_message_sid") + self.participant_sid: Optional[str] = payload.get("participant_sid") + self.status: Optional["DeliveryReceiptInstance.DeliveryStatus"] = payload.get( + "status" + ) + self.error_code: Optional[int] = deserialize.integer(payload.get("error_code")) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") self._solution = { "conversation_sid": conversation_sid, "message_sid": message_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[DeliveryReceiptContext] = None @@ -82,83 +97,6 @@ def _proxy(self) -> "DeliveryReceiptContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this participant. - """ - return self._properties["account_sid"] - - @property - def conversation_sid(self) -> str: - """ - :returns: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this message. - """ - return self._properties["conversation_sid"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def message_sid(self) -> str: - """ - :returns: The SID of the message within a [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) the delivery receipt belongs to - """ - return self._properties["message_sid"] - - @property - def channel_message_sid(self) -> str: - """ - :returns: A messaging channel-specific identifier for the message delivered to participant e.g. `SMxx` for SMS, `WAxx` for Whatsapp etc. - """ - return self._properties["channel_message_sid"] - - @property - def participant_sid(self) -> str: - """ - :returns: The unique ID of the participant the delivery receipt belongs to. - """ - return self._properties["participant_sid"] - - @property - def status(self) -> "DeliveryReceiptInstance.DeliveryStatus": - """ - :returns: - """ - return self._properties["status"] - - @property - def error_code(self) -> int: - """ - :returns: The message [delivery error code](https://www.twilio.com/docs/sms/api/message-resource#delivery-related-errors) for a `failed` status, - """ - return self._properties["error_code"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated. `null` if the delivery receipt has not been updated. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: An absolute API resource URL for this delivery receipt. - """ - return self._properties["url"] - def fetch(self) -> "DeliveryReceiptInstance": """ Fetch the DeliveryReceiptInstance diff --git a/twilio/rest/conversations/v1/conversation/participant.py b/twilio/rest/conversations/v1/conversation/participant.py index 2db7cb218..3dc833f28 100644 --- a/twilio/rest/conversations/v1/conversation/participant.py +++ b/twilio/rest/conversations/v1/conversation/participant.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,34 +28,54 @@ class WebhookEnabledType(object): TRUE = "true" FALSE = "false" + """ + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this participant. + :ivar conversation_sid: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this participant. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar identity: A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. + :ivar attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + :ivar messaging_binding: Information about how this participant exchanges messages with the conversation. A JSON parameter consisting of type and address fields of the participant. + :ivar role_sid: The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. + :ivar date_created: The date that this resource was created. + :ivar date_updated: The date that this resource was last updated. + :ivar url: An absolute API resource URL for this participant. + :ivar last_read_message_index: Index of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. + :ivar last_read_timestamp: Timestamp of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. + """ + def __init__( - self, version, payload, conversation_sid: str, sid: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + conversation_sid: str, + sid: Optional[str] = None, ): - """ - Initialize the ParticipantInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "conversation_sid": payload.get("conversation_sid"), - "sid": payload.get("sid"), - "identity": payload.get("identity"), - "attributes": payload.get("attributes"), - "messaging_binding": payload.get("messaging_binding"), - "role_sid": payload.get("role_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "last_read_message_index": deserialize.integer( - payload.get("last_read_message_index") - ), - "last_read_timestamp": payload.get("last_read_timestamp"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.conversation_sid: Optional[str] = payload.get("conversation_sid") + self.sid: Optional[str] = payload.get("sid") + self.identity: Optional[str] = payload.get("identity") + self.attributes: Optional[str] = payload.get("attributes") + self.messaging_binding: Optional[Dict[str, object]] = payload.get( + "messaging_binding" + ) + self.role_sid: Optional[str] = payload.get("role_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") + self.last_read_message_index: Optional[int] = deserialize.integer( + payload.get("last_read_message_index") + ) + self.last_read_timestamp: Optional[str] = payload.get("last_read_timestamp") self._solution = { "conversation_sid": conversation_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ParticipantContext] = None @@ -75,90 +95,6 @@ def _proxy(self) -> "ParticipantContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this participant. - """ - return self._properties["account_sid"] - - @property - def conversation_sid(self) -> str: - """ - :returns: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this participant. - """ - return self._properties["conversation_sid"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def identity(self) -> str: - """ - :returns: A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. - """ - return self._properties["identity"] - - @property - def attributes(self) -> str: - """ - :returns: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. - """ - return self._properties["attributes"] - - @property - def messaging_binding(self) -> Dict[str, object]: - """ - :returns: Information about how this participant exchanges messages with the conversation. A JSON parameter consisting of type and address fields of the participant. - """ - return self._properties["messaging_binding"] - - @property - def role_sid(self) -> str: - """ - :returns: The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. - """ - return self._properties["role_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: An absolute API resource URL for this participant. - """ - return self._properties["url"] - - @property - def last_read_message_index(self) -> int: - """ - :returns: Index of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. - """ - return self._properties["last_read_message_index"] - - @property - def last_read_timestamp(self) -> str: - """ - :returns: Timestamp of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. - """ - return self._properties["last_read_timestamp"] - def delete(self, x_twilio_webhook_enabled=values.unset) -> bool: """ Deletes the ParticipantInstance diff --git a/twilio/rest/conversations/v1/conversation/webhook.py b/twilio/rest/conversations/v1/conversation/webhook.py index 8139bc157..95b8594c5 100644 --- a/twilio/rest/conversations/v1/conversation/webhook.py +++ b/twilio/rest/conversations/v1/conversation/webhook.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,28 +24,43 @@ class WebhookInstance(InstanceResource): + + """ + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + :ivar conversation_sid: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this webhook. + :ivar target: The target of this webhook: `webhook`, `studio`, `trigger` + :ivar url: An absolute API resource URL for this webhook. + :ivar configuration: The configuration of this webhook. Is defined based on target. + :ivar date_created: The date that this resource was created. + :ivar date_updated: The date that this resource was last updated. + """ + def __init__( - self, version, payload, conversation_sid: str, sid: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + conversation_sid: str, + sid: Optional[str] = None, ): - """ - Initialize the WebhookInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "conversation_sid": payload.get("conversation_sid"), - "target": payload.get("target"), - "url": payload.get("url"), - "configuration": payload.get("configuration"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.conversation_sid: Optional[str] = payload.get("conversation_sid") + self.target: Optional[str] = payload.get("target") + self.url: Optional[str] = payload.get("url") + self.configuration: Optional[Dict[str, object]] = payload.get("configuration") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) self._solution = { "conversation_sid": conversation_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[WebhookContext] = None @@ -65,62 +80,6 @@ def _proxy(self) -> "WebhookContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. - """ - return self._properties["account_sid"] - - @property - def conversation_sid(self) -> str: - """ - :returns: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this webhook. - """ - return self._properties["conversation_sid"] - - @property - def target(self) -> str: - """ - :returns: The target of this webhook: `webhook`, `studio`, `trigger` - """ - return self._properties["target"] - - @property - def url(self) -> str: - """ - :returns: An absolute API resource URL for this webhook. - """ - return self._properties["url"] - - @property - def configuration(self) -> Dict[str, object]: - """ - :returns: The configuration of this webhook. Is defined based on target. - """ - return self._properties["configuration"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated. - """ - return self._properties["date_updated"] - def delete(self) -> bool: """ Deletes the WebhookInstance diff --git a/twilio/rest/conversations/v1/credential.py b/twilio/rest/conversations/v1/credential.py index c9f54eb13..b113c5b91 100644 --- a/twilio/rest/conversations/v1/credential.py +++ b/twilio/rest/conversations/v1/credential.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -29,25 +29,37 @@ class PushType(object): GCM = "gcm" FCM = "fcm" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the CredentialInstance - """ + """ + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this credential. + :ivar friendly_name: The human-readable name of this credential, limited to 64 characters. Optional. + :ivar type: + :ivar sandbox: [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. + :ivar date_created: The date that this resource was created. + :ivar date_updated: The date that this resource was last updated. + :ivar url: An absolute API resource URL for this credential. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "type": payload.get("type"), - "sandbox": payload.get("sandbox"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + 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["CredentialInstance.PushType"] = payload.get("type") + self.sandbox: Optional[str] = payload.get("sandbox") + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[CredentialContext] = None @@ -66,62 +78,6 @@ def _proxy(self) -> "CredentialContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this credential. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The human-readable name of this credential, limited to 64 characters. Optional. - """ - return self._properties["friendly_name"] - - @property - def type(self) -> "CredentialInstance.PushType": - """ - :returns: - """ - return self._properties["type"] - - @property - def sandbox(self) -> str: - """ - :returns: [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. - """ - return self._properties["sandbox"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: An absolute API resource URL for this credential. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the CredentialInstance diff --git a/twilio/rest/conversations/v1/participant_conversation.py b/twilio/rest/conversations/v1/participant_conversation.py index 2e096341d..3321cb1c9 100644 --- a/twilio/rest/conversations/v1/participant_conversation.py +++ b/twilio/rest/conversations/v1/participant_conversation.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -29,151 +29,65 @@ class State(object): ACTIVE = "active" CLOSED = "closed" - def __init__(self, version, payload): - """ - Initialize the ParticipantConversationInstance - """ + """ + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + :ivar chat_service_sid: The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. + :ivar participant_sid: The unique ID of the [Participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). + :ivar participant_user_sid: The unique string that identifies the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). + :ivar participant_identity: A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. + :ivar participant_messaging_binding: Information about how this participant exchanges messages with the conversation. A JSON parameter consisting of type and address fields of the participant. + :ivar conversation_sid: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) this Participant belongs to. + :ivar conversation_unique_name: An application-defined string that uniquely identifies the Conversation resource. + :ivar conversation_friendly_name: The human-readable name of this conversation, limited to 256 characters. Optional. + :ivar conversation_attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + :ivar conversation_date_created: The date that this conversation was created, given in ISO 8601 format. + :ivar conversation_date_updated: The date that this conversation was last updated, given in ISO 8601 format. + :ivar conversation_created_by: Identity of the creator of this Conversation. + :ivar conversation_state: + :ivar conversation_timers: Timer date values representing state update for this conversation. + :ivar links: Contains absolute URLs to access the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) and [conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) of this conversation. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "chat_service_sid": payload.get("chat_service_sid"), - "participant_sid": payload.get("participant_sid"), - "participant_user_sid": payload.get("participant_user_sid"), - "participant_identity": payload.get("participant_identity"), - "participant_messaging_binding": payload.get( - "participant_messaging_binding" - ), - "conversation_sid": payload.get("conversation_sid"), - "conversation_unique_name": payload.get("conversation_unique_name"), - "conversation_friendly_name": payload.get("conversation_friendly_name"), - "conversation_attributes": payload.get("conversation_attributes"), - "conversation_date_created": deserialize.iso8601_datetime( - payload.get("conversation_date_created") - ), - "conversation_date_updated": deserialize.iso8601_datetime( - payload.get("conversation_date_updated") - ), - "conversation_created_by": payload.get("conversation_created_by"), - "conversation_state": payload.get("conversation_state"), - "conversation_timers": payload.get("conversation_timers"), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.participant_sid: Optional[str] = payload.get("participant_sid") + self.participant_user_sid: Optional[str] = payload.get("participant_user_sid") + self.participant_identity: Optional[str] = payload.get("participant_identity") + self.participant_messaging_binding: Optional[Dict[str, object]] = payload.get( + "participant_messaging_binding" + ) + self.conversation_sid: Optional[str] = payload.get("conversation_sid") + self.conversation_unique_name: Optional[str] = payload.get( + "conversation_unique_name" + ) + self.conversation_friendly_name: Optional[str] = payload.get( + "conversation_friendly_name" + ) + self.conversation_attributes: Optional[str] = payload.get( + "conversation_attributes" + ) + self.conversation_date_created: Optional[ + datetime + ] = deserialize.iso8601_datetime(payload.get("conversation_date_created")) + self.conversation_date_updated: Optional[ + datetime + ] = deserialize.iso8601_datetime(payload.get("conversation_date_updated")) + self.conversation_created_by: Optional[str] = payload.get( + "conversation_created_by" + ) + self.conversation_state: Optional[ + "ParticipantConversationInstance.State" + ] = payload.get("conversation_state") + self.conversation_timers: Optional[Dict[str, object]] = payload.get( + "conversation_timers" + ) + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = {} - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. - """ - return self._properties["account_sid"] - - @property - def chat_service_sid(self) -> str: - """ - :returns: The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. - """ - return self._properties["chat_service_sid"] - - @property - def participant_sid(self) -> str: - """ - :returns: The unique ID of the [Participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). - """ - return self._properties["participant_sid"] - - @property - def participant_user_sid(self) -> str: - """ - :returns: The unique string that identifies the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). - """ - return self._properties["participant_user_sid"] - - @property - def participant_identity(self) -> str: - """ - :returns: A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. - """ - return self._properties["participant_identity"] - - @property - def participant_messaging_binding(self) -> Dict[str, object]: - """ - :returns: Information about how this participant exchanges messages with the conversation. A JSON parameter consisting of type and address fields of the participant. - """ - return self._properties["participant_messaging_binding"] - - @property - def conversation_sid(self) -> str: - """ - :returns: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) this Participant belongs to. - """ - return self._properties["conversation_sid"] - - @property - def conversation_unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the Conversation resource. - """ - return self._properties["conversation_unique_name"] - - @property - def conversation_friendly_name(self) -> str: - """ - :returns: The human-readable name of this conversation, limited to 256 characters. Optional. - """ - return self._properties["conversation_friendly_name"] - - @property - def conversation_attributes(self) -> str: - """ - :returns: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. - """ - return self._properties["conversation_attributes"] - - @property - def conversation_date_created(self) -> datetime: - """ - :returns: The date that this conversation was created, given in ISO 8601 format. - """ - return self._properties["conversation_date_created"] - - @property - def conversation_date_updated(self) -> datetime: - """ - :returns: The date that this conversation was last updated, given in ISO 8601 format. - """ - return self._properties["conversation_date_updated"] - - @property - def conversation_created_by(self) -> str: - """ - :returns: Identity of the creator of this Conversation. - """ - return self._properties["conversation_created_by"] - - @property - def conversation_state(self) -> "ParticipantConversationInstance.State": - """ - :returns: - """ - return self._properties["conversation_state"] - - @property - def conversation_timers(self) -> Dict[str, object]: - """ - :returns: Timer date values representing state update for this conversation. - """ - return self._properties["conversation_timers"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: Contains absolute URLs to access the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) and [conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) of this conversation. - """ - return self._properties["links"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/conversations/v1/role.py b/twilio/rest/conversations/v1/role.py index 521f024da..2135fe07b 100644 --- a/twilio/rest/conversations/v1/role.py +++ b/twilio/rest/conversations/v1/role.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,26 +28,39 @@ class RoleType(object): CONVERSATION = "conversation" SERVICE = "service" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the RoleInstance - """ + """ + :ivar sid: The unique string that we created to identify the Role resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Role resource. + :ivar chat_service_sid: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Role resource is associated with. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar type: + :ivar permissions: An array of the permissions the role has been granted. + :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: An absolute API resource URL for this user role. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "chat_service_sid": payload.get("chat_service_sid"), - "friendly_name": payload.get("friendly_name"), - "type": payload.get("type"), - "permissions": payload.get("permissions"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.type: Optional["RoleInstance.RoleType"] = payload.get("type") + self.permissions: Optional[List[str]] = payload.get("permissions") + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[RoleContext] = None @@ -66,69 +79,6 @@ def _proxy(self) -> "RoleContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Role resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Role resource. - """ - return self._properties["account_sid"] - - @property - def chat_service_sid(self) -> str: - """ - :returns: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Role resource is associated with. - """ - return self._properties["chat_service_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def type(self) -> "RoleInstance.RoleType": - """ - :returns: - """ - return self._properties["type"] - - @property - def permissions(self) -> List[str]: - """ - :returns: An array of the permissions the role has been granted. - """ - return self._properties["permissions"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: An absolute API resource URL for this user role. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the RoleInstance diff --git a/twilio/rest/conversations/v1/service/__init__.py b/twilio/rest/conversations/v1/service/__init__.py index 425d32d7d..e61b6e142 100644 --- a/twilio/rest/conversations/v1/service/__init__.py +++ b/twilio/rest/conversations/v1/service/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -32,24 +32,36 @@ class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the ServiceInstance - """ + + """ + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this service. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar friendly_name: The human-readable name of this service, limited to 256 characters. Optional. + :ivar date_created: The date that this resource was created. + :ivar date_updated: The date that this resource was last updated. + :ivar url: An absolute API resource URL for this service. + :ivar links: Contains absolute API resource URLs to access conversations, users, roles, bindings and configuration of this service. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "sid": payload.get("sid"), - "friendly_name": payload.get("friendly_name"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ServiceContext] = None @@ -68,55 +80,6 @@ def _proxy(self) -> "ServiceContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this service. - """ - return self._properties["account_sid"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The human-readable name of this service, limited to 256 characters. Optional. - """ - return self._properties["friendly_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: An absolute API resource URL for this service. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: Contains absolute API resource URLs to access conversations, users, roles, bindings and configuration of this service. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the ServiceInstance diff --git a/twilio/rest/conversations/v1/service/binding.py b/twilio/rest/conversations/v1/service/binding.py index a7211538c..48d59cb43 100644 --- a/twilio/rest/conversations/v1/service/binding.py +++ b/twilio/rest/conversations/v1/service/binding.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -29,31 +29,50 @@ class BindingType(object): GCM = "gcm" FCM = "fcm" + """ + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this binding. + :ivar chat_service_sid: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Binding resource is associated with. + :ivar credential_sid: The SID of the [Credential](https://www.twilio.com/docs/conversations/api/credential-resource) for the binding. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. + :ivar date_created: The date that this resource was created. + :ivar date_updated: The date that this resource was last updated. + :ivar endpoint: The unique endpoint identifier for the Binding. The format of this value depends on the `binding_type`. + :ivar identity: The application-defined string that uniquely identifies the [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource) within the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource). See [access tokens](https://www.twilio.com/docs/conversations/create-tokens) for more info. + :ivar binding_type: + :ivar message_types: The [Conversation message types](https://www.twilio.com/docs/chat/push-notification-configuration#push-types) the binding is subscribed to. + :ivar url: An absolute API resource URL for this binding. + """ + def __init__( - self, version, payload, chat_service_sid: str, sid: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + chat_service_sid: str, + sid: Optional[str] = None, ): - """ - Initialize the BindingInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "chat_service_sid": payload.get("chat_service_sid"), - "credential_sid": payload.get("credential_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "endpoint": payload.get("endpoint"), - "identity": payload.get("identity"), - "binding_type": payload.get("binding_type"), - "message_types": payload.get("message_types"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.credential_sid: Optional[str] = payload.get("credential_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.endpoint: Optional[str] = payload.get("endpoint") + self.identity: Optional[str] = payload.get("identity") + self.binding_type: Optional["BindingInstance.BindingType"] = payload.get( + "binding_type" + ) + self.message_types: Optional[List[str]] = payload.get("message_types") + self.url: Optional[str] = payload.get("url") self._solution = { "chat_service_sid": chat_service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[BindingContext] = None @@ -73,83 +92,6 @@ def _proxy(self) -> "BindingContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this binding. - """ - return self._properties["account_sid"] - - @property - def chat_service_sid(self) -> str: - """ - :returns: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Binding resource is associated with. - """ - return self._properties["chat_service_sid"] - - @property - def credential_sid(self) -> str: - """ - :returns: The SID of the [Credential](https://www.twilio.com/docs/conversations/api/credential-resource) for the binding. See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info. - """ - return self._properties["credential_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated. - """ - return self._properties["date_updated"] - - @property - def endpoint(self) -> str: - """ - :returns: The unique endpoint identifier for the Binding. The format of this value depends on the `binding_type`. - """ - return self._properties["endpoint"] - - @property - def identity(self) -> str: - """ - :returns: The application-defined string that uniquely identifies the [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource) within the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource). See [access tokens](https://www.twilio.com/docs/conversations/create-tokens) for more info. - """ - return self._properties["identity"] - - @property - def binding_type(self) -> "BindingInstance.BindingType": - """ - :returns: - """ - return self._properties["binding_type"] - - @property - def message_types(self) -> List[str]: - """ - :returns: The [Conversation message types](https://www.twilio.com/docs/chat/push-notification-configuration#push-types) the binding is subscribed to. - """ - return self._properties["message_types"] - - @property - def url(self) -> str: - """ - :returns: An absolute API resource URL for this binding. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the BindingInstance diff --git a/twilio/rest/conversations/v1/service/configuration/__init__.py b/twilio/rest/conversations/v1/service/configuration/__init__.py index 1d1f37f5b..2685d90af 100644 --- a/twilio/rest/conversations/v1/service/configuration/__init__.py +++ b/twilio/rest/conversations/v1/service/configuration/__init__.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +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 @@ -27,27 +27,35 @@ class ConfigurationInstance(InstanceResource): - def __init__(self, version, payload, chat_service_sid: str): - """ - Initialize the ConfigurationInstance - """ + + """ + :ivar chat_service_sid: The unique string that we created to identify the Service configuration resource. + :ivar default_conversation_creator_role_sid: The conversation-level role assigned to a conversation creator user when they join a new conversation. See the [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. + :ivar default_conversation_role_sid: The conversation-level role assigned to users when they are added to a conversation. See the [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. + :ivar default_chat_service_role_sid: The service-level role assigned to users when they are added to the service. See the [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. + :ivar url: An absolute API resource URL for this service configuration. + :ivar links: Contains an absolute API resource URL to access the push notifications configuration of this service. + :ivar reachability_enabled: Whether the [Reachability Indicator](https://www.twilio.com/docs/chat/reachability-indicator) is enabled for this Conversations Service. The default is `false`. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], chat_service_sid: str + ): super().__init__(version) - self._properties = { - "chat_service_sid": payload.get("chat_service_sid"), - "default_conversation_creator_role_sid": payload.get( - "default_conversation_creator_role_sid" - ), - "default_conversation_role_sid": payload.get( - "default_conversation_role_sid" - ), - "default_chat_service_role_sid": payload.get( - "default_chat_service_role_sid" - ), - "url": payload.get("url"), - "links": payload.get("links"), - "reachability_enabled": payload.get("reachability_enabled"), - } + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.default_conversation_creator_role_sid: Optional[str] = payload.get( + "default_conversation_creator_role_sid" + ) + self.default_conversation_role_sid: Optional[str] = payload.get( + "default_conversation_role_sid" + ) + self.default_chat_service_role_sid: Optional[str] = payload.get( + "default_chat_service_role_sid" + ) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.reachability_enabled: Optional[bool] = payload.get("reachability_enabled") self._solution = { "chat_service_sid": chat_service_sid, @@ -69,55 +77,6 @@ def _proxy(self) -> "ConfigurationContext": ) return self._context - @property - def chat_service_sid(self) -> str: - """ - :returns: The unique string that we created to identify the Service configuration resource. - """ - return self._properties["chat_service_sid"] - - @property - def default_conversation_creator_role_sid(self) -> str: - """ - :returns: The conversation-level role assigned to a conversation creator user when they join a new conversation. See the [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. - """ - return self._properties["default_conversation_creator_role_sid"] - - @property - def default_conversation_role_sid(self) -> str: - """ - :returns: The conversation-level role assigned to users when they are added to a conversation. See the [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. - """ - return self._properties["default_conversation_role_sid"] - - @property - def default_chat_service_role_sid(self) -> str: - """ - :returns: The service-level role assigned to users when they are added to the service. See the [Conversation Role](https://www.twilio.com/docs/conversations/api/role-resource) for more info about roles. - """ - return self._properties["default_chat_service_role_sid"] - - @property - def url(self) -> str: - """ - :returns: An absolute API resource URL for this service configuration. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: Contains an absolute API resource URL to access the push notifications configuration of this service. - """ - return self._properties["links"] - - @property - def reachability_enabled(self) -> bool: - """ - :returns: Whether the [Reachability Indicator](https://www.twilio.com/docs/chat/reachability-indicator) is enabled for this Conversations Service. The default is `false`. - """ - return self._properties["reachability_enabled"] - def fetch(self) -> "ConfigurationInstance": """ Fetch the ConfigurationInstance diff --git a/twilio/rest/conversations/v1/service/configuration/notification.py b/twilio/rest/conversations/v1/service/configuration/notification.py index a7eb330a4..e1c2f3db2 100644 --- a/twilio/rest/conversations/v1/service/configuration/notification.py +++ b/twilio/rest/conversations/v1/service/configuration/notification.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +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 @@ -22,21 +22,33 @@ class NotificationInstance(InstanceResource): - def __init__(self, version, payload, chat_service_sid: str): - """ - Initialize the NotificationInstance - """ + + """ + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this configuration. + :ivar chat_service_sid: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Configuration applies to. + :ivar new_message: The Push Notification configuration for New Messages. + :ivar added_to_conversation: The Push Notification configuration for being added to a Conversation. + :ivar removed_from_conversation: The Push Notification configuration for being removed from a Conversation. + :ivar log_enabled: Weather the notification logging is enabled. + :ivar url: An absolute API resource URL for this configuration. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], chat_service_sid: str + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "chat_service_sid": payload.get("chat_service_sid"), - "new_message": payload.get("new_message"), - "added_to_conversation": payload.get("added_to_conversation"), - "removed_from_conversation": payload.get("removed_from_conversation"), - "log_enabled": payload.get("log_enabled"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.new_message: Optional[Dict[str, object]] = payload.get("new_message") + self.added_to_conversation: Optional[Dict[str, object]] = payload.get( + "added_to_conversation" + ) + self.removed_from_conversation: Optional[Dict[str, object]] = payload.get( + "removed_from_conversation" + ) + self.log_enabled: Optional[bool] = payload.get("log_enabled") + self.url: Optional[str] = payload.get("url") self._solution = { "chat_service_sid": chat_service_sid, @@ -58,55 +70,6 @@ def _proxy(self) -> "NotificationContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this configuration. - """ - return self._properties["account_sid"] - - @property - def chat_service_sid(self) -> str: - """ - :returns: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Configuration applies to. - """ - return self._properties["chat_service_sid"] - - @property - def new_message(self) -> Dict[str, object]: - """ - :returns: The Push Notification configuration for New Messages. - """ - return self._properties["new_message"] - - @property - def added_to_conversation(self) -> Dict[str, object]: - """ - :returns: The Push Notification configuration for being added to a Conversation. - """ - return self._properties["added_to_conversation"] - - @property - def removed_from_conversation(self) -> Dict[str, object]: - """ - :returns: The Push Notification configuration for being removed from a Conversation. - """ - return self._properties["removed_from_conversation"] - - @property - def log_enabled(self) -> bool: - """ - :returns: Weather the notification logging is enabled. - """ - return self._properties["log_enabled"] - - @property - def url(self) -> str: - """ - :returns: An absolute API resource URL for this configuration. - """ - return self._properties["url"] - def fetch(self) -> "NotificationInstance": """ Fetch the NotificationInstance diff --git a/twilio/rest/conversations/v1/service/configuration/webhook.py b/twilio/rest/conversations/v1/service/configuration/webhook.py index 10824415d..c31fc52d6 100644 --- a/twilio/rest/conversations/v1/service/configuration/webhook.py +++ b/twilio/rest/conversations/v1/service/configuration/webhook.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -26,21 +26,28 @@ class Method(object): GET = "GET" POST = "POST" - def __init__(self, version, payload, chat_service_sid: str): - """ - Initialize the WebhookInstance - """ + """ + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this service. + :ivar chat_service_sid: The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. + :ivar pre_webhook_url: The absolute url the pre-event webhook request should be sent to. + :ivar post_webhook_url: The absolute url the post-event webhook request should be sent to. + :ivar filters: The list of events that your configured webhook targets will receive. Events not configured here will not fire. Possible values are `onParticipantAdd`, `onParticipantAdded`, `onDeliveryUpdated`, `onConversationUpdated`, `onConversationRemove`, `onParticipantRemove`, `onConversationUpdate`, `onMessageAdd`, `onMessageRemoved`, `onParticipantUpdated`, `onConversationAdded`, `onMessageAdded`, `onConversationAdd`, `onConversationRemoved`, `onParticipantUpdate`, `onMessageRemove`, `onMessageUpdated`, `onParticipantRemoved`, `onMessageUpdate` or `onConversationStateUpdated`. + :ivar method: + :ivar url: An absolute API resource URL for this webhook. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], chat_service_sid: str + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "chat_service_sid": payload.get("chat_service_sid"), - "pre_webhook_url": payload.get("pre_webhook_url"), - "post_webhook_url": payload.get("post_webhook_url"), - "filters": payload.get("filters"), - "method": payload.get("method"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.pre_webhook_url: Optional[str] = payload.get("pre_webhook_url") + self.post_webhook_url: Optional[str] = payload.get("post_webhook_url") + self.filters: Optional[List[str]] = payload.get("filters") + self.method: Optional["WebhookInstance.Method"] = payload.get("method") + self.url: Optional[str] = payload.get("url") self._solution = { "chat_service_sid": chat_service_sid, @@ -62,55 +69,6 @@ def _proxy(self) -> "WebhookContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this service. - """ - return self._properties["account_sid"] - - @property - def chat_service_sid(self) -> str: - """ - :returns: The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. - """ - return self._properties["chat_service_sid"] - - @property - def pre_webhook_url(self) -> str: - """ - :returns: The absolute url the pre-event webhook request should be sent to. - """ - return self._properties["pre_webhook_url"] - - @property - def post_webhook_url(self) -> str: - """ - :returns: The absolute url the post-event webhook request should be sent to. - """ - return self._properties["post_webhook_url"] - - @property - def filters(self) -> List[str]: - """ - :returns: The list of events that your configured webhook targets will receive. Events not configured here will not fire. Possible values are `onParticipantAdd`, `onParticipantAdded`, `onDeliveryUpdated`, `onConversationUpdated`, `onConversationRemove`, `onParticipantRemove`, `onConversationUpdate`, `onMessageAdd`, `onMessageRemoved`, `onParticipantUpdated`, `onConversationAdded`, `onMessageAdded`, `onConversationAdd`, `onConversationRemoved`, `onParticipantUpdate`, `onMessageRemove`, `onMessageUpdated`, `onParticipantRemoved`, `onMessageUpdate` or `onConversationStateUpdated`. - """ - return self._properties["filters"] - - @property - def method(self) -> "WebhookInstance.Method": - """ - :returns: - """ - return self._properties["method"] - - @property - def url(self) -> str: - """ - :returns: An absolute API resource URL for this webhook. - """ - return self._properties["url"] - def fetch(self) -> "WebhookInstance": """ Fetch the WebhookInstance diff --git a/twilio/rest/conversations/v1/service/conversation/__init__.py b/twilio/rest/conversations/v1/service/conversation/__init__.py index 95667e8e4..b02b8d206 100644 --- a/twilio/rest/conversations/v1/service/conversation/__init__.py +++ b/twilio/rest/conversations/v1/service/conversation/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -38,34 +38,54 @@ class WebhookEnabledType(object): TRUE = "true" FALSE = "false" + """ + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + :ivar chat_service_sid: The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. + :ivar messaging_service_sid: The unique ID of the [Messaging Service](https://www.twilio.com/docs/sms/services/api) this conversation belongs to. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar friendly_name: The human-readable name of this conversation, limited to 256 characters. Optional. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. + :ivar attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + :ivar state: + :ivar date_created: The date that this resource was created. + :ivar date_updated: The date that this resource was last updated. + :ivar timers: Timer date values representing state update for this conversation. + :ivar url: An absolute API resource URL for this conversation. + :ivar links: Contains absolute URLs to access the [participants](https://www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](https://www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](https://www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation. + :ivar bindings: + """ + def __init__( - self, version, payload, chat_service_sid: str, sid: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + chat_service_sid: str, + sid: Optional[str] = None, ): - """ - Initialize the ConversationInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "chat_service_sid": payload.get("chat_service_sid"), - "messaging_service_sid": payload.get("messaging_service_sid"), - "sid": payload.get("sid"), - "friendly_name": payload.get("friendly_name"), - "unique_name": payload.get("unique_name"), - "attributes": payload.get("attributes"), - "state": payload.get("state"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "timers": payload.get("timers"), - "url": payload.get("url"), - "links": payload.get("links"), - "bindings": payload.get("bindings"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.messaging_service_sid: Optional[str] = payload.get("messaging_service_sid") + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.unique_name: Optional[str] = payload.get("unique_name") + self.attributes: Optional[str] = payload.get("attributes") + self.state: Optional["ConversationInstance.State"] = payload.get("state") + 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.timers: Optional[Dict[str, object]] = payload.get("timers") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.bindings: Optional[Dict[str, object]] = payload.get("bindings") self._solution = { "chat_service_sid": chat_service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ConversationContext] = None @@ -85,104 +105,6 @@ def _proxy(self) -> "ConversationContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. - """ - return self._properties["account_sid"] - - @property - def chat_service_sid(self) -> str: - """ - :returns: The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. - """ - return self._properties["chat_service_sid"] - - @property - def messaging_service_sid(self) -> str: - """ - :returns: The unique ID of the [Messaging Service](https://www.twilio.com/docs/sms/services/api) this conversation belongs to. - """ - return self._properties["messaging_service_sid"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The human-readable name of this conversation, limited to 256 characters. Optional. - """ - return self._properties["friendly_name"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. - """ - return self._properties["unique_name"] - - @property - def attributes(self) -> str: - """ - :returns: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. - """ - return self._properties["attributes"] - - @property - def state(self) -> "ConversationInstance.State": - """ - :returns: - """ - return self._properties["state"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated. - """ - return self._properties["date_updated"] - - @property - def timers(self) -> Dict[str, object]: - """ - :returns: Timer date values representing state update for this conversation. - """ - return self._properties["timers"] - - @property - def url(self) -> str: - """ - :returns: An absolute API resource URL for this conversation. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: Contains absolute URLs to access the [participants](https://www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](https://www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](https://www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation. - """ - return self._properties["links"] - - @property - def bindings(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["bindings"] - def delete(self, x_twilio_webhook_enabled=values.unset) -> bool: """ Deletes the ConversationInstance diff --git a/twilio/rest/conversations/v1/service/conversation/message/__init__.py b/twilio/rest/conversations/v1/service/conversation/message/__init__.py index 05bb3706b..5d1fee999 100644 --- a/twilio/rest/conversations/v1/service/conversation/message/__init__.py +++ b/twilio/rest/conversations/v1/service/conversation/message/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -35,42 +35,60 @@ class WebhookEnabledType(object): TRUE = "true" FALSE = "false" + """ + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this message. + :ivar chat_service_sid: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Participant resource is associated with. + :ivar conversation_sid: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this message. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar index: The index of the message within the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource). + :ivar author: The channel specific identifier of the message's author. Defaults to `system`. + :ivar body: The content of the message, can be up to 1,600 characters long. + :ivar media: An array of objects that describe the Message's media, if the message contains media. Each object contains these fields: `content_type` with the MIME type of the media, `filename` with the name of the media, `sid` with the SID of the Media resource, and `size` with the media object's file size in bytes. If the Message has no media, this value is `null`. + :ivar attributes: A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + :ivar participant_sid: The unique ID of messages's author participant. Null in case of `system` sent message. + :ivar date_created: The date that this resource was created. + :ivar date_updated: The date that this resource was last updated. `null` if the message has not been edited. + :ivar delivery: An object that contains the summary of delivery statuses for the message to non-chat participants. + :ivar url: An absolute API resource URL for this message. + :ivar links: Contains an absolute API resource URL to access the delivery & read receipts of this message. + :ivar content_sid: The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content-api) template. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], chat_service_sid: str, conversation_sid: str, sid: Optional[str] = None, ): - """ - Initialize the MessageInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "chat_service_sid": payload.get("chat_service_sid"), - "conversation_sid": payload.get("conversation_sid"), - "sid": payload.get("sid"), - "index": deserialize.integer(payload.get("index")), - "author": payload.get("author"), - "body": payload.get("body"), - "media": payload.get("media"), - "attributes": payload.get("attributes"), - "participant_sid": payload.get("participant_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "delivery": payload.get("delivery"), - "url": payload.get("url"), - "links": payload.get("links"), - "content_sid": payload.get("content_sid"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.conversation_sid: Optional[str] = payload.get("conversation_sid") + self.sid: Optional[str] = payload.get("sid") + self.index: Optional[int] = deserialize.integer(payload.get("index")) + self.author: Optional[str] = payload.get("author") + self.body: Optional[str] = payload.get("body") + self.media: Optional[List[object]] = payload.get("media") + self.attributes: Optional[str] = payload.get("attributes") + self.participant_sid: Optional[str] = payload.get("participant_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.delivery: Optional[Dict[str, object]] = payload.get("delivery") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.content_sid: Optional[str] = payload.get("content_sid") self._solution = { "chat_service_sid": chat_service_sid, "conversation_sid": conversation_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[MessageContext] = None @@ -91,118 +109,6 @@ def _proxy(self) -> "MessageContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this message. - """ - return self._properties["account_sid"] - - @property - def chat_service_sid(self) -> str: - """ - :returns: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Participant resource is associated with. - """ - return self._properties["chat_service_sid"] - - @property - def conversation_sid(self) -> str: - """ - :returns: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this message. - """ - return self._properties["conversation_sid"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def index(self) -> int: - """ - :returns: The index of the message within the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource). - """ - return self._properties["index"] - - @property - def author(self) -> str: - """ - :returns: The channel specific identifier of the message's author. Defaults to `system`. - """ - return self._properties["author"] - - @property - def body(self) -> str: - """ - :returns: The content of the message, can be up to 1,600 characters long. - """ - return self._properties["body"] - - @property - def media(self) -> List[object]: - """ - :returns: An array of objects that describe the Message's media, if the message contains media. Each object contains these fields: `content_type` with the MIME type of the media, `filename` with the name of the media, `sid` with the SID of the Media resource, and `size` with the media object's file size in bytes. If the Message has no media, this value is `null`. - """ - return self._properties["media"] - - @property - def attributes(self) -> str: - """ - :returns: A string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. - """ - return self._properties["attributes"] - - @property - def participant_sid(self) -> str: - """ - :returns: The unique ID of messages's author participant. Null in case of `system` sent message. - """ - return self._properties["participant_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated. `null` if the message has not been edited. - """ - return self._properties["date_updated"] - - @property - def delivery(self) -> Dict[str, object]: - """ - :returns: An object that contains the summary of delivery statuses for the message to non-chat participants. - """ - return self._properties["delivery"] - - @property - def url(self) -> str: - """ - :returns: An absolute API resource URL for this message. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: Contains an absolute API resource URL to access the delivery & read receipts of this message. - """ - return self._properties["links"] - - @property - def content_sid(self) -> str: - """ - :returns: The unique ID of the multi-channel [Rich Content](https://www.twilio.com/docs/content-api) template. - """ - return self._properties["content_sid"] - def delete(self, x_twilio_webhook_enabled=values.unset) -> bool: """ Deletes the MessageInstance diff --git a/twilio/rest/conversations/v1/service/conversation/message/delivery_receipt.py b/twilio/rest/conversations/v1/service/conversation/message/delivery_receipt.py index 28c9917ca..98c6a4027 100644 --- a/twilio/rest/conversations/v1/service/conversation/message/delivery_receipt.py +++ b/twilio/rest/conversations/v1/service/conversation/message/delivery_receipt.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -31,40 +31,56 @@ class DeliveryStatus(object): UNDELIVERED = "undelivered" SENT = "sent" + """ + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this participant. + :ivar chat_service_sid: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Message resource is associated with. + :ivar conversation_sid: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this message. + :ivar message_sid: The SID of the message within a [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) the delivery receipt belongs to + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar channel_message_sid: A messaging channel-specific identifier for the message delivered to participant e.g. `SMxx` for SMS, `WAxx` for Whatsapp etc. + :ivar participant_sid: The unique ID of the participant the delivery receipt belongs to. + :ivar status: + :ivar error_code: The message [delivery error code](https://www.twilio.com/docs/sms/api/message-resource#delivery-related-errors) for a `failed` status, + :ivar date_created: The date that this resource was created. + :ivar date_updated: The date that this resource was last updated. `null` if the delivery receipt has not been updated. + :ivar url: An absolute API resource URL for this delivery receipt. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], chat_service_sid: str, conversation_sid: str, message_sid: str, sid: Optional[str] = None, ): - """ - Initialize the DeliveryReceiptInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "chat_service_sid": payload.get("chat_service_sid"), - "conversation_sid": payload.get("conversation_sid"), - "message_sid": payload.get("message_sid"), - "sid": payload.get("sid"), - "channel_message_sid": payload.get("channel_message_sid"), - "participant_sid": payload.get("participant_sid"), - "status": payload.get("status"), - "error_code": deserialize.integer(payload.get("error_code")), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.conversation_sid: Optional[str] = payload.get("conversation_sid") + self.message_sid: Optional[str] = payload.get("message_sid") + self.sid: Optional[str] = payload.get("sid") + self.channel_message_sid: Optional[str] = payload.get("channel_message_sid") + self.participant_sid: Optional[str] = payload.get("participant_sid") + self.status: Optional["DeliveryReceiptInstance.DeliveryStatus"] = payload.get( + "status" + ) + self.error_code: Optional[int] = deserialize.integer(payload.get("error_code")) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") self._solution = { "chat_service_sid": chat_service_sid, "conversation_sid": conversation_sid, "message_sid": message_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[DeliveryReceiptContext] = None @@ -86,90 +102,6 @@ def _proxy(self) -> "DeliveryReceiptContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this participant. - """ - return self._properties["account_sid"] - - @property - def chat_service_sid(self) -> str: - """ - :returns: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Message resource is associated with. - """ - return self._properties["chat_service_sid"] - - @property - def conversation_sid(self) -> str: - """ - :returns: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this message. - """ - return self._properties["conversation_sid"] - - @property - def message_sid(self) -> str: - """ - :returns: The SID of the message within a [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) the delivery receipt belongs to - """ - return self._properties["message_sid"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def channel_message_sid(self) -> str: - """ - :returns: A messaging channel-specific identifier for the message delivered to participant e.g. `SMxx` for SMS, `WAxx` for Whatsapp etc. - """ - return self._properties["channel_message_sid"] - - @property - def participant_sid(self) -> str: - """ - :returns: The unique ID of the participant the delivery receipt belongs to. - """ - return self._properties["participant_sid"] - - @property - def status(self) -> "DeliveryReceiptInstance.DeliveryStatus": - """ - :returns: - """ - return self._properties["status"] - - @property - def error_code(self) -> int: - """ - :returns: The message [delivery error code](https://www.twilio.com/docs/sms/api/message-resource#delivery-related-errors) for a `failed` status, - """ - return self._properties["error_code"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated. `null` if the delivery receipt has not been updated. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: An absolute API resource URL for this delivery receipt. - """ - return self._properties["url"] - def fetch(self) -> "DeliveryReceiptInstance": """ Fetch the DeliveryReceiptInstance diff --git a/twilio/rest/conversations/v1/service/conversation/participant.py b/twilio/rest/conversations/v1/service/conversation/participant.py index 7e22c4801..91bb99bec 100644 --- a/twilio/rest/conversations/v1/service/conversation/participant.py +++ b/twilio/rest/conversations/v1/service/conversation/participant.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,41 +28,58 @@ class WebhookEnabledType(object): TRUE = "true" FALSE = "false" + """ + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this participant. + :ivar chat_service_sid: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Participant resource is associated with. + :ivar conversation_sid: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this participant. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar identity: A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversation SDK to communicate. Limited to 256 characters. + :ivar attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + :ivar messaging_binding: Information about how this participant exchanges messages with the conversation. A JSON parameter consisting of type and address fields of the participant. + :ivar role_sid: The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. + :ivar date_created: The date that this resource was created. + :ivar date_updated: The date that this resource was last updated. + :ivar url: An absolute API resource URL for this participant. + :ivar last_read_message_index: Index of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. + :ivar last_read_timestamp: Timestamp of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], chat_service_sid: str, conversation_sid: str, sid: Optional[str] = None, ): - """ - Initialize the ParticipantInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "chat_service_sid": payload.get("chat_service_sid"), - "conversation_sid": payload.get("conversation_sid"), - "sid": payload.get("sid"), - "identity": payload.get("identity"), - "attributes": payload.get("attributes"), - "messaging_binding": payload.get("messaging_binding"), - "role_sid": payload.get("role_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "last_read_message_index": deserialize.integer( - payload.get("last_read_message_index") - ), - "last_read_timestamp": payload.get("last_read_timestamp"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.conversation_sid: Optional[str] = payload.get("conversation_sid") + self.sid: Optional[str] = payload.get("sid") + self.identity: Optional[str] = payload.get("identity") + self.attributes: Optional[str] = payload.get("attributes") + self.messaging_binding: Optional[Dict[str, object]] = payload.get( + "messaging_binding" + ) + self.role_sid: Optional[str] = payload.get("role_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") + self.last_read_message_index: Optional[int] = deserialize.integer( + payload.get("last_read_message_index") + ) + self.last_read_timestamp: Optional[str] = payload.get("last_read_timestamp") self._solution = { "chat_service_sid": chat_service_sid, "conversation_sid": conversation_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ParticipantContext] = None @@ -83,97 +100,6 @@ def _proxy(self) -> "ParticipantContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this participant. - """ - return self._properties["account_sid"] - - @property - def chat_service_sid(self) -> str: - """ - :returns: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Participant resource is associated with. - """ - return self._properties["chat_service_sid"] - - @property - def conversation_sid(self) -> str: - """ - :returns: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this participant. - """ - return self._properties["conversation_sid"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def identity(self) -> str: - """ - :returns: A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversation SDK to communicate. Limited to 256 characters. - """ - return self._properties["identity"] - - @property - def attributes(self) -> str: - """ - :returns: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. - """ - return self._properties["attributes"] - - @property - def messaging_binding(self) -> Dict[str, object]: - """ - :returns: Information about how this participant exchanges messages with the conversation. A JSON parameter consisting of type and address fields of the participant. - """ - return self._properties["messaging_binding"] - - @property - def role_sid(self) -> str: - """ - :returns: The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant. - """ - return self._properties["role_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: An absolute API resource URL for this participant. - """ - return self._properties["url"] - - @property - def last_read_message_index(self) -> int: - """ - :returns: Index of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. - """ - return self._properties["last_read_message_index"] - - @property - def last_read_timestamp(self) -> str: - """ - :returns: Timestamp of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant. - """ - return self._properties["last_read_timestamp"] - def delete(self, x_twilio_webhook_enabled=values.unset) -> bool: """ Deletes the ParticipantInstance diff --git a/twilio/rest/conversations/v1/service/conversation/webhook.py b/twilio/rest/conversations/v1/service/conversation/webhook.py index 55d7d42e5..be9091dc7 100644 --- a/twilio/rest/conversations/v1/service/conversation/webhook.py +++ b/twilio/rest/conversations/v1/service/conversation/webhook.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,35 +24,47 @@ class WebhookInstance(InstanceResource): + + """ + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + :ivar chat_service_sid: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Participant resource is associated with. + :ivar conversation_sid: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this webhook. + :ivar target: The target of this webhook: `webhook`, `studio`, `trigger` + :ivar url: An absolute API resource URL for this webhook. + :ivar configuration: The configuration of this webhook. Is defined based on target. + :ivar date_created: The date that this resource was created. + :ivar date_updated: The date that this resource was last updated. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], chat_service_sid: str, conversation_sid: str, sid: Optional[str] = None, ): - """ - Initialize the WebhookInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "chat_service_sid": payload.get("chat_service_sid"), - "conversation_sid": payload.get("conversation_sid"), - "target": payload.get("target"), - "url": payload.get("url"), - "configuration": payload.get("configuration"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.conversation_sid: Optional[str] = payload.get("conversation_sid") + self.target: Optional[str] = payload.get("target") + self.url: Optional[str] = payload.get("url") + self.configuration: Optional[Dict[str, object]] = payload.get("configuration") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) self._solution = { "chat_service_sid": chat_service_sid, "conversation_sid": conversation_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[WebhookContext] = None @@ -73,69 +85,6 @@ def _proxy(self) -> "WebhookContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. - """ - return self._properties["account_sid"] - - @property - def chat_service_sid(self) -> str: - """ - :returns: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Participant resource is associated with. - """ - return self._properties["chat_service_sid"] - - @property - def conversation_sid(self) -> str: - """ - :returns: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this webhook. - """ - return self._properties["conversation_sid"] - - @property - def target(self) -> str: - """ - :returns: The target of this webhook: `webhook`, `studio`, `trigger` - """ - return self._properties["target"] - - @property - def url(self) -> str: - """ - :returns: An absolute API resource URL for this webhook. - """ - return self._properties["url"] - - @property - def configuration(self) -> Dict[str, object]: - """ - :returns: The configuration of this webhook. Is defined based on target. - """ - return self._properties["configuration"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated. - """ - return self._properties["date_updated"] - def delete(self) -> bool: """ Deletes the WebhookInstance diff --git a/twilio/rest/conversations/v1/service/participant_conversation.py b/twilio/rest/conversations/v1/service/participant_conversation.py index 92f9ae5ef..f888c5e1e 100644 --- a/twilio/rest/conversations/v1/service/participant_conversation.py +++ b/twilio/rest/conversations/v1/service/participant_conversation.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -29,153 +29,69 @@ class State(object): ACTIVE = "active" CLOSED = "closed" - def __init__(self, version, payload, chat_service_sid: str): - """ - Initialize the ParticipantConversationInstance - """ + """ + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + :ivar chat_service_sid: The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. + :ivar participant_sid: The unique ID of the [Participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). + :ivar participant_user_sid: The unique string that identifies the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). + :ivar participant_identity: A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. + :ivar participant_messaging_binding: Information about how this participant exchanges messages with the conversation. A JSON parameter consisting of type and address fields of the participant. + :ivar conversation_sid: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) this Participant belongs to. + :ivar conversation_unique_name: An application-defined string that uniquely identifies the Conversation resource. + :ivar conversation_friendly_name: The human-readable name of this conversation, limited to 256 characters. Optional. + :ivar conversation_attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + :ivar conversation_date_created: The date that this conversation was created, given in ISO 8601 format. + :ivar conversation_date_updated: The date that this conversation was last updated, given in ISO 8601 format. + :ivar conversation_created_by: Identity of the creator of this Conversation. + :ivar conversation_state: + :ivar conversation_timers: Timer date values representing state update for this conversation. + :ivar links: Contains absolute URLs to access the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) and [conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) of this conversation. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], chat_service_sid: str + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "chat_service_sid": payload.get("chat_service_sid"), - "participant_sid": payload.get("participant_sid"), - "participant_user_sid": payload.get("participant_user_sid"), - "participant_identity": payload.get("participant_identity"), - "participant_messaging_binding": payload.get( - "participant_messaging_binding" - ), - "conversation_sid": payload.get("conversation_sid"), - "conversation_unique_name": payload.get("conversation_unique_name"), - "conversation_friendly_name": payload.get("conversation_friendly_name"), - "conversation_attributes": payload.get("conversation_attributes"), - "conversation_date_created": deserialize.iso8601_datetime( - payload.get("conversation_date_created") - ), - "conversation_date_updated": deserialize.iso8601_datetime( - payload.get("conversation_date_updated") - ), - "conversation_created_by": payload.get("conversation_created_by"), - "conversation_state": payload.get("conversation_state"), - "conversation_timers": payload.get("conversation_timers"), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.participant_sid: Optional[str] = payload.get("participant_sid") + self.participant_user_sid: Optional[str] = payload.get("participant_user_sid") + self.participant_identity: Optional[str] = payload.get("participant_identity") + self.participant_messaging_binding: Optional[Dict[str, object]] = payload.get( + "participant_messaging_binding" + ) + self.conversation_sid: Optional[str] = payload.get("conversation_sid") + self.conversation_unique_name: Optional[str] = payload.get( + "conversation_unique_name" + ) + self.conversation_friendly_name: Optional[str] = payload.get( + "conversation_friendly_name" + ) + self.conversation_attributes: Optional[str] = payload.get( + "conversation_attributes" + ) + self.conversation_date_created: Optional[ + datetime + ] = deserialize.iso8601_datetime(payload.get("conversation_date_created")) + self.conversation_date_updated: Optional[ + datetime + ] = deserialize.iso8601_datetime(payload.get("conversation_date_updated")) + self.conversation_created_by: Optional[str] = payload.get( + "conversation_created_by" + ) + self.conversation_state: Optional[ + "ParticipantConversationInstance.State" + ] = payload.get("conversation_state") + self.conversation_timers: Optional[Dict[str, object]] = payload.get( + "conversation_timers" + ) + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "chat_service_sid": chat_service_sid, } - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. - """ - return self._properties["account_sid"] - - @property - def chat_service_sid(self) -> str: - """ - :returns: The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. - """ - return self._properties["chat_service_sid"] - - @property - def participant_sid(self) -> str: - """ - :returns: The unique ID of the [Participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource). - """ - return self._properties["participant_sid"] - - @property - def participant_user_sid(self) -> str: - """ - :returns: The unique string that identifies the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). - """ - return self._properties["participant_user_sid"] - - @property - def participant_identity(self) -> str: - """ - :returns: A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters. - """ - return self._properties["participant_identity"] - - @property - def participant_messaging_binding(self) -> Dict[str, object]: - """ - :returns: Information about how this participant exchanges messages with the conversation. A JSON parameter consisting of type and address fields of the participant. - """ - return self._properties["participant_messaging_binding"] - - @property - def conversation_sid(self) -> str: - """ - :returns: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) this Participant belongs to. - """ - return self._properties["conversation_sid"] - - @property - def conversation_unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the Conversation resource. - """ - return self._properties["conversation_unique_name"] - - @property - def conversation_friendly_name(self) -> str: - """ - :returns: The human-readable name of this conversation, limited to 256 characters. Optional. - """ - return self._properties["conversation_friendly_name"] - - @property - def conversation_attributes(self) -> str: - """ - :returns: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. - """ - return self._properties["conversation_attributes"] - - @property - def conversation_date_created(self) -> datetime: - """ - :returns: The date that this conversation was created, given in ISO 8601 format. - """ - return self._properties["conversation_date_created"] - - @property - def conversation_date_updated(self) -> datetime: - """ - :returns: The date that this conversation was last updated, given in ISO 8601 format. - """ - return self._properties["conversation_date_updated"] - - @property - def conversation_created_by(self) -> str: - """ - :returns: Identity of the creator of this Conversation. - """ - return self._properties["conversation_created_by"] - - @property - def conversation_state(self) -> "ParticipantConversationInstance.State": - """ - :returns: - """ - return self._properties["conversation_state"] - - @property - def conversation_timers(self) -> Dict[str, object]: - """ - :returns: Timer date values representing state update for this conversation. - """ - return self._properties["conversation_timers"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: Contains absolute URLs to access the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) and [conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) of this conversation. - """ - return self._properties["links"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/conversations/v1/service/role.py b/twilio/rest/conversations/v1/service/role.py index 40107a651..321e8d45b 100644 --- a/twilio/rest/conversations/v1/service/role.py +++ b/twilio/rest/conversations/v1/service/role.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,29 +28,44 @@ class RoleType(object): CONVERSATION = "conversation" SERVICE = "service" + """ + :ivar sid: The unique string that we created to identify the Role resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Role resource. + :ivar chat_service_sid: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Role resource is associated with. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar type: + :ivar permissions: An array of the permissions the role has been granted. + :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: An absolute API resource URL for this user role. + """ + def __init__( - self, version, payload, chat_service_sid: str, sid: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + chat_service_sid: str, + sid: Optional[str] = None, ): - """ - Initialize the RoleInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "chat_service_sid": payload.get("chat_service_sid"), - "friendly_name": payload.get("friendly_name"), - "type": payload.get("type"), - "permissions": payload.get("permissions"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.type: Optional["RoleInstance.RoleType"] = payload.get("type") + self.permissions: Optional[List[str]] = payload.get("permissions") + 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 = { "chat_service_sid": chat_service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[RoleContext] = None @@ -70,69 +85,6 @@ def _proxy(self) -> "RoleContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Role resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Role resource. - """ - return self._properties["account_sid"] - - @property - def chat_service_sid(self) -> str: - """ - :returns: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Role resource is associated with. - """ - return self._properties["chat_service_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def type(self) -> "RoleInstance.RoleType": - """ - :returns: - """ - return self._properties["type"] - - @property - def permissions(self) -> List[str]: - """ - :returns: An array of the permissions the role has been granted. - """ - return self._properties["permissions"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: An absolute API resource URL for this user role. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the RoleInstance diff --git a/twilio/rest/conversations/v1/service/user/__init__.py b/twilio/rest/conversations/v1/service/user/__init__.py index 354e73001..a96fce3a3 100644 --- a/twilio/rest/conversations/v1/service/user/__init__.py +++ b/twilio/rest/conversations/v1/service/user/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -31,33 +31,52 @@ class WebhookEnabledType(object): TRUE = "true" FALSE = "false" + """ + :ivar sid: The unique string that we created to identify the User resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User resource. + :ivar chat_service_sid: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the User resource is associated with. + :ivar role_sid: The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) assigned to the user. + :ivar identity: The application-defined string that uniquely identifies the resource's User within the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource). This value is often a username or an email address, and is case-sensitive. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar attributes: The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. + :ivar is_online: Whether the User is actively connected to this Conversations Service and online. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, if the User has never been online for this Conversations Service, even if the Service's `reachability_enabled` is `true`. + :ivar is_notifiable: Whether the User has a potentially valid Push Notification registration (APN or GCM) for this Conversations Service. If at least one registration exists, `true`; otherwise `false`. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, and if the User has never had a notification registration, even if the Service's `reachability_enabled` is `true`. + :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: An absolute API resource URL for this user. + :ivar links: + """ + def __init__( - self, version, payload, chat_service_sid: str, sid: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + chat_service_sid: str, + sid: Optional[str] = None, ): - """ - Initialize the UserInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "chat_service_sid": payload.get("chat_service_sid"), - "role_sid": payload.get("role_sid"), - "identity": payload.get("identity"), - "friendly_name": payload.get("friendly_name"), - "attributes": payload.get("attributes"), - "is_online": payload.get("is_online"), - "is_notifiable": payload.get("is_notifiable"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.role_sid: Optional[str] = payload.get("role_sid") + self.identity: Optional[str] = payload.get("identity") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.attributes: Optional[str] = payload.get("attributes") + self.is_online: Optional[bool] = payload.get("is_online") + self.is_notifiable: Optional[bool] = payload.get("is_notifiable") + 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 = { "chat_service_sid": chat_service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[UserContext] = None @@ -77,97 +96,6 @@ def _proxy(self) -> "UserContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the User resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User resource. - """ - return self._properties["account_sid"] - - @property - def chat_service_sid(self) -> str: - """ - :returns: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the User resource is associated with. - """ - return self._properties["chat_service_sid"] - - @property - def role_sid(self) -> str: - """ - :returns: The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) assigned to the user. - """ - return self._properties["role_sid"] - - @property - def identity(self) -> str: - """ - :returns: The application-defined string that uniquely identifies the resource's User within the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource). This value is often a username or an email address, and is case-sensitive. - """ - return self._properties["identity"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def attributes(self) -> str: - """ - :returns: The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. - """ - return self._properties["attributes"] - - @property - def is_online(self) -> bool: - """ - :returns: Whether the User is actively connected to this Conversations Service and online. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, if the User has never been online for this Conversations Service, even if the Service's `reachability_enabled` is `true`. - """ - return self._properties["is_online"] - - @property - def is_notifiable(self) -> bool: - """ - :returns: Whether the User has a potentially valid Push Notification registration (APN or GCM) for this Conversations Service. If at least one registration exists, `true`; otherwise `false`. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, and if the User has never had a notification registration, even if the Service's `reachability_enabled` is `true`. - """ - return self._properties["is_notifiable"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: An absolute API resource URL for this user. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - def delete(self, x_twilio_webhook_enabled=values.unset) -> bool: """ Deletes the UserInstance diff --git a/twilio/rest/conversations/v1/service/user/user_conversation.py b/twilio/rest/conversations/v1/service/user/user_conversation.py index 9604803e0..2639f4b45 100644 --- a/twilio/rest/conversations/v1/service/user/user_conversation.py +++ b/twilio/rest/conversations/v1/service/user/user_conversation.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -33,49 +33,72 @@ class State(object): ACTIVE = "active" CLOSED = "closed" + """ + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + :ivar chat_service_sid: The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. + :ivar conversation_sid: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this User Conversation. + :ivar unread_messages_count: The number of unread Messages in the Conversation for the Participant. + :ivar last_read_message_index: The index of the last Message in the Conversation that the Participant has read. + :ivar participant_sid: The unique ID of the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) the user conversation belongs to. + :ivar user_sid: The unique string that identifies the [User resource](https://www.twilio.com/docs/conversations/api/user-resource). + :ivar friendly_name: The human-readable name of this conversation, limited to 256 characters. Optional. + :ivar conversation_state: + :ivar timers: Timer date values representing state update for this conversation. + :ivar attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + :ivar date_created: The date that this conversation was created, given in ISO 8601 format. + :ivar date_updated: The date that this conversation was last updated, given in ISO 8601 format. + :ivar created_by: Identity of the creator of this Conversation. + :ivar notification_level: + :ivar unique_name: An application-defined string that uniquely identifies the Conversation resource. It can be used to address the resource in place of the resource's `conversation_sid` in the URL. + :ivar url: + :ivar links: Contains absolute URLs to access the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) and [conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) of this conversation. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], chat_service_sid: str, user_sid: str, conversation_sid: Optional[str] = None, ): - """ - Initialize the UserConversationInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "chat_service_sid": payload.get("chat_service_sid"), - "conversation_sid": payload.get("conversation_sid"), - "unread_messages_count": deserialize.integer( - payload.get("unread_messages_count") - ), - "last_read_message_index": deserialize.integer( - payload.get("last_read_message_index") - ), - "participant_sid": payload.get("participant_sid"), - "user_sid": payload.get("user_sid"), - "friendly_name": payload.get("friendly_name"), - "conversation_state": payload.get("conversation_state"), - "timers": payload.get("timers"), - "attributes": payload.get("attributes"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "created_by": payload.get("created_by"), - "notification_level": payload.get("notification_level"), - "unique_name": payload.get("unique_name"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.conversation_sid: Optional[str] = payload.get("conversation_sid") + self.unread_messages_count: Optional[int] = deserialize.integer( + payload.get("unread_messages_count") + ) + self.last_read_message_index: Optional[int] = deserialize.integer( + payload.get("last_read_message_index") + ) + self.participant_sid: Optional[str] = payload.get("participant_sid") + self.user_sid: Optional[str] = payload.get("user_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.conversation_state: Optional[ + "UserConversationInstance.State" + ] = payload.get("conversation_state") + self.timers: Optional[Dict[str, object]] = payload.get("timers") + self.attributes: Optional[str] = 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.created_by: Optional[str] = payload.get("created_by") + self.notification_level: Optional[ + "UserConversationInstance.NotificationLevel" + ] = payload.get("notification_level") + self.unique_name: Optional[str] = payload.get("unique_name") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "chat_service_sid": chat_service_sid, "user_sid": user_sid, - "conversation_sid": conversation_sid - or self._properties["conversation_sid"], + "conversation_sid": conversation_sid or self.conversation_sid, } self._context: Optional[UserConversationContext] = None @@ -96,132 +119,6 @@ def _proxy(self) -> "UserConversationContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. - """ - return self._properties["account_sid"] - - @property - def chat_service_sid(self) -> str: - """ - :returns: The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. - """ - return self._properties["chat_service_sid"] - - @property - def conversation_sid(self) -> str: - """ - :returns: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this User Conversation. - """ - return self._properties["conversation_sid"] - - @property - def unread_messages_count(self) -> int: - """ - :returns: The number of unread Messages in the Conversation for the Participant. - """ - return self._properties["unread_messages_count"] - - @property - def last_read_message_index(self) -> int: - """ - :returns: The index of the last Message in the Conversation that the Participant has read. - """ - return self._properties["last_read_message_index"] - - @property - def participant_sid(self) -> str: - """ - :returns: The unique ID of the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) the user conversation belongs to. - """ - return self._properties["participant_sid"] - - @property - def user_sid(self) -> str: - """ - :returns: The unique string that identifies the [User resource](https://www.twilio.com/docs/conversations/api/user-resource). - """ - return self._properties["user_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The human-readable name of this conversation, limited to 256 characters. Optional. - """ - return self._properties["friendly_name"] - - @property - def conversation_state(self) -> "UserConversationInstance.State": - """ - :returns: - """ - return self._properties["conversation_state"] - - @property - def timers(self) -> Dict[str, object]: - """ - :returns: Timer date values representing state update for this conversation. - """ - return self._properties["timers"] - - @property - def attributes(self) -> str: - """ - :returns: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. - """ - return self._properties["attributes"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this conversation was created, given in ISO 8601 format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this conversation was last updated, given in ISO 8601 format. - """ - return self._properties["date_updated"] - - @property - def created_by(self) -> str: - """ - :returns: Identity of the creator of this Conversation. - """ - return self._properties["created_by"] - - @property - def notification_level(self) -> "UserConversationInstance.NotificationLevel": - """ - :returns: - """ - return self._properties["notification_level"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the Conversation resource. It can be used to address the resource in place of the resource's `conversation_sid` in the URL. - """ - return self._properties["unique_name"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: Contains absolute URLs to access the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) and [conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) of this conversation. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the UserConversationInstance diff --git a/twilio/rest/conversations/v1/user/__init__.py b/twilio/rest/conversations/v1/user/__init__.py index be2e0204c..8140e9905 100644 --- a/twilio/rest/conversations/v1/user/__init__.py +++ b/twilio/rest/conversations/v1/user/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -29,30 +29,47 @@ class WebhookEnabledType(object): TRUE = "true" FALSE = "false" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the UserInstance - """ + """ + :ivar sid: The unique string that we created to identify the User resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User resource. + :ivar chat_service_sid: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the User resource is associated with. + :ivar role_sid: The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) assigned to the user. + :ivar identity: The application-defined string that uniquely identifies the resource's User within the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource). This value is often a username or an email address, and is case-sensitive. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar attributes: The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. + :ivar is_online: Whether the User is actively connected to this Conversations Service and online. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, if the User has never been online for this Conversations Service, even if the Service's `reachability_enabled` is `true`. + :ivar is_notifiable: Whether the User has a potentially valid Push Notification registration (APN or GCM) for this Conversations Service. If at least one registration exists, `true`; otherwise `false`. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, and if the User has never had a notification registration, even if the Service's `reachability_enabled` is `true`. + :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: An absolute API resource URL for this user. + :ivar links: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "chat_service_sid": payload.get("chat_service_sid"), - "role_sid": payload.get("role_sid"), - "identity": payload.get("identity"), - "friendly_name": payload.get("friendly_name"), - "attributes": payload.get("attributes"), - "is_online": payload.get("is_online"), - "is_notifiable": payload.get("is_notifiable"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.role_sid: Optional[str] = payload.get("role_sid") + self.identity: Optional[str] = payload.get("identity") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.attributes: Optional[str] = payload.get("attributes") + self.is_online: Optional[bool] = payload.get("is_online") + self.is_notifiable: Optional[bool] = payload.get("is_notifiable") + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[UserContext] = None @@ -71,97 +88,6 @@ def _proxy(self) -> "UserContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the User resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the User resource. - """ - return self._properties["account_sid"] - - @property - def chat_service_sid(self) -> str: - """ - :returns: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the User resource is associated with. - """ - return self._properties["chat_service_sid"] - - @property - def role_sid(self) -> str: - """ - :returns: The SID of a service-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) assigned to the user. - """ - return self._properties["role_sid"] - - @property - def identity(self) -> str: - """ - :returns: The application-defined string that uniquely identifies the resource's User within the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource). This value is often a username or an email address, and is case-sensitive. - """ - return self._properties["identity"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def attributes(self) -> str: - """ - :returns: The JSON Object string that stores application-specific data. If attributes have not been set, `{}` is returned. - """ - return self._properties["attributes"] - - @property - def is_online(self) -> bool: - """ - :returns: Whether the User is actively connected to this Conversations Service and online. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, if the User has never been online for this Conversations Service, even if the Service's `reachability_enabled` is `true`. - """ - return self._properties["is_online"] - - @property - def is_notifiable(self) -> bool: - """ - :returns: Whether the User has a potentially valid Push Notification registration (APN or GCM) for this Conversations Service. If at least one registration exists, `true`; otherwise `false`. This value is only returned by Fetch actions that return a single resource and `null` is always returned by a Read action. This value is `null` if the Service's `reachability_enabled` is `false`, and if the User has never had a notification registration, even if the Service's `reachability_enabled` is `true`. - """ - return self._properties["is_notifiable"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: An absolute API resource URL for this user. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - def delete(self, x_twilio_webhook_enabled=values.unset) -> bool: """ Deletes the UserInstance diff --git a/twilio/rest/conversations/v1/user/user_conversation.py b/twilio/rest/conversations/v1/user/user_conversation.py index 1ebf76218..63b910939 100644 --- a/twilio/rest/conversations/v1/user/user_conversation.py +++ b/twilio/rest/conversations/v1/user/user_conversation.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -33,43 +33,70 @@ class State(object): ACTIVE = "active" CLOSED = "closed" + """ + :ivar account_sid: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. + :ivar chat_service_sid: The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. + :ivar conversation_sid: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this User Conversation. + :ivar unread_messages_count: The number of unread Messages in the Conversation for the Participant. + :ivar last_read_message_index: The index of the last Message in the Conversation that the Participant has read. + :ivar participant_sid: The unique ID of the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) the user conversation belongs to. + :ivar user_sid: The unique string that identifies the [User resource](https://www.twilio.com/docs/conversations/api/user-resource). + :ivar friendly_name: The human-readable name of this conversation, limited to 256 characters. Optional. + :ivar conversation_state: + :ivar timers: Timer date values representing state update for this conversation. + :ivar attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. + :ivar date_created: The date that this conversation was created, given in ISO 8601 format. + :ivar date_updated: The date that this conversation was last updated, given in ISO 8601 format. + :ivar created_by: Identity of the creator of this Conversation. + :ivar notification_level: + :ivar unique_name: An application-defined string that uniquely identifies the Conversation resource. It can be used to address the resource in place of the resource's `conversation_sid` in the URL. + :ivar url: + :ivar links: Contains absolute URLs to access the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) and [conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) of this conversation. + """ + def __init__( - self, version, payload, user_sid: str, conversation_sid: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + user_sid: str, + conversation_sid: Optional[str] = None, ): - """ - Initialize the UserConversationInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "chat_service_sid": payload.get("chat_service_sid"), - "conversation_sid": payload.get("conversation_sid"), - "unread_messages_count": deserialize.integer( - payload.get("unread_messages_count") - ), - "last_read_message_index": deserialize.integer( - payload.get("last_read_message_index") - ), - "participant_sid": payload.get("participant_sid"), - "user_sid": payload.get("user_sid"), - "friendly_name": payload.get("friendly_name"), - "conversation_state": payload.get("conversation_state"), - "timers": payload.get("timers"), - "attributes": payload.get("attributes"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "created_by": payload.get("created_by"), - "notification_level": payload.get("notification_level"), - "unique_name": payload.get("unique_name"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.conversation_sid: Optional[str] = payload.get("conversation_sid") + self.unread_messages_count: Optional[int] = deserialize.integer( + payload.get("unread_messages_count") + ) + self.last_read_message_index: Optional[int] = deserialize.integer( + payload.get("last_read_message_index") + ) + self.participant_sid: Optional[str] = payload.get("participant_sid") + self.user_sid: Optional[str] = payload.get("user_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.conversation_state: Optional[ + "UserConversationInstance.State" + ] = payload.get("conversation_state") + self.timers: Optional[Dict[str, object]] = payload.get("timers") + self.attributes: Optional[str] = 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.created_by: Optional[str] = payload.get("created_by") + self.notification_level: Optional[ + "UserConversationInstance.NotificationLevel" + ] = payload.get("notification_level") + self.unique_name: Optional[str] = payload.get("unique_name") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "user_sid": user_sid, - "conversation_sid": conversation_sid - or self._properties["conversation_sid"], + "conversation_sid": conversation_sid or self.conversation_sid, } self._context: Optional[UserConversationContext] = None @@ -89,132 +116,6 @@ def _proxy(self) -> "UserConversationContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the [Account](https://www.twilio.com/docs/iam/api/account) responsible for this conversation. - """ - return self._properties["account_sid"] - - @property - def chat_service_sid(self) -> str: - """ - :returns: The unique ID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to. - """ - return self._properties["chat_service_sid"] - - @property - def conversation_sid(self) -> str: - """ - :returns: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this User Conversation. - """ - return self._properties["conversation_sid"] - - @property - def unread_messages_count(self) -> int: - """ - :returns: The number of unread Messages in the Conversation for the Participant. - """ - return self._properties["unread_messages_count"] - - @property - def last_read_message_index(self) -> int: - """ - :returns: The index of the last Message in the Conversation that the Participant has read. - """ - return self._properties["last_read_message_index"] - - @property - def participant_sid(self) -> str: - """ - :returns: The unique ID of the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) the user conversation belongs to. - """ - return self._properties["participant_sid"] - - @property - def user_sid(self) -> str: - """ - :returns: The unique string that identifies the [User resource](https://www.twilio.com/docs/conversations/api/user-resource). - """ - return self._properties["user_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The human-readable name of this conversation, limited to 256 characters. Optional. - """ - return self._properties["friendly_name"] - - @property - def conversation_state(self) -> "UserConversationInstance.State": - """ - :returns: - """ - return self._properties["conversation_state"] - - @property - def timers(self) -> Dict[str, object]: - """ - :returns: Timer date values representing state update for this conversation. - """ - return self._properties["timers"] - - @property - def attributes(self) -> str: - """ - :returns: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set \"{}\" will be returned. - """ - return self._properties["attributes"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this conversation was created, given in ISO 8601 format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this conversation was last updated, given in ISO 8601 format. - """ - return self._properties["date_updated"] - - @property - def created_by(self) -> str: - """ - :returns: Identity of the creator of this Conversation. - """ - return self._properties["created_by"] - - @property - def notification_level(self) -> "UserConversationInstance.NotificationLevel": - """ - :returns: - """ - return self._properties["notification_level"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the Conversation resource. It can be used to address the resource in place of the resource's `conversation_sid` in the URL. - """ - return self._properties["unique_name"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: Contains absolute URLs to access the [participant](https://www.twilio.com/docs/conversations/api/conversation-participant-resource) and [conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) of this conversation. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the UserConversationInstance diff --git a/twilio/rest/events/v1/event_type.py b/twilio/rest/events/v1/event_type.py index 1b38ac4df..677065bdc 100644 --- a/twilio/rest/events/v1/event_type.py +++ b/twilio/rest/events/v1/event_type.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,24 +24,36 @@ class EventTypeInstance(InstanceResource): - def __init__(self, version, payload, type: Optional[str] = None): - """ - Initialize the EventTypeInstance - """ + + """ + :ivar type: A string that uniquely identifies this Event Type. + :ivar schema_id: A string that uniquely identifies the Schema this Event Type adheres to. + :ivar date_created: The date that this Event Type was created, given in ISO 8601 format. + :ivar date_updated: The date that this Event Type was updated, given in ISO 8601 format. + :ivar description: A human readable description for this Event Type. + :ivar url: The URL of this resource. + :ivar links: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], type: Optional[str] = None + ): super().__init__(version) - self._properties = { - "type": payload.get("type"), - "schema_id": payload.get("schema_id"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "description": payload.get("description"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.type: Optional[str] = payload.get("type") + self.schema_id: Optional[str] = payload.get("schema_id") + 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.description: Optional[str] = payload.get("description") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "type": type or self._properties["type"], + "type": type or self.type, } self._context: Optional[EventTypeContext] = None @@ -60,55 +72,6 @@ def _proxy(self) -> "EventTypeContext": ) return self._context - @property - def type(self) -> str: - """ - :returns: A string that uniquely identifies this Event Type. - """ - return self._properties["type"] - - @property - def schema_id(self) -> str: - """ - :returns: A string that uniquely identifies the Schema this Event Type adheres to. - """ - return self._properties["schema_id"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this Event Type was created, given in ISO 8601 format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this Event Type was updated, given in ISO 8601 format. - """ - return self._properties["date_updated"] - - @property - def description(self) -> str: - """ - :returns: A human readable description for this Event Type. - """ - return self._properties["description"] - - @property - def url(self) -> str: - """ - :returns: The URL of this resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - def fetch(self) -> "EventTypeInstance": """ Fetch the EventTypeInstance diff --git a/twilio/rest/events/v1/schema/__init__.py b/twilio/rest/events/v1/schema/__init__.py index 5dba01559..2b23af2c2 100644 --- a/twilio/rest/events/v1/schema/__init__.py +++ b/twilio/rest/events/v1/schema/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base import deserialize from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -25,24 +25,32 @@ class SchemaInstance(InstanceResource): - def __init__(self, version, payload, id: Optional[str] = None): - """ - Initialize the SchemaInstance - """ + + """ + :ivar id: The unique identifier of the schema. Each schema can have multiple versions, that share the same id. + :ivar url: The URL of this resource. + :ivar links: Contains a dictionary of URL links to nested resources of this schema. + :ivar latest_version_date_created: The date that the latest schema version was created, given in ISO 8601 format. + :ivar latest_version: The latest version published of this schema. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], id: Optional[str] = None + ): super().__init__(version) - self._properties = { - "id": payload.get("id"), - "url": payload.get("url"), - "links": payload.get("links"), - "latest_version_date_created": deserialize.iso8601_datetime( - payload.get("latest_version_date_created") - ), - "latest_version": deserialize.integer(payload.get("latest_version")), - } + self.id: Optional[str] = payload.get("id") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.latest_version_date_created: Optional[ + datetime + ] = deserialize.iso8601_datetime(payload.get("latest_version_date_created")) + self.latest_version: Optional[int] = deserialize.integer( + payload.get("latest_version") + ) self._solution = { - "id": id or self._properties["id"], + "id": id or self.id, } self._context: Optional[SchemaContext] = None @@ -61,41 +69,6 @@ def _proxy(self) -> "SchemaContext": ) return self._context - @property - def id(self) -> str: - """ - :returns: The unique identifier of the schema. Each schema can have multiple versions, that share the same id. - """ - return self._properties["id"] - - @property - def url(self) -> str: - """ - :returns: The URL of this resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: Contains a dictionary of URL links to nested resources of this schema. - """ - return self._properties["links"] - - @property - def latest_version_date_created(self) -> datetime: - """ - :returns: The date that the latest schema version was created, given in ISO 8601 format. - """ - return self._properties["latest_version_date_created"] - - @property - def latest_version(self) -> int: - """ - :returns: The latest version published of this schema. - """ - return self._properties["latest_version"] - def fetch(self) -> "SchemaInstance": """ Fetch the SchemaInstance diff --git a/twilio/rest/events/v1/schema/schema_version.py b/twilio/rest/events/v1/schema/schema_version.py index ad98d1953..a1113e56f 100644 --- a/twilio/rest/events/v1/schema/schema_version.py +++ b/twilio/rest/events/v1/schema/schema_version.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,23 +24,37 @@ class SchemaVersionInstance(InstanceResource): - def __init__(self, version, payload, id: str, schema_version: Optional[int] = None): - """ - Initialize the SchemaVersionInstance - """ + + """ + :ivar id: The unique identifier of the schema. Each schema can have multiple versions, that share the same id. + :ivar schema_version: The version of this schema. + :ivar date_created: The date the schema version was created, given in ISO 8601 format. + :ivar url: The URL of this resource. + :ivar raw: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + id: str, + schema_version: Optional[int] = None, + ): super().__init__(version) - self._properties = { - "id": payload.get("id"), - "schema_version": deserialize.integer(payload.get("schema_version")), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "url": payload.get("url"), - "raw": payload.get("raw"), - } + self.id: Optional[str] = payload.get("id") + self.schema_version: Optional[int] = deserialize.integer( + payload.get("schema_version") + ) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.url: Optional[str] = payload.get("url") + self.raw: Optional[str] = payload.get("raw") self._solution = { "id": id, - "schema_version": schema_version or self._properties["schema_version"], + "schema_version": schema_version or self.schema_version, } self._context: Optional[SchemaVersionContext] = None @@ -60,41 +74,6 @@ def _proxy(self) -> "SchemaVersionContext": ) return self._context - @property - def id(self) -> str: - """ - :returns: The unique identifier of the schema. Each schema can have multiple versions, that share the same id. - """ - return self._properties["id"] - - @property - def schema_version(self) -> int: - """ - :returns: The version of this schema. - """ - return self._properties["schema_version"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date the schema version was created, given in ISO 8601 format. - """ - return self._properties["date_created"] - - @property - def url(self) -> str: - """ - :returns: The URL of this resource. - """ - return self._properties["url"] - - @property - def raw(self) -> str: - """ - :returns: - """ - return self._properties["raw"] - def fetch(self) -> "SchemaVersionInstance": """ Fetch the SchemaVersionInstance diff --git a/twilio/rest/events/v1/sink/__init__.py b/twilio/rest/events/v1/sink/__init__.py index eb0150202..5307c333f 100644 --- a/twilio/rest/events/v1/sink/__init__.py +++ b/twilio/rest/events/v1/sink/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -37,26 +37,41 @@ class Status(object): ACTIVE = "active" FAILED = "failed" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the SinkInstance - """ + """ + :ivar date_created: The date that this Sink was created, given in ISO 8601 format. + :ivar date_updated: The date that this Sink was updated, given in ISO 8601 format. + :ivar description: A human readable description for the Sink + :ivar sid: A 34 character string that uniquely identifies this Sink. + :ivar sink_configuration: The information required for Twilio to connect to the provided Sink encoded as JSON. + :ivar sink_type: + :ivar status: + :ivar url: The URL of this resource. + :ivar links: Contains a dictionary of URL links to nested resources of this Sink. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "description": payload.get("description"), - "sid": payload.get("sid"), - "sink_configuration": payload.get("sink_configuration"), - "sink_type": payload.get("sink_type"), - "status": payload.get("status"), - "url": payload.get("url"), - "links": payload.get("links"), - } + 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.description: Optional[str] = payload.get("description") + self.sid: Optional[str] = payload.get("sid") + self.sink_configuration: Optional[Dict[str, object]] = payload.get( + "sink_configuration" + ) + self.sink_type: Optional["SinkInstance.SinkType"] = payload.get("sink_type") + self.status: Optional["SinkInstance.Status"] = payload.get("status") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[SinkContext] = None @@ -75,69 +90,6 @@ def _proxy(self) -> "SinkContext": ) return self._context - @property - def date_created(self) -> datetime: - """ - :returns: The date that this Sink was created, given in ISO 8601 format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this Sink was updated, given in ISO 8601 format. - """ - return self._properties["date_updated"] - - @property - def description(self) -> str: - """ - :returns: A human readable description for the Sink - """ - return self._properties["description"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this Sink. - """ - return self._properties["sid"] - - @property - def sink_configuration(self) -> Dict[str, object]: - """ - :returns: The information required for Twilio to connect to the provided Sink encoded as JSON. - """ - return self._properties["sink_configuration"] - - @property - def sink_type(self) -> "SinkInstance.SinkType": - """ - :returns: - """ - return self._properties["sink_type"] - - @property - def status(self) -> "SinkInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def url(self) -> str: - """ - :returns: The URL of this resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: Contains a dictionary of URL links to nested resources of this Sink. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the SinkInstance diff --git a/twilio/rest/events/v1/sink/sink_test.py b/twilio/rest/events/v1/sink/sink_test.py index 3b47ea9fb..c85c422e7 100644 --- a/twilio/rest/events/v1/sink/sink_test.py +++ b/twilio/rest/events/v1/sink/sink_test.py @@ -13,33 +13,28 @@ """ +from typing import Any, Dict, Optional + from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource from twilio.base.version import Version class SinkTestInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - """ - Initialize the SinkTestInstance - """ + + """ + :ivar result: Feedback indicating whether the test event was generated. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], sid: str): super().__init__(version) - self._properties = { - "result": payload.get("result"), - } + self.result: Optional[str] = payload.get("result") self._solution = { "sid": sid, } - @property - def result(self) -> str: - """ - :returns: Feedback indicating whether the test event was generated. - """ - return self._properties["result"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/events/v1/sink/sink_validate.py b/twilio/rest/events/v1/sink/sink_validate.py index 27258fcba..7e578a47b 100644 --- a/twilio/rest/events/v1/sink/sink_validate.py +++ b/twilio/rest/events/v1/sink/sink_validate.py @@ -13,6 +13,7 @@ """ +from typing import Any, Dict, Optional from twilio.base import values from twilio.base.instance_resource import InstanceResource @@ -21,27 +22,20 @@ class SinkValidateInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - """ - Initialize the SinkValidateInstance - """ + + """ + :ivar result: Feedback indicating whether the given Sink was validated. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], sid: str): super().__init__(version) - self._properties = { - "result": payload.get("result"), - } + self.result: Optional[str] = payload.get("result") self._solution = { "sid": sid, } - @property - def result(self) -> str: - """ - :returns: Feedback indicating whether the given Sink was validated. - """ - return self._properties["result"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/events/v1/subscription/__init__.py b/twilio/rest/events/v1/subscription/__init__.py index a81051c00..6d0a3005b 100644 --- a/twilio/rest/events/v1/subscription/__init__.py +++ b/twilio/rest/events/v1/subscription/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -25,25 +25,38 @@ class SubscriptionInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the SubscriptionInstance - """ + + """ + :ivar account_sid: The unique SID identifier of the Account. + :ivar sid: A 34 character string that uniquely identifies this Subscription. + :ivar date_created: The date that this Subscription was created, given in ISO 8601 format. + :ivar date_updated: The date that this Subscription was updated, given in ISO 8601 format. + :ivar description: A human readable description for the Subscription + :ivar sink_sid: The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. + :ivar url: The URL of this resource. + :ivar links: Contains a dictionary of URL links to nested resources of this Subscription. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "sid": payload.get("sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "description": payload.get("description"), - "sink_sid": payload.get("sink_sid"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.sid: Optional[str] = payload.get("sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.description: Optional[str] = payload.get("description") + self.sink_sid: Optional[str] = payload.get("sink_sid") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[SubscriptionContext] = None @@ -62,62 +75,6 @@ def _proxy(self) -> "SubscriptionContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique SID identifier of the Account. - """ - return self._properties["account_sid"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this Subscription. - """ - return self._properties["sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this Subscription was created, given in ISO 8601 format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this Subscription was updated, given in ISO 8601 format. - """ - return self._properties["date_updated"] - - @property - def description(self) -> str: - """ - :returns: A human readable description for the Subscription - """ - return self._properties["description"] - - @property - def sink_sid(self) -> str: - """ - :returns: The SID of the sink that events selected by this subscription should be sent to. Sink must be active for the subscription to be created. - """ - return self._properties["sink_sid"] - - @property - def url(self) -> str: - """ - :returns: The URL of this resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: Contains a dictionary of URL links to nested resources of this Subscription. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the SubscriptionInstance diff --git a/twilio/rest/events/v1/subscription/subscribed_event.py b/twilio/rest/events/v1/subscription/subscribed_event.py index 786619036..7203aa2fc 100644 --- a/twilio/rest/events/v1/subscription/subscribed_event.py +++ b/twilio/rest/events/v1/subscription/subscribed_event.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,25 +23,35 @@ class SubscribedEventInstance(InstanceResource): + + """ + :ivar account_sid: The unique SID identifier of the Account. + :ivar type: Type of event being subscribed to. + :ivar schema_version: The schema version that the subscription should use. + :ivar subscription_sid: The unique SID identifier of the Subscription. + :ivar url: The URL of this resource. + """ + def __init__( - self, version, payload, subscription_sid: str, type: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + subscription_sid: str, + type: Optional[str] = None, ): - """ - Initialize the SubscribedEventInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "type": payload.get("type"), - "schema_version": deserialize.integer(payload.get("schema_version")), - "subscription_sid": payload.get("subscription_sid"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.type: Optional[str] = payload.get("type") + self.schema_version: Optional[int] = deserialize.integer( + payload.get("schema_version") + ) + self.subscription_sid: Optional[str] = payload.get("subscription_sid") + self.url: Optional[str] = payload.get("url") self._solution = { "subscription_sid": subscription_sid, - "type": type or self._properties["type"], + "type": type or self.type, } self._context: Optional[SubscribedEventContext] = None @@ -61,41 +71,6 @@ def _proxy(self) -> "SubscribedEventContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique SID identifier of the Account. - """ - return self._properties["account_sid"] - - @property - def type(self) -> str: - """ - :returns: Type of event being subscribed to. - """ - return self._properties["type"] - - @property - def schema_version(self) -> int: - """ - :returns: The schema version that the subscription should use. - """ - return self._properties["schema_version"] - - @property - def subscription_sid(self) -> str: - """ - :returns: The unique SID identifier of the Subscription. - """ - return self._properties["subscription_sid"] - - @property - def url(self) -> str: - """ - :returns: The URL of this resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the SubscribedEventInstance diff --git a/twilio/rest/flex_api/v1/assessments.py b/twilio/rest/flex_api/v1/assessments.py index 415a44d2f..981209aa5 100644 --- a/twilio/rest/flex_api/v1/assessments.py +++ b/twilio/rest/flex_api/v1/assessments.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,31 +23,49 @@ class AssessmentsInstance(InstanceResource): - def __init__(self, version, payload, assessment_id: Optional[str] = None): - """ - Initialize the AssessmentsInstance - """ + + """ + :ivar account_sid: The unique SID identifier of the Account. + :ivar assessment_id: The unique id of the assessment + :ivar offset: Offset of the conversation + :ivar report: The flag indicating if this assessment is part of report + :ivar weight: The weightage given to this comment + :ivar agent_id: The id of the Agent + :ivar segment_id: Segment Id of conversation + :ivar user_name: The name of the user. + :ivar user_email: The email id of the user. + :ivar answer_text: The answer text selected by user + :ivar answer_id: The id of the answer selected by user + :ivar assessment: Assessment Details associated with an assessment + :ivar timestamp: + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assessment_id: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "assessment_id": payload.get("assessment_id"), - "offset": deserialize.decimal(payload.get("offset")), - "report": payload.get("report"), - "weight": deserialize.decimal(payload.get("weight")), - "agent_id": payload.get("agent_id"), - "segment_id": payload.get("segment_id"), - "user_name": payload.get("user_name"), - "user_email": payload.get("user_email"), - "answer_text": payload.get("answer_text"), - "answer_id": payload.get("answer_id"), - "assessment": payload.get("assessment"), - "timestamp": deserialize.decimal(payload.get("timestamp")), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.assessment_id: Optional[str] = payload.get("assessment_id") + self.offset: Optional[float] = deserialize.decimal(payload.get("offset")) + self.report: Optional[bool] = payload.get("report") + self.weight: Optional[float] = deserialize.decimal(payload.get("weight")) + self.agent_id: Optional[str] = payload.get("agent_id") + self.segment_id: Optional[str] = payload.get("segment_id") + self.user_name: Optional[str] = payload.get("user_name") + self.user_email: Optional[str] = payload.get("user_email") + self.answer_text: Optional[str] = payload.get("answer_text") + self.answer_id: Optional[str] = payload.get("answer_id") + self.assessment: Optional[Dict[str, object]] = payload.get("assessment") + self.timestamp: Optional[float] = deserialize.decimal(payload.get("timestamp")) + self.url: Optional[str] = payload.get("url") self._solution = { - "assessment_id": assessment_id or self._properties["assessment_id"], + "assessment_id": assessment_id or self.assessment_id, } self._context: Optional[AssessmentsContext] = None @@ -66,104 +84,6 @@ def _proxy(self) -> "AssessmentsContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique SID identifier of the Account. - """ - return self._properties["account_sid"] - - @property - def assessment_id(self) -> str: - """ - :returns: The unique id of the assessment - """ - return self._properties["assessment_id"] - - @property - def offset(self) -> float: - """ - :returns: Offset of the conversation - """ - return self._properties["offset"] - - @property - def report(self) -> bool: - """ - :returns: The flag indicating if this assessment is part of report - """ - return self._properties["report"] - - @property - def weight(self) -> float: - """ - :returns: The weightage given to this comment - """ - return self._properties["weight"] - - @property - def agent_id(self) -> str: - """ - :returns: The id of the Agent - """ - return self._properties["agent_id"] - - @property - def segment_id(self) -> str: - """ - :returns: Segment Id of conversation - """ - return self._properties["segment_id"] - - @property - def user_name(self) -> str: - """ - :returns: The name of the user. - """ - return self._properties["user_name"] - - @property - def user_email(self) -> str: - """ - :returns: The email id of the user. - """ - return self._properties["user_email"] - - @property - def answer_text(self) -> str: - """ - :returns: The answer text selected by user - """ - return self._properties["answer_text"] - - @property - def answer_id(self) -> str: - """ - :returns: The id of the answer selected by user - """ - return self._properties["answer_id"] - - @property - def assessment(self) -> Dict[str, object]: - """ - :returns: Assessment Details associated with an assessment - """ - return self._properties["assessment"] - - @property - def timestamp(self) -> float: - """ - :returns: - """ - return self._properties["timestamp"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def update( self, offset, answer_text, answer_id, token=values.unset ) -> "AssessmentsInstance": diff --git a/twilio/rest/flex_api/v1/channel.py b/twilio/rest/flex_api/v1/channel.py index d3cc8ced6..b8613d05c 100644 --- a/twilio/rest/flex_api/v1/channel.py +++ b/twilio/rest/flex_api/v1/channel.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,25 +24,38 @@ class ChannelInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the ChannelInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Channel resource and owns this Workflow. + :ivar flex_flow_sid: The SID of the Flex Flow. + :ivar sid: The unique string that we created to identify the Channel resource. + :ivar user_sid: The SID of the chat user. + :ivar task_sid: The SID of the TaskRouter Task. Only valid when integration type is `task`. `null` for integration types `studio` & `external` + :ivar url: The absolute URL of the Flex chat channel resource. + :ivar date_created: The date and time in GMT when the Flex chat channel 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 Flex chat channel was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "flex_flow_sid": payload.get("flex_flow_sid"), - "sid": payload.get("sid"), - "user_sid": payload.get("user_sid"), - "task_sid": payload.get("task_sid"), - "url": payload.get("url"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.flex_flow_sid: Optional[str] = payload.get("flex_flow_sid") + self.sid: Optional[str] = payload.get("sid") + self.user_sid: Optional[str] = payload.get("user_sid") + self.task_sid: Optional[str] = payload.get("task_sid") + self.url: Optional[str] = payload.get("url") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ChannelContext] = None @@ -61,62 +74,6 @@ def _proxy(self) -> "ChannelContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Channel resource and owns this Workflow. - """ - return self._properties["account_sid"] - - @property - def flex_flow_sid(self) -> str: - """ - :returns: The SID of the Flex Flow. - """ - return self._properties["flex_flow_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Channel resource. - """ - return self._properties["sid"] - - @property - def user_sid(self) -> str: - """ - :returns: The SID of the chat user. - """ - return self._properties["user_sid"] - - @property - def task_sid(self) -> str: - """ - :returns: The SID of the TaskRouter Task. Only valid when integration type is `task`. `null` for integration types `studio` & `external` - """ - return self._properties["task_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Flex chat channel resource. - """ - return self._properties["url"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the Flex chat channel was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the Flex chat channel was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - def delete(self) -> bool: """ Deletes the ChannelInstance diff --git a/twilio/rest/flex_api/v1/configuration.py b/twilio/rest/flex_api/v1/configuration.py index 030070b32..b04fdeb77 100644 --- a/twilio/rest/flex_api/v1/configuration.py +++ b/twilio/rest/flex_api/v1/configuration.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,67 +28,154 @@ class Status(object): INPROGRESS = "inprogress" NOTSTARTED = "notstarted" - def __init__(self, version, payload): - """ - Initialize the ConfigurationInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Configuration resource. + :ivar date_created: The date and time in GMT when the Configuration 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 Configuration resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar attributes: An object that contains application-specific data. + :ivar status: + :ivar taskrouter_workspace_sid: The SID of the TaskRouter Workspace. + :ivar taskrouter_target_workflow_sid: The SID of the TaskRouter target Workflow. + :ivar taskrouter_target_taskqueue_sid: The SID of the TaskRouter Target TaskQueue. + :ivar taskrouter_taskqueues: The list of TaskRouter TaskQueues. + :ivar taskrouter_skills: The Skill description for TaskRouter workers. + :ivar taskrouter_worker_channels: The TaskRouter default channel capacities and availability for workers. + :ivar taskrouter_worker_attributes: The TaskRouter Worker attributes. + :ivar taskrouter_offline_activity_sid: The TaskRouter SID of the offline activity. + :ivar runtime_domain: The URL where the Flex instance is hosted. + :ivar messaging_service_instance_sid: The SID of the Messaging service instance. + :ivar chat_service_instance_sid: The SID of the chat service this user belongs to. + :ivar flex_service_instance_sid: The SID of the Flex service instance. + :ivar ui_language: The primary language of the Flex UI. + :ivar ui_attributes: The object that describes Flex UI characteristics and settings. + :ivar ui_dependencies: The object that defines the NPM packages and versions to be used in Hosted Flex. + :ivar ui_version: The Pinned UI version. + :ivar service_version: The Flex Service version. + :ivar call_recording_enabled: Whether call recording is enabled. + :ivar call_recording_webhook_url: The call recording webhook URL. + :ivar crm_enabled: Whether CRM is present for Flex. + :ivar crm_type: The CRM type. + :ivar crm_callback_url: The CRM Callback URL. + :ivar crm_fallback_url: The CRM Fallback URL. + :ivar crm_attributes: An object that contains the CRM attributes. + :ivar public_attributes: The list of public attributes, which are visible to unauthenticated clients. + :ivar plugin_service_enabled: Whether the plugin service enabled. + :ivar plugin_service_attributes: The plugin service attributes. + :ivar integrations: A list of objects that contain the configurations for the Integrations supported in this configuration. + :ivar outbound_call_flows: The list of outbound call flows. + :ivar serverless_service_sids: The list of serverless service SIDs. + :ivar queue_stats_configuration: Configurable parameters for Queues Statistics. + :ivar notifications: Configurable parameters for Notifications. + :ivar markdown: Configurable parameters for Markdown. + :ivar url: The absolute URL of the Configuration resource. + :ivar flex_insights_hr: Object with enabled/disabled flag with list of workspaces. + :ivar flex_insights_drilldown: Setting this to true will redirect Flex UI to the URL set in flex_url + :ivar flex_url: URL to redirect to in case drilldown is enabled. + :ivar channel_configs: Settings for different limits for Flex Conversations channels attachments. + :ivar debugger_integration: Configurable parameters for Debugger Integration. + :ivar flex_ui_status_report: Configurable parameters for Flex UI Status report. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "attributes": payload.get("attributes"), - "status": payload.get("status"), - "taskrouter_workspace_sid": payload.get("taskrouter_workspace_sid"), - "taskrouter_target_workflow_sid": payload.get( - "taskrouter_target_workflow_sid" - ), - "taskrouter_target_taskqueue_sid": payload.get( - "taskrouter_target_taskqueue_sid" - ), - "taskrouter_taskqueues": payload.get("taskrouter_taskqueues"), - "taskrouter_skills": payload.get("taskrouter_skills"), - "taskrouter_worker_channels": payload.get("taskrouter_worker_channels"), - "taskrouter_worker_attributes": payload.get("taskrouter_worker_attributes"), - "taskrouter_offline_activity_sid": payload.get( - "taskrouter_offline_activity_sid" - ), - "runtime_domain": payload.get("runtime_domain"), - "messaging_service_instance_sid": payload.get( - "messaging_service_instance_sid" - ), - "chat_service_instance_sid": payload.get("chat_service_instance_sid"), - "flex_service_instance_sid": payload.get("flex_service_instance_sid"), - "ui_language": payload.get("ui_language"), - "ui_attributes": payload.get("ui_attributes"), - "ui_dependencies": payload.get("ui_dependencies"), - "ui_version": payload.get("ui_version"), - "service_version": payload.get("service_version"), - "call_recording_enabled": payload.get("call_recording_enabled"), - "call_recording_webhook_url": payload.get("call_recording_webhook_url"), - "crm_enabled": payload.get("crm_enabled"), - "crm_type": payload.get("crm_type"), - "crm_callback_url": payload.get("crm_callback_url"), - "crm_fallback_url": payload.get("crm_fallback_url"), - "crm_attributes": payload.get("crm_attributes"), - "public_attributes": payload.get("public_attributes"), - "plugin_service_enabled": payload.get("plugin_service_enabled"), - "plugin_service_attributes": payload.get("plugin_service_attributes"), - "integrations": payload.get("integrations"), - "outbound_call_flows": payload.get("outbound_call_flows"), - "serverless_service_sids": payload.get("serverless_service_sids"), - "queue_stats_configuration": payload.get("queue_stats_configuration"), - "notifications": payload.get("notifications"), - "markdown": payload.get("markdown"), - "url": payload.get("url"), - "flex_insights_hr": payload.get("flex_insights_hr"), - "flex_insights_drilldown": payload.get("flex_insights_drilldown"), - "flex_url": payload.get("flex_url"), - "channel_configs": payload.get("channel_configs"), - "debugger_integration": payload.get("debugger_integration"), - "flex_ui_status_report": payload.get("flex_ui_status_report"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.attributes: Optional[Dict[str, object]] = payload.get("attributes") + self.status: Optional["ConfigurationInstance.Status"] = payload.get("status") + self.taskrouter_workspace_sid: Optional[str] = payload.get( + "taskrouter_workspace_sid" + ) + self.taskrouter_target_workflow_sid: Optional[str] = payload.get( + "taskrouter_target_workflow_sid" + ) + self.taskrouter_target_taskqueue_sid: Optional[str] = payload.get( + "taskrouter_target_taskqueue_sid" + ) + self.taskrouter_taskqueues: Optional[List[object]] = payload.get( + "taskrouter_taskqueues" + ) + self.taskrouter_skills: Optional[List[object]] = payload.get( + "taskrouter_skills" + ) + self.taskrouter_worker_channels: Optional[Dict[str, object]] = payload.get( + "taskrouter_worker_channels" + ) + self.taskrouter_worker_attributes: Optional[Dict[str, object]] = payload.get( + "taskrouter_worker_attributes" + ) + self.taskrouter_offline_activity_sid: Optional[str] = payload.get( + "taskrouter_offline_activity_sid" + ) + self.runtime_domain: Optional[str] = payload.get("runtime_domain") + self.messaging_service_instance_sid: Optional[str] = payload.get( + "messaging_service_instance_sid" + ) + self.chat_service_instance_sid: Optional[str] = payload.get( + "chat_service_instance_sid" + ) + self.flex_service_instance_sid: Optional[str] = payload.get( + "flex_service_instance_sid" + ) + self.ui_language: Optional[str] = payload.get("ui_language") + self.ui_attributes: Optional[Dict[str, object]] = payload.get("ui_attributes") + self.ui_dependencies: Optional[Dict[str, object]] = payload.get( + "ui_dependencies" + ) + self.ui_version: Optional[str] = payload.get("ui_version") + self.service_version: Optional[str] = payload.get("service_version") + self.call_recording_enabled: Optional[bool] = payload.get( + "call_recording_enabled" + ) + self.call_recording_webhook_url: Optional[str] = payload.get( + "call_recording_webhook_url" + ) + self.crm_enabled: Optional[bool] = payload.get("crm_enabled") + self.crm_type: Optional[str] = payload.get("crm_type") + self.crm_callback_url: Optional[str] = payload.get("crm_callback_url") + self.crm_fallback_url: Optional[str] = payload.get("crm_fallback_url") + self.crm_attributes: Optional[Dict[str, object]] = payload.get("crm_attributes") + self.public_attributes: Optional[Dict[str, object]] = payload.get( + "public_attributes" + ) + self.plugin_service_enabled: Optional[bool] = payload.get( + "plugin_service_enabled" + ) + self.plugin_service_attributes: Optional[Dict[str, object]] = payload.get( + "plugin_service_attributes" + ) + self.integrations: Optional[List[object]] = payload.get("integrations") + self.outbound_call_flows: Optional[Dict[str, object]] = payload.get( + "outbound_call_flows" + ) + self.serverless_service_sids: Optional[List[str]] = payload.get( + "serverless_service_sids" + ) + self.queue_stats_configuration: Optional[Dict[str, object]] = payload.get( + "queue_stats_configuration" + ) + self.notifications: Optional[Dict[str, object]] = payload.get("notifications") + self.markdown: Optional[Dict[str, object]] = payload.get("markdown") + self.url: Optional[str] = payload.get("url") + self.flex_insights_hr: Optional[Dict[str, object]] = payload.get( + "flex_insights_hr" + ) + self.flex_insights_drilldown: Optional[bool] = payload.get( + "flex_insights_drilldown" + ) + self.flex_url: Optional[str] = payload.get("flex_url") + self.channel_configs: Optional[List[object]] = payload.get("channel_configs") + self.debugger_integration: Optional[Dict[str, object]] = payload.get( + "debugger_integration" + ) + self.flex_ui_status_report: Optional[Dict[str, object]] = payload.get( + "flex_ui_status_report" + ) self._solution = {} self._context: Optional[ConfigurationContext] = None @@ -107,321 +194,6 @@ def _proxy(self) -> "ConfigurationContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Configuration resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the Configuration resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the Configuration resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def attributes(self) -> Dict[str, object]: - """ - :returns: An object that contains application-specific data. - """ - return self._properties["attributes"] - - @property - def status(self) -> "ConfigurationInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def taskrouter_workspace_sid(self) -> str: - """ - :returns: The SID of the TaskRouter Workspace. - """ - return self._properties["taskrouter_workspace_sid"] - - @property - def taskrouter_target_workflow_sid(self) -> str: - """ - :returns: The SID of the TaskRouter target Workflow. - """ - return self._properties["taskrouter_target_workflow_sid"] - - @property - def taskrouter_target_taskqueue_sid(self) -> str: - """ - :returns: The SID of the TaskRouter Target TaskQueue. - """ - return self._properties["taskrouter_target_taskqueue_sid"] - - @property - def taskrouter_taskqueues(self) -> List[object]: - """ - :returns: The list of TaskRouter TaskQueues. - """ - return self._properties["taskrouter_taskqueues"] - - @property - def taskrouter_skills(self) -> List[object]: - """ - :returns: The Skill description for TaskRouter workers. - """ - return self._properties["taskrouter_skills"] - - @property - def taskrouter_worker_channels(self) -> Dict[str, object]: - """ - :returns: The TaskRouter default channel capacities and availability for workers. - """ - return self._properties["taskrouter_worker_channels"] - - @property - def taskrouter_worker_attributes(self) -> Dict[str, object]: - """ - :returns: The TaskRouter Worker attributes. - """ - return self._properties["taskrouter_worker_attributes"] - - @property - def taskrouter_offline_activity_sid(self) -> str: - """ - :returns: The TaskRouter SID of the offline activity. - """ - return self._properties["taskrouter_offline_activity_sid"] - - @property - def runtime_domain(self) -> str: - """ - :returns: The URL where the Flex instance is hosted. - """ - return self._properties["runtime_domain"] - - @property - def messaging_service_instance_sid(self) -> str: - """ - :returns: The SID of the Messaging service instance. - """ - return self._properties["messaging_service_instance_sid"] - - @property - def chat_service_instance_sid(self) -> str: - """ - :returns: The SID of the chat service this user belongs to. - """ - return self._properties["chat_service_instance_sid"] - - @property - def flex_service_instance_sid(self) -> str: - """ - :returns: The SID of the Flex service instance. - """ - return self._properties["flex_service_instance_sid"] - - @property - def ui_language(self) -> str: - """ - :returns: The primary language of the Flex UI. - """ - return self._properties["ui_language"] - - @property - def ui_attributes(self) -> Dict[str, object]: - """ - :returns: The object that describes Flex UI characteristics and settings. - """ - return self._properties["ui_attributes"] - - @property - def ui_dependencies(self) -> Dict[str, object]: - """ - :returns: The object that defines the NPM packages and versions to be used in Hosted Flex. - """ - return self._properties["ui_dependencies"] - - @property - def ui_version(self) -> str: - """ - :returns: The Pinned UI version. - """ - return self._properties["ui_version"] - - @property - def service_version(self) -> str: - """ - :returns: The Flex Service version. - """ - return self._properties["service_version"] - - @property - def call_recording_enabled(self) -> bool: - """ - :returns: Whether call recording is enabled. - """ - return self._properties["call_recording_enabled"] - - @property - def call_recording_webhook_url(self) -> str: - """ - :returns: The call recording webhook URL. - """ - return self._properties["call_recording_webhook_url"] - - @property - def crm_enabled(self) -> bool: - """ - :returns: Whether CRM is present for Flex. - """ - return self._properties["crm_enabled"] - - @property - def crm_type(self) -> str: - """ - :returns: The CRM type. - """ - return self._properties["crm_type"] - - @property - def crm_callback_url(self) -> str: - """ - :returns: The CRM Callback URL. - """ - return self._properties["crm_callback_url"] - - @property - def crm_fallback_url(self) -> str: - """ - :returns: The CRM Fallback URL. - """ - return self._properties["crm_fallback_url"] - - @property - def crm_attributes(self) -> Dict[str, object]: - """ - :returns: An object that contains the CRM attributes. - """ - return self._properties["crm_attributes"] - - @property - def public_attributes(self) -> Dict[str, object]: - """ - :returns: The list of public attributes, which are visible to unauthenticated clients. - """ - return self._properties["public_attributes"] - - @property - def plugin_service_enabled(self) -> bool: - """ - :returns: Whether the plugin service enabled. - """ - return self._properties["plugin_service_enabled"] - - @property - def plugin_service_attributes(self) -> Dict[str, object]: - """ - :returns: The plugin service attributes. - """ - return self._properties["plugin_service_attributes"] - - @property - def integrations(self) -> List[object]: - """ - :returns: A list of objects that contain the configurations for the Integrations supported in this configuration. - """ - return self._properties["integrations"] - - @property - def outbound_call_flows(self) -> Dict[str, object]: - """ - :returns: The list of outbound call flows. - """ - return self._properties["outbound_call_flows"] - - @property - def serverless_service_sids(self) -> List[str]: - """ - :returns: The list of serverless service SIDs. - """ - return self._properties["serverless_service_sids"] - - @property - def queue_stats_configuration(self) -> Dict[str, object]: - """ - :returns: Configurable parameters for Queues Statistics. - """ - return self._properties["queue_stats_configuration"] - - @property - def notifications(self) -> Dict[str, object]: - """ - :returns: Configurable parameters for Notifications. - """ - return self._properties["notifications"] - - @property - def markdown(self) -> Dict[str, object]: - """ - :returns: Configurable parameters for Markdown. - """ - return self._properties["markdown"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Configuration resource. - """ - return self._properties["url"] - - @property - def flex_insights_hr(self) -> Dict[str, object]: - """ - :returns: Object with enabled/disabled flag with list of workspaces. - """ - return self._properties["flex_insights_hr"] - - @property - def flex_insights_drilldown(self) -> bool: - """ - :returns: Setting this to true will redirect Flex UI to the URL set in flex_url - """ - return self._properties["flex_insights_drilldown"] - - @property - def flex_url(self) -> str: - """ - :returns: URL to redirect to in case drilldown is enabled. - """ - return self._properties["flex_url"] - - @property - def channel_configs(self) -> List[object]: - """ - :returns: Settings for different limits for Flex Conversations channels attachments. - """ - return self._properties["channel_configs"] - - @property - def debugger_integration(self) -> Dict[str, object]: - """ - :returns: Configurable parameters for Debugger Integration. - """ - return self._properties["debugger_integration"] - - @property - def flex_ui_status_report(self) -> Dict[str, object]: - """ - :returns: Configurable parameters for Flex UI Status report. - """ - return self._properties["flex_ui_status_report"] - def fetch(self, ui_version=values.unset) -> "ConfigurationInstance": """ Fetch the ConfigurationInstance diff --git a/twilio/rest/flex_api/v1/flex_flow.py b/twilio/rest/flex_api/v1/flex_flow.py index 6629cb115..0dd2072de 100644 --- a/twilio/rest/flex_api/v1/flex_flow.py +++ b/twilio/rest/flex_api/v1/flex_flow.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -37,31 +37,53 @@ class IntegrationType(object): EXTERNAL = "external" TASK = "task" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the FlexFlowInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Flow resource and owns this Workflow. + :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 sid: The unique string that we created to identify the Flex Flow resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar chat_service_sid: The SID of the chat service. + :ivar channel_type: + :ivar contact_identity: The channel contact's Identity. + :ivar enabled: Whether the Flex Flow is enabled. + :ivar integration_type: + :ivar integration: An object that contains specific parameters for the integration. + :ivar long_lived: When enabled, Flex will keep the chat channel active so that it may be used for subsequent interactions with a contact identity. Defaults to `false`. + :ivar janitor_enabled: When enabled, the Messaging Channel Janitor will remove active Proxy sessions if the associated Task is deleted outside of the Flex UI. Defaults to `false`. + :ivar url: The absolute URL of the Flex Flow resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "sid": payload.get("sid"), - "friendly_name": payload.get("friendly_name"), - "chat_service_sid": payload.get("chat_service_sid"), - "channel_type": payload.get("channel_type"), - "contact_identity": payload.get("contact_identity"), - "enabled": payload.get("enabled"), - "integration_type": payload.get("integration_type"), - "integration": payload.get("integration"), - "long_lived": payload.get("long_lived"), - "janitor_enabled": payload.get("janitor_enabled"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.chat_service_sid: Optional[str] = payload.get("chat_service_sid") + self.channel_type: Optional["FlexFlowInstance.ChannelType"] = payload.get( + "channel_type" + ) + self.contact_identity: Optional[str] = payload.get("contact_identity") + self.enabled: Optional[bool] = payload.get("enabled") + self.integration_type: Optional[ + "FlexFlowInstance.IntegrationType" + ] = payload.get("integration_type") + self.integration: Optional[Dict[str, object]] = payload.get("integration") + self.long_lived: Optional[bool] = payload.get("long_lived") + self.janitor_enabled: Optional[bool] = payload.get("janitor_enabled") + self.url: Optional[str] = payload.get("url") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[FlexFlowContext] = None @@ -80,104 +102,6 @@ def _proxy(self) -> "FlexFlowContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Flow resource and owns this Workflow. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Flex Flow resource. - """ - return self._properties["sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def chat_service_sid(self) -> str: - """ - :returns: The SID of the chat service. - """ - return self._properties["chat_service_sid"] - - @property - def channel_type(self) -> "FlexFlowInstance.ChannelType": - """ - :returns: - """ - return self._properties["channel_type"] - - @property - def contact_identity(self) -> str: - """ - :returns: The channel contact's Identity. - """ - return self._properties["contact_identity"] - - @property - def enabled(self) -> bool: - """ - :returns: Whether the Flex Flow is enabled. - """ - return self._properties["enabled"] - - @property - def integration_type(self) -> "FlexFlowInstance.IntegrationType": - """ - :returns: - """ - return self._properties["integration_type"] - - @property - def integration(self) -> Dict[str, object]: - """ - :returns: An object that contains specific parameters for the integration. - """ - return self._properties["integration"] - - @property - def long_lived(self) -> bool: - """ - :returns: When enabled, Flex will keep the chat channel active so that it may be used for subsequent interactions with a contact identity. Defaults to `false`. - """ - return self._properties["long_lived"] - - @property - def janitor_enabled(self) -> bool: - """ - :returns: When enabled, the Messaging Channel Janitor will remove active Proxy sessions if the associated Task is deleted outside of the Flex UI. Defaults to `false`. - """ - return self._properties["janitor_enabled"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Flex Flow resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the FlexFlowInstance diff --git a/twilio/rest/flex_api/v1/insights_assessments_comment.py b/twilio/rest/flex_api/v1/insights_assessments_comment.py index 4803a8a87..c0ee8f1ce 100644 --- a/twilio/rest/flex_api/v1/insights_assessments_comment.py +++ b/twilio/rest/flex_api/v1/insights_assessments_comment.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -23,113 +23,40 @@ class InsightsAssessmentsCommentInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the InsightsAssessmentsCommentInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. + :ivar assessment_id: The unique ID of the assessment. + :ivar comment: The comment added for assessment. + :ivar offset: The offset + :ivar report: The flag indicating if this assessment is part of report + :ivar weight: The weightage given to this comment + :ivar agent_id: The id of the agent. + :ivar segment_id: The id of the segment. + :ivar user_name: The name of the user. + :ivar user_email: The email id of the user. + :ivar timestamp: The timestamp when the record is inserted + :ivar url: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "assessment_id": payload.get("assessment_id"), - "comment": payload.get("comment"), - "offset": deserialize.decimal(payload.get("offset")), - "report": payload.get("report"), - "weight": deserialize.decimal(payload.get("weight")), - "agent_id": payload.get("agent_id"), - "segment_id": payload.get("segment_id"), - "user_name": payload.get("user_name"), - "user_email": payload.get("user_email"), - "timestamp": deserialize.decimal(payload.get("timestamp")), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.assessment_id: Optional[str] = payload.get("assessment_id") + self.comment: Optional[Dict[str, object]] = payload.get("comment") + self.offset: Optional[float] = deserialize.decimal(payload.get("offset")) + self.report: Optional[bool] = payload.get("report") + self.weight: Optional[float] = deserialize.decimal(payload.get("weight")) + self.agent_id: Optional[str] = payload.get("agent_id") + self.segment_id: Optional[str] = payload.get("segment_id") + self.user_name: Optional[str] = payload.get("user_name") + self.user_email: Optional[str] = payload.get("user_email") + self.timestamp: Optional[float] = deserialize.decimal(payload.get("timestamp")) + self.url: Optional[str] = payload.get("url") self._solution = {} - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. - """ - return self._properties["account_sid"] - - @property - def assessment_id(self) -> str: - """ - :returns: The unique ID of the assessment. - """ - return self._properties["assessment_id"] - - @property - def comment(self) -> Dict[str, object]: - """ - :returns: The comment added for assessment. - """ - return self._properties["comment"] - - @property - def offset(self) -> float: - """ - :returns: The offset - """ - return self._properties["offset"] - - @property - def report(self) -> bool: - """ - :returns: The flag indicating if this assessment is part of report - """ - return self._properties["report"] - - @property - def weight(self) -> float: - """ - :returns: The weightage given to this comment - """ - return self._properties["weight"] - - @property - def agent_id(self) -> str: - """ - :returns: The id of the agent. - """ - return self._properties["agent_id"] - - @property - def segment_id(self) -> str: - """ - :returns: The id of the segment. - """ - return self._properties["segment_id"] - - @property - def user_name(self) -> str: - """ - :returns: The name of the user. - """ - return self._properties["user_name"] - - @property - def user_email(self) -> str: - """ - :returns: The email id of the user. - """ - return self._properties["user_email"] - - @property - def timestamp(self) -> float: - """ - :returns: The timestamp when the record is inserted - """ - return self._properties["timestamp"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/flex_api/v1/insights_conversations.py b/twilio/rest/flex_api/v1/insights_conversations.py index 66994402b..9a3330957 100644 --- a/twilio/rest/flex_api/v1/insights_conversations.py +++ b/twilio/rest/flex_api/v1/insights_conversations.py @@ -13,7 +13,7 @@ """ -from typing import List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -23,48 +23,25 @@ class InsightsConversationsInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the InsightsConversationsInstance - """ - super().__init__(version) - self._properties = { - "account_id": payload.get("account_id"), - "conversation_id": payload.get("conversation_id"), - "segment_count": deserialize.integer(payload.get("segment_count")), - "segments": payload.get("segments"), - } - - self._solution = {} + """ + :ivar account_id: The id of the account. + :ivar conversation_id: The unique id of the conversation + :ivar segment_count: The count of segments for a conversation + :ivar segments: The Segments of a conversation + """ - @property - def account_id(self) -> str: - """ - :returns: The id of the account. - """ - return self._properties["account_id"] - - @property - def conversation_id(self) -> str: - """ - :returns: The unique id of the conversation - """ - return self._properties["conversation_id"] + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) - @property - def segment_count(self) -> int: - """ - :returns: The count of segments for a conversation - """ - return self._properties["segment_count"] + self.account_id: Optional[str] = payload.get("account_id") + self.conversation_id: Optional[str] = payload.get("conversation_id") + self.segment_count: Optional[int] = deserialize.integer( + payload.get("segment_count") + ) + self.segments: Optional[List[object]] = payload.get("segments") - @property - def segments(self) -> List[object]: - """ - :returns: The Segments of a conversation - """ - return self._properties["segments"] + self._solution = {} def __repr__(self) -> str: """ diff --git a/twilio/rest/flex_api/v1/insights_questionnaires.py b/twilio/rest/flex_api/v1/insights_questionnaires.py index 20caa8017..38b33c5df 100644 --- a/twilio/rest/flex_api/v1/insights_questionnaires.py +++ b/twilio/rest/flex_api/v1/insights_questionnaires.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,24 +23,32 @@ class InsightsQuestionnairesInstance(InstanceResource): - def __init__(self, version, payload, id: Optional[str] = None): - """ - Initialize the InsightsQuestionnairesInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. + :ivar id: The unique id of this questionnaire + :ivar name: The name of this category. + :ivar description: The description of this questionnaire + :ivar active: The flag to enable or disable questionnaire + :ivar questions: The list of questions with category for a questionnaire + :ivar url: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], id: Optional[str] = None + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "id": payload.get("id"), - "name": payload.get("name"), - "description": payload.get("description"), - "active": payload.get("active"), - "questions": payload.get("questions"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.id: Optional[str] = payload.get("id") + self.name: Optional[str] = payload.get("name") + self.description: Optional[str] = payload.get("description") + self.active: Optional[bool] = payload.get("active") + self.questions: Optional[List[object]] = payload.get("questions") + self.url: Optional[str] = payload.get("url") self._solution = { - "id": id or self._properties["id"], + "id": id or self.id, } self._context: Optional[InsightsQuestionnairesContext] = None @@ -59,55 +67,6 @@ def _proxy(self) -> "InsightsQuestionnairesContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. - """ - return self._properties["account_sid"] - - @property - def id(self) -> str: - """ - :returns: The unique id of this questionnaire - """ - return self._properties["id"] - - @property - def name(self) -> str: - """ - :returns: The name of this category. - """ - return self._properties["name"] - - @property - def description(self) -> str: - """ - :returns: The description of this questionnaire - """ - return self._properties["description"] - - @property - def active(self) -> bool: - """ - :returns: The flag to enable or disable questionnaire - """ - return self._properties["active"] - - @property - def questions(self) -> List[object]: - """ - :returns: The list of questions with category for a questionnaire - """ - return self._properties["questions"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def delete(self, token=values.unset) -> bool: """ Deletes the InsightsQuestionnairesInstance diff --git a/twilio/rest/flex_api/v1/insights_questionnaires_category.py b/twilio/rest/flex_api/v1/insights_questionnaires_category.py index b177b3d11..baf1dda7b 100644 --- a/twilio/rest/flex_api/v1/insights_questionnaires_category.py +++ b/twilio/rest/flex_api/v1/insights_questionnaires_category.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,21 +23,29 @@ class InsightsQuestionnairesCategoryInstance(InstanceResource): - def __init__(self, version, payload, category_id: Optional[str] = None): - """ - Initialize the InsightsQuestionnairesCategoryInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. + :ivar category_id: The unique ID for the category + :ivar name: The name of this category. + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + category_id: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "category_id": payload.get("category_id"), - "name": payload.get("name"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.category_id: Optional[str] = payload.get("category_id") + self.name: Optional[str] = payload.get("name") + self.url: Optional[str] = payload.get("url") self._solution = { - "category_id": category_id or self._properties["category_id"], + "category_id": category_id or self.category_id, } self._context: Optional[InsightsQuestionnairesCategoryContext] = None @@ -56,34 +64,6 @@ def _proxy(self) -> "InsightsQuestionnairesCategoryContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. - """ - return self._properties["account_sid"] - - @property - def category_id(self) -> str: - """ - :returns: The unique ID for the category - """ - return self._properties["category_id"] - - @property - def name(self) -> str: - """ - :returns: The name of this category. - """ - return self._properties["name"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def delete(self, token=values.unset) -> bool: """ Deletes the InsightsQuestionnairesCategoryInstance diff --git a/twilio/rest/flex_api/v1/insights_questionnaires_question.py b/twilio/rest/flex_api/v1/insights_questionnaires_question.py index d30c05b1f..5d4ea583d 100644 --- a/twilio/rest/flex_api/v1/insights_questionnaires_question.py +++ b/twilio/rest/flex_api/v1/insights_questionnaires_question.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,27 +23,41 @@ class InsightsQuestionnairesQuestionInstance(InstanceResource): - def __init__(self, version, payload, question_id: Optional[str] = None): - """ - Initialize the InsightsQuestionnairesQuestionInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. + :ivar question_id: The unique ID of the question + :ivar question: The question. + :ivar description: The description for the question. + :ivar category: The Category for the question. + :ivar answer_set_id: The answer_set for the question. + :ivar allow_na: The flag to enable for disable NA for answer. + :ivar usage: Integer value that tells a particular question is used by how many questionnaires + :ivar answer_set: Set of answers for the question + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + question_id: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "question_id": payload.get("question_id"), - "question": payload.get("question"), - "description": payload.get("description"), - "category": payload.get("category"), - "answer_set_id": payload.get("answer_set_id"), - "allow_na": payload.get("allow_na"), - "usage": deserialize.integer(payload.get("usage")), - "answer_set": payload.get("answer_set"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.question_id: Optional[str] = payload.get("question_id") + self.question: Optional[str] = payload.get("question") + self.description: Optional[str] = payload.get("description") + self.category: Optional[Dict[str, object]] = payload.get("category") + self.answer_set_id: Optional[str] = payload.get("answer_set_id") + self.allow_na: Optional[bool] = payload.get("allow_na") + self.usage: Optional[int] = deserialize.integer(payload.get("usage")) + self.answer_set: Optional[Dict[str, object]] = payload.get("answer_set") + self.url: Optional[str] = payload.get("url") self._solution = { - "question_id": question_id or self._properties["question_id"], + "question_id": question_id or self.question_id, } self._context: Optional[InsightsQuestionnairesQuestionContext] = None @@ -62,76 +76,6 @@ def _proxy(self) -> "InsightsQuestionnairesQuestionContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. - """ - return self._properties["account_sid"] - - @property - def question_id(self) -> str: - """ - :returns: The unique ID of the question - """ - return self._properties["question_id"] - - @property - def question(self) -> str: - """ - :returns: The question. - """ - return self._properties["question"] - - @property - def description(self) -> str: - """ - :returns: The description for the question. - """ - return self._properties["description"] - - @property - def category(self) -> Dict[str, object]: - """ - :returns: The Category for the question. - """ - return self._properties["category"] - - @property - def answer_set_id(self) -> str: - """ - :returns: The answer_set for the question. - """ - return self._properties["answer_set_id"] - - @property - def allow_na(self) -> bool: - """ - :returns: The flag to enable for disable NA for answer. - """ - return self._properties["allow_na"] - - @property - def usage(self) -> int: - """ - :returns: Integer value that tells a particular question is used by how many questionnaires - """ - return self._properties["usage"] - - @property - def answer_set(self) -> Dict[str, object]: - """ - :returns: Set of answers for the question - """ - return self._properties["answer_set"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def delete(self, token=values.unset) -> bool: """ Deletes the InsightsQuestionnairesQuestionInstance diff --git a/twilio/rest/flex_api/v1/insights_segments.py b/twilio/rest/flex_api/v1/insights_segments.py index 4232cbc19..54185a003 100644 --- a/twilio/rest/flex_api/v1/insights_segments.py +++ b/twilio/rest/flex_api/v1/insights_segments.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,39 +23,75 @@ class InsightsSegmentsInstance(InstanceResource): - def __init__(self, version, payload, segment_id: Optional[str] = None): - """ - Initialize the InsightsSegmentsInstance - """ + + """ + :ivar segment_id: To unique id of the segment + :ivar external_id: The unique id for the conversation. + :ivar queue: + :ivar external_contact: + :ivar external_segment_link_id: The uuid for the external_segment_link. + :ivar date: The date of the conversation. + :ivar account_id: The unique id for the account. + :ivar external_segment_link: The hyperlink to recording of the task event. + :ivar agent_id: The unique id for the agent. + :ivar agent_phone: The phone number of the agent. + :ivar agent_name: The name of the agent. + :ivar agent_team_name: The team name to which agent belongs. + :ivar agent_team_name_in_hierarchy: he team name to which agent belongs. + :ivar agent_link: The link to the agent conversation. + :ivar customer_phone: The phone number of the customer. + :ivar customer_name: The name of the customer. + :ivar customer_link: The link to the customer conversation. + :ivar segment_recording_offset: The offset value for the recording. + :ivar media: The media identifiers of the conversation. + :ivar assessment_type: The type of the assessment. + :ivar assessment_percentage: The percentage scored on the Assessments. + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + segment_id: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "segment_id": payload.get("segment_id"), - "external_id": payload.get("external_id"), - "queue": payload.get("queue"), - "external_contact": payload.get("external_contact"), - "external_segment_link_id": payload.get("external_segment_link_id"), - "date": payload.get("date"), - "account_id": payload.get("account_id"), - "external_segment_link": payload.get("external_segment_link"), - "agent_id": payload.get("agent_id"), - "agent_phone": payload.get("agent_phone"), - "agent_name": payload.get("agent_name"), - "agent_team_name": payload.get("agent_team_name"), - "agent_team_name_in_hierarchy": payload.get("agent_team_name_in_hierarchy"), - "agent_link": payload.get("agent_link"), - "customer_phone": payload.get("customer_phone"), - "customer_name": payload.get("customer_name"), - "customer_link": payload.get("customer_link"), - "segment_recording_offset": payload.get("segment_recording_offset"), - "media": payload.get("media"), - "assessment_type": payload.get("assessment_type"), - "assessment_percentage": payload.get("assessment_percentage"), - "url": payload.get("url"), - } + self.segment_id: Optional[str] = payload.get("segment_id") + self.external_id: Optional[str] = payload.get("external_id") + self.queue: Optional[str] = payload.get("queue") + self.external_contact: Optional[str] = payload.get("external_contact") + self.external_segment_link_id: Optional[str] = payload.get( + "external_segment_link_id" + ) + self.date: Optional[str] = payload.get("date") + self.account_id: Optional[str] = payload.get("account_id") + self.external_segment_link: Optional[str] = payload.get("external_segment_link") + self.agent_id: Optional[str] = payload.get("agent_id") + self.agent_phone: Optional[str] = payload.get("agent_phone") + self.agent_name: Optional[str] = payload.get("agent_name") + self.agent_team_name: Optional[str] = payload.get("agent_team_name") + self.agent_team_name_in_hierarchy: Optional[str] = payload.get( + "agent_team_name_in_hierarchy" + ) + self.agent_link: Optional[str] = payload.get("agent_link") + self.customer_phone: Optional[str] = payload.get("customer_phone") + self.customer_name: Optional[str] = payload.get("customer_name") + self.customer_link: Optional[str] = payload.get("customer_link") + self.segment_recording_offset: Optional[str] = payload.get( + "segment_recording_offset" + ) + self.media: Optional[Dict[str, object]] = payload.get("media") + self.assessment_type: Optional[Dict[str, object]] = payload.get( + "assessment_type" + ) + self.assessment_percentage: Optional[Dict[str, object]] = payload.get( + "assessment_percentage" + ) + self.url: Optional[str] = payload.get("url") self._solution = { - "segment_id": segment_id or self._properties["segment_id"], + "segment_id": segment_id or self.segment_id, } self._context: Optional[InsightsSegmentsContext] = None @@ -74,160 +110,6 @@ def _proxy(self) -> "InsightsSegmentsContext": ) return self._context - @property - def segment_id(self) -> str: - """ - :returns: To unique id of the segment - """ - return self._properties["segment_id"] - - @property - def external_id(self) -> str: - """ - :returns: The unique id for the conversation. - """ - return self._properties["external_id"] - - @property - def queue(self) -> str: - """ - :returns: - """ - return self._properties["queue"] - - @property - def external_contact(self) -> str: - """ - :returns: - """ - return self._properties["external_contact"] - - @property - def external_segment_link_id(self) -> str: - """ - :returns: The uuid for the external_segment_link. - """ - return self._properties["external_segment_link_id"] - - @property - def date(self) -> str: - """ - :returns: The date of the conversation. - """ - return self._properties["date"] - - @property - def account_id(self) -> str: - """ - :returns: The unique id for the account. - """ - return self._properties["account_id"] - - @property - def external_segment_link(self) -> str: - """ - :returns: The hyperlink to recording of the task event. - """ - return self._properties["external_segment_link"] - - @property - def agent_id(self) -> str: - """ - :returns: The unique id for the agent. - """ - return self._properties["agent_id"] - - @property - def agent_phone(self) -> str: - """ - :returns: The phone number of the agent. - """ - return self._properties["agent_phone"] - - @property - def agent_name(self) -> str: - """ - :returns: The name of the agent. - """ - return self._properties["agent_name"] - - @property - def agent_team_name(self) -> str: - """ - :returns: The team name to which agent belongs. - """ - return self._properties["agent_team_name"] - - @property - def agent_team_name_in_hierarchy(self) -> str: - """ - :returns: he team name to which agent belongs. - """ - return self._properties["agent_team_name_in_hierarchy"] - - @property - def agent_link(self) -> str: - """ - :returns: The link to the agent conversation. - """ - return self._properties["agent_link"] - - @property - def customer_phone(self) -> str: - """ - :returns: The phone number of the customer. - """ - return self._properties["customer_phone"] - - @property - def customer_name(self) -> str: - """ - :returns: The name of the customer. - """ - return self._properties["customer_name"] - - @property - def customer_link(self) -> str: - """ - :returns: The link to the customer conversation. - """ - return self._properties["customer_link"] - - @property - def segment_recording_offset(self) -> str: - """ - :returns: The offset value for the recording. - """ - return self._properties["segment_recording_offset"] - - @property - def media(self) -> Dict[str, object]: - """ - :returns: The media identifiers of the conversation. - """ - return self._properties["media"] - - @property - def assessment_type(self) -> Dict[str, object]: - """ - :returns: The type of the assessment. - """ - return self._properties["assessment_type"] - - @property - def assessment_percentage(self) -> Dict[str, object]: - """ - :returns: The percentage scored on the Assessments. - """ - return self._properties["assessment_percentage"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def fetch(self, token=values.unset) -> "InsightsSegmentsInstance": """ Fetch the InsightsSegmentsInstance diff --git a/twilio/rest/flex_api/v1/insights_session.py b/twilio/rest/flex_api/v1/insights_session.py index 19eb0e54d..f868c6006 100644 --- a/twilio/rest/flex_api/v1/insights_session.py +++ b/twilio/rest/flex_api/v1/insights_session.py @@ -13,7 +13,7 @@ """ -from typing import Optional +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 @@ -22,19 +22,23 @@ class InsightsSessionInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the InsightsSessionInstance - """ + + """ + :ivar workspace_id: Unique ID to identify the user's workspace + :ivar session_expiry: The session expiry date and time, given in ISO 8601 format. + :ivar session_id: The unique ID for the session + :ivar base_url: The base URL to fetch reports and dashboards + :ivar url: The URL of this resource. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "workspace_id": payload.get("workspace_id"), - "session_expiry": payload.get("session_expiry"), - "session_id": payload.get("session_id"), - "base_url": payload.get("base_url"), - "url": payload.get("url"), - } + self.workspace_id: Optional[str] = payload.get("workspace_id") + self.session_expiry: Optional[str] = payload.get("session_expiry") + self.session_id: Optional[str] = payload.get("session_id") + self.base_url: Optional[str] = payload.get("base_url") + self.url: Optional[str] = payload.get("url") self._solution = {} self._context: Optional[InsightsSessionContext] = None @@ -53,41 +57,6 @@ def _proxy(self) -> "InsightsSessionContext": ) return self._context - @property - def workspace_id(self) -> str: - """ - :returns: Unique ID to identify the user's workspace - """ - return self._properties["workspace_id"] - - @property - def session_expiry(self) -> str: - """ - :returns: The session expiry date and time, given in ISO 8601 format. - """ - return self._properties["session_expiry"] - - @property - def session_id(self) -> str: - """ - :returns: The unique ID for the session - """ - return self._properties["session_id"] - - @property - def base_url(self) -> str: - """ - :returns: The base URL to fetch reports and dashboards - """ - return self._properties["base_url"] - - @property - def url(self) -> str: - """ - :returns: The URL of this resource. - """ - return self._properties["url"] - def create(self, authorization=values.unset) -> "InsightsSessionInstance": """ Create the InsightsSessionInstance diff --git a/twilio/rest/flex_api/v1/insights_settings_answer_sets.py b/twilio/rest/flex_api/v1/insights_settings_answer_sets.py index 0db2ae8d0..8a05e8002 100644 --- a/twilio/rest/flex_api/v1/insights_settings_answer_sets.py +++ b/twilio/rest/flex_api/v1/insights_settings_answer_sets.py @@ -13,7 +13,7 @@ """ -from typing import Dict +from typing import Any, Dict, Optional from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -21,56 +21,27 @@ class InsightsSettingsAnswerSetsInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the InsightsSettingsAnswerSetsInstance - """ - super().__init__(version) - - self._properties = { - "account_sid": payload.get("account_sid"), - "answer_sets": payload.get("answer_sets"), - "answer_set_categories": payload.get("answer_set_categories"), - "not_applicable": payload.get("not_applicable"), - "url": payload.get("url"), - } - - self._solution = {} - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. - """ - return self._properties["account_sid"] - - @property - def answer_sets(self) -> Dict[str, object]: - """ - :returns: The lis of answer sets - """ - return self._properties["answer_sets"] + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. + :ivar answer_sets: The lis of answer sets + :ivar answer_set_categories: The list of answer set categories + :ivar not_applicable: The details for not applicable answer set + :ivar url: + """ - @property - def answer_set_categories(self) -> Dict[str, object]: - """ - :returns: The list of answer set categories - """ - return self._properties["answer_set_categories"] + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) - @property - def not_applicable(self) -> Dict[str, object]: - """ - :returns: The details for not applicable answer set - """ - return self._properties["not_applicable"] + self.account_sid: Optional[str] = payload.get("account_sid") + self.answer_sets: Optional[Dict[str, object]] = payload.get("answer_sets") + self.answer_set_categories: Optional[Dict[str, object]] = payload.get( + "answer_set_categories" + ) + self.not_applicable: Optional[Dict[str, object]] = payload.get("not_applicable") + self.url: Optional[str] = payload.get("url") - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] + self._solution = {} def __repr__(self) -> str: """ diff --git a/twilio/rest/flex_api/v1/insights_settings_comment.py b/twilio/rest/flex_api/v1/insights_settings_comment.py index ad2f8ec26..8f318d45b 100644 --- a/twilio/rest/flex_api/v1/insights_settings_comment.py +++ b/twilio/rest/flex_api/v1/insights_settings_comment.py @@ -13,7 +13,7 @@ """ -from typing import Dict +from typing import Any, Dict, Optional from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -21,40 +21,21 @@ class InsightsSettingsCommentInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the InsightsSettingsCommentInstance - """ - super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "comments": payload.get("comments"), - "url": payload.get("url"), - } + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. + :ivar comments: + :ivar url: + """ - self._solution = {} - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource. - """ - return self._properties["account_sid"] + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) - @property - def comments(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["comments"] + self.account_sid: Optional[str] = payload.get("account_sid") + self.comments: Optional[Dict[str, object]] = payload.get("comments") + self.url: Optional[str] = payload.get("url") - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] + self._solution = {} def __repr__(self) -> str: """ diff --git a/twilio/rest/flex_api/v1/insights_user_roles.py b/twilio/rest/flex_api/v1/insights_user_roles.py index 8e680726e..f40447722 100644 --- a/twilio/rest/flex_api/v1/insights_user_roles.py +++ b/twilio/rest/flex_api/v1/insights_user_roles.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -22,16 +22,17 @@ class InsightsUserRolesInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the InsightsUserRolesInstance - """ + + """ + :ivar roles: Flex Insights roles for the user + :ivar url: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "roles": payload.get("roles"), - "url": payload.get("url"), - } + self.roles: Optional[List[str]] = payload.get("roles") + self.url: Optional[str] = payload.get("url") self._solution = {} self._context: Optional[InsightsUserRolesContext] = None @@ -50,20 +51,6 @@ def _proxy(self) -> "InsightsUserRolesContext": ) return self._context - @property - def roles(self) -> List[str]: - """ - :returns: Flex Insights roles for the user - """ - return self._properties["roles"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def fetch(self, authorization=values.unset) -> "InsightsUserRolesInstance": """ Fetch the InsightsUserRolesInstance diff --git a/twilio/rest/flex_api/v1/interaction/__init__.py b/twilio/rest/flex_api/v1/interaction/__init__.py index 13ed24f94..56ea8f551 100644 --- a/twilio/rest/flex_api/v1/interaction/__init__.py +++ b/twilio/rest/flex_api/v1/interaction/__init__.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -26,22 +26,28 @@ class InteractionInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the InteractionInstance - """ + + """ + :ivar sid: The unique string created by Twilio to identify an Interaction resource, prefixed with KD. + :ivar channel: A JSON object that defines the Interaction’s communication channel and includes details about the channel. See the [Outbound SMS](https://www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#agent-initiated-outbound-interactions) and [inbound (API-initiated)](https://www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#api-initiated-contact) Channel object examples. + :ivar routing: A JSON Object representing the routing rules for the Interaction Channel. See [Outbound SMS Example](https://www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#agent-initiated-outbound-interactions) for an example Routing object. The Interactions resource uses TaskRouter for all routing functionality. All attributes in the Routing object on your Interaction request body are added “as is” to the task. For a list of known attributes consumed by the Flex UI and/or Flex Insights, see [Known Task Attributes](https://www.twilio.com/docs/flex/developer/conversations/interactions-api#task-attributes). + :ivar url: + :ivar links: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "channel": payload.get("channel"), - "routing": payload.get("routing"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.channel: Optional[Dict[str, object]] = payload.get("channel") + self.routing: Optional[Dict[str, object]] = payload.get("routing") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[InteractionContext] = None @@ -60,41 +66,6 @@ def _proxy(self) -> "InteractionContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string created by Twilio to identify an Interaction resource, prefixed with KD. - """ - return self._properties["sid"] - - @property - def channel(self) -> Dict[str, object]: - """ - :returns: A JSON object that defines the Interaction’s communication channel and includes details about the channel. See the [Outbound SMS](https://www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#agent-initiated-outbound-interactions) and [inbound (API-initiated)](https://www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#api-initiated-contact) Channel object examples. - """ - return self._properties["channel"] - - @property - def routing(self) -> Dict[str, object]: - """ - :returns: A JSON Object representing the routing rules for the Interaction Channel. See [Outbound SMS Example](https://www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#agent-initiated-outbound-interactions) for an example Routing object. The Interactions resource uses TaskRouter for all routing functionality. All attributes in the Routing object on your Interaction request body are added “as is” to the task. For a list of known attributes consumed by the Flex UI and/or Flex Insights, see [Known Task Attributes](https://www.twilio.com/docs/flex/developer/conversations/interactions-api#task-attributes). - """ - return self._properties["routing"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - def fetch(self) -> "InteractionInstance": """ Fetch the InteractionInstance diff --git a/twilio/rest/flex_api/v1/interaction/interaction_channel/__init__.py b/twilio/rest/flex_api/v1/interaction/interaction_channel/__init__.py index 7c25fe2e0..3f23e2df2 100644 --- a/twilio/rest/flex_api/v1/interaction/interaction_channel/__init__.py +++ b/twilio/rest/flex_api/v1/interaction/interaction_channel/__init__.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -45,28 +45,40 @@ class Type(object): MESSENGER = "messenger" GBM = "gbm" + """ + :ivar sid: The unique string created by Twilio to identify an Interaction Channel resource, prefixed with UO. + :ivar interaction_sid: The unique string created by Twilio to identify an Interaction resource, prefixed with KD. + :ivar type: + :ivar status: + :ivar error_code: The Twilio error code for a failed channel. + :ivar error_message: The error message for a failed channel. + :ivar url: + :ivar links: + """ + def __init__( - self, version, payload, interaction_sid: str, sid: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + interaction_sid: str, + sid: Optional[str] = None, ): - """ - Initialize the InteractionChannelInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "interaction_sid": payload.get("interaction_sid"), - "type": payload.get("type"), - "status": payload.get("status"), - "error_code": deserialize.integer(payload.get("error_code")), - "error_message": payload.get("error_message"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.interaction_sid: Optional[str] = payload.get("interaction_sid") + self.type: Optional["InteractionChannelInstance.Type"] = payload.get("type") + self.status: Optional["InteractionChannelInstance.ChannelStatus"] = payload.get( + "status" + ) + self.error_code: Optional[int] = deserialize.integer(payload.get("error_code")) + self.error_message: Optional[str] = payload.get("error_message") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "interaction_sid": interaction_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[InteractionChannelContext] = None @@ -86,62 +98,6 @@ def _proxy(self) -> "InteractionChannelContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string created by Twilio to identify an Interaction Channel resource, prefixed with UO. - """ - return self._properties["sid"] - - @property - def interaction_sid(self) -> str: - """ - :returns: The unique string created by Twilio to identify an Interaction resource, prefixed with KD. - """ - return self._properties["interaction_sid"] - - @property - def type(self) -> "InteractionChannelInstance.Type": - """ - :returns: - """ - return self._properties["type"] - - @property - def status(self) -> "InteractionChannelInstance.ChannelStatus": - """ - :returns: - """ - return self._properties["status"] - - @property - def error_code(self) -> int: - """ - :returns: The Twilio error code for a failed channel. - """ - return self._properties["error_code"] - - @property - def error_message(self) -> str: - """ - :returns: The error message for a failed channel. - """ - return self._properties["error_message"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - def fetch(self) -> "InteractionChannelInstance": """ Fetch the InteractionChannelInstance diff --git a/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.py b/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.py index 6914a15e8..9b03db53a 100644 --- a/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.py +++ b/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_invite.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import serialize, values from twilio.base.instance_resource import InstanceResource @@ -23,60 +23,35 @@ class InteractionChannelInviteInstance(InstanceResource): - def __init__(self, version, payload, interaction_sid: str, channel_sid: str): - """ - Initialize the InteractionChannelInviteInstance - """ + + """ + :ivar sid: The unique string created by Twilio to identify an Interaction Channel Invite resource. + :ivar interaction_sid: The Interaction SID for this Channel. + :ivar channel_sid: The Channel SID for this Invite. + :ivar routing: A JSON object representing the routing rules for the Interaction Channel. See [Outbound SMS Example](https://www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#agent-initiated-outbound-interactions) for an example Routing object. The Interactions resource uses TaskRouter for all routing functionality. All attributes in the Routing object on your Interaction request body are added “as is” to the task. For a list of known attributes consumed by the Flex UI and/or Flex Insights, see [Known Task Attributes](https://www.twilio.com/docs/flex/developer/conversations/interactions-api#task-attributes). + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + interaction_sid: str, + channel_sid: str, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "interaction_sid": payload.get("interaction_sid"), - "channel_sid": payload.get("channel_sid"), - "routing": payload.get("routing"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.interaction_sid: Optional[str] = payload.get("interaction_sid") + self.channel_sid: Optional[str] = payload.get("channel_sid") + self.routing: Optional[Dict[str, object]] = payload.get("routing") + self.url: Optional[str] = payload.get("url") self._solution = { "interaction_sid": interaction_sid, "channel_sid": channel_sid, } - @property - def sid(self) -> str: - """ - :returns: The unique string created by Twilio to identify an Interaction Channel Invite resource. - """ - return self._properties["sid"] - - @property - def interaction_sid(self) -> str: - """ - :returns: The Interaction SID for this Channel. - """ - return self._properties["interaction_sid"] - - @property - def channel_sid(self) -> str: - """ - :returns: The Channel SID for this Invite. - """ - return self._properties["channel_sid"] - - @property - def routing(self) -> Dict[str, object]: - """ - :returns: A JSON object representing the routing rules for the Interaction Channel. See [Outbound SMS Example](https://www.twilio.com/docs/flex/developer/conversations/interactions-api/interactions#agent-initiated-outbound-interactions) for an example Routing object. The Interactions resource uses TaskRouter for all routing functionality. All attributes in the Routing object on your Interaction request body are added “as is” to the task. For a list of known attributes consumed by the Flex UI and/or Flex Insights, see [Known Task Attributes](https://www.twilio.com/docs/flex/developer/conversations/interactions-api#task-attributes). - """ - return self._properties["routing"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.py b/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.py index c79cef8fa..70f257bd7 100644 --- a/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.py +++ b/twilio/rest/flex_api/v1/interaction/interaction_channel/interaction_channel_participant.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -30,31 +30,36 @@ class Type(object): AGENT = "agent" UNKNOWN = "unknown" + """ + :ivar sid: The unique string created by Twilio to identify an Interaction Channel Participant resource. + :ivar type: + :ivar interaction_sid: The Interaction Sid for this channel. + :ivar channel_sid: The Channel Sid for this Participant. + :ivar url: + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], interaction_sid: str, channel_sid: str, sid: Optional[str] = None, ): - """ - Initialize the InteractionChannelParticipantInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "type": payload.get("type"), - "interaction_sid": payload.get("interaction_sid"), - "channel_sid": payload.get("channel_sid"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.type: Optional["InteractionChannelParticipantInstance.Type"] = payload.get( + "type" + ) + self.interaction_sid: Optional[str] = payload.get("interaction_sid") + self.channel_sid: Optional[str] = payload.get("channel_sid") + self.url: Optional[str] = payload.get("url") self._solution = { "interaction_sid": interaction_sid, "channel_sid": channel_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[InteractionChannelParticipantContext] = None @@ -75,41 +80,6 @@ def _proxy(self) -> "InteractionChannelParticipantContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string created by Twilio to identify an Interaction Channel Participant resource. - """ - return self._properties["sid"] - - @property - def type(self) -> "InteractionChannelParticipantInstance.Type": - """ - :returns: - """ - return self._properties["type"] - - @property - def interaction_sid(self) -> str: - """ - :returns: The Interaction Sid for this channel. - """ - return self._properties["interaction_sid"] - - @property - def channel_sid(self) -> str: - """ - :returns: The Channel Sid for this Participant. - """ - return self._properties["channel_sid"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def update(self, status) -> "InteractionChannelParticipantInstance": """ Update the InteractionChannelParticipantInstance diff --git a/twilio/rest/flex_api/v1/web_channel.py b/twilio/rest/flex_api/v1/web_channel.py index f895977f3..ddb23b520 100644 --- a/twilio/rest/flex_api/v1/web_channel.py +++ b/twilio/rest/flex_api/v1/web_channel.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,23 +24,34 @@ class WebChannelInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the WebChannelInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the WebChannel resource and owns this Workflow. + :ivar flex_flow_sid: The SID of the Flex Flow. + :ivar sid: The unique string that we created to identify the WebChannel resource. + :ivar url: The absolute URL of the WebChannel resource. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "flex_flow_sid": payload.get("flex_flow_sid"), - "sid": payload.get("sid"), - "url": payload.get("url"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.flex_flow_sid: Optional[str] = payload.get("flex_flow_sid") + self.sid: Optional[str] = payload.get("sid") + self.url: Optional[str] = payload.get("url") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[WebChannelContext] = None @@ -59,48 +70,6 @@ def _proxy(self) -> "WebChannelContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the WebChannel resource and owns this Workflow. - """ - return self._properties["account_sid"] - - @property - def flex_flow_sid(self) -> str: - """ - :returns: The SID of the Flex Flow. - """ - return self._properties["flex_flow_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the WebChannel resource. - """ - return self._properties["sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the WebChannel resource. - """ - return self._properties["url"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - def delete(self) -> bool: """ Deletes the WebChannelInstance diff --git a/twilio/rest/flex_api/v2/web_channels.py b/twilio/rest/flex_api/v2/web_channels.py index 07d5f1042..b2a09afd6 100644 --- a/twilio/rest/flex_api/v2/web_channels.py +++ b/twilio/rest/flex_api/v2/web_channels.py @@ -13,6 +13,7 @@ """ +from typing import Any, Dict, Optional from twilio.base import values from twilio.base.instance_resource import InstanceResource @@ -21,32 +22,19 @@ class WebChannelsInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the WebChannelsInstance - """ - super().__init__(version) - self._properties = { - "conversation_sid": payload.get("conversation_sid"), - "identity": payload.get("identity"), - } + """ + :ivar conversation_sid: The unique string representing the [Conversation resource](https://www.twilio.com/docs/conversations/api/conversation-resource) created. + :ivar identity: The unique string representing the User created and should be authorized to participate in the Conversation. For more details, see [User Identity & Access Tokens](https://www.twilio.com/docs/conversations/identity). + """ - self._solution = {} + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) - @property - def conversation_sid(self) -> str: - """ - :returns: The unique string representing the [Conversation resource](https://www.twilio.com/docs/conversations/api/conversation-resource) created. - """ - return self._properties["conversation_sid"] + self.conversation_sid: Optional[str] = payload.get("conversation_sid") + self.identity: Optional[str] = payload.get("identity") - @property - def identity(self) -> str: - """ - :returns: The unique string representing the User created and should be authorized to participate in the Conversation. For more details, see [User Identity & Access Tokens](https://www.twilio.com/docs/conversations/identity). - """ - return self._properties["identity"] + self._solution = {} def __repr__(self) -> str: """ diff --git a/twilio/rest/frontline_api/v1/user.py b/twilio/rest/frontline_api/v1/user.py index e6152c873..79760e6da 100644 --- a/twilio/rest/frontline_api/v1/user.py +++ b/twilio/rest/frontline_api/v1/user.py @@ -13,7 +13,7 @@ """ -from typing import Optional +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 @@ -26,24 +26,31 @@ class StateType(object): ACTIVE = "active" DEACTIVATED = "deactivated" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the UserInstance - """ + """ + :ivar sid: The unique string that we created to identify the User resource. + :ivar identity: The application-defined string that uniquely identifies the resource's User. This value is often a username or an email address, and is case-sensitive. + :ivar friendly_name: The string that you assigned to describe the User. + :ivar avatar: The avatar URL which will be shown in Frontline application. + :ivar state: + :ivar is_available: Whether the User is available for new conversations. Defaults to `false` for new users. + :ivar url: An absolute API resource URL for this user. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "identity": payload.get("identity"), - "friendly_name": payload.get("friendly_name"), - "avatar": payload.get("avatar"), - "state": payload.get("state"), - "is_available": payload.get("is_available"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.identity: Optional[str] = payload.get("identity") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.avatar: Optional[str] = payload.get("avatar") + self.state: Optional["UserInstance.StateType"] = payload.get("state") + self.is_available: Optional[bool] = payload.get("is_available") + self.url: Optional[str] = payload.get("url") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[UserContext] = None @@ -62,55 +69,6 @@ def _proxy(self) -> "UserContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the User resource. - """ - return self._properties["sid"] - - @property - def identity(self) -> str: - """ - :returns: The application-defined string that uniquely identifies the resource's User. This value is often a username or an email address, and is case-sensitive. - """ - return self._properties["identity"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the User. - """ - return self._properties["friendly_name"] - - @property - def avatar(self) -> str: - """ - :returns: The avatar URL which will be shown in Frontline application. - """ - return self._properties["avatar"] - - @property - def state(self) -> "UserInstance.StateType": - """ - :returns: - """ - return self._properties["state"] - - @property - def is_available(self) -> bool: - """ - :returns: Whether the User is available for new conversations. Defaults to `false` for new users. - """ - return self._properties["is_available"] - - @property - def url(self) -> str: - """ - :returns: An absolute API resource URL for this user. - """ - return self._properties["url"] - def fetch(self) -> "UserInstance": """ Fetch the UserInstance diff --git a/twilio/rest/insights/v1/call/__init__.py b/twilio/rest/insights/v1/call/__init__.py index e905f9838..f0548a000 100644 --- a/twilio/rest/insights/v1/call/__init__.py +++ b/twilio/rest/insights/v1/call/__init__.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -26,20 +26,24 @@ class CallInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the CallInstance - """ + + """ + :ivar sid: + :ivar url: + :ivar links: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[CallContext] = None @@ -58,27 +62,6 @@ def _proxy(self) -> "CallContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - def fetch(self) -> "CallInstance": """ Fetch the CallInstance diff --git a/twilio/rest/insights/v1/call/annotation.py b/twilio/rest/insights/v1/call/annotation.py index df5175777..7c76f0c05 100644 --- a/twilio/rest/insights/v1/call/annotation.py +++ b/twilio/rest/insights/v1/call/annotation.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -35,24 +35,36 @@ class ConnectivityIssue(object): DROPPED_CALL = "dropped_call" NUMBER_REACHABILITY = "number_reachability" - def __init__(self, version, payload, call_sid: str): - """ - Initialize the AnnotationInstance - """ + """ + :ivar call_sid: The unique SID identifier of the Call. + :ivar account_sid: The unique SID identifier of the Account. + :ivar answered_by: + :ivar connectivity_issue: + :ivar quality_issues: Specify if the call had any subjective quality issues. Possible values, one or more of: no_quality_issue, low_volume, choppy_robotic, echo, dtmf, latency, owa, static_noise. Use comma separated values to indicate multiple quality issues for the same call + :ivar spam: Specify if the call was a spam call. Use this to provide feedback on whether calls placed from your account were marked as spam, or if inbound calls received by your account were unwanted spam. Is of type Boolean: true, false. Use true if the call was a spam call. + :ivar call_score: Specify the call score. This is of type integer. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for rating the call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. + :ivar comment: Specify any comments pertaining to the call. This of type string with a max limit of 100 characters. Twilio does not treat this field as PII, so don’t put any PII in here. + :ivar incident: Associate this call with an incident or support ticket. This is of type string with a max limit of 100 characters. Twilio does not treat this field as PII, so don’t put any PII in here. + :ivar url: The URL of this resource. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], call_sid: str): super().__init__(version) - self._properties = { - "call_sid": payload.get("call_sid"), - "account_sid": payload.get("account_sid"), - "answered_by": payload.get("answered_by"), - "connectivity_issue": payload.get("connectivity_issue"), - "quality_issues": payload.get("quality_issues"), - "spam": payload.get("spam"), - "call_score": deserialize.integer(payload.get("call_score")), - "comment": payload.get("comment"), - "incident": payload.get("incident"), - "url": payload.get("url"), - } + self.call_sid: Optional[str] = payload.get("call_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.answered_by: Optional["AnnotationInstance.AnsweredBy"] = payload.get( + "answered_by" + ) + self.connectivity_issue: Optional[ + "AnnotationInstance.ConnectivityIssue" + ] = payload.get("connectivity_issue") + self.quality_issues: Optional[List[str]] = payload.get("quality_issues") + self.spam: Optional[bool] = payload.get("spam") + self.call_score: Optional[int] = deserialize.integer(payload.get("call_score")) + self.comment: Optional[str] = payload.get("comment") + self.incident: Optional[str] = payload.get("incident") + self.url: Optional[str] = payload.get("url") self._solution = { "call_sid": call_sid, @@ -74,76 +86,6 @@ def _proxy(self) -> "AnnotationContext": ) return self._context - @property - def call_sid(self) -> str: - """ - :returns: The unique SID identifier of the Call. - """ - return self._properties["call_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The unique SID identifier of the Account. - """ - return self._properties["account_sid"] - - @property - def answered_by(self) -> "AnnotationInstance.AnsweredBy": - """ - :returns: - """ - return self._properties["answered_by"] - - @property - def connectivity_issue(self) -> "AnnotationInstance.ConnectivityIssue": - """ - :returns: - """ - return self._properties["connectivity_issue"] - - @property - def quality_issues(self) -> List[str]: - """ - :returns: Specify if the call had any subjective quality issues. Possible values, one or more of: no_quality_issue, low_volume, choppy_robotic, echo, dtmf, latency, owa, static_noise. Use comma separated values to indicate multiple quality issues for the same call - """ - return self._properties["quality_issues"] - - @property - def spam(self) -> bool: - """ - :returns: Specify if the call was a spam call. Use this to provide feedback on whether calls placed from your account were marked as spam, or if inbound calls received by your account were unwanted spam. Is of type Boolean: true, false. Use true if the call was a spam call. - """ - return self._properties["spam"] - - @property - def call_score(self) -> int: - """ - :returns: Specify the call score. This is of type integer. Use a range of 1-5 to indicate the call experience score, with the following mapping as a reference for rating the call [5: Excellent, 4: Good, 3 : Fair, 2 : Poor, 1: Bad]. - """ - return self._properties["call_score"] - - @property - def comment(self) -> str: - """ - :returns: Specify any comments pertaining to the call. This of type string with a max limit of 100 characters. Twilio does not treat this field as PII, so don’t put any PII in here. - """ - return self._properties["comment"] - - @property - def incident(self) -> str: - """ - :returns: Associate this call with an incident or support ticket. This is of type string with a max limit of 100 characters. Twilio does not treat this field as PII, so don’t put any PII in here. - """ - return self._properties["incident"] - - @property - def url(self) -> str: - """ - :returns: The URL of this resource. - """ - return self._properties["url"] - def fetch(self) -> "AnnotationInstance": """ Fetch the AnnotationInstance diff --git a/twilio/rest/insights/v1/call/call_summary.py b/twilio/rest/insights/v1/call/call_summary.py index 53cc58006..e46e091c9 100644 --- a/twilio/rest/insights/v1/call/call_summary.py +++ b/twilio/rest/insights/v1/call/call_summary.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -52,37 +52,74 @@ class ProcessingState(object): COMPLETE = "complete" PARTIAL = "partial" - def __init__(self, version, payload, call_sid: str): - """ - Initialize the CallSummaryInstance - """ + """ + :ivar account_sid: + :ivar call_sid: + :ivar call_type: + :ivar call_state: + :ivar answered_by: + :ivar processing_state: + :ivar created_time: + :ivar start_time: + :ivar end_time: + :ivar duration: + :ivar connect_duration: + :ivar _from: + :ivar to: + :ivar carrier_edge: + :ivar client_edge: + :ivar sdk_edge: + :ivar sip_edge: + :ivar tags: + :ivar url: + :ivar attributes: + :ivar properties: + :ivar trust: + :ivar annotation: + """ + + def __init__(self, version: Version, payload: Dict[str, Any], call_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "call_sid": payload.get("call_sid"), - "call_type": payload.get("call_type"), - "call_state": payload.get("call_state"), - "answered_by": payload.get("answered_by"), - "processing_state": payload.get("processing_state"), - "created_time": deserialize.iso8601_datetime(payload.get("created_time")), - "start_time": deserialize.iso8601_datetime(payload.get("start_time")), - "end_time": deserialize.iso8601_datetime(payload.get("end_time")), - "duration": deserialize.integer(payload.get("duration")), - "connect_duration": deserialize.integer(payload.get("connect_duration")), - "_from": payload.get("from"), - "to": payload.get("to"), - "carrier_edge": payload.get("carrier_edge"), - "client_edge": payload.get("client_edge"), - "sdk_edge": payload.get("sdk_edge"), - "sip_edge": payload.get("sip_edge"), - "tags": payload.get("tags"), - "url": payload.get("url"), - "attributes": payload.get("attributes"), - "properties": payload.get("properties"), - "trust": payload.get("trust"), - "annotation": payload.get("annotation"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.call_sid: Optional[str] = payload.get("call_sid") + self.call_type: Optional["CallSummaryInstance.CallType"] = payload.get( + "call_type" + ) + self.call_state: Optional["CallSummaryInstance.CallState"] = payload.get( + "call_state" + ) + self.answered_by: Optional["CallSummaryInstance.AnsweredBy"] = payload.get( + "answered_by" + ) + self.processing_state: Optional[ + "CallSummaryInstance.ProcessingState" + ] = payload.get("processing_state") + self.created_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("created_time") + ) + self.start_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("start_time") + ) + self.end_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("end_time") + ) + self.duration: Optional[int] = deserialize.integer(payload.get("duration")) + self.connect_duration: Optional[int] = deserialize.integer( + payload.get("connect_duration") + ) + self._from: Optional[Dict[str, object]] = payload.get("from") + self.to: Optional[Dict[str, object]] = payload.get("to") + self.carrier_edge: Optional[Dict[str, object]] = payload.get("carrier_edge") + self.client_edge: Optional[Dict[str, object]] = payload.get("client_edge") + self.sdk_edge: Optional[Dict[str, object]] = payload.get("sdk_edge") + self.sip_edge: Optional[Dict[str, object]] = payload.get("sip_edge") + self.tags: Optional[List[str]] = payload.get("tags") + self.url: Optional[str] = payload.get("url") + self.attributes: Optional[Dict[str, object]] = payload.get("attributes") + self.properties: Optional[Dict[str, object]] = payload.get("properties") + self.trust: Optional[Dict[str, object]] = payload.get("trust") + self.annotation: Optional[Dict[str, object]] = payload.get("annotation") self._solution = { "call_sid": call_sid, @@ -104,167 +141,6 @@ def _proxy(self) -> "CallSummaryContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def call_sid(self) -> str: - """ - :returns: - """ - return self._properties["call_sid"] - - @property - def call_type(self) -> "CallSummaryInstance.CallType": - """ - :returns: - """ - return self._properties["call_type"] - - @property - def call_state(self) -> "CallSummaryInstance.CallState": - """ - :returns: - """ - return self._properties["call_state"] - - @property - def answered_by(self) -> "CallSummaryInstance.AnsweredBy": - """ - :returns: - """ - return self._properties["answered_by"] - - @property - def processing_state(self) -> "CallSummaryInstance.ProcessingState": - """ - :returns: - """ - return self._properties["processing_state"] - - @property - def created_time(self) -> datetime: - """ - :returns: - """ - return self._properties["created_time"] - - @property - def start_time(self) -> datetime: - """ - :returns: - """ - return self._properties["start_time"] - - @property - def end_time(self) -> datetime: - """ - :returns: - """ - return self._properties["end_time"] - - @property - def duration(self) -> int: - """ - :returns: - """ - return self._properties["duration"] - - @property - def connect_duration(self) -> int: - """ - :returns: - """ - return self._properties["connect_duration"] - - @property - def _from(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["_from"] - - @property - def to(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["to"] - - @property - def carrier_edge(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["carrier_edge"] - - @property - def client_edge(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["client_edge"] - - @property - def sdk_edge(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["sdk_edge"] - - @property - def sip_edge(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["sip_edge"] - - @property - def tags(self) -> List[str]: - """ - :returns: - """ - return self._properties["tags"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def attributes(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["attributes"] - - @property - def properties(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["properties"] - - @property - def trust(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["trust"] - - @property - def annotation(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["annotation"] - def fetch(self, processing_state=values.unset) -> "CallSummaryInstance": """ Fetch the CallSummaryInstance diff --git a/twilio/rest/insights/v1/call/event.py b/twilio/rest/insights/v1/call/event.py index 144e43799..7aa0b8439 100644 --- a/twilio/rest/insights/v1/call/event.py +++ b/twilio/rest/insights/v1/call/event.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_resource import InstanceResource @@ -37,107 +37,39 @@ class TwilioEdge(object): SDK_EDGE = "sdk_edge" CLIENT_EDGE = "client_edge" - def __init__(self, version, payload, call_sid: str): - """ - Initialize the EventInstance - """ + """ + :ivar timestamp: + :ivar call_sid: + :ivar account_sid: + :ivar edge: + :ivar group: + :ivar level: + :ivar name: + :ivar carrier_edge: + :ivar sip_edge: + :ivar sdk_edge: + :ivar client_edge: + """ + + def __init__(self, version: Version, payload: Dict[str, Any], call_sid: str): super().__init__(version) - self._properties = { - "timestamp": payload.get("timestamp"), - "call_sid": payload.get("call_sid"), - "account_sid": payload.get("account_sid"), - "edge": payload.get("edge"), - "group": payload.get("group"), - "level": payload.get("level"), - "name": payload.get("name"), - "carrier_edge": payload.get("carrier_edge"), - "sip_edge": payload.get("sip_edge"), - "sdk_edge": payload.get("sdk_edge"), - "client_edge": payload.get("client_edge"), - } + self.timestamp: Optional[str] = payload.get("timestamp") + self.call_sid: Optional[str] = payload.get("call_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.edge: Optional["EventInstance.TwilioEdge"] = payload.get("edge") + self.group: Optional[str] = payload.get("group") + self.level: Optional["EventInstance.Level"] = payload.get("level") + self.name: Optional[str] = payload.get("name") + self.carrier_edge: Optional[Dict[str, object]] = payload.get("carrier_edge") + self.sip_edge: Optional[Dict[str, object]] = payload.get("sip_edge") + self.sdk_edge: Optional[Dict[str, object]] = payload.get("sdk_edge") + self.client_edge: Optional[Dict[str, object]] = payload.get("client_edge") self._solution = { "call_sid": call_sid, } - @property - def timestamp(self) -> str: - """ - :returns: - """ - return self._properties["timestamp"] - - @property - def call_sid(self) -> str: - """ - :returns: - """ - return self._properties["call_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def edge(self) -> "EventInstance.TwilioEdge": - """ - :returns: - """ - return self._properties["edge"] - - @property - def group(self) -> str: - """ - :returns: - """ - return self._properties["group"] - - @property - def level(self) -> "EventInstance.Level": - """ - :returns: - """ - return self._properties["level"] - - @property - def name(self) -> str: - """ - :returns: - """ - return self._properties["name"] - - @property - def carrier_edge(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["carrier_edge"] - - @property - def sip_edge(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["sip_edge"] - - @property - def sdk_edge(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["sdk_edge"] - - @property - def client_edge(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["client_edge"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/insights/v1/call/metric.py b/twilio/rest/insights/v1/call/metric.py index d3db5d9cc..52bde0bae 100644 --- a/twilio/rest/insights/v1/call/metric.py +++ b/twilio/rest/insights/v1/call/metric.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_resource import InstanceResource @@ -36,91 +36,37 @@ class TwilioEdge(object): SDK_EDGE = "sdk_edge" CLIENT_EDGE = "client_edge" - def __init__(self, version, payload, call_sid: str): - """ - Initialize the MetricInstance - """ + """ + :ivar timestamp: + :ivar call_sid: + :ivar account_sid: + :ivar edge: + :ivar direction: + :ivar carrier_edge: + :ivar sip_edge: + :ivar sdk_edge: + :ivar client_edge: + """ + + def __init__(self, version: Version, payload: Dict[str, Any], call_sid: str): super().__init__(version) - self._properties = { - "timestamp": payload.get("timestamp"), - "call_sid": payload.get("call_sid"), - "account_sid": payload.get("account_sid"), - "edge": payload.get("edge"), - "direction": payload.get("direction"), - "carrier_edge": payload.get("carrier_edge"), - "sip_edge": payload.get("sip_edge"), - "sdk_edge": payload.get("sdk_edge"), - "client_edge": payload.get("client_edge"), - } + self.timestamp: Optional[str] = payload.get("timestamp") + self.call_sid: Optional[str] = payload.get("call_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.edge: Optional["MetricInstance.TwilioEdge"] = payload.get("edge") + self.direction: Optional["MetricInstance.StreamDirection"] = payload.get( + "direction" + ) + self.carrier_edge: Optional[Dict[str, object]] = payload.get("carrier_edge") + self.sip_edge: Optional[Dict[str, object]] = payload.get("sip_edge") + self.sdk_edge: Optional[Dict[str, object]] = payload.get("sdk_edge") + self.client_edge: Optional[Dict[str, object]] = payload.get("client_edge") self._solution = { "call_sid": call_sid, } - @property - def timestamp(self) -> str: - """ - :returns: - """ - return self._properties["timestamp"] - - @property - def call_sid(self) -> str: - """ - :returns: - """ - return self._properties["call_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def edge(self) -> "MetricInstance.TwilioEdge": - """ - :returns: - """ - return self._properties["edge"] - - @property - def direction(self) -> "MetricInstance.StreamDirection": - """ - :returns: - """ - return self._properties["direction"] - - @property - def carrier_edge(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["carrier_edge"] - - @property - def sip_edge(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["sip_edge"] - - @property - def sdk_edge(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["sdk_edge"] - - @property - def client_edge(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["client_edge"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/insights/v1/call_summaries.py b/twilio/rest/insights/v1/call_summaries.py index d9a1abb8c..9c03614f8 100644 --- a/twilio/rest/insights/v1/call_summaries.py +++ b/twilio/rest/insights/v1/call_summaries.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -63,193 +63,75 @@ class SortBy(object): START_TIME = "start_time" END_TIME = "end_time" - def __init__(self, version, payload): - """ - Initialize the CallSummariesInstance - """ + """ + :ivar account_sid: + :ivar call_sid: + :ivar answered_by: + :ivar call_type: + :ivar call_state: + :ivar processing_state: + :ivar created_time: + :ivar start_time: + :ivar end_time: + :ivar duration: + :ivar connect_duration: + :ivar _from: + :ivar to: + :ivar carrier_edge: + :ivar client_edge: + :ivar sdk_edge: + :ivar sip_edge: + :ivar tags: + :ivar url: + :ivar attributes: + :ivar properties: + :ivar trust: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "call_sid": payload.get("call_sid"), - "answered_by": payload.get("answered_by"), - "call_type": payload.get("call_type"), - "call_state": payload.get("call_state"), - "processing_state": payload.get("processing_state"), - "created_time": deserialize.iso8601_datetime(payload.get("created_time")), - "start_time": deserialize.iso8601_datetime(payload.get("start_time")), - "end_time": deserialize.iso8601_datetime(payload.get("end_time")), - "duration": deserialize.integer(payload.get("duration")), - "connect_duration": deserialize.integer(payload.get("connect_duration")), - "_from": payload.get("from"), - "to": payload.get("to"), - "carrier_edge": payload.get("carrier_edge"), - "client_edge": payload.get("client_edge"), - "sdk_edge": payload.get("sdk_edge"), - "sip_edge": payload.get("sip_edge"), - "tags": payload.get("tags"), - "url": payload.get("url"), - "attributes": payload.get("attributes"), - "properties": payload.get("properties"), - "trust": payload.get("trust"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.call_sid: Optional[str] = payload.get("call_sid") + self.answered_by: Optional["CallSummariesInstance.AnsweredBy"] = payload.get( + "answered_by" + ) + self.call_type: Optional["CallSummariesInstance.CallType"] = payload.get( + "call_type" + ) + self.call_state: Optional["CallSummariesInstance.CallState"] = payload.get( + "call_state" + ) + self.processing_state: Optional[ + "CallSummariesInstance.ProcessingState" + ] = payload.get("processing_state") + self.created_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("created_time") + ) + self.start_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("start_time") + ) + self.end_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("end_time") + ) + self.duration: Optional[int] = deserialize.integer(payload.get("duration")) + self.connect_duration: Optional[int] = deserialize.integer( + payload.get("connect_duration") + ) + self._from: Optional[Dict[str, object]] = payload.get("from") + self.to: Optional[Dict[str, object]] = payload.get("to") + self.carrier_edge: Optional[Dict[str, object]] = payload.get("carrier_edge") + self.client_edge: Optional[Dict[str, object]] = payload.get("client_edge") + self.sdk_edge: Optional[Dict[str, object]] = payload.get("sdk_edge") + self.sip_edge: Optional[Dict[str, object]] = payload.get("sip_edge") + self.tags: Optional[List[str]] = payload.get("tags") + self.url: Optional[str] = payload.get("url") + self.attributes: Optional[Dict[str, object]] = payload.get("attributes") + self.properties: Optional[Dict[str, object]] = payload.get("properties") + self.trust: Optional[Dict[str, object]] = payload.get("trust") self._solution = {} - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def call_sid(self) -> str: - """ - :returns: - """ - return self._properties["call_sid"] - - @property - def answered_by(self) -> "CallSummariesInstance.AnsweredBy": - """ - :returns: - """ - return self._properties["answered_by"] - - @property - def call_type(self) -> "CallSummariesInstance.CallType": - """ - :returns: - """ - return self._properties["call_type"] - - @property - def call_state(self) -> "CallSummariesInstance.CallState": - """ - :returns: - """ - return self._properties["call_state"] - - @property - def processing_state(self) -> "CallSummariesInstance.ProcessingState": - """ - :returns: - """ - return self._properties["processing_state"] - - @property - def created_time(self) -> datetime: - """ - :returns: - """ - return self._properties["created_time"] - - @property - def start_time(self) -> datetime: - """ - :returns: - """ - return self._properties["start_time"] - - @property - def end_time(self) -> datetime: - """ - :returns: - """ - return self._properties["end_time"] - - @property - def duration(self) -> int: - """ - :returns: - """ - return self._properties["duration"] - - @property - def connect_duration(self) -> int: - """ - :returns: - """ - return self._properties["connect_duration"] - - @property - def _from(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["_from"] - - @property - def to(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["to"] - - @property - def carrier_edge(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["carrier_edge"] - - @property - def client_edge(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["client_edge"] - - @property - def sdk_edge(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["sdk_edge"] - - @property - def sip_edge(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["sip_edge"] - - @property - def tags(self) -> List[str]: - """ - :returns: - """ - return self._properties["tags"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def attributes(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["attributes"] - - @property - def properties(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["properties"] - - @property - def trust(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["trust"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/insights/v1/conference/__init__.py b/twilio/rest/insights/v1/conference/__init__.py index 5f2cba164..7dd551a1b 100644 --- a/twilio/rest/insights/v1/conference/__init__.py +++ b/twilio/rest/insights/v1/conference/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -71,46 +71,94 @@ class Tag(object): LOW_MOS = "low_mos" DETECTED_SILENCE = "detected_silence" - def __init__(self, version, payload, conference_sid: Optional[str] = None): - """ - Initialize the ConferenceInstance - """ + """ + :ivar conference_sid: The unique SID identifier of the Conference. + :ivar account_sid: The unique SID identifier of the Account. + :ivar friendly_name: Custom label for the conference resource, up to 64 characters. + :ivar create_time: Conference creation date and time in ISO 8601 format. + :ivar start_time: Timestamp in ISO 8601 format when the conference started. Conferences do not start until at least two participants join, at least one of whom has startConferenceOnEnter=true. + :ivar end_time: Conference end date and time in ISO 8601 format. + :ivar duration_seconds: Conference duration in seconds. + :ivar connect_duration_seconds: Duration of the between conference start event and conference end event in seconds. + :ivar status: + :ivar max_participants: Maximum number of concurrent participants as specified by the configuration. + :ivar max_concurrent_participants: Actual maximum number of concurrent participants in the conference. + :ivar unique_participants: Unique conference participants based on caller ID. + :ivar end_reason: + :ivar ended_by: Call SID of the participant whose actions ended the conference. + :ivar mixer_region: + :ivar mixer_region_requested: + :ivar recording_enabled: Boolean. Indicates whether recording was enabled at the conference mixer. + :ivar detected_issues: Potential issues detected by Twilio during the conference. + :ivar tags: Tags for detected conference conditions and participant behaviors which may be of interest. + :ivar tag_info: Object. Contains details about conference tags including severity. + :ivar processing_state: + :ivar url: The URL of this resource. + :ivar links: Contains a dictionary of URL links to nested resources of this Conference. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + conference_sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "conference_sid": payload.get("conference_sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "create_time": deserialize.iso8601_datetime(payload.get("create_time")), - "start_time": deserialize.iso8601_datetime(payload.get("start_time")), - "end_time": deserialize.iso8601_datetime(payload.get("end_time")), - "duration_seconds": deserialize.integer(payload.get("duration_seconds")), - "connect_duration_seconds": deserialize.integer( - payload.get("connect_duration_seconds") - ), - "status": payload.get("status"), - "max_participants": deserialize.integer(payload.get("max_participants")), - "max_concurrent_participants": deserialize.integer( - payload.get("max_concurrent_participants") - ), - "unique_participants": deserialize.integer( - payload.get("unique_participants") - ), - "end_reason": payload.get("end_reason"), - "ended_by": payload.get("ended_by"), - "mixer_region": payload.get("mixer_region"), - "mixer_region_requested": payload.get("mixer_region_requested"), - "recording_enabled": payload.get("recording_enabled"), - "detected_issues": payload.get("detected_issues"), - "tags": payload.get("tags"), - "tag_info": payload.get("tag_info"), - "processing_state": payload.get("processing_state"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.conference_sid: Optional[str] = payload.get("conference_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.create_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("create_time") + ) + self.start_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("start_time") + ) + self.end_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("end_time") + ) + self.duration_seconds: Optional[int] = deserialize.integer( + payload.get("duration_seconds") + ) + self.connect_duration_seconds: Optional[int] = deserialize.integer( + payload.get("connect_duration_seconds") + ) + self.status: Optional["ConferenceInstance.ConferenceStatus"] = payload.get( + "status" + ) + self.max_participants: Optional[int] = deserialize.integer( + payload.get("max_participants") + ) + self.max_concurrent_participants: Optional[int] = deserialize.integer( + payload.get("max_concurrent_participants") + ) + self.unique_participants: Optional[int] = deserialize.integer( + payload.get("unique_participants") + ) + self.end_reason: Optional[ + "ConferenceInstance.ConferenceEndReason" + ] = payload.get("end_reason") + self.ended_by: Optional[str] = payload.get("ended_by") + self.mixer_region: Optional["ConferenceInstance.Region"] = payload.get( + "mixer_region" + ) + self.mixer_region_requested: Optional[ + "ConferenceInstance.Region" + ] = payload.get("mixer_region_requested") + self.recording_enabled: Optional[bool] = payload.get("recording_enabled") + self.detected_issues: Optional[Dict[str, object]] = payload.get( + "detected_issues" + ) + self.tags: Optional[List["ConferenceInstance.Tag"]] = payload.get("tags") + self.tag_info: Optional[Dict[str, object]] = payload.get("tag_info") + self.processing_state: Optional[ + "ConferenceInstance.ProcessingState" + ] = payload.get("processing_state") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "conference_sid": conference_sid or self._properties["conference_sid"], + "conference_sid": conference_sid or self.conference_sid, } self._context: Optional[ConferenceContext] = None @@ -129,167 +177,6 @@ def _proxy(self) -> "ConferenceContext": ) return self._context - @property - def conference_sid(self) -> str: - """ - :returns: The unique SID identifier of the Conference. - """ - return self._properties["conference_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The unique SID identifier of the Account. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: Custom label for the conference resource, up to 64 characters. - """ - return self._properties["friendly_name"] - - @property - def create_time(self) -> datetime: - """ - :returns: Conference creation date and time in ISO 8601 format. - """ - return self._properties["create_time"] - - @property - def start_time(self) -> datetime: - """ - :returns: Timestamp in ISO 8601 format when the conference started. Conferences do not start until at least two participants join, at least one of whom has startConferenceOnEnter=true. - """ - return self._properties["start_time"] - - @property - def end_time(self) -> datetime: - """ - :returns: Conference end date and time in ISO 8601 format. - """ - return self._properties["end_time"] - - @property - def duration_seconds(self) -> int: - """ - :returns: Conference duration in seconds. - """ - return self._properties["duration_seconds"] - - @property - def connect_duration_seconds(self) -> int: - """ - :returns: Duration of the between conference start event and conference end event in seconds. - """ - return self._properties["connect_duration_seconds"] - - @property - def status(self) -> "ConferenceInstance.ConferenceStatus": - """ - :returns: - """ - return self._properties["status"] - - @property - def max_participants(self) -> int: - """ - :returns: Maximum number of concurrent participants as specified by the configuration. - """ - return self._properties["max_participants"] - - @property - def max_concurrent_participants(self) -> int: - """ - :returns: Actual maximum number of concurrent participants in the conference. - """ - return self._properties["max_concurrent_participants"] - - @property - def unique_participants(self) -> int: - """ - :returns: Unique conference participants based on caller ID. - """ - return self._properties["unique_participants"] - - @property - def end_reason(self) -> "ConferenceInstance.ConferenceEndReason": - """ - :returns: - """ - return self._properties["end_reason"] - - @property - def ended_by(self) -> str: - """ - :returns: Call SID of the participant whose actions ended the conference. - """ - return self._properties["ended_by"] - - @property - def mixer_region(self) -> "ConferenceInstance.Region": - """ - :returns: - """ - return self._properties["mixer_region"] - - @property - def mixer_region_requested(self) -> "ConferenceInstance.Region": - """ - :returns: - """ - return self._properties["mixer_region_requested"] - - @property - def recording_enabled(self) -> bool: - """ - :returns: Boolean. Indicates whether recording was enabled at the conference mixer. - """ - return self._properties["recording_enabled"] - - @property - def detected_issues(self) -> Dict[str, object]: - """ - :returns: Potential issues detected by Twilio during the conference. - """ - return self._properties["detected_issues"] - - @property - def tags(self) -> List["ConferenceInstance.Tag"]: - """ - :returns: Tags for detected conference conditions and participant behaviors which may be of interest. - """ - return self._properties["tags"] - - @property - def tag_info(self) -> Dict[str, object]: - """ - :returns: Object. Contains details about conference tags including severity. - """ - return self._properties["tag_info"] - - @property - def processing_state(self) -> "ConferenceInstance.ProcessingState": - """ - :returns: - """ - return self._properties["processing_state"] - - @property - def url(self) -> str: - """ - :returns: The URL of this resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: Contains a dictionary of URL links to nested resources of this Conference. - """ - return self._properties["links"] - def fetch(self) -> "ConferenceInstance": """ Fetch the ConferenceInstance diff --git a/twilio/rest/insights/v1/conference/conference_participant.py b/twilio/rest/insights/v1/conference/conference_participant.py index ab7e57d9b..15d964b91 100644 --- a/twilio/rest/insights/v1/conference/conference_participant.py +++ b/twilio/rest/insights/v1/conference/conference_participant.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -63,55 +63,102 @@ class Region(object): SG1 = "sg1" DE1 = "de1" + """ + :ivar participant_sid: SID for this participant. + :ivar label: The user-specified label of this participant. + :ivar conference_sid: The unique SID identifier of the Conference. + :ivar call_sid: Unique SID identifier of the call that generated the Participant resource. + :ivar account_sid: The unique SID identifier of the Account. + :ivar call_direction: + :ivar _from: Caller ID of the calling party. + :ivar to: Called party. + :ivar call_status: + :ivar country_code: ISO alpha-2 country code of the participant based on caller ID or called number. + :ivar is_moderator: Boolean. Indicates whether participant had startConferenceOnEnter=true or endConferenceOnExit=true. + :ivar join_time: ISO 8601 timestamp of participant join event. + :ivar leave_time: ISO 8601 timestamp of participant leave event. + :ivar duration_seconds: Participant durations in seconds. + :ivar outbound_queue_length: Add Participant API only. Estimated time in queue at call creation. + :ivar outbound_time_in_queue: Add Participant API only. Actual time in queue in seconds. + :ivar jitter_buffer_size: + :ivar is_coach: Boolean. Indicated whether participant was a coach. + :ivar coached_participants: Call SIDs coached by this participant. + :ivar participant_region: + :ivar conference_region: + :ivar call_type: + :ivar processing_state: + :ivar properties: Participant properties and metadata. + :ivar events: Object containing information of actions taken by participants. Contains a dictionary of URL links to nested resources of this Conference Participant. + :ivar metrics: Object. Contains participant call quality metrics. + :ivar url: The URL of this resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], conference_sid: str, participant_sid: Optional[str] = None, ): - """ - Initialize the ConferenceParticipantInstance - """ super().__init__(version) - self._properties = { - "participant_sid": payload.get("participant_sid"), - "label": payload.get("label"), - "conference_sid": payload.get("conference_sid"), - "call_sid": payload.get("call_sid"), - "account_sid": payload.get("account_sid"), - "call_direction": payload.get("call_direction"), - "_from": payload.get("from"), - "to": payload.get("to"), - "call_status": payload.get("call_status"), - "country_code": payload.get("country_code"), - "is_moderator": payload.get("is_moderator"), - "join_time": deserialize.iso8601_datetime(payload.get("join_time")), - "leave_time": deserialize.iso8601_datetime(payload.get("leave_time")), - "duration_seconds": deserialize.integer(payload.get("duration_seconds")), - "outbound_queue_length": deserialize.integer( - payload.get("outbound_queue_length") - ), - "outbound_time_in_queue": deserialize.integer( - payload.get("outbound_time_in_queue") - ), - "jitter_buffer_size": payload.get("jitter_buffer_size"), - "is_coach": payload.get("is_coach"), - "coached_participants": payload.get("coached_participants"), - "participant_region": payload.get("participant_region"), - "conference_region": payload.get("conference_region"), - "call_type": payload.get("call_type"), - "processing_state": payload.get("processing_state"), - "properties": payload.get("properties"), - "events": payload.get("events"), - "metrics": payload.get("metrics"), - "url": payload.get("url"), - } + self.participant_sid: Optional[str] = payload.get("participant_sid") + self.label: Optional[str] = payload.get("label") + self.conference_sid: Optional[str] = payload.get("conference_sid") + self.call_sid: Optional[str] = payload.get("call_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.call_direction: Optional[ + "ConferenceParticipantInstance.CallDirection" + ] = payload.get("call_direction") + self._from: Optional[str] = payload.get("from") + self.to: Optional[str] = payload.get("to") + self.call_status: Optional[ + "ConferenceParticipantInstance.CallStatus" + ] = payload.get("call_status") + self.country_code: Optional[str] = payload.get("country_code") + self.is_moderator: Optional[bool] = payload.get("is_moderator") + self.join_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("join_time") + ) + self.leave_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("leave_time") + ) + self.duration_seconds: Optional[int] = deserialize.integer( + payload.get("duration_seconds") + ) + self.outbound_queue_length: Optional[int] = deserialize.integer( + payload.get("outbound_queue_length") + ) + self.outbound_time_in_queue: Optional[int] = deserialize.integer( + payload.get("outbound_time_in_queue") + ) + self.jitter_buffer_size: Optional[ + "ConferenceParticipantInstance.JitterBufferSize" + ] = payload.get("jitter_buffer_size") + self.is_coach: Optional[bool] = payload.get("is_coach") + self.coached_participants: Optional[List[str]] = payload.get( + "coached_participants" + ) + self.participant_region: Optional[ + "ConferenceParticipantInstance.Region" + ] = payload.get("participant_region") + self.conference_region: Optional[ + "ConferenceParticipantInstance.Region" + ] = payload.get("conference_region") + self.call_type: Optional[ + "ConferenceParticipantInstance.CallType" + ] = payload.get("call_type") + self.processing_state: Optional[ + "ConferenceParticipantInstance.ProcessingState" + ] = payload.get("processing_state") + self.properties: Optional[Dict[str, object]] = payload.get("properties") + self.events: Optional[Dict[str, object]] = payload.get("events") + self.metrics: Optional[Dict[str, object]] = payload.get("metrics") + self.url: Optional[str] = payload.get("url") self._solution = { "conference_sid": conference_sid, - "participant_sid": participant_sid or self._properties["participant_sid"], + "participant_sid": participant_sid or self.participant_sid, } self._context: Optional[ConferenceParticipantContext] = None @@ -131,195 +178,6 @@ def _proxy(self) -> "ConferenceParticipantContext": ) return self._context - @property - def participant_sid(self) -> str: - """ - :returns: SID for this participant. - """ - return self._properties["participant_sid"] - - @property - def label(self) -> str: - """ - :returns: The user-specified label of this participant. - """ - return self._properties["label"] - - @property - def conference_sid(self) -> str: - """ - :returns: The unique SID identifier of the Conference. - """ - return self._properties["conference_sid"] - - @property - def call_sid(self) -> str: - """ - :returns: Unique SID identifier of the call that generated the Participant resource. - """ - return self._properties["call_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The unique SID identifier of the Account. - """ - return self._properties["account_sid"] - - @property - def call_direction(self) -> "ConferenceParticipantInstance.CallDirection": - """ - :returns: - """ - return self._properties["call_direction"] - - @property - def _from(self) -> str: - """ - :returns: Caller ID of the calling party. - """ - return self._properties["_from"] - - @property - def to(self) -> str: - """ - :returns: Called party. - """ - return self._properties["to"] - - @property - def call_status(self) -> "ConferenceParticipantInstance.CallStatus": - """ - :returns: - """ - return self._properties["call_status"] - - @property - def country_code(self) -> str: - """ - :returns: ISO alpha-2 country code of the participant based on caller ID or called number. - """ - return self._properties["country_code"] - - @property - def is_moderator(self) -> bool: - """ - :returns: Boolean. Indicates whether participant had startConferenceOnEnter=true or endConferenceOnExit=true. - """ - return self._properties["is_moderator"] - - @property - def join_time(self) -> datetime: - """ - :returns: ISO 8601 timestamp of participant join event. - """ - return self._properties["join_time"] - - @property - def leave_time(self) -> datetime: - """ - :returns: ISO 8601 timestamp of participant leave event. - """ - return self._properties["leave_time"] - - @property - def duration_seconds(self) -> int: - """ - :returns: Participant durations in seconds. - """ - return self._properties["duration_seconds"] - - @property - def outbound_queue_length(self) -> int: - """ - :returns: Add Participant API only. Estimated time in queue at call creation. - """ - return self._properties["outbound_queue_length"] - - @property - def outbound_time_in_queue(self) -> int: - """ - :returns: Add Participant API only. Actual time in queue in seconds. - """ - return self._properties["outbound_time_in_queue"] - - @property - def jitter_buffer_size(self) -> "ConferenceParticipantInstance.JitterBufferSize": - """ - :returns: - """ - return self._properties["jitter_buffer_size"] - - @property - def is_coach(self) -> bool: - """ - :returns: Boolean. Indicated whether participant was a coach. - """ - return self._properties["is_coach"] - - @property - def coached_participants(self) -> List[str]: - """ - :returns: Call SIDs coached by this participant. - """ - return self._properties["coached_participants"] - - @property - def participant_region(self) -> "ConferenceParticipantInstance.Region": - """ - :returns: - """ - return self._properties["participant_region"] - - @property - def conference_region(self) -> "ConferenceParticipantInstance.Region": - """ - :returns: - """ - return self._properties["conference_region"] - - @property - def call_type(self) -> "ConferenceParticipantInstance.CallType": - """ - :returns: - """ - return self._properties["call_type"] - - @property - def processing_state(self) -> "ConferenceParticipantInstance.ProcessingState": - """ - :returns: - """ - return self._properties["processing_state"] - - @property - def properties(self) -> Dict[str, object]: - """ - :returns: Participant properties and metadata. - """ - return self._properties["properties"] - - @property - def events(self) -> Dict[str, object]: - """ - :returns: Object containing information of actions taken by participants. Contains a dictionary of URL links to nested resources of this Conference Participant. - """ - return self._properties["events"] - - @property - def metrics(self) -> Dict[str, object]: - """ - :returns: Object. Contains participant call quality metrics. - """ - return self._properties["metrics"] - - @property - def url(self) -> str: - """ - :returns: The URL of this resource. - """ - return self._properties["url"] - def fetch( self, events=values.unset, metrics=values.unset ) -> "ConferenceParticipantInstance": diff --git a/twilio/rest/insights/v1/room/__init__.py b/twilio/rest/insights/v1/room/__init__.py index fd3f5e68f..a1ff35c54 100644 --- a/twilio/rest/insights/v1/room/__init__.py +++ b/twilio/rest/insights/v1/room/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -76,53 +76,99 @@ class TwilioRealm(object): DE1 = "de1" GLL = "gll" - def __init__(self, version, payload, room_sid: Optional[str] = None): - """ - Initialize the RoomInstance - """ + """ + :ivar account_sid: Account SID associated with this room. + :ivar room_sid: Unique identifier for the room. + :ivar room_name: Room friendly name. + :ivar create_time: Creation time of the room. + :ivar end_time: End time for the room. + :ivar room_type: + :ivar room_status: + :ivar status_callback: Webhook provided for status callbacks. + :ivar status_callback_method: HTTP method provided for status callback URL. + :ivar created_method: + :ivar end_reason: + :ivar max_participants: Max number of total participants allowed by the application settings. + :ivar unique_participants: Number of participants. May include duplicate identities for participants who left and rejoined. + :ivar unique_participant_identities: Unique number of participant identities. + :ivar concurrent_participants: Actual number of concurrent participants. + :ivar max_concurrent_participants: Maximum number of participants allowed in the room at the same time allowed by the application settings. + :ivar codecs: Codecs used by participants in the room. Can be `VP8`, `H264`, or `VP9`. + :ivar media_region: + :ivar duration_sec: Total room duration from create time to end time. + :ivar total_participant_duration_sec: Combined amount of participant time in the room. + :ivar total_recording_duration_sec: Combined amount of recorded seconds for participants in the room. + :ivar processing_state: + :ivar recording_enabled: Boolean indicating if recording is enabled for the room. + :ivar edge_location: + :ivar url: URL for the room resource. + :ivar links: Room subresources. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], room_sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "room_sid": payload.get("room_sid"), - "room_name": payload.get("room_name"), - "create_time": deserialize.iso8601_datetime(payload.get("create_time")), - "end_time": deserialize.iso8601_datetime(payload.get("end_time")), - "room_type": payload.get("room_type"), - "room_status": payload.get("room_status"), - "status_callback": payload.get("status_callback"), - "status_callback_method": payload.get("status_callback_method"), - "created_method": payload.get("created_method"), - "end_reason": payload.get("end_reason"), - "max_participants": deserialize.integer(payload.get("max_participants")), - "unique_participants": deserialize.integer( - payload.get("unique_participants") - ), - "unique_participant_identities": deserialize.integer( - payload.get("unique_participant_identities") - ), - "concurrent_participants": deserialize.integer( - payload.get("concurrent_participants") - ), - "max_concurrent_participants": deserialize.integer( - payload.get("max_concurrent_participants") - ), - "codecs": payload.get("codecs"), - "media_region": payload.get("media_region"), - "duration_sec": payload.get("duration_sec"), - "total_participant_duration_sec": payload.get( - "total_participant_duration_sec" - ), - "total_recording_duration_sec": payload.get("total_recording_duration_sec"), - "processing_state": payload.get("processing_state"), - "recording_enabled": payload.get("recording_enabled"), - "edge_location": payload.get("edge_location"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.room_sid: Optional[str] = payload.get("room_sid") + self.room_name: Optional[str] = payload.get("room_name") + self.create_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("create_time") + ) + self.end_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("end_time") + ) + self.room_type: Optional["RoomInstance.RoomType"] = payload.get("room_type") + self.room_status: Optional["RoomInstance.RoomStatus"] = payload.get( + "room_status" + ) + self.status_callback: Optional[str] = payload.get("status_callback") + self.status_callback_method: Optional[str] = payload.get( + "status_callback_method" + ) + self.created_method: Optional["RoomInstance.CreatedMethod"] = payload.get( + "created_method" + ) + self.end_reason: Optional["RoomInstance.EndReason"] = payload.get("end_reason") + self.max_participants: Optional[int] = deserialize.integer( + payload.get("max_participants") + ) + self.unique_participants: Optional[int] = deserialize.integer( + payload.get("unique_participants") + ) + self.unique_participant_identities: Optional[int] = deserialize.integer( + payload.get("unique_participant_identities") + ) + self.concurrent_participants: Optional[int] = deserialize.integer( + payload.get("concurrent_participants") + ) + self.max_concurrent_participants: Optional[int] = deserialize.integer( + payload.get("max_concurrent_participants") + ) + self.codecs: Optional[List["RoomInstance.Codec"]] = payload.get("codecs") + self.media_region: Optional["RoomInstance.TwilioRealm"] = payload.get( + "media_region" + ) + self.duration_sec: Optional[int] = payload.get("duration_sec") + self.total_participant_duration_sec: Optional[int] = payload.get( + "total_participant_duration_sec" + ) + self.total_recording_duration_sec: Optional[int] = payload.get( + "total_recording_duration_sec" + ) + self.processing_state: Optional["RoomInstance.ProcessingState"] = payload.get( + "processing_state" + ) + self.recording_enabled: Optional[bool] = payload.get("recording_enabled") + self.edge_location: Optional["RoomInstance.EdgeLocation"] = payload.get( + "edge_location" + ) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "room_sid": room_sid or self._properties["room_sid"], + "room_sid": room_sid or self.room_sid, } self._context: Optional[RoomContext] = None @@ -141,188 +187,6 @@ def _proxy(self) -> "RoomContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: Account SID associated with this room. - """ - return self._properties["account_sid"] - - @property - def room_sid(self) -> str: - """ - :returns: Unique identifier for the room. - """ - return self._properties["room_sid"] - - @property - def room_name(self) -> str: - """ - :returns: Room friendly name. - """ - return self._properties["room_name"] - - @property - def create_time(self) -> datetime: - """ - :returns: Creation time of the room. - """ - return self._properties["create_time"] - - @property - def end_time(self) -> datetime: - """ - :returns: End time for the room. - """ - return self._properties["end_time"] - - @property - def room_type(self) -> "RoomInstance.RoomType": - """ - :returns: - """ - return self._properties["room_type"] - - @property - def room_status(self) -> "RoomInstance.RoomStatus": - """ - :returns: - """ - return self._properties["room_status"] - - @property - def status_callback(self) -> str: - """ - :returns: Webhook provided for status callbacks. - """ - return self._properties["status_callback"] - - @property - def status_callback_method(self) -> str: - """ - :returns: HTTP method provided for status callback URL. - """ - return self._properties["status_callback_method"] - - @property - def created_method(self) -> "RoomInstance.CreatedMethod": - """ - :returns: - """ - return self._properties["created_method"] - - @property - def end_reason(self) -> "RoomInstance.EndReason": - """ - :returns: - """ - return self._properties["end_reason"] - - @property - def max_participants(self) -> int: - """ - :returns: Max number of total participants allowed by the application settings. - """ - return self._properties["max_participants"] - - @property - def unique_participants(self) -> int: - """ - :returns: Number of participants. May include duplicate identities for participants who left and rejoined. - """ - return self._properties["unique_participants"] - - @property - def unique_participant_identities(self) -> int: - """ - :returns: Unique number of participant identities. - """ - return self._properties["unique_participant_identities"] - - @property - def concurrent_participants(self) -> int: - """ - :returns: Actual number of concurrent participants. - """ - return self._properties["concurrent_participants"] - - @property - def max_concurrent_participants(self) -> int: - """ - :returns: Maximum number of participants allowed in the room at the same time allowed by the application settings. - """ - return self._properties["max_concurrent_participants"] - - @property - def codecs(self) -> List["RoomInstance.Codec"]: - """ - :returns: Codecs used by participants in the room. Can be `VP8`, `H264`, or `VP9`. - """ - return self._properties["codecs"] - - @property - def media_region(self) -> "RoomInstance.TwilioRealm": - """ - :returns: - """ - return self._properties["media_region"] - - @property - def duration_sec(self) -> int: - """ - :returns: Total room duration from create time to end time. - """ - return self._properties["duration_sec"] - - @property - def total_participant_duration_sec(self) -> int: - """ - :returns: Combined amount of participant time in the room. - """ - return self._properties["total_participant_duration_sec"] - - @property - def total_recording_duration_sec(self) -> int: - """ - :returns: Combined amount of recorded seconds for participants in the room. - """ - return self._properties["total_recording_duration_sec"] - - @property - def processing_state(self) -> "RoomInstance.ProcessingState": - """ - :returns: - """ - return self._properties["processing_state"] - - @property - def recording_enabled(self) -> bool: - """ - :returns: Boolean indicating if recording is enabled for the room. - """ - return self._properties["recording_enabled"] - - @property - def edge_location(self) -> "RoomInstance.EdgeLocation": - """ - :returns: - """ - return self._properties["edge_location"] - - @property - def url(self) -> str: - """ - :returns: URL for the room resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: Room subresources. - """ - return self._properties["links"] - def fetch(self) -> "RoomInstance": """ Fetch the RoomInstance diff --git a/twilio/rest/insights/v1/room/participant.py b/twilio/rest/insights/v1/room/participant.py index 71b474a93..235e3f195 100644 --- a/twilio/rest/insights/v1/room/participant.py +++ b/twilio/rest/insights/v1/room/participant.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -56,37 +56,64 @@ class TwilioRealm(object): DE1 = "de1" GLL = "gll" + """ + :ivar participant_sid: Unique identifier for the participant. + :ivar participant_identity: The application-defined string that uniquely identifies the participant within a Room. + :ivar join_time: When the participant joined the room. + :ivar leave_time: When the participant left the room. + :ivar duration_sec: Amount of time in seconds the participant was in the room. + :ivar account_sid: Account SID associated with the room. + :ivar room_sid: Unique identifier for the room. + :ivar status: + :ivar codecs: Codecs detected from the participant. Can be `VP8`, `H264`, or `VP9`. + :ivar end_reason: Reason the participant left the room. See [the list of possible values here](https://www.twilio.com/docs/video/video-log-analyzer/video-log-analyzer-api#end_reason). + :ivar error_code: Errors encountered by the participant. + :ivar error_code_url: Twilio error code dictionary link. + :ivar media_region: + :ivar properties: Object containing information about the participant's data from the room. See [below](https://www.twilio.com/docs/video/video-log-analyzer/video-log-analyzer-api#properties) for more information. + :ivar edge_location: + :ivar publisher_info: Object containing information about the SDK name and version. See [below](https://www.twilio.com/docs/video/video-log-analyzer/video-log-analyzer-api#publisher_info) for more information. + :ivar url: URL of the participant resource. + """ + def __init__( - self, version, payload, room_sid: str, participant_sid: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + room_sid: str, + participant_sid: Optional[str] = None, ): - """ - Initialize the ParticipantInstance - """ super().__init__(version) - self._properties = { - "participant_sid": payload.get("participant_sid"), - "participant_identity": payload.get("participant_identity"), - "join_time": deserialize.iso8601_datetime(payload.get("join_time")), - "leave_time": deserialize.iso8601_datetime(payload.get("leave_time")), - "duration_sec": payload.get("duration_sec"), - "account_sid": payload.get("account_sid"), - "room_sid": payload.get("room_sid"), - "status": payload.get("status"), - "codecs": payload.get("codecs"), - "end_reason": payload.get("end_reason"), - "error_code": deserialize.integer(payload.get("error_code")), - "error_code_url": payload.get("error_code_url"), - "media_region": payload.get("media_region"), - "properties": payload.get("properties"), - "edge_location": payload.get("edge_location"), - "publisher_info": payload.get("publisher_info"), - "url": payload.get("url"), - } + self.participant_sid: Optional[str] = payload.get("participant_sid") + self.participant_identity: Optional[str] = payload.get("participant_identity") + self.join_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("join_time") + ) + self.leave_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("leave_time") + ) + self.duration_sec: Optional[int] = payload.get("duration_sec") + self.account_sid: Optional[str] = payload.get("account_sid") + self.room_sid: Optional[str] = payload.get("room_sid") + self.status: Optional["ParticipantInstance.RoomStatus"] = payload.get("status") + self.codecs: Optional[List["ParticipantInstance.Codec"]] = payload.get("codecs") + self.end_reason: Optional[str] = payload.get("end_reason") + self.error_code: Optional[int] = deserialize.integer(payload.get("error_code")) + self.error_code_url: Optional[str] = payload.get("error_code_url") + self.media_region: Optional["ParticipantInstance.TwilioRealm"] = payload.get( + "media_region" + ) + self.properties: Optional[Dict[str, object]] = payload.get("properties") + self.edge_location: Optional["ParticipantInstance.EdgeLocation"] = payload.get( + "edge_location" + ) + self.publisher_info: Optional[Dict[str, object]] = payload.get("publisher_info") + self.url: Optional[str] = payload.get("url") self._solution = { "room_sid": room_sid, - "participant_sid": participant_sid or self._properties["participant_sid"], + "participant_sid": participant_sid or self.participant_sid, } self._context: Optional[ParticipantContext] = None @@ -106,125 +133,6 @@ def _proxy(self) -> "ParticipantContext": ) return self._context - @property - def participant_sid(self) -> str: - """ - :returns: Unique identifier for the participant. - """ - return self._properties["participant_sid"] - - @property - def participant_identity(self) -> str: - """ - :returns: The application-defined string that uniquely identifies the participant within a Room. - """ - return self._properties["participant_identity"] - - @property - def join_time(self) -> datetime: - """ - :returns: When the participant joined the room. - """ - return self._properties["join_time"] - - @property - def leave_time(self) -> datetime: - """ - :returns: When the participant left the room. - """ - return self._properties["leave_time"] - - @property - def duration_sec(self) -> int: - """ - :returns: Amount of time in seconds the participant was in the room. - """ - return self._properties["duration_sec"] - - @property - def account_sid(self) -> str: - """ - :returns: Account SID associated with the room. - """ - return self._properties["account_sid"] - - @property - def room_sid(self) -> str: - """ - :returns: Unique identifier for the room. - """ - return self._properties["room_sid"] - - @property - def status(self) -> "ParticipantInstance.RoomStatus": - """ - :returns: - """ - return self._properties["status"] - - @property - def codecs(self) -> List["ParticipantInstance.Codec"]: - """ - :returns: Codecs detected from the participant. Can be `VP8`, `H264`, or `VP9`. - """ - return self._properties["codecs"] - - @property - def end_reason(self) -> str: - """ - :returns: Reason the participant left the room. See [the list of possible values here](https://www.twilio.com/docs/video/video-log-analyzer/video-log-analyzer-api#end_reason). - """ - return self._properties["end_reason"] - - @property - def error_code(self) -> int: - """ - :returns: Errors encountered by the participant. - """ - return self._properties["error_code"] - - @property - def error_code_url(self) -> str: - """ - :returns: Twilio error code dictionary link. - """ - return self._properties["error_code_url"] - - @property - def media_region(self) -> "ParticipantInstance.TwilioRealm": - """ - :returns: - """ - return self._properties["media_region"] - - @property - def properties(self) -> Dict[str, object]: - """ - :returns: Object containing information about the participant's data from the room. See [below](https://www.twilio.com/docs/video/video-log-analyzer/video-log-analyzer-api#properties) for more information. - """ - return self._properties["properties"] - - @property - def edge_location(self) -> "ParticipantInstance.EdgeLocation": - """ - :returns: - """ - return self._properties["edge_location"] - - @property - def publisher_info(self) -> Dict[str, object]: - """ - :returns: Object containing information about the SDK name and version. See [below](https://www.twilio.com/docs/video/video-log-analyzer/video-log-analyzer-api#publisher_info) for more information. - """ - return self._properties["publisher_info"] - - @property - def url(self) -> str: - """ - :returns: URL of the participant resource. - """ - return self._properties["url"] - def fetch(self) -> "ParticipantInstance": """ Fetch the ParticipantInstance diff --git a/twilio/rest/insights/v1/setting.py b/twilio/rest/insights/v1/setting.py index a4d3c729a..30d18855f 100644 --- a/twilio/rest/insights/v1/setting.py +++ b/twilio/rest/insights/v1/setting.py @@ -13,7 +13,7 @@ """ -from typing import Optional +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 @@ -22,18 +22,21 @@ class SettingInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the SettingInstance - """ + + """ + :ivar account_sid: + :ivar advanced_features: + :ivar voice_trace: + :ivar url: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "advanced_features": payload.get("advanced_features"), - "voice_trace": payload.get("voice_trace"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.advanced_features: Optional[bool] = payload.get("advanced_features") + self.voice_trace: Optional[bool] = payload.get("voice_trace") + self.url: Optional[str] = payload.get("url") self._solution = {} self._context: Optional[SettingContext] = None @@ -52,34 +55,6 @@ def _proxy(self) -> "SettingContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def advanced_features(self) -> bool: - """ - :returns: - """ - return self._properties["advanced_features"] - - @property - def voice_trace(self) -> bool: - """ - :returns: - """ - return self._properties["voice_trace"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def fetch(self, subaccount_sid=values.unset) -> "SettingInstance": """ Fetch the SettingInstance diff --git a/twilio/rest/ip_messaging/v1/credential.py b/twilio/rest/ip_messaging/v1/credential.py index 05fdeb453..654a41cd3 100644 --- a/twilio/rest/ip_messaging/v1/credential.py +++ b/twilio/rest/ip_messaging/v1/credential.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -29,25 +29,37 @@ class PushService(object): APN = "apn" FCM = "fcm" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the CredentialInstance - """ + """ + :ivar sid: + :ivar account_sid: + :ivar friendly_name: + :ivar type: + :ivar sandbox: + :ivar date_created: + :ivar date_updated: + :ivar url: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "type": payload.get("type"), - "sandbox": payload.get("sandbox"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + 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["CredentialInstance.PushService"] = payload.get("type") + self.sandbox: Optional[str] = payload.get("sandbox") + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[CredentialContext] = None @@ -66,62 +78,6 @@ def _proxy(self) -> "CredentialContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: - """ - return self._properties["friendly_name"] - - @property - def type(self) -> "CredentialInstance.PushService": - """ - :returns: - """ - return self._properties["type"] - - @property - def sandbox(self) -> str: - """ - :returns: - """ - return self._properties["sandbox"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the CredentialInstance diff --git a/twilio/rest/ip_messaging/v1/service/__init__.py b/twilio/rest/ip_messaging/v1/service/__init__.py index 7b69b4a7a..6a5bfdf9e 100644 --- a/twilio/rest/ip_messaging/v1/service/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,44 +27,74 @@ class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the ServiceInstance - """ + + """ + :ivar sid: + :ivar account_sid: + :ivar friendly_name: + :ivar date_created: + :ivar date_updated: + :ivar default_service_role_sid: + :ivar default_channel_role_sid: + :ivar default_channel_creator_role_sid: + :ivar read_status_enabled: + :ivar reachability_enabled: + :ivar typing_indicator_timeout: + :ivar consumption_report_interval: + :ivar limits: + :ivar webhooks: + :ivar pre_webhook_url: + :ivar post_webhook_url: + :ivar webhook_method: + :ivar webhook_filters: + :ivar notifications: + :ivar url: + :ivar links: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "default_service_role_sid": payload.get("default_service_role_sid"), - "default_channel_role_sid": payload.get("default_channel_role_sid"), - "default_channel_creator_role_sid": payload.get( - "default_channel_creator_role_sid" - ), - "read_status_enabled": payload.get("read_status_enabled"), - "reachability_enabled": payload.get("reachability_enabled"), - "typing_indicator_timeout": deserialize.integer( - payload.get("typing_indicator_timeout") - ), - "consumption_report_interval": deserialize.integer( - payload.get("consumption_report_interval") - ), - "limits": payload.get("limits"), - "webhooks": payload.get("webhooks"), - "pre_webhook_url": payload.get("pre_webhook_url"), - "post_webhook_url": payload.get("post_webhook_url"), - "webhook_method": payload.get("webhook_method"), - "webhook_filters": payload.get("webhook_filters"), - "notifications": payload.get("notifications"), - "url": payload.get("url"), - "links": payload.get("links"), - } + 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.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.default_service_role_sid: Optional[str] = payload.get( + "default_service_role_sid" + ) + self.default_channel_role_sid: Optional[str] = payload.get( + "default_channel_role_sid" + ) + self.default_channel_creator_role_sid: Optional[str] = payload.get( + "default_channel_creator_role_sid" + ) + self.read_status_enabled: Optional[bool] = payload.get("read_status_enabled") + self.reachability_enabled: Optional[bool] = payload.get("reachability_enabled") + self.typing_indicator_timeout: Optional[int] = deserialize.integer( + payload.get("typing_indicator_timeout") + ) + self.consumption_report_interval: Optional[int] = deserialize.integer( + payload.get("consumption_report_interval") + ) + self.limits: Optional[Dict[str, object]] = payload.get("limits") + self.webhooks: Optional[Dict[str, object]] = payload.get("webhooks") + self.pre_webhook_url: Optional[str] = payload.get("pre_webhook_url") + self.post_webhook_url: Optional[str] = payload.get("post_webhook_url") + self.webhook_method: Optional[str] = payload.get("webhook_method") + self.webhook_filters: Optional[List[str]] = payload.get("webhook_filters") + self.notifications: Optional[Dict[str, object]] = payload.get("notifications") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ServiceContext] = None @@ -83,153 +113,6 @@ def _proxy(self) -> "ServiceContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: - """ - return self._properties["friendly_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def default_service_role_sid(self) -> str: - """ - :returns: - """ - return self._properties["default_service_role_sid"] - - @property - def default_channel_role_sid(self) -> str: - """ - :returns: - """ - return self._properties["default_channel_role_sid"] - - @property - def default_channel_creator_role_sid(self) -> str: - """ - :returns: - """ - return self._properties["default_channel_creator_role_sid"] - - @property - def read_status_enabled(self) -> bool: - """ - :returns: - """ - return self._properties["read_status_enabled"] - - @property - def reachability_enabled(self) -> bool: - """ - :returns: - """ - return self._properties["reachability_enabled"] - - @property - def typing_indicator_timeout(self) -> int: - """ - :returns: - """ - return self._properties["typing_indicator_timeout"] - - @property - def consumption_report_interval(self) -> int: - """ - :returns: - """ - return self._properties["consumption_report_interval"] - - @property - def limits(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["limits"] - - @property - def webhooks(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["webhooks"] - - @property - def pre_webhook_url(self) -> str: - """ - :returns: - """ - return self._properties["pre_webhook_url"] - - @property - def post_webhook_url(self) -> str: - """ - :returns: - """ - return self._properties["post_webhook_url"] - - @property - def webhook_method(self) -> str: - """ - :returns: - """ - return self._properties["webhook_method"] - - @property - def webhook_filters(self) -> List[str]: - """ - :returns: - """ - return self._properties["webhook_filters"] - - @property - def notifications(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["notifications"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the ServiceInstance diff --git a/twilio/rest/ip_messaging/v1/service/channel/__init__.py b/twilio/rest/ip_messaging/v1/service/channel/__init__.py index ec01f8b71..3e844938e 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/channel/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -31,32 +31,58 @@ class ChannelType(object): PUBLIC = "public" PRIVATE = "private" - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the ChannelInstance - """ + """ + :ivar sid: + :ivar account_sid: + :ivar service_sid: + :ivar friendly_name: + :ivar unique_name: + :ivar attributes: + :ivar type: + :ivar date_created: + :ivar date_updated: + :ivar created_by: + :ivar members_count: + :ivar messages_count: + :ivar url: + :ivar links: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "friendly_name": payload.get("friendly_name"), - "unique_name": payload.get("unique_name"), - "attributes": payload.get("attributes"), - "type": payload.get("type"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "created_by": payload.get("created_by"), - "members_count": deserialize.integer(payload.get("members_count")), - "messages_count": deserialize.integer(payload.get("messages_count")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.unique_name: Optional[str] = payload.get("unique_name") + self.attributes: Optional[str] = payload.get("attributes") + self.type: Optional["ChannelInstance.ChannelType"] = payload.get("type") + 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.created_by: Optional[str] = payload.get("created_by") + self.members_count: Optional[int] = deserialize.integer( + payload.get("members_count") + ) + self.messages_count: Optional[int] = deserialize.integer( + payload.get("messages_count") + ) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ChannelContext] = None @@ -76,104 +102,6 @@ def _proxy(self) -> "ChannelContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: - """ - return self._properties["service_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: - """ - return self._properties["friendly_name"] - - @property - def unique_name(self) -> str: - """ - :returns: - """ - return self._properties["unique_name"] - - @property - def attributes(self) -> str: - """ - :returns: - """ - return self._properties["attributes"] - - @property - def type(self) -> "ChannelInstance.ChannelType": - """ - :returns: - """ - return self._properties["type"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def created_by(self) -> str: - """ - :returns: - """ - return self._properties["created_by"] - - @property - def members_count(self) -> int: - """ - :returns: - """ - return self._properties["members_count"] - - @property - def messages_count(self) -> int: - """ - :returns: - """ - return self._properties["messages_count"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the ChannelInstance diff --git a/twilio/rest/ip_messaging/v1/service/channel/invite.py b/twilio/rest/ip_messaging/v1/service/channel/invite.py index 173ee631d..96d9407d4 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/invite.py +++ b/twilio/rest/ip_messaging/v1/service/channel/invite.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,36 +24,49 @@ class InviteInstance(InstanceResource): + + """ + :ivar sid: + :ivar account_sid: + :ivar channel_sid: + :ivar service_sid: + :ivar identity: + :ivar date_created: + :ivar date_updated: + :ivar role_sid: + :ivar created_by: + :ivar url: + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, channel_sid: str, sid: Optional[str] = None, ): - """ - Initialize the InviteInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "channel_sid": payload.get("channel_sid"), - "service_sid": payload.get("service_sid"), - "identity": payload.get("identity"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "role_sid": payload.get("role_sid"), - "created_by": payload.get("created_by"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.channel_sid: Optional[str] = payload.get("channel_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.identity: Optional[str] = payload.get("identity") + 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.role_sid: Optional[str] = payload.get("role_sid") + self.created_by: Optional[str] = payload.get("created_by") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, "channel_sid": channel_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[InviteContext] = None @@ -74,76 +87,6 @@ def _proxy(self) -> "InviteContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def channel_sid(self) -> str: - """ - :returns: - """ - return self._properties["channel_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: - """ - return self._properties["service_sid"] - - @property - def identity(self) -> str: - """ - :returns: - """ - return self._properties["identity"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def role_sid(self) -> str: - """ - :returns: - """ - return self._properties["role_sid"] - - @property - def created_by(self) -> str: - """ - :returns: - """ - return self._properties["created_by"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the InviteInstance diff --git a/twilio/rest/ip_messaging/v1/service/channel/member.py b/twilio/rest/ip_messaging/v1/service/channel/member.py index c15bf49c0..c4f593225 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/member.py +++ b/twilio/rest/ip_messaging/v1/service/channel/member.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,41 +24,55 @@ class MemberInstance(InstanceResource): + + """ + :ivar sid: + :ivar account_sid: + :ivar channel_sid: + :ivar service_sid: + :ivar identity: + :ivar date_created: + :ivar date_updated: + :ivar role_sid: + :ivar last_consumed_message_index: + :ivar last_consumption_timestamp: + :ivar url: + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, channel_sid: str, sid: Optional[str] = None, ): - """ - Initialize the MemberInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "channel_sid": payload.get("channel_sid"), - "service_sid": payload.get("service_sid"), - "identity": payload.get("identity"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "role_sid": payload.get("role_sid"), - "last_consumed_message_index": deserialize.integer( - payload.get("last_consumed_message_index") - ), - "last_consumption_timestamp": deserialize.iso8601_datetime( - payload.get("last_consumption_timestamp") - ), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.channel_sid: Optional[str] = payload.get("channel_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.identity: Optional[str] = payload.get("identity") + 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.role_sid: Optional[str] = payload.get("role_sid") + self.last_consumed_message_index: Optional[int] = deserialize.integer( + payload.get("last_consumed_message_index") + ) + self.last_consumption_timestamp: Optional[ + datetime + ] = deserialize.iso8601_datetime(payload.get("last_consumption_timestamp")) + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, "channel_sid": channel_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[MemberContext] = None @@ -79,83 +93,6 @@ def _proxy(self) -> "MemberContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def channel_sid(self) -> str: - """ - :returns: - """ - return self._properties["channel_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: - """ - return self._properties["service_sid"] - - @property - def identity(self) -> str: - """ - :returns: - """ - return self._properties["identity"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def role_sid(self) -> str: - """ - :returns: - """ - return self._properties["role_sid"] - - @property - def last_consumed_message_index(self) -> int: - """ - :returns: - """ - return self._properties["last_consumed_message_index"] - - @property - def last_consumption_timestamp(self) -> datetime: - """ - :returns: - """ - return self._properties["last_consumption_timestamp"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the MemberInstance diff --git a/twilio/rest/ip_messaging/v1/service/channel/message.py b/twilio/rest/ip_messaging/v1/service/channel/message.py index b839a6683..7bb0384ff 100644 --- a/twilio/rest/ip_messaging/v1/service/channel/message.py +++ b/twilio/rest/ip_messaging/v1/service/channel/message.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,39 +28,54 @@ class OrderType(object): ASC = "asc" DESC = "desc" + """ + :ivar sid: + :ivar account_sid: + :ivar attributes: + :ivar service_sid: + :ivar to: + :ivar channel_sid: + :ivar date_created: + :ivar date_updated: + :ivar was_edited: + :ivar _from: + :ivar body: + :ivar index: + :ivar url: + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, channel_sid: str, sid: Optional[str] = None, ): - """ - Initialize the MessageInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "attributes": payload.get("attributes"), - "service_sid": payload.get("service_sid"), - "to": payload.get("to"), - "channel_sid": payload.get("channel_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "was_edited": payload.get("was_edited"), - "_from": payload.get("from"), - "body": payload.get("body"), - "index": deserialize.integer(payload.get("index")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.attributes: Optional[str] = payload.get("attributes") + self.service_sid: Optional[str] = payload.get("service_sid") + self.to: Optional[str] = payload.get("to") + self.channel_sid: Optional[str] = payload.get("channel_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.was_edited: Optional[bool] = payload.get("was_edited") + self._from: Optional[str] = payload.get("from") + self.body: Optional[str] = payload.get("body") + self.index: Optional[int] = deserialize.integer(payload.get("index")) + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, "channel_sid": channel_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[MessageContext] = None @@ -81,97 +96,6 @@ def _proxy(self) -> "MessageContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def attributes(self) -> str: - """ - :returns: - """ - return self._properties["attributes"] - - @property - def service_sid(self) -> str: - """ - :returns: - """ - return self._properties["service_sid"] - - @property - def to(self) -> str: - """ - :returns: - """ - return self._properties["to"] - - @property - def channel_sid(self) -> str: - """ - :returns: - """ - return self._properties["channel_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def was_edited(self) -> bool: - """ - :returns: - """ - return self._properties["was_edited"] - - @property - def _from(self) -> str: - """ - :returns: - """ - return self._properties["_from"] - - @property - def body(self) -> str: - """ - :returns: - """ - return self._properties["body"] - - @property - def index(self) -> int: - """ - :returns: - """ - return self._properties["index"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the MessageInstance diff --git a/twilio/rest/ip_messaging/v1/service/role.py b/twilio/rest/ip_messaging/v1/service/role.py index 3ced99ac9..3e5f3b212 100644 --- a/twilio/rest/ip_messaging/v1/service/role.py +++ b/twilio/rest/ip_messaging/v1/service/role.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,27 +28,44 @@ class RoleType(object): CHANNEL = "channel" DEPLOYMENT = "deployment" - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the RoleInstance - """ + """ + :ivar sid: + :ivar account_sid: + :ivar service_sid: + :ivar friendly_name: + :ivar type: + :ivar permissions: + :ivar date_created: + :ivar date_updated: + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "friendly_name": payload.get("friendly_name"), - "type": payload.get("type"), - "permissions": payload.get("permissions"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.type: Optional["RoleInstance.RoleType"] = payload.get("type") + self.permissions: Optional[List[str]] = payload.get("permissions") + 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 = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[RoleContext] = None @@ -68,69 +85,6 @@ def _proxy(self) -> "RoleContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: - """ - return self._properties["service_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: - """ - return self._properties["friendly_name"] - - @property - def type(self) -> "RoleInstance.RoleType": - """ - :returns: - """ - return self._properties["type"] - - @property - def permissions(self) -> List[str]: - """ - :returns: - """ - return self._properties["permissions"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the RoleInstance diff --git a/twilio/rest/ip_messaging/v1/service/user/__init__.py b/twilio/rest/ip_messaging/v1/service/user/__init__.py index ba8eb02b7..c09e1bb3a 100644 --- a/twilio/rest/ip_messaging/v1/service/user/__init__.py +++ b/twilio/rest/ip_messaging/v1/service/user/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -25,34 +25,57 @@ class UserInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the UserInstance - """ + + """ + :ivar sid: + :ivar account_sid: + :ivar service_sid: + :ivar attributes: + :ivar friendly_name: + :ivar role_sid: + :ivar identity: + :ivar is_online: + :ivar is_notifiable: + :ivar date_created: + :ivar date_updated: + :ivar joined_channels_count: + :ivar links: + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "attributes": payload.get("attributes"), - "friendly_name": payload.get("friendly_name"), - "role_sid": payload.get("role_sid"), - "identity": payload.get("identity"), - "is_online": payload.get("is_online"), - "is_notifiable": payload.get("is_notifiable"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "joined_channels_count": deserialize.integer( - payload.get("joined_channels_count") - ), - "links": payload.get("links"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.attributes: Optional[str] = payload.get("attributes") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.role_sid: Optional[str] = payload.get("role_sid") + self.identity: Optional[str] = payload.get("identity") + self.is_online: Optional[bool] = payload.get("is_online") + self.is_notifiable: Optional[bool] = payload.get("is_notifiable") + 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.joined_channels_count: Optional[int] = deserialize.integer( + payload.get("joined_channels_count") + ) + self.links: Optional[Dict[str, object]] = payload.get("links") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[UserContext] = None @@ -72,104 +95,6 @@ def _proxy(self) -> "UserContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: - """ - return self._properties["service_sid"] - - @property - def attributes(self) -> str: - """ - :returns: - """ - return self._properties["attributes"] - - @property - def friendly_name(self) -> str: - """ - :returns: - """ - return self._properties["friendly_name"] - - @property - def role_sid(self) -> str: - """ - :returns: - """ - return self._properties["role_sid"] - - @property - def identity(self) -> str: - """ - :returns: - """ - return self._properties["identity"] - - @property - def is_online(self) -> bool: - """ - :returns: - """ - return self._properties["is_online"] - - @property - def is_notifiable(self) -> bool: - """ - :returns: - """ - return self._properties["is_notifiable"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def joined_channels_count(self) -> int: - """ - :returns: - """ - return self._properties["joined_channels_count"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the UserInstance diff --git a/twilio/rest/ip_messaging/v1/service/user/user_channel.py b/twilio/rest/ip_messaging/v1/service/user/user_channel.py index 1addcbe8a..c759d2b6c 100644 --- a/twilio/rest/ip_messaging/v1/service/user/user_channel.py +++ b/twilio/rest/ip_messaging/v1/service/user/user_channel.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -28,88 +28,42 @@ class ChannelStatus(object): INVITED = "invited" NOT_PARTICIPATING = "not_participating" - def __init__(self, version, payload, service_sid: str, user_sid: str): - """ - Initialize the UserChannelInstance - """ + """ + :ivar account_sid: + :ivar service_sid: + :ivar channel_sid: + :ivar member_sid: + :ivar status: + :ivar last_consumed_message_index: + :ivar unread_messages_count: + :ivar links: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], service_sid: str, user_sid: str + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "channel_sid": payload.get("channel_sid"), - "member_sid": payload.get("member_sid"), - "status": payload.get("status"), - "last_consumed_message_index": deserialize.integer( - payload.get("last_consumed_message_index") - ), - "unread_messages_count": deserialize.integer( - payload.get("unread_messages_count") - ), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.channel_sid: Optional[str] = payload.get("channel_sid") + self.member_sid: Optional[str] = payload.get("member_sid") + self.status: Optional["UserChannelInstance.ChannelStatus"] = payload.get( + "status" + ) + self.last_consumed_message_index: Optional[int] = deserialize.integer( + payload.get("last_consumed_message_index") + ) + self.unread_messages_count: Optional[int] = deserialize.integer( + payload.get("unread_messages_count") + ) + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "service_sid": service_sid, "user_sid": user_sid, } - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: - """ - return self._properties["service_sid"] - - @property - def channel_sid(self) -> str: - """ - :returns: - """ - return self._properties["channel_sid"] - - @property - def member_sid(self) -> str: - """ - :returns: - """ - return self._properties["member_sid"] - - @property - def status(self) -> "UserChannelInstance.ChannelStatus": - """ - :returns: - """ - return self._properties["status"] - - @property - def last_consumed_message_index(self) -> int: - """ - :returns: - """ - return self._properties["last_consumed_message_index"] - - @property - def unread_messages_count(self) -> int: - """ - :returns: - """ - return self._properties["unread_messages_count"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/ip_messaging/v2/credential.py b/twilio/rest/ip_messaging/v2/credential.py index 63c9738ec..c324a65e1 100644 --- a/twilio/rest/ip_messaging/v2/credential.py +++ b/twilio/rest/ip_messaging/v2/credential.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -29,25 +29,37 @@ class PushService(object): APN = "apn" FCM = "fcm" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the CredentialInstance - """ + """ + :ivar sid: + :ivar account_sid: + :ivar friendly_name: + :ivar type: + :ivar sandbox: + :ivar date_created: + :ivar date_updated: + :ivar url: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "type": payload.get("type"), - "sandbox": payload.get("sandbox"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + 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["CredentialInstance.PushService"] = payload.get("type") + self.sandbox: Optional[str] = payload.get("sandbox") + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[CredentialContext] = None @@ -66,62 +78,6 @@ def _proxy(self) -> "CredentialContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: - """ - return self._properties["friendly_name"] - - @property - def type(self) -> "CredentialInstance.PushService": - """ - :returns: - """ - return self._properties["type"] - - @property - def sandbox(self) -> str: - """ - :returns: - """ - return self._properties["sandbox"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the CredentialInstance diff --git a/twilio/rest/ip_messaging/v2/service/__init__.py b/twilio/rest/ip_messaging/v2/service/__init__.py index c7e993284..f48a548f6 100644 --- a/twilio/rest/ip_messaging/v2/service/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,50 +28,82 @@ class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the ServiceInstance - """ + + """ + :ivar sid: + :ivar account_sid: + :ivar friendly_name: + :ivar date_created: + :ivar date_updated: + :ivar default_service_role_sid: + :ivar default_channel_role_sid: + :ivar default_channel_creator_role_sid: + :ivar read_status_enabled: + :ivar reachability_enabled: + :ivar typing_indicator_timeout: + :ivar consumption_report_interval: + :ivar limits: + :ivar pre_webhook_url: + :ivar post_webhook_url: + :ivar webhook_method: + :ivar webhook_filters: + :ivar pre_webhook_retry_count: + :ivar post_webhook_retry_count: + :ivar notifications: + :ivar media: + :ivar url: + :ivar links: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "default_service_role_sid": payload.get("default_service_role_sid"), - "default_channel_role_sid": payload.get("default_channel_role_sid"), - "default_channel_creator_role_sid": payload.get( - "default_channel_creator_role_sid" - ), - "read_status_enabled": payload.get("read_status_enabled"), - "reachability_enabled": payload.get("reachability_enabled"), - "typing_indicator_timeout": deserialize.integer( - payload.get("typing_indicator_timeout") - ), - "consumption_report_interval": deserialize.integer( - payload.get("consumption_report_interval") - ), - "limits": payload.get("limits"), - "pre_webhook_url": payload.get("pre_webhook_url"), - "post_webhook_url": payload.get("post_webhook_url"), - "webhook_method": payload.get("webhook_method"), - "webhook_filters": payload.get("webhook_filters"), - "pre_webhook_retry_count": deserialize.integer( - payload.get("pre_webhook_retry_count") - ), - "post_webhook_retry_count": deserialize.integer( - payload.get("post_webhook_retry_count") - ), - "notifications": payload.get("notifications"), - "media": payload.get("media"), - "url": payload.get("url"), - "links": payload.get("links"), - } + 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.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.default_service_role_sid: Optional[str] = payload.get( + "default_service_role_sid" + ) + self.default_channel_role_sid: Optional[str] = payload.get( + "default_channel_role_sid" + ) + self.default_channel_creator_role_sid: Optional[str] = payload.get( + "default_channel_creator_role_sid" + ) + self.read_status_enabled: Optional[bool] = payload.get("read_status_enabled") + self.reachability_enabled: Optional[bool] = payload.get("reachability_enabled") + self.typing_indicator_timeout: Optional[int] = deserialize.integer( + payload.get("typing_indicator_timeout") + ) + self.consumption_report_interval: Optional[int] = deserialize.integer( + payload.get("consumption_report_interval") + ) + self.limits: Optional[Dict[str, object]] = payload.get("limits") + self.pre_webhook_url: Optional[str] = payload.get("pre_webhook_url") + self.post_webhook_url: Optional[str] = payload.get("post_webhook_url") + self.webhook_method: Optional[str] = payload.get("webhook_method") + self.webhook_filters: Optional[List[str]] = payload.get("webhook_filters") + self.pre_webhook_retry_count: Optional[int] = deserialize.integer( + payload.get("pre_webhook_retry_count") + ) + self.post_webhook_retry_count: Optional[int] = deserialize.integer( + payload.get("post_webhook_retry_count") + ) + self.notifications: Optional[Dict[str, object]] = payload.get("notifications") + self.media: Optional[Dict[str, object]] = payload.get("media") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ServiceContext] = None @@ -90,167 +122,6 @@ def _proxy(self) -> "ServiceContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: - """ - return self._properties["friendly_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def default_service_role_sid(self) -> str: - """ - :returns: - """ - return self._properties["default_service_role_sid"] - - @property - def default_channel_role_sid(self) -> str: - """ - :returns: - """ - return self._properties["default_channel_role_sid"] - - @property - def default_channel_creator_role_sid(self) -> str: - """ - :returns: - """ - return self._properties["default_channel_creator_role_sid"] - - @property - def read_status_enabled(self) -> bool: - """ - :returns: - """ - return self._properties["read_status_enabled"] - - @property - def reachability_enabled(self) -> bool: - """ - :returns: - """ - return self._properties["reachability_enabled"] - - @property - def typing_indicator_timeout(self) -> int: - """ - :returns: - """ - return self._properties["typing_indicator_timeout"] - - @property - def consumption_report_interval(self) -> int: - """ - :returns: - """ - return self._properties["consumption_report_interval"] - - @property - def limits(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["limits"] - - @property - def pre_webhook_url(self) -> str: - """ - :returns: - """ - return self._properties["pre_webhook_url"] - - @property - def post_webhook_url(self) -> str: - """ - :returns: - """ - return self._properties["post_webhook_url"] - - @property - def webhook_method(self) -> str: - """ - :returns: - """ - return self._properties["webhook_method"] - - @property - def webhook_filters(self) -> List[str]: - """ - :returns: - """ - return self._properties["webhook_filters"] - - @property - def pre_webhook_retry_count(self) -> int: - """ - :returns: - """ - return self._properties["pre_webhook_retry_count"] - - @property - def post_webhook_retry_count(self) -> int: - """ - :returns: - """ - return self._properties["post_webhook_retry_count"] - - @property - def notifications(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["notifications"] - - @property - def media(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["media"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the ServiceInstance diff --git a/twilio/rest/ip_messaging/v2/service/binding.py b/twilio/rest/ip_messaging/v2/service/binding.py index b4e8108fb..f4d94809e 100644 --- a/twilio/rest/ip_messaging/v2/service/binding.py +++ b/twilio/rest/ip_messaging/v2/service/binding.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -29,30 +29,52 @@ class BindingType(object): APN = "apn" FCM = "fcm" - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the BindingInstance - """ + """ + :ivar sid: + :ivar account_sid: + :ivar service_sid: + :ivar date_created: + :ivar date_updated: + :ivar endpoint: + :ivar identity: + :ivar credential_sid: + :ivar binding_type: + :ivar message_types: + :ivar url: + :ivar links: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "endpoint": payload.get("endpoint"), - "identity": payload.get("identity"), - "credential_sid": payload.get("credential_sid"), - "binding_type": payload.get("binding_type"), - "message_types": payload.get("message_types"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.endpoint: Optional[str] = payload.get("endpoint") + self.identity: Optional[str] = payload.get("identity") + self.credential_sid: Optional[str] = payload.get("credential_sid") + self.binding_type: Optional["BindingInstance.BindingType"] = payload.get( + "binding_type" + ) + self.message_types: Optional[List[str]] = payload.get("message_types") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[BindingContext] = None @@ -72,90 +94,6 @@ def _proxy(self) -> "BindingContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: - """ - return self._properties["service_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def endpoint(self) -> str: - """ - :returns: - """ - return self._properties["endpoint"] - - @property - def identity(self) -> str: - """ - :returns: - """ - return self._properties["identity"] - - @property - def credential_sid(self) -> str: - """ - :returns: - """ - return self._properties["credential_sid"] - - @property - def binding_type(self) -> "BindingInstance.BindingType": - """ - :returns: - """ - return self._properties["binding_type"] - - @property - def message_types(self) -> List[str]: - """ - :returns: - """ - return self._properties["message_types"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the BindingInstance diff --git a/twilio/rest/ip_messaging/v2/service/channel/__init__.py b/twilio/rest/ip_messaging/v2/service/channel/__init__.py index b7c32ca60..a895f4574 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/channel/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -36,32 +36,58 @@ class WebhookEnabledType(object): TRUE = "true" FALSE = "false" - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the ChannelInstance - """ + """ + :ivar sid: + :ivar account_sid: + :ivar service_sid: + :ivar friendly_name: + :ivar unique_name: + :ivar attributes: + :ivar type: + :ivar date_created: + :ivar date_updated: + :ivar created_by: + :ivar members_count: + :ivar messages_count: + :ivar url: + :ivar links: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "friendly_name": payload.get("friendly_name"), - "unique_name": payload.get("unique_name"), - "attributes": payload.get("attributes"), - "type": payload.get("type"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "created_by": payload.get("created_by"), - "members_count": deserialize.integer(payload.get("members_count")), - "messages_count": deserialize.integer(payload.get("messages_count")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.unique_name: Optional[str] = payload.get("unique_name") + self.attributes: Optional[str] = payload.get("attributes") + self.type: Optional["ChannelInstance.ChannelType"] = payload.get("type") + 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.created_by: Optional[str] = payload.get("created_by") + self.members_count: Optional[int] = deserialize.integer( + payload.get("members_count") + ) + self.messages_count: Optional[int] = deserialize.integer( + payload.get("messages_count") + ) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ChannelContext] = None @@ -81,104 +107,6 @@ def _proxy(self) -> "ChannelContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: - """ - return self._properties["service_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: - """ - return self._properties["friendly_name"] - - @property - def unique_name(self) -> str: - """ - :returns: - """ - return self._properties["unique_name"] - - @property - def attributes(self) -> str: - """ - :returns: - """ - return self._properties["attributes"] - - @property - def type(self) -> "ChannelInstance.ChannelType": - """ - :returns: - """ - return self._properties["type"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def created_by(self) -> str: - """ - :returns: - """ - return self._properties["created_by"] - - @property - def members_count(self) -> int: - """ - :returns: - """ - return self._properties["members_count"] - - @property - def messages_count(self) -> int: - """ - :returns: - """ - return self._properties["messages_count"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - def delete(self, x_twilio_webhook_enabled=values.unset) -> bool: """ Deletes the ChannelInstance diff --git a/twilio/rest/ip_messaging/v2/service/channel/invite.py b/twilio/rest/ip_messaging/v2/service/channel/invite.py index b501f1184..fdf702760 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/invite.py +++ b/twilio/rest/ip_messaging/v2/service/channel/invite.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,36 +24,49 @@ class InviteInstance(InstanceResource): + + """ + :ivar sid: + :ivar account_sid: + :ivar channel_sid: + :ivar service_sid: + :ivar identity: + :ivar date_created: + :ivar date_updated: + :ivar role_sid: + :ivar created_by: + :ivar url: + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, channel_sid: str, sid: Optional[str] = None, ): - """ - Initialize the InviteInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "channel_sid": payload.get("channel_sid"), - "service_sid": payload.get("service_sid"), - "identity": payload.get("identity"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "role_sid": payload.get("role_sid"), - "created_by": payload.get("created_by"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.channel_sid: Optional[str] = payload.get("channel_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.identity: Optional[str] = payload.get("identity") + 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.role_sid: Optional[str] = payload.get("role_sid") + self.created_by: Optional[str] = payload.get("created_by") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, "channel_sid": channel_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[InviteContext] = None @@ -74,76 +87,6 @@ def _proxy(self) -> "InviteContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def channel_sid(self) -> str: - """ - :returns: - """ - return self._properties["channel_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: - """ - return self._properties["service_sid"] - - @property - def identity(self) -> str: - """ - :returns: - """ - return self._properties["identity"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def role_sid(self) -> str: - """ - :returns: - """ - return self._properties["role_sid"] - - @property - def created_by(self) -> str: - """ - :returns: - """ - return self._properties["created_by"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the InviteInstance diff --git a/twilio/rest/ip_messaging/v2/service/channel/member.py b/twilio/rest/ip_messaging/v2/service/channel/member.py index 2a747ca21..1a41baf9b 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/member.py +++ b/twilio/rest/ip_messaging/v2/service/channel/member.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,42 +28,56 @@ class WebhookEnabledType(object): TRUE = "true" FALSE = "false" + """ + :ivar sid: + :ivar account_sid: + :ivar channel_sid: + :ivar service_sid: + :ivar identity: + :ivar date_created: + :ivar date_updated: + :ivar role_sid: + :ivar last_consumed_message_index: + :ivar last_consumption_timestamp: + :ivar url: + :ivar attributes: + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, channel_sid: str, sid: Optional[str] = None, ): - """ - Initialize the MemberInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "channel_sid": payload.get("channel_sid"), - "service_sid": payload.get("service_sid"), - "identity": payload.get("identity"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "role_sid": payload.get("role_sid"), - "last_consumed_message_index": deserialize.integer( - payload.get("last_consumed_message_index") - ), - "last_consumption_timestamp": deserialize.iso8601_datetime( - payload.get("last_consumption_timestamp") - ), - "url": payload.get("url"), - "attributes": payload.get("attributes"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.channel_sid: Optional[str] = payload.get("channel_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.identity: Optional[str] = payload.get("identity") + 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.role_sid: Optional[str] = payload.get("role_sid") + self.last_consumed_message_index: Optional[int] = deserialize.integer( + payload.get("last_consumed_message_index") + ) + self.last_consumption_timestamp: Optional[ + datetime + ] = deserialize.iso8601_datetime(payload.get("last_consumption_timestamp")) + self.url: Optional[str] = payload.get("url") + self.attributes: Optional[str] = payload.get("attributes") self._solution = { "service_sid": service_sid, "channel_sid": channel_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[MemberContext] = None @@ -84,90 +98,6 @@ def _proxy(self) -> "MemberContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def channel_sid(self) -> str: - """ - :returns: - """ - return self._properties["channel_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: - """ - return self._properties["service_sid"] - - @property - def identity(self) -> str: - """ - :returns: - """ - return self._properties["identity"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def role_sid(self) -> str: - """ - :returns: - """ - return self._properties["role_sid"] - - @property - def last_consumed_message_index(self) -> int: - """ - :returns: - """ - return self._properties["last_consumed_message_index"] - - @property - def last_consumption_timestamp(self) -> datetime: - """ - :returns: - """ - return self._properties["last_consumption_timestamp"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def attributes(self) -> str: - """ - :returns: - """ - return self._properties["attributes"] - def delete(self, x_twilio_webhook_enabled=values.unset) -> bool: """ Deletes the MemberInstance diff --git a/twilio/rest/ip_messaging/v2/service/channel/message.py b/twilio/rest/ip_messaging/v2/service/channel/message.py index 5e6640a0b..d7720c86e 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/message.py +++ b/twilio/rest/ip_messaging/v2/service/channel/message.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -32,42 +32,60 @@ class WebhookEnabledType(object): TRUE = "true" FALSE = "false" + """ + :ivar sid: + :ivar account_sid: + :ivar attributes: + :ivar service_sid: + :ivar to: + :ivar channel_sid: + :ivar date_created: + :ivar date_updated: + :ivar last_updated_by: + :ivar was_edited: + :ivar _from: + :ivar body: + :ivar index: + :ivar type: + :ivar media: + :ivar url: + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, channel_sid: str, sid: Optional[str] = None, ): - """ - Initialize the MessageInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "attributes": payload.get("attributes"), - "service_sid": payload.get("service_sid"), - "to": payload.get("to"), - "channel_sid": payload.get("channel_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "last_updated_by": payload.get("last_updated_by"), - "was_edited": payload.get("was_edited"), - "_from": payload.get("from"), - "body": payload.get("body"), - "index": deserialize.integer(payload.get("index")), - "type": payload.get("type"), - "media": payload.get("media"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.attributes: Optional[str] = payload.get("attributes") + self.service_sid: Optional[str] = payload.get("service_sid") + self.to: Optional[str] = payload.get("to") + self.channel_sid: Optional[str] = payload.get("channel_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.last_updated_by: Optional[str] = payload.get("last_updated_by") + self.was_edited: Optional[bool] = payload.get("was_edited") + self._from: Optional[str] = payload.get("from") + self.body: Optional[str] = payload.get("body") + self.index: Optional[int] = deserialize.integer(payload.get("index")) + self.type: Optional[str] = payload.get("type") + self.media: Optional[Dict[str, object]] = payload.get("media") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, "channel_sid": channel_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[MessageContext] = None @@ -88,118 +106,6 @@ def _proxy(self) -> "MessageContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def attributes(self) -> str: - """ - :returns: - """ - return self._properties["attributes"] - - @property - def service_sid(self) -> str: - """ - :returns: - """ - return self._properties["service_sid"] - - @property - def to(self) -> str: - """ - :returns: - """ - return self._properties["to"] - - @property - def channel_sid(self) -> str: - """ - :returns: - """ - return self._properties["channel_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def last_updated_by(self) -> str: - """ - :returns: - """ - return self._properties["last_updated_by"] - - @property - def was_edited(self) -> bool: - """ - :returns: - """ - return self._properties["was_edited"] - - @property - def _from(self) -> str: - """ - :returns: - """ - return self._properties["_from"] - - @property - def body(self) -> str: - """ - :returns: - """ - return self._properties["body"] - - @property - def index(self) -> int: - """ - :returns: - """ - return self._properties["index"] - - @property - def type(self) -> str: - """ - :returns: - """ - return self._properties["type"] - - @property - def media(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["media"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def delete(self, x_twilio_webhook_enabled=values.unset) -> bool: """ Deletes the MessageInstance diff --git a/twilio/rest/ip_messaging/v2/service/channel/webhook.py b/twilio/rest/ip_messaging/v2/service/channel/webhook.py index 01599119d..7e172f279 100644 --- a/twilio/rest/ip_messaging/v2/service/channel/webhook.py +++ b/twilio/rest/ip_messaging/v2/service/channel/webhook.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,35 +24,47 @@ class WebhookInstance(InstanceResource): + + """ + :ivar sid: + :ivar account_sid: + :ivar service_sid: + :ivar channel_sid: + :ivar type: + :ivar url: + :ivar configuration: + :ivar date_created: + :ivar date_updated: + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, channel_sid: str, sid: Optional[str] = None, ): - """ - Initialize the WebhookInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "channel_sid": payload.get("channel_sid"), - "type": payload.get("type"), - "url": payload.get("url"), - "configuration": payload.get("configuration"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.channel_sid: Optional[str] = payload.get("channel_sid") + self.type: Optional[str] = payload.get("type") + self.url: Optional[str] = payload.get("url") + self.configuration: Optional[Dict[str, object]] = payload.get("configuration") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) self._solution = { "service_sid": service_sid, "channel_sid": channel_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[WebhookContext] = None @@ -73,69 +85,6 @@ def _proxy(self) -> "WebhookContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: - """ - return self._properties["service_sid"] - - @property - def channel_sid(self) -> str: - """ - :returns: - """ - return self._properties["channel_sid"] - - @property - def type(self) -> str: - """ - :returns: - """ - return self._properties["type"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def configuration(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["configuration"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - def delete(self) -> bool: """ Deletes the WebhookInstance diff --git a/twilio/rest/ip_messaging/v2/service/role.py b/twilio/rest/ip_messaging/v2/service/role.py index e52fde044..0669177b0 100644 --- a/twilio/rest/ip_messaging/v2/service/role.py +++ b/twilio/rest/ip_messaging/v2/service/role.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,27 +28,44 @@ class RoleType(object): CHANNEL = "channel" DEPLOYMENT = "deployment" - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the RoleInstance - """ + """ + :ivar sid: + :ivar account_sid: + :ivar service_sid: + :ivar friendly_name: + :ivar type: + :ivar permissions: + :ivar date_created: + :ivar date_updated: + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "friendly_name": payload.get("friendly_name"), - "type": payload.get("type"), - "permissions": payload.get("permissions"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.type: Optional["RoleInstance.RoleType"] = payload.get("type") + self.permissions: Optional[List[str]] = payload.get("permissions") + 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 = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[RoleContext] = None @@ -68,69 +85,6 @@ def _proxy(self) -> "RoleContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: - """ - return self._properties["service_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: - """ - return self._properties["friendly_name"] - - @property - def type(self) -> "RoleInstance.RoleType": - """ - :returns: - """ - return self._properties["type"] - - @property - def permissions(self) -> List[str]: - """ - :returns: - """ - return self._properties["permissions"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the RoleInstance diff --git a/twilio/rest/ip_messaging/v2/service/user/__init__.py b/twilio/rest/ip_messaging/v2/service/user/__init__.py index 605f6bfc4..f59ff7e98 100644 --- a/twilio/rest/ip_messaging/v2/service/user/__init__.py +++ b/twilio/rest/ip_messaging/v2/service/user/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -30,34 +30,56 @@ class WebhookEnabledType(object): TRUE = "true" FALSE = "false" - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the UserInstance - """ + """ + :ivar sid: + :ivar account_sid: + :ivar service_sid: + :ivar attributes: + :ivar friendly_name: + :ivar role_sid: + :ivar identity: + :ivar is_online: + :ivar is_notifiable: + :ivar date_created: + :ivar date_updated: + :ivar joined_channels_count: + :ivar links: + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "attributes": payload.get("attributes"), - "friendly_name": payload.get("friendly_name"), - "role_sid": payload.get("role_sid"), - "identity": payload.get("identity"), - "is_online": payload.get("is_online"), - "is_notifiable": payload.get("is_notifiable"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "joined_channels_count": deserialize.integer( - payload.get("joined_channels_count") - ), - "links": payload.get("links"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.attributes: Optional[str] = payload.get("attributes") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.role_sid: Optional[str] = payload.get("role_sid") + self.identity: Optional[str] = payload.get("identity") + self.is_online: Optional[bool] = payload.get("is_online") + self.is_notifiable: Optional[bool] = payload.get("is_notifiable") + 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.joined_channels_count: Optional[int] = deserialize.integer( + payload.get("joined_channels_count") + ) + self.links: Optional[Dict[str, object]] = payload.get("links") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[UserContext] = None @@ -77,104 +99,6 @@ def _proxy(self) -> "UserContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: - """ - return self._properties["service_sid"] - - @property - def attributes(self) -> str: - """ - :returns: - """ - return self._properties["attributes"] - - @property - def friendly_name(self) -> str: - """ - :returns: - """ - return self._properties["friendly_name"] - - @property - def role_sid(self) -> str: - """ - :returns: - """ - return self._properties["role_sid"] - - @property - def identity(self) -> str: - """ - :returns: - """ - return self._properties["identity"] - - @property - def is_online(self) -> bool: - """ - :returns: - """ - return self._properties["is_online"] - - @property - def is_notifiable(self) -> bool: - """ - :returns: - """ - return self._properties["is_notifiable"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def joined_channels_count(self) -> int: - """ - :returns: - """ - return self._properties["joined_channels_count"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the UserInstance diff --git a/twilio/rest/ip_messaging/v2/service/user/user_binding.py b/twilio/rest/ip_messaging/v2/service/user/user_binding.py index e6e29f414..ed51dcdcc 100644 --- a/twilio/rest/ip_messaging/v2/service/user/user_binding.py +++ b/twilio/rest/ip_messaging/v2/service/user/user_binding.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -29,38 +29,54 @@ class BindingType(object): APN = "apn" FCM = "fcm" + """ + :ivar sid: + :ivar account_sid: + :ivar service_sid: + :ivar date_created: + :ivar date_updated: + :ivar endpoint: + :ivar identity: + :ivar user_sid: + :ivar credential_sid: + :ivar binding_type: + :ivar message_types: + :ivar url: + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, user_sid: str, sid: Optional[str] = None, ): - """ - Initialize the UserBindingInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "endpoint": payload.get("endpoint"), - "identity": payload.get("identity"), - "user_sid": payload.get("user_sid"), - "credential_sid": payload.get("credential_sid"), - "binding_type": payload.get("binding_type"), - "message_types": payload.get("message_types"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.endpoint: Optional[str] = payload.get("endpoint") + self.identity: Optional[str] = payload.get("identity") + self.user_sid: Optional[str] = payload.get("user_sid") + self.credential_sid: Optional[str] = payload.get("credential_sid") + self.binding_type: Optional["UserBindingInstance.BindingType"] = payload.get( + "binding_type" + ) + self.message_types: Optional[List[str]] = payload.get("message_types") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, "user_sid": user_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[UserBindingContext] = None @@ -81,90 +97,6 @@ def _proxy(self) -> "UserBindingContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: - """ - return self._properties["service_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def endpoint(self) -> str: - """ - :returns: - """ - return self._properties["endpoint"] - - @property - def identity(self) -> str: - """ - :returns: - """ - return self._properties["identity"] - - @property - def user_sid(self) -> str: - """ - :returns: - """ - return self._properties["user_sid"] - - @property - def credential_sid(self) -> str: - """ - :returns: - """ - return self._properties["credential_sid"] - - @property - def binding_type(self) -> "UserBindingInstance.BindingType": - """ - :returns: - """ - return self._properties["binding_type"] - - @property - def message_types(self) -> List[str]: - """ - :returns: - """ - return self._properties["message_types"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the UserBindingInstance diff --git a/twilio/rest/ip_messaging/v2/service/user/user_channel.py b/twilio/rest/ip_messaging/v2/service/user/user_channel.py index 2a8d339a6..c14c852d4 100644 --- a/twilio/rest/ip_messaging/v2/service/user/user_channel.py +++ b/twilio/rest/ip_messaging/v2/service/user/user_channel.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -32,41 +32,54 @@ class NotificationLevel(object): DEFAULT = "default" MUTED = "muted" + """ + :ivar account_sid: + :ivar service_sid: + :ivar channel_sid: + :ivar user_sid: + :ivar member_sid: + :ivar status: + :ivar last_consumed_message_index: + :ivar unread_messages_count: + :ivar links: + :ivar url: + :ivar notification_level: + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, user_sid: str, channel_sid: Optional[str] = None, ): - """ - Initialize the UserChannelInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "channel_sid": payload.get("channel_sid"), - "user_sid": payload.get("user_sid"), - "member_sid": payload.get("member_sid"), - "status": payload.get("status"), - "last_consumed_message_index": deserialize.integer( - payload.get("last_consumed_message_index") - ), - "unread_messages_count": deserialize.integer( - payload.get("unread_messages_count") - ), - "links": payload.get("links"), - "url": payload.get("url"), - "notification_level": payload.get("notification_level"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.channel_sid: Optional[str] = payload.get("channel_sid") + self.user_sid: Optional[str] = payload.get("user_sid") + self.member_sid: Optional[str] = payload.get("member_sid") + self.status: Optional["UserChannelInstance.ChannelStatus"] = payload.get( + "status" + ) + self.last_consumed_message_index: Optional[int] = deserialize.integer( + payload.get("last_consumed_message_index") + ) + self.unread_messages_count: Optional[int] = deserialize.integer( + payload.get("unread_messages_count") + ) + self.links: Optional[Dict[str, object]] = payload.get("links") + self.url: Optional[str] = payload.get("url") + self.notification_level: Optional[ + "UserChannelInstance.NotificationLevel" + ] = payload.get("notification_level") self._solution = { "service_sid": service_sid, "user_sid": user_sid, - "channel_sid": channel_sid or self._properties["channel_sid"], + "channel_sid": channel_sid or self.channel_sid, } self._context: Optional[UserChannelContext] = None @@ -87,83 +100,6 @@ def _proxy(self) -> "UserChannelContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: - """ - return self._properties["service_sid"] - - @property - def channel_sid(self) -> str: - """ - :returns: - """ - return self._properties["channel_sid"] - - @property - def user_sid(self) -> str: - """ - :returns: - """ - return self._properties["user_sid"] - - @property - def member_sid(self) -> str: - """ - :returns: - """ - return self._properties["member_sid"] - - @property - def status(self) -> "UserChannelInstance.ChannelStatus": - """ - :returns: - """ - return self._properties["status"] - - @property - def last_consumed_message_index(self) -> int: - """ - :returns: - """ - return self._properties["last_consumed_message_index"] - - @property - def unread_messages_count(self) -> int: - """ - :returns: - """ - return self._properties["unread_messages_count"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def notification_level(self) -> "UserChannelInstance.NotificationLevel": - """ - :returns: - """ - return self._properties["notification_level"] - def delete(self) -> bool: """ Deletes the UserChannelInstance diff --git a/twilio/rest/lookups/v1/phone_number.py b/twilio/rest/lookups/v1/phone_number.py index 391f99054..fee8aad6b 100644 --- a/twilio/rest/lookups/v1/phone_number.py +++ b/twilio/rest/lookups/v1/phone_number.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -22,24 +22,35 @@ class PhoneNumberInstance(InstanceResource): - def __init__(self, version, payload, phone_number: Optional[str] = None): - """ - Initialize the PhoneNumberInstance - """ + + """ + :ivar caller_name: The name of the phone number's owner. If `null`, that information was not available. + :ivar country_code: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) for the phone number. + :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + :ivar national_format: The phone number, in national format. + :ivar carrier: The telecom company that provides the phone number. + :ivar add_ons: A JSON string with the results of the Add-ons you specified in the `add_ons` parameters. For the format of the object, see [Using Add-ons](https://www.twilio.com/docs/add-ons). + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + phone_number: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "caller_name": payload.get("caller_name"), - "country_code": payload.get("country_code"), - "phone_number": payload.get("phone_number"), - "national_format": payload.get("national_format"), - "carrier": payload.get("carrier"), - "add_ons": payload.get("add_ons"), - "url": payload.get("url"), - } + self.caller_name: Optional[Dict[str, object]] = payload.get("caller_name") + self.country_code: Optional[str] = payload.get("country_code") + self.phone_number: Optional[str] = payload.get("phone_number") + self.national_format: Optional[str] = payload.get("national_format") + self.carrier: Optional[Dict[str, object]] = payload.get("carrier") + self.add_ons: Optional[Dict[str, object]] = payload.get("add_ons") + self.url: Optional[str] = payload.get("url") self._solution = { - "phone_number": phone_number or self._properties["phone_number"], + "phone_number": phone_number or self.phone_number, } self._context: Optional[PhoneNumberContext] = None @@ -58,55 +69,6 @@ def _proxy(self) -> "PhoneNumberContext": ) return self._context - @property - def caller_name(self) -> Dict[str, object]: - """ - :returns: The name of the phone number's owner. If `null`, that information was not available. - """ - return self._properties["caller_name"] - - @property - def country_code(self) -> str: - """ - :returns: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) for the phone number. - """ - return self._properties["country_code"] - - @property - def phone_number(self) -> str: - """ - :returns: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. - """ - return self._properties["phone_number"] - - @property - def national_format(self) -> str: - """ - :returns: The phone number, in national format. - """ - return self._properties["national_format"] - - @property - def carrier(self) -> Dict[str, object]: - """ - :returns: The telecom company that provides the phone number. - """ - return self._properties["carrier"] - - @property - def add_ons(self) -> Dict[str, object]: - """ - :returns: A JSON string with the results of the Add-ons you specified in the `add_ons` parameters. For the format of the object, see [Using Add-ons](https://www.twilio.com/docs/add-ons). - """ - return self._properties["add_ons"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def fetch( self, country_code=values.unset, diff --git a/twilio/rest/lookups/v2/phone_number.py b/twilio/rest/lookups/v2/phone_number.py index 00c38185f..0789407fa 100644 --- a/twilio/rest/lookups/v2/phone_number.py +++ b/twilio/rest/lookups/v2/phone_number.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -30,32 +30,60 @@ class ValidationError(object): INVALID_LENGTH = "INVALID_LENGTH" NOT_A_NUMBER = "NOT_A_NUMBER" - def __init__(self, version, payload, phone_number: Optional[str] = None): - """ - Initialize the PhoneNumberInstance - """ + """ + :ivar calling_country_code: International dialing prefix of the phone number defined in the E.164 standard. + :ivar country_code: The phone number's [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + :ivar national_format: The phone number in [national format](https://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers). + :ivar valid: Boolean which indicates if the phone number is in a valid range that can be freely assigned by a carrier to a user. + :ivar validation_errors: Contains reasons why a phone number is invalid. Possible values: TOO_SHORT, TOO_LONG, INVALID_BUT_POSSIBLE, INVALID_COUNTRY_CODE, INVALID_LENGTH, NOT_A_NUMBER. + :ivar caller_name: An object that contains caller name information based on [CNAM](https://support.twilio.com/hc/en-us/articles/360051670533-Getting-Started-with-CNAM-Caller-ID). + :ivar sim_swap: An object that contains information on the last date the subscriber identity module (SIM) was changed for a mobile phone number. + :ivar call_forwarding: An object that contains information on the unconditional call forwarding status of mobile phone number. + :ivar live_activity: An object that contains live activity information for a mobile phone number. + :ivar line_type_intelligence: An object that contains line type information including the carrier name, mobile country code, and mobile network code. + :ivar identity_match: An object that contains identity match information. The result of comparing user-provided information including name, address, date of birth, national ID, against authoritative phone-based data sources + :ivar sms_pumping_risk: An object that contains information on if a phone number has been currently or previously blocked by Verify Fraud Guard for receiving malicious SMS pumping traffic as well as other signals associated with risky carriers and low conversion rates. + :ivar disposable_phone_number_risk: An object that contains information on if a mobile phone number could be a disposable or burner number. + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + phone_number: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "calling_country_code": payload.get("calling_country_code"), - "country_code": payload.get("country_code"), - "phone_number": payload.get("phone_number"), - "national_format": payload.get("national_format"), - "valid": payload.get("valid"), - "validation_errors": payload.get("validation_errors"), - "caller_name": payload.get("caller_name"), - "sim_swap": payload.get("sim_swap"), - "call_forwarding": payload.get("call_forwarding"), - "live_activity": payload.get("live_activity"), - "line_type_intelligence": payload.get("line_type_intelligence"), - "identity_match": payload.get("identity_match"), - "sms_pumping_risk": payload.get("sms_pumping_risk"), - "disposable_phone_number_risk": payload.get("disposable_phone_number_risk"), - "url": payload.get("url"), - } + self.calling_country_code: Optional[str] = payload.get("calling_country_code") + self.country_code: Optional[str] = payload.get("country_code") + self.phone_number: Optional[str] = payload.get("phone_number") + self.national_format: Optional[str] = payload.get("national_format") + self.valid: Optional[bool] = payload.get("valid") + self.validation_errors: Optional[ + List["PhoneNumberInstance.ValidationError"] + ] = payload.get("validation_errors") + self.caller_name: Optional[Dict[str, object]] = payload.get("caller_name") + self.sim_swap: Optional[Dict[str, object]] = payload.get("sim_swap") + self.call_forwarding: Optional[Dict[str, object]] = payload.get( + "call_forwarding" + ) + self.live_activity: Optional[Dict[str, object]] = payload.get("live_activity") + self.line_type_intelligence: Optional[Dict[str, object]] = payload.get( + "line_type_intelligence" + ) + self.identity_match: Optional[Dict[str, object]] = payload.get("identity_match") + self.sms_pumping_risk: Optional[Dict[str, object]] = payload.get( + "sms_pumping_risk" + ) + self.disposable_phone_number_risk: Optional[Dict[str, object]] = payload.get( + "disposable_phone_number_risk" + ) + self.url: Optional[str] = payload.get("url") self._solution = { - "phone_number": phone_number or self._properties["phone_number"], + "phone_number": phone_number or self.phone_number, } self._context: Optional[PhoneNumberContext] = None @@ -74,111 +102,6 @@ def _proxy(self) -> "PhoneNumberContext": ) return self._context - @property - def calling_country_code(self) -> str: - """ - :returns: International dialing prefix of the phone number defined in the E.164 standard. - """ - return self._properties["calling_country_code"] - - @property - def country_code(self) -> str: - """ - :returns: The phone number's [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). - """ - return self._properties["country_code"] - - @property - def phone_number(self) -> str: - """ - :returns: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. - """ - return self._properties["phone_number"] - - @property - def national_format(self) -> str: - """ - :returns: The phone number in [national format](https://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers). - """ - return self._properties["national_format"] - - @property - def valid(self) -> bool: - """ - :returns: Boolean which indicates if the phone number is in a valid range that can be freely assigned by a carrier to a user. - """ - return self._properties["valid"] - - @property - def validation_errors(self) -> List["PhoneNumberInstance.ValidationError"]: - """ - :returns: Contains reasons why a phone number is invalid. Possible values: TOO_SHORT, TOO_LONG, INVALID_BUT_POSSIBLE, INVALID_COUNTRY_CODE, INVALID_LENGTH, NOT_A_NUMBER. - """ - return self._properties["validation_errors"] - - @property - def caller_name(self) -> Dict[str, object]: - """ - :returns: An object that contains caller name information based on [CNAM](https://support.twilio.com/hc/en-us/articles/360051670533-Getting-Started-with-CNAM-Caller-ID). - """ - return self._properties["caller_name"] - - @property - def sim_swap(self) -> Dict[str, object]: - """ - :returns: An object that contains information on the last date the subscriber identity module (SIM) was changed for a mobile phone number. - """ - return self._properties["sim_swap"] - - @property - def call_forwarding(self) -> Dict[str, object]: - """ - :returns: An object that contains information on the unconditional call forwarding status of mobile phone number. - """ - return self._properties["call_forwarding"] - - @property - def live_activity(self) -> Dict[str, object]: - """ - :returns: An object that contains live activity information for a mobile phone number. - """ - return self._properties["live_activity"] - - @property - def line_type_intelligence(self) -> Dict[str, object]: - """ - :returns: An object that contains line type information including the carrier name, mobile country code, and mobile network code. - """ - return self._properties["line_type_intelligence"] - - @property - def identity_match(self) -> Dict[str, object]: - """ - :returns: An object that contains identity match information. The result of comparing user-provided information including name, address, date of birth, national ID, against authoritative phone-based data sources - """ - return self._properties["identity_match"] - - @property - def sms_pumping_risk(self) -> Dict[str, object]: - """ - :returns: An object that contains information on if a phone number has been currently or previously blocked by Verify Fraud Guard for receiving malicious SMS pumping traffic as well as other signals associated with risky carriers and low conversion rates. - """ - return self._properties["sms_pumping_risk"] - - @property - def disposable_phone_number_risk(self) -> Dict[str, object]: - """ - :returns: An object that contains information on if a mobile phone number could be a disposable or burner number. - """ - return self._properties["disposable_phone_number_risk"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def fetch( self, fields=values.unset, diff --git a/twilio/rest/media/v1/media_processor.py b/twilio/rest/media/v1/media_processor.py index 2ad45d00e..caa7b3b76 100644 --- a/twilio/rest/media/v1/media_processor.py +++ b/twilio/rest/media/v1/media_processor.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -33,29 +33,49 @@ class Status(object): STARTED = "started" ENDED = "ended" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the MediaProcessorInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the MediaProcessor resource. + :ivar sid: The unique string generated to identify the MediaProcessor resource. + :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 extension: The [Media Extension](/docs/live/api/media-extensions-overview) name or URL. Ex: `video-composer-v2` + :ivar extension_context: The context of the Media Extension, represented as a JSON dictionary. See the documentation for the specific [Media Extension](/docs/live/api/media-extensions-overview) you are using for more information about the context to send. + :ivar status: + :ivar url: The absolute URL of the resource. + :ivar ended_reason: The reason why a MediaProcessor ended. When a MediaProcessor is in progress, will be `null`. When a MediaProcessor is completed, can be `ended-via-api`, `max-duration-exceeded`, `error-loading-extension`, `error-streaming-media` or `internal-service-error`. See [ended reasons](/docs/live/api/mediaprocessors#mediaprocessor-ended-reason-values) for more details. + :ivar status_callback: The URL to which Twilio will send asynchronous webhook requests for every MediaProcessor event. See [Status Callbacks](/docs/live/status-callbacks) for details. + :ivar status_callback_method: The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. + :ivar max_duration: The maximum time, in seconds, that the MediaProcessor can run before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the MediaProcessor, regardless of whether media is still streaming. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "sid": payload.get("sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "extension": payload.get("extension"), - "extension_context": payload.get("extension_context"), - "status": payload.get("status"), - "url": payload.get("url"), - "ended_reason": payload.get("ended_reason"), - "status_callback": payload.get("status_callback"), - "status_callback_method": payload.get("status_callback_method"), - "max_duration": deserialize.integer(payload.get("max_duration")), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.sid: Optional[str] = payload.get("sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.extension: Optional[str] = payload.get("extension") + self.extension_context: Optional[str] = payload.get("extension_context") + self.status: Optional["MediaProcessorInstance.Status"] = payload.get("status") + self.url: Optional[str] = payload.get("url") + self.ended_reason: Optional[str] = payload.get("ended_reason") + self.status_callback: Optional[str] = payload.get("status_callback") + self.status_callback_method: Optional[str] = payload.get( + "status_callback_method" + ) + self.max_duration: Optional[int] = deserialize.integer( + payload.get("max_duration") + ) self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[MediaProcessorContext] = None @@ -74,90 +94,6 @@ def _proxy(self) -> "MediaProcessorContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the MediaProcessor resource. - """ - return self._properties["account_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string generated to identify the MediaProcessor resource. - """ - return self._properties["sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def extension(self) -> str: - """ - :returns: The [Media Extension](/docs/live/api/media-extensions-overview) name or URL. Ex: `video-composer-v2` - """ - return self._properties["extension"] - - @property - def extension_context(self) -> str: - """ - :returns: The context of the Media Extension, represented as a JSON dictionary. See the documentation for the specific [Media Extension](/docs/live/api/media-extensions-overview) you are using for more information about the context to send. - """ - return self._properties["extension_context"] - - @property - def status(self) -> "MediaProcessorInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def ended_reason(self) -> str: - """ - :returns: The reason why a MediaProcessor ended. When a MediaProcessor is in progress, will be `null`. When a MediaProcessor is completed, can be `ended-via-api`, `max-duration-exceeded`, `error-loading-extension`, `error-streaming-media` or `internal-service-error`. See [ended reasons](/docs/live/api/mediaprocessors#mediaprocessor-ended-reason-values) for more details. - """ - return self._properties["ended_reason"] - - @property - def status_callback(self) -> str: - """ - :returns: The URL to which Twilio will send asynchronous webhook requests for every MediaProcessor event. See [Status Callbacks](/docs/live/status-callbacks) for details. - """ - return self._properties["status_callback"] - - @property - def status_callback_method(self) -> str: - """ - :returns: The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. - """ - return self._properties["status_callback_method"] - - @property - def max_duration(self) -> int: - """ - :returns: The maximum time, in seconds, that the MediaProcessor can run before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the MediaProcessor, regardless of whether media is still streaming. - """ - return self._properties["max_duration"] - def fetch(self) -> "MediaProcessorInstance": """ Fetch the MediaProcessorInstance diff --git a/twilio/rest/media/v1/media_recording.py b/twilio/rest/media/v1/media_recording.py index 3be3b3a91..d0aa6ae5a 100644 --- a/twilio/rest/media/v1/media_recording.py +++ b/twilio/rest/media/v1/media_recording.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -38,32 +38,53 @@ class Status(object): DELETED = "deleted" FAILED = "failed" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the MediaRecordingInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the MediaRecording resource. + :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 duration: The duration of the MediaRecording in seconds. + :ivar format: + :ivar links: The URLs of related resources. + :ivar processor_sid: The SID of the MediaProcessor resource which produced the MediaRecording. + :ivar resolution: The dimensions of the video image in pixels expressed as columns (width) and rows (height). + :ivar source_sid: The SID of the resource that generated the original media track(s) of the MediaRecording. + :ivar sid: The unique string generated to identify the MediaRecording resource. + :ivar media_size: The size of the recording media in bytes. + :ivar status: + :ivar status_callback: The URL to which Twilio will send asynchronous webhook requests for every MediaRecording event. See [Status Callbacks](/docs/live/status-callbacks) for more details. + :ivar status_callback_method: The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "duration": deserialize.integer(payload.get("duration")), - "format": payload.get("format"), - "links": payload.get("links"), - "processor_sid": payload.get("processor_sid"), - "resolution": payload.get("resolution"), - "source_sid": payload.get("source_sid"), - "sid": payload.get("sid"), - "media_size": payload.get("media_size"), - "status": payload.get("status"), - "status_callback": payload.get("status_callback"), - "status_callback_method": payload.get("status_callback_method"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.duration: Optional[int] = deserialize.integer(payload.get("duration")) + self.format: Optional["MediaRecordingInstance.Format"] = payload.get("format") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.processor_sid: Optional[str] = payload.get("processor_sid") + self.resolution: Optional[str] = payload.get("resolution") + self.source_sid: Optional[str] = payload.get("source_sid") + self.sid: Optional[str] = payload.get("sid") + self.media_size: Optional[int] = payload.get("media_size") + self.status: Optional["MediaRecordingInstance.Status"] = payload.get("status") + self.status_callback: Optional[str] = payload.get("status_callback") + self.status_callback_method: Optional[str] = payload.get( + "status_callback_method" + ) + self.url: Optional[str] = payload.get("url") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[MediaRecordingContext] = None @@ -82,111 +103,6 @@ def _proxy(self) -> "MediaRecordingContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the MediaRecording resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def duration(self) -> int: - """ - :returns: The duration of the MediaRecording in seconds. - """ - return self._properties["duration"] - - @property - def format(self) -> "MediaRecordingInstance.Format": - """ - :returns: - """ - return self._properties["format"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - - @property - def processor_sid(self) -> str: - """ - :returns: The SID of the MediaProcessor resource which produced the MediaRecording. - """ - return self._properties["processor_sid"] - - @property - def resolution(self) -> str: - """ - :returns: The dimensions of the video image in pixels expressed as columns (width) and rows (height). - """ - return self._properties["resolution"] - - @property - def source_sid(self) -> str: - """ - :returns: The SID of the resource that generated the original media track(s) of the MediaRecording. - """ - return self._properties["source_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string generated to identify the MediaRecording resource. - """ - return self._properties["sid"] - - @property - def media_size(self) -> int: - """ - :returns: The size of the recording media in bytes. - """ - return self._properties["media_size"] - - @property - def status(self) -> "MediaRecordingInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def status_callback(self) -> str: - """ - :returns: The URL to which Twilio will send asynchronous webhook requests for every MediaRecording event. See [Status Callbacks](/docs/live/status-callbacks) for more details. - """ - return self._properties["status_callback"] - - @property - def status_callback_method(self) -> str: - """ - :returns: The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. - """ - return self._properties["status_callback_method"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the MediaRecordingInstance diff --git a/twilio/rest/media/v1/player_streamer/__init__.py b/twilio/rest/media/v1/player_streamer/__init__.py index d5ffb1e37..8d5670c5b 100644 --- a/twilio/rest/media/v1/player_streamer/__init__.py +++ b/twilio/rest/media/v1/player_streamer/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -41,29 +41,51 @@ class Status(object): ENDED = "ended" FAILED = "failed" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the PlayerStreamerInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PlayerStreamer resource. + :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 video: Specifies whether the PlayerStreamer is configured to stream video. Defaults to `true`. + :ivar links: The URLs of related resources. + :ivar sid: The unique string generated to identify the PlayerStreamer resource. + :ivar status: + :ivar url: The absolute URL of the resource. + :ivar status_callback: The URL to which Twilio will send asynchronous webhook requests for every PlayerStreamer event. See [Status Callbacks](/docs/live/status-callbacks) for more details. + :ivar status_callback_method: The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. + :ivar ended_reason: + :ivar max_duration: The maximum time, in seconds, that the PlayerStreamer is active (`created` or `started`) before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the PlayerStreamer, regardless of whether media is still streaming. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "video": payload.get("video"), - "links": payload.get("links"), - "sid": payload.get("sid"), - "status": payload.get("status"), - "url": payload.get("url"), - "status_callback": payload.get("status_callback"), - "status_callback_method": payload.get("status_callback_method"), - "ended_reason": payload.get("ended_reason"), - "max_duration": deserialize.integer(payload.get("max_duration")), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.video: Optional[bool] = payload.get("video") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.sid: Optional[str] = payload.get("sid") + self.status: Optional["PlayerStreamerInstance.Status"] = payload.get("status") + self.url: Optional[str] = payload.get("url") + self.status_callback: Optional[str] = payload.get("status_callback") + self.status_callback_method: Optional[str] = payload.get( + "status_callback_method" + ) + self.ended_reason: Optional["PlayerStreamerInstance.EndedReason"] = payload.get( + "ended_reason" + ) + self.max_duration: Optional[int] = deserialize.integer( + payload.get("max_duration") + ) self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[PlayerStreamerContext] = None @@ -82,90 +104,6 @@ def _proxy(self) -> "PlayerStreamerContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PlayerStreamer resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def video(self) -> bool: - """ - :returns: Specifies whether the PlayerStreamer is configured to stream video. Defaults to `true`. - """ - return self._properties["video"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - - @property - def sid(self) -> str: - """ - :returns: The unique string generated to identify the PlayerStreamer resource. - """ - return self._properties["sid"] - - @property - def status(self) -> "PlayerStreamerInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def status_callback(self) -> str: - """ - :returns: The URL to which Twilio will send asynchronous webhook requests for every PlayerStreamer event. See [Status Callbacks](/docs/live/status-callbacks) for more details. - """ - return self._properties["status_callback"] - - @property - def status_callback_method(self) -> str: - """ - :returns: The HTTP method Twilio should use to call the `status_callback` URL. Can be `POST` or `GET` and the default is `POST`. - """ - return self._properties["status_callback_method"] - - @property - def ended_reason(self) -> "PlayerStreamerInstance.EndedReason": - """ - :returns: - """ - return self._properties["ended_reason"] - - @property - def max_duration(self) -> int: - """ - :returns: The maximum time, in seconds, that the PlayerStreamer is active (`created` or `started`) before automatically ends. The default value is 300 seconds, and the maximum value is 90000 seconds. Once this maximum duration is reached, Twilio will end the PlayerStreamer, regardless of whether media is still streaming. - """ - return self._properties["max_duration"] - def fetch(self) -> "PlayerStreamerInstance": """ Fetch the PlayerStreamerInstance diff --git a/twilio/rest/media/v1/player_streamer/playback_grant.py b/twilio/rest/media/v1/player_streamer/playback_grant.py index 6a82d99f2..9e4e53223 100644 --- a/twilio/rest/media/v1/player_streamer/playback_grant.py +++ b/twilio/rest/media/v1/player_streamer/playback_grant.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,19 +23,25 @@ class PlaybackGrantInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - """ - Initialize the PlaybackGrantInstance - """ + + """ + :ivar sid: The unique string generated to identify the PlayerStreamer resource that this PlaybackGrant authorizes views for. + :ivar url: The absolute URL of the resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this resource. + :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 grant: The grant that authorizes the player sdk to connect to the livestream + """ + + def __init__(self, version: Version, payload: Dict[str, Any], sid: str): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "url": payload.get("url"), - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "grant": payload.get("grant"), - } + self.sid: Optional[str] = payload.get("sid") + self.url: Optional[str] = payload.get("url") + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.grant: Optional[Dict[str, object]] = payload.get("grant") self._solution = { "sid": sid, @@ -57,41 +63,6 @@ def _proxy(self) -> "PlaybackGrantContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string generated to identify the PlayerStreamer resource that this PlaybackGrant authorizes views for. - """ - return self._properties["sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created this resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def grant(self) -> Dict[str, object]: - """ - :returns: The grant that authorizes the player sdk to connect to the livestream - """ - return self._properties["grant"] - def create( self, ttl=values.unset, access_control_allow_origin=values.unset ) -> "PlaybackGrantInstance": diff --git a/twilio/rest/messaging/v1/brand_registration/__init__.py b/twilio/rest/messaging/v1/brand_registration/__init__.py index 2ad35c51d..9c8fd61cf 100644 --- a/twilio/rest/messaging/v1/brand_registration/__init__.py +++ b/twilio/rest/messaging/v1/brand_registration/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -45,37 +45,75 @@ class Status(object): IN_REVIEW = "IN_REVIEW" DELETED = "DELETED" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the BrandRegistrationInstance - """ + """ + :ivar sid: The unique string to identify Brand Registration. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Brand Registration resource. + :ivar customer_profile_bundle_sid: A2P Messaging Profile Bundle BundleSid. + :ivar a2p_profile_bundle_sid: A2P Messaging Profile Bundle BundleSid. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar brand_type: Type of brand. One of: \"STANDARD\", \"STARTER\". STARTER is for the low volume, STARTER campaign use case. There can only be one STARTER campaign created per STARTER brand. STANDARD is for all other campaign use cases. Multiple campaign use cases can be created per STANDARD brand. + :ivar status: + :ivar tcr_id: Campaign Registry (TCR) Brand ID. Assigned only after successful brand registration. + :ivar failure_reason: A reason why brand registration has failed. Only applicable when status is FAILED. + :ivar url: The absolute URL of the Brand Registration resource. + :ivar brand_score: The secondary vetting score if it was done. Otherwise, it will be the brand score if it's returned from TCR. It may be null if no score is available. + :ivar brand_feedback: Feedback on how to improve brand score + :ivar identity_status: + :ivar russell_3000: Publicly traded company identified in the Russell 3000 Index + :ivar government_entity: Identified as a government entity + :ivar tax_exempt_status: Nonprofit organization tax-exempt status per section 501 of the U.S. tax code. + :ivar skip_automatic_sec_vet: A flag to disable automatic secondary vetting for brands which it would otherwise be done. + :ivar mock: A boolean that specifies whether brand should be a mock or not. If true, brand will be registered as a mock brand. Defaults to false if no value is provided. + :ivar links: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "customer_profile_bundle_sid": payload.get("customer_profile_bundle_sid"), - "a2p_profile_bundle_sid": payload.get("a2p_profile_bundle_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "brand_type": payload.get("brand_type"), - "status": payload.get("status"), - "tcr_id": payload.get("tcr_id"), - "failure_reason": payload.get("failure_reason"), - "url": payload.get("url"), - "brand_score": deserialize.integer(payload.get("brand_score")), - "brand_feedback": payload.get("brand_feedback"), - "identity_status": payload.get("identity_status"), - "russell_3000": payload.get("russell_3000"), - "government_entity": payload.get("government_entity"), - "tax_exempt_status": payload.get("tax_exempt_status"), - "skip_automatic_sec_vet": payload.get("skip_automatic_sec_vet"), - "mock": payload.get("mock"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.customer_profile_bundle_sid: Optional[str] = payload.get( + "customer_profile_bundle_sid" + ) + self.a2p_profile_bundle_sid: Optional[str] = payload.get( + "a2p_profile_bundle_sid" + ) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.brand_type: Optional[str] = payload.get("brand_type") + self.status: Optional["BrandRegistrationInstance.Status"] = payload.get( + "status" + ) + self.tcr_id: Optional[str] = payload.get("tcr_id") + self.failure_reason: Optional[str] = payload.get("failure_reason") + self.url: Optional[str] = payload.get("url") + self.brand_score: Optional[int] = deserialize.integer( + payload.get("brand_score") + ) + self.brand_feedback: Optional[ + List["BrandRegistrationInstance.BrandFeedback"] + ] = payload.get("brand_feedback") + self.identity_status: Optional[ + "BrandRegistrationInstance.IdentityStatus" + ] = payload.get("identity_status") + self.russell_3000: Optional[bool] = payload.get("russell_3000") + self.government_entity: Optional[bool] = payload.get("government_entity") + self.tax_exempt_status: Optional[str] = payload.get("tax_exempt_status") + self.skip_automatic_sec_vet: Optional[bool] = payload.get( + "skip_automatic_sec_vet" + ) + self.mock: Optional[bool] = payload.get("mock") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[BrandRegistrationContext] = None @@ -94,146 +132,6 @@ def _proxy(self) -> "BrandRegistrationContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string to identify Brand Registration. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Brand Registration resource. - """ - return self._properties["account_sid"] - - @property - def customer_profile_bundle_sid(self) -> str: - """ - :returns: A2P Messaging Profile Bundle BundleSid. - """ - return self._properties["customer_profile_bundle_sid"] - - @property - def a2p_profile_bundle_sid(self) -> str: - """ - :returns: A2P Messaging Profile Bundle BundleSid. - """ - return self._properties["a2p_profile_bundle_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def brand_type(self) -> str: - """ - :returns: Type of brand. One of: \"STANDARD\", \"STARTER\". STARTER is for the low volume, STARTER campaign use case. There can only be one STARTER campaign created per STARTER brand. STANDARD is for all other campaign use cases. Multiple campaign use cases can be created per STANDARD brand. - """ - return self._properties["brand_type"] - - @property - def status(self) -> "BrandRegistrationInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def tcr_id(self) -> str: - """ - :returns: Campaign Registry (TCR) Brand ID. Assigned only after successful brand registration. - """ - return self._properties["tcr_id"] - - @property - def failure_reason(self) -> str: - """ - :returns: A reason why brand registration has failed. Only applicable when status is FAILED. - """ - return self._properties["failure_reason"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Brand Registration resource. - """ - return self._properties["url"] - - @property - def brand_score(self) -> int: - """ - :returns: The secondary vetting score if it was done. Otherwise, it will be the brand score if it's returned from TCR. It may be null if no score is available. - """ - return self._properties["brand_score"] - - @property - def brand_feedback(self) -> List["BrandRegistrationInstance.BrandFeedback"]: - """ - :returns: Feedback on how to improve brand score - """ - return self._properties["brand_feedback"] - - @property - def identity_status(self) -> "BrandRegistrationInstance.IdentityStatus": - """ - :returns: - """ - return self._properties["identity_status"] - - @property - def russell_3000(self) -> bool: - """ - :returns: Publicly traded company identified in the Russell 3000 Index - """ - return self._properties["russell_3000"] - - @property - def government_entity(self) -> bool: - """ - :returns: Identified as a government entity - """ - return self._properties["government_entity"] - - @property - def tax_exempt_status(self) -> str: - """ - :returns: Nonprofit organization tax-exempt status per section 501 of the U.S. tax code. - """ - return self._properties["tax_exempt_status"] - - @property - def skip_automatic_sec_vet(self) -> bool: - """ - :returns: A flag to disable automatic secondary vetting for brands which it would otherwise be done. - """ - return self._properties["skip_automatic_sec_vet"] - - @property - def mock(self) -> bool: - """ - :returns: A boolean that specifies whether brand should be a mock or not. If true, brand will be registered as a mock brand. Defaults to false if no value is provided. - """ - return self._properties["mock"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - def fetch(self) -> "BrandRegistrationInstance": """ Fetch the BrandRegistrationInstance diff --git a/twilio/rest/messaging/v1/brand_registration/brand_vetting.py b/twilio/rest/messaging/v1/brand_registration/brand_vetting.py index a8924ca55..32bd4e08b 100644 --- a/twilio/rest/messaging/v1/brand_registration/brand_vetting.py +++ b/twilio/rest/messaging/v1/brand_registration/brand_vetting.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,31 +27,48 @@ class BrandVettingInstance(InstanceResource): class VettingProvider(object): CAMPAIGN_VERIFY = "campaign-verify" + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the vetting record. + :ivar brand_sid: The unique string to identify Brand Registration. + :ivar brand_vetting_sid: The Twilio SID of the third-party vetting record. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar vetting_id: The unique identifier of the vetting from the third-party provider. + :ivar vetting_class: The type of vetting that has been conducted. One of “STANDARD” (Aegis) or “POLITICAL” (Campaign Verify). + :ivar vetting_status: The status of the import vetting attempt. One of “PENDING,” “SUCCESS,” or “FAILED”. + :ivar vetting_provider: + :ivar url: The absolute URL of the Brand Vetting resource. + """ + def __init__( - self, version, payload, brand_sid: str, brand_vetting_sid: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + brand_sid: str, + brand_vetting_sid: Optional[str] = None, ): - """ - Initialize the BrandVettingInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "brand_sid": payload.get("brand_sid"), - "brand_vetting_sid": payload.get("brand_vetting_sid"), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "vetting_id": payload.get("vetting_id"), - "vetting_class": payload.get("vetting_class"), - "vetting_status": payload.get("vetting_status"), - "vetting_provider": payload.get("vetting_provider"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.brand_sid: Optional[str] = payload.get("brand_sid") + self.brand_vetting_sid: Optional[str] = payload.get("brand_vetting_sid") + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.vetting_id: Optional[str] = payload.get("vetting_id") + self.vetting_class: Optional[str] = payload.get("vetting_class") + self.vetting_status: Optional[str] = payload.get("vetting_status") + self.vetting_provider: Optional[ + "BrandVettingInstance.VettingProvider" + ] = payload.get("vetting_provider") + self.url: Optional[str] = payload.get("url") self._solution = { "brand_sid": brand_sid, - "brand_vetting_sid": brand_vetting_sid - or self._properties["brand_vetting_sid"], + "brand_vetting_sid": brand_vetting_sid or self.brand_vetting_sid, } self._context: Optional[BrandVettingContext] = None @@ -71,76 +88,6 @@ def _proxy(self) -> "BrandVettingContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the vetting record. - """ - return self._properties["account_sid"] - - @property - def brand_sid(self) -> str: - """ - :returns: The unique string to identify Brand Registration. - """ - return self._properties["brand_sid"] - - @property - def brand_vetting_sid(self) -> str: - """ - :returns: The Twilio SID of the third-party vetting record. - """ - return self._properties["brand_vetting_sid"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def vetting_id(self) -> str: - """ - :returns: The unique identifier of the vetting from the third-party provider. - """ - return self._properties["vetting_id"] - - @property - def vetting_class(self) -> str: - """ - :returns: The type of vetting that has been conducted. One of “STANDARD” (Aegis) or “POLITICAL” (Campaign Verify). - """ - return self._properties["vetting_class"] - - @property - def vetting_status(self) -> str: - """ - :returns: The status of the import vetting attempt. One of “PENDING,” “SUCCESS,” or “FAILED”. - """ - return self._properties["vetting_status"] - - @property - def vetting_provider(self) -> "BrandVettingInstance.VettingProvider": - """ - :returns: - """ - return self._properties["vetting_provider"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Brand Vetting resource. - """ - return self._properties["url"] - def fetch(self) -> "BrandVettingInstance": """ Fetch the BrandVettingInstance diff --git a/twilio/rest/messaging/v1/deactivations.py b/twilio/rest/messaging/v1/deactivations.py index 9d02f42aa..cc82a224a 100644 --- a/twilio/rest/messaging/v1/deactivations.py +++ b/twilio/rest/messaging/v1/deactivations.py @@ -13,7 +13,7 @@ """ -from typing import Optional +from typing import Any, Dict, Optional from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -22,15 +22,15 @@ class DeactivationsInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the DeactivationsInstance - """ + + """ + :ivar redirect_to: Returns an authenticated url that redirects to a file containing the deactivated numbers for the requested day. This url is valid for up to two minutes. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "redirect_to": payload.get("redirect_to"), - } + self.redirect_to: Optional[str] = payload.get("redirect_to") self._solution = {} self._context: Optional[DeactivationsContext] = None @@ -49,13 +49,6 @@ def _proxy(self) -> "DeactivationsContext": ) return self._context - @property - def redirect_to(self) -> str: - """ - :returns: Returns an authenticated url that redirects to a file containing the deactivated numbers for the requested day. This url is valid for up to two minutes. - """ - return self._properties["redirect_to"] - def fetch(self, date=values.unset) -> "DeactivationsInstance": """ Fetch the DeactivationsInstance diff --git a/twilio/rest/messaging/v1/domain_certs.py b/twilio/rest/messaging/v1/domain_certs.py index 4987243a7..21777b5e5 100644 --- a/twilio/rest/messaging/v1/domain_certs.py +++ b/twilio/rest/messaging/v1/domain_certs.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,25 +23,45 @@ class DomainCertsInstance(InstanceResource): - def __init__(self, version, payload, domain_sid: Optional[str] = None): - """ - Initialize the DomainCertsInstance - """ + + """ + :ivar domain_sid: The unique string that we created to identify the Domain resource. + :ivar date_updated: Date that this Domain was last updated. + :ivar date_expires: Date that the private certificate associated with this domain expires. You will need to update the certificate before that date to ensure your shortened links will continue to work. + :ivar date_created: Date that this Domain was registered to the Twilio platform to create a new Domain object. + :ivar domain_name: Full url path for this domain. + :ivar certificate_sid: The unique string that we created to identify this Certificate resource. + :ivar url: + :ivar cert_in_validation: Optional JSON field describing the status and upload date of a new certificate in the process of validation + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + domain_sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "domain_sid": payload.get("domain_sid"), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "date_expires": deserialize.iso8601_datetime(payload.get("date_expires")), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "domain_name": payload.get("domain_name"), - "certificate_sid": payload.get("certificate_sid"), - "url": payload.get("url"), - "cert_in_validation": payload.get("cert_in_validation"), - } + self.domain_sid: Optional[str] = payload.get("domain_sid") + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.date_expires: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_expires") + ) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.domain_name: Optional[str] = payload.get("domain_name") + self.certificate_sid: Optional[str] = payload.get("certificate_sid") + self.url: Optional[str] = payload.get("url") + self.cert_in_validation: Optional[Dict[str, object]] = payload.get( + "cert_in_validation" + ) self._solution = { - "domain_sid": domain_sid or self._properties["domain_sid"], + "domain_sid": domain_sid or self.domain_sid, } self._context: Optional[DomainCertsContext] = None @@ -60,62 +80,6 @@ def _proxy(self) -> "DomainCertsContext": ) return self._context - @property - def domain_sid(self) -> str: - """ - :returns: The unique string that we created to identify the Domain resource. - """ - return self._properties["domain_sid"] - - @property - def date_updated(self) -> datetime: - """ - :returns: Date that this Domain was last updated. - """ - return self._properties["date_updated"] - - @property - def date_expires(self) -> datetime: - """ - :returns: Date that the private certificate associated with this domain expires. You will need to update the certificate before that date to ensure your shortened links will continue to work. - """ - return self._properties["date_expires"] - - @property - def date_created(self) -> datetime: - """ - :returns: Date that this Domain was registered to the Twilio platform to create a new Domain object. - """ - return self._properties["date_created"] - - @property - def domain_name(self) -> str: - """ - :returns: Full url path for this domain. - """ - return self._properties["domain_name"] - - @property - def certificate_sid(self) -> str: - """ - :returns: The unique string that we created to identify this Certificate resource. - """ - return self._properties["certificate_sid"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def cert_in_validation(self) -> Dict[str, object]: - """ - :returns: Optional JSON field describing the status and upload date of a new certificate in the process of validation - """ - return self._properties["cert_in_validation"] - def delete(self) -> bool: """ Deletes the DomainCertsInstance diff --git a/twilio/rest/messaging/v1/domain_config.py b/twilio/rest/messaging/v1/domain_config.py index 29f8a7ae5..ee62c3c46 100644 --- a/twilio/rest/messaging/v1/domain_config.py +++ b/twilio/rest/messaging/v1/domain_config.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,25 +23,43 @@ class DomainConfigInstance(InstanceResource): - def __init__(self, version, payload, domain_sid: Optional[str] = None): - """ - Initialize the DomainConfigInstance - """ + + """ + :ivar domain_sid: The unique string that we created to identify the Domain resource. + :ivar config_sid: The unique string that we created to identify the Domain config (prefix ZK). + :ivar messaging_service_sids: A list of messagingServiceSids (with prefix MG). + :ivar fallback_url: Any requests we receive to this domain that do not match an existing shortened message will be redirected to the fallback url. These will likely be either expired messages, random misdirected traffic, or intentional scraping. + :ivar callback_url: URL to receive click events to your webhook whenever the recipients click on the shortened links. + :ivar date_created: Date this Domain Config was created. + :ivar date_updated: Date that this Domain Config was last updated. + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + domain_sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "domain_sid": payload.get("domain_sid"), - "config_sid": payload.get("config_sid"), - "messaging_service_sids": payload.get("messaging_service_sids"), - "fallback_url": payload.get("fallback_url"), - "callback_url": payload.get("callback_url"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.domain_sid: Optional[str] = payload.get("domain_sid") + self.config_sid: Optional[str] = payload.get("config_sid") + self.messaging_service_sids: Optional[List[str]] = payload.get( + "messaging_service_sids" + ) + self.fallback_url: Optional[str] = payload.get("fallback_url") + self.callback_url: Optional[str] = payload.get("callback_url") + 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 = { - "domain_sid": domain_sid or self._properties["domain_sid"], + "domain_sid": domain_sid or self.domain_sid, } self._context: Optional[DomainConfigContext] = None @@ -60,62 +78,6 @@ def _proxy(self) -> "DomainConfigContext": ) return self._context - @property - def domain_sid(self) -> str: - """ - :returns: The unique string that we created to identify the Domain resource. - """ - return self._properties["domain_sid"] - - @property - def config_sid(self) -> str: - """ - :returns: The unique string that we created to identify the Domain config (prefix ZK). - """ - return self._properties["config_sid"] - - @property - def messaging_service_sids(self) -> List[str]: - """ - :returns: A list of messagingServiceSids (with prefix MG). - """ - return self._properties["messaging_service_sids"] - - @property - def fallback_url(self) -> str: - """ - :returns: Any requests we receive to this domain that do not match an existing shortened message will be redirected to the fallback url. These will likely be either expired messages, random misdirected traffic, or intentional scraping. - """ - return self._properties["fallback_url"] - - @property - def callback_url(self) -> str: - """ - :returns: URL to receive click events to your webhook whenever the recipients click on the shortened links. - """ - return self._properties["callback_url"] - - @property - def date_created(self) -> datetime: - """ - :returns: Date this Domain Config was created. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: Date that this Domain Config was last updated. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def fetch(self) -> "DomainConfigInstance": """ Fetch the DomainConfigInstance diff --git a/twilio/rest/messaging/v1/domain_config_messaging_service.py b/twilio/rest/messaging/v1/domain_config_messaging_service.py index 75f244314..eee1d8efe 100644 --- a/twilio/rest/messaging/v1/domain_config_messaging_service.py +++ b/twilio/rest/messaging/v1/domain_config_messaging_service.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Optional +from typing import Any, Dict, Optional from twilio.base import deserialize from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,26 +23,42 @@ class DomainConfigMessagingServiceInstance(InstanceResource): - def __init__(self, version, payload, messaging_service_sid: Optional[str] = None): - """ - Initialize the DomainConfigMessagingServiceInstance - """ + + """ + :ivar domain_sid: The unique string that we created to identify the Domain resource. + :ivar config_sid: The unique string that we created to identify the Domain config (prefix ZK). + :ivar messaging_service_sid: The unique string that identifies the messaging service + :ivar fallback_url: Any requests we receive to this domain that do not match an existing shortened message will be redirected to the fallback url. These will likely be either expired messages, random misdirected traffic, or intentional scraping. + :ivar callback_url: URL to receive click events to your webhook whenever the recipients click on the shortened links. + :ivar date_created: Date this Domain Config was created. + :ivar date_updated: Date that this Domain Config was last updated. + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + messaging_service_sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "domain_sid": payload.get("domain_sid"), - "config_sid": payload.get("config_sid"), - "messaging_service_sid": payload.get("messaging_service_sid"), - "fallback_url": payload.get("fallback_url"), - "callback_url": payload.get("callback_url"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.domain_sid: Optional[str] = payload.get("domain_sid") + self.config_sid: Optional[str] = payload.get("config_sid") + self.messaging_service_sid: Optional[str] = payload.get("messaging_service_sid") + self.fallback_url: Optional[str] = payload.get("fallback_url") + self.callback_url: Optional[str] = payload.get("callback_url") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") self._solution = { "messaging_service_sid": messaging_service_sid - or self._properties["messaging_service_sid"], + or self.messaging_service_sid, } self._context: Optional[DomainConfigMessagingServiceContext] = None @@ -61,62 +77,6 @@ def _proxy(self) -> "DomainConfigMessagingServiceContext": ) return self._context - @property - def domain_sid(self) -> str: - """ - :returns: The unique string that we created to identify the Domain resource. - """ - return self._properties["domain_sid"] - - @property - def config_sid(self) -> str: - """ - :returns: The unique string that we created to identify the Domain config (prefix ZK). - """ - return self._properties["config_sid"] - - @property - def messaging_service_sid(self) -> str: - """ - :returns: The unique string that identifies the messaging service - """ - return self._properties["messaging_service_sid"] - - @property - def fallback_url(self) -> str: - """ - :returns: Any requests we receive to this domain that do not match an existing shortened message will be redirected to the fallback url. These will likely be either expired messages, random misdirected traffic, or intentional scraping. - """ - return self._properties["fallback_url"] - - @property - def callback_url(self) -> str: - """ - :returns: URL to receive click events to your webhook whenever the recipients click on the shortened links. - """ - return self._properties["callback_url"] - - @property - def date_created(self) -> datetime: - """ - :returns: Date this Domain Config was created. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: Date that this Domain Config was last updated. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def fetch(self) -> "DomainConfigMessagingServiceInstance": """ Fetch the DomainConfigMessagingServiceInstance diff --git a/twilio/rest/messaging/v1/external_campaign.py b/twilio/rest/messaging/v1/external_campaign.py index 97fef3634..ba1abe68c 100644 --- a/twilio/rest/messaging/v1/external_campaign.py +++ b/twilio/rest/messaging/v1/external_campaign.py @@ -14,6 +14,7 @@ from datetime import datetime +from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -22,56 +23,27 @@ class ExternalCampaignInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the ExternalCampaignInstance - """ - super().__init__(version) - - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "campaign_id": payload.get("campaign_id"), - "messaging_service_sid": payload.get("messaging_service_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - } - - self._solution = {} - @property - def sid(self) -> str: - """ - :returns: The unique string that identifies a US A2P Compliance resource `QE2c6890da8086d771620e9b13fadeba0b`. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Campaign belongs to. - """ - return self._properties["account_sid"] + """ + :ivar sid: The unique string that identifies a US A2P Compliance resource `QE2c6890da8086d771620e9b13fadeba0b`. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Campaign belongs to. + :ivar campaign_id: ID of the preregistered campaign. + :ivar messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/services/api) that the resource is associated with. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ - @property - def campaign_id(self) -> str: - """ - :returns: ID of the preregistered campaign. - """ - return self._properties["campaign_id"] + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) - @property - def messaging_service_sid(self) -> str: - """ - :returns: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/services/api) that the resource is associated with. - """ - return self._properties["messaging_service_sid"] + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.campaign_id: Optional[str] = payload.get("campaign_id") + self.messaging_service_sid: Optional[str] = payload.get("messaging_service_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] + self._solution = {} def __repr__(self) -> str: """ diff --git a/twilio/rest/messaging/v1/linkshortening_messaging_service.py b/twilio/rest/messaging/v1/linkshortening_messaging_service.py index d4c54da05..95d3ce9d1 100644 --- a/twilio/rest/messaging/v1/linkshortening_messaging_service.py +++ b/twilio/rest/messaging/v1/linkshortening_messaging_service.py @@ -13,7 +13,7 @@ """ -from typing import Optional +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 @@ -22,28 +22,30 @@ class LinkshorteningMessagingServiceInstance(InstanceResource): + + """ + :ivar domain_sid: The unique string identifies the domain resource + :ivar messaging_service_sid: The unique string that identifies the messaging service + :ivar url: + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], domain_sid: Optional[str] = None, messaging_service_sid: Optional[str] = None, ): - """ - Initialize the LinkshorteningMessagingServiceInstance - """ super().__init__(version) - self._properties = { - "domain_sid": payload.get("domain_sid"), - "messaging_service_sid": payload.get("messaging_service_sid"), - "url": payload.get("url"), - } + self.domain_sid: Optional[str] = payload.get("domain_sid") + self.messaging_service_sid: Optional[str] = payload.get("messaging_service_sid") + self.url: Optional[str] = payload.get("url") self._solution = { - "domain_sid": domain_sid or self._properties["domain_sid"], + "domain_sid": domain_sid or self.domain_sid, "messaging_service_sid": messaging_service_sid - or self._properties["messaging_service_sid"], + or self.messaging_service_sid, } self._context: Optional[LinkshorteningMessagingServiceContext] = None @@ -63,27 +65,6 @@ def _proxy(self) -> "LinkshorteningMessagingServiceContext": ) return self._context - @property - def domain_sid(self) -> str: - """ - :returns: The unique string identifies the domain resource - """ - return self._properties["domain_sid"] - - @property - def messaging_service_sid(self) -> str: - """ - :returns: The unique string that identifies the messaging service - """ - return self._properties["messaging_service_sid"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def create(self) -> "LinkshorteningMessagingServiceInstance": """ Create the LinkshorteningMessagingServiceInstance diff --git a/twilio/rest/messaging/v1/service/__init__.py b/twilio/rest/messaging/v1/service/__init__.py index dd0040dc8..9c7e3e73b 100644 --- a/twilio/rest/messaging/v1/service/__init__.py +++ b/twilio/rest/messaging/v1/service/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -36,42 +36,79 @@ class ScanMessageContent(object): ENABLE = "enable" DISABLE = "disable" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the ServiceInstance - """ + """ + :ivar sid: The unique string that we created to identify the Service resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :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 inbound_request_url: The URL we call using `inbound_method` when a message is received by any phone number or short code in the Service. When this property is `null`, receiving inbound messages is disabled. All messages sent to the Twilio phone number or short code will not be logged and received on the Account. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `inbound_request_url` defined for the Messaging Service. + :ivar inbound_method: The HTTP method we use to call `inbound_request_url`. Can be `GET` or `POST`. + :ivar fallback_url: The URL that we call using `fallback_method` if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `fallback_url` defined for the Messaging Service. + :ivar fallback_method: The HTTP method we use to call `fallback_url`. Can be: `GET` or `POST`. + :ivar status_callback: The URL we call to [pass status updates](https://www.twilio.com/docs/sms/api/message-resource#message-status-values) about message delivery. + :ivar sticky_sender: Whether to enable [Sticky Sender](https://www.twilio.com/docs/sms/services#sticky-sender) on the Service instance. + :ivar mms_converter: Whether to enable the [MMS Converter](https://www.twilio.com/docs/sms/services#mms-converter) for messages sent through the Service instance. + :ivar smart_encoding: Whether to enable [Smart Encoding](https://www.twilio.com/docs/sms/services#smart-encoding) for messages sent through the Service instance. + :ivar scan_message_content: + :ivar fallback_to_long_code: Whether to enable [Fallback to Long Code](https://www.twilio.com/docs/sms/services#fallback-to-long-code) for messages sent through the Service instance. + :ivar area_code_geomatch: Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/sms/services#area-code-geomatch) on the Service Instance. + :ivar synchronous_validation: Reserved. + :ivar validity_period: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. + :ivar url: The absolute URL of the Service resource. + :ivar links: The absolute URLs of related resources. + :ivar usecase: A string that describes the scenario in which the Messaging Service will be used. Examples: [notification, marketing, verification, poll ..] + :ivar us_app_to_person_registered: Whether US A2P campaign is registered for this Service. + :ivar use_inbound_webhook_on_number: A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "inbound_request_url": payload.get("inbound_request_url"), - "inbound_method": payload.get("inbound_method"), - "fallback_url": payload.get("fallback_url"), - "fallback_method": payload.get("fallback_method"), - "status_callback": payload.get("status_callback"), - "sticky_sender": payload.get("sticky_sender"), - "mms_converter": payload.get("mms_converter"), - "smart_encoding": payload.get("smart_encoding"), - "scan_message_content": payload.get("scan_message_content"), - "fallback_to_long_code": payload.get("fallback_to_long_code"), - "area_code_geomatch": payload.get("area_code_geomatch"), - "synchronous_validation": payload.get("synchronous_validation"), - "validity_period": deserialize.integer(payload.get("validity_period")), - "url": payload.get("url"), - "links": payload.get("links"), - "usecase": payload.get("usecase"), - "us_app_to_person_registered": payload.get("us_app_to_person_registered"), - "use_inbound_webhook_on_number": payload.get( - "use_inbound_webhook_on_number" - ), - } + 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.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.inbound_request_url: Optional[str] = payload.get("inbound_request_url") + self.inbound_method: Optional[str] = payload.get("inbound_method") + self.fallback_url: Optional[str] = payload.get("fallback_url") + self.fallback_method: Optional[str] = payload.get("fallback_method") + self.status_callback: Optional[str] = payload.get("status_callback") + self.sticky_sender: Optional[bool] = payload.get("sticky_sender") + self.mms_converter: Optional[bool] = payload.get("mms_converter") + self.smart_encoding: Optional[bool] = payload.get("smart_encoding") + self.scan_message_content: Optional[ + "ServiceInstance.ScanMessageContent" + ] = payload.get("scan_message_content") + self.fallback_to_long_code: Optional[bool] = payload.get( + "fallback_to_long_code" + ) + self.area_code_geomatch: Optional[bool] = payload.get("area_code_geomatch") + self.synchronous_validation: Optional[bool] = payload.get( + "synchronous_validation" + ) + self.validity_period: Optional[int] = deserialize.integer( + payload.get("validity_period") + ) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.usecase: Optional[str] = payload.get("usecase") + self.us_app_to_person_registered: Optional[bool] = payload.get( + "us_app_to_person_registered" + ) + self.use_inbound_webhook_on_number: Optional[bool] = payload.get( + "use_inbound_webhook_on_number" + ) self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ServiceContext] = None @@ -90,167 +127,6 @@ def _proxy(self) -> "ServiceContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Service resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def inbound_request_url(self) -> str: - """ - :returns: The URL we call using `inbound_method` when a message is received by any phone number or short code in the Service. When this property is `null`, receiving inbound messages is disabled. All messages sent to the Twilio phone number or short code will not be logged and received on the Account. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `inbound_request_url` defined for the Messaging Service. - """ - return self._properties["inbound_request_url"] - - @property - def inbound_method(self) -> str: - """ - :returns: The HTTP method we use to call `inbound_request_url`. Can be `GET` or `POST`. - """ - return self._properties["inbound_method"] - - @property - def fallback_url(self) -> str: - """ - :returns: The URL that we call using `fallback_method` if an error occurs while retrieving or executing the TwiML from the Inbound Request URL. If the `use_inbound_webhook_on_number` field is enabled then the webhook url defined on the phone number will override the `fallback_url` defined for the Messaging Service. - """ - return self._properties["fallback_url"] - - @property - def fallback_method(self) -> str: - """ - :returns: The HTTP method we use to call `fallback_url`. Can be: `GET` or `POST`. - """ - return self._properties["fallback_method"] - - @property - def status_callback(self) -> str: - """ - :returns: The URL we call to [pass status updates](https://www.twilio.com/docs/sms/api/message-resource#message-status-values) about message delivery. - """ - return self._properties["status_callback"] - - @property - def sticky_sender(self) -> bool: - """ - :returns: Whether to enable [Sticky Sender](https://www.twilio.com/docs/sms/services#sticky-sender) on the Service instance. - """ - return self._properties["sticky_sender"] - - @property - def mms_converter(self) -> bool: - """ - :returns: Whether to enable the [MMS Converter](https://www.twilio.com/docs/sms/services#mms-converter) for messages sent through the Service instance. - """ - return self._properties["mms_converter"] - - @property - def smart_encoding(self) -> bool: - """ - :returns: Whether to enable [Smart Encoding](https://www.twilio.com/docs/sms/services#smart-encoding) for messages sent through the Service instance. - """ - return self._properties["smart_encoding"] - - @property - def scan_message_content(self) -> "ServiceInstance.ScanMessageContent": - """ - :returns: - """ - return self._properties["scan_message_content"] - - @property - def fallback_to_long_code(self) -> bool: - """ - :returns: Whether to enable [Fallback to Long Code](https://www.twilio.com/docs/sms/services#fallback-to-long-code) for messages sent through the Service instance. - """ - return self._properties["fallback_to_long_code"] - - @property - def area_code_geomatch(self) -> bool: - """ - :returns: Whether to enable [Area Code Geomatch](https://www.twilio.com/docs/sms/services#area-code-geomatch) on the Service Instance. - """ - return self._properties["area_code_geomatch"] - - @property - def synchronous_validation(self) -> bool: - """ - :returns: Reserved. - """ - return self._properties["synchronous_validation"] - - @property - def validity_period(self) -> int: - """ - :returns: How long, in seconds, messages sent from the Service are valid. Can be an integer from `1` to `14,400`. - """ - return self._properties["validity_period"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Service resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The absolute URLs of related resources. - """ - return self._properties["links"] - - @property - def usecase(self) -> str: - """ - :returns: A string that describes the scenario in which the Messaging Service will be used. Examples: [notification, marketing, verification, poll ..] - """ - return self._properties["usecase"] - - @property - def us_app_to_person_registered(self) -> bool: - """ - :returns: Whether US A2P campaign is registered for this Service. - """ - return self._properties["us_app_to_person_registered"] - - @property - def use_inbound_webhook_on_number(self) -> bool: - """ - :returns: A boolean value that indicates either the webhook url configured on the phone number will be used or `inbound_request_url`/`fallback_url` url will be called when a message is received from the phone number. If this field is enabled then the webhook url defined on the phone number will override the `inbound_request_url`/`fallback_url` defined for the Messaging Service. - """ - return self._properties["use_inbound_webhook_on_number"] - def delete(self) -> bool: """ Deletes the ServiceInstance diff --git a/twilio/rest/messaging/v1/service/alpha_sender.py b/twilio/rest/messaging/v1/service/alpha_sender.py index 9457e68a3..569552aba 100644 --- a/twilio/rest/messaging/v1/service/alpha_sender.py +++ b/twilio/rest/messaging/v1/service/alpha_sender.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,26 +24,43 @@ class AlphaSenderInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the AlphaSenderInstance - """ + + """ + :ivar sid: The unique string that we created to identify the AlphaSender resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AlphaSender resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar alpha_sender: The Alphanumeric Sender ID string. + :ivar capabilities: An array of values that describe whether the number can receive calls or messages. Can be: `SMS`. + :ivar url: The absolute URL of the AlphaSender resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "alpha_sender": payload.get("alpha_sender"), - "capabilities": payload.get("capabilities"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.alpha_sender: Optional[str] = payload.get("alpha_sender") + self.capabilities: Optional[List[str]] = payload.get("capabilities") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[AlphaSenderContext] = None @@ -63,62 +80,6 @@ def _proxy(self) -> "AlphaSenderContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the AlphaSender resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AlphaSender resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def alpha_sender(self) -> str: - """ - :returns: The Alphanumeric Sender ID string. - """ - return self._properties["alpha_sender"] - - @property - def capabilities(self) -> List[str]: - """ - :returns: An array of values that describe whether the number can receive calls or messages. Can be: `SMS`. - """ - return self._properties["capabilities"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the AlphaSender resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the AlphaSenderInstance diff --git a/twilio/rest/messaging/v1/service/phone_number.py b/twilio/rest/messaging/v1/service/phone_number.py index adbafd698..2b8605ae1 100644 --- a/twilio/rest/messaging/v1/service/phone_number.py +++ b/twilio/rest/messaging/v1/service/phone_number.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,27 +24,45 @@ class PhoneNumberInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the PhoneNumberInstance - """ + + """ + :ivar sid: The unique string that we created to identify the PhoneNumber resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PhoneNumber resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + :ivar country_code: The 2-character [ISO Country Code](https://www.iso.org/iso-3166-country-codes.html) of the number. + :ivar capabilities: An array of values that describe whether the number can receive calls or messages. Can be: `Voice`, `SMS`, and `MMS`. + :ivar url: The absolute URL of the PhoneNumber resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "phone_number": payload.get("phone_number"), - "country_code": payload.get("country_code"), - "capabilities": payload.get("capabilities"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.phone_number: Optional[str] = payload.get("phone_number") + self.country_code: Optional[str] = payload.get("country_code") + self.capabilities: Optional[List[str]] = payload.get("capabilities") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[PhoneNumberContext] = None @@ -64,69 +82,6 @@ def _proxy(self) -> "PhoneNumberContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the PhoneNumber resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PhoneNumber resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def phone_number(self) -> str: - """ - :returns: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. - """ - return self._properties["phone_number"] - - @property - def country_code(self) -> str: - """ - :returns: The 2-character [ISO Country Code](https://www.iso.org/iso-3166-country-codes.html) of the number. - """ - return self._properties["country_code"] - - @property - def capabilities(self) -> List[str]: - """ - :returns: An array of values that describe whether the number can receive calls or messages. Can be: `Voice`, `SMS`, and `MMS`. - """ - return self._properties["capabilities"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the PhoneNumber resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the PhoneNumberInstance diff --git a/twilio/rest/messaging/v1/service/short_code.py b/twilio/rest/messaging/v1/service/short_code.py index 1bf1a752e..b3bdd397b 100644 --- a/twilio/rest/messaging/v1/service/short_code.py +++ b/twilio/rest/messaging/v1/service/short_code.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,27 +24,45 @@ class ShortCodeInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the ShortCodeInstance - """ + + """ + :ivar sid: The unique string that we created to identify the ShortCode resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ShortCode resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar short_code: The [E.164](https://www.twilio.com/docs/glossary/what-e164) format of the short code. + :ivar country_code: The 2-character [ISO Country Code](https://www.iso.org/iso-3166-country-codes.html) of the number. + :ivar capabilities: An array of values that describe whether the number can receive calls or messages. Can be: `SMS` and `MMS`. + :ivar url: The absolute URL of the ShortCode resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "short_code": payload.get("short_code"), - "country_code": payload.get("country_code"), - "capabilities": payload.get("capabilities"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.short_code: Optional[str] = payload.get("short_code") + self.country_code: Optional[str] = payload.get("country_code") + self.capabilities: Optional[List[str]] = payload.get("capabilities") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ShortCodeContext] = None @@ -64,69 +82,6 @@ def _proxy(self) -> "ShortCodeContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the ShortCode resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ShortCode resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def short_code(self) -> str: - """ - :returns: The [E.164](https://www.twilio.com/docs/glossary/what-e164) format of the short code. - """ - return self._properties["short_code"] - - @property - def country_code(self) -> str: - """ - :returns: The 2-character [ISO Country Code](https://www.iso.org/iso-3166-country-codes.html) of the number. - """ - return self._properties["country_code"] - - @property - def capabilities(self) -> List[str]: - """ - :returns: An array of values that describe whether the number can receive calls or messages. Can be: `SMS` and `MMS`. - """ - return self._properties["capabilities"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the ShortCode resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the ShortCodeInstance diff --git a/twilio/rest/messaging/v1/service/us_app_to_person.py b/twilio/rest/messaging/v1/service/us_app_to_person.py index 3b4208bfd..1f647f1a3 100644 --- a/twilio/rest/messaging/v1/service/us_app_to_person.py +++ b/twilio/rest/messaging/v1/service/us_app_to_person.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,44 +24,81 @@ class UsAppToPersonInstance(InstanceResource): + + """ + :ivar sid: The unique string that identifies a US A2P Compliance resource `QE2c6890da8086d771620e9b13fadeba0b`. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Campaign belongs to. + :ivar brand_registration_sid: The unique string to identify the A2P brand. + :ivar messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/services/api) that the resource is associated with. + :ivar description: A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. + :ivar message_samples: Message samples, at least 1 and up to 5 sample messages (at least 2 for starter/sole proprietor), >=20 chars, <=1024 chars each. + :ivar us_app_to_person_usecase: A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING, STARTER...]. STARTER campaign use cases can only be created by STARTER Brands, and there can only be one STARTER campaign created per STARTER Brand. + :ivar has_embedded_links: Indicate that this SMS campaign will send messages that contain links. + :ivar has_embedded_phone: Indicates that this SMS campaign will send messages that contain phone numbers. + :ivar campaign_status: Campaign status. Examples: IN_PROGRESS, VERIFIED, FAILED. + :ivar campaign_id: The Campaign Registry (TCR) Campaign ID. + :ivar is_externally_registered: Indicates whether the campaign was registered externally or not. + :ivar rate_limits: Rate limit and/or classification set by each carrier, Ex. AT&T or T-Mobile. + :ivar message_flow: Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum. + :ivar opt_in_message: If end users can text in a keyword to start receiving messages from this campaign, the auto-reply messages sent to the end users must be provided. The opt-in response should include the Brand name, confirmation of opt-in enrollment to a recurring message campaign, how to get help, and clear description of how to opt-out. This field is required if end users can text in a keyword to start receiving messages from this campaign. 20 character minimum. 320 character maximum. + :ivar opt_out_message: Upon receiving the opt-out keywords from the end users, Twilio customers are expected to send back an auto-generated response, which must provide acknowledgment of the opt-out request and confirmation that no further messages will be sent. It is also recommended that these opt-out messages include the brand name. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. + :ivar help_message: When customers receive the help keywords from their end users, Twilio customers are expected to send back an auto-generated response; this may include the brand name and additional support contact information. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. + :ivar opt_in_keywords: If end users can text in a keyword to start receiving messages from this campaign, those keywords must be provided. This field is required if end users can text in a keyword to start receiving messages from this campaign. Values must be alphanumeric. 255 character maximum. + :ivar opt_out_keywords: End users should be able to text in a keyword to stop receiving messages from this campaign. Those keywords must be provided. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum. + :ivar help_keywords: End users should be able to text in a keyword to receive help. Those keywords must be provided as part of the campaign registration request. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the US App to Person resource. + :ivar mock: A boolean that specifies whether campaign is a mock or not. Mock campaigns will be automatically created if using a mock brand. Mock campaigns should only be used for testing purposes. + """ + def __init__( - self, version, payload, messaging_service_sid: str, sid: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + messaging_service_sid: str, + sid: Optional[str] = None, ): - """ - Initialize the UsAppToPersonInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "brand_registration_sid": payload.get("brand_registration_sid"), - "messaging_service_sid": payload.get("messaging_service_sid"), - "description": payload.get("description"), - "message_samples": payload.get("message_samples"), - "us_app_to_person_usecase": payload.get("us_app_to_person_usecase"), - "has_embedded_links": payload.get("has_embedded_links"), - "has_embedded_phone": payload.get("has_embedded_phone"), - "campaign_status": payload.get("campaign_status"), - "campaign_id": payload.get("campaign_id"), - "is_externally_registered": payload.get("is_externally_registered"), - "rate_limits": payload.get("rate_limits"), - "message_flow": payload.get("message_flow"), - "opt_in_message": payload.get("opt_in_message"), - "opt_out_message": payload.get("opt_out_message"), - "help_message": payload.get("help_message"), - "opt_in_keywords": payload.get("opt_in_keywords"), - "opt_out_keywords": payload.get("opt_out_keywords"), - "help_keywords": payload.get("help_keywords"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "mock": payload.get("mock"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.brand_registration_sid: Optional[str] = payload.get( + "brand_registration_sid" + ) + self.messaging_service_sid: Optional[str] = payload.get("messaging_service_sid") + self.description: Optional[str] = payload.get("description") + self.message_samples: Optional[List[str]] = payload.get("message_samples") + self.us_app_to_person_usecase: Optional[str] = payload.get( + "us_app_to_person_usecase" + ) + self.has_embedded_links: Optional[bool] = payload.get("has_embedded_links") + self.has_embedded_phone: Optional[bool] = payload.get("has_embedded_phone") + self.campaign_status: Optional[str] = payload.get("campaign_status") + self.campaign_id: Optional[str] = payload.get("campaign_id") + self.is_externally_registered: Optional[bool] = payload.get( + "is_externally_registered" + ) + self.rate_limits: Optional[Dict[str, object]] = payload.get("rate_limits") + self.message_flow: Optional[str] = payload.get("message_flow") + self.opt_in_message: Optional[str] = payload.get("opt_in_message") + self.opt_out_message: Optional[str] = payload.get("opt_out_message") + self.help_message: Optional[str] = payload.get("help_message") + self.opt_in_keywords: Optional[List[str]] = payload.get("opt_in_keywords") + self.opt_out_keywords: Optional[List[str]] = payload.get("opt_out_keywords") + self.help_keywords: Optional[List[str]] = payload.get("help_keywords") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") + self.mock: Optional[bool] = payload.get("mock") self._solution = { "messaging_service_sid": messaging_service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[UsAppToPersonContext] = None @@ -81,174 +118,6 @@ def _proxy(self) -> "UsAppToPersonContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that identifies a US A2P Compliance resource `QE2c6890da8086d771620e9b13fadeba0b`. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Campaign belongs to. - """ - return self._properties["account_sid"] - - @property - def brand_registration_sid(self) -> str: - """ - :returns: The unique string to identify the A2P brand. - """ - return self._properties["brand_registration_sid"] - - @property - def messaging_service_sid(self) -> str: - """ - :returns: The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/services/api) that the resource is associated with. - """ - return self._properties["messaging_service_sid"] - - @property - def description(self) -> str: - """ - :returns: A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters. - """ - return self._properties["description"] - - @property - def message_samples(self) -> List[str]: - """ - :returns: Message samples, at least 1 and up to 5 sample messages (at least 2 for starter/sole proprietor), >=20 chars, <=1024 chars each. - """ - return self._properties["message_samples"] - - @property - def us_app_to_person_usecase(self) -> str: - """ - :returns: A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING, STARTER...]. STARTER campaign use cases can only be created by STARTER Brands, and there can only be one STARTER campaign created per STARTER Brand. - """ - return self._properties["us_app_to_person_usecase"] - - @property - def has_embedded_links(self) -> bool: - """ - :returns: Indicate that this SMS campaign will send messages that contain links. - """ - return self._properties["has_embedded_links"] - - @property - def has_embedded_phone(self) -> bool: - """ - :returns: Indicates that this SMS campaign will send messages that contain phone numbers. - """ - return self._properties["has_embedded_phone"] - - @property - def campaign_status(self) -> str: - """ - :returns: Campaign status. Examples: IN_PROGRESS, VERIFIED, FAILED. - """ - return self._properties["campaign_status"] - - @property - def campaign_id(self) -> str: - """ - :returns: The Campaign Registry (TCR) Campaign ID. - """ - return self._properties["campaign_id"] - - @property - def is_externally_registered(self) -> bool: - """ - :returns: Indicates whether the campaign was registered externally or not. - """ - return self._properties["is_externally_registered"] - - @property - def rate_limits(self) -> Dict[str, object]: - """ - :returns: Rate limit and/or classification set by each carrier, Ex. AT&T or T-Mobile. - """ - return self._properties["rate_limits"] - - @property - def message_flow(self) -> str: - """ - :returns: Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum. - """ - return self._properties["message_flow"] - - @property - def opt_in_message(self) -> str: - """ - :returns: If end users can text in a keyword to start receiving messages from this campaign, the auto-reply messages sent to the end users must be provided. The opt-in response should include the Brand name, confirmation of opt-in enrollment to a recurring message campaign, how to get help, and clear description of how to opt-out. This field is required if end users can text in a keyword to start receiving messages from this campaign. 20 character minimum. 320 character maximum. - """ - return self._properties["opt_in_message"] - - @property - def opt_out_message(self) -> str: - """ - :returns: Upon receiving the opt-out keywords from the end users, Twilio customers are expected to send back an auto-generated response, which must provide acknowledgment of the opt-out request and confirmation that no further messages will be sent. It is also recommended that these opt-out messages include the brand name. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. - """ - return self._properties["opt_out_message"] - - @property - def help_message(self) -> str: - """ - :returns: When customers receive the help keywords from their end users, Twilio customers are expected to send back an auto-generated response; this may include the brand name and additional support contact information. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). 20 character minimum. 320 character maximum. - """ - return self._properties["help_message"] - - @property - def opt_in_keywords(self) -> List[str]: - """ - :returns: If end users can text in a keyword to start receiving messages from this campaign, those keywords must be provided. This field is required if end users can text in a keyword to start receiving messages from this campaign. Values must be alphanumeric. 255 character maximum. - """ - return self._properties["opt_in_keywords"] - - @property - def opt_out_keywords(self) -> List[str]: - """ - :returns: End users should be able to text in a keyword to stop receiving messages from this campaign. Those keywords must be provided. This field is required if managing opt out keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum. - """ - return self._properties["opt_out_keywords"] - - @property - def help_keywords(self) -> List[str]: - """ - :returns: End users should be able to text in a keyword to receive help. Those keywords must be provided as part of the campaign registration request. This field is required if managing help keywords yourself (i.e. not using Twilio's Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum. - """ - return self._properties["help_keywords"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the US App to Person resource. - """ - return self._properties["url"] - - @property - def mock(self) -> bool: - """ - :returns: A boolean that specifies whether campaign is a mock or not. Mock campaigns will be automatically created if using a mock brand. Mock campaigns should only be used for testing purposes. - """ - return self._properties["mock"] - def delete(self) -> bool: """ Deletes the UsAppToPersonInstance diff --git a/twilio/rest/messaging/v1/service/us_app_to_person_usecase.py b/twilio/rest/messaging/v1/service/us_app_to_person_usecase.py index b0b48140e..572434a3d 100644 --- a/twilio/rest/messaging/v1/service/us_app_to_person_usecase.py +++ b/twilio/rest/messaging/v1/service/us_app_to_person_usecase.py @@ -13,7 +13,7 @@ """ -from typing import List +from typing import Any, Dict, List, Optional from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -21,27 +21,24 @@ class UsAppToPersonUsecaseInstance(InstanceResource): - def __init__(self, version, payload, messaging_service_sid: str): - """ - Initialize the UsAppToPersonUsecaseInstance - """ + + """ + :ivar us_app_to_person_usecases: Human readable name, code, description and post_approval_required (indicates whether or not post approval is required for this Use Case) of A2P Campaign Use Cases. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], messaging_service_sid: str + ): super().__init__(version) - self._properties = { - "us_app_to_person_usecases": payload.get("us_app_to_person_usecases"), - } + self.us_app_to_person_usecases: Optional[List[object]] = payload.get( + "us_app_to_person_usecases" + ) self._solution = { "messaging_service_sid": messaging_service_sid, } - @property - def us_app_to_person_usecases(self) -> List[object]: - """ - :returns: Human readable name, code, description and post_approval_required (indicates whether or not post approval is required for this Use Case) of A2P Campaign Use Cases. - """ - return self._properties["us_app_to_person_usecases"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/messaging/v1/tollfree_verification.py b/twilio/rest/messaging/v1/tollfree_verification.py index 53ff20590..526690334 100644 --- a/twilio/rest/messaging/v1/tollfree_verification.py +++ b/twilio/rest/messaging/v1/tollfree_verification.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -37,51 +37,111 @@ class Status(object): TWILIO_APPROVED = "TWILIO_APPROVED" TWILIO_REJECTED = "TWILIO_REJECTED" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the TollfreeVerificationInstance - """ + """ + :ivar sid: The unique string to identify Tollfree Verification. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Tollfree Verification resource. + :ivar customer_profile_sid: Customer's Profile Bundle BundleSid. + :ivar trust_product_sid: Tollfree TrustProduct Bundle BundleSid. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar regulated_item_sid: The SID of the Regulated Item. + :ivar business_name: The name of the business or organization using the Tollfree number. + :ivar business_street_address: The address of the business or organization using the Tollfree number. + :ivar business_street_address2: The address of the business or organization using the Tollfree number. + :ivar business_city: The city of the business or organization using the Tollfree number. + :ivar business_state_province_region: The state/province/region of the business or organization using the Tollfree number. + :ivar business_postal_code: The postal code of the business or organization using the Tollfree number. + :ivar business_country: The country of the business or organization using the Tollfree number. + :ivar business_website: The website of the business or organization using the Tollfree number. + :ivar business_contact_first_name: The first name of the contact for the business or organization using the Tollfree number. + :ivar business_contact_last_name: The last name of the contact for the business or organization using the Tollfree number. + :ivar business_contact_email: The email address of the contact for the business or organization using the Tollfree number. + :ivar business_contact_phone: The phone number of the contact for the business or organization using the Tollfree number. + :ivar notification_email: The email address to receive the notification about the verification result. . + :ivar use_case_categories: The category of the use case for the Tollfree Number. List as many are applicable.. + :ivar use_case_summary: Use this to further explain how messaging is used by the business or organization. + :ivar production_message_sample: An example of message content, i.e. a sample message. + :ivar opt_in_image_urls: Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. + :ivar opt_in_type: + :ivar message_volume: Estimate monthly volume of messages from the Tollfree Number. + :ivar additional_information: Additional information to be provided for verification. + :ivar tollfree_phone_number_sid: The SID of the Phone Number associated with the Tollfree Verification. + :ivar status: + :ivar url: The absolute URL of the Tollfree Verification resource. + :ivar resource_links: The URLs of the documents associated with the Tollfree Verification resource. + :ivar external_reference_id: An optional external reference ID supplied by customer and echoed back on status retrieval. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "customer_profile_sid": payload.get("customer_profile_sid"), - "trust_product_sid": payload.get("trust_product_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "regulated_item_sid": payload.get("regulated_item_sid"), - "business_name": payload.get("business_name"), - "business_street_address": payload.get("business_street_address"), - "business_street_address2": payload.get("business_street_address2"), - "business_city": payload.get("business_city"), - "business_state_province_region": payload.get( - "business_state_province_region" - ), - "business_postal_code": payload.get("business_postal_code"), - "business_country": payload.get("business_country"), - "business_website": payload.get("business_website"), - "business_contact_first_name": payload.get("business_contact_first_name"), - "business_contact_last_name": payload.get("business_contact_last_name"), - "business_contact_email": payload.get("business_contact_email"), - "business_contact_phone": payload.get("business_contact_phone"), - "notification_email": payload.get("notification_email"), - "use_case_categories": payload.get("use_case_categories"), - "use_case_summary": payload.get("use_case_summary"), - "production_message_sample": payload.get("production_message_sample"), - "opt_in_image_urls": payload.get("opt_in_image_urls"), - "opt_in_type": payload.get("opt_in_type"), - "message_volume": payload.get("message_volume"), - "additional_information": payload.get("additional_information"), - "tollfree_phone_number_sid": payload.get("tollfree_phone_number_sid"), - "status": payload.get("status"), - "url": payload.get("url"), - "resource_links": payload.get("resource_links"), - "external_reference_id": payload.get("external_reference_id"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.customer_profile_sid: Optional[str] = payload.get("customer_profile_sid") + self.trust_product_sid: Optional[str] = payload.get("trust_product_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.regulated_item_sid: Optional[str] = payload.get("regulated_item_sid") + self.business_name: Optional[str] = payload.get("business_name") + self.business_street_address: Optional[str] = payload.get( + "business_street_address" + ) + self.business_street_address2: Optional[str] = payload.get( + "business_street_address2" + ) + self.business_city: Optional[str] = payload.get("business_city") + self.business_state_province_region: Optional[str] = payload.get( + "business_state_province_region" + ) + self.business_postal_code: Optional[str] = payload.get("business_postal_code") + self.business_country: Optional[str] = payload.get("business_country") + self.business_website: Optional[str] = payload.get("business_website") + self.business_contact_first_name: Optional[str] = payload.get( + "business_contact_first_name" + ) + self.business_contact_last_name: Optional[str] = payload.get( + "business_contact_last_name" + ) + self.business_contact_email: Optional[str] = payload.get( + "business_contact_email" + ) + self.business_contact_phone: Optional[str] = payload.get( + "business_contact_phone" + ) + self.notification_email: Optional[str] = payload.get("notification_email") + self.use_case_categories: Optional[List[str]] = payload.get( + "use_case_categories" + ) + self.use_case_summary: Optional[str] = payload.get("use_case_summary") + self.production_message_sample: Optional[str] = payload.get( + "production_message_sample" + ) + self.opt_in_image_urls: Optional[List[str]] = payload.get("opt_in_image_urls") + self.opt_in_type: Optional[ + "TollfreeVerificationInstance.OptInType" + ] = payload.get("opt_in_type") + self.message_volume: Optional[str] = payload.get("message_volume") + self.additional_information: Optional[str] = payload.get( + "additional_information" + ) + self.tollfree_phone_number_sid: Optional[str] = payload.get( + "tollfree_phone_number_sid" + ) + self.status: Optional["TollfreeVerificationInstance.Status"] = payload.get( + "status" + ) + self.url: Optional[str] = payload.get("url") + self.resource_links: Optional[Dict[str, object]] = payload.get("resource_links") + self.external_reference_id: Optional[str] = payload.get("external_reference_id") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[TollfreeVerificationContext] = None @@ -100,230 +160,6 @@ def _proxy(self) -> "TollfreeVerificationContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string to identify Tollfree Verification. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Tollfree Verification resource. - """ - return self._properties["account_sid"] - - @property - def customer_profile_sid(self) -> str: - """ - :returns: Customer's Profile Bundle BundleSid. - """ - return self._properties["customer_profile_sid"] - - @property - def trust_product_sid(self) -> str: - """ - :returns: Tollfree TrustProduct Bundle BundleSid. - """ - return self._properties["trust_product_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def regulated_item_sid(self) -> str: - """ - :returns: The SID of the Regulated Item. - """ - return self._properties["regulated_item_sid"] - - @property - def business_name(self) -> str: - """ - :returns: The name of the business or organization using the Tollfree number. - """ - return self._properties["business_name"] - - @property - def business_street_address(self) -> str: - """ - :returns: The address of the business or organization using the Tollfree number. - """ - return self._properties["business_street_address"] - - @property - def business_street_address2(self) -> str: - """ - :returns: The address of the business or organization using the Tollfree number. - """ - return self._properties["business_street_address2"] - - @property - def business_city(self) -> str: - """ - :returns: The city of the business or organization using the Tollfree number. - """ - return self._properties["business_city"] - - @property - def business_state_province_region(self) -> str: - """ - :returns: The state/province/region of the business or organization using the Tollfree number. - """ - return self._properties["business_state_province_region"] - - @property - def business_postal_code(self) -> str: - """ - :returns: The postal code of the business or organization using the Tollfree number. - """ - return self._properties["business_postal_code"] - - @property - def business_country(self) -> str: - """ - :returns: The country of the business or organization using the Tollfree number. - """ - return self._properties["business_country"] - - @property - def business_website(self) -> str: - """ - :returns: The website of the business or organization using the Tollfree number. - """ - return self._properties["business_website"] - - @property - def business_contact_first_name(self) -> str: - """ - :returns: The first name of the contact for the business or organization using the Tollfree number. - """ - return self._properties["business_contact_first_name"] - - @property - def business_contact_last_name(self) -> str: - """ - :returns: The last name of the contact for the business or organization using the Tollfree number. - """ - return self._properties["business_contact_last_name"] - - @property - def business_contact_email(self) -> str: - """ - :returns: The email address of the contact for the business or organization using the Tollfree number. - """ - return self._properties["business_contact_email"] - - @property - def business_contact_phone(self) -> str: - """ - :returns: The phone number of the contact for the business or organization using the Tollfree number. - """ - return self._properties["business_contact_phone"] - - @property - def notification_email(self) -> str: - """ - :returns: The email address to receive the notification about the verification result. . - """ - return self._properties["notification_email"] - - @property - def use_case_categories(self) -> List[str]: - """ - :returns: The category of the use case for the Tollfree Number. List as many are applicable.. - """ - return self._properties["use_case_categories"] - - @property - def use_case_summary(self) -> str: - """ - :returns: Use this to further explain how messaging is used by the business or organization. - """ - return self._properties["use_case_summary"] - - @property - def production_message_sample(self) -> str: - """ - :returns: An example of message content, i.e. a sample message. - """ - return self._properties["production_message_sample"] - - @property - def opt_in_image_urls(self) -> List[str]: - """ - :returns: Link to an image that shows the opt-in workflow. Multiple images allowed and must be a publicly hosted URL. - """ - return self._properties["opt_in_image_urls"] - - @property - def opt_in_type(self) -> "TollfreeVerificationInstance.OptInType": - """ - :returns: - """ - return self._properties["opt_in_type"] - - @property - def message_volume(self) -> str: - """ - :returns: Estimate monthly volume of messages from the Tollfree Number. - """ - return self._properties["message_volume"] - - @property - def additional_information(self) -> str: - """ - :returns: Additional information to be provided for verification. - """ - return self._properties["additional_information"] - - @property - def tollfree_phone_number_sid(self) -> str: - """ - :returns: The SID of the Phone Number associated with the Tollfree Verification. - """ - return self._properties["tollfree_phone_number_sid"] - - @property - def status(self) -> "TollfreeVerificationInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Tollfree Verification resource. - """ - return self._properties["url"] - - @property - def resource_links(self) -> Dict[str, object]: - """ - :returns: The URLs of the documents associated with the Tollfree Verification resource. - """ - return self._properties["resource_links"] - - @property - def external_reference_id(self) -> str: - """ - :returns: An optional external reference ID supplied by customer and echoed back on status retrieval. - """ - return self._properties["external_reference_id"] - def fetch(self) -> "TollfreeVerificationInstance": """ Fetch the TollfreeVerificationInstance diff --git a/twilio/rest/messaging/v1/usecase.py b/twilio/rest/messaging/v1/usecase.py index 2f1a8d937..2af794ebc 100644 --- a/twilio/rest/messaging/v1/usecase.py +++ b/twilio/rest/messaging/v1/usecase.py @@ -13,7 +13,7 @@ """ -from typing import List +from typing import Any, Dict, List, Optional from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -21,25 +21,18 @@ class UsecaseInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the UsecaseInstance - """ + + """ + :ivar usecases: Human readable use case details (usecase, description and purpose) of Messaging Service Use Cases. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "usecases": payload.get("usecases"), - } + self.usecases: Optional[List[object]] = payload.get("usecases") self._solution = {} - @property - def usecases(self) -> List[object]: - """ - :returns: Human readable use case details (usecase, description and purpose) of Messaging Service Use Cases. - """ - return self._properties["usecases"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/microvisor/v1/account_config.py b/twilio/rest/microvisor/v1/account_config.py index 2c733ea13..4bc4ffa32 100644 --- a/twilio/rest/microvisor/v1/account_config.py +++ b/twilio/rest/microvisor/v1/account_config.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,21 +24,28 @@ class AccountConfigInstance(InstanceResource): - def __init__(self, version, payload, key: Optional[str] = None): - """ - Initialize the AccountConfigInstance - """ + + """ + :ivar key: The config key; up to 100 characters. + :ivar date_updated: + :ivar value: The config value; up to 4096 characters. + :ivar url: The absolute URL of the Config. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], key: Optional[str] = None + ): super().__init__(version) - self._properties = { - "key": payload.get("key"), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "value": payload.get("value"), - "url": payload.get("url"), - } + self.key: Optional[str] = payload.get("key") + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.value: Optional[str] = payload.get("value") + self.url: Optional[str] = payload.get("url") self._solution = { - "key": key or self._properties["key"], + "key": key or self.key, } self._context: Optional[AccountConfigContext] = None @@ -57,34 +64,6 @@ def _proxy(self) -> "AccountConfigContext": ) return self._context - @property - def key(self) -> str: - """ - :returns: The config key; up to 100 characters. - """ - return self._properties["key"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def value(self) -> str: - """ - :returns: The config value; up to 4096 characters. - """ - return self._properties["value"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Config. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the AccountConfigInstance diff --git a/twilio/rest/microvisor/v1/account_secret.py b/twilio/rest/microvisor/v1/account_secret.py index bbb815f48..b5e3b3651 100644 --- a/twilio/rest/microvisor/v1/account_secret.py +++ b/twilio/rest/microvisor/v1/account_secret.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,20 +24,26 @@ class AccountSecretInstance(InstanceResource): - def __init__(self, version, payload, key: Optional[str] = None): - """ - Initialize the AccountSecretInstance - """ + + """ + :ivar key: The secret key; up to 100 characters. + :ivar date_rotated: + :ivar url: The absolute URL of the Secret. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], key: Optional[str] = None + ): super().__init__(version) - self._properties = { - "key": payload.get("key"), - "date_rotated": deserialize.iso8601_datetime(payload.get("date_rotated")), - "url": payload.get("url"), - } + self.key: Optional[str] = payload.get("key") + self.date_rotated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_rotated") + ) + self.url: Optional[str] = payload.get("url") self._solution = { - "key": key or self._properties["key"], + "key": key or self.key, } self._context: Optional[AccountSecretContext] = None @@ -56,27 +62,6 @@ def _proxy(self) -> "AccountSecretContext": ) return self._context - @property - def key(self) -> str: - """ - :returns: The secret key; up to 100 characters. - """ - return self._properties["key"] - - @property - def date_rotated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_rotated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Secret. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the AccountSecretInstance diff --git a/twilio/rest/microvisor/v1/app/__init__.py b/twilio/rest/microvisor/v1/app/__init__.py index 75a73590a..b26d7981b 100644 --- a/twilio/rest/microvisor/v1/app/__init__.py +++ b/twilio/rest/microvisor/v1/app/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -25,25 +25,38 @@ class AppInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the AppInstance - """ + + """ + :ivar sid: A 34-character string that uniquely identifies this App. + :ivar account_sid: The unique SID identifier of the Account. + :ivar hash: App manifest hash represented as `hash_algorithm:hash_value`. + :ivar unique_name: A developer-defined string that uniquely identifies the App. This value must be unique for all Apps on this Account. The `unique_name` value may be used as an alternative to the `sid` in the URL path to address the resource. + :ivar date_created: The date that this App was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date that this App was last updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The URL of this resource. + :ivar links: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "hash": payload.get("hash"), - "unique_name": payload.get("unique_name"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.hash: Optional[str] = payload.get("hash") + self.unique_name: Optional[str] = payload.get("unique_name") + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[AppContext] = None @@ -62,62 +75,6 @@ def _proxy(self) -> "AppContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: A 34-character string that uniquely identifies this App. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The unique SID identifier of the Account. - """ - return self._properties["account_sid"] - - @property - def hash(self) -> str: - """ - :returns: App manifest hash represented as `hash_algorithm:hash_value`. - """ - return self._properties["hash"] - - @property - def unique_name(self) -> str: - """ - :returns: A developer-defined string that uniquely identifies the App. This value must be unique for all Apps on this Account. The `unique_name` value may be used as an alternative to the `sid` in the URL path to address the resource. - """ - return self._properties["unique_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this App was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this App was last updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The URL of this resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the AppInstance diff --git a/twilio/rest/microvisor/v1/app/app_manifest.py b/twilio/rest/microvisor/v1/app/app_manifest.py index 6aab79225..dba0240e9 100644 --- a/twilio/rest/microvisor/v1/app/app_manifest.py +++ b/twilio/rest/microvisor/v1/app/app_manifest.py @@ -13,7 +13,7 @@ """ -from typing import Optional +from typing import Any, Dict, Optional from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -21,18 +21,21 @@ class AppManifestInstance(InstanceResource): - def __init__(self, version, payload, app_sid: str): - """ - Initialize the AppManifestInstance - """ + + """ + :ivar app_sid: A 34-character string that uniquely identifies this App. + :ivar hash: App manifest hash represented as `hash_algorithm:hash_value`. + :ivar encoded_bytes: The base-64 encoded manifest + :ivar url: The absolute URL of this Manifest. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], app_sid: str): super().__init__(version) - self._properties = { - "app_sid": payload.get("app_sid"), - "hash": payload.get("hash"), - "encoded_bytes": payload.get("encoded_bytes"), - "url": payload.get("url"), - } + self.app_sid: Optional[str] = payload.get("app_sid") + self.hash: Optional[str] = payload.get("hash") + self.encoded_bytes: Optional[str] = payload.get("encoded_bytes") + self.url: Optional[str] = payload.get("url") self._solution = { "app_sid": app_sid, @@ -54,34 +57,6 @@ def _proxy(self) -> "AppManifestContext": ) return self._context - @property - def app_sid(self) -> str: - """ - :returns: A 34-character string that uniquely identifies this App. - """ - return self._properties["app_sid"] - - @property - def hash(self) -> str: - """ - :returns: App manifest hash represented as `hash_algorithm:hash_value`. - """ - return self._properties["hash"] - - @property - def encoded_bytes(self) -> str: - """ - :returns: The base-64 encoded manifest - """ - return self._properties["encoded_bytes"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of this Manifest. - """ - return self._properties["url"] - def fetch(self) -> "AppManifestInstance": """ Fetch the AppManifestInstance diff --git a/twilio/rest/microvisor/v1/device/__init__.py b/twilio/rest/microvisor/v1/device/__init__.py index 52a90ab48..eadc8c906 100644 --- a/twilio/rest/microvisor/v1/device/__init__.py +++ b/twilio/rest/microvisor/v1/device/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -26,26 +26,40 @@ class DeviceInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the DeviceInstance - """ + + """ + :ivar sid: A 34-character string that uniquely identifies this Device. + :ivar unique_name: A developer-defined string that uniquely identifies the Device. This value must be unique for all Devices on this Account. The `unique_name` value may be used as an alternative to the `sid` in the URL path to address the resource. + :ivar account_sid: The unique SID identifier of the Account. + :ivar app: Information about the target App and the App reported by this Device. Contains the properties `target_sid`, `date_targeted`, `update_status` (one of `up-to-date`, `pending` and `error`), `update_error_code`, `reported_sid` and `date_reported`. + :ivar logging: Object specifying whether application logging is enabled for this Device. Contains the properties `enabled` and `date_expires`. + :ivar date_created: The date that this Device was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date that this Device was last updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The URL of this resource. + :ivar links: The absolute URLs of related resources. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "account_sid": payload.get("account_sid"), - "app": payload.get("app"), - "logging": payload.get("logging"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.account_sid: Optional[str] = payload.get("account_sid") + self.app: Optional[Dict[str, object]] = payload.get("app") + self.logging: Optional[Dict[str, object]] = payload.get("logging") + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[DeviceContext] = None @@ -64,69 +78,6 @@ def _proxy(self) -> "DeviceContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: A 34-character string that uniquely identifies this Device. - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: A developer-defined string that uniquely identifies the Device. This value must be unique for all Devices on this Account. The `unique_name` value may be used as an alternative to the `sid` in the URL path to address the resource. - """ - return self._properties["unique_name"] - - @property - def account_sid(self) -> str: - """ - :returns: The unique SID identifier of the Account. - """ - return self._properties["account_sid"] - - @property - def app(self) -> Dict[str, object]: - """ - :returns: Information about the target App and the App reported by this Device. Contains the properties `target_sid`, `date_targeted`, `update_status` (one of `up-to-date`, `pending` and `error`), `update_error_code`, `reported_sid` and `date_reported`. - """ - return self._properties["app"] - - @property - def logging(self) -> Dict[str, object]: - """ - :returns: Object specifying whether application logging is enabled for this Device. Contains the properties `enabled` and `date_expires`. - """ - return self._properties["logging"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this Device was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this Device was last updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The URL of this resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The absolute URLs of related resources. - """ - return self._properties["links"] - def fetch(self) -> "DeviceInstance": """ Fetch the DeviceInstance diff --git a/twilio/rest/microvisor/v1/device/device_config.py b/twilio/rest/microvisor/v1/device/device_config.py index 38c31013e..ce3bebb9e 100644 --- a/twilio/rest/microvisor/v1/device/device_config.py +++ b/twilio/rest/microvisor/v1/device/device_config.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,23 +24,35 @@ class DeviceConfigInstance(InstanceResource): - def __init__(self, version, payload, device_sid: str, key: Optional[str] = None): - """ - Initialize the DeviceConfigInstance - """ + + """ + :ivar device_sid: A 34-character string that uniquely identifies the parent Device. + :ivar key: The config key; up to 100 characters. + :ivar value: The config value; up to 4096 characters. + :ivar date_updated: + :ivar url: The absolute URL of the Config. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + device_sid: str, + key: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "device_sid": payload.get("device_sid"), - "key": payload.get("key"), - "value": payload.get("value"), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.device_sid: Optional[str] = payload.get("device_sid") + self.key: Optional[str] = payload.get("key") + self.value: Optional[str] = payload.get("value") + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") self._solution = { "device_sid": device_sid, - "key": key or self._properties["key"], + "key": key or self.key, } self._context: Optional[DeviceConfigContext] = None @@ -60,41 +72,6 @@ def _proxy(self) -> "DeviceConfigContext": ) return self._context - @property - def device_sid(self) -> str: - """ - :returns: A 34-character string that uniquely identifies the parent Device. - """ - return self._properties["device_sid"] - - @property - def key(self) -> str: - """ - :returns: The config key; up to 100 characters. - """ - return self._properties["key"] - - @property - def value(self) -> str: - """ - :returns: The config value; up to 4096 characters. - """ - return self._properties["value"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Config. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the DeviceConfigInstance diff --git a/twilio/rest/microvisor/v1/device/device_secret.py b/twilio/rest/microvisor/v1/device/device_secret.py index a2e6af229..0b3d9af22 100644 --- a/twilio/rest/microvisor/v1/device/device_secret.py +++ b/twilio/rest/microvisor/v1/device/device_secret.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,22 +24,33 @@ class DeviceSecretInstance(InstanceResource): - def __init__(self, version, payload, device_sid: str, key: Optional[str] = None): - """ - Initialize the DeviceSecretInstance - """ + + """ + :ivar device_sid: A 34-character string that uniquely identifies the parent Device. + :ivar key: The secret key; up to 100 characters. + :ivar date_rotated: + :ivar url: The absolute URL of the Secret. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + device_sid: str, + key: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "device_sid": payload.get("device_sid"), - "key": payload.get("key"), - "date_rotated": deserialize.iso8601_datetime(payload.get("date_rotated")), - "url": payload.get("url"), - } + self.device_sid: Optional[str] = payload.get("device_sid") + self.key: Optional[str] = payload.get("key") + self.date_rotated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_rotated") + ) + self.url: Optional[str] = payload.get("url") self._solution = { "device_sid": device_sid, - "key": key or self._properties["key"], + "key": key or self.key, } self._context: Optional[DeviceSecretContext] = None @@ -59,34 +70,6 @@ def _proxy(self) -> "DeviceSecretContext": ) return self._context - @property - def device_sid(self) -> str: - """ - :returns: A 34-character string that uniquely identifies the parent Device. - """ - return self._properties["device_sid"] - - @property - def key(self) -> str: - """ - :returns: The secret key; up to 100 characters. - """ - return self._properties["key"] - - @property - def date_rotated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_rotated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Secret. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the DeviceSecretInstance diff --git a/twilio/rest/monitor/v1/alert.py b/twilio/rest/monitor/v1/alert.py index 9890188e8..22c0a7d67 100644 --- a/twilio/rest/monitor/v1/alert.py +++ b/twilio/rest/monitor/v1/alert.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,38 +24,62 @@ class AlertInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the AlertInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Alert resource. + :ivar alert_text: The text of the alert. + :ivar api_version: The API version used when the alert was generated. Can be empty for events that don't have a specific API version. + :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_generated: The date and time in GMT when the alert was generated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. Due to buffering, this can be different than `date_created`. + :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 error_code: The error code for the condition that generated the alert. See the [Error Dictionary](https://www.twilio.com/docs/api/errors) for possible causes and solutions to the error. + :ivar log_level: The log level. Can be: `error`, `warning`, `notice`, or `debug`. + :ivar more_info: The URL of the page in our [Error Dictionary](https://www.twilio.com/docs/api/errors) with more information about the error condition. + :ivar request_method: The method used by the request that generated the alert. If the alert was generated by a request we made to your server, this is the method we used. If the alert was generated by a request from your application to our API, this is the method your application used. + :ivar request_url: The URL of the request that generated the alert. If the alert was generated by a request we made to your server, this is the URL on your server that generated the alert. If the alert was generated by a request from your application to our API, this is the URL of the resource requested. + :ivar request_variables: The variables passed in the request that generated the alert. This value is only returned when a single Alert resource is fetched. + :ivar resource_sid: The SID of the resource for which the alert was generated. For instance, if your server failed to respond to an HTTP request during the flow of a particular call, this value would be the SID of the server. This value is empty if the alert was not generated for a particular resource. + :ivar response_body: The response body of the request that generated the alert. This value is only returned when a single Alert resource is fetched. + :ivar response_headers: The response headers of the request that generated the alert. This value is only returned when a single Alert resource is fetched. + :ivar sid: The unique string that we created to identify the Alert resource. + :ivar url: The absolute URL of the Alert resource. + :ivar request_headers: The request headers of the request that generated the alert. This value is only returned when a single Alert resource is fetched. + :ivar service_sid: The SID of the service or resource that generated the alert. Can be `null`. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "alert_text": payload.get("alert_text"), - "api_version": payload.get("api_version"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_generated": deserialize.iso8601_datetime( - payload.get("date_generated") - ), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "error_code": payload.get("error_code"), - "log_level": payload.get("log_level"), - "more_info": payload.get("more_info"), - "request_method": payload.get("request_method"), - "request_url": payload.get("request_url"), - "request_variables": payload.get("request_variables"), - "resource_sid": payload.get("resource_sid"), - "response_body": payload.get("response_body"), - "response_headers": payload.get("response_headers"), - "sid": payload.get("sid"), - "url": payload.get("url"), - "request_headers": payload.get("request_headers"), - "service_sid": payload.get("service_sid"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.alert_text: Optional[str] = payload.get("alert_text") + self.api_version: Optional[str] = payload.get("api_version") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_generated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_generated") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.error_code: Optional[str] = payload.get("error_code") + self.log_level: Optional[str] = payload.get("log_level") + self.more_info: Optional[str] = payload.get("more_info") + self.request_method: Optional[str] = payload.get("request_method") + self.request_url: Optional[str] = payload.get("request_url") + self.request_variables: Optional[str] = payload.get("request_variables") + self.resource_sid: Optional[str] = payload.get("resource_sid") + self.response_body: Optional[str] = payload.get("response_body") + self.response_headers: Optional[str] = payload.get("response_headers") + self.sid: Optional[str] = payload.get("sid") + self.url: Optional[str] = payload.get("url") + self.request_headers: Optional[str] = payload.get("request_headers") + self.service_sid: Optional[str] = payload.get("service_sid") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[AlertContext] = None @@ -74,139 +98,6 @@ def _proxy(self) -> "AlertContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Alert resource. - """ - return self._properties["account_sid"] - - @property - def alert_text(self) -> str: - """ - :returns: The text of the alert. - """ - return self._properties["alert_text"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used when the alert was generated. Can be empty for events that don't have a specific API version. - """ - return self._properties["api_version"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_generated(self) -> datetime: - """ - :returns: The date and time in GMT when the alert was generated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. Due to buffering, this can be different than `date_created`. - """ - return self._properties["date_generated"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def error_code(self) -> str: - """ - :returns: The error code for the condition that generated the alert. See the [Error Dictionary](https://www.twilio.com/docs/api/errors) for possible causes and solutions to the error. - """ - return self._properties["error_code"] - - @property - def log_level(self) -> str: - """ - :returns: The log level. Can be: `error`, `warning`, `notice`, or `debug`. - """ - return self._properties["log_level"] - - @property - def more_info(self) -> str: - """ - :returns: The URL of the page in our [Error Dictionary](https://www.twilio.com/docs/api/errors) with more information about the error condition. - """ - return self._properties["more_info"] - - @property - def request_method(self) -> str: - """ - :returns: The method used by the request that generated the alert. If the alert was generated by a request we made to your server, this is the method we used. If the alert was generated by a request from your application to our API, this is the method your application used. - """ - return self._properties["request_method"] - - @property - def request_url(self) -> str: - """ - :returns: The URL of the request that generated the alert. If the alert was generated by a request we made to your server, this is the URL on your server that generated the alert. If the alert was generated by a request from your application to our API, this is the URL of the resource requested. - """ - return self._properties["request_url"] - - @property - def request_variables(self) -> str: - """ - :returns: The variables passed in the request that generated the alert. This value is only returned when a single Alert resource is fetched. - """ - return self._properties["request_variables"] - - @property - def resource_sid(self) -> str: - """ - :returns: The SID of the resource for which the alert was generated. For instance, if your server failed to respond to an HTTP request during the flow of a particular call, this value would be the SID of the server. This value is empty if the alert was not generated for a particular resource. - """ - return self._properties["resource_sid"] - - @property - def response_body(self) -> str: - """ - :returns: The response body of the request that generated the alert. This value is only returned when a single Alert resource is fetched. - """ - return self._properties["response_body"] - - @property - def response_headers(self) -> str: - """ - :returns: The response headers of the request that generated the alert. This value is only returned when a single Alert resource is fetched. - """ - return self._properties["response_headers"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Alert resource. - """ - return self._properties["sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Alert resource. - """ - return self._properties["url"] - - @property - def request_headers(self) -> str: - """ - :returns: The request headers of the request that generated the alert. This value is only returned when a single Alert resource is fetched. - """ - return self._properties["request_headers"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the service or resource that generated the alert. Can be `null`. - """ - return self._properties["service_sid"] - def fetch(self) -> "AlertInstance": """ Fetch the AlertInstance diff --git a/twilio/rest/monitor/v1/event.py b/twilio/rest/monitor/v1/event.py index e46e743b1..340c2263a 100644 --- a/twilio/rest/monitor/v1/event.py +++ b/twilio/rest/monitor/v1/event.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,31 +24,48 @@ class EventInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the EventInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Event resource. + :ivar actor_sid: The SID of the actor that caused the event, if available. Can be `null`. + :ivar actor_type: The type of actor that caused the event. Can be: `user` for a change made by a logged-in user in the Twilio Console, `account` for an event caused by an API request by an authenticating Account, `twilio-admin` for an event caused by a Twilio employee, and so on. + :ivar description: A description of the event. Can be `null`. + :ivar event_data: An object with additional data about the event. The contents depend on `event_type`. For example, event-types of the form `RESOURCE.updated`, this value contains a `resource_properties` dictionary that describes the previous and updated properties of the resource. + :ivar event_date: The date and time in GMT when the event was recorded specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar event_type: The event's type. Event-types are typically in the form: `RESOURCE_TYPE.ACTION`, where `RESOURCE_TYPE` is the type of resource that was affected and `ACTION` is what happened to it. For example, `phone-number.created`. For a full list of all event-types, see the [Monitor Event Types](https://www.twilio.com/docs/usage/monitor-events#event-types). + :ivar resource_sid: The SID of the resource that was affected. + :ivar resource_type: The type of resource that was affected. For a full list of all resource-types, see the [Monitor Event Types](https://www.twilio.com/docs/usage/monitor-events#event-types). + :ivar sid: The unique string that we created to identify the Event resource. + :ivar source: The originating system or interface that caused the event. Can be: `web` for events caused by user action in the Twilio Console, `api` for events caused by a request to our API, or `twilio` for events caused by an automated or internal Twilio system. + :ivar source_ip_address: The IP address of the source, if the source is outside the Twilio cloud. This value is `null` for events with `source` of `twilio` + :ivar url: The absolute URL of the resource that was affected. Can be `null`. + :ivar links: The absolute URLs of related resources. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "actor_sid": payload.get("actor_sid"), - "actor_type": payload.get("actor_type"), - "description": payload.get("description"), - "event_data": payload.get("event_data"), - "event_date": deserialize.iso8601_datetime(payload.get("event_date")), - "event_type": payload.get("event_type"), - "resource_sid": payload.get("resource_sid"), - "resource_type": payload.get("resource_type"), - "sid": payload.get("sid"), - "source": payload.get("source"), - "source_ip_address": payload.get("source_ip_address"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.actor_sid: Optional[str] = payload.get("actor_sid") + self.actor_type: Optional[str] = payload.get("actor_type") + self.description: Optional[str] = payload.get("description") + self.event_data: Optional[Dict[str, object]] = payload.get("event_data") + self.event_date: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("event_date") + ) + self.event_type: Optional[str] = payload.get("event_type") + self.resource_sid: Optional[str] = payload.get("resource_sid") + self.resource_type: Optional[str] = payload.get("resource_type") + self.sid: Optional[str] = payload.get("sid") + self.source: Optional[str] = payload.get("source") + self.source_ip_address: Optional[str] = payload.get("source_ip_address") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[EventContext] = None @@ -67,104 +84,6 @@ def _proxy(self) -> "EventContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Event resource. - """ - return self._properties["account_sid"] - - @property - def actor_sid(self) -> str: - """ - :returns: The SID of the actor that caused the event, if available. Can be `null`. - """ - return self._properties["actor_sid"] - - @property - def actor_type(self) -> str: - """ - :returns: The type of actor that caused the event. Can be: `user` for a change made by a logged-in user in the Twilio Console, `account` for an event caused by an API request by an authenticating Account, `twilio-admin` for an event caused by a Twilio employee, and so on. - """ - return self._properties["actor_type"] - - @property - def description(self) -> str: - """ - :returns: A description of the event. Can be `null`. - """ - return self._properties["description"] - - @property - def event_data(self) -> Dict[str, object]: - """ - :returns: An object with additional data about the event. The contents depend on `event_type`. For example, event-types of the form `RESOURCE.updated`, this value contains a `resource_properties` dictionary that describes the previous and updated properties of the resource. - """ - return self._properties["event_data"] - - @property - def event_date(self) -> datetime: - """ - :returns: The date and time in GMT when the event was recorded specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["event_date"] - - @property - def event_type(self) -> str: - """ - :returns: The event's type. Event-types are typically in the form: `RESOURCE_TYPE.ACTION`, where `RESOURCE_TYPE` is the type of resource that was affected and `ACTION` is what happened to it. For example, `phone-number.created`. For a full list of all event-types, see the [Monitor Event Types](https://www.twilio.com/docs/usage/monitor-events#event-types). - """ - return self._properties["event_type"] - - @property - def resource_sid(self) -> str: - """ - :returns: The SID of the resource that was affected. - """ - return self._properties["resource_sid"] - - @property - def resource_type(self) -> str: - """ - :returns: The type of resource that was affected. For a full list of all resource-types, see the [Monitor Event Types](https://www.twilio.com/docs/usage/monitor-events#event-types). - """ - return self._properties["resource_type"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Event resource. - """ - return self._properties["sid"] - - @property - def source(self) -> str: - """ - :returns: The originating system or interface that caused the event. Can be: `web` for events caused by user action in the Twilio Console, `api` for events caused by a request to our API, or `twilio` for events caused by an automated or internal Twilio system. - """ - return self._properties["source"] - - @property - def source_ip_address(self) -> str: - """ - :returns: The IP address of the source, if the source is outside the Twilio cloud. This value is `null` for events with `source` of `twilio` - """ - return self._properties["source_ip_address"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource that was affected. Can be `null`. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The absolute URLs of related resources. - """ - return self._properties["links"] - def fetch(self) -> "EventInstance": """ Fetch the EventInstance diff --git a/twilio/rest/notify/v1/credential.py b/twilio/rest/notify/v1/credential.py index a90912b17..202d9b717 100644 --- a/twilio/rest/notify/v1/credential.py +++ b/twilio/rest/notify/v1/credential.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -29,25 +29,37 @@ class PushService(object): APN = "apn" FCM = "fcm" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the CredentialInstance - """ + """ + :ivar sid: The unique string that we created to identify the Credential resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Credential resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar type: + :ivar sandbox: [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar url: The absolute URL of the Credential resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "type": payload.get("type"), - "sandbox": payload.get("sandbox"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + 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["CredentialInstance.PushService"] = payload.get("type") + self.sandbox: Optional[str] = payload.get("sandbox") + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[CredentialContext] = None @@ -66,62 +78,6 @@ def _proxy(self) -> "CredentialContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Credential resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Credential resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def type(self) -> "CredentialInstance.PushService": - """ - :returns: - """ - return self._properties["type"] - - @property - def sandbox(self) -> str: - """ - :returns: [APN only] Whether to send the credential to sandbox APNs. Can be `true` to send to sandbox APNs or `false` to send to production. - """ - return self._properties["sandbox"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Credential resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the CredentialInstance diff --git a/twilio/rest/notify/v1/service/__init__.py b/twilio/rest/notify/v1/service/__init__.py index 676fad32c..b64e13942 100644 --- a/twilio/rest/notify/v1/service/__init__.py +++ b/twilio/rest/notify/v1/service/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -26,45 +26,74 @@ class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the ServiceInstance - """ + + """ + :ivar sid: The unique string that we created to identify the Service resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar apn_credential_sid: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for APN Bindings. + :ivar gcm_credential_sid: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for GCM Bindings. + :ivar fcm_credential_sid: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for FCM Bindings. + :ivar messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/sms/send-messages#messaging-services) to use for SMS Bindings. In order to send SMS notifications this parameter has to be set. + :ivar facebook_messenger_page_id: Deprecated. + :ivar default_apn_notification_protocol_version: The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. + :ivar default_gcm_notification_protocol_version: The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. + :ivar default_fcm_notification_protocol_version: The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. + :ivar log_enabled: Whether to log notifications. Can be: `true` or `false` and the default is `true`. + :ivar url: The absolute URL of the Service resource. + :ivar links: The URLs of the Binding, Notification, Segment, and User resources related to the service. + :ivar alexa_skill_id: Deprecated. + :ivar default_alexa_notification_protocol_version: Deprecated. + :ivar delivery_callback_url: URL to send delivery status callback. + :ivar delivery_callback_enabled: Callback configuration that enables delivery callbacks, default false + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "apn_credential_sid": payload.get("apn_credential_sid"), - "gcm_credential_sid": payload.get("gcm_credential_sid"), - "fcm_credential_sid": payload.get("fcm_credential_sid"), - "messaging_service_sid": payload.get("messaging_service_sid"), - "facebook_messenger_page_id": payload.get("facebook_messenger_page_id"), - "default_apn_notification_protocol_version": payload.get( - "default_apn_notification_protocol_version" - ), - "default_gcm_notification_protocol_version": payload.get( - "default_gcm_notification_protocol_version" - ), - "default_fcm_notification_protocol_version": payload.get( - "default_fcm_notification_protocol_version" - ), - "log_enabled": payload.get("log_enabled"), - "url": payload.get("url"), - "links": payload.get("links"), - "alexa_skill_id": payload.get("alexa_skill_id"), - "default_alexa_notification_protocol_version": payload.get( - "default_alexa_notification_protocol_version" - ), - "delivery_callback_url": payload.get("delivery_callback_url"), - "delivery_callback_enabled": payload.get("delivery_callback_enabled"), - } + 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.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.apn_credential_sid: Optional[str] = payload.get("apn_credential_sid") + self.gcm_credential_sid: Optional[str] = payload.get("gcm_credential_sid") + self.fcm_credential_sid: Optional[str] = payload.get("fcm_credential_sid") + self.messaging_service_sid: Optional[str] = payload.get("messaging_service_sid") + self.facebook_messenger_page_id: Optional[str] = payload.get( + "facebook_messenger_page_id" + ) + self.default_apn_notification_protocol_version: Optional[str] = payload.get( + "default_apn_notification_protocol_version" + ) + self.default_gcm_notification_protocol_version: Optional[str] = payload.get( + "default_gcm_notification_protocol_version" + ) + self.default_fcm_notification_protocol_version: Optional[str] = payload.get( + "default_fcm_notification_protocol_version" + ) + self.log_enabled: Optional[bool] = payload.get("log_enabled") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.alexa_skill_id: Optional[str] = payload.get("alexa_skill_id") + self.default_alexa_notification_protocol_version: Optional[str] = payload.get( + "default_alexa_notification_protocol_version" + ) + self.delivery_callback_url: Optional[str] = payload.get("delivery_callback_url") + self.delivery_callback_enabled: Optional[bool] = payload.get( + "delivery_callback_enabled" + ) self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ServiceContext] = None @@ -83,146 +112,6 @@ def _proxy(self) -> "ServiceContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Service resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def apn_credential_sid(self) -> str: - """ - :returns: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for APN Bindings. - """ - return self._properties["apn_credential_sid"] - - @property - def gcm_credential_sid(self) -> str: - """ - :returns: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for GCM Bindings. - """ - return self._properties["gcm_credential_sid"] - - @property - def fcm_credential_sid(self) -> str: - """ - :returns: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) to use for FCM Bindings. - """ - return self._properties["fcm_credential_sid"] - - @property - def messaging_service_sid(self) -> str: - """ - :returns: The SID of the [Messaging Service](https://www.twilio.com/docs/sms/send-messages#messaging-services) to use for SMS Bindings. In order to send SMS notifications this parameter has to be set. - """ - return self._properties["messaging_service_sid"] - - @property - def facebook_messenger_page_id(self) -> str: - """ - :returns: Deprecated. - """ - return self._properties["facebook_messenger_page_id"] - - @property - def default_apn_notification_protocol_version(self) -> str: - """ - :returns: The protocol version to use for sending APNS notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. - """ - return self._properties["default_apn_notification_protocol_version"] - - @property - def default_gcm_notification_protocol_version(self) -> str: - """ - :returns: The protocol version to use for sending GCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. - """ - return self._properties["default_gcm_notification_protocol_version"] - - @property - def default_fcm_notification_protocol_version(self) -> str: - """ - :returns: The protocol version to use for sending FCM notifications. Can be overridden on a Binding by Binding basis when creating a [Binding](https://www.twilio.com/docs/notify/api/binding-resource) resource. - """ - return self._properties["default_fcm_notification_protocol_version"] - - @property - def log_enabled(self) -> bool: - """ - :returns: Whether to log notifications. Can be: `true` or `false` and the default is `true`. - """ - return self._properties["log_enabled"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Service resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of the Binding, Notification, Segment, and User resources related to the service. - """ - return self._properties["links"] - - @property - def alexa_skill_id(self) -> str: - """ - :returns: Deprecated. - """ - return self._properties["alexa_skill_id"] - - @property - def default_alexa_notification_protocol_version(self) -> str: - """ - :returns: Deprecated. - """ - return self._properties["default_alexa_notification_protocol_version"] - - @property - def delivery_callback_url(self) -> str: - """ - :returns: URL to send delivery status callback. - """ - return self._properties["delivery_callback_url"] - - @property - def delivery_callback_enabled(self) -> bool: - """ - :returns: Callback configuration that enables delivery callbacks, default false - """ - return self._properties["delivery_callback_enabled"] - def delete(self) -> bool: """ Deletes the ServiceInstance diff --git a/twilio/rest/notify/v1/service/binding.py b/twilio/rest/notify/v1/service/binding.py index 917187906..0c7a625d2 100644 --- a/twilio/rest/notify/v1/service/binding.py +++ b/twilio/rest/notify/v1/service/binding.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,34 +24,57 @@ class BindingInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the BindingInstance - """ + + """ + :ivar sid: The unique string that we created to identify the Binding resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Binding resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/notify/api/service-resource) the resource is associated with. + :ivar credential_sid: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) resource to be used to send notifications to this Binding. If present, this overrides the Credential specified in the Service resource. Applicable only to `apn`, `fcm`, and `gcm` type Bindings. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar notification_protocol_version: The protocol version to use to send the notification. This defaults to the value of `default_xxxx_notification_protocol_version` in the [Service](https://www.twilio.com/docs/notify/api/service-resource) for the protocol. The current version is `\"3\"` for `apn`, `fcm`, and `gcm` type Bindings. The parameter is not applicable to `sms` and `facebook-messenger` type Bindings as the data format is fixed. + :ivar endpoint: Deprecated. + :ivar identity: The `identity` value that uniquely identifies the resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/notify/api/service-resource). Up to 20 Bindings can be created for the same Identity in a given Service. + :ivar binding_type: The transport technology to use for the Binding. Can be: `apn`, `fcm`, `gcm`, `sms`, or `facebook-messenger`. + :ivar address: The channel-specific address. For APNS, the device token. For FCM and GCM, the registration token. For SMS, a phone number in E.164 format. For Facebook Messenger, the Messenger ID of the user or a phone number in E.164 format. + :ivar tags: The list of tags associated with this Binding. Tags can be used to select the Bindings to use when sending a notification. Maximum 20 tags are allowed. + :ivar url: The absolute URL of the Binding resource. + :ivar links: The URLs of related resources. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "credential_sid": payload.get("credential_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "notification_protocol_version": payload.get( - "notification_protocol_version" - ), - "endpoint": payload.get("endpoint"), - "identity": payload.get("identity"), - "binding_type": payload.get("binding_type"), - "address": payload.get("address"), - "tags": payload.get("tags"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.credential_sid: Optional[str] = payload.get("credential_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.notification_protocol_version: Optional[str] = payload.get( + "notification_protocol_version" + ) + self.endpoint: Optional[str] = payload.get("endpoint") + self.identity: Optional[str] = payload.get("identity") + self.binding_type: Optional[str] = payload.get("binding_type") + self.address: Optional[str] = payload.get("address") + self.tags: Optional[List[str]] = payload.get("tags") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[BindingContext] = None @@ -71,104 +94,6 @@ def _proxy(self) -> "BindingContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Binding resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Binding resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/notify/api/service-resource) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def credential_sid(self) -> str: - """ - :returns: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) resource to be used to send notifications to this Binding. If present, this overrides the Credential specified in the Service resource. Applicable only to `apn`, `fcm`, and `gcm` type Bindings. - """ - return self._properties["credential_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def notification_protocol_version(self) -> str: - """ - :returns: The protocol version to use to send the notification. This defaults to the value of `default_xxxx_notification_protocol_version` in the [Service](https://www.twilio.com/docs/notify/api/service-resource) for the protocol. The current version is `\"3\"` for `apn`, `fcm`, and `gcm` type Bindings. The parameter is not applicable to `sms` and `facebook-messenger` type Bindings as the data format is fixed. - """ - return self._properties["notification_protocol_version"] - - @property - def endpoint(self) -> str: - """ - :returns: Deprecated. - """ - return self._properties["endpoint"] - - @property - def identity(self) -> str: - """ - :returns: The `identity` value that uniquely identifies the resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/notify/api/service-resource). Up to 20 Bindings can be created for the same Identity in a given Service. - """ - return self._properties["identity"] - - @property - def binding_type(self) -> str: - """ - :returns: The transport technology to use for the Binding. Can be: `apn`, `fcm`, `gcm`, `sms`, or `facebook-messenger`. - """ - return self._properties["binding_type"] - - @property - def address(self) -> str: - """ - :returns: The channel-specific address. For APNS, the device token. For FCM and GCM, the registration token. For SMS, a phone number in E.164 format. For Facebook Messenger, the Messenger ID of the user or a phone number in E.164 format. - """ - return self._properties["address"] - - @property - def tags(self) -> List[str]: - """ - :returns: The list of tags associated with this Binding. Tags can be used to select the Bindings to use when sending a notification. Maximum 20 tags are allowed. - """ - return self._properties["tags"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Binding resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the BindingInstance diff --git a/twilio/rest/notify/v1/service/notification.py b/twilio/rest/notify/v1/service/notification.py index 326a35615..92237372a 100644 --- a/twilio/rest/notify/v1/service/notification.py +++ b/twilio/rest/notify/v1/service/notification.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource @@ -27,179 +27,63 @@ class Priority(object): HIGH = "high" LOW = "low" - def __init__(self, version, payload, service_sid: str): - """ - Initialize the NotificationInstance - """ + """ + :ivar sid: The unique string that we created to identify the Notification resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Notification resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/notify/api/service-resource) the resource is associated with. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar identities: The list of `identity` values of the Users to notify. We will attempt to deliver notifications only to Bindings with an identity in this list. + :ivar tags: The tags that select the Bindings to notify. Notifications will be attempted only to Bindings that have all of the tags listed in this property. + :ivar segments: The list of Segments to notify. The [Segment](https://www.twilio.com/docs/notify/api/segment-resource) resource is deprecated. Use the `tags` property, instead. + :ivar priority: + :ivar ttl: How long, in seconds, the notification is valid. Can be an integer between 0 and 2,419,200, which is 4 weeks, the default and the maximum supported time to live (TTL). Delivery should be attempted if the device is offline until the TTL elapses. Zero means that the notification delivery is attempted immediately, only once, and is not stored for future delivery. SMS does not support this property. + :ivar title: The notification title. For FCM and GCM, this translates to the `data.twi_title` value. For APNS, this translates to the `aps.alert.title` value. SMS does not support this property. This field is not visible on iOS phones and tablets but appears on Apple Watch and Android devices. + :ivar body: The notification text. For FCM and GCM, translates to `data.twi_body`. For APNS, translates to `aps.alert.body`. For SMS, translates to `body`. SMS requires either this `body` value, or `media_urls` attribute defined in the `sms` parameter of the notification. + :ivar sound: The name of the sound to be played for the notification. For FCM and GCM, this Translates to `data.twi_sound`. For APNS, this translates to `aps.sound`. SMS does not support this property. + :ivar action: The actions to display for the notification. For APNS, translates to the `aps.category` value. For GCM, translates to the `data.twi_action` value. For SMS, this parameter is not supported and is omitted from deliveries to those channels. + :ivar data: The custom key-value pairs of the notification's payload. For FCM and GCM, this value translates to `data` in the FCM and GCM payloads. FCM and GCM [reserve certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref) that cannot be used in those channels. For APNS, attributes of `data` are inserted into the APNS payload as custom properties outside of the `aps` dictionary. In all channels, we reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed and are rejected as 400 Bad request with no delivery attempted. For SMS, this parameter is not supported and is omitted from deliveries to those channels. + :ivar apn: The APNS-specific payload that overrides corresponding attributes in the generic payload for APNS Bindings. This property maps to the APNS `Payload` item, therefore the `aps` key must be used to change standard attributes. Adds custom key-value pairs to the root of the dictionary. See the [APNS documentation](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html) for more details. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. + :ivar gcm: The GCM-specific payload that overrides corresponding attributes in the generic payload for GCM Bindings. This property maps to the root JSON dictionary. Target parameters `to`, `registration_ids`, and `notification_key` are not allowed. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. + :ivar fcm: The FCM-specific payload that overrides corresponding attributes in the generic payload for FCM Bindings. This property maps to the root JSON dictionary. See the [FCM documentation](https://firebase.google.com/docs/cloud-messaging/http-server-ref#downstream) for more details. Target parameters `to`, `registration_ids`, `condition`, and `notification_key` are not allowed in this parameter. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. FCM also [reserves certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref), which cannot be used in that channel. + :ivar sms: The SMS-specific payload that overrides corresponding attributes in the generic payload for SMS Bindings. Each attribute in this value maps to the corresponding `form` parameter of the Twilio [Message](https://www.twilio.com/docs/sms/api/message-resource) resource. These parameters of the Message resource are supported in snake case format: `body`, `media_urls`, `status_callback`, and `max_price`. The `status_callback` parameter overrides the corresponding parameter in the messaging service, if configured. The `media_urls` property expects a JSON array. + :ivar facebook_messenger: Deprecated. + :ivar alexa: Deprecated. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], service_sid: str): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "identities": payload.get("identities"), - "tags": payload.get("tags"), - "segments": payload.get("segments"), - "priority": payload.get("priority"), - "ttl": deserialize.integer(payload.get("ttl")), - "title": payload.get("title"), - "body": payload.get("body"), - "sound": payload.get("sound"), - "action": payload.get("action"), - "data": payload.get("data"), - "apn": payload.get("apn"), - "gcm": payload.get("gcm"), - "fcm": payload.get("fcm"), - "sms": payload.get("sms"), - "facebook_messenger": payload.get("facebook_messenger"), - "alexa": payload.get("alexa"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.identities: Optional[List[str]] = payload.get("identities") + self.tags: Optional[List[str]] = payload.get("tags") + self.segments: Optional[List[str]] = payload.get("segments") + self.priority: Optional["NotificationInstance.Priority"] = payload.get( + "priority" + ) + self.ttl: Optional[int] = deserialize.integer(payload.get("ttl")) + self.title: Optional[str] = payload.get("title") + self.body: Optional[str] = payload.get("body") + self.sound: Optional[str] = payload.get("sound") + self.action: Optional[str] = payload.get("action") + self.data: Optional[Dict[str, object]] = payload.get("data") + self.apn: Optional[Dict[str, object]] = payload.get("apn") + self.gcm: Optional[Dict[str, object]] = payload.get("gcm") + self.fcm: Optional[Dict[str, object]] = payload.get("fcm") + self.sms: Optional[Dict[str, object]] = payload.get("sms") + self.facebook_messenger: Optional[Dict[str, object]] = payload.get( + "facebook_messenger" + ) + self.alexa: Optional[Dict[str, object]] = payload.get("alexa") self._solution = { "service_sid": service_sid, } - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Notification resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Notification resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/notify/api/service-resource) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def identities(self) -> List[str]: - """ - :returns: The list of `identity` values of the Users to notify. We will attempt to deliver notifications only to Bindings with an identity in this list. - """ - return self._properties["identities"] - - @property - def tags(self) -> List[str]: - """ - :returns: The tags that select the Bindings to notify. Notifications will be attempted only to Bindings that have all of the tags listed in this property. - """ - return self._properties["tags"] - - @property - def segments(self) -> List[str]: - """ - :returns: The list of Segments to notify. The [Segment](https://www.twilio.com/docs/notify/api/segment-resource) resource is deprecated. Use the `tags` property, instead. - """ - return self._properties["segments"] - - @property - def priority(self) -> "NotificationInstance.Priority": - """ - :returns: - """ - return self._properties["priority"] - - @property - def ttl(self) -> int: - """ - :returns: How long, in seconds, the notification is valid. Can be an integer between 0 and 2,419,200, which is 4 weeks, the default and the maximum supported time to live (TTL). Delivery should be attempted if the device is offline until the TTL elapses. Zero means that the notification delivery is attempted immediately, only once, and is not stored for future delivery. SMS does not support this property. - """ - return self._properties["ttl"] - - @property - def title(self) -> str: - """ - :returns: The notification title. For FCM and GCM, this translates to the `data.twi_title` value. For APNS, this translates to the `aps.alert.title` value. SMS does not support this property. This field is not visible on iOS phones and tablets but appears on Apple Watch and Android devices. - """ - return self._properties["title"] - - @property - def body(self) -> str: - """ - :returns: The notification text. For FCM and GCM, translates to `data.twi_body`. For APNS, translates to `aps.alert.body`. For SMS, translates to `body`. SMS requires either this `body` value, or `media_urls` attribute defined in the `sms` parameter of the notification. - """ - return self._properties["body"] - - @property - def sound(self) -> str: - """ - :returns: The name of the sound to be played for the notification. For FCM and GCM, this Translates to `data.twi_sound`. For APNS, this translates to `aps.sound`. SMS does not support this property. - """ - return self._properties["sound"] - - @property - def action(self) -> str: - """ - :returns: The actions to display for the notification. For APNS, translates to the `aps.category` value. For GCM, translates to the `data.twi_action` value. For SMS, this parameter is not supported and is omitted from deliveries to those channels. - """ - return self._properties["action"] - - @property - def data(self) -> Dict[str, object]: - """ - :returns: The custom key-value pairs of the notification's payload. For FCM and GCM, this value translates to `data` in the FCM and GCM payloads. FCM and GCM [reserve certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref) that cannot be used in those channels. For APNS, attributes of `data` are inserted into the APNS payload as custom properties outside of the `aps` dictionary. In all channels, we reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed and are rejected as 400 Bad request with no delivery attempted. For SMS, this parameter is not supported and is omitted from deliveries to those channels. - """ - return self._properties["data"] - - @property - def apn(self) -> Dict[str, object]: - """ - :returns: The APNS-specific payload that overrides corresponding attributes in the generic payload for APNS Bindings. This property maps to the APNS `Payload` item, therefore the `aps` key must be used to change standard attributes. Adds custom key-value pairs to the root of the dictionary. See the [APNS documentation](https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html) for more details. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. - """ - return self._properties["apn"] - - @property - def gcm(self) -> Dict[str, object]: - """ - :returns: The GCM-specific payload that overrides corresponding attributes in the generic payload for GCM Bindings. This property maps to the root JSON dictionary. Target parameters `to`, `registration_ids`, and `notification_key` are not allowed. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. - """ - return self._properties["gcm"] - - @property - def fcm(self) -> Dict[str, object]: - """ - :returns: The FCM-specific payload that overrides corresponding attributes in the generic payload for FCM Bindings. This property maps to the root JSON dictionary. See the [FCM documentation](https://firebase.google.com/docs/cloud-messaging/http-server-ref#downstream) for more details. Target parameters `to`, `registration_ids`, `condition`, and `notification_key` are not allowed in this parameter. We reserve keys that start with `twi_` for future use. Custom keys that start with `twi_` are not allowed. FCM also [reserves certain keys](https://firebase.google.com/docs/cloud-messaging/http-server-ref), which cannot be used in that channel. - """ - return self._properties["fcm"] - - @property - def sms(self) -> Dict[str, object]: - """ - :returns: The SMS-specific payload that overrides corresponding attributes in the generic payload for SMS Bindings. Each attribute in this value maps to the corresponding `form` parameter of the Twilio [Message](https://www.twilio.com/docs/sms/api/message-resource) resource. These parameters of the Message resource are supported in snake case format: `body`, `media_urls`, `status_callback`, and `max_price`. The `status_callback` parameter overrides the corresponding parameter in the messaging service, if configured. The `media_urls` property expects a JSON array. - """ - return self._properties["sms"] - - @property - def facebook_messenger(self) -> Dict[str, object]: - """ - :returns: Deprecated. - """ - return self._properties["facebook_messenger"] - - @property - def alexa(self) -> Dict[str, object]: - """ - :returns: Deprecated. - """ - return self._properties["alexa"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py index 9ed6150cc..403c0366b 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -52,29 +52,47 @@ class Status(object): TWILIO_APPROVED = "twilio-approved" PROVISIONALLY_APPROVED = "provisionally-approved" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the BundleInstance - """ + """ + :ivar sid: The unique string that we created to identify the Bundle resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource. + :ivar regulation_sid: The unique string of a regulation that is associated to the Bundle resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar status: + :ivar valid_until: The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. + :ivar email: The email address that will receive updates when the Bundle resource changes status. + :ivar status_callback: The URL we call to inform your application of status changes. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the Bundle resource. + :ivar links: The URLs of the Assigned Items of the Bundle resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "regulation_sid": payload.get("regulation_sid"), - "friendly_name": payload.get("friendly_name"), - "status": payload.get("status"), - "valid_until": deserialize.iso8601_datetime(payload.get("valid_until")), - "email": payload.get("email"), - "status_callback": payload.get("status_callback"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.regulation_sid: Optional[str] = payload.get("regulation_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.status: Optional["BundleInstance.Status"] = payload.get("status") + self.valid_until: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("valid_until") + ) + self.email: Optional[str] = payload.get("email") + self.status_callback: Optional[str] = payload.get("status_callback") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[BundleContext] = None @@ -93,90 +111,6 @@ def _proxy(self) -> "BundleContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Bundle resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource. - """ - return self._properties["account_sid"] - - @property - def regulation_sid(self) -> str: - """ - :returns: The unique string of a regulation that is associated to the Bundle resource. - """ - return self._properties["regulation_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def status(self) -> "BundleInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def valid_until(self) -> datetime: - """ - :returns: The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. - """ - return self._properties["valid_until"] - - @property - def email(self) -> str: - """ - :returns: The email address that will receive updates when the Bundle resource changes status. - """ - return self._properties["email"] - - @property - def status_callback(self) -> str: - """ - :returns: The URL we call to inform your application of status changes. - """ - return self._properties["status_callback"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Bundle resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of the Assigned Items of the Bundle resource. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the BundleInstance diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.py index df46a48bf..0c3410a61 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -32,99 +32,43 @@ class Status(object): TWILIO_APPROVED = "twilio-approved" PROVISIONALLY_APPROVED = "provisionally-approved" - def __init__(self, version, payload, bundle_sid: str): - """ - Initialize the BundleCopyInstance - """ + """ + :ivar sid: The unique string that we created to identify the Bundle resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource. + :ivar regulation_sid: The unique string of a regulation that is associated to the Bundle resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar status: + :ivar valid_until: The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. + :ivar email: The email address that will receive updates when the Bundle resource changes status. + :ivar status_callback: The URL we call to inform your application of status changes. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], bundle_sid: str): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "regulation_sid": payload.get("regulation_sid"), - "friendly_name": payload.get("friendly_name"), - "status": payload.get("status"), - "valid_until": deserialize.iso8601_datetime(payload.get("valid_until")), - "email": payload.get("email"), - "status_callback": payload.get("status_callback"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.regulation_sid: Optional[str] = payload.get("regulation_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.status: Optional["BundleCopyInstance.Status"] = payload.get("status") + self.valid_until: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("valid_until") + ) + self.email: Optional[str] = payload.get("email") + self.status_callback: Optional[str] = payload.get("status_callback") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) self._solution = { "bundle_sid": bundle_sid, } - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Bundle resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource. - """ - return self._properties["account_sid"] - - @property - def regulation_sid(self) -> str: - """ - :returns: The unique string of a regulation that is associated to the Bundle resource. - """ - return self._properties["regulation_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def status(self) -> "BundleCopyInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def valid_until(self) -> datetime: - """ - :returns: The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. - """ - return self._properties["valid_until"] - - @property - def email(self) -> str: - """ - :returns: The email address that will receive updates when the Bundle resource changes status. - """ - return self._properties["email"] - - @property - def status_callback(self) -> str: - """ - :returns: The URL we call to inform your application of status changes. - """ - return self._properties["status_callback"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py index 74866f812..680077f7f 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/evaluation.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,26 +28,40 @@ class Status(object): COMPLIANT = "compliant" NONCOMPLIANT = "noncompliant" - def __init__(self, version, payload, bundle_sid: str, sid: Optional[str] = None): - """ - Initialize the EvaluationInstance - """ + """ + :ivar sid: The unique string that identifies the Evaluation resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource. + :ivar regulation_sid: The unique string of a regulation that is associated to the Bundle resource. + :ivar bundle_sid: The unique string that we created to identify the Bundle resource. + :ivar status: + :ivar results: The results of the Evaluation which includes the valid and invalid attributes. + :ivar date_created: + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + bundle_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "regulation_sid": payload.get("regulation_sid"), - "bundle_sid": payload.get("bundle_sid"), - "status": payload.get("status"), - "results": payload.get("results"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.regulation_sid: Optional[str] = payload.get("regulation_sid") + self.bundle_sid: Optional[str] = payload.get("bundle_sid") + self.status: Optional["EvaluationInstance.Status"] = payload.get("status") + self.results: Optional[List[object]] = payload.get("results") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.url: Optional[str] = payload.get("url") self._solution = { "bundle_sid": bundle_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[EvaluationContext] = None @@ -67,62 +81,6 @@ def _proxy(self) -> "EvaluationContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that identifies the Evaluation resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource. - """ - return self._properties["account_sid"] - - @property - def regulation_sid(self) -> str: - """ - :returns: The unique string of a regulation that is associated to the Bundle resource. - """ - return self._properties["regulation_sid"] - - @property - def bundle_sid(self) -> str: - """ - :returns: The unique string that we created to identify the Bundle resource. - """ - return self._properties["bundle_sid"] - - @property - def status(self) -> "EvaluationInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def results(self) -> List[object]: - """ - :returns: The results of the Evaluation which includes the valid and invalid attributes. - """ - return self._properties["results"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def fetch(self) -> "EvaluationInstance": """ Fetch the EvaluationInstance diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.py index 48784d8d2..3debf73a6 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,24 +24,37 @@ class ItemAssignmentInstance(InstanceResource): - def __init__(self, version, payload, bundle_sid: str, sid: Optional[str] = None): - """ - Initialize the ItemAssignmentInstance - """ + + """ + :ivar sid: The unique string that we created to identify the Item Assignment resource. + :ivar bundle_sid: The unique string that we created to identify the Bundle resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource. + :ivar object_sid: The SID of an object bag that holds information of the different items. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the Identity resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + bundle_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "bundle_sid": payload.get("bundle_sid"), - "account_sid": payload.get("account_sid"), - "object_sid": payload.get("object_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.bundle_sid: Optional[str] = payload.get("bundle_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.object_sid: Optional[str] = payload.get("object_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.url: Optional[str] = payload.get("url") self._solution = { "bundle_sid": bundle_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ItemAssignmentContext] = None @@ -61,48 +74,6 @@ def _proxy(self) -> "ItemAssignmentContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Item Assignment resource. - """ - return self._properties["sid"] - - @property - def bundle_sid(self) -> str: - """ - :returns: The unique string that we created to identify the Bundle resource. - """ - return self._properties["bundle_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource. - """ - return self._properties["account_sid"] - - @property - def object_sid(self) -> str: - """ - :returns: The SID of an object bag that holds information of the different items. - """ - return self._properties["object_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Identity resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the ItemAssignmentInstance diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/replace_items.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/replace_items.py index 9fbdae183..756ff268f 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/replace_items.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/replace_items.py @@ -14,6 +14,7 @@ from datetime import datetime +from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -30,99 +31,43 @@ class Status(object): TWILIO_APPROVED = "twilio-approved" PROVISIONALLY_APPROVED = "provisionally-approved" - def __init__(self, version, payload, bundle_sid: str): - """ - Initialize the ReplaceItemsInstance - """ + """ + :ivar sid: The unique string that we created to identify the Bundle resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource. + :ivar regulation_sid: The unique string of a regulation that is associated to the Bundle resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar status: + :ivar valid_until: The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. + :ivar email: The email address that will receive updates when the Bundle resource changes status. + :ivar status_callback: The URL we call to inform your application of status changes. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], bundle_sid: str): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "regulation_sid": payload.get("regulation_sid"), - "friendly_name": payload.get("friendly_name"), - "status": payload.get("status"), - "valid_until": deserialize.iso8601_datetime(payload.get("valid_until")), - "email": payload.get("email"), - "status_callback": payload.get("status_callback"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.regulation_sid: Optional[str] = payload.get("regulation_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.status: Optional["ReplaceItemsInstance.Status"] = payload.get("status") + self.valid_until: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("valid_until") + ) + self.email: Optional[str] = payload.get("email") + self.status_callback: Optional[str] = payload.get("status_callback") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) self._solution = { "bundle_sid": bundle_sid, } - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Bundle resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Bundle resource. - """ - return self._properties["account_sid"] - - @property - def regulation_sid(self) -> str: - """ - :returns: The unique string of a regulation that is associated to the Bundle resource. - """ - return self._properties["regulation_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def status(self) -> "ReplaceItemsInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def valid_until(self) -> datetime: - """ - :returns: The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. - """ - return self._properties["valid_until"] - - @property - def email(self) -> str: - """ - :returns: The email address that will receive updates when the Bundle resource changes status. - """ - return self._properties["email"] - - @property - def status_callback(self) -> str: - """ - :returns: The URL we call to inform your application of status changes. - """ - return self._properties["status_callback"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v2/regulatory_compliance/end_user.py b/twilio/rest/numbers/v2/regulatory_compliance/end_user.py index 9431d5fb4..384a49457 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/end_user.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/end_user.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,25 +28,37 @@ class Type(object): INDIVIDUAL = "individual" BUSINESS = "business" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the EndUserInstance - """ + """ + :ivar sid: The unique string created by Twilio to identify the End User resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the End User resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar type: + :ivar attributes: The set of parameters that are the attributes of the End Users resource which are listed in the End User Types. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the End User resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "type": payload.get("type"), - "attributes": payload.get("attributes"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.type: Optional["EndUserInstance.Type"] = payload.get("type") + self.attributes: Optional[Dict[str, object]] = payload.get("attributes") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[EndUserContext] = None @@ -65,62 +77,6 @@ def _proxy(self) -> "EndUserContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string created by Twilio to identify the End User resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the End User resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def type(self) -> "EndUserInstance.Type": - """ - :returns: - """ - return self._properties["type"] - - @property - def attributes(self) -> Dict[str, object]: - """ - :returns: The set of parameters that are the attributes of the End Users resource which are listed in the End User Types. - """ - return self._properties["attributes"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the End User resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the EndUserInstance diff --git a/twilio/rest/numbers/v2/regulatory_compliance/end_user_type.py b/twilio/rest/numbers/v2/regulatory_compliance/end_user_type.py index c308c63af..0968b72ad 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/end_user_type.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/end_user_type.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,22 +23,28 @@ class EndUserTypeInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the EndUserTypeInstance - """ + + """ + :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._properties = { - "sid": payload.get("sid"), - "friendly_name": payload.get("friendly_name"), - "machine_name": payload.get("machine_name"), - "fields": payload.get("fields"), - "url": payload.get("url"), - } + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[EndUserTypeContext] = None @@ -57,41 +63,6 @@ def _proxy(self) -> "EndUserTypeContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that identifies the End-User Type resource. - """ - return self._properties["sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: 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 - """ - return self._properties["friendly_name"] - - @property - def machine_name(self) -> str: - """ - :returns: A machine-readable description of the End-User Type resource. Examples can include first_name, last_name, email, business_name, etc. - """ - return self._properties["machine_name"] - - @property - def fields(self) -> List[object]: - """ - :returns: The required information for creating an End-User. The required fields will change as regulatory needs change and will differ for businesses and individuals. - """ - return self._properties["fields"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the End-User Type resource. - """ - return self._properties["url"] - def fetch(self) -> "EndUserTypeInstance": """ Fetch the EndUserTypeInstance diff --git a/twilio/rest/numbers/v2/regulatory_compliance/regulation.py b/twilio/rest/numbers/v2/regulatory_compliance/regulation.py index aa50d80d9..9d6119478 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/regulation.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/regulation.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,24 +27,33 @@ class EndUserType(object): INDIVIDUAL = "individual" BUSINESS = "business" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the RegulationInstance - """ + """ + :ivar sid: The unique string that identifies the Regulation resource. + :ivar friendly_name: A human-readable description that is assigned to describe the Regulation resource. Examples can include Germany: Mobile - Business. + :ivar iso_country: The ISO country code of the phone number's country. + :ivar number_type: The type of phone number restricted by the regulatory requirement. For example, Germany mobile phone numbers provisioned by businesses require a business name with commercial register proof from the Handelsregisterauszug and a proof of address from Handelsregisterauszug or a trade license by Gewerbeanmeldung. + :ivar end_user_type: + :ivar requirements: The SID of an object that holds the regulatory information of the phone number country, phone number type, and end user type. + :ivar url: The absolute URL of the Regulation resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "friendly_name": payload.get("friendly_name"), - "iso_country": payload.get("iso_country"), - "number_type": payload.get("number_type"), - "end_user_type": payload.get("end_user_type"), - "requirements": payload.get("requirements"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.iso_country: Optional[str] = payload.get("iso_country") + self.number_type: Optional[str] = payload.get("number_type") + self.end_user_type: Optional["RegulationInstance.EndUserType"] = payload.get( + "end_user_type" + ) + self.requirements: Optional[Dict[str, object]] = payload.get("requirements") + self.url: Optional[str] = payload.get("url") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[RegulationContext] = None @@ -63,55 +72,6 @@ def _proxy(self) -> "RegulationContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that identifies the Regulation resource. - """ - return self._properties["sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: A human-readable description that is assigned to describe the Regulation resource. Examples can include Germany: Mobile - Business. - """ - return self._properties["friendly_name"] - - @property - def iso_country(self) -> str: - """ - :returns: The ISO country code of the phone number's country. - """ - return self._properties["iso_country"] - - @property - def number_type(self) -> str: - """ - :returns: The type of phone number restricted by the regulatory requirement. For example, Germany mobile phone numbers provisioned by businesses require a business name with commercial register proof from the Handelsregisterauszug and a proof of address from Handelsregisterauszug or a trade license by Gewerbeanmeldung. - """ - return self._properties["number_type"] - - @property - def end_user_type(self) -> "RegulationInstance.EndUserType": - """ - :returns: - """ - return self._properties["end_user_type"] - - @property - def requirements(self) -> Dict[str, object]: - """ - :returns: The SID of an object that holds the regulatory information of the phone number country, phone number type, and end user type. - """ - return self._properties["requirements"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Regulation resource. - """ - return self._properties["url"] - def fetch(self) -> "RegulationInstance": """ Fetch the RegulationInstance diff --git a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py index a9c59d365..0e616159d 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -32,28 +32,45 @@ class Status(object): EXPIRED = "expired" PROVISIONALLY_APPROVED = "provisionally-approved" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the SupportingDocumentInstance - """ + """ + :ivar sid: The unique string created by Twilio to identify the Supporting Document resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Document resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar mime_type: The image type uploaded in the Supporting Document container. + :ivar status: + :ivar failure_reason: The failure reason of the Supporting Document Resource. + :ivar type: The type of the Supporting Document. + :ivar attributes: The set of parameters that are the attributes of the Supporting Documents resource which are listed in the Supporting Document Types. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the Supporting Document resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "mime_type": payload.get("mime_type"), - "status": payload.get("status"), - "failure_reason": payload.get("failure_reason"), - "type": payload.get("type"), - "attributes": payload.get("attributes"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.mime_type: Optional[str] = payload.get("mime_type") + self.status: Optional["SupportingDocumentInstance.Status"] = payload.get( + "status" + ) + self.failure_reason: Optional[str] = payload.get("failure_reason") + self.type: Optional[str] = payload.get("type") + self.attributes: Optional[Dict[str, object]] = payload.get("attributes") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[SupportingDocumentContext] = None @@ -72,83 +89,6 @@ def _proxy(self) -> "SupportingDocumentContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string created by Twilio to identify the Supporting Document resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Document resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def mime_type(self) -> str: - """ - :returns: The image type uploaded in the Supporting Document container. - """ - return self._properties["mime_type"] - - @property - def status(self) -> "SupportingDocumentInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def failure_reason(self) -> str: - """ - :returns: The failure reason of the Supporting Document Resource. - """ - return self._properties["failure_reason"] - - @property - def type(self) -> str: - """ - :returns: The type of the Supporting Document. - """ - return self._properties["type"] - - @property - def attributes(self) -> Dict[str, object]: - """ - :returns: The set of parameters that are the attributes of the Supporting Documents resource which are listed in the Supporting Document Types. - """ - return self._properties["attributes"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Supporting Document resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the SupportingDocumentInstance diff --git a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document_type.py b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document_type.py index 30f1699ab..fd5fc612f 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/supporting_document_type.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/supporting_document_type.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,22 +23,28 @@ class SupportingDocumentTypeInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the SupportingDocumentTypeInstance - """ + + """ + :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._properties = { - "sid": payload.get("sid"), - "friendly_name": payload.get("friendly_name"), - "machine_name": payload.get("machine_name"), - "fields": payload.get("fields"), - "url": payload.get("url"), - } + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[SupportingDocumentTypeContext] = None @@ -57,41 +63,6 @@ def _proxy(self) -> "SupportingDocumentTypeContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that identifies the Supporting Document Type resource. - """ - return self._properties["sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: A human-readable description of the Supporting Document Type resource. - """ - return self._properties["friendly_name"] - - @property - def machine_name(self) -> str: - """ - :returns: The machine-readable description of the Supporting Document Type resource. - """ - return self._properties["machine_name"] - - @property - def fields(self) -> List[object]: - """ - :returns: The required information for creating a Supporting Document. The required fields will change as regulatory needs change and will differ for businesses and individuals. - """ - return self._properties["fields"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Supporting Document Type resource. - """ - return self._properties["url"] - def fetch(self) -> "SupportingDocumentTypeInstance": """ Fetch the SupportingDocumentTypeInstance diff --git a/twilio/rest/oauth/v1/device_code.py b/twilio/rest/oauth/v1/device_code.py index 3174928fb..dcf706fef 100644 --- a/twilio/rest/oauth/v1/device_code.py +++ b/twilio/rest/oauth/v1/device_code.py @@ -13,6 +13,7 @@ """ +from typing import Any, Dict, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource @@ -21,64 +22,29 @@ class DeviceCodeInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the DeviceCodeInstance - """ - super().__init__(version) - - self._properties = { - "device_code": payload.get("device_code"), - "user_code": payload.get("user_code"), - "verification_uri": payload.get("verification_uri"), - "verification_uri_complete": payload.get("verification_uri_complete"), - "expires_in": payload.get("expires_in"), - "interval": deserialize.integer(payload.get("interval")), - } - - self._solution = {} - @property - def device_code(self) -> str: - """ - :returns: The device verification code. - """ - return self._properties["device_code"] - - @property - def user_code(self) -> str: - """ - :returns: The verification code which end user uses to verify authorization request. - """ - return self._properties["user_code"] + """ + :ivar device_code: The device verification code. + :ivar user_code: The verification code which end user uses to verify authorization request. + :ivar verification_uri: The URI that the end user visits to verify authorization request. + :ivar verification_uri_complete: The URI with user_code that the end-user alternatively visits to verify authorization request. + :ivar expires_in: The expiration time of the device_code and user_code in seconds. + :ivar interval: The minimum amount of time in seconds that the client should wait between polling requests to the token endpoint. + """ - @property - def verification_uri(self) -> str: - """ - :returns: The URI that the end user visits to verify authorization request. - """ - return self._properties["verification_uri"] - - @property - def verification_uri_complete(self) -> str: - """ - :returns: The URI with user_code that the end-user alternatively visits to verify authorization request. - """ - return self._properties["verification_uri_complete"] + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) - @property - def expires_in(self) -> int: - """ - :returns: The expiration time of the device_code and user_code in seconds. - """ - return self._properties["expires_in"] + self.device_code: Optional[str] = payload.get("device_code") + self.user_code: Optional[str] = payload.get("user_code") + self.verification_uri: Optional[str] = payload.get("verification_uri") + self.verification_uri_complete: Optional[str] = payload.get( + "verification_uri_complete" + ) + self.expires_in: Optional[int] = payload.get("expires_in") + self.interval: Optional[int] = deserialize.integer(payload.get("interval")) - @property - def interval(self) -> int: - """ - :returns: The minimum amount of time in seconds that the client should wait between polling requests to the token endpoint. - """ - return self._properties["interval"] + self._solution = {} def __repr__(self) -> str: """ diff --git a/twilio/rest/oauth/v1/oauth.py b/twilio/rest/oauth/v1/oauth.py index 7ec23fb32..bb9945d3d 100644 --- a/twilio/rest/oauth/v1/oauth.py +++ b/twilio/rest/oauth/v1/oauth.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -21,16 +21,17 @@ class OauthInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the OauthInstance - """ + + """ + :ivar keys: A collection of certificates where are signed Twilio-issued tokens. + :ivar url: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "keys": payload.get("keys"), - "url": payload.get("url"), - } + self.keys: Optional[Dict[str, object]] = payload.get("keys") + self.url: Optional[str] = payload.get("url") self._solution = {} self._context: Optional[OauthContext] = None @@ -49,20 +50,6 @@ def _proxy(self) -> "OauthContext": ) return self._context - @property - def keys(self) -> Dict[str, object]: - """ - :returns: A collection of certificates where are signed Twilio-issued tokens. - """ - return self._properties["keys"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def fetch(self) -> "OauthInstance": """ Fetch the OauthInstance diff --git a/twilio/rest/oauth/v1/openid_discovery.py b/twilio/rest/oauth/v1/openid_discovery.py index 409d9fd2d..c05715de4 100644 --- a/twilio/rest/oauth/v1/openid_discovery.py +++ b/twilio/rest/oauth/v1/openid_discovery.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -21,31 +21,49 @@ class OpenidDiscoveryInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the OpenidDiscoveryInstance - """ + + """ + :ivar issuer: The URL of the party that will create the token and sign it with its private key. + :ivar authorization_endpoint: The endpoint that validates all authorization requests. + :ivar device_authorization_endpoint: The endpoint that validates all device code related authorization requests. + :ivar token_endpoint: The URL of the token endpoint. After a client has received an authorization code, that code is presented to the token endpoint and exchanged for an identity token, an access token, and a refresh token. + :ivar userinfo_endpoint: The URL of the user info endpoint, which returns user profile information to a client. Keep in mind that the user info endpoint returns only the information that has been requested. + :ivar revocation_endpoint: The endpoint used to revoke access or refresh tokens issued by the authorization server. + :ivar jwk_uri: The URL of your JSON Web Key Set. This set is a collection of JSON Web Keys, a standard method for representing cryptographic keys in a JSON structure. + :ivar response_type_supported: A collection of response type supported by authorization server. + :ivar subject_type_supported: A collection of subject by authorization server. + :ivar id_token_signing_alg_values_supported: A collection of JWS signing algorithms supported by authorization server to sign identity token. + :ivar scopes_supported: A collection of scopes supported by authorization server for identity token + :ivar claims_supported: A collection of claims supported by authorization server for identity token + :ivar url: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "issuer": payload.get("issuer"), - "authorization_endpoint": payload.get("authorization_endpoint"), - "device_authorization_endpoint": payload.get( - "device_authorization_endpoint" - ), - "token_endpoint": payload.get("token_endpoint"), - "userinfo_endpoint": payload.get("userinfo_endpoint"), - "revocation_endpoint": payload.get("revocation_endpoint"), - "jwk_uri": payload.get("jwk_uri"), - "response_type_supported": payload.get("response_type_supported"), - "subject_type_supported": payload.get("subject_type_supported"), - "id_token_signing_alg_values_supported": payload.get( - "id_token_signing_alg_values_supported" - ), - "scopes_supported": payload.get("scopes_supported"), - "claims_supported": payload.get("claims_supported"), - "url": payload.get("url"), - } + self.issuer: Optional[str] = payload.get("issuer") + self.authorization_endpoint: Optional[str] = payload.get( + "authorization_endpoint" + ) + self.device_authorization_endpoint: Optional[str] = payload.get( + "device_authorization_endpoint" + ) + self.token_endpoint: Optional[str] = payload.get("token_endpoint") + self.userinfo_endpoint: Optional[str] = payload.get("userinfo_endpoint") + self.revocation_endpoint: Optional[str] = payload.get("revocation_endpoint") + self.jwk_uri: Optional[str] = payload.get("jwk_uri") + self.response_type_supported: Optional[List[str]] = payload.get( + "response_type_supported" + ) + self.subject_type_supported: Optional[List[str]] = payload.get( + "subject_type_supported" + ) + self.id_token_signing_alg_values_supported: Optional[List[str]] = payload.get( + "id_token_signing_alg_values_supported" + ) + self.scopes_supported: Optional[List[str]] = payload.get("scopes_supported") + self.claims_supported: Optional[List[str]] = payload.get("claims_supported") + self.url: Optional[str] = payload.get("url") self._solution = {} self._context: Optional[OpenidDiscoveryContext] = None @@ -64,97 +82,6 @@ def _proxy(self) -> "OpenidDiscoveryContext": ) return self._context - @property - def issuer(self) -> str: - """ - :returns: The URL of the party that will create the token and sign it with its private key. - """ - return self._properties["issuer"] - - @property - def authorization_endpoint(self) -> str: - """ - :returns: The endpoint that validates all authorization requests. - """ - return self._properties["authorization_endpoint"] - - @property - def device_authorization_endpoint(self) -> str: - """ - :returns: The endpoint that validates all device code related authorization requests. - """ - return self._properties["device_authorization_endpoint"] - - @property - def token_endpoint(self) -> str: - """ - :returns: The URL of the token endpoint. After a client has received an authorization code, that code is presented to the token endpoint and exchanged for an identity token, an access token, and a refresh token. - """ - return self._properties["token_endpoint"] - - @property - def userinfo_endpoint(self) -> str: - """ - :returns: The URL of the user info endpoint, which returns user profile information to a client. Keep in mind that the user info endpoint returns only the information that has been requested. - """ - return self._properties["userinfo_endpoint"] - - @property - def revocation_endpoint(self) -> str: - """ - :returns: The endpoint used to revoke access or refresh tokens issued by the authorization server. - """ - return self._properties["revocation_endpoint"] - - @property - def jwk_uri(self) -> str: - """ - :returns: The URL of your JSON Web Key Set. This set is a collection of JSON Web Keys, a standard method for representing cryptographic keys in a JSON structure. - """ - return self._properties["jwk_uri"] - - @property - def response_type_supported(self) -> List[str]: - """ - :returns: A collection of response type supported by authorization server. - """ - return self._properties["response_type_supported"] - - @property - def subject_type_supported(self) -> List[str]: - """ - :returns: A collection of subject by authorization server. - """ - return self._properties["subject_type_supported"] - - @property - def id_token_signing_alg_values_supported(self) -> List[str]: - """ - :returns: A collection of JWS signing algorithms supported by authorization server to sign identity token. - """ - return self._properties["id_token_signing_alg_values_supported"] - - @property - def scopes_supported(self) -> List[str]: - """ - :returns: A collection of scopes supported by authorization server for identity token - """ - return self._properties["scopes_supported"] - - @property - def claims_supported(self) -> List[str]: - """ - :returns: A collection of claims supported by authorization server for identity token - """ - return self._properties["claims_supported"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def fetch(self) -> "OpenidDiscoveryInstance": """ Fetch the OpenidDiscoveryInstance diff --git a/twilio/rest/oauth/v1/token.py b/twilio/rest/oauth/v1/token.py index ec2c38aa8..5f869b68d 100644 --- a/twilio/rest/oauth/v1/token.py +++ b/twilio/rest/oauth/v1/token.py @@ -14,6 +14,7 @@ from datetime import datetime +from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -22,60 +23,29 @@ class TokenInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the TokenInstance - """ - super().__init__(version) - - self._properties = { - "access_token": payload.get("access_token"), - "refresh_token": payload.get("refresh_token"), - "id_token": payload.get("id_token"), - "refresh_token_expires_at": deserialize.iso8601_datetime( - payload.get("refresh_token_expires_at") - ), - "access_token_expires_at": deserialize.iso8601_datetime( - payload.get("access_token_expires_at") - ), - } - - self._solution = {} - @property - def access_token(self) -> str: - """ - :returns: Token which carries the necessary information to access a Twilio resource directly. - """ - return self._properties["access_token"] - - @property - def refresh_token(self) -> str: - """ - :returns: Token which carries the information necessary to get a new access token. - """ - return self._properties["refresh_token"] + """ + :ivar access_token: Token which carries the necessary information to access a Twilio resource directly. + :ivar refresh_token: Token which carries the information necessary to get a new access token. + :ivar id_token: + :ivar refresh_token_expires_at: The date and time in GMT when the refresh token expires in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar access_token_expires_at: The date and time in GMT when the refresh token expires in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + """ - @property - def id_token(self) -> str: - """ - :returns: - """ - return self._properties["id_token"] + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) - @property - def refresh_token_expires_at(self) -> datetime: - """ - :returns: The date and time in GMT when the refresh token expires in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["refresh_token_expires_at"] + self.access_token: Optional[str] = payload.get("access_token") + self.refresh_token: Optional[str] = payload.get("refresh_token") + self.id_token: Optional[str] = payload.get("id_token") + self.refresh_token_expires_at: Optional[ + datetime + ] = deserialize.iso8601_datetime(payload.get("refresh_token_expires_at")) + self.access_token_expires_at: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("access_token_expires_at") + ) - @property - def access_token_expires_at(self) -> datetime: - """ - :returns: The date and time in GMT when the refresh token expires in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["access_token_expires_at"] + self._solution = {} def __repr__(self) -> str: """ diff --git a/twilio/rest/oauth/v1/user_info.py b/twilio/rest/oauth/v1/user_info.py index af47a9b61..df9b35edd 100644 --- a/twilio/rest/oauth/v1/user_info.py +++ b/twilio/rest/oauth/v1/user_info.py @@ -13,7 +13,7 @@ """ -from typing import Optional +from typing import Any, Dict, Optional from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -21,20 +21,25 @@ class UserInfoInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the UserInfoInstance - """ + + """ + :ivar user_sid: The URL of the party that will create the token and sign it with its private key. + :ivar first_name: The first name of the end-user. + :ivar last_name: The last name of the end-user. + :ivar friendly_name: The friendly name of the end-user. + :ivar email: The end-user's preferred email address. + :ivar url: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "user_sid": payload.get("user_sid"), - "first_name": payload.get("first_name"), - "last_name": payload.get("last_name"), - "friendly_name": payload.get("friendly_name"), - "email": payload.get("email"), - "url": payload.get("url"), - } + self.user_sid: Optional[str] = payload.get("user_sid") + self.first_name: Optional[str] = payload.get("first_name") + self.last_name: Optional[str] = payload.get("last_name") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.email: Optional[str] = payload.get("email") + self.url: Optional[str] = payload.get("url") self._solution = {} self._context: Optional[UserInfoContext] = None @@ -53,48 +58,6 @@ def _proxy(self) -> "UserInfoContext": ) return self._context - @property - def user_sid(self) -> str: - """ - :returns: The URL of the party that will create the token and sign it with its private key. - """ - return self._properties["user_sid"] - - @property - def first_name(self) -> str: - """ - :returns: The first name of the end-user. - """ - return self._properties["first_name"] - - @property - def last_name(self) -> str: - """ - :returns: The last name of the end-user. - """ - return self._properties["last_name"] - - @property - def friendly_name(self) -> str: - """ - :returns: The friendly name of the end-user. - """ - return self._properties["friendly_name"] - - @property - def email(self) -> str: - """ - :returns: The end-user's preferred email address. - """ - return self._properties["email"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def fetch(self) -> "UserInfoInstance": """ Fetch the UserInfoInstance diff --git a/twilio/rest/preview/deployed_devices/fleet/__init__.py b/twilio/rest/preview/deployed_devices/fleet/__init__.py index c5767c556..77622d4b0 100644 --- a/twilio/rest/preview/deployed_devices/fleet/__init__.py +++ b/twilio/rest/preview/deployed_devices/fleet/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,26 +28,42 @@ class FleetInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the FleetInstance - """ + + """ + :ivar sid: Contains a 34 character string that uniquely identifies this Fleet resource. + :ivar url: Contains an absolute URL for this Fleet resource. + :ivar unique_name: Contains a unique and addressable name of this Fleet, e.g. 'default', up to 128 characters long. + :ivar friendly_name: Contains a human readable descriptive text for this Fleet, up to 256 characters long. + :ivar account_sid: Speicifies the unique string identifier of the Account responsible for this Fleet. + :ivar default_deployment_sid: Contains the string identifier of the automatically provisioned default Deployment of this Fleet. + :ivar date_created: Specifies the date this Fleet was created, given in UTC ISO 8601 format. + :ivar date_updated: Specifies the date this Fleet was last updated, given in UTC ISO 8601 format. + :ivar links: Contains a dictionary of URL links to nested resources of this Fleet. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "url": payload.get("url"), - "unique_name": payload.get("unique_name"), - "friendly_name": payload.get("friendly_name"), - "account_sid": payload.get("account_sid"), - "default_deployment_sid": payload.get("default_deployment_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.url: Optional[str] = payload.get("url") + self.unique_name: Optional[str] = payload.get("unique_name") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.account_sid: Optional[str] = payload.get("account_sid") + self.default_deployment_sid: Optional[str] = payload.get( + "default_deployment_sid" + ) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[FleetContext] = None @@ -66,69 +82,6 @@ def _proxy(self) -> "FleetContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: Contains a 34 character string that uniquely identifies this Fleet resource. - """ - return self._properties["sid"] - - @property - def url(self) -> str: - """ - :returns: Contains an absolute URL for this Fleet resource. - """ - return self._properties["url"] - - @property - def unique_name(self) -> str: - """ - :returns: Contains a unique and addressable name of this Fleet, e.g. 'default', up to 128 characters long. - """ - return self._properties["unique_name"] - - @property - def friendly_name(self) -> str: - """ - :returns: Contains a human readable descriptive text for this Fleet, up to 256 characters long. - """ - return self._properties["friendly_name"] - - @property - def account_sid(self) -> str: - """ - :returns: Speicifies the unique string identifier of the Account responsible for this Fleet. - """ - return self._properties["account_sid"] - - @property - def default_deployment_sid(self) -> str: - """ - :returns: Contains the string identifier of the automatically provisioned default Deployment of this Fleet. - """ - return self._properties["default_deployment_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: Specifies the date this Fleet was created, given in UTC ISO 8601 format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: Specifies the date this Fleet was last updated, given in UTC ISO 8601 format. - """ - return self._properties["date_updated"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: Contains a dictionary of URL links to nested resources of this Fleet. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the FleetInstance diff --git a/twilio/rest/preview/deployed_devices/fleet/certificate.py b/twilio/rest/preview/deployed_devices/fleet/certificate.py index 781954090..3796be575 100644 --- a/twilio/rest/preview/deployed_devices/fleet/certificate.py +++ b/twilio/rest/preview/deployed_devices/fleet/certificate.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,27 +24,45 @@ class CertificateInstance(InstanceResource): - def __init__(self, version, payload, fleet_sid: str, sid: Optional[str] = None): - """ - Initialize the CertificateInstance - """ + + """ + :ivar sid: Contains a 34 character string that uniquely identifies this Certificate credential resource. + :ivar url: Contains an absolute URL for this Certificate credential resource. + :ivar friendly_name: Contains a human readable descriptive text for this Certificate credential, up to 256 characters long. + :ivar fleet_sid: Specifies the unique string identifier of the Fleet that the given Certificate credential belongs to. + :ivar account_sid: Specifies the unique string identifier of the Account responsible for this Certificate credential. + :ivar device_sid: Specifies the unique string identifier of a Device authenticated with this Certificate credential. + :ivar thumbprint: Contains a unique hash of the payload of this Certificate credential, used to authenticate the Device. + :ivar date_created: Specifies the date this Certificate credential was created, given in UTC ISO 8601 format. + :ivar date_updated: Specifies the date this Certificate credential was last updated, given in UTC ISO 8601 format. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + fleet_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "url": payload.get("url"), - "friendly_name": payload.get("friendly_name"), - "fleet_sid": payload.get("fleet_sid"), - "account_sid": payload.get("account_sid"), - "device_sid": payload.get("device_sid"), - "thumbprint": payload.get("thumbprint"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - } + self.sid: Optional[str] = payload.get("sid") + self.url: Optional[str] = payload.get("url") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.fleet_sid: Optional[str] = payload.get("fleet_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.device_sid: Optional[str] = payload.get("device_sid") + self.thumbprint: Optional[str] = payload.get("thumbprint") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) self._solution = { "fleet_sid": fleet_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[CertificateContext] = None @@ -64,69 +82,6 @@ def _proxy(self) -> "CertificateContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: Contains a 34 character string that uniquely identifies this Certificate credential resource. - """ - return self._properties["sid"] - - @property - def url(self) -> str: - """ - :returns: Contains an absolute URL for this Certificate credential resource. - """ - return self._properties["url"] - - @property - def friendly_name(self) -> str: - """ - :returns: Contains a human readable descriptive text for this Certificate credential, up to 256 characters long. - """ - return self._properties["friendly_name"] - - @property - def fleet_sid(self) -> str: - """ - :returns: Specifies the unique string identifier of the Fleet that the given Certificate credential belongs to. - """ - return self._properties["fleet_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: Specifies the unique string identifier of the Account responsible for this Certificate credential. - """ - return self._properties["account_sid"] - - @property - def device_sid(self) -> str: - """ - :returns: Specifies the unique string identifier of a Device authenticated with this Certificate credential. - """ - return self._properties["device_sid"] - - @property - def thumbprint(self) -> str: - """ - :returns: Contains a unique hash of the payload of this Certificate credential, used to authenticate the Device. - """ - return self._properties["thumbprint"] - - @property - def date_created(self) -> datetime: - """ - :returns: Specifies the date this Certificate credential was created, given in UTC ISO 8601 format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: Specifies the date this Certificate credential was last updated, given in UTC ISO 8601 format. - """ - return self._properties["date_updated"] - def delete(self) -> bool: """ Deletes the CertificateInstance diff --git a/twilio/rest/preview/deployed_devices/fleet/deployment.py b/twilio/rest/preview/deployed_devices/fleet/deployment.py index 2f77ca481..ebd6b563f 100644 --- a/twilio/rest/preview/deployed_devices/fleet/deployment.py +++ b/twilio/rest/preview/deployed_devices/fleet/deployment.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,26 +24,43 @@ class DeploymentInstance(InstanceResource): - def __init__(self, version, payload, fleet_sid: str, sid: Optional[str] = None): - """ - Initialize the DeploymentInstance - """ + + """ + :ivar sid: Contains a 34 character string that uniquely identifies this Deployment resource. + :ivar url: Contains an absolute URL for this Deployment resource. + :ivar friendly_name: Contains a human readable descriptive text for this Deployment, up to 64 characters long + :ivar fleet_sid: Specifies the unique string identifier of the Fleet that the given Deployment belongs to. + :ivar account_sid: Specifies the unique string identifier of the Account responsible for this Deployment. + :ivar sync_service_sid: Specifies the unique string identifier of the Twilio Sync service instance linked to and accessible by this Deployment. + :ivar date_created: Specifies the date this Deployment was created, given in UTC ISO 8601 format. + :ivar date_updated: Specifies the date this Deployment was last updated, given in UTC ISO 8601 format. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + fleet_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "url": payload.get("url"), - "friendly_name": payload.get("friendly_name"), - "fleet_sid": payload.get("fleet_sid"), - "account_sid": payload.get("account_sid"), - "sync_service_sid": payload.get("sync_service_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - } + self.sid: Optional[str] = payload.get("sid") + self.url: Optional[str] = payload.get("url") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.fleet_sid: Optional[str] = payload.get("fleet_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.sync_service_sid: Optional[str] = payload.get("sync_service_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) self._solution = { "fleet_sid": fleet_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[DeploymentContext] = None @@ -63,62 +80,6 @@ def _proxy(self) -> "DeploymentContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: Contains a 34 character string that uniquely identifies this Deployment resource. - """ - return self._properties["sid"] - - @property - def url(self) -> str: - """ - :returns: Contains an absolute URL for this Deployment resource. - """ - return self._properties["url"] - - @property - def friendly_name(self) -> str: - """ - :returns: Contains a human readable descriptive text for this Deployment, up to 64 characters long - """ - return self._properties["friendly_name"] - - @property - def fleet_sid(self) -> str: - """ - :returns: Specifies the unique string identifier of the Fleet that the given Deployment belongs to. - """ - return self._properties["fleet_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: Specifies the unique string identifier of the Account responsible for this Deployment. - """ - return self._properties["account_sid"] - - @property - def sync_service_sid(self) -> str: - """ - :returns: Specifies the unique string identifier of the Twilio Sync service instance linked to and accessible by this Deployment. - """ - return self._properties["sync_service_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: Specifies the date this Deployment was created, given in UTC ISO 8601 format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: Specifies the date this Deployment was last updated, given in UTC ISO 8601 format. - """ - return self._properties["date_updated"] - def delete(self) -> bool: """ Deletes the DeploymentInstance diff --git a/twilio/rest/preview/deployed_devices/fleet/device.py b/twilio/rest/preview/deployed_devices/fleet/device.py index f63f1f911..c33d0c359 100644 --- a/twilio/rest/preview/deployed_devices/fleet/device.py +++ b/twilio/rest/preview/deployed_devices/fleet/device.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,32 +24,53 @@ class DeviceInstance(InstanceResource): - def __init__(self, version, payload, fleet_sid: str, sid: Optional[str] = None): - """ - Initialize the DeviceInstance - """ + + """ + :ivar sid: Contains a 34 character string that uniquely identifies this Device resource. + :ivar url: Contains an absolute URL for this Device resource. + :ivar unique_name: Contains a unique and addressable name of this Device, assigned by the developer, up to 128 characters long. + :ivar friendly_name: Contains a human readable descriptive text for this Device, up to 256 characters long + :ivar fleet_sid: Specifies the unique string identifier of the Fleet that the given Device belongs to. + :ivar enabled: Contains a boolean flag indicating whether the device is enabled or not, blocks device connectivity if set to false. + :ivar account_sid: Specifies the unique string identifier of the Account responsible for this Device. + :ivar identity: Contains an arbitrary string identifier representing a human user associated with this Device, assigned by the developer, up to 256 characters long. + :ivar deployment_sid: Specifies the unique string identifier of the Deployment group that this Device is associated with. + :ivar date_created: Specifies the date this Device was created, given in UTC ISO 8601 format. + :ivar date_updated: Specifies the date this Device was last updated, given in UTC ISO 8601 format. + :ivar date_authenticated: Specifies the date this Device was last authenticated, given in UTC ISO 8601 format. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + fleet_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "url": payload.get("url"), - "unique_name": payload.get("unique_name"), - "friendly_name": payload.get("friendly_name"), - "fleet_sid": payload.get("fleet_sid"), - "enabled": payload.get("enabled"), - "account_sid": payload.get("account_sid"), - "identity": payload.get("identity"), - "deployment_sid": payload.get("deployment_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "date_authenticated": deserialize.iso8601_datetime( - payload.get("date_authenticated") - ), - } + self.sid: Optional[str] = payload.get("sid") + self.url: Optional[str] = payload.get("url") + self.unique_name: Optional[str] = payload.get("unique_name") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.fleet_sid: Optional[str] = payload.get("fleet_sid") + self.enabled: Optional[bool] = payload.get("enabled") + self.account_sid: Optional[str] = payload.get("account_sid") + self.identity: Optional[str] = payload.get("identity") + self.deployment_sid: Optional[str] = payload.get("deployment_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.date_authenticated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_authenticated") + ) self._solution = { "fleet_sid": fleet_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[DeviceContext] = None @@ -69,90 +90,6 @@ def _proxy(self) -> "DeviceContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: Contains a 34 character string that uniquely identifies this Device resource. - """ - return self._properties["sid"] - - @property - def url(self) -> str: - """ - :returns: Contains an absolute URL for this Device resource. - """ - return self._properties["url"] - - @property - def unique_name(self) -> str: - """ - :returns: Contains a unique and addressable name of this Device, assigned by the developer, up to 128 characters long. - """ - return self._properties["unique_name"] - - @property - def friendly_name(self) -> str: - """ - :returns: Contains a human readable descriptive text for this Device, up to 256 characters long - """ - return self._properties["friendly_name"] - - @property - def fleet_sid(self) -> str: - """ - :returns: Specifies the unique string identifier of the Fleet that the given Device belongs to. - """ - return self._properties["fleet_sid"] - - @property - def enabled(self) -> bool: - """ - :returns: Contains a boolean flag indicating whether the device is enabled or not, blocks device connectivity if set to false. - """ - return self._properties["enabled"] - - @property - def account_sid(self) -> str: - """ - :returns: Specifies the unique string identifier of the Account responsible for this Device. - """ - return self._properties["account_sid"] - - @property - def identity(self) -> str: - """ - :returns: Contains an arbitrary string identifier representing a human user associated with this Device, assigned by the developer, up to 256 characters long. - """ - return self._properties["identity"] - - @property - def deployment_sid(self) -> str: - """ - :returns: Specifies the unique string identifier of the Deployment group that this Device is associated with. - """ - return self._properties["deployment_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: Specifies the date this Device was created, given in UTC ISO 8601 format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: Specifies the date this Device was last updated, given in UTC ISO 8601 format. - """ - return self._properties["date_updated"] - - @property - def date_authenticated(self) -> datetime: - """ - :returns: Specifies the date this Device was last authenticated, given in UTC ISO 8601 format. - """ - return self._properties["date_authenticated"] - def delete(self) -> bool: """ Deletes the DeviceInstance diff --git a/twilio/rest/preview/deployed_devices/fleet/key.py b/twilio/rest/preview/deployed_devices/fleet/key.py index 30eafbca0..3f94f85b1 100644 --- a/twilio/rest/preview/deployed_devices/fleet/key.py +++ b/twilio/rest/preview/deployed_devices/fleet/key.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,27 +24,45 @@ class KeyInstance(InstanceResource): - def __init__(self, version, payload, fleet_sid: str, sid: Optional[str] = None): - """ - Initialize the KeyInstance - """ + + """ + :ivar sid: Contains a 34 character string that uniquely identifies this Key credential resource. + :ivar url: Contains an absolute URL for this Key credential resource. + :ivar friendly_name: Contains a human readable descriptive text for this Key credential, up to 256 characters long. + :ivar fleet_sid: Specifies the unique string identifier of the Fleet that the given Key credential belongs to. + :ivar account_sid: Specifies the unique string identifier of the Account responsible for this Key credential. + :ivar device_sid: Specifies the unique string identifier of a Device authenticated with this Key credential. + :ivar secret: Contains the automatically generated secret belonging to this Key credential, used to authenticate the Device. + :ivar date_created: Specifies the date this Key credential was created, given in UTC ISO 8601 format. + :ivar date_updated: Specifies the date this Key credential was last updated, given in UTC ISO 8601 format. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + fleet_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "url": payload.get("url"), - "friendly_name": payload.get("friendly_name"), - "fleet_sid": payload.get("fleet_sid"), - "account_sid": payload.get("account_sid"), - "device_sid": payload.get("device_sid"), - "secret": payload.get("secret"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - } + self.sid: Optional[str] = payload.get("sid") + self.url: Optional[str] = payload.get("url") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.fleet_sid: Optional[str] = payload.get("fleet_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.device_sid: Optional[str] = payload.get("device_sid") + self.secret: Optional[str] = payload.get("secret") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) self._solution = { "fleet_sid": fleet_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[KeyContext] = None @@ -64,69 +82,6 @@ def _proxy(self) -> "KeyContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: Contains a 34 character string that uniquely identifies this Key credential resource. - """ - return self._properties["sid"] - - @property - def url(self) -> str: - """ - :returns: Contains an absolute URL for this Key credential resource. - """ - return self._properties["url"] - - @property - def friendly_name(self) -> str: - """ - :returns: Contains a human readable descriptive text for this Key credential, up to 256 characters long. - """ - return self._properties["friendly_name"] - - @property - def fleet_sid(self) -> str: - """ - :returns: Specifies the unique string identifier of the Fleet that the given Key credential belongs to. - """ - return self._properties["fleet_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: Specifies the unique string identifier of the Account responsible for this Key credential. - """ - return self._properties["account_sid"] - - @property - def device_sid(self) -> str: - """ - :returns: Specifies the unique string identifier of a Device authenticated with this Key credential. - """ - return self._properties["device_sid"] - - @property - def secret(self) -> str: - """ - :returns: Contains the automatically generated secret belonging to this Key credential, used to authenticate the Device. - """ - return self._properties["secret"] - - @property - def date_created(self) -> datetime: - """ - :returns: Specifies the date this Key credential was created, given in UTC ISO 8601 format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: Specifies the date this Key credential was last updated, given in UTC ISO 8601 format. - """ - return self._properties["date_updated"] - def delete(self) -> bool: """ Deletes the KeyInstance diff --git a/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py b/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py index 7cabe109a..30b5d487a 100644 --- a/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py +++ b/twilio/rest/preview/hosted_numbers/authorization_document/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -34,26 +34,41 @@ class Status(object): CANCELED = "canceled" FAILED = "failed" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the AuthorizationDocumentInstance - """ + """ + :ivar sid: A 34 character string that uniquely identifies this AuthorizationDocument. + :ivar address_sid: A 34 character string that uniquely identifies the Address resource that is associated with this AuthorizationDocument. + :ivar status: + :ivar email: Email that this AuthorizationDocument will be sent to for signing. + :ivar cc_emails: Email recipients who will be informed when an Authorization Document has been sent and signed. + :ivar date_created: The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + :ivar url: + :ivar links: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "address_sid": payload.get("address_sid"), - "status": payload.get("status"), - "email": payload.get("email"), - "cc_emails": payload.get("cc_emails"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.address_sid: Optional[str] = payload.get("address_sid") + self.status: Optional["AuthorizationDocumentInstance.Status"] = payload.get( + "status" + ) + self.email: Optional[str] = payload.get("email") + self.cc_emails: Optional[List[str]] = payload.get("cc_emails") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[AuthorizationDocumentContext] = None @@ -72,69 +87,6 @@ def _proxy(self) -> "AuthorizationDocumentContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this AuthorizationDocument. - """ - return self._properties["sid"] - - @property - def address_sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies the Address resource that is associated with this AuthorizationDocument. - """ - return self._properties["address_sid"] - - @property - def status(self) -> "AuthorizationDocumentInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def email(self) -> str: - """ - :returns: Email that this AuthorizationDocument will be sent to for signing. - """ - return self._properties["email"] - - @property - def cc_emails(self) -> List[str]: - """ - :returns: Email recipients who will be informed when an Authorization Document has been sent and signed. - """ - return self._properties["cc_emails"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - def fetch(self) -> "AuthorizationDocumentInstance": """ Fetch the AuthorizationDocumentInstance diff --git a/twilio/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.py b/twilio/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.py index 90d2e9fa8..643b7dcff 100644 --- a/twilio/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.py +++ b/twilio/rest/preview/hosted_numbers/authorization_document/dependent_hosted_number_order.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -39,199 +39,79 @@ class VerificationType(object): PHONE_CALL = "phone-call" PHONE_BILL = "phone-bill" - def __init__(self, version, payload, signing_document_sid: str): - """ - Initialize the DependentHostedNumberOrderInstance - """ + """ + :ivar sid: A 34 character string that uniquely identifies this Authorization Document + :ivar account_sid: The unique SID identifier of the Account. + :ivar incoming_phone_number_sid: A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. + :ivar address_sid: A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number. + :ivar signing_document_sid: A 34 character string that uniquely identifies the LOA document associated with this HostedNumberOrder. + :ivar phone_number: An E164 formatted phone number hosted by this HostedNumberOrder. + :ivar capabilities: + :ivar friendly_name: A human readable description of this resource, up to 64 characters. + :ivar unique_name: Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. + :ivar status: + :ivar failure_reason: A message that explains why a hosted_number_order went to status \"action-required\" + :ivar date_created: The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + :ivar verification_attempts: The number of attempts made to verify ownership of the phone number that is being hosted. + :ivar email: Email of the owner of this phone number that is being hosted. + :ivar cc_emails: Email recipients who will be informed when an Authorization Document has been sent and signed + :ivar verification_type: + :ivar verification_document_sid: A 34 character string that uniquely identifies the Identity Document resource that represents the document for verifying ownership of the number to be hosted. + :ivar extension: A numerical extension to be used when making the ownership verification call. + :ivar call_delay: A value between 0-30 specifying the number of seconds to delay initiating the ownership verification call. + :ivar verification_code: The digits passed during the ownership verification call. + :ivar verification_call_sids: A list of 34 character strings that are unique identifiers for the calls placed as part of ownership verification. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], signing_document_sid: str + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "incoming_phone_number_sid": payload.get("incoming_phone_number_sid"), - "address_sid": payload.get("address_sid"), - "signing_document_sid": payload.get("signing_document_sid"), - "phone_number": payload.get("phone_number"), - "capabilities": payload.get("capabilities"), - "friendly_name": payload.get("friendly_name"), - "unique_name": payload.get("unique_name"), - "status": payload.get("status"), - "failure_reason": payload.get("failure_reason"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "verification_attempts": deserialize.integer( - payload.get("verification_attempts") - ), - "email": payload.get("email"), - "cc_emails": payload.get("cc_emails"), - "verification_type": payload.get("verification_type"), - "verification_document_sid": payload.get("verification_document_sid"), - "extension": payload.get("extension"), - "call_delay": deserialize.integer(payload.get("call_delay")), - "verification_code": payload.get("verification_code"), - "verification_call_sids": payload.get("verification_call_sids"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.incoming_phone_number_sid: Optional[str] = payload.get( + "incoming_phone_number_sid" + ) + self.address_sid: Optional[str] = payload.get("address_sid") + self.signing_document_sid: Optional[str] = payload.get("signing_document_sid") + self.phone_number: Optional[str] = payload.get("phone_number") + self.capabilities: Optional[str] = payload.get("capabilities") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.unique_name: Optional[str] = payload.get("unique_name") + self.status: Optional[ + "DependentHostedNumberOrderInstance.Status" + ] = payload.get("status") + self.failure_reason: Optional[str] = payload.get("failure_reason") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.verification_attempts: Optional[int] = deserialize.integer( + payload.get("verification_attempts") + ) + self.email: Optional[str] = payload.get("email") + self.cc_emails: Optional[List[str]] = payload.get("cc_emails") + self.verification_type: Optional[ + "DependentHostedNumberOrderInstance.VerificationType" + ] = payload.get("verification_type") + self.verification_document_sid: Optional[str] = payload.get( + "verification_document_sid" + ) + self.extension: Optional[str] = payload.get("extension") + self.call_delay: Optional[int] = deserialize.integer(payload.get("call_delay")) + self.verification_code: Optional[str] = payload.get("verification_code") + self.verification_call_sids: Optional[List[str]] = payload.get( + "verification_call_sids" + ) self._solution = { "signing_document_sid": signing_document_sid, } - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this Authorization Document - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The unique SID identifier of the Account. - """ - return self._properties["account_sid"] - - @property - def incoming_phone_number_sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies the IncomingPhoneNumber resource created by this HostedNumberOrder. - """ - return self._properties["incoming_phone_number_sid"] - - @property - def address_sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number. - """ - return self._properties["address_sid"] - - @property - def signing_document_sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies the LOA document associated with this HostedNumberOrder. - """ - return self._properties["signing_document_sid"] - - @property - def phone_number(self) -> str: - """ - :returns: An E164 formatted phone number hosted by this HostedNumberOrder. - """ - return self._properties["phone_number"] - - @property - def capabilities(self) -> str: - """ - :returns: - """ - return self._properties["capabilities"] - - @property - def friendly_name(self) -> str: - """ - :returns: A human readable description of this resource, up to 64 characters. - """ - return self._properties["friendly_name"] - - @property - def unique_name(self) -> str: - """ - :returns: Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. - """ - return self._properties["unique_name"] - - @property - def status(self) -> "DependentHostedNumberOrderInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def failure_reason(self) -> str: - """ - :returns: A message that explains why a hosted_number_order went to status \"action-required\" - """ - return self._properties["failure_reason"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def verification_attempts(self) -> int: - """ - :returns: The number of attempts made to verify ownership of the phone number that is being hosted. - """ - return self._properties["verification_attempts"] - - @property - def email(self) -> str: - """ - :returns: Email of the owner of this phone number that is being hosted. - """ - return self._properties["email"] - - @property - def cc_emails(self) -> List[str]: - """ - :returns: Email recipients who will be informed when an Authorization Document has been sent and signed - """ - return self._properties["cc_emails"] - - @property - def verification_type( - self, - ) -> "DependentHostedNumberOrderInstance.VerificationType": - """ - :returns: - """ - return self._properties["verification_type"] - - @property - def verification_document_sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies the Identity Document resource that represents the document for verifying ownership of the number to be hosted. - """ - return self._properties["verification_document_sid"] - - @property - def extension(self) -> str: - """ - :returns: A numerical extension to be used when making the ownership verification call. - """ - return self._properties["extension"] - - @property - def call_delay(self) -> int: - """ - :returns: A value between 0-30 specifying the number of seconds to delay initiating the ownership verification call. - """ - return self._properties["call_delay"] - - @property - def verification_code(self) -> str: - """ - :returns: The digits passed during the ownership verification call. - """ - return self._properties["verification_code"] - - @property - def verification_call_sids(self) -> List[str]: - """ - :returns: A list of 34 character strings that are unique identifiers for the calls placed as part of ownership verification. - """ - return self._properties["verification_call_sids"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/preview/hosted_numbers/hosted_number_order.py b/twilio/rest/preview/hosted_numbers/hosted_number_order.py index 25bc3a5fb..fd2224f08 100644 --- a/twilio/rest/preview/hosted_numbers/hosted_number_order.py +++ b/twilio/rest/preview/hosted_numbers/hosted_number_order.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -39,42 +39,79 @@ class VerificationType(object): PHONE_CALL = "phone-call" PHONE_BILL = "phone-bill" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the HostedNumberOrderInstance - """ + """ + :ivar sid: A 34 character string that uniquely identifies this HostedNumberOrder. + :ivar account_sid: A 34 character string that uniquely identifies the account. + :ivar incoming_phone_number_sid: A 34 character string that uniquely identifies the [IncomingPhoneNumber](https://www.twilio.com/docs/api/rest/incoming-phone-numbers) resource that represents the phone number being hosted. + :ivar address_sid: A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number. + :ivar signing_document_sid: A 34 character string that uniquely identifies the [Authorization Document](https://www.twilio.com/docs/api/phone-numbers/hosted-number-authorization-documents) the user needs to sign. + :ivar phone_number: Phone number to be hosted. This must be in [E.164](https://en.wikipedia.org/wiki/E.164) format, e.g., +16175551212 + :ivar capabilities: + :ivar friendly_name: A 64 character string that is a human-readable text that describes this resource. + :ivar unique_name: Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. + :ivar status: + :ivar failure_reason: A message that explains why a hosted_number_order went to status \"action-required\" + :ivar date_created: The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. + :ivar verification_attempts: The number of attempts made to verify ownership of the phone number that is being hosted. + :ivar email: Email of the owner of this phone number that is being hosted. + :ivar cc_emails: A list of emails that LOA document for this HostedNumberOrder will be carbon copied to. + :ivar url: The URL of this HostedNumberOrder. + :ivar verification_type: + :ivar verification_document_sid: A 34 character string that uniquely identifies the Identity Document resource that represents the document for verifying ownership of the number to be hosted. + :ivar extension: A numerical extension to be used when making the ownership verification call. + :ivar call_delay: A value between 0-30 specifying the number of seconds to delay initiating the ownership verification call. + :ivar verification_code: A verification code provided in the response for a user to enter when they pick up the phone call. + :ivar verification_call_sids: A list of 34 character strings that are unique identifiers for the calls placed as part of ownership verification. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "incoming_phone_number_sid": payload.get("incoming_phone_number_sid"), - "address_sid": payload.get("address_sid"), - "signing_document_sid": payload.get("signing_document_sid"), - "phone_number": payload.get("phone_number"), - "capabilities": payload.get("capabilities"), - "friendly_name": payload.get("friendly_name"), - "unique_name": payload.get("unique_name"), - "status": payload.get("status"), - "failure_reason": payload.get("failure_reason"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "verification_attempts": deserialize.integer( - payload.get("verification_attempts") - ), - "email": payload.get("email"), - "cc_emails": payload.get("cc_emails"), - "url": payload.get("url"), - "verification_type": payload.get("verification_type"), - "verification_document_sid": payload.get("verification_document_sid"), - "extension": payload.get("extension"), - "call_delay": deserialize.integer(payload.get("call_delay")), - "verification_code": payload.get("verification_code"), - "verification_call_sids": payload.get("verification_call_sids"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.incoming_phone_number_sid: Optional[str] = payload.get( + "incoming_phone_number_sid" + ) + self.address_sid: Optional[str] = payload.get("address_sid") + self.signing_document_sid: Optional[str] = payload.get("signing_document_sid") + self.phone_number: Optional[str] = payload.get("phone_number") + self.capabilities: Optional[str] = payload.get("capabilities") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.unique_name: Optional[str] = payload.get("unique_name") + self.status: Optional["HostedNumberOrderInstance.Status"] = payload.get( + "status" + ) + self.failure_reason: Optional[str] = payload.get("failure_reason") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.verification_attempts: Optional[int] = deserialize.integer( + payload.get("verification_attempts") + ) + self.email: Optional[str] = payload.get("email") + self.cc_emails: Optional[List[str]] = payload.get("cc_emails") + self.url: Optional[str] = payload.get("url") + self.verification_type: Optional[ + "HostedNumberOrderInstance.VerificationType" + ] = payload.get("verification_type") + self.verification_document_sid: Optional[str] = payload.get( + "verification_document_sid" + ) + self.extension: Optional[str] = payload.get("extension") + self.call_delay: Optional[int] = deserialize.integer(payload.get("call_delay")) + self.verification_code: Optional[str] = payload.get("verification_code") + self.verification_call_sids: Optional[List[str]] = payload.get( + "verification_call_sids" + ) self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[HostedNumberOrderContext] = None @@ -93,167 +130,6 @@ def _proxy(self) -> "HostedNumberOrderContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this HostedNumberOrder. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies the account. - """ - return self._properties["account_sid"] - - @property - def incoming_phone_number_sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies the [IncomingPhoneNumber](https://www.twilio.com/docs/api/rest/incoming-phone-numbers) resource that represents the phone number being hosted. - """ - return self._properties["incoming_phone_number_sid"] - - @property - def address_sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies the Address resource that represents the address of the owner of this phone number. - """ - return self._properties["address_sid"] - - @property - def signing_document_sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies the [Authorization Document](https://www.twilio.com/docs/api/phone-numbers/hosted-number-authorization-documents) the user needs to sign. - """ - return self._properties["signing_document_sid"] - - @property - def phone_number(self) -> str: - """ - :returns: Phone number to be hosted. This must be in [E.164](https://en.wikipedia.org/wiki/E.164) format, e.g., +16175551212 - """ - return self._properties["phone_number"] - - @property - def capabilities(self) -> str: - """ - :returns: - """ - return self._properties["capabilities"] - - @property - def friendly_name(self) -> str: - """ - :returns: A 64 character string that is a human-readable text that describes this resource. - """ - return self._properties["friendly_name"] - - @property - def unique_name(self) -> str: - """ - :returns: Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID. - """ - return self._properties["unique_name"] - - @property - def status(self) -> "HostedNumberOrderInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def failure_reason(self) -> str: - """ - :returns: A message that explains why a hosted_number_order went to status \"action-required\" - """ - return self._properties["failure_reason"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date this resource was created, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was updated, given as [GMT RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def verification_attempts(self) -> int: - """ - :returns: The number of attempts made to verify ownership of the phone number that is being hosted. - """ - return self._properties["verification_attempts"] - - @property - def email(self) -> str: - """ - :returns: Email of the owner of this phone number that is being hosted. - """ - return self._properties["email"] - - @property - def cc_emails(self) -> List[str]: - """ - :returns: A list of emails that LOA document for this HostedNumberOrder will be carbon copied to. - """ - return self._properties["cc_emails"] - - @property - def url(self) -> str: - """ - :returns: The URL of this HostedNumberOrder. - """ - return self._properties["url"] - - @property - def verification_type(self) -> "HostedNumberOrderInstance.VerificationType": - """ - :returns: - """ - return self._properties["verification_type"] - - @property - def verification_document_sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies the Identity Document resource that represents the document for verifying ownership of the number to be hosted. - """ - return self._properties["verification_document_sid"] - - @property - def extension(self) -> str: - """ - :returns: A numerical extension to be used when making the ownership verification call. - """ - return self._properties["extension"] - - @property - def call_delay(self) -> int: - """ - :returns: A value between 0-30 specifying the number of seconds to delay initiating the ownership verification call. - """ - return self._properties["call_delay"] - - @property - def verification_code(self) -> str: - """ - :returns: A verification code provided in the response for a user to enter when they pick up the phone call. - """ - return self._properties["verification_code"] - - @property - def verification_call_sids(self) -> List[str]: - """ - :returns: A list of 34 character strings that are unique identifiers for the calls placed as part of ownership verification. - """ - return self._properties["verification_call_sids"] - def delete(self) -> bool: """ Deletes the HostedNumberOrderInstance diff --git a/twilio/rest/preview/marketplace/available_add_on/__init__.py b/twilio/rest/preview/marketplace/available_add_on/__init__.py index 3ba08902a..551e41483 100644 --- a/twilio/rest/preview/marketplace/available_add_on/__init__.py +++ b/twilio/rest/preview/marketplace/available_add_on/__init__.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -26,24 +26,34 @@ class AvailableAddOnInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the AvailableAddOnInstance - """ + + """ + :ivar sid: The unique string that we created to identify the AvailableAddOn resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar description: A short description of the Add-on's functionality. + :ivar pricing_type: How customers are charged for using this Add-on. + :ivar configuration_schema: The JSON object with the configuration that must be provided when installing a given Add-on. + :ivar url: The absolute URL of the resource. + :ivar links: The URLs of related resources. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "friendly_name": payload.get("friendly_name"), - "description": payload.get("description"), - "pricing_type": payload.get("pricing_type"), - "configuration_schema": payload.get("configuration_schema"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.description: Optional[str] = payload.get("description") + self.pricing_type: Optional[str] = payload.get("pricing_type") + self.configuration_schema: Optional[Dict[str, object]] = payload.get( + "configuration_schema" + ) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[AvailableAddOnContext] = None @@ -62,55 +72,6 @@ def _proxy(self) -> "AvailableAddOnContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the AvailableAddOn resource. - """ - return self._properties["sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def description(self) -> str: - """ - :returns: A short description of the Add-on's functionality. - """ - return self._properties["description"] - - @property - def pricing_type(self) -> str: - """ - :returns: How customers are charged for using this Add-on. - """ - return self._properties["pricing_type"] - - @property - def configuration_schema(self) -> Dict[str, object]: - """ - :returns: The JSON object with the configuration that must be provided when installing a given Add-on. - """ - return self._properties["configuration_schema"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - def fetch(self) -> "AvailableAddOnInstance": """ Fetch the AvailableAddOnInstance diff --git a/twilio/rest/preview/marketplace/available_add_on/available_add_on_extension.py b/twilio/rest/preview/marketplace/available_add_on/available_add_on_extension.py index e3910ccc0..28b01bd77 100644 --- a/twilio/rest/preview/marketplace/available_add_on/available_add_on_extension.py +++ b/twilio/rest/preview/marketplace/available_add_on/available_add_on_extension.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,26 +23,35 @@ class AvailableAddOnExtensionInstance(InstanceResource): + + """ + :ivar sid: The unique string that we created to identify the AvailableAddOnExtension resource. + :ivar available_add_on_sid: The SID of the AvailableAddOn resource to which this extension applies. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar product_name: The name of the Product this Extension is used within. + :ivar unique_name: An application-defined string that uniquely identifies the resource. + :ivar url: The absolute URL of the resource. + """ + def __init__( - self, version, payload, available_add_on_sid: str, sid: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + available_add_on_sid: str, + sid: Optional[str] = None, ): - """ - Initialize the AvailableAddOnExtensionInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "available_add_on_sid": payload.get("available_add_on_sid"), - "friendly_name": payload.get("friendly_name"), - "product_name": payload.get("product_name"), - "unique_name": payload.get("unique_name"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.available_add_on_sid: Optional[str] = payload.get("available_add_on_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.product_name: Optional[str] = payload.get("product_name") + self.unique_name: Optional[str] = payload.get("unique_name") + self.url: Optional[str] = payload.get("url") self._solution = { "available_add_on_sid": available_add_on_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[AvailableAddOnExtensionContext] = None @@ -62,48 +71,6 @@ def _proxy(self) -> "AvailableAddOnExtensionContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the AvailableAddOnExtension resource. - """ - return self._properties["sid"] - - @property - def available_add_on_sid(self) -> str: - """ - :returns: The SID of the AvailableAddOn resource to which this extension applies. - """ - return self._properties["available_add_on_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def product_name(self) -> str: - """ - :returns: The name of the Product this Extension is used within. - """ - return self._properties["product_name"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. - """ - return self._properties["unique_name"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def fetch(self) -> "AvailableAddOnExtensionInstance": """ Fetch the AvailableAddOnExtensionInstance diff --git a/twilio/rest/preview/marketplace/installed_add_on/__init__.py b/twilio/rest/preview/marketplace/installed_add_on/__init__.py index 8c2306cc8..af187a5ed 100644 --- a/twilio/rest/preview/marketplace/installed_add_on/__init__.py +++ b/twilio/rest/preview/marketplace/installed_add_on/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,27 +27,42 @@ class InstalledAddOnInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the InstalledAddOnInstance - """ + + """ + :ivar sid: The unique string that we created to identify the InstalledAddOn resource. This Sid can also be found in the Console on that specific Add-ons page as the 'Available Add-on Sid'. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the InstalledAddOn resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar description: A short description of the Add-on's functionality. + :ivar configuration: The JSON object that represents the current configuration of installed Add-on. + :ivar unique_name: An application-defined string that uniquely identifies the resource. + :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 resource. + :ivar links: The URLs of related resources. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "description": payload.get("description"), - "configuration": payload.get("configuration"), - "unique_name": payload.get("unique_name"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + 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.description: Optional[str] = payload.get("description") + self.configuration: Optional[Dict[str, object]] = payload.get("configuration") + self.unique_name: Optional[str] = payload.get("unique_name") + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[InstalledAddOnContext] = None @@ -66,76 +81,6 @@ def _proxy(self) -> "InstalledAddOnContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the InstalledAddOn resource. This Sid can also be found in the Console on that specific Add-ons page as the 'Available Add-on Sid'. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the InstalledAddOn resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def description(self) -> str: - """ - :returns: A short description of the Add-on's functionality. - """ - return self._properties["description"] - - @property - def configuration(self) -> Dict[str, object]: - """ - :returns: The JSON object that represents the current configuration of installed Add-on. - """ - return self._properties["configuration"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. - """ - return self._properties["unique_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the InstalledAddOnInstance diff --git a/twilio/rest/preview/marketplace/installed_add_on/installed_add_on_extension.py b/twilio/rest/preview/marketplace/installed_add_on/installed_add_on_extension.py index 8c666e7db..a78fba6a9 100644 --- a/twilio/rest/preview/marketplace/installed_add_on/installed_add_on_extension.py +++ b/twilio/rest/preview/marketplace/installed_add_on/installed_add_on_extension.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,27 +23,37 @@ class InstalledAddOnExtensionInstance(InstanceResource): + + """ + :ivar sid: The unique string that we created to identify the InstalledAddOn Extension resource. + :ivar installed_add_on_sid: The SID of the InstalledAddOn resource to which this extension applies. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar product_name: The name of the Product this Extension is used within. + :ivar unique_name: An application-defined string that uniquely identifies the resource. + :ivar enabled: Whether the Extension will be invoked. + :ivar url: The absolute URL of the resource. + """ + def __init__( - self, version, payload, installed_add_on_sid: str, sid: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + installed_add_on_sid: str, + sid: Optional[str] = None, ): - """ - Initialize the InstalledAddOnExtensionInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "installed_add_on_sid": payload.get("installed_add_on_sid"), - "friendly_name": payload.get("friendly_name"), - "product_name": payload.get("product_name"), - "unique_name": payload.get("unique_name"), - "enabled": payload.get("enabled"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.installed_add_on_sid: Optional[str] = payload.get("installed_add_on_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.product_name: Optional[str] = payload.get("product_name") + self.unique_name: Optional[str] = payload.get("unique_name") + self.enabled: Optional[bool] = payload.get("enabled") + self.url: Optional[str] = payload.get("url") self._solution = { "installed_add_on_sid": installed_add_on_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[InstalledAddOnExtensionContext] = None @@ -63,55 +73,6 @@ def _proxy(self) -> "InstalledAddOnExtensionContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the InstalledAddOn Extension resource. - """ - return self._properties["sid"] - - @property - def installed_add_on_sid(self) -> str: - """ - :returns: The SID of the InstalledAddOn resource to which this extension applies. - """ - return self._properties["installed_add_on_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def product_name(self) -> str: - """ - :returns: The name of the Product this Extension is used within. - """ - return self._properties["product_name"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. - """ - return self._properties["unique_name"] - - @property - def enabled(self) -> bool: - """ - :returns: Whether the Extension will be invoked. - """ - return self._properties["enabled"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def fetch(self) -> "InstalledAddOnExtensionInstance": """ Fetch the InstalledAddOnExtensionInstance diff --git a/twilio/rest/preview/sync/service/__init__.py b/twilio/rest/preview/sync/service/__init__.py index a6e5f7e72..79042b013 100644 --- a/twilio/rest/preview/sync/service/__init__.py +++ b/twilio/rest/preview/sync/service/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,29 +27,44 @@ class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the ServiceInstance - """ + + """ + :ivar sid: + :ivar account_sid: + :ivar friendly_name: + :ivar date_created: + :ivar date_updated: + :ivar url: + :ivar webhook_url: + :ivar reachability_webhooks_enabled: + :ivar acl_enabled: + :ivar links: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "webhook_url": payload.get("webhook_url"), - "reachability_webhooks_enabled": payload.get( - "reachability_webhooks_enabled" - ), - "acl_enabled": payload.get("acl_enabled"), - "links": payload.get("links"), - } + 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.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.webhook_url: Optional[str] = payload.get("webhook_url") + self.reachability_webhooks_enabled: Optional[bool] = payload.get( + "reachability_webhooks_enabled" + ) + self.acl_enabled: Optional[bool] = payload.get("acl_enabled") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ServiceContext] = None @@ -68,76 +83,6 @@ def _proxy(self) -> "ServiceContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: - """ - return self._properties["friendly_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def webhook_url(self) -> str: - """ - :returns: - """ - return self._properties["webhook_url"] - - @property - def reachability_webhooks_enabled(self) -> bool: - """ - :returns: - """ - return self._properties["reachability_webhooks_enabled"] - - @property - def acl_enabled(self) -> bool: - """ - :returns: - """ - return self._properties["acl_enabled"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the ServiceInstance diff --git a/twilio/rest/preview/sync/service/document/__init__.py b/twilio/rest/preview/sync/service/document/__init__.py index 3ca20b54d..b1c55aa3f 100644 --- a/twilio/rest/preview/sync/service/document/__init__.py +++ b/twilio/rest/preview/sync/service/document/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,29 +27,49 @@ class DocumentInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the DocumentInstance - """ + + """ + :ivar sid: + :ivar unique_name: + :ivar account_sid: + :ivar service_sid: + :ivar url: + :ivar links: + :ivar revision: + :ivar data: + :ivar date_created: + :ivar date_updated: + :ivar created_by: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "url": payload.get("url"), - "links": payload.get("links"), - "revision": payload.get("revision"), - "data": payload.get("data"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "created_by": payload.get("created_by"), - } + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.revision: Optional[str] = payload.get("revision") + self.data: Optional[Dict[str, object]] = payload.get("data") + 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.created_by: Optional[str] = payload.get("created_by") self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[DocumentContext] = None @@ -69,83 +89,6 @@ def _proxy(self) -> "DocumentContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: - """ - return self._properties["unique_name"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: - """ - return self._properties["service_sid"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - - @property - def revision(self) -> str: - """ - :returns: - """ - return self._properties["revision"] - - @property - def data(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["data"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def created_by(self) -> str: - """ - :returns: - """ - return self._properties["created_by"] - def delete(self) -> bool: """ Deletes the DocumentInstance diff --git a/twilio/rest/preview/sync/service/document/document_permission.py b/twilio/rest/preview/sync/service/document/document_permission.py index b21894276..270d70a76 100644 --- a/twilio/rest/preview/sync/service/document/document_permission.py +++ b/twilio/rest/preview/sync/service/document/document_permission.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,34 +23,41 @@ class DocumentPermissionInstance(InstanceResource): + + """ + :ivar account_sid: The unique SID identifier of the Twilio Account. + :ivar service_sid: The unique SID identifier of the Sync Service Instance. + :ivar document_sid: The unique SID identifier of the Sync Document to which the Permission applies. + :ivar identity: Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. + :ivar read: Boolean flag specifying whether the identity can read the Sync Document. + :ivar write: Boolean flag specifying whether the identity can update the Sync Document. + :ivar manage: Boolean flag specifying whether the identity can delete the Sync Document. + :ivar url: Contains an absolute URL for this Sync Document Permission. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, document_sid: str, identity: Optional[str] = None, ): - """ - Initialize the DocumentPermissionInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "document_sid": payload.get("document_sid"), - "identity": payload.get("identity"), - "read": payload.get("read"), - "write": payload.get("write"), - "manage": payload.get("manage"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.document_sid: Optional[str] = payload.get("document_sid") + self.identity: Optional[str] = payload.get("identity") + self.read: Optional[bool] = payload.get("read") + self.write: Optional[bool] = payload.get("write") + self.manage: Optional[bool] = payload.get("manage") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, "document_sid": document_sid, - "identity": identity or self._properties["identity"], + "identity": identity or self.identity, } self._context: Optional[DocumentPermissionContext] = None @@ -71,62 +78,6 @@ def _proxy(self) -> "DocumentPermissionContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique SID identifier of the Twilio Account. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The unique SID identifier of the Sync Service Instance. - """ - return self._properties["service_sid"] - - @property - def document_sid(self) -> str: - """ - :returns: The unique SID identifier of the Sync Document to which the Permission applies. - """ - return self._properties["document_sid"] - - @property - def identity(self) -> str: - """ - :returns: Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. - """ - return self._properties["identity"] - - @property - def read(self) -> bool: - """ - :returns: Boolean flag specifying whether the identity can read the Sync Document. - """ - return self._properties["read"] - - @property - def write(self) -> bool: - """ - :returns: Boolean flag specifying whether the identity can update the Sync Document. - """ - return self._properties["write"] - - @property - def manage(self) -> bool: - """ - :returns: Boolean flag specifying whether the identity can delete the Sync Document. - """ - return self._properties["manage"] - - @property - def url(self) -> str: - """ - :returns: Contains an absolute URL for this Sync Document Permission. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the DocumentPermissionInstance diff --git a/twilio/rest/preview/sync/service/sync_list/__init__.py b/twilio/rest/preview/sync/service/sync_list/__init__.py index f84f82214..65db4403b 100644 --- a/twilio/rest/preview/sync/service/sync_list/__init__.py +++ b/twilio/rest/preview/sync/service/sync_list/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,28 +28,47 @@ class SyncListInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the SyncListInstance - """ + + """ + :ivar sid: + :ivar unique_name: + :ivar account_sid: + :ivar service_sid: + :ivar url: + :ivar links: + :ivar revision: + :ivar date_created: + :ivar date_updated: + :ivar created_by: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "url": payload.get("url"), - "links": payload.get("links"), - "revision": payload.get("revision"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "created_by": payload.get("created_by"), - } + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.revision: Optional[str] = payload.get("revision") + 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.created_by: Optional[str] = payload.get("created_by") self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[SyncListContext] = None @@ -69,76 +88,6 @@ def _proxy(self) -> "SyncListContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: - """ - return self._properties["unique_name"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: - """ - return self._properties["service_sid"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - - @property - def revision(self) -> str: - """ - :returns: - """ - return self._properties["revision"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def created_by(self) -> str: - """ - :returns: - """ - return self._properties["created_by"] - def delete(self) -> bool: """ Deletes the SyncListInstance diff --git a/twilio/rest/preview/sync/service/sync_list/sync_list_item.py b/twilio/rest/preview/sync/service/sync_list/sync_list_item.py index cbcd06173..6402faf15 100644 --- a/twilio/rest/preview/sync/service/sync_list/sync_list_item.py +++ b/twilio/rest/preview/sync/service/sync_list/sync_list_item.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -32,36 +32,48 @@ class QueryResultOrder(object): ASC = "asc" DESC = "desc" + """ + :ivar index: + :ivar account_sid: + :ivar service_sid: + :ivar list_sid: + :ivar url: + :ivar revision: + :ivar data: + :ivar date_created: + :ivar date_updated: + :ivar created_by: + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, list_sid: str, index: Optional[int] = None, ): - """ - Initialize the SyncListItemInstance - """ super().__init__(version) - self._properties = { - "index": deserialize.integer(payload.get("index")), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "list_sid": payload.get("list_sid"), - "url": payload.get("url"), - "revision": payload.get("revision"), - "data": payload.get("data"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "created_by": payload.get("created_by"), - } + self.index: Optional[int] = deserialize.integer(payload.get("index")) + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.list_sid: Optional[str] = payload.get("list_sid") + self.url: Optional[str] = payload.get("url") + self.revision: Optional[str] = payload.get("revision") + self.data: Optional[Dict[str, object]] = payload.get("data") + 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.created_by: Optional[str] = payload.get("created_by") self._solution = { "service_sid": service_sid, "list_sid": list_sid, - "index": index or self._properties["index"], + "index": index or self.index, } self._context: Optional[SyncListItemContext] = None @@ -82,76 +94,6 @@ def _proxy(self) -> "SyncListItemContext": ) return self._context - @property - def index(self) -> int: - """ - :returns: - """ - return self._properties["index"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: - """ - return self._properties["service_sid"] - - @property - def list_sid(self) -> str: - """ - :returns: - """ - return self._properties["list_sid"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def revision(self) -> str: - """ - :returns: - """ - return self._properties["revision"] - - @property - def data(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["data"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def created_by(self) -> str: - """ - :returns: - """ - return self._properties["created_by"] - def delete(self, if_match=values.unset) -> bool: """ Deletes the SyncListItemInstance diff --git a/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py b/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py index 4b35fc33f..97d50ced3 100644 --- a/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py +++ b/twilio/rest/preview/sync/service/sync_list/sync_list_permission.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,34 +23,41 @@ class SyncListPermissionInstance(InstanceResource): + + """ + :ivar account_sid: The unique SID identifier of the Twilio Account. + :ivar service_sid: The unique SID identifier of the Sync Service Instance. + :ivar list_sid: The unique SID identifier of the Sync List to which the Permission applies. + :ivar identity: Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. + :ivar read: Boolean flag specifying whether the identity can read the Sync List and its Items. + :ivar write: Boolean flag specifying whether the identity can create, update and delete Items of the Sync List. + :ivar manage: Boolean flag specifying whether the identity can delete the Sync List. + :ivar url: Contains an absolute URL for this Sync List Permission. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, list_sid: str, identity: Optional[str] = None, ): - """ - Initialize the SyncListPermissionInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "list_sid": payload.get("list_sid"), - "identity": payload.get("identity"), - "read": payload.get("read"), - "write": payload.get("write"), - "manage": payload.get("manage"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.list_sid: Optional[str] = payload.get("list_sid") + self.identity: Optional[str] = payload.get("identity") + self.read: Optional[bool] = payload.get("read") + self.write: Optional[bool] = payload.get("write") + self.manage: Optional[bool] = payload.get("manage") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, "list_sid": list_sid, - "identity": identity or self._properties["identity"], + "identity": identity or self.identity, } self._context: Optional[SyncListPermissionContext] = None @@ -71,62 +78,6 @@ def _proxy(self) -> "SyncListPermissionContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique SID identifier of the Twilio Account. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The unique SID identifier of the Sync Service Instance. - """ - return self._properties["service_sid"] - - @property - def list_sid(self) -> str: - """ - :returns: The unique SID identifier of the Sync List to which the Permission applies. - """ - return self._properties["list_sid"] - - @property - def identity(self) -> str: - """ - :returns: Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. - """ - return self._properties["identity"] - - @property - def read(self) -> bool: - """ - :returns: Boolean flag specifying whether the identity can read the Sync List and its Items. - """ - return self._properties["read"] - - @property - def write(self) -> bool: - """ - :returns: Boolean flag specifying whether the identity can create, update and delete Items of the Sync List. - """ - return self._properties["write"] - - @property - def manage(self) -> bool: - """ - :returns: Boolean flag specifying whether the identity can delete the Sync List. - """ - return self._properties["manage"] - - @property - def url(self) -> str: - """ - :returns: Contains an absolute URL for this Sync List Permission. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the SyncListPermissionInstance diff --git a/twilio/rest/preview/sync/service/sync_map/__init__.py b/twilio/rest/preview/sync/service/sync_map/__init__.py index 1a73c37ed..8b47d8485 100644 --- a/twilio/rest/preview/sync/service/sync_map/__init__.py +++ b/twilio/rest/preview/sync/service/sync_map/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,28 +28,47 @@ class SyncMapInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the SyncMapInstance - """ + + """ + :ivar sid: + :ivar unique_name: + :ivar account_sid: + :ivar service_sid: + :ivar url: + :ivar links: + :ivar revision: + :ivar date_created: + :ivar date_updated: + :ivar created_by: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "url": payload.get("url"), - "links": payload.get("links"), - "revision": payload.get("revision"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "created_by": payload.get("created_by"), - } + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.revision: Optional[str] = payload.get("revision") + 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.created_by: Optional[str] = payload.get("created_by") self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[SyncMapContext] = None @@ -69,76 +88,6 @@ def _proxy(self) -> "SyncMapContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: - """ - return self._properties["unique_name"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: - """ - return self._properties["service_sid"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - - @property - def revision(self) -> str: - """ - :returns: - """ - return self._properties["revision"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def created_by(self) -> str: - """ - :returns: - """ - return self._properties["created_by"] - def delete(self) -> bool: """ Deletes the SyncMapInstance diff --git a/twilio/rest/preview/sync/service/sync_map/sync_map_item.py b/twilio/rest/preview/sync/service/sync_map/sync_map_item.py index 584cb349d..f332e9027 100644 --- a/twilio/rest/preview/sync/service/sync_map/sync_map_item.py +++ b/twilio/rest/preview/sync/service/sync_map/sync_map_item.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -32,36 +32,48 @@ class QueryResultOrder(object): ASC = "asc" DESC = "desc" + """ + :ivar key: + :ivar account_sid: + :ivar service_sid: + :ivar map_sid: + :ivar url: + :ivar revision: + :ivar data: + :ivar date_created: + :ivar date_updated: + :ivar created_by: + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, map_sid: str, key: Optional[str] = None, ): - """ - Initialize the SyncMapItemInstance - """ super().__init__(version) - self._properties = { - "key": payload.get("key"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "map_sid": payload.get("map_sid"), - "url": payload.get("url"), - "revision": payload.get("revision"), - "data": payload.get("data"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "created_by": payload.get("created_by"), - } + self.key: Optional[str] = payload.get("key") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.map_sid: Optional[str] = payload.get("map_sid") + self.url: Optional[str] = payload.get("url") + self.revision: Optional[str] = payload.get("revision") + self.data: Optional[Dict[str, object]] = payload.get("data") + 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.created_by: Optional[str] = payload.get("created_by") self._solution = { "service_sid": service_sid, "map_sid": map_sid, - "key": key or self._properties["key"], + "key": key or self.key, } self._context: Optional[SyncMapItemContext] = None @@ -82,76 +94,6 @@ def _proxy(self) -> "SyncMapItemContext": ) return self._context - @property - def key(self) -> str: - """ - :returns: - """ - return self._properties["key"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: - """ - return self._properties["service_sid"] - - @property - def map_sid(self) -> str: - """ - :returns: - """ - return self._properties["map_sid"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def revision(self) -> str: - """ - :returns: - """ - return self._properties["revision"] - - @property - def data(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["data"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def created_by(self) -> str: - """ - :returns: - """ - return self._properties["created_by"] - def delete(self, if_match=values.unset) -> bool: """ Deletes the SyncMapItemInstance diff --git a/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py b/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py index 3488ea9ae..ae3a3c45a 100644 --- a/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py +++ b/twilio/rest/preview/sync/service/sync_map/sync_map_permission.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,34 +23,41 @@ class SyncMapPermissionInstance(InstanceResource): + + """ + :ivar account_sid: The unique SID identifier of the Twilio Account. + :ivar service_sid: The unique SID identifier of the Sync Service Instance. + :ivar map_sid: The unique SID identifier of the Sync Map to which the Permission applies. + :ivar identity: Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. + :ivar read: Boolean flag specifying whether the identity can read the Sync Map and its Items. + :ivar write: Boolean flag specifying whether the identity can create, update and delete Items of the Sync Map. + :ivar manage: Boolean flag specifying whether the identity can delete the Sync Map. + :ivar url: Contains an absolute URL for this Sync Map Permission. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, map_sid: str, identity: Optional[str] = None, ): - """ - Initialize the SyncMapPermissionInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "map_sid": payload.get("map_sid"), - "identity": payload.get("identity"), - "read": payload.get("read"), - "write": payload.get("write"), - "manage": payload.get("manage"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.map_sid: Optional[str] = payload.get("map_sid") + self.identity: Optional[str] = payload.get("identity") + self.read: Optional[bool] = payload.get("read") + self.write: Optional[bool] = payload.get("write") + self.manage: Optional[bool] = payload.get("manage") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, "map_sid": map_sid, - "identity": identity or self._properties["identity"], + "identity": identity or self.identity, } self._context: Optional[SyncMapPermissionContext] = None @@ -71,62 +78,6 @@ def _proxy(self) -> "SyncMapPermissionContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique SID identifier of the Twilio Account. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The unique SID identifier of the Sync Service Instance. - """ - return self._properties["service_sid"] - - @property - def map_sid(self) -> str: - """ - :returns: The unique SID identifier of the Sync Map to which the Permission applies. - """ - return self._properties["map_sid"] - - @property - def identity(self) -> str: - """ - :returns: Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. - """ - return self._properties["identity"] - - @property - def read(self) -> bool: - """ - :returns: Boolean flag specifying whether the identity can read the Sync Map and its Items. - """ - return self._properties["read"] - - @property - def write(self) -> bool: - """ - :returns: Boolean flag specifying whether the identity can create, update and delete Items of the Sync Map. - """ - return self._properties["write"] - - @property - def manage(self) -> bool: - """ - :returns: Boolean flag specifying whether the identity can delete the Sync Map. - """ - return self._properties["manage"] - - @property - def url(self) -> str: - """ - :returns: Contains an absolute URL for this Sync Map Permission. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the SyncMapPermissionInstance diff --git a/twilio/rest/preview/understand/assistant/__init__.py b/twilio/rest/preview/understand/assistant/__init__.py index 801db6533..4c12f4555 100644 --- a/twilio/rest/preview/understand/assistant/__init__.py +++ b/twilio/rest/preview/understand/assistant/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -36,29 +36,48 @@ class AssistantInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the AssistantInstance - """ + + """ + :ivar account_sid: The unique ID of the Account that created this Assistant. + :ivar date_created: The date that this resource was created + :ivar date_updated: The date that this resource was last updated + :ivar friendly_name: A text description for the Assistant. It is non-unique and can up to 255 characters long. + :ivar latest_model_build_sid: The unique ID (Sid) of the latest model build. Null if no model has been built. + :ivar links: + :ivar log_queries: A boolean that specifies whether queries should be logged for 30 days further training. If false, no queries will be stored, if true, queries will be stored for 30 days and deleted thereafter. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. You can use the unique name in the URL path. Unique up to 64 characters long. + :ivar url: + :ivar callback_url: A user-provided URL to send event callbacks to. + :ivar callback_events: Space-separated list of callback events that will trigger callbacks. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "latest_model_build_sid": payload.get("latest_model_build_sid"), - "links": payload.get("links"), - "log_queries": payload.get("log_queries"), - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "url": payload.get("url"), - "callback_url": payload.get("callback_url"), - "callback_events": payload.get("callback_events"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.latest_model_build_sid: Optional[str] = payload.get( + "latest_model_build_sid" + ) + self.links: Optional[Dict[str, object]] = payload.get("links") + self.log_queries: Optional[bool] = payload.get("log_queries") + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.url: Optional[str] = payload.get("url") + self.callback_url: Optional[str] = payload.get("callback_url") + self.callback_events: Optional[str] = payload.get("callback_events") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[AssistantContext] = None @@ -77,90 +96,6 @@ def _proxy(self) -> "AssistantContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the Account that created this Assistant. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: A text description for the Assistant. It is non-unique and can up to 255 characters long. - """ - return self._properties["friendly_name"] - - @property - def latest_model_build_sid(self) -> str: - """ - :returns: The unique ID (Sid) of the latest model build. Null if no model has been built. - """ - return self._properties["latest_model_build_sid"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - - @property - def log_queries(self) -> bool: - """ - :returns: A boolean that specifies whether queries should be logged for 30 days further training. If false, no queries will be stored, if true, queries will be stored for 30 days and deleted thereafter. - """ - return self._properties["log_queries"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: A user-provided string that uniquely identifies this resource as an alternative to the sid. You can use the unique name in the URL path. Unique up to 64 characters long. - """ - return self._properties["unique_name"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def callback_url(self) -> str: - """ - :returns: A user-provided URL to send event callbacks to. - """ - return self._properties["callback_url"] - - @property - def callback_events(self) -> str: - """ - :returns: Space-separated list of callback events that will trigger callbacks. - """ - return self._properties["callback_events"] - def delete(self) -> bool: """ Deletes the AssistantInstance diff --git a/twilio/rest/preview/understand/assistant/assistant_fallback_actions.py b/twilio/rest/preview/understand/assistant/assistant_fallback_actions.py index 594c6082e..5cc3d9f22 100644 --- a/twilio/rest/preview/understand/assistant/assistant_fallback_actions.py +++ b/twilio/rest/preview/understand/assistant/assistant_fallback_actions.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -22,18 +22,21 @@ class AssistantFallbackActionsInstance(InstanceResource): - def __init__(self, version, payload, assistant_sid: str): - """ - Initialize the AssistantFallbackActionsInstance - """ + + """ + :ivar account_sid: + :ivar assistant_sid: + :ivar url: + :ivar data: + """ + + def __init__(self, version: Version, payload: Dict[str, Any], assistant_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "assistant_sid": payload.get("assistant_sid"), - "url": payload.get("url"), - "data": payload.get("data"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.url: Optional[str] = payload.get("url") + self.data: Optional[Dict[str, object]] = payload.get("data") self._solution = { "assistant_sid": assistant_sid, @@ -55,34 +58,6 @@ def _proxy(self) -> "AssistantFallbackActionsContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def assistant_sid(self) -> str: - """ - :returns: - """ - return self._properties["assistant_sid"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def data(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["data"] - def fetch(self) -> "AssistantFallbackActionsInstance": """ Fetch the AssistantFallbackActionsInstance diff --git a/twilio/rest/preview/understand/assistant/assistant_initiation_actions.py b/twilio/rest/preview/understand/assistant/assistant_initiation_actions.py index 08abd92b9..252677a51 100644 --- a/twilio/rest/preview/understand/assistant/assistant_initiation_actions.py +++ b/twilio/rest/preview/understand/assistant/assistant_initiation_actions.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -22,18 +22,21 @@ class AssistantInitiationActionsInstance(InstanceResource): - def __init__(self, version, payload, assistant_sid: str): - """ - Initialize the AssistantInitiationActionsInstance - """ + + """ + :ivar account_sid: + :ivar assistant_sid: + :ivar url: + :ivar data: + """ + + def __init__(self, version: Version, payload: Dict[str, Any], assistant_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "assistant_sid": payload.get("assistant_sid"), - "url": payload.get("url"), - "data": payload.get("data"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.url: Optional[str] = payload.get("url") + self.data: Optional[Dict[str, object]] = payload.get("data") self._solution = { "assistant_sid": assistant_sid, @@ -55,34 +58,6 @@ def _proxy(self) -> "AssistantInitiationActionsContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def assistant_sid(self) -> str: - """ - :returns: - """ - return self._properties["assistant_sid"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def data(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["data"] - def fetch(self) -> "AssistantInitiationActionsInstance": """ Fetch the AssistantInitiationActionsInstance diff --git a/twilio/rest/preview/understand/assistant/dialogue.py b/twilio/rest/preview/understand/assistant/dialogue.py index 060f3229e..7a145b40b 100644 --- a/twilio/rest/preview/understand/assistant/dialogue.py +++ b/twilio/rest/preview/understand/assistant/dialogue.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -21,23 +21,33 @@ class DialogueInstance(InstanceResource): - def __init__(self, version, payload, assistant_sid: str, sid: Optional[str] = None): - """ - Initialize the DialogueInstance - """ + + """ + :ivar account_sid: The unique ID of the Account that created this Field. + :ivar assistant_sid: The unique ID of the parent Assistant. + :ivar sid: The unique ID of the Dialogue + :ivar data: The dialogue memory object as json + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "assistant_sid": payload.get("assistant_sid"), - "sid": payload.get("sid"), - "data": payload.get("data"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.data: Optional[Dict[str, object]] = payload.get("data") + self.url: Optional[str] = payload.get("url") self._solution = { "assistant_sid": assistant_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[DialogueContext] = None @@ -57,41 +67,6 @@ def _proxy(self) -> "DialogueContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the Account that created this Field. - """ - return self._properties["account_sid"] - - @property - def assistant_sid(self) -> str: - """ - :returns: The unique ID of the parent Assistant. - """ - return self._properties["assistant_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique ID of the Dialogue - """ - return self._properties["sid"] - - @property - def data(self) -> Dict[str, object]: - """ - :returns: The dialogue memory object as json - """ - return self._properties["data"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def fetch(self) -> "DialogueInstance": """ Fetch the DialogueInstance diff --git a/twilio/rest/preview/understand/assistant/field_type/__init__.py b/twilio/rest/preview/understand/assistant/field_type/__init__.py index 204ef719d..f7c29bd4d 100644 --- a/twilio/rest/preview/understand/assistant/field_type/__init__.py +++ b/twilio/rest/preview/understand/assistant/field_type/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,27 +27,45 @@ class FieldTypeInstance(InstanceResource): - def __init__(self, version, payload, assistant_sid: str, sid: Optional[str] = None): - """ - Initialize the FieldTypeInstance - """ + + """ + :ivar account_sid: The unique ID of the Account that created this Field Type. + :ivar date_created: The date that this resource was created + :ivar date_updated: The date that this resource was last updated + :ivar friendly_name: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. + :ivar links: + :ivar assistant_sid: The unique ID of the Assistant. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "links": payload.get("links"), - "assistant_sid": payload.get("assistant_sid"), - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.url: Optional[str] = payload.get("url") self._solution = { "assistant_sid": assistant_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[FieldTypeContext] = None @@ -67,69 +85,6 @@ def _proxy(self) -> "FieldTypeContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the Account that created this Field Type. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. - """ - return self._properties["friendly_name"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - - @property - def assistant_sid(self) -> str: - """ - :returns: The unique ID of the Assistant. - """ - return self._properties["assistant_sid"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - """ - return self._properties["unique_name"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the FieldTypeInstance diff --git a/twilio/rest/preview/understand/assistant/field_type/field_value.py b/twilio/rest/preview/understand/assistant/field_type/field_value.py index 049ad3eaa..cbbb10fff 100644 --- a/twilio/rest/preview/understand/assistant/field_type/field_value.py +++ b/twilio/rest/preview/understand/assistant/field_type/field_value.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,36 +24,49 @@ class FieldValueInstance(InstanceResource): + + """ + :ivar account_sid: The unique ID of the Account that created this Field Value. + :ivar date_created: The date that this resource was created + :ivar date_updated: The date that this resource was last updated + :ivar field_type_sid: The unique ID of the Field Type associated with this Field Value. + :ivar language: An ISO language-country string of the value. + :ivar assistant_sid: The unique ID of the Assistant. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar value: The Field Value itself. + :ivar url: + :ivar synonym_of: A value that indicates this field value is a synonym of. Empty if the value is not a synonym. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], assistant_sid: str, field_type_sid: str, sid: Optional[str] = None, ): - """ - Initialize the FieldValueInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "field_type_sid": payload.get("field_type_sid"), - "language": payload.get("language"), - "assistant_sid": payload.get("assistant_sid"), - "sid": payload.get("sid"), - "value": payload.get("value"), - "url": payload.get("url"), - "synonym_of": payload.get("synonym_of"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.field_type_sid: Optional[str] = payload.get("field_type_sid") + self.language: Optional[str] = payload.get("language") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.value: Optional[str] = payload.get("value") + self.url: Optional[str] = payload.get("url") + self.synonym_of: Optional[str] = payload.get("synonym_of") self._solution = { "assistant_sid": assistant_sid, "field_type_sid": field_type_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[FieldValueContext] = None @@ -74,76 +87,6 @@ def _proxy(self) -> "FieldValueContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the Account that created this Field Value. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated - """ - return self._properties["date_updated"] - - @property - def field_type_sid(self) -> str: - """ - :returns: The unique ID of the Field Type associated with this Field Value. - """ - return self._properties["field_type_sid"] - - @property - def language(self) -> str: - """ - :returns: An ISO language-country string of the value. - """ - return self._properties["language"] - - @property - def assistant_sid(self) -> str: - """ - :returns: The unique ID of the Assistant. - """ - return self._properties["assistant_sid"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def value(self) -> str: - """ - :returns: The Field Value itself. - """ - return self._properties["value"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def synonym_of(self) -> str: - """ - :returns: A value that indicates this field value is a synonym of. Empty if the value is not a synonym. - """ - return self._properties["synonym_of"] - def delete(self) -> bool: """ Deletes the FieldValueInstance diff --git a/twilio/rest/preview/understand/assistant/model_build.py b/twilio/rest/preview/understand/assistant/model_build.py index 1158952b9..a5f3ab95e 100644 --- a/twilio/rest/preview/understand/assistant/model_build.py +++ b/twilio/rest/preview/understand/assistant/model_build.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -31,28 +31,48 @@ class Status(object): FAILED = "failed" CANCELED = "canceled" - def __init__(self, version, payload, assistant_sid: str, sid: Optional[str] = None): - """ - Initialize the ModelBuildInstance - """ + """ + :ivar account_sid: The unique ID of the Account that created this Model Build. + :ivar date_created: The date that this resource was created + :ivar date_updated: The date that this resource was last updated + :ivar assistant_sid: The unique ID of the parent Assistant. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar status: + :ivar unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + :ivar url: + :ivar build_duration: The time in seconds it took to build the model. + :ivar error_code: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "assistant_sid": payload.get("assistant_sid"), - "sid": payload.get("sid"), - "status": payload.get("status"), - "unique_name": payload.get("unique_name"), - "url": payload.get("url"), - "build_duration": deserialize.integer(payload.get("build_duration")), - "error_code": deserialize.integer(payload.get("error_code")), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.status: Optional["ModelBuildInstance.Status"] = payload.get("status") + self.unique_name: Optional[str] = payload.get("unique_name") + self.url: Optional[str] = payload.get("url") + self.build_duration: Optional[int] = deserialize.integer( + payload.get("build_duration") + ) + self.error_code: Optional[int] = deserialize.integer(payload.get("error_code")) self._solution = { "assistant_sid": assistant_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ModelBuildContext] = None @@ -72,76 +92,6 @@ def _proxy(self) -> "ModelBuildContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the Account that created this Model Build. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated - """ - return self._properties["date_updated"] - - @property - def assistant_sid(self) -> str: - """ - :returns: The unique ID of the parent Assistant. - """ - return self._properties["assistant_sid"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def status(self) -> "ModelBuildInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def unique_name(self) -> str: - """ - :returns: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - """ - return self._properties["unique_name"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def build_duration(self) -> int: - """ - :returns: The time in seconds it took to build the model. - """ - return self._properties["build_duration"] - - @property - def error_code(self) -> int: - """ - :returns: - """ - return self._properties["error_code"] - def delete(self) -> bool: """ Deletes the ModelBuildInstance diff --git a/twilio/rest/preview/understand/assistant/query.py b/twilio/rest/preview/understand/assistant/query.py index 7c518b265..b28d6f306 100644 --- a/twilio/rest/preview/understand/assistant/query.py +++ b/twilio/rest/preview/understand/assistant/query.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,31 +24,53 @@ class QueryInstance(InstanceResource): - def __init__(self, version, payload, assistant_sid: str, sid: Optional[str] = None): - """ - Initialize the QueryInstance - """ + + """ + :ivar account_sid: The unique ID of the Account that created this Query. + :ivar date_created: The date that this resource was created + :ivar date_updated: The date that this resource was last updated + :ivar results: The natural language analysis results which include the Task recognized, the confidence score and a list of identified Fields. + :ivar language: An ISO language-country string of the sample. + :ivar model_build_sid: The unique ID of the Model Build queried. + :ivar query: The end-user's natural language input. + :ivar sample_sid: An optional reference to the Sample created from this query. + :ivar assistant_sid: The unique ID of the parent Assistant. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar status: A string that described the query status. The values can be: pending_review, reviewed, discarded + :ivar url: + :ivar source_channel: The communication channel where this end-user input came from + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "results": payload.get("results"), - "language": payload.get("language"), - "model_build_sid": payload.get("model_build_sid"), - "query": payload.get("query"), - "sample_sid": payload.get("sample_sid"), - "assistant_sid": payload.get("assistant_sid"), - "sid": payload.get("sid"), - "status": payload.get("status"), - "url": payload.get("url"), - "source_channel": payload.get("source_channel"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.results: Optional[Dict[str, object]] = payload.get("results") + self.language: Optional[str] = payload.get("language") + self.model_build_sid: Optional[str] = payload.get("model_build_sid") + self.query: Optional[str] = payload.get("query") + self.sample_sid: Optional[str] = payload.get("sample_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.status: Optional[str] = payload.get("status") + self.url: Optional[str] = payload.get("url") + self.source_channel: Optional[str] = payload.get("source_channel") self._solution = { "assistant_sid": assistant_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[QueryContext] = None @@ -68,97 +90,6 @@ def _proxy(self) -> "QueryContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the Account that created this Query. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated - """ - return self._properties["date_updated"] - - @property - def results(self) -> Dict[str, object]: - """ - :returns: The natural language analysis results which include the Task recognized, the confidence score and a list of identified Fields. - """ - return self._properties["results"] - - @property - def language(self) -> str: - """ - :returns: An ISO language-country string of the sample. - """ - return self._properties["language"] - - @property - def model_build_sid(self) -> str: - """ - :returns: The unique ID of the Model Build queried. - """ - return self._properties["model_build_sid"] - - @property - def query(self) -> str: - """ - :returns: The end-user's natural language input. - """ - return self._properties["query"] - - @property - def sample_sid(self) -> str: - """ - :returns: An optional reference to the Sample created from this query. - """ - return self._properties["sample_sid"] - - @property - def assistant_sid(self) -> str: - """ - :returns: The unique ID of the parent Assistant. - """ - return self._properties["assistant_sid"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def status(self) -> str: - """ - :returns: A string that described the query status. The values can be: pending_review, reviewed, discarded - """ - return self._properties["status"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def source_channel(self) -> str: - """ - :returns: The communication channel where this end-user input came from - """ - return self._properties["source_channel"] - def delete(self) -> bool: """ Deletes the QueryInstance diff --git a/twilio/rest/preview/understand/assistant/style_sheet.py b/twilio/rest/preview/understand/assistant/style_sheet.py index 5826211b0..eda55dee5 100644 --- a/twilio/rest/preview/understand/assistant/style_sheet.py +++ b/twilio/rest/preview/understand/assistant/style_sheet.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -22,18 +22,21 @@ class StyleSheetInstance(InstanceResource): - def __init__(self, version, payload, assistant_sid: str): - """ - Initialize the StyleSheetInstance - """ + + """ + :ivar account_sid: The unique ID of the Account that created this Assistant + :ivar assistant_sid: The unique ID of the Assistant + :ivar url: + :ivar data: The JSON style sheet object + """ + + def __init__(self, version: Version, payload: Dict[str, Any], assistant_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "assistant_sid": payload.get("assistant_sid"), - "url": payload.get("url"), - "data": payload.get("data"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.url: Optional[str] = payload.get("url") + self.data: Optional[Dict[str, object]] = payload.get("data") self._solution = { "assistant_sid": assistant_sid, @@ -55,34 +58,6 @@ def _proxy(self) -> "StyleSheetContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the Account that created this Assistant - """ - return self._properties["account_sid"] - - @property - def assistant_sid(self) -> str: - """ - :returns: The unique ID of the Assistant - """ - return self._properties["assistant_sid"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def data(self) -> Dict[str, object]: - """ - :returns: The JSON style sheet object - """ - return self._properties["data"] - def fetch(self) -> "StyleSheetInstance": """ Fetch the StyleSheetInstance diff --git a/twilio/rest/preview/understand/assistant/task/__init__.py b/twilio/rest/preview/understand/assistant/task/__init__.py index 18103fde7..b0ebf6793 100644 --- a/twilio/rest/preview/understand/assistant/task/__init__.py +++ b/twilio/rest/preview/understand/assistant/task/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -30,28 +30,47 @@ class TaskInstance(InstanceResource): - def __init__(self, version, payload, assistant_sid: str, sid: Optional[str] = None): - """ - Initialize the TaskInstance - """ + + """ + :ivar account_sid: The unique ID of the Account that created this Task. + :ivar date_created: The date that this resource was created + :ivar date_updated: The date that this resource was last updated + :ivar friendly_name: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. + :ivar links: + :ivar assistant_sid: The unique ID of the Assistant. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + :ivar actions_url: User-provided HTTP endpoint where from the assistant fetches actions + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "links": payload.get("links"), - "assistant_sid": payload.get("assistant_sid"), - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "actions_url": payload.get("actions_url"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.actions_url: Optional[str] = payload.get("actions_url") + self.url: Optional[str] = payload.get("url") self._solution = { "assistant_sid": assistant_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[TaskContext] = None @@ -71,76 +90,6 @@ def _proxy(self) -> "TaskContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the Account that created this Task. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. - """ - return self._properties["friendly_name"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - - @property - def assistant_sid(self) -> str: - """ - :returns: The unique ID of the Assistant. - """ - return self._properties["assistant_sid"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - """ - return self._properties["unique_name"] - - @property - def actions_url(self) -> str: - """ - :returns: User-provided HTTP endpoint where from the assistant fetches actions - """ - return self._properties["actions_url"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the TaskInstance diff --git a/twilio/rest/preview/understand/assistant/task/field.py b/twilio/rest/preview/understand/assistant/task/field.py index 6adbd07b5..53c7bed75 100644 --- a/twilio/rest/preview/understand/assistant/task/field.py +++ b/twilio/rest/preview/understand/assistant/task/field.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,35 +24,47 @@ class FieldInstance(InstanceResource): + + """ + :ivar account_sid: The unique ID of the Account that created this Field. + :ivar date_created: The date that this resource was created + :ivar date_updated: The date that this resource was last updated + :ivar field_type: The Field Type of this field. It can be any [Built-in Field Type](https://www.twilio.com/docs/assistant/api/built-in-field-types) or the unique_name or sid of a custom Field Type. + :ivar task_sid: The unique ID of the Task associated with this Field. + :ivar assistant_sid: The unique ID of the parent Assistant. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar unique_name: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. + :ivar url: + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], assistant_sid: str, task_sid: str, sid: Optional[str] = None, ): - """ - Initialize the FieldInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "field_type": payload.get("field_type"), - "task_sid": payload.get("task_sid"), - "assistant_sid": payload.get("assistant_sid"), - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.field_type: Optional[str] = payload.get("field_type") + self.task_sid: Optional[str] = payload.get("task_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.url: Optional[str] = payload.get("url") self._solution = { "assistant_sid": assistant_sid, "task_sid": task_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[FieldContext] = None @@ -73,69 +85,6 @@ def _proxy(self) -> "FieldContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the Account that created this Field. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated - """ - return self._properties["date_updated"] - - @property - def field_type(self) -> str: - """ - :returns: The Field Type of this field. It can be any [Built-in Field Type](https://www.twilio.com/docs/assistant/api/built-in-field-types) or the unique_name or sid of a custom Field Type. - """ - return self._properties["field_type"] - - @property - def task_sid(self) -> str: - """ - :returns: The unique ID of the Task associated with this Field. - """ - return self._properties["task_sid"] - - @property - def assistant_sid(self) -> str: - """ - :returns: The unique ID of the parent Assistant. - """ - return self._properties["assistant_sid"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - """ - return self._properties["unique_name"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the FieldInstance diff --git a/twilio/rest/preview/understand/assistant/task/sample.py b/twilio/rest/preview/understand/assistant/task/sample.py index ff9ac1464..4a2057f81 100644 --- a/twilio/rest/preview/understand/assistant/task/sample.py +++ b/twilio/rest/preview/understand/assistant/task/sample.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,36 +24,49 @@ class SampleInstance(InstanceResource): + + """ + :ivar account_sid: The unique ID of the Account that created this Sample. + :ivar date_created: The date that this resource was created + :ivar date_updated: The date that this resource was last updated + :ivar task_sid: The unique ID of the Task associated with this Sample. + :ivar language: An ISO language-country string of the sample. + :ivar assistant_sid: The unique ID of the Assistant. + :ivar sid: A 34 character string that uniquely identifies this resource. + :ivar tagged_text: The text example of how end-users may express this task. The sample may contain Field tag blocks. + :ivar url: + :ivar source_channel: The communication channel the sample was captured. It can be: *voice*, *sms*, *chat*, *alexa*, *google-assistant*, or *slack*. If not included the value will be null + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], assistant_sid: str, task_sid: str, sid: Optional[str] = None, ): - """ - Initialize the SampleInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "task_sid": payload.get("task_sid"), - "language": payload.get("language"), - "assistant_sid": payload.get("assistant_sid"), - "sid": payload.get("sid"), - "tagged_text": payload.get("tagged_text"), - "url": payload.get("url"), - "source_channel": payload.get("source_channel"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.task_sid: Optional[str] = payload.get("task_sid") + self.language: Optional[str] = payload.get("language") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.sid: Optional[str] = payload.get("sid") + self.tagged_text: Optional[str] = payload.get("tagged_text") + self.url: Optional[str] = payload.get("url") + self.source_channel: Optional[str] = payload.get("source_channel") self._solution = { "assistant_sid": assistant_sid, "task_sid": task_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[SampleContext] = None @@ -74,76 +87,6 @@ def _proxy(self) -> "SampleContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the Account that created this Sample. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this resource was created - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this resource was last updated - """ - return self._properties["date_updated"] - - @property - def task_sid(self) -> str: - """ - :returns: The unique ID of the Task associated with this Sample. - """ - return self._properties["task_sid"] - - @property - def language(self) -> str: - """ - :returns: An ISO language-country string of the sample. - """ - return self._properties["language"] - - @property - def assistant_sid(self) -> str: - """ - :returns: The unique ID of the Assistant. - """ - return self._properties["assistant_sid"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this resource. - """ - return self._properties["sid"] - - @property - def tagged_text(self) -> str: - """ - :returns: The text example of how end-users may express this task. The sample may contain Field tag blocks. - """ - return self._properties["tagged_text"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def source_channel(self) -> str: - """ - :returns: The communication channel the sample was captured. It can be: *voice*, *sms*, *chat*, *alexa*, *google-assistant*, or *slack*. If not included the value will be null - """ - return self._properties["source_channel"] - def delete(self) -> bool: """ Deletes the SampleInstance diff --git a/twilio/rest/preview/understand/assistant/task/task_actions.py b/twilio/rest/preview/understand/assistant/task/task_actions.py index fbdbbb3ec..4cd363375 100644 --- a/twilio/rest/preview/understand/assistant/task/task_actions.py +++ b/twilio/rest/preview/understand/assistant/task/task_actions.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -22,19 +22,29 @@ class TaskActionsInstance(InstanceResource): - def __init__(self, version, payload, assistant_sid: str, task_sid: str): - """ - Initialize the TaskActionsInstance - """ + + """ + :ivar account_sid: The unique ID of the Account that created this Field. + :ivar assistant_sid: The unique ID of the parent Assistant. + :ivar task_sid: The unique ID of the Task. + :ivar url: + :ivar data: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + task_sid: str, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "assistant_sid": payload.get("assistant_sid"), - "task_sid": payload.get("task_sid"), - "url": payload.get("url"), - "data": payload.get("data"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.task_sid: Optional[str] = payload.get("task_sid") + self.url: Optional[str] = payload.get("url") + self.data: Optional[Dict[str, object]] = payload.get("data") self._solution = { "assistant_sid": assistant_sid, @@ -58,41 +68,6 @@ def _proxy(self) -> "TaskActionsContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the Account that created this Field. - """ - return self._properties["account_sid"] - - @property - def assistant_sid(self) -> str: - """ - :returns: The unique ID of the parent Assistant. - """ - return self._properties["assistant_sid"] - - @property - def task_sid(self) -> str: - """ - :returns: The unique ID of the Task. - """ - return self._properties["task_sid"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def data(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["data"] - def fetch(self) -> "TaskActionsInstance": """ Fetch the TaskActionsInstance diff --git a/twilio/rest/preview/understand/assistant/task/task_statistics.py b/twilio/rest/preview/understand/assistant/task/task_statistics.py index bdb5eb11f..07375954c 100644 --- a/twilio/rest/preview/understand/assistant/task/task_statistics.py +++ b/twilio/rest/preview/understand/assistant/task/task_statistics.py @@ -13,7 +13,7 @@ """ -from typing import Optional +from typing import Any, Dict, Optional from twilio.base import deserialize from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -22,20 +22,35 @@ class TaskStatisticsInstance(InstanceResource): - def __init__(self, version, payload, assistant_sid: str, task_sid: str): - """ - Initialize the TaskStatisticsInstance - """ + + """ + :ivar account_sid: The unique ID of the Account that created this Field. + :ivar assistant_sid: The unique ID of the parent Assistant. + :ivar task_sid: The unique ID of the Task associated with this Field. + :ivar samples_count: The total number of Samples associated with this Task. + :ivar fields_count: The total number of Fields associated with this Task. + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + assistant_sid: str, + task_sid: str, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "assistant_sid": payload.get("assistant_sid"), - "task_sid": payload.get("task_sid"), - "samples_count": deserialize.integer(payload.get("samples_count")), - "fields_count": deserialize.integer(payload.get("fields_count")), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.assistant_sid: Optional[str] = payload.get("assistant_sid") + self.task_sid: Optional[str] = payload.get("task_sid") + self.samples_count: Optional[int] = deserialize.integer( + payload.get("samples_count") + ) + self.fields_count: Optional[int] = deserialize.integer( + payload.get("fields_count") + ) + self.url: Optional[str] = payload.get("url") self._solution = { "assistant_sid": assistant_sid, @@ -59,48 +74,6 @@ def _proxy(self) -> "TaskStatisticsContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The unique ID of the Account that created this Field. - """ - return self._properties["account_sid"] - - @property - def assistant_sid(self) -> str: - """ - :returns: The unique ID of the parent Assistant. - """ - return self._properties["assistant_sid"] - - @property - def task_sid(self) -> str: - """ - :returns: The unique ID of the Task associated with this Field. - """ - return self._properties["task_sid"] - - @property - def samples_count(self) -> int: - """ - :returns: The total number of Samples associated with this Task. - """ - return self._properties["samples_count"] - - @property - def fields_count(self) -> int: - """ - :returns: The total number of Fields associated with this Task. - """ - return self._properties["fields_count"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def fetch(self) -> "TaskStatisticsInstance": """ Fetch the TaskStatisticsInstance diff --git a/twilio/rest/preview/wireless/command.py b/twilio/rest/preview/wireless/command.py index 41b2ce07e..2be3dc639 100644 --- a/twilio/rest/preview/wireless/command.py +++ b/twilio/rest/preview/wireless/command.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,28 +24,44 @@ class CommandInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the CommandInstance - """ + + """ + :ivar sid: + :ivar account_sid: + :ivar device_sid: + :ivar sim_sid: + :ivar command: + :ivar command_mode: + :ivar status: + :ivar direction: + :ivar date_created: + :ivar date_updated: + :ivar url: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "device_sid": payload.get("device_sid"), - "sim_sid": payload.get("sim_sid"), - "command": payload.get("command"), - "command_mode": payload.get("command_mode"), - "status": payload.get("status"), - "direction": payload.get("direction"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.device_sid: Optional[str] = payload.get("device_sid") + self.sim_sid: Optional[str] = payload.get("sim_sid") + self.command: Optional[str] = payload.get("command") + self.command_mode: Optional[str] = payload.get("command_mode") + self.status: Optional[str] = payload.get("status") + self.direction: Optional[str] = payload.get("direction") + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[CommandContext] = None @@ -64,83 +80,6 @@ def _proxy(self) -> "CommandContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def device_sid(self) -> str: - """ - :returns: - """ - return self._properties["device_sid"] - - @property - def sim_sid(self) -> str: - """ - :returns: - """ - return self._properties["sim_sid"] - - @property - def command(self) -> str: - """ - :returns: - """ - return self._properties["command"] - - @property - def command_mode(self) -> str: - """ - :returns: - """ - return self._properties["command_mode"] - - @property - def status(self) -> str: - """ - :returns: - """ - return self._properties["status"] - - @property - def direction(self) -> str: - """ - :returns: - """ - return self._properties["direction"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def fetch(self) -> "CommandInstance": """ Fetch the CommandInstance diff --git a/twilio/rest/preview/wireless/rate_plan.py b/twilio/rest/preview/wireless/rate_plan.py index e2a52bfd1..6cf4ced25 100644 --- a/twilio/rest/preview/wireless/rate_plan.py +++ b/twilio/rest/preview/wireless/rate_plan.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,31 +24,54 @@ class RatePlanInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the RatePlanInstance - """ + + """ + :ivar sid: + :ivar unique_name: + :ivar account_sid: + :ivar friendly_name: + :ivar data_enabled: + :ivar data_metering: + :ivar data_limit: + :ivar messaging_enabled: + :ivar voice_enabled: + :ivar national_roaming_enabled: + :ivar international_roaming: + :ivar date_created: + :ivar date_updated: + :ivar url: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "data_enabled": payload.get("data_enabled"), - "data_metering": payload.get("data_metering"), - "data_limit": deserialize.integer(payload.get("data_limit")), - "messaging_enabled": payload.get("messaging_enabled"), - "voice_enabled": payload.get("voice_enabled"), - "national_roaming_enabled": payload.get("national_roaming_enabled"), - "international_roaming": payload.get("international_roaming"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.account_sid: Optional[str] = payload.get("account_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.data_enabled: Optional[bool] = payload.get("data_enabled") + self.data_metering: Optional[str] = payload.get("data_metering") + self.data_limit: Optional[int] = deserialize.integer(payload.get("data_limit")) + self.messaging_enabled: Optional[bool] = payload.get("messaging_enabled") + self.voice_enabled: Optional[bool] = payload.get("voice_enabled") + self.national_roaming_enabled: Optional[bool] = payload.get( + "national_roaming_enabled" + ) + self.international_roaming: Optional[List[str]] = payload.get( + "international_roaming" + ) + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[RatePlanContext] = None @@ -67,104 +90,6 @@ def _proxy(self) -> "RatePlanContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: - """ - return self._properties["unique_name"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: - """ - return self._properties["friendly_name"] - - @property - def data_enabled(self) -> bool: - """ - :returns: - """ - return self._properties["data_enabled"] - - @property - def data_metering(self) -> str: - """ - :returns: - """ - return self._properties["data_metering"] - - @property - def data_limit(self) -> int: - """ - :returns: - """ - return self._properties["data_limit"] - - @property - def messaging_enabled(self) -> bool: - """ - :returns: - """ - return self._properties["messaging_enabled"] - - @property - def voice_enabled(self) -> bool: - """ - :returns: - """ - return self._properties["voice_enabled"] - - @property - def national_roaming_enabled(self) -> bool: - """ - :returns: - """ - return self._properties["national_roaming_enabled"] - - @property - def international_roaming(self) -> List[str]: - """ - :returns: - """ - return self._properties["international_roaming"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the RatePlanInstance diff --git a/twilio/rest/preview/wireless/sim/__init__.py b/twilio/rest/preview/wireless/sim/__init__.py index 9ff201263..40ee60833 100644 --- a/twilio/rest/preview/wireless/sim/__init__.py +++ b/twilio/rest/preview/wireless/sim/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -25,39 +25,68 @@ class SimInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the SimInstance - """ + + """ + :ivar sid: + :ivar unique_name: + :ivar account_sid: + :ivar rate_plan_sid: + :ivar friendly_name: + :ivar iccid: + :ivar e_id: + :ivar status: + :ivar commands_callback_url: + :ivar commands_callback_method: + :ivar sms_fallback_method: + :ivar sms_fallback_url: + :ivar sms_method: + :ivar sms_url: + :ivar voice_fallback_method: + :ivar voice_fallback_url: + :ivar voice_method: + :ivar voice_url: + :ivar date_created: + :ivar date_updated: + :ivar url: + :ivar links: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "account_sid": payload.get("account_sid"), - "rate_plan_sid": payload.get("rate_plan_sid"), - "friendly_name": payload.get("friendly_name"), - "iccid": payload.get("iccid"), - "e_id": payload.get("e_id"), - "status": payload.get("status"), - "commands_callback_url": payload.get("commands_callback_url"), - "commands_callback_method": payload.get("commands_callback_method"), - "sms_fallback_method": payload.get("sms_fallback_method"), - "sms_fallback_url": payload.get("sms_fallback_url"), - "sms_method": payload.get("sms_method"), - "sms_url": payload.get("sms_url"), - "voice_fallback_method": payload.get("voice_fallback_method"), - "voice_fallback_url": payload.get("voice_fallback_url"), - "voice_method": payload.get("voice_method"), - "voice_url": payload.get("voice_url"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.account_sid: Optional[str] = payload.get("account_sid") + self.rate_plan_sid: Optional[str] = payload.get("rate_plan_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.iccid: Optional[str] = payload.get("iccid") + self.e_id: Optional[str] = payload.get("e_id") + self.status: Optional[str] = payload.get("status") + self.commands_callback_url: Optional[str] = payload.get("commands_callback_url") + self.commands_callback_method: Optional[str] = payload.get( + "commands_callback_method" + ) + self.sms_fallback_method: Optional[str] = payload.get("sms_fallback_method") + self.sms_fallback_url: Optional[str] = payload.get("sms_fallback_url") + self.sms_method: Optional[str] = payload.get("sms_method") + self.sms_url: Optional[str] = payload.get("sms_url") + self.voice_fallback_method: Optional[str] = payload.get("voice_fallback_method") + self.voice_fallback_url: Optional[str] = payload.get("voice_fallback_url") + self.voice_method: Optional[str] = payload.get("voice_method") + self.voice_url: Optional[str] = payload.get("voice_url") + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[SimContext] = None @@ -76,160 +105,6 @@ def _proxy(self) -> "SimContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: - """ - return self._properties["unique_name"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def rate_plan_sid(self) -> str: - """ - :returns: - """ - return self._properties["rate_plan_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: - """ - return self._properties["friendly_name"] - - @property - def iccid(self) -> str: - """ - :returns: - """ - return self._properties["iccid"] - - @property - def e_id(self) -> str: - """ - :returns: - """ - return self._properties["e_id"] - - @property - def status(self) -> str: - """ - :returns: - """ - return self._properties["status"] - - @property - def commands_callback_url(self) -> str: - """ - :returns: - """ - return self._properties["commands_callback_url"] - - @property - def commands_callback_method(self) -> str: - """ - :returns: - """ - return self._properties["commands_callback_method"] - - @property - def sms_fallback_method(self) -> str: - """ - :returns: - """ - return self._properties["sms_fallback_method"] - - @property - def sms_fallback_url(self) -> str: - """ - :returns: - """ - return self._properties["sms_fallback_url"] - - @property - def sms_method(self) -> str: - """ - :returns: - """ - return self._properties["sms_method"] - - @property - def sms_url(self) -> str: - """ - :returns: - """ - return self._properties["sms_url"] - - @property - def voice_fallback_method(self) -> str: - """ - :returns: - """ - return self._properties["voice_fallback_method"] - - @property - def voice_fallback_url(self) -> str: - """ - :returns: - """ - return self._properties["voice_fallback_url"] - - @property - def voice_method(self) -> str: - """ - :returns: - """ - return self._properties["voice_method"] - - @property - def voice_url(self) -> str: - """ - :returns: - """ - return self._properties["voice_url"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - def fetch(self) -> "SimInstance": """ Fetch the SimInstance diff --git a/twilio/rest/preview/wireless/sim/usage.py b/twilio/rest/preview/wireless/sim/usage.py index 938738a12..8180e2370 100644 --- a/twilio/rest/preview/wireless/sim/usage.py +++ b/twilio/rest/preview/wireless/sim/usage.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +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 @@ -22,23 +22,31 @@ class UsageInstance(InstanceResource): - def __init__(self, version, payload, sim_sid: str): - """ - Initialize the UsageInstance - """ + + """ + :ivar sim_sid: + :ivar sim_unique_name: + :ivar account_sid: + :ivar period: + :ivar commands_usage: + :ivar commands_costs: + :ivar data_usage: + :ivar data_costs: + :ivar url: + """ + + def __init__(self, version: Version, payload: Dict[str, Any], sim_sid: str): super().__init__(version) - self._properties = { - "sim_sid": payload.get("sim_sid"), - "sim_unique_name": payload.get("sim_unique_name"), - "account_sid": payload.get("account_sid"), - "period": payload.get("period"), - "commands_usage": payload.get("commands_usage"), - "commands_costs": payload.get("commands_costs"), - "data_usage": payload.get("data_usage"), - "data_costs": payload.get("data_costs"), - "url": payload.get("url"), - } + self.sim_sid: Optional[str] = payload.get("sim_sid") + self.sim_unique_name: Optional[str] = payload.get("sim_unique_name") + self.account_sid: Optional[str] = payload.get("account_sid") + self.period: Optional[Dict[str, object]] = payload.get("period") + self.commands_usage: Optional[Dict[str, object]] = payload.get("commands_usage") + self.commands_costs: Optional[Dict[str, object]] = payload.get("commands_costs") + self.data_usage: Optional[Dict[str, object]] = payload.get("data_usage") + self.data_costs: Optional[Dict[str, object]] = payload.get("data_costs") + self.url: Optional[str] = payload.get("url") self._solution = { "sim_sid": sim_sid, @@ -60,69 +68,6 @@ def _proxy(self) -> "UsageContext": ) return self._context - @property - def sim_sid(self) -> str: - """ - :returns: - """ - return self._properties["sim_sid"] - - @property - def sim_unique_name(self) -> str: - """ - :returns: - """ - return self._properties["sim_unique_name"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def period(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["period"] - - @property - def commands_usage(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["commands_usage"] - - @property - def commands_costs(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["commands_costs"] - - @property - def data_usage(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["data_usage"] - - @property - def data_costs(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["data_costs"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def fetch(self, end=values.unset, start=values.unset) -> "UsageInstance": """ Fetch the UsageInstance diff --git a/twilio/rest/pricing/v1/messaging/country.py b/twilio/rest/pricing/v1/messaging/country.py index 3ce278e7f..3635f10aa 100644 --- a/twilio/rest/pricing/v1/messaging/country.py +++ b/twilio/rest/pricing/v1/messaging/country.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,23 +23,35 @@ class CountryInstance(InstanceResource): - def __init__(self, version, payload, iso_country: Optional[str] = None): - """ - Initialize the CountryInstance - """ + + """ + :ivar country: The name of the country. + :ivar iso_country: The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + :ivar outbound_sms_prices: The list of [OutboundSMSPrice](https://www.twilio.com/docs/sms/api/pricing#outbound-sms-price) records that represent the price to send a message for each MCC/MNC applicable in this country. + :ivar inbound_sms_prices: The list of [InboundPrice](https://www.twilio.com/docs/sms/api/pricing#inbound-price) records that describe the price to receive an inbound SMS to the different Twilio phone number types supported in this country + :ivar price_unit: The currency in which prices are measured, specified in [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + iso_country: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "country": payload.get("country"), - "iso_country": payload.get("iso_country"), - "outbound_sms_prices": payload.get("outbound_sms_prices"), - "inbound_sms_prices": payload.get("inbound_sms_prices"), - "price_unit": payload.get("price_unit"), - "url": payload.get("url"), - } + self.country: Optional[str] = payload.get("country") + self.iso_country: Optional[str] = payload.get("iso_country") + self.outbound_sms_prices: Optional[List[str]] = payload.get( + "outbound_sms_prices" + ) + self.inbound_sms_prices: Optional[List[str]] = payload.get("inbound_sms_prices") + self.price_unit: Optional[str] = payload.get("price_unit") + self.url: Optional[str] = payload.get("url") self._solution = { - "iso_country": iso_country or self._properties["iso_country"], + "iso_country": iso_country or self.iso_country, } self._context: Optional[CountryContext] = None @@ -58,48 +70,6 @@ def _proxy(self) -> "CountryContext": ) return self._context - @property - def country(self) -> str: - """ - :returns: The name of the country. - """ - return self._properties["country"] - - @property - def iso_country(self) -> str: - """ - :returns: The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). - """ - return self._properties["iso_country"] - - @property - def outbound_sms_prices(self) -> List[str]: - """ - :returns: The list of [OutboundSMSPrice](https://www.twilio.com/docs/sms/api/pricing#outbound-sms-price) records that represent the price to send a message for each MCC/MNC applicable in this country. - """ - return self._properties["outbound_sms_prices"] - - @property - def inbound_sms_prices(self) -> List[str]: - """ - :returns: The list of [InboundPrice](https://www.twilio.com/docs/sms/api/pricing#inbound-price) records that describe the price to receive an inbound SMS to the different Twilio phone number types supported in this country - """ - return self._properties["inbound_sms_prices"] - - @property - def price_unit(self) -> str: - """ - :returns: The currency in which prices are measured, specified in [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). - """ - return self._properties["price_unit"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def fetch(self) -> "CountryInstance": """ Fetch the CountryInstance diff --git a/twilio/rest/pricing/v1/phone_number/country.py b/twilio/rest/pricing/v1/phone_number/country.py index ecb9f9b68..cbdda297e 100644 --- a/twilio/rest/pricing/v1/phone_number/country.py +++ b/twilio/rest/pricing/v1/phone_number/country.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,22 +23,33 @@ class CountryInstance(InstanceResource): - def __init__(self, version, payload, iso_country: Optional[str] = None): - """ - Initialize the CountryInstance - """ + + """ + :ivar country: The name of the country. + :ivar iso_country: The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + :ivar phone_number_prices: The list of [PhoneNumberPrice](https://www.twilio.com/docs/phone-numbers/pricing#phone-number-price) records. + :ivar price_unit: The currency in which prices are measured, specified in [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + iso_country: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "country": payload.get("country"), - "iso_country": payload.get("iso_country"), - "phone_number_prices": payload.get("phone_number_prices"), - "price_unit": payload.get("price_unit"), - "url": payload.get("url"), - } + self.country: Optional[str] = payload.get("country") + self.iso_country: Optional[str] = payload.get("iso_country") + self.phone_number_prices: Optional[List[str]] = payload.get( + "phone_number_prices" + ) + self.price_unit: Optional[str] = payload.get("price_unit") + self.url: Optional[str] = payload.get("url") self._solution = { - "iso_country": iso_country or self._properties["iso_country"], + "iso_country": iso_country or self.iso_country, } self._context: Optional[CountryContext] = None @@ -57,41 +68,6 @@ def _proxy(self) -> "CountryContext": ) return self._context - @property - def country(self) -> str: - """ - :returns: The name of the country. - """ - return self._properties["country"] - - @property - def iso_country(self) -> str: - """ - :returns: The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). - """ - return self._properties["iso_country"] - - @property - def phone_number_prices(self) -> List[str]: - """ - :returns: The list of [PhoneNumberPrice](https://www.twilio.com/docs/phone-numbers/pricing#phone-number-price) records. - """ - return self._properties["phone_number_prices"] - - @property - def price_unit(self) -> str: - """ - :returns: The currency in which prices are measured, specified in [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). - """ - return self._properties["price_unit"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def fetch(self) -> "CountryInstance": """ Fetch the CountryInstance diff --git a/twilio/rest/pricing/v1/voice/country.py b/twilio/rest/pricing/v1/voice/country.py index bd92794c8..607601477 100644 --- a/twilio/rest/pricing/v1/voice/country.py +++ b/twilio/rest/pricing/v1/voice/country.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,23 +23,37 @@ class CountryInstance(InstanceResource): - def __init__(self, version, payload, iso_country: Optional[str] = None): - """ - Initialize the CountryInstance - """ + + """ + :ivar country: The name of the country. + :ivar iso_country: The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + :ivar outbound_prefix_prices: The list of OutboundPrefixPrice records, which include a list of the `prefixes`, the `friendly_name`, `base_price`, and the `current_price` for those prefixes. + :ivar inbound_call_prices: The list of [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) records. + :ivar price_unit: The currency in which prices are measured, specified in [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + iso_country: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "country": payload.get("country"), - "iso_country": payload.get("iso_country"), - "outbound_prefix_prices": payload.get("outbound_prefix_prices"), - "inbound_call_prices": payload.get("inbound_call_prices"), - "price_unit": payload.get("price_unit"), - "url": payload.get("url"), - } + self.country: Optional[str] = payload.get("country") + self.iso_country: Optional[str] = payload.get("iso_country") + self.outbound_prefix_prices: Optional[List[str]] = payload.get( + "outbound_prefix_prices" + ) + self.inbound_call_prices: Optional[List[str]] = payload.get( + "inbound_call_prices" + ) + self.price_unit: Optional[str] = payload.get("price_unit") + self.url: Optional[str] = payload.get("url") self._solution = { - "iso_country": iso_country or self._properties["iso_country"], + "iso_country": iso_country or self.iso_country, } self._context: Optional[CountryContext] = None @@ -58,48 +72,6 @@ def _proxy(self) -> "CountryContext": ) return self._context - @property - def country(self) -> str: - """ - :returns: The name of the country. - """ - return self._properties["country"] - - @property - def iso_country(self) -> str: - """ - :returns: The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). - """ - return self._properties["iso_country"] - - @property - def outbound_prefix_prices(self) -> List[str]: - """ - :returns: The list of OutboundPrefixPrice records, which include a list of the `prefixes`, the `friendly_name`, `base_price`, and the `current_price` for those prefixes. - """ - return self._properties["outbound_prefix_prices"] - - @property - def inbound_call_prices(self) -> List[str]: - """ - :returns: The list of [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) records. - """ - return self._properties["inbound_call_prices"] - - @property - def price_unit(self) -> str: - """ - :returns: The currency in which prices are measured, specified in [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). - """ - return self._properties["price_unit"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def fetch(self) -> "CountryInstance": """ Fetch the CountryInstance diff --git a/twilio/rest/pricing/v1/voice/number.py b/twilio/rest/pricing/v1/voice/number.py index 05903da0d..9d2d5288f 100644 --- a/twilio/rest/pricing/v1/voice/number.py +++ b/twilio/rest/pricing/v1/voice/number.py @@ -13,7 +13,7 @@ """ -from typing import Optional +from typing import Any, Dict, Optional from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -21,24 +21,32 @@ class NumberInstance(InstanceResource): - def __init__(self, version, payload, number: Optional[str] = None): - """ - Initialize the NumberInstance - """ + + """ + :ivar number: The phone number. + :ivar country: The name of the country. + :ivar iso_country: The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + :ivar outbound_call_price: + :ivar inbound_call_price: + :ivar price_unit: The currency in which prices are measured, specified in [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], number: Optional[str] = None + ): super().__init__(version) - self._properties = { - "number": payload.get("number"), - "country": payload.get("country"), - "iso_country": payload.get("iso_country"), - "outbound_call_price": payload.get("outbound_call_price"), - "inbound_call_price": payload.get("inbound_call_price"), - "price_unit": payload.get("price_unit"), - "url": payload.get("url"), - } + self.number: Optional[str] = payload.get("number") + self.country: Optional[str] = payload.get("country") + self.iso_country: Optional[str] = payload.get("iso_country") + self.outbound_call_price: Optional[str] = payload.get("outbound_call_price") + self.inbound_call_price: Optional[str] = payload.get("inbound_call_price") + self.price_unit: Optional[str] = payload.get("price_unit") + self.url: Optional[str] = payload.get("url") self._solution = { - "number": number or self._properties["number"], + "number": number or self.number, } self._context: Optional[NumberContext] = None @@ -57,55 +65,6 @@ def _proxy(self) -> "NumberContext": ) return self._context - @property - def number(self) -> str: - """ - :returns: The phone number. - """ - return self._properties["number"] - - @property - def country(self) -> str: - """ - :returns: The name of the country. - """ - return self._properties["country"] - - @property - def iso_country(self) -> str: - """ - :returns: The [ISO country code](http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). - """ - return self._properties["iso_country"] - - @property - def outbound_call_price(self) -> str: - """ - :returns: - """ - return self._properties["outbound_call_price"] - - @property - def inbound_call_price(self) -> str: - """ - :returns: - """ - return self._properties["inbound_call_price"] - - @property - def price_unit(self) -> str: - """ - :returns: The currency in which prices are measured, specified in [ISO 4127](http://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). - """ - return self._properties["price_unit"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def fetch(self) -> "NumberInstance": """ Fetch the NumberInstance diff --git a/twilio/rest/pricing/v2/country.py b/twilio/rest/pricing/v2/country.py index de5af2153..06a544f69 100644 --- a/twilio/rest/pricing/v2/country.py +++ b/twilio/rest/pricing/v2/country.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,23 +23,37 @@ class CountryInstance(InstanceResource): - def __init__(self, version, payload, iso_country: Optional[str] = None): - """ - Initialize the CountryInstance - """ + + """ + :ivar country: The name of the country. + :ivar iso_country: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + :ivar terminating_prefix_prices: The list of [TerminatingPrefixPrice](https://www.twilio.com/docs/voice/pricing#outbound-prefix-price-with-origin) records. + :ivar originating_call_prices: The list of [OriginatingCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) records. + :ivar price_unit: The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + iso_country: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "country": payload.get("country"), - "iso_country": payload.get("iso_country"), - "terminating_prefix_prices": payload.get("terminating_prefix_prices"), - "originating_call_prices": payload.get("originating_call_prices"), - "price_unit": payload.get("price_unit"), - "url": payload.get("url"), - } + self.country: Optional[str] = payload.get("country") + self.iso_country: Optional[str] = payload.get("iso_country") + self.terminating_prefix_prices: Optional[List[str]] = payload.get( + "terminating_prefix_prices" + ) + self.originating_call_prices: Optional[List[str]] = payload.get( + "originating_call_prices" + ) + self.price_unit: Optional[str] = payload.get("price_unit") + self.url: Optional[str] = payload.get("url") self._solution = { - "iso_country": iso_country or self._properties["iso_country"], + "iso_country": iso_country or self.iso_country, } self._context: Optional[CountryContext] = None @@ -58,48 +72,6 @@ def _proxy(self) -> "CountryContext": ) return self._context - @property - def country(self) -> str: - """ - :returns: The name of the country. - """ - return self._properties["country"] - - @property - def iso_country(self) -> str: - """ - :returns: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). - """ - return self._properties["iso_country"] - - @property - def terminating_prefix_prices(self) -> List[str]: - """ - :returns: The list of [TerminatingPrefixPrice](https://www.twilio.com/docs/voice/pricing#outbound-prefix-price-with-origin) records. - """ - return self._properties["terminating_prefix_prices"] - - @property - def originating_call_prices(self) -> List[str]: - """ - :returns: The list of [OriginatingCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) records. - """ - return self._properties["originating_call_prices"] - - @property - def price_unit(self) -> str: - """ - :returns: The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). - """ - return self._properties["price_unit"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def fetch(self) -> "CountryInstance": """ Fetch the CountryInstance diff --git a/twilio/rest/pricing/v2/number.py b/twilio/rest/pricing/v2/number.py index 652e4bbeb..b3d1308eb 100644 --- a/twilio/rest/pricing/v2/number.py +++ b/twilio/rest/pricing/v2/number.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -22,26 +22,41 @@ class NumberInstance(InstanceResource): - def __init__(self, version, payload, destination_number: Optional[str] = None): - """ - Initialize the NumberInstance - """ + + """ + :ivar destination_number: The destination phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + :ivar origination_number: The origination phone number in [[E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + :ivar country: The name of the country. + :ivar iso_country: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) + :ivar terminating_prefix_prices: + :ivar originating_call_price: + :ivar price_unit: The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + destination_number: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "destination_number": payload.get("destination_number"), - "origination_number": payload.get("origination_number"), - "country": payload.get("country"), - "iso_country": payload.get("iso_country"), - "terminating_prefix_prices": payload.get("terminating_prefix_prices"), - "originating_call_price": payload.get("originating_call_price"), - "price_unit": payload.get("price_unit"), - "url": payload.get("url"), - } + self.destination_number: Optional[str] = payload.get("destination_number") + self.origination_number: Optional[str] = payload.get("origination_number") + self.country: Optional[str] = payload.get("country") + self.iso_country: Optional[str] = payload.get("iso_country") + self.terminating_prefix_prices: Optional[List[str]] = payload.get( + "terminating_prefix_prices" + ) + self.originating_call_price: Optional[str] = payload.get( + "originating_call_price" + ) + self.price_unit: Optional[str] = payload.get("price_unit") + self.url: Optional[str] = payload.get("url") self._solution = { - "destination_number": destination_number - or self._properties["destination_number"], + "destination_number": destination_number or self.destination_number, } self._context: Optional[NumberContext] = None @@ -60,62 +75,6 @@ def _proxy(self) -> "NumberContext": ) return self._context - @property - def destination_number(self) -> str: - """ - :returns: The destination phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. - """ - return self._properties["destination_number"] - - @property - def origination_number(self) -> str: - """ - :returns: The origination phone number in [[E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. - """ - return self._properties["origination_number"] - - @property - def country(self) -> str: - """ - :returns: The name of the country. - """ - return self._properties["country"] - - @property - def iso_country(self) -> str: - """ - :returns: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) - """ - return self._properties["iso_country"] - - @property - def terminating_prefix_prices(self) -> List[str]: - """ - :returns: - """ - return self._properties["terminating_prefix_prices"] - - @property - def originating_call_price(self) -> str: - """ - :returns: - """ - return self._properties["originating_call_price"] - - @property - def price_unit(self) -> str: - """ - :returns: The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). - """ - return self._properties["price_unit"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def fetch(self, origination_number=values.unset) -> "NumberInstance": """ Fetch the NumberInstance diff --git a/twilio/rest/pricing/v2/voice/country.py b/twilio/rest/pricing/v2/voice/country.py index 5319d7a14..c6ff87d1e 100644 --- a/twilio/rest/pricing/v2/voice/country.py +++ b/twilio/rest/pricing/v2/voice/country.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,23 +23,37 @@ class CountryInstance(InstanceResource): - def __init__(self, version, payload, iso_country: Optional[str] = None): - """ - Initialize the CountryInstance - """ + + """ + :ivar country: The name of the country. + :ivar iso_country: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + :ivar outbound_prefix_prices: The list of [OutboundPrefixPriceWithOrigin](https://www.twilio.com/docs/voice/pricing#outbound-prefix-price-with-origin) records. + :ivar inbound_call_prices: The list of [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) records. + :ivar price_unit: The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + iso_country: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "country": payload.get("country"), - "iso_country": payload.get("iso_country"), - "outbound_prefix_prices": payload.get("outbound_prefix_prices"), - "inbound_call_prices": payload.get("inbound_call_prices"), - "price_unit": payload.get("price_unit"), - "url": payload.get("url"), - } + self.country: Optional[str] = payload.get("country") + self.iso_country: Optional[str] = payload.get("iso_country") + self.outbound_prefix_prices: Optional[List[str]] = payload.get( + "outbound_prefix_prices" + ) + self.inbound_call_prices: Optional[List[str]] = payload.get( + "inbound_call_prices" + ) + self.price_unit: Optional[str] = payload.get("price_unit") + self.url: Optional[str] = payload.get("url") self._solution = { - "iso_country": iso_country or self._properties["iso_country"], + "iso_country": iso_country or self.iso_country, } self._context: Optional[CountryContext] = None @@ -58,48 +72,6 @@ def _proxy(self) -> "CountryContext": ) return self._context - @property - def country(self) -> str: - """ - :returns: The name of the country. - """ - return self._properties["country"] - - @property - def iso_country(self) -> str: - """ - :returns: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). - """ - return self._properties["iso_country"] - - @property - def outbound_prefix_prices(self) -> List[str]: - """ - :returns: The list of [OutboundPrefixPriceWithOrigin](https://www.twilio.com/docs/voice/pricing#outbound-prefix-price-with-origin) records. - """ - return self._properties["outbound_prefix_prices"] - - @property - def inbound_call_prices(self) -> List[str]: - """ - :returns: The list of [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) records. - """ - return self._properties["inbound_call_prices"] - - @property - def price_unit(self) -> str: - """ - :returns: The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). - """ - return self._properties["price_unit"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def fetch(self) -> "CountryInstance": """ Fetch the CountryInstance diff --git a/twilio/rest/pricing/v2/voice/number.py b/twilio/rest/pricing/v2/voice/number.py index beb4ebd4f..a13a56d8b 100644 --- a/twilio/rest/pricing/v2/voice/number.py +++ b/twilio/rest/pricing/v2/voice/number.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -22,26 +22,39 @@ class NumberInstance(InstanceResource): - def __init__(self, version, payload, destination_number: Optional[str] = None): - """ - Initialize the NumberInstance - """ + + """ + :ivar destination_number: The destination phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + :ivar origination_number: The origination phone number in [[E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + :ivar country: The name of the country. + :ivar iso_country: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) + :ivar outbound_call_prices: The list of [OutboundCallPriceWithOrigin](https://www.twilio.com/docs/voice/pricing#outbound-call-price-with-origin) records. + :ivar inbound_call_price: + :ivar price_unit: The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + destination_number: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "destination_number": payload.get("destination_number"), - "origination_number": payload.get("origination_number"), - "country": payload.get("country"), - "iso_country": payload.get("iso_country"), - "outbound_call_prices": payload.get("outbound_call_prices"), - "inbound_call_price": payload.get("inbound_call_price"), - "price_unit": payload.get("price_unit"), - "url": payload.get("url"), - } + self.destination_number: Optional[str] = payload.get("destination_number") + self.origination_number: Optional[str] = payload.get("origination_number") + self.country: Optional[str] = payload.get("country") + self.iso_country: Optional[str] = payload.get("iso_country") + self.outbound_call_prices: Optional[List[str]] = payload.get( + "outbound_call_prices" + ) + self.inbound_call_price: Optional[str] = payload.get("inbound_call_price") + self.price_unit: Optional[str] = payload.get("price_unit") + self.url: Optional[str] = payload.get("url") self._solution = { - "destination_number": destination_number - or self._properties["destination_number"], + "destination_number": destination_number or self.destination_number, } self._context: Optional[NumberContext] = None @@ -60,62 +73,6 @@ def _proxy(self) -> "NumberContext": ) return self._context - @property - def destination_number(self) -> str: - """ - :returns: The destination phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. - """ - return self._properties["destination_number"] - - @property - def origination_number(self) -> str: - """ - :returns: The origination phone number in [[E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. - """ - return self._properties["origination_number"] - - @property - def country(self) -> str: - """ - :returns: The name of the country. - """ - return self._properties["country"] - - @property - def iso_country(self) -> str: - """ - :returns: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) - """ - return self._properties["iso_country"] - - @property - def outbound_call_prices(self) -> List[str]: - """ - :returns: The list of [OutboundCallPriceWithOrigin](https://www.twilio.com/docs/voice/pricing#outbound-call-price-with-origin) records. - """ - return self._properties["outbound_call_prices"] - - @property - def inbound_call_price(self) -> str: - """ - :returns: - """ - return self._properties["inbound_call_price"] - - @property - def price_unit(self) -> str: - """ - :returns: The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). - """ - return self._properties["price_unit"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def fetch(self, origination_number=values.unset) -> "NumberInstance": """ Fetch the NumberInstance diff --git a/twilio/rest/proxy/v1/service/__init__.py b/twilio/rest/proxy/v1/service/__init__.py index 87f777cb5..c3ecfa799 100644 --- a/twilio/rest/proxy/v1/service/__init__.py +++ b/twilio/rest/proxy/v1/service/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -37,31 +37,59 @@ class NumberSelectionBehavior(object): AVOID_STICKY = "avoid-sticky" PREFER_STICKY = "prefer-sticky" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the ServiceInstance - """ + """ + :ivar sid: The unique string that we created to identify the Service resource. + :ivar unique_name: An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. Supports UTF-8 characters. **This value should not have PII.** + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. + :ivar chat_instance_sid: The SID of the Chat Service Instance managed by Proxy Service. The Chat Service enables Proxy to forward SMS and channel messages to this chat instance. This is a one-to-one relationship. + :ivar callback_url: The URL we call when the interaction status changes. + :ivar default_ttl: The default `ttl` value for Sessions created in the Service. The TTL (time to live) is measured in seconds after the Session's last create or last Interaction. The default value of `0` indicates an unlimited Session length. You can override a Session's default TTL value by setting its `ttl` value. + :ivar number_selection_behavior: + :ivar geo_match_level: + :ivar intercept_callback_url: The URL we call on each interaction. If we receive a 403 status, we block the interaction; otherwise the interaction continues. + :ivar out_of_session_callback_url: The URL we call when an inbound call or SMS action occurs on a closed or non-existent Session. If your server (or a Twilio [function](https://www.twilio.com/functions)) responds with valid [TwiML](https://www.twilio.com/docs/voice/twiml), we will process it. This means it is possible, for example, to play a message for a call, send an automated text message response, or redirect a call to another Phone Number. See [Out-of-Session Callback Response Guide](https://www.twilio.com/docs/proxy/out-session-callback-response-guide) for more information. + :ivar date_created: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. + :ivar date_updated: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. + :ivar url: The absolute URL of the Service resource. + :ivar links: The URLs of resources related to the Service. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "account_sid": payload.get("account_sid"), - "chat_instance_sid": payload.get("chat_instance_sid"), - "callback_url": payload.get("callback_url"), - "default_ttl": deserialize.integer(payload.get("default_ttl")), - "number_selection_behavior": payload.get("number_selection_behavior"), - "geo_match_level": payload.get("geo_match_level"), - "intercept_callback_url": payload.get("intercept_callback_url"), - "out_of_session_callback_url": payload.get("out_of_session_callback_url"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.account_sid: Optional[str] = payload.get("account_sid") + self.chat_instance_sid: Optional[str] = payload.get("chat_instance_sid") + self.callback_url: Optional[str] = payload.get("callback_url") + self.default_ttl: Optional[int] = deserialize.integer( + payload.get("default_ttl") + ) + self.number_selection_behavior: Optional[ + "ServiceInstance.NumberSelectionBehavior" + ] = payload.get("number_selection_behavior") + self.geo_match_level: Optional["ServiceInstance.GeoMatchLevel"] = payload.get( + "geo_match_level" + ) + self.intercept_callback_url: Optional[str] = payload.get( + "intercept_callback_url" + ) + self.out_of_session_callback_url: Optional[str] = payload.get( + "out_of_session_callback_url" + ) + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ServiceContext] = None @@ -80,104 +108,6 @@ def _proxy(self) -> "ServiceContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Service resource. - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. Supports UTF-8 characters. **This value should not have PII.** - """ - return self._properties["unique_name"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. - """ - return self._properties["account_sid"] - - @property - def chat_instance_sid(self) -> str: - """ - :returns: The SID of the Chat Service Instance managed by Proxy Service. The Chat Service enables Proxy to forward SMS and channel messages to this chat instance. This is a one-to-one relationship. - """ - return self._properties["chat_instance_sid"] - - @property - def callback_url(self) -> str: - """ - :returns: The URL we call when the interaction status changes. - """ - return self._properties["callback_url"] - - @property - def default_ttl(self) -> int: - """ - :returns: The default `ttl` value for Sessions created in the Service. The TTL (time to live) is measured in seconds after the Session's last create or last Interaction. The default value of `0` indicates an unlimited Session length. You can override a Session's default TTL value by setting its `ttl` value. - """ - return self._properties["default_ttl"] - - @property - def number_selection_behavior(self) -> "ServiceInstance.NumberSelectionBehavior": - """ - :returns: - """ - return self._properties["number_selection_behavior"] - - @property - def geo_match_level(self) -> "ServiceInstance.GeoMatchLevel": - """ - :returns: - """ - return self._properties["geo_match_level"] - - @property - def intercept_callback_url(self) -> str: - """ - :returns: The URL we call on each interaction. If we receive a 403 status, we block the interaction; otherwise the interaction continues. - """ - return self._properties["intercept_callback_url"] - - @property - def out_of_session_callback_url(self) -> str: - """ - :returns: The URL we call when an inbound call or SMS action occurs on a closed or non-existent Session. If your server (or a Twilio [function](https://www.twilio.com/functions)) responds with valid [TwiML](https://www.twilio.com/docs/voice/twiml), we will process it. This means it is possible, for example, to play a message for a call, send an automated text message response, or redirect a call to another Phone Number. See [Out-of-Session Callback Response Guide](https://www.twilio.com/docs/proxy/out-session-callback-response-guide) for more information. - """ - return self._properties["out_of_session_callback_url"] - - @property - def date_created(self) -> datetime: - """ - :returns: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Service resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of resources related to the Service. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the ServiceInstance diff --git a/twilio/rest/proxy/v1/service/phone_number.py b/twilio/rest/proxy/v1/service/phone_number.py index 2ce995aae..e5adfd21f 100644 --- a/twilio/rest/proxy/v1/service/phone_number.py +++ b/twilio/rest/proxy/v1/service/phone_number.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,30 +24,51 @@ class PhoneNumberInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the PhoneNumberInstance - """ + + """ + :ivar sid: The unique string that we created to identify the PhoneNumber resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PhoneNumber resource. + :ivar service_sid: The SID of the PhoneNumber resource's parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. + :ivar date_created: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. + :ivar date_updated: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. + :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar iso_country: The ISO Country Code for the phone number. + :ivar capabilities: + :ivar url: The absolute URL of the PhoneNumber resource. + :ivar is_reserved: Whether the phone number should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. + :ivar in_use: The number of open session assigned to the number. See the [How many Phone Numbers do I need?](https://www.twilio.com/docs/proxy/phone-numbers-needed) guide for more information. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "phone_number": payload.get("phone_number"), - "friendly_name": payload.get("friendly_name"), - "iso_country": payload.get("iso_country"), - "capabilities": payload.get("capabilities"), - "url": payload.get("url"), - "is_reserved": payload.get("is_reserved"), - "in_use": deserialize.integer(payload.get("in_use")), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.phone_number: Optional[str] = payload.get("phone_number") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.iso_country: Optional[str] = payload.get("iso_country") + self.capabilities: Optional[str] = payload.get("capabilities") + self.url: Optional[str] = payload.get("url") + self.is_reserved: Optional[bool] = payload.get("is_reserved") + self.in_use: Optional[int] = deserialize.integer(payload.get("in_use")) self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[PhoneNumberContext] = None @@ -67,90 +88,6 @@ def _proxy(self) -> "PhoneNumberContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the PhoneNumber resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PhoneNumber resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the PhoneNumber resource's parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. - """ - return self._properties["service_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. - """ - return self._properties["date_updated"] - - @property - def phone_number(self) -> str: - """ - :returns: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. - """ - return self._properties["phone_number"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def iso_country(self) -> str: - """ - :returns: The ISO Country Code for the phone number. - """ - return self._properties["iso_country"] - - @property - def capabilities(self) -> str: - """ - :returns: - """ - return self._properties["capabilities"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the PhoneNumber resource. - """ - return self._properties["url"] - - @property - def is_reserved(self) -> bool: - """ - :returns: Whether the phone number should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. - """ - return self._properties["is_reserved"] - - @property - def in_use(self) -> int: - """ - :returns: The number of open session assigned to the number. See the [How many Phone Numbers do I need?](https://www.twilio.com/docs/proxy/phone-numbers-needed) guide for more information. - """ - return self._properties["in_use"] - def delete(self) -> bool: """ Deletes the PhoneNumberInstance diff --git a/twilio/rest/proxy/v1/service/session/__init__.py b/twilio/rest/proxy/v1/service/session/__init__.py index 2562a07f2..83f8f6534 100644 --- a/twilio/rest/proxy/v1/service/session/__init__.py +++ b/twilio/rest/proxy/v1/service/session/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -38,36 +38,66 @@ class Status(object): FAILED = "failed" UNKNOWN = "unknown" - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the SessionInstance - """ + """ + :ivar sid: The unique string that we created to identify the Session resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/proxy/api/service) the session is associated with. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Session resource. + :ivar date_started: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session started. + :ivar date_ended: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session ended. + :ivar date_last_interaction: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session last had an interaction. + :ivar date_expiry: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session should expire. If this is value is present, it overrides the `ttl` value. + :ivar unique_name: An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. Supports UTF-8 characters. **This value should not have PII.** + :ivar status: + :ivar closed_reason: The reason the Session ended. + :ivar ttl: The time, in seconds, when the session will expire. The time is measured from the last Session create or the Session's last Interaction. + :ivar mode: + :ivar date_created: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. + :ivar date_updated: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. + :ivar url: The absolute URL of the Session resource. + :ivar links: The URLs of resources related to the Session. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "service_sid": payload.get("service_sid"), - "account_sid": payload.get("account_sid"), - "date_started": deserialize.iso8601_datetime(payload.get("date_started")), - "date_ended": deserialize.iso8601_datetime(payload.get("date_ended")), - "date_last_interaction": deserialize.iso8601_datetime( - payload.get("date_last_interaction") - ), - "date_expiry": deserialize.iso8601_datetime(payload.get("date_expiry")), - "unique_name": payload.get("unique_name"), - "status": payload.get("status"), - "closed_reason": payload.get("closed_reason"), - "ttl": deserialize.integer(payload.get("ttl")), - "mode": payload.get("mode"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_started: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_started") + ) + self.date_ended: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_ended") + ) + self.date_last_interaction: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_last_interaction") + ) + self.date_expiry: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_expiry") + ) + self.unique_name: Optional[str] = payload.get("unique_name") + self.status: Optional["SessionInstance.Status"] = payload.get("status") + self.closed_reason: Optional[str] = payload.get("closed_reason") + self.ttl: Optional[int] = deserialize.integer(payload.get("ttl")) + self.mode: Optional["SessionInstance.Mode"] = payload.get("mode") + 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 = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[SessionContext] = None @@ -87,118 +117,6 @@ def _proxy(self) -> "SessionContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Session resource. - """ - return self._properties["sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/proxy/api/service) the session is associated with. - """ - return self._properties["service_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Session resource. - """ - return self._properties["account_sid"] - - @property - def date_started(self) -> datetime: - """ - :returns: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session started. - """ - return self._properties["date_started"] - - @property - def date_ended(self) -> datetime: - """ - :returns: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session ended. - """ - return self._properties["date_ended"] - - @property - def date_last_interaction(self) -> datetime: - """ - :returns: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session last had an interaction. - """ - return self._properties["date_last_interaction"] - - @property - def date_expiry(self) -> datetime: - """ - :returns: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Session should expire. If this is value is present, it overrides the `ttl` value. - """ - return self._properties["date_expiry"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. Supports UTF-8 characters. **This value should not have PII.** - """ - return self._properties["unique_name"] - - @property - def status(self) -> "SessionInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def closed_reason(self) -> str: - """ - :returns: The reason the Session ended. - """ - return self._properties["closed_reason"] - - @property - def ttl(self) -> int: - """ - :returns: The time, in seconds, when the session will expire. The time is measured from the last Session create or the Session's last Interaction. - """ - return self._properties["ttl"] - - @property - def mode(self) -> "SessionInstance.Mode": - """ - :returns: - """ - return self._properties["mode"] - - @property - def date_created(self) -> datetime: - """ - :returns: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Session resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of resources related to the Session. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the SessionInstance diff --git a/twilio/rest/proxy/v1/service/session/interaction.py b/twilio/rest/proxy/v1/service/session/interaction.py index 76ac1a7e8..acec23995 100644 --- a/twilio/rest/proxy/v1/service/session/interaction.py +++ b/twilio/rest/proxy/v1/service/session/interaction.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -52,45 +52,76 @@ class Type(object): VOICE = "voice" UNKNOWN = "unknown" + """ + :ivar sid: The unique string that we created to identify the Interaction resource. + :ivar session_sid: The SID of the parent [Session](https://www.twilio.com/docs/proxy/api/session) resource. + :ivar service_sid: The SID of the parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Interaction resource. + :ivar data: A JSON string that includes the message body of message interactions (e.g. `{\"body\": \"hello\"}`) or the call duration (when available) of a call (e.g. `{\"duration\": \"5\"}`). + :ivar type: + :ivar inbound_participant_sid: The SID of the inbound [Participant](https://www.twilio.com/docs/proxy/api/participant) resource. + :ivar inbound_resource_sid: The SID of the inbound resource; either the [Call](https://www.twilio.com/docs/voice/api/call-resource) or [Message](https://www.twilio.com/docs/sms/api/message. + :ivar inbound_resource_status: + :ivar inbound_resource_type: The inbound resource type. Can be [Call](https://www.twilio.com/docs/voice/api/call-resource) or [Message](https://www.twilio.com/docs/sms/api/message-resource). + :ivar inbound_resource_url: The URL of the Twilio inbound resource + :ivar outbound_participant_sid: The SID of the outbound [Participant](https://www.twilio.com/docs/proxy/api/participant)). + :ivar outbound_resource_sid: The SID of the outbound resource; either the [Call](https://www.twilio.com/docs/voice/api/call-resource) or [Message](https://www.twilio.com/docs/sms/api/message-resource). + :ivar outbound_resource_status: + :ivar outbound_resource_type: The outbound resource type. Can be: [Call](https://www.twilio.com/docs/voice/api/call-resource) or [Message](https://www.twilio.com/docs/sms/api/message-resource). + :ivar outbound_resource_url: The URL of the Twilio outbound resource. + :ivar date_created: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the Interaction was created. + :ivar date_updated: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. + :ivar url: The absolute URL of the Interaction resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, session_sid: str, sid: Optional[str] = None, ): - """ - Initialize the InteractionInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "session_sid": payload.get("session_sid"), - "service_sid": payload.get("service_sid"), - "account_sid": payload.get("account_sid"), - "data": payload.get("data"), - "type": payload.get("type"), - "inbound_participant_sid": payload.get("inbound_participant_sid"), - "inbound_resource_sid": payload.get("inbound_resource_sid"), - "inbound_resource_status": payload.get("inbound_resource_status"), - "inbound_resource_type": payload.get("inbound_resource_type"), - "inbound_resource_url": payload.get("inbound_resource_url"), - "outbound_participant_sid": payload.get("outbound_participant_sid"), - "outbound_resource_sid": payload.get("outbound_resource_sid"), - "outbound_resource_status": payload.get("outbound_resource_status"), - "outbound_resource_type": payload.get("outbound_resource_type"), - "outbound_resource_url": payload.get("outbound_resource_url"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.session_sid: Optional[str] = payload.get("session_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.data: Optional[str] = payload.get("data") + self.type: Optional["InteractionInstance.Type"] = payload.get("type") + self.inbound_participant_sid: Optional[str] = payload.get( + "inbound_participant_sid" + ) + self.inbound_resource_sid: Optional[str] = payload.get("inbound_resource_sid") + self.inbound_resource_status: Optional[ + "InteractionInstance.ResourceStatus" + ] = payload.get("inbound_resource_status") + self.inbound_resource_type: Optional[str] = payload.get("inbound_resource_type") + self.inbound_resource_url: Optional[str] = payload.get("inbound_resource_url") + self.outbound_participant_sid: Optional[str] = payload.get( + "outbound_participant_sid" + ) + self.outbound_resource_sid: Optional[str] = payload.get("outbound_resource_sid") + self.outbound_resource_status: Optional[ + "InteractionInstance.ResourceStatus" + ] = payload.get("outbound_resource_status") + self.outbound_resource_type: Optional[str] = payload.get( + "outbound_resource_type" + ) + self.outbound_resource_url: Optional[str] = payload.get("outbound_resource_url") + 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 = { "service_sid": service_sid, "session_sid": session_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[InteractionContext] = None @@ -111,139 +142,6 @@ def _proxy(self) -> "InteractionContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Interaction resource. - """ - return self._properties["sid"] - - @property - def session_sid(self) -> str: - """ - :returns: The SID of the parent [Session](https://www.twilio.com/docs/proxy/api/session) resource. - """ - return self._properties["session_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. - """ - return self._properties["service_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Interaction resource. - """ - return self._properties["account_sid"] - - @property - def data(self) -> str: - """ - :returns: A JSON string that includes the message body of message interactions (e.g. `{\"body\": \"hello\"}`) or the call duration (when available) of a call (e.g. `{\"duration\": \"5\"}`). - """ - return self._properties["data"] - - @property - def type(self) -> "InteractionInstance.Type": - """ - :returns: - """ - return self._properties["type"] - - @property - def inbound_participant_sid(self) -> str: - """ - :returns: The SID of the inbound [Participant](https://www.twilio.com/docs/proxy/api/participant) resource. - """ - return self._properties["inbound_participant_sid"] - - @property - def inbound_resource_sid(self) -> str: - """ - :returns: The SID of the inbound resource; either the [Call](https://www.twilio.com/docs/voice/api/call-resource) or [Message](https://www.twilio.com/docs/sms/api/message. - """ - return self._properties["inbound_resource_sid"] - - @property - def inbound_resource_status(self) -> "InteractionInstance.ResourceStatus": - """ - :returns: - """ - return self._properties["inbound_resource_status"] - - @property - def inbound_resource_type(self) -> str: - """ - :returns: The inbound resource type. Can be [Call](https://www.twilio.com/docs/voice/api/call-resource) or [Message](https://www.twilio.com/docs/sms/api/message-resource). - """ - return self._properties["inbound_resource_type"] - - @property - def inbound_resource_url(self) -> str: - """ - :returns: The URL of the Twilio inbound resource - """ - return self._properties["inbound_resource_url"] - - @property - def outbound_participant_sid(self) -> str: - """ - :returns: The SID of the outbound [Participant](https://www.twilio.com/docs/proxy/api/participant)). - """ - return self._properties["outbound_participant_sid"] - - @property - def outbound_resource_sid(self) -> str: - """ - :returns: The SID of the outbound resource; either the [Call](https://www.twilio.com/docs/voice/api/call-resource) or [Message](https://www.twilio.com/docs/sms/api/message-resource). - """ - return self._properties["outbound_resource_sid"] - - @property - def outbound_resource_status(self) -> "InteractionInstance.ResourceStatus": - """ - :returns: - """ - return self._properties["outbound_resource_status"] - - @property - def outbound_resource_type(self) -> str: - """ - :returns: The outbound resource type. Can be: [Call](https://www.twilio.com/docs/voice/api/call-resource) or [Message](https://www.twilio.com/docs/sms/api/message-resource). - """ - return self._properties["outbound_resource_type"] - - @property - def outbound_resource_url(self) -> str: - """ - :returns: The URL of the Twilio outbound resource. - """ - return self._properties["outbound_resource_url"] - - @property - def date_created(self) -> datetime: - """ - :returns: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the Interaction was created. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Interaction resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the InteractionInstance diff --git a/twilio/rest/proxy/v1/service/session/participant/__init__.py b/twilio/rest/proxy/v1/service/session/participant/__init__.py index 0337fc498..3c46bbbef 100644 --- a/twilio/rest/proxy/v1/service/session/participant/__init__.py +++ b/twilio/rest/proxy/v1/service/session/participant/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,39 +27,57 @@ class ParticipantInstance(InstanceResource): + + """ + :ivar sid: The unique string that we created to identify the Participant resource. + :ivar session_sid: The SID of the parent [Session](https://www.twilio.com/docs/proxy/api/session) resource. + :ivar service_sid: The SID of the resource's parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Participant resource. + :ivar friendly_name: The string that you assigned to describe the participant. This value must be 255 characters or fewer. Supports UTF-8 characters. **This value should not have PII.** + :ivar identifier: The phone number or channel identifier of the Participant. This value must be 191 characters or fewer. Supports UTF-8 characters. + :ivar proxy_identifier: The phone number or short code (masked number) of the participant's partner. The participant will call or message the partner participant at this number. + :ivar proxy_identifier_sid: The SID of the Proxy Identifier assigned to the Participant. + :ivar date_deleted: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Participant was removed from the session. + :ivar date_created: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. + :ivar date_updated: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. + :ivar url: The absolute URL of the Participant resource. + :ivar links: The URLs to resources related the participant. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, session_sid: str, sid: Optional[str] = None, ): - """ - Initialize the ParticipantInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "session_sid": payload.get("session_sid"), - "service_sid": payload.get("service_sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "identifier": payload.get("identifier"), - "proxy_identifier": payload.get("proxy_identifier"), - "proxy_identifier_sid": payload.get("proxy_identifier_sid"), - "date_deleted": deserialize.iso8601_datetime(payload.get("date_deleted")), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.session_sid: Optional[str] = payload.get("session_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.identifier: Optional[str] = payload.get("identifier") + self.proxy_identifier: Optional[str] = payload.get("proxy_identifier") + self.proxy_identifier_sid: Optional[str] = payload.get("proxy_identifier_sid") + self.date_deleted: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_deleted") + ) + 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 = { "service_sid": service_sid, "session_sid": session_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ParticipantContext] = None @@ -80,97 +98,6 @@ def _proxy(self) -> "ParticipantContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Participant resource. - """ - return self._properties["sid"] - - @property - def session_sid(self) -> str: - """ - :returns: The SID of the parent [Session](https://www.twilio.com/docs/proxy/api/session) resource. - """ - return self._properties["session_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the resource's parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. - """ - return self._properties["service_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Participant resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the participant. This value must be 255 characters or fewer. Supports UTF-8 characters. **This value should not have PII.** - """ - return self._properties["friendly_name"] - - @property - def identifier(self) -> str: - """ - :returns: The phone number or channel identifier of the Participant. This value must be 191 characters or fewer. Supports UTF-8 characters. - """ - return self._properties["identifier"] - - @property - def proxy_identifier(self) -> str: - """ - :returns: The phone number or short code (masked number) of the participant's partner. The participant will call or message the partner participant at this number. - """ - return self._properties["proxy_identifier"] - - @property - def proxy_identifier_sid(self) -> str: - """ - :returns: The SID of the Proxy Identifier assigned to the Participant. - """ - return self._properties["proxy_identifier_sid"] - - @property - def date_deleted(self) -> datetime: - """ - :returns: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the Participant was removed from the session. - """ - return self._properties["date_deleted"] - - @property - def date_created(self) -> datetime: - """ - :returns: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Participant resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs to resources related the participant. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the ParticipantInstance diff --git a/twilio/rest/proxy/v1/service/session/participant/message_interaction.py b/twilio/rest/proxy/v1/service/session/participant/message_interaction.py index a0c707082..dbfecccf1 100644 --- a/twilio/rest/proxy/v1/service/session/participant/message_interaction.py +++ b/twilio/rest/proxy/v1/service/session/participant/message_interaction.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -52,48 +52,80 @@ class Type(object): VOICE = "voice" UNKNOWN = "unknown" + """ + :ivar sid: The unique string that we created to identify the MessageInteraction resource. + :ivar session_sid: The SID of the parent [Session](https://www.twilio.com/docs/proxy/api/session) resource. + :ivar service_sid: The SID of the parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the MessageInteraction resource. + :ivar data: A JSON string that includes the message body sent to the participant. (e.g. `{\"body\": \"hello\"}`) + :ivar type: + :ivar participant_sid: The SID of the [Participant](https://www.twilio.com/docs/proxy/api/participant) resource. + :ivar inbound_participant_sid: Always empty for created Message Interactions. + :ivar inbound_resource_sid: Always empty for created Message Interactions. + :ivar inbound_resource_status: + :ivar inbound_resource_type: Always empty for created Message Interactions. + :ivar inbound_resource_url: Always empty for created Message Interactions. + :ivar outbound_participant_sid: The SID of the outbound [Participant](https://www.twilio.com/docs/proxy/api/participant) resource. + :ivar outbound_resource_sid: The SID of the outbound [Message](https://www.twilio.com/docs/sms/api/message-resource) resource. + :ivar outbound_resource_status: + :ivar outbound_resource_type: The outbound resource type. This value is always `Message`. + :ivar outbound_resource_url: The URL of the Twilio message resource. + :ivar date_created: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. + :ivar date_updated: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. + :ivar url: The absolute URL of the MessageInteraction resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, session_sid: str, participant_sid: str, sid: Optional[str] = None, ): - """ - Initialize the MessageInteractionInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "session_sid": payload.get("session_sid"), - "service_sid": payload.get("service_sid"), - "account_sid": payload.get("account_sid"), - "data": payload.get("data"), - "type": payload.get("type"), - "participant_sid": payload.get("participant_sid"), - "inbound_participant_sid": payload.get("inbound_participant_sid"), - "inbound_resource_sid": payload.get("inbound_resource_sid"), - "inbound_resource_status": payload.get("inbound_resource_status"), - "inbound_resource_type": payload.get("inbound_resource_type"), - "inbound_resource_url": payload.get("inbound_resource_url"), - "outbound_participant_sid": payload.get("outbound_participant_sid"), - "outbound_resource_sid": payload.get("outbound_resource_sid"), - "outbound_resource_status": payload.get("outbound_resource_status"), - "outbound_resource_type": payload.get("outbound_resource_type"), - "outbound_resource_url": payload.get("outbound_resource_url"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.session_sid: Optional[str] = payload.get("session_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.data: Optional[str] = payload.get("data") + self.type: Optional["MessageInteractionInstance.Type"] = payload.get("type") + self.participant_sid: Optional[str] = payload.get("participant_sid") + self.inbound_participant_sid: Optional[str] = payload.get( + "inbound_participant_sid" + ) + self.inbound_resource_sid: Optional[str] = payload.get("inbound_resource_sid") + self.inbound_resource_status: Optional[ + "MessageInteractionInstance.ResourceStatus" + ] = payload.get("inbound_resource_status") + self.inbound_resource_type: Optional[str] = payload.get("inbound_resource_type") + self.inbound_resource_url: Optional[str] = payload.get("inbound_resource_url") + self.outbound_participant_sid: Optional[str] = payload.get( + "outbound_participant_sid" + ) + self.outbound_resource_sid: Optional[str] = payload.get("outbound_resource_sid") + self.outbound_resource_status: Optional[ + "MessageInteractionInstance.ResourceStatus" + ] = payload.get("outbound_resource_status") + self.outbound_resource_type: Optional[str] = payload.get( + "outbound_resource_type" + ) + self.outbound_resource_url: Optional[str] = payload.get("outbound_resource_url") + 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 = { "service_sid": service_sid, "session_sid": session_sid, "participant_sid": participant_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[MessageInteractionContext] = None @@ -115,146 +147,6 @@ def _proxy(self) -> "MessageInteractionContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the MessageInteraction resource. - """ - return self._properties["sid"] - - @property - def session_sid(self) -> str: - """ - :returns: The SID of the parent [Session](https://www.twilio.com/docs/proxy/api/session) resource. - """ - return self._properties["session_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. - """ - return self._properties["service_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the MessageInteraction resource. - """ - return self._properties["account_sid"] - - @property - def data(self) -> str: - """ - :returns: A JSON string that includes the message body sent to the participant. (e.g. `{\"body\": \"hello\"}`) - """ - return self._properties["data"] - - @property - def type(self) -> "MessageInteractionInstance.Type": - """ - :returns: - """ - return self._properties["type"] - - @property - def participant_sid(self) -> str: - """ - :returns: The SID of the [Participant](https://www.twilio.com/docs/proxy/api/participant) resource. - """ - return self._properties["participant_sid"] - - @property - def inbound_participant_sid(self) -> str: - """ - :returns: Always empty for created Message Interactions. - """ - return self._properties["inbound_participant_sid"] - - @property - def inbound_resource_sid(self) -> str: - """ - :returns: Always empty for created Message Interactions. - """ - return self._properties["inbound_resource_sid"] - - @property - def inbound_resource_status(self) -> "MessageInteractionInstance.ResourceStatus": - """ - :returns: - """ - return self._properties["inbound_resource_status"] - - @property - def inbound_resource_type(self) -> str: - """ - :returns: Always empty for created Message Interactions. - """ - return self._properties["inbound_resource_type"] - - @property - def inbound_resource_url(self) -> str: - """ - :returns: Always empty for created Message Interactions. - """ - return self._properties["inbound_resource_url"] - - @property - def outbound_participant_sid(self) -> str: - """ - :returns: The SID of the outbound [Participant](https://www.twilio.com/docs/proxy/api/participant) resource. - """ - return self._properties["outbound_participant_sid"] - - @property - def outbound_resource_sid(self) -> str: - """ - :returns: The SID of the outbound [Message](https://www.twilio.com/docs/sms/api/message-resource) resource. - """ - return self._properties["outbound_resource_sid"] - - @property - def outbound_resource_status(self) -> "MessageInteractionInstance.ResourceStatus": - """ - :returns: - """ - return self._properties["outbound_resource_status"] - - @property - def outbound_resource_type(self) -> str: - """ - :returns: The outbound resource type. This value is always `Message`. - """ - return self._properties["outbound_resource_type"] - - @property - def outbound_resource_url(self) -> str: - """ - :returns: The URL of the Twilio message resource. - """ - return self._properties["outbound_resource_url"] - - @property - def date_created(self) -> datetime: - """ - :returns: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the MessageInteraction resource. - """ - return self._properties["url"] - def fetch(self) -> "MessageInteractionInstance": """ Fetch the MessageInteractionInstance diff --git a/twilio/rest/proxy/v1/service/short_code.py b/twilio/rest/proxy/v1/service/short_code.py index 07669c2af..f808e459d 100644 --- a/twilio/rest/proxy/v1/service/short_code.py +++ b/twilio/rest/proxy/v1/service/short_code.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,28 +24,47 @@ class ShortCodeInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the ShortCodeInstance - """ + + """ + :ivar sid: The unique string that we created to identify the ShortCode resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ShortCode resource. + :ivar service_sid: The SID of the ShortCode resource's parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. + :ivar date_created: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. + :ivar date_updated: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. + :ivar short_code: The short code's number. + :ivar iso_country: The ISO Country Code for the short code. + :ivar capabilities: + :ivar url: The absolute URL of the ShortCode resource. + :ivar is_reserved: Whether the short code should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "short_code": payload.get("short_code"), - "iso_country": payload.get("iso_country"), - "capabilities": payload.get("capabilities"), - "url": payload.get("url"), - "is_reserved": payload.get("is_reserved"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.short_code: Optional[str] = payload.get("short_code") + self.iso_country: Optional[str] = payload.get("iso_country") + self.capabilities: Optional[str] = payload.get("capabilities") + self.url: Optional[str] = payload.get("url") + self.is_reserved: Optional[bool] = payload.get("is_reserved") self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ShortCodeContext] = None @@ -65,76 +84,6 @@ def _proxy(self) -> "ShortCodeContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the ShortCode resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ShortCode resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the ShortCode resource's parent [Service](https://www.twilio.com/docs/proxy/api/service) resource. - """ - return self._properties["service_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated. - """ - return self._properties["date_updated"] - - @property - def short_code(self) -> str: - """ - :returns: The short code's number. - """ - return self._properties["short_code"] - - @property - def iso_country(self) -> str: - """ - :returns: The ISO Country Code for the short code. - """ - return self._properties["iso_country"] - - @property - def capabilities(self) -> str: - """ - :returns: - """ - return self._properties["capabilities"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the ShortCode resource. - """ - return self._properties["url"] - - @property - def is_reserved(self) -> bool: - """ - :returns: Whether the short code should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information. - """ - return self._properties["is_reserved"] - def delete(self) -> bool: """ Deletes the ShortCodeInstance diff --git a/twilio/rest/routes/v2/phone_number.py b/twilio/rest/routes/v2/phone_number.py index fd8dad2c8..cda1513e5 100644 --- a/twilio/rest/routes/v2/phone_number.py +++ b/twilio/rest/routes/v2/phone_number.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Optional +from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,25 +23,41 @@ class PhoneNumberInstance(InstanceResource): - def __init__(self, version, payload, phone_number: Optional[str] = None): - """ - Initialize the PhoneNumberInstance - """ + + """ + :ivar phone_number: The phone number in E.164 format + :ivar url: The absolute URL of the resource. + :ivar sid: A 34 character string that uniquely identifies the Inbound Processing Region assignments for this phone number. + :ivar account_sid: The unique SID identifier of the Account. + :ivar friendly_name: A human readable description of the Inbound Processing Region assignments for this phone number, up to 64 characters. + :ivar voice_region: The Inbound Processing Region used for this phone number for voice. + :ivar date_created: The date that this phone number was assigned an Inbound Processing Region, given in ISO 8601 format. + :ivar date_updated: The date that the Inbound Processing Region was updated for this phone number, given in ISO 8601 format. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + phone_number: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "phone_number": payload.get("phone_number"), - "url": payload.get("url"), - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "voice_region": payload.get("voice_region"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - } + self.phone_number: Optional[str] = payload.get("phone_number") + self.url: Optional[str] = payload.get("url") + 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.voice_region: Optional[str] = payload.get("voice_region") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) self._solution = { - "phone_number": phone_number or self._properties["phone_number"], + "phone_number": phone_number or self.phone_number, } self._context: Optional[PhoneNumberContext] = None @@ -60,62 +76,6 @@ def _proxy(self) -> "PhoneNumberContext": ) return self._context - @property - def phone_number(self) -> str: - """ - :returns: The phone number in E.164 format - """ - return self._properties["phone_number"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies the Inbound Processing Region assignments for this phone number. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The unique SID identifier of the Account. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: A human readable description of the Inbound Processing Region assignments for this phone number, up to 64 characters. - """ - return self._properties["friendly_name"] - - @property - def voice_region(self) -> str: - """ - :returns: The Inbound Processing Region used for this phone number for voice. - """ - return self._properties["voice_region"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this phone number was assigned an Inbound Processing Region, given in ISO 8601 format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that the Inbound Processing Region was updated for this phone number, given in ISO 8601 format. - """ - return self._properties["date_updated"] - def fetch(self) -> "PhoneNumberInstance": """ Fetch the PhoneNumberInstance diff --git a/twilio/rest/routes/v2/sip_domain.py b/twilio/rest/routes/v2/sip_domain.py index cd3d824ff..b4f1cb817 100644 --- a/twilio/rest/routes/v2/sip_domain.py +++ b/twilio/rest/routes/v2/sip_domain.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Optional +from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,25 +23,41 @@ class SipDomainInstance(InstanceResource): - def __init__(self, version, payload, sip_domain: Optional[str] = None): - """ - Initialize the SipDomainInstance - """ + + """ + :ivar sip_domain: + :ivar url: + :ivar sid: + :ivar account_sid: + :ivar friendly_name: + :ivar voice_region: + :ivar date_created: + :ivar date_updated: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + sip_domain: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sip_domain": payload.get("sip_domain"), - "url": payload.get("url"), - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "voice_region": payload.get("voice_region"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - } + self.sip_domain: Optional[str] = payload.get("sip_domain") + self.url: Optional[str] = payload.get("url") + 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.voice_region: Optional[str] = payload.get("voice_region") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) self._solution = { - "sip_domain": sip_domain or self._properties["sip_domain"], + "sip_domain": sip_domain or self.sip_domain, } self._context: Optional[SipDomainContext] = None @@ -60,62 +76,6 @@ def _proxy(self) -> "SipDomainContext": ) return self._context - @property - def sip_domain(self) -> str: - """ - :returns: - """ - return self._properties["sip_domain"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - - @property - def sid(self) -> str: - """ - :returns: - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: - """ - return self._properties["friendly_name"] - - @property - def voice_region(self) -> str: - """ - :returns: - """ - return self._properties["voice_region"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: - """ - return self._properties["date_updated"] - def fetch(self) -> "SipDomainInstance": """ Fetch the SipDomainInstance diff --git a/twilio/rest/routes/v2/trunk.py b/twilio/rest/routes/v2/trunk.py index b6add4ee7..1b5f8954b 100644 --- a/twilio/rest/routes/v2/trunk.py +++ b/twilio/rest/routes/v2/trunk.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Optional +from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,26 +23,41 @@ class TrunkInstance(InstanceResource): - def __init__(self, version, payload, sip_trunk_domain: Optional[str] = None): - """ - Initialize the TrunkInstance - """ + + """ + :ivar sip_trunk_domain: The absolute URL of the SIP Trunk + :ivar url: The absolute URL of the resource. + :ivar sid: A 34 character string that uniquely identifies the Inbound Processing Region assignments for this SIP Trunk. + :ivar account_sid: The unique SID identifier of the Account. + :ivar friendly_name: A human readable description of the Inbound Processing Region assignments for this SIP Trunk, up to 64 characters. + :ivar voice_region: The Inbound Processing Region used for this SIP Trunk for voice. + :ivar date_created: The date that this SIP Trunk was assigned an Inbound Processing Region, given in ISO 8601 format. + :ivar date_updated: The date that the Inbound Processing Region was updated for this SIP Trunk, given in ISO 8601 format. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + sip_trunk_domain: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sip_trunk_domain": payload.get("sip_trunk_domain"), - "url": payload.get("url"), - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "voice_region": payload.get("voice_region"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - } + self.sip_trunk_domain: Optional[str] = payload.get("sip_trunk_domain") + self.url: Optional[str] = payload.get("url") + 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.voice_region: Optional[str] = payload.get("voice_region") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) self._solution = { - "sip_trunk_domain": sip_trunk_domain - or self._properties["sip_trunk_domain"], + "sip_trunk_domain": sip_trunk_domain or self.sip_trunk_domain, } self._context: Optional[TrunkContext] = None @@ -61,62 +76,6 @@ def _proxy(self) -> "TrunkContext": ) return self._context - @property - def sip_trunk_domain(self) -> str: - """ - :returns: The absolute URL of the SIP Trunk - """ - return self._properties["sip_trunk_domain"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies the Inbound Processing Region assignments for this SIP Trunk. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The unique SID identifier of the Account. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: A human readable description of the Inbound Processing Region assignments for this SIP Trunk, up to 64 characters. - """ - return self._properties["friendly_name"] - - @property - def voice_region(self) -> str: - """ - :returns: The Inbound Processing Region used for this SIP Trunk for voice. - """ - return self._properties["voice_region"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this SIP Trunk was assigned an Inbound Processing Region, given in ISO 8601 format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that the Inbound Processing Region was updated for this SIP Trunk, given in ISO 8601 format. - """ - return self._properties["date_updated"] - def fetch(self) -> "TrunkInstance": """ Fetch the TrunkInstance diff --git a/twilio/rest/serverless/v1/service/__init__.py b/twilio/rest/serverless/v1/service/__init__.py index 1777a3229..e6ac74a1d 100644 --- a/twilio/rest/serverless/v1/service/__init__.py +++ b/twilio/rest/serverless/v1/service/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,28 +28,44 @@ class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the ServiceInstance - """ + + """ + :ivar sid: The unique string that we created to identify the Service resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. + :ivar friendly_name: The string that you assigned to describe the Service resource. + :ivar unique_name: A user-defined string that uniquely identifies the Service resource. It can be used in place of the Service resource's `sid` in the URL to address the Service resource. + :ivar include_credentials: Whether to inject Account credentials into a function invocation context. + :ivar ui_editable: Whether the Service resource's properties and subresources can be edited via the UI. + :ivar domain_base: The base domain name for this Service, which is a combination of the unique name and a randomly generated string. + :ivar date_created: The date and time in GMT when the Service 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 Service resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the Service resource. + :ivar links: The URLs of the Service's nested resources. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "unique_name": payload.get("unique_name"), - "include_credentials": payload.get("include_credentials"), - "ui_editable": payload.get("ui_editable"), - "domain_base": payload.get("domain_base"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + 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.unique_name: Optional[str] = payload.get("unique_name") + self.include_credentials: Optional[bool] = payload.get("include_credentials") + self.ui_editable: Optional[bool] = payload.get("ui_editable") + self.domain_base: Optional[str] = payload.get("domain_base") + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ServiceContext] = None @@ -68,83 +84,6 @@ def _proxy(self) -> "ServiceContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Service resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the Service resource. - """ - return self._properties["friendly_name"] - - @property - def unique_name(self) -> str: - """ - :returns: A user-defined string that uniquely identifies the Service resource. It can be used in place of the Service resource's `sid` in the URL to address the Service resource. - """ - return self._properties["unique_name"] - - @property - def include_credentials(self) -> bool: - """ - :returns: Whether to inject Account credentials into a function invocation context. - """ - return self._properties["include_credentials"] - - @property - def ui_editable(self) -> bool: - """ - :returns: Whether the Service resource's properties and subresources can be edited via the UI. - """ - return self._properties["ui_editable"] - - @property - def domain_base(self) -> str: - """ - :returns: The base domain name for this Service, which is a combination of the unique name and a randomly generated string. - """ - return self._properties["domain_base"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the Service resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the Service resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Service resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of the Service's nested resources. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the ServiceInstance diff --git a/twilio/rest/serverless/v1/service/asset/__init__.py b/twilio/rest/serverless/v1/service/asset/__init__.py index 9827b5bc7..75e0c1bd8 100644 --- a/twilio/rest/serverless/v1/service/asset/__init__.py +++ b/twilio/rest/serverless/v1/service/asset/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -25,26 +25,43 @@ class AssetInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the AssetInstance - """ + + """ + :ivar sid: The unique string that we created to identify the Asset resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Asset resource. + :ivar service_sid: The SID of the Service that the Asset resource is associated with. + :ivar friendly_name: The string that you assigned to describe the Asset resource. It can be a maximum of 255 characters. + :ivar date_created: The date and time in GMT when the Asset 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 Asset resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the Asset resource. + :ivar links: The URLs of the Asset resource's nested resources. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "friendly_name": payload.get("friendly_name"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + 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 = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[AssetContext] = None @@ -64,62 +81,6 @@ def _proxy(self) -> "AssetContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Asset resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Asset resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the Service that the Asset resource is associated with. - """ - return self._properties["service_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the Asset resource. It can be a maximum of 255 characters. - """ - return self._properties["friendly_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the Asset resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the Asset resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Asset resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of the Asset resource's nested resources. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the AssetInstance diff --git a/twilio/rest/serverless/v1/service/asset/asset_version.py b/twilio/rest/serverless/v1/service/asset/asset_version.py index f934c8f0e..5bfcd562a 100644 --- a/twilio/rest/serverless/v1/service/asset/asset_version.py +++ b/twilio/rest/serverless/v1/service/asset/asset_version.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -29,34 +29,44 @@ class Visibility(object): PRIVATE = "private" PROTECTED = "protected" + """ + :ivar sid: The unique string that we created to identify the Asset Version resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Asset Version resource. + :ivar service_sid: The SID of the Service that the Asset Version resource is associated with. + :ivar asset_sid: The SID of the Asset resource that is the parent of the Asset Version. + :ivar path: The URL-friendly string by which the Asset Version can be referenced. It can be a maximum of 255 characters. All paths begin with a forward slash ('/'). If an Asset Version creation request is submitted with a path not containing a leading slash, the path will automatically be prepended with one. + :ivar visibility: + :ivar date_created: The date and time in GMT when the Asset Version resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the Asset Version resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, asset_sid: str, sid: Optional[str] = None, ): - """ - Initialize the AssetVersionInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "asset_sid": payload.get("asset_sid"), - "path": payload.get("path"), - "visibility": payload.get("visibility"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.asset_sid: Optional[str] = payload.get("asset_sid") + self.path: Optional[str] = payload.get("path") + self.visibility: Optional["AssetVersionInstance.Visibility"] = payload.get( + "visibility" + ) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, "asset_sid": asset_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[AssetVersionContext] = None @@ -77,62 +87,6 @@ def _proxy(self) -> "AssetVersionContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Asset Version resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Asset Version resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the Service that the Asset Version resource is associated with. - """ - return self._properties["service_sid"] - - @property - def asset_sid(self) -> str: - """ - :returns: The SID of the Asset resource that is the parent of the Asset Version. - """ - return self._properties["asset_sid"] - - @property - def path(self) -> str: - """ - :returns: The URL-friendly string by which the Asset Version can be referenced. It can be a maximum of 255 characters. All paths begin with a forward slash ('/'). If an Asset Version creation request is submitted with a path not containing a leading slash, the path will automatically be prepended with one. - """ - return self._properties["path"] - - @property - def visibility(self) -> "AssetVersionInstance.Visibility": - """ - :returns: - """ - return self._properties["visibility"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the Asset Version resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Asset Version resource. - """ - return self._properties["url"] - def fetch(self) -> "AssetVersionInstance": """ Fetch the AssetVersionInstance diff --git a/twilio/rest/serverless/v1/service/build/__init__.py b/twilio/rest/serverless/v1/service/build/__init__.py index b4314c2fc..5a63b90fe 100644 --- a/twilio/rest/serverless/v1/service/build/__init__.py +++ b/twilio/rest/serverless/v1/service/build/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -38,28 +38,39 @@ class Status(object): COMPLETED = "completed" FAILED = "failed" - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the BuildInstance - """ + """ + :ivar sid: The unique string that we created to identify the Build resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Build resource. + :ivar service_sid: The SID of the Service that the Build resource is associated with. + :ivar status: + :ivar asset_versions: The list of Asset Version resource SIDs that are included in the Build. + :ivar function_versions: The list of Function Version resource SIDs that are included in the Build. + :ivar dependencies: A list of objects that describe the Dependencies included in the Build. Each object contains the `name` and `version` of the dependency. + :ivar runtime: + :ivar date_created: The date and time in GMT when the Build 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 Build resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the Build resource. + :ivar links: + """ + + def __init__(self, version: Version, payload: Dict[str, Any], service_sid: str, sid: Optional[str] = None): super().__init__(version) - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'status': payload.get('status'), - 'asset_versions': payload.get('asset_versions'), - 'function_versions': payload.get('function_versions'), - 'dependencies': payload.get('dependencies'), - 'runtime': payload.get('runtime'), - 'date_created': deserialize.iso8601_datetime(payload.get('date_created')), - 'date_updated': deserialize.iso8601_datetime(payload.get('date_updated')), - 'url': payload.get('url'), - 'links': payload.get('links'), - } - - self._solution = { 'service_sid': service_sid, 'sid': sid or self._properties['sid'], } + + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.status: Optional["BuildInstance.Status"] = payload.get("status") + self.asset_versions: Optional[List[object]] = payload.get("asset_versions") + self.function_versions: Optional[List[object]] = payload.get("function_versions") + self.dependencies: Optional[List[object]] = payload.get("dependencies") + self.runtime: Optional["BuildInstance.Runtime"] = payload.get("runtime") + 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 = { "service_sid": service_sid, "sid": sid or self.sid, } self._context: Optional[BuildContext] = None @property @@ -74,90 +85,6 @@ def _proxy(self) -> "BuildContext": self._context = BuildContext(self._version, service_sid=self._solution['service_sid'], sid=self._solution['sid'],) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Build resource. - """ - return self._properties['sid'] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Build resource. - """ - return self._properties['account_sid'] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the Service that the Build resource is associated with. - """ - return self._properties['service_sid'] - - @property - def status(self) -> "BuildInstance.Status": - """ - :returns: - """ - return self._properties['status'] - - @property - def asset_versions(self) -> List[object]: - """ - :returns: The list of Asset Version resource SIDs that are included in the Build. - """ - return self._properties['asset_versions'] - - @property - def function_versions(self) -> List[object]: - """ - :returns: The list of Function Version resource SIDs that are included in the Build. - """ - return self._properties['function_versions'] - - @property - def dependencies(self) -> List[object]: - """ - :returns: A list of objects that describe the Dependencies included in the Build. Each object contains the `name` and `version` of the dependency. - """ - return self._properties['dependencies'] - - @property - def runtime(self) -> "BuildInstance.Runtime": - """ - :returns: - """ - return self._properties['runtime'] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the Build resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties['date_created'] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the Build resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties['date_updated'] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Build resource. - """ - return self._properties['url'] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties['links'] - def delete(self) -> bool: """ diff --git a/twilio/rest/serverless/v1/service/build/build_status.py b/twilio/rest/serverless/v1/service/build/build_status.py index 30b76fcab..37555eda7 100644 --- a/twilio/rest/serverless/v1/service/build/build_status.py +++ b/twilio/rest/serverless/v1/service/build/build_status.py @@ -13,7 +13,7 @@ """ -from typing import Optional +from typing import Any, Dict, Optional from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -28,21 +28,25 @@ class Status(object): COMPLETED = "completed" FAILED = "failed" - def __init__(self, version, payload, service_sid: str, sid: str): - """ - Initialize the BuildStatusInstance - """ + """ + :ivar sid: The unique string that we created to identify the Build resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Build resource. + :ivar service_sid: The SID of the Service that the Build resource is associated with. + :ivar status: + :ivar url: The absolute URL of the Build Status resource. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], service_sid: str, sid: str): super().__init__(version) - self._properties = { - 'sid': payload.get('sid'), - 'account_sid': payload.get('account_sid'), - 'service_sid': payload.get('service_sid'), - 'status': payload.get('status'), - 'url': payload.get('url'), - } + + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.status: Optional["BuildStatusInstance.Status"] = payload.get("status") + self.url: Optional[str] = payload.get("url") - self._solution = { 'service_sid': service_sid, 'sid': sid, } + self._solution = { "service_sid": service_sid, "sid": sid, } self._context: Optional[BuildStatusContext] = None @property @@ -57,41 +61,6 @@ def _proxy(self) -> "BuildStatusContext": self._context = BuildStatusContext(self._version, service_sid=self._solution['service_sid'], sid=self._solution['sid'],) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Build resource. - """ - return self._properties['sid'] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Build resource. - """ - return self._properties['account_sid'] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the Service that the Build resource is associated with. - """ - return self._properties['service_sid'] - - @property - def status(self) -> "BuildStatusInstance.Status": - """ - :returns: - """ - return self._properties['status'] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Build Status resource. - """ - return self._properties['url'] - def fetch(self) -> "BuildStatusInstance": """ diff --git a/twilio/rest/serverless/v1/service/environment/__init__.py b/twilio/rest/serverless/v1/service/environment/__init__.py index 342282b87..968b91940 100644 --- a/twilio/rest/serverless/v1/service/environment/__init__.py +++ b/twilio/rest/serverless/v1/service/environment/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,29 +27,49 @@ class EnvironmentInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the EnvironmentInstance - """ + + """ + :ivar sid: The unique string that we created to identify the Environment resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Environment resource. + :ivar service_sid: The SID of the Service that the Environment resource is associated with. + :ivar build_sid: The SID of the build deployed in the environment. + :ivar unique_name: A user-defined string that uniquely identifies the Environment resource. + :ivar domain_suffix: A URL-friendly name that represents the environment and forms part of the domain name. + :ivar domain_name: The domain name for all Functions and Assets deployed in the Environment, using the Service unique name, a randomly-generated Service suffix, and an optional Environment domain suffix. + :ivar date_created: The date and time in GMT when the Environment 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 Environment resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the Environment resource. + :ivar links: The URLs of the Environment resource's nested resources. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "build_sid": payload.get("build_sid"), - "unique_name": payload.get("unique_name"), - "domain_suffix": payload.get("domain_suffix"), - "domain_name": payload.get("domain_name"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.build_sid: Optional[str] = payload.get("build_sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.domain_suffix: Optional[str] = payload.get("domain_suffix") + self.domain_name: Optional[str] = payload.get("domain_name") + 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 = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[EnvironmentContext] = None @@ -69,83 +89,6 @@ def _proxy(self) -> "EnvironmentContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Environment resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Environment resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the Service that the Environment resource is associated with. - """ - return self._properties["service_sid"] - - @property - def build_sid(self) -> str: - """ - :returns: The SID of the build deployed in the environment. - """ - return self._properties["build_sid"] - - @property - def unique_name(self) -> str: - """ - :returns: A user-defined string that uniquely identifies the Environment resource. - """ - return self._properties["unique_name"] - - @property - def domain_suffix(self) -> str: - """ - :returns: A URL-friendly name that represents the environment and forms part of the domain name. - """ - return self._properties["domain_suffix"] - - @property - def domain_name(self) -> str: - """ - :returns: The domain name for all Functions and Assets deployed in the Environment, using the Service unique name, a randomly-generated Service suffix, and an optional Environment domain suffix. - """ - return self._properties["domain_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the Environment resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the Environment resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Environment resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of the Environment resource's nested resources. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the EnvironmentInstance diff --git a/twilio/rest/serverless/v1/service/environment/deployment.py b/twilio/rest/serverless/v1/service/environment/deployment.py index 469bf7f01..9d0ddb194 100644 --- a/twilio/rest/serverless/v1/service/environment/deployment.py +++ b/twilio/rest/serverless/v1/service/environment/deployment.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,34 +24,45 @@ class DeploymentInstance(InstanceResource): + + """ + :ivar sid: The unique string that we created to identify the Deployment resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Deployment resource. + :ivar service_sid: The SID of the Service that the Deployment resource is associated with. + :ivar environment_sid: The SID of the Environment for the Deployment. + :ivar build_sid: The SID of the Build for the deployment. + :ivar date_created: The date and time in GMT when the Deployment 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 Deployment resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the Deployment resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, environment_sid: str, sid: Optional[str] = None, ): - """ - Initialize the DeploymentInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "environment_sid": payload.get("environment_sid"), - "build_sid": payload.get("build_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.environment_sid: Optional[str] = payload.get("environment_sid") + self.build_sid: Optional[str] = payload.get("build_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, "environment_sid": environment_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[DeploymentContext] = None @@ -72,62 +83,6 @@ def _proxy(self) -> "DeploymentContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Deployment resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Deployment resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the Service that the Deployment resource is associated with. - """ - return self._properties["service_sid"] - - @property - def environment_sid(self) -> str: - """ - :returns: The SID of the Environment for the Deployment. - """ - return self._properties["environment_sid"] - - @property - def build_sid(self) -> str: - """ - :returns: The SID of the Build for the deployment. - """ - return self._properties["build_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the Deployment resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the Deployment resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Deployment resource. - """ - return self._properties["url"] - def fetch(self) -> "DeploymentInstance": """ Fetch the DeploymentInstance diff --git a/twilio/rest/serverless/v1/service/environment/log.py b/twilio/rest/serverless/v1/service/environment/log.py index 3a03d3510..47ca9eab0 100644 --- a/twilio/rest/serverless/v1/service/environment/log.py +++ b/twilio/rest/serverless/v1/service/environment/log.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -29,38 +29,50 @@ class Level(object): WARN = "warn" ERROR = "error" + """ + :ivar sid: The unique string that we created to identify the Log resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Log resource. + :ivar service_sid: The SID of the Service that the Log resource is associated with. + :ivar environment_sid: The SID of the environment in which the log occurred. + :ivar build_sid: The SID of the build that corresponds to the log. + :ivar deployment_sid: The SID of the deployment that corresponds to the log. + :ivar function_sid: The SID of the function whose invocation produced the log. + :ivar request_sid: The SID of the request associated with the log. + :ivar level: + :ivar message: The log message. + :ivar date_created: The date and time in GMT when the Log resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the Log resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, environment_sid: str, sid: Optional[str] = None, ): - """ - Initialize the LogInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "environment_sid": payload.get("environment_sid"), - "build_sid": payload.get("build_sid"), - "deployment_sid": payload.get("deployment_sid"), - "function_sid": payload.get("function_sid"), - "request_sid": payload.get("request_sid"), - "level": payload.get("level"), - "message": payload.get("message"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.environment_sid: Optional[str] = payload.get("environment_sid") + self.build_sid: Optional[str] = payload.get("build_sid") + self.deployment_sid: Optional[str] = payload.get("deployment_sid") + self.function_sid: Optional[str] = payload.get("function_sid") + self.request_sid: Optional[str] = payload.get("request_sid") + self.level: Optional["LogInstance.Level"] = payload.get("level") + self.message: Optional[str] = payload.get("message") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, "environment_sid": environment_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[LogContext] = None @@ -81,90 +93,6 @@ def _proxy(self) -> "LogContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Log resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Log resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the Service that the Log resource is associated with. - """ - return self._properties["service_sid"] - - @property - def environment_sid(self) -> str: - """ - :returns: The SID of the environment in which the log occurred. - """ - return self._properties["environment_sid"] - - @property - def build_sid(self) -> str: - """ - :returns: The SID of the build that corresponds to the log. - """ - return self._properties["build_sid"] - - @property - def deployment_sid(self) -> str: - """ - :returns: The SID of the deployment that corresponds to the log. - """ - return self._properties["deployment_sid"] - - @property - def function_sid(self) -> str: - """ - :returns: The SID of the function whose invocation produced the log. - """ - return self._properties["function_sid"] - - @property - def request_sid(self) -> str: - """ - :returns: The SID of the request associated with the log. - """ - return self._properties["request_sid"] - - @property - def level(self) -> "LogInstance.Level": - """ - :returns: - """ - return self._properties["level"] - - @property - def message(self) -> str: - """ - :returns: The log message. - """ - return self._properties["message"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the Log resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Log resource. - """ - return self._properties["url"] - def fetch(self) -> "LogInstance": """ Fetch the LogInstance diff --git a/twilio/rest/serverless/v1/service/environment/variable.py b/twilio/rest/serverless/v1/service/environment/variable.py index 443a6dfa4..cc560bb71 100644 --- a/twilio/rest/serverless/v1/service/environment/variable.py +++ b/twilio/rest/serverless/v1/service/environment/variable.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,35 +24,47 @@ class VariableInstance(InstanceResource): + + """ + :ivar sid: The unique string that we created to identify the Variable resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Variable resource. + :ivar service_sid: The SID of the Service that the Variable resource is associated with. + :ivar environment_sid: The SID of the Environment in which the Variable exists. + :ivar key: A string by which the Variable resource can be referenced. + :ivar value: A string that contains the actual value of the Variable. + :ivar date_created: The date and time in GMT when the Variable 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 Variable resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the Variable resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, environment_sid: str, sid: Optional[str] = None, ): - """ - Initialize the VariableInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "environment_sid": payload.get("environment_sid"), - "key": payload.get("key"), - "value": payload.get("value"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.environment_sid: Optional[str] = payload.get("environment_sid") + self.key: Optional[str] = payload.get("key") + self.value: Optional[str] = payload.get("value") + 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 = { "service_sid": service_sid, "environment_sid": environment_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[VariableContext] = None @@ -73,69 +85,6 @@ def _proxy(self) -> "VariableContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Variable resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Variable resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the Service that the Variable resource is associated with. - """ - return self._properties["service_sid"] - - @property - def environment_sid(self) -> str: - """ - :returns: The SID of the Environment in which the Variable exists. - """ - return self._properties["environment_sid"] - - @property - def key(self) -> str: - """ - :returns: A string by which the Variable resource can be referenced. - """ - return self._properties["key"] - - @property - def value(self) -> str: - """ - :returns: A string that contains the actual value of the Variable. - """ - return self._properties["value"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the Variable resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the Variable resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Variable resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the VariableInstance diff --git a/twilio/rest/serverless/v1/service/function/__init__.py b/twilio/rest/serverless/v1/service/function/__init__.py index aab2b7caa..50b495b8b 100644 --- a/twilio/rest/serverless/v1/service/function/__init__.py +++ b/twilio/rest/serverless/v1/service/function/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,26 +27,43 @@ class FunctionInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the FunctionInstance - """ + + """ + :ivar sid: The unique string that we created to identify the Function resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Function resource. + :ivar service_sid: The SID of the Service that the Function resource is associated with. + :ivar friendly_name: The string that you assigned to describe the Function resource. It can be a maximum of 255 characters. + :ivar date_created: The date and time in GMT when the Function 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 Function resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the Function resource. + :ivar links: The URLs of nested resources of the Function resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "friendly_name": payload.get("friendly_name"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + 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 = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[FunctionContext] = None @@ -66,62 +83,6 @@ def _proxy(self) -> "FunctionContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Function resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Function resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the Service that the Function resource is associated with. - """ - return self._properties["service_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the Function resource. It can be a maximum of 255 characters. - """ - return self._properties["friendly_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the Function resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the Function resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Function resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of nested resources of the Function resource. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the FunctionInstance diff --git a/twilio/rest/serverless/v1/service/function/function_version/__init__.py b/twilio/rest/serverless/v1/service/function/function_version/__init__.py index 06d019d7c..2bb526738 100644 --- a/twilio/rest/serverless/v1/service/function/function_version/__init__.py +++ b/twilio/rest/serverless/v1/service/function/function_version/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -32,35 +32,46 @@ class Visibility(object): PRIVATE = "private" PROTECTED = "protected" + """ + :ivar sid: The unique string that we created to identify the Function Version resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Function Version resource. + :ivar service_sid: The SID of the Service that the Function Version resource is associated with. + :ivar function_sid: The SID of the Function resource that is the parent of the Function Version resource. + :ivar path: The URL-friendly string by which the Function Version resource can be referenced. It can be a maximum of 255 characters. All paths begin with a forward slash ('/'). If a Function Version creation request is submitted with a path not containing a leading slash, the path will automatically be prepended with one. + :ivar visibility: + :ivar date_created: The date and time in GMT when the Function Version resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the Function Version resource. + :ivar links: + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, function_sid: str, sid: Optional[str] = None, ): - """ - Initialize the FunctionVersionInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "function_sid": payload.get("function_sid"), - "path": payload.get("path"), - "visibility": payload.get("visibility"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.function_sid: Optional[str] = payload.get("function_sid") + self.path: Optional[str] = payload.get("path") + self.visibility: Optional["FunctionVersionInstance.Visibility"] = payload.get( + "visibility" + ) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "service_sid": service_sid, "function_sid": function_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[FunctionVersionContext] = None @@ -81,69 +92,6 @@ def _proxy(self) -> "FunctionVersionContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Function Version resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Function Version resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the Service that the Function Version resource is associated with. - """ - return self._properties["service_sid"] - - @property - def function_sid(self) -> str: - """ - :returns: The SID of the Function resource that is the parent of the Function Version resource. - """ - return self._properties["function_sid"] - - @property - def path(self) -> str: - """ - :returns: The URL-friendly string by which the Function Version resource can be referenced. It can be a maximum of 255 characters. All paths begin with a forward slash ('/'). If a Function Version creation request is submitted with a path not containing a leading slash, the path will automatically be prepended with one. - """ - return self._properties["path"] - - @property - def visibility(self) -> "FunctionVersionInstance.Visibility": - """ - :returns: - """ - return self._properties["visibility"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the Function Version resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Function Version resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - def fetch(self) -> "FunctionVersionInstance": """ Fetch the FunctionVersionInstance diff --git a/twilio/rest/serverless/v1/service/function/function_version/function_version_content.py b/twilio/rest/serverless/v1/service/function/function_version/function_version_content.py index a7218b672..c39f9f071 100644 --- a/twilio/rest/serverless/v1/service/function/function_version/function_version_content.py +++ b/twilio/rest/serverless/v1/service/function/function_version/function_version_content.py @@ -13,7 +13,7 @@ """ -from typing import Optional +from typing import Any, Dict, Optional from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -21,20 +21,32 @@ class FunctionVersionContentInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, function_sid: str, sid: str): - """ - Initialize the FunctionVersionContentInstance - """ + + """ + :ivar sid: The unique string that we created to identify the Function Version resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Function Version resource. + :ivar service_sid: The SID of the Service that the Function Version resource is associated with. + :ivar function_sid: The SID of the Function that is the parent of the Function Version. + :ivar content: The content of the Function Version resource. + :ivar url: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + function_sid: str, + sid: str, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "function_sid": payload.get("function_sid"), - "content": payload.get("content"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.function_sid: Optional[str] = payload.get("function_sid") + self.content: Optional[str] = payload.get("content") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, @@ -60,48 +72,6 @@ def _proxy(self) -> "FunctionVersionContentContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Function Version resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Function Version resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the Service that the Function Version resource is associated with. - """ - return self._properties["service_sid"] - - @property - def function_sid(self) -> str: - """ - :returns: The SID of the Function that is the parent of the Function Version. - """ - return self._properties["function_sid"] - - @property - def content(self) -> str: - """ - :returns: The content of the Function Version resource. - """ - return self._properties["content"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def fetch(self) -> "FunctionVersionContentInstance": """ Fetch the FunctionVersionContentInstance diff --git a/twilio/rest/studio/v1/flow/__init__.py b/twilio/rest/studio/v1/flow/__init__.py index 26dcb9bf6..5fb6ab88e 100644 --- a/twilio/rest/studio/v1/flow/__init__.py +++ b/twilio/rest/studio/v1/flow/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -30,26 +30,39 @@ class Status(object): DRAFT = "draft" PUBLISHED = "published" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the FlowInstance - """ + """ + :ivar sid: The unique string that we created to identify the Flow resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flow resource. + :ivar friendly_name: The string that you assigned to describe the Flow. + :ivar status: + :ivar version: The latest version number of the Flow's definition. + :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 resource. + :ivar links: The URLs of the Flow's nested resources. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "status": payload.get("status"), - "version": deserialize.integer(payload.get("version")), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + 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.status: Optional["FlowInstance.Status"] = payload.get("status") + self.version: Optional[int] = deserialize.integer(payload.get("version")) + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[FlowContext] = None @@ -68,69 +81,6 @@ def _proxy(self) -> "FlowContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Flow resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flow resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the Flow. - """ - return self._properties["friendly_name"] - - @property - def status(self) -> "FlowInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def version(self) -> int: - """ - :returns: The latest version number of the Flow's definition. - """ - return self._properties["version"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of the Flow's nested resources. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the FlowInstance diff --git a/twilio/rest/studio/v1/flow/engagement/__init__.py b/twilio/rest/studio/v1/flow/engagement/__init__.py index 89808e1b7..5272d6810 100644 --- a/twilio/rest/studio/v1/flow/engagement/__init__.py +++ b/twilio/rest/studio/v1/flow/engagement/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -32,29 +32,50 @@ class Status(object): ACTIVE = "active" ENDED = "ended" - def __init__(self, version, payload, flow_sid: str, sid: Optional[str] = None): - """ - Initialize the EngagementInstance - """ + """ + :ivar sid: The unique string that we created to identify the Engagement resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Engagement resource. + :ivar flow_sid: The SID of the Flow. + :ivar contact_sid: The SID of the Contact. + :ivar contact_channel_address: The phone number, SIP address or Client identifier that triggered this Engagement. Phone numbers are in E.164 format (+16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. + :ivar context: The current state of the execution flow. As your flow executes, we save the state in a flow context. Your widgets can access the data in the flow context as variables, either in configuration fields or in text areas as variable substitution. + :ivar status: + :ivar date_created: The date and time in GMT when the Engagement was created in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the Engagement was updated in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The absolute URL of the resource. + :ivar links: The URLs of the Engagement's nested resources. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + flow_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "flow_sid": payload.get("flow_sid"), - "contact_sid": payload.get("contact_sid"), - "contact_channel_address": payload.get("contact_channel_address"), - "context": payload.get("context"), - "status": payload.get("status"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.flow_sid: Optional[str] = payload.get("flow_sid") + self.contact_sid: Optional[str] = payload.get("contact_sid") + self.contact_channel_address: Optional[str] = payload.get( + "contact_channel_address" + ) + self.context: Optional[Dict[str, object]] = payload.get("context") + self.status: Optional["EngagementInstance.Status"] = payload.get("status") + 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 = { "flow_sid": flow_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[EngagementContext] = None @@ -74,83 +95,6 @@ def _proxy(self) -> "EngagementContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Engagement resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Engagement resource. - """ - return self._properties["account_sid"] - - @property - def flow_sid(self) -> str: - """ - :returns: The SID of the Flow. - """ - return self._properties["flow_sid"] - - @property - def contact_sid(self) -> str: - """ - :returns: The SID of the Contact. - """ - return self._properties["contact_sid"] - - @property - def contact_channel_address(self) -> str: - """ - :returns: The phone number, SIP address or Client identifier that triggered this Engagement. Phone numbers are in E.164 format (+16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. - """ - return self._properties["contact_channel_address"] - - @property - def context(self) -> Dict[str, object]: - """ - :returns: The current state of the execution flow. As your flow executes, we save the state in a flow context. Your widgets can access the data in the flow context as variables, either in configuration fields or in text areas as variable substitution. - """ - return self._properties["context"] - - @property - def status(self) -> "EngagementInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the Engagement was created in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the Engagement was updated in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of the Engagement's nested resources. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the EngagementInstance diff --git a/twilio/rest/studio/v1/flow/engagement/engagement_context.py b/twilio/rest/studio/v1/flow/engagement/engagement_context.py index 63c843f5d..d558b38be 100644 --- a/twilio/rest/studio/v1/flow/engagement/engagement_context.py +++ b/twilio/rest/studio/v1/flow/engagement/engagement_context.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -21,19 +21,29 @@ class EngagementContextInstance(InstanceResource): - def __init__(self, version, payload, flow_sid: str, engagement_sid: str): - """ - Initialize the EngagementContextInstance - """ + + """ + :ivar account_sid: The SID of the Account. + :ivar context: As your flow executes, we save the state in what's called the Flow Context. Any data in the flow context can be accessed by your widgets as variables, either in configuration fields or in text areas as variable substitution. + :ivar engagement_sid: The SID of the Engagement. + :ivar flow_sid: The SID of the Flow. + :ivar url: The URL of the resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + flow_sid: str, + engagement_sid: str, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "context": payload.get("context"), - "engagement_sid": payload.get("engagement_sid"), - "flow_sid": payload.get("flow_sid"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.context: Optional[Dict[str, object]] = payload.get("context") + self.engagement_sid: Optional[str] = payload.get("engagement_sid") + self.flow_sid: Optional[str] = payload.get("flow_sid") + self.url: Optional[str] = payload.get("url") self._solution = { "flow_sid": flow_sid, @@ -57,41 +67,6 @@ def _proxy(self) -> "EngagementContextContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the Account. - """ - return self._properties["account_sid"] - - @property - def context(self) -> Dict[str, object]: - """ - :returns: As your flow executes, we save the state in what's called the Flow Context. Any data in the flow context can be accessed by your widgets as variables, either in configuration fields or in text areas as variable substitution. - """ - return self._properties["context"] - - @property - def engagement_sid(self) -> str: - """ - :returns: The SID of the Engagement. - """ - return self._properties["engagement_sid"] - - @property - def flow_sid(self) -> str: - """ - :returns: The SID of the Flow. - """ - return self._properties["flow_sid"] - - @property - def url(self) -> str: - """ - :returns: The URL of the resource. - """ - return self._properties["url"] - def fetch(self) -> "EngagementContextInstance": """ Fetch the EngagementContextInstance diff --git a/twilio/rest/studio/v1/flow/engagement/step/__init__.py b/twilio/rest/studio/v1/flow/engagement/step/__init__.py index 61dd1de3b..111896c8e 100644 --- a/twilio/rest/studio/v1/flow/engagement/step/__init__.py +++ b/twilio/rest/studio/v1/flow/engagement/step/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -25,38 +25,53 @@ class StepInstance(InstanceResource): + + """ + :ivar sid: The unique string that we created to identify the Step resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Step resource. + :ivar flow_sid: The SID of the Flow. + :ivar engagement_sid: The SID of the Engagement. + :ivar name: The event that caused the Flow to transition to the Step. + :ivar context: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. + :ivar transitioned_from: The Widget that preceded the Widget for the Step. + :ivar transitioned_to: The Widget that will follow the Widget for the Step. + :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 resource. + :ivar links: The URLs of related resources. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], flow_sid: str, engagement_sid: str, sid: Optional[str] = None, ): - """ - Initialize the StepInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "flow_sid": payload.get("flow_sid"), - "engagement_sid": payload.get("engagement_sid"), - "name": payload.get("name"), - "context": payload.get("context"), - "transitioned_from": payload.get("transitioned_from"), - "transitioned_to": payload.get("transitioned_to"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.flow_sid: Optional[str] = payload.get("flow_sid") + self.engagement_sid: Optional[str] = payload.get("engagement_sid") + self.name: Optional[str] = payload.get("name") + self.context: Optional[Dict[str, object]] = payload.get("context") + self.transitioned_from: Optional[str] = payload.get("transitioned_from") + self.transitioned_to: Optional[str] = payload.get("transitioned_to") + 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 = { "flow_sid": flow_sid, "engagement_sid": engagement_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[StepContext] = None @@ -77,90 +92,6 @@ def _proxy(self) -> "StepContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Step resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Step resource. - """ - return self._properties["account_sid"] - - @property - def flow_sid(self) -> str: - """ - :returns: The SID of the Flow. - """ - return self._properties["flow_sid"] - - @property - def engagement_sid(self) -> str: - """ - :returns: The SID of the Engagement. - """ - return self._properties["engagement_sid"] - - @property - def name(self) -> str: - """ - :returns: The event that caused the Flow to transition to the Step. - """ - return self._properties["name"] - - @property - def context(self) -> Dict[str, object]: - """ - :returns: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. - """ - return self._properties["context"] - - @property - def transitioned_from(self) -> str: - """ - :returns: The Widget that preceded the Widget for the Step. - """ - return self._properties["transitioned_from"] - - @property - def transitioned_to(self) -> str: - """ - :returns: The Widget that will follow the Widget for the Step. - """ - return self._properties["transitioned_to"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - def fetch(self) -> "StepInstance": """ Fetch the StepInstance diff --git a/twilio/rest/studio/v1/flow/engagement/step/step_context.py b/twilio/rest/studio/v1/flow/engagement/step/step_context.py index 65bb9ad09..c1555d05a 100644 --- a/twilio/rest/studio/v1/flow/engagement/step/step_context.py +++ b/twilio/rest/studio/v1/flow/engagement/step/step_context.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -21,22 +21,32 @@ class StepContextInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the StepContext resource. + :ivar context: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. + :ivar engagement_sid: The SID of the Engagement. + :ivar flow_sid: The SID of the Flow. + :ivar step_sid: The SID of the Step the context is associated with. + :ivar url: The absolute URL of the resource. + """ + def __init__( - self, version, payload, flow_sid: str, engagement_sid: str, step_sid: str + self, + version: Version, + payload: Dict[str, Any], + flow_sid: str, + engagement_sid: str, + step_sid: str, ): - """ - Initialize the StepContextInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "context": payload.get("context"), - "engagement_sid": payload.get("engagement_sid"), - "flow_sid": payload.get("flow_sid"), - "step_sid": payload.get("step_sid"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.context: Optional[Dict[str, object]] = payload.get("context") + self.engagement_sid: Optional[str] = payload.get("engagement_sid") + self.flow_sid: Optional[str] = payload.get("flow_sid") + self.step_sid: Optional[str] = payload.get("step_sid") + self.url: Optional[str] = payload.get("url") self._solution = { "flow_sid": flow_sid, @@ -62,48 +72,6 @@ def _proxy(self) -> "StepContextContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the StepContext resource. - """ - return self._properties["account_sid"] - - @property - def context(self) -> Dict[str, object]: - """ - :returns: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. - """ - return self._properties["context"] - - @property - def engagement_sid(self) -> str: - """ - :returns: The SID of the Engagement. - """ - return self._properties["engagement_sid"] - - @property - def flow_sid(self) -> str: - """ - :returns: The SID of the Flow. - """ - return self._properties["flow_sid"] - - @property - def step_sid(self) -> str: - """ - :returns: The SID of the Step the context is associated with. - """ - return self._properties["step_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def fetch(self) -> "StepContextInstance": """ Fetch the StepContextInstance diff --git a/twilio/rest/studio/v1/flow/execution/__init__.py b/twilio/rest/studio/v1/flow/execution/__init__.py index bb0d686ae..f8ab8dd43 100644 --- a/twilio/rest/studio/v1/flow/execution/__init__.py +++ b/twilio/rest/studio/v1/flow/execution/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -30,29 +30,50 @@ class Status(object): ACTIVE = "active" ENDED = "ended" - def __init__(self, version, payload, flow_sid: str, sid: Optional[str] = None): - """ - Initialize the ExecutionInstance - """ + """ + :ivar sid: The unique string that we created to identify the Execution resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Execution resource. + :ivar flow_sid: The SID of the Flow. + :ivar contact_sid: The SID of the Contact. + :ivar contact_channel_address: The phone number, SIP address or Client identifier that triggered the Execution. Phone numbers are in E.164 format (e.g. +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. + :ivar context: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. + :ivar status: + :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 resource. + :ivar links: The URLs of nested resources. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + flow_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "flow_sid": payload.get("flow_sid"), - "contact_sid": payload.get("contact_sid"), - "contact_channel_address": payload.get("contact_channel_address"), - "context": payload.get("context"), - "status": payload.get("status"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.flow_sid: Optional[str] = payload.get("flow_sid") + self.contact_sid: Optional[str] = payload.get("contact_sid") + self.contact_channel_address: Optional[str] = payload.get( + "contact_channel_address" + ) + self.context: Optional[Dict[str, object]] = payload.get("context") + self.status: Optional["ExecutionInstance.Status"] = payload.get("status") + 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 = { "flow_sid": flow_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ExecutionContext] = None @@ -72,83 +93,6 @@ def _proxy(self) -> "ExecutionContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Execution resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Execution resource. - """ - return self._properties["account_sid"] - - @property - def flow_sid(self) -> str: - """ - :returns: The SID of the Flow. - """ - return self._properties["flow_sid"] - - @property - def contact_sid(self) -> str: - """ - :returns: The SID of the Contact. - """ - return self._properties["contact_sid"] - - @property - def contact_channel_address(self) -> str: - """ - :returns: The phone number, SIP address or Client identifier that triggered the Execution. Phone numbers are in E.164 format (e.g. +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. - """ - return self._properties["contact_channel_address"] - - @property - def context(self) -> Dict[str, object]: - """ - :returns: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. - """ - return self._properties["context"] - - @property - def status(self) -> "ExecutionInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of nested resources. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the ExecutionInstance diff --git a/twilio/rest/studio/v1/flow/execution/execution_context.py b/twilio/rest/studio/v1/flow/execution/execution_context.py index 164cf5ad1..d84431d12 100644 --- a/twilio/rest/studio/v1/flow/execution/execution_context.py +++ b/twilio/rest/studio/v1/flow/execution/execution_context.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -21,19 +21,29 @@ class ExecutionContextInstance(InstanceResource): - def __init__(self, version, payload, flow_sid: str, execution_sid: str): - """ - Initialize the ExecutionContextInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionContext resource. + :ivar context: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. + :ivar flow_sid: The SID of the Flow. + :ivar execution_sid: The SID of the context's Execution resource. + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + flow_sid: str, + execution_sid: str, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "context": payload.get("context"), - "flow_sid": payload.get("flow_sid"), - "execution_sid": payload.get("execution_sid"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.context: Optional[Dict[str, object]] = payload.get("context") + self.flow_sid: Optional[str] = payload.get("flow_sid") + self.execution_sid: Optional[str] = payload.get("execution_sid") + self.url: Optional[str] = payload.get("url") self._solution = { "flow_sid": flow_sid, @@ -57,41 +67,6 @@ def _proxy(self) -> "ExecutionContextContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionContext resource. - """ - return self._properties["account_sid"] - - @property - def context(self) -> Dict[str, object]: - """ - :returns: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. - """ - return self._properties["context"] - - @property - def flow_sid(self) -> str: - """ - :returns: The SID of the Flow. - """ - return self._properties["flow_sid"] - - @property - def execution_sid(self) -> str: - """ - :returns: The SID of the context's Execution resource. - """ - return self._properties["execution_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def fetch(self) -> "ExecutionContextInstance": """ Fetch the ExecutionContextInstance diff --git a/twilio/rest/studio/v1/flow/execution/execution_step/__init__.py b/twilio/rest/studio/v1/flow/execution/execution_step/__init__.py index e3f7d07be..9d29bc72a 100644 --- a/twilio/rest/studio/v1/flow/execution/execution_step/__init__.py +++ b/twilio/rest/studio/v1/flow/execution/execution_step/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,38 +27,53 @@ class ExecutionStepInstance(InstanceResource): + + """ + :ivar sid: The unique string that we created to identify the ExecutionStep resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStep resource. + :ivar flow_sid: The SID of the Flow. + :ivar execution_sid: The SID of the Step's Execution resource. + :ivar name: The event that caused the Flow to transition to the Step. + :ivar context: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. + :ivar transitioned_from: The Widget that preceded the Widget for the Step. + :ivar transitioned_to: The Widget that will follow the Widget for the Step. + :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 resource. + :ivar links: The URLs of related resources. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], flow_sid: str, execution_sid: str, sid: Optional[str] = None, ): - """ - Initialize the ExecutionStepInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "flow_sid": payload.get("flow_sid"), - "execution_sid": payload.get("execution_sid"), - "name": payload.get("name"), - "context": payload.get("context"), - "transitioned_from": payload.get("transitioned_from"), - "transitioned_to": payload.get("transitioned_to"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.flow_sid: Optional[str] = payload.get("flow_sid") + self.execution_sid: Optional[str] = payload.get("execution_sid") + self.name: Optional[str] = payload.get("name") + self.context: Optional[Dict[str, object]] = payload.get("context") + self.transitioned_from: Optional[str] = payload.get("transitioned_from") + self.transitioned_to: Optional[str] = payload.get("transitioned_to") + 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 = { "flow_sid": flow_sid, "execution_sid": execution_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ExecutionStepContext] = None @@ -79,90 +94,6 @@ def _proxy(self) -> "ExecutionStepContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the ExecutionStep resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStep resource. - """ - return self._properties["account_sid"] - - @property - def flow_sid(self) -> str: - """ - :returns: The SID of the Flow. - """ - return self._properties["flow_sid"] - - @property - def execution_sid(self) -> str: - """ - :returns: The SID of the Step's Execution resource. - """ - return self._properties["execution_sid"] - - @property - def name(self) -> str: - """ - :returns: The event that caused the Flow to transition to the Step. - """ - return self._properties["name"] - - @property - def context(self) -> Dict[str, object]: - """ - :returns: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. - """ - return self._properties["context"] - - @property - def transitioned_from(self) -> str: - """ - :returns: The Widget that preceded the Widget for the Step. - """ - return self._properties["transitioned_from"] - - @property - def transitioned_to(self) -> str: - """ - :returns: The Widget that will follow the Widget for the Step. - """ - return self._properties["transitioned_to"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - def fetch(self) -> "ExecutionStepInstance": """ Fetch the ExecutionStepInstance diff --git a/twilio/rest/studio/v1/flow/execution/execution_step/execution_step_context.py b/twilio/rest/studio/v1/flow/execution/execution_step/execution_step_context.py index 400e94d89..1463adec6 100644 --- a/twilio/rest/studio/v1/flow/execution/execution_step/execution_step_context.py +++ b/twilio/rest/studio/v1/flow/execution/execution_step/execution_step_context.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -21,22 +21,32 @@ class ExecutionStepContextInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStepContext resource. + :ivar context: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. + :ivar execution_sid: The SID of the context's Execution resource. + :ivar flow_sid: The SID of the Flow. + :ivar step_sid: The SID of the Step that the context is associated with. + :ivar url: The absolute URL of the resource. + """ + def __init__( - self, version, payload, flow_sid: str, execution_sid: str, step_sid: str + self, + version: Version, + payload: Dict[str, Any], + flow_sid: str, + execution_sid: str, + step_sid: str, ): - """ - Initialize the ExecutionStepContextInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "context": payload.get("context"), - "execution_sid": payload.get("execution_sid"), - "flow_sid": payload.get("flow_sid"), - "step_sid": payload.get("step_sid"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.context: Optional[Dict[str, object]] = payload.get("context") + self.execution_sid: Optional[str] = payload.get("execution_sid") + self.flow_sid: Optional[str] = payload.get("flow_sid") + self.step_sid: Optional[str] = payload.get("step_sid") + self.url: Optional[str] = payload.get("url") self._solution = { "flow_sid": flow_sid, @@ -62,48 +72,6 @@ def _proxy(self) -> "ExecutionStepContextContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStepContext resource. - """ - return self._properties["account_sid"] - - @property - def context(self) -> Dict[str, object]: - """ - :returns: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. - """ - return self._properties["context"] - - @property - def execution_sid(self) -> str: - """ - :returns: The SID of the context's Execution resource. - """ - return self._properties["execution_sid"] - - @property - def flow_sid(self) -> str: - """ - :returns: The SID of the Flow. - """ - return self._properties["flow_sid"] - - @property - def step_sid(self) -> str: - """ - :returns: The SID of the Step that the context is associated with. - """ - return self._properties["step_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def fetch(self) -> "ExecutionStepContextInstance": """ Fetch the ExecutionStepContextInstance diff --git a/twilio/rest/studio/v2/flow/__init__.py b/twilio/rest/studio/v2/flow/__init__.py index 210e8dbaa..a48de8938 100644 --- a/twilio/rest/studio/v2/flow/__init__.py +++ b/twilio/rest/studio/v2/flow/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -31,32 +31,51 @@ class Status(object): DRAFT = "draft" PUBLISHED = "published" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the FlowInstance - """ + """ + :ivar sid: The unique string that we created to identify the Flow resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flow resource. + :ivar friendly_name: The string that you assigned to describe the Flow. + :ivar definition: JSON representation of flow definition. + :ivar status: + :ivar revision: The latest revision number of the Flow's definition. + :ivar commit_message: Description of change made in the revision. + :ivar valid: Boolean if the flow definition is valid. + :ivar errors: List of error in the flow definition. + :ivar warnings: List of warnings in the flow definition. + :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 webhook_url: + :ivar url: The absolute URL of the resource. + :ivar links: The URLs of the Flow's nested resources. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "definition": payload.get("definition"), - "status": payload.get("status"), - "revision": deserialize.integer(payload.get("revision")), - "commit_message": payload.get("commit_message"), - "valid": payload.get("valid"), - "errors": payload.get("errors"), - "warnings": payload.get("warnings"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "webhook_url": payload.get("webhook_url"), - "url": payload.get("url"), - "links": payload.get("links"), - } + 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.definition: Optional[Dict[str, object]] = payload.get("definition") + self.status: Optional["FlowInstance.Status"] = payload.get("status") + self.revision: Optional[int] = deserialize.integer(payload.get("revision")) + self.commit_message: Optional[str] = payload.get("commit_message") + self.valid: Optional[bool] = payload.get("valid") + self.errors: Optional[List[object]] = payload.get("errors") + self.warnings: Optional[List[object]] = payload.get("warnings") + 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.webhook_url: Optional[str] = payload.get("webhook_url") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[FlowContext] = None @@ -75,111 +94,6 @@ def _proxy(self) -> "FlowContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Flow resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flow resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the Flow. - """ - return self._properties["friendly_name"] - - @property - def definition(self) -> Dict[str, object]: - """ - :returns: JSON representation of flow definition. - """ - return self._properties["definition"] - - @property - def status(self) -> "FlowInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def revision(self) -> int: - """ - :returns: The latest revision number of the Flow's definition. - """ - return self._properties["revision"] - - @property - def commit_message(self) -> str: - """ - :returns: Description of change made in the revision. - """ - return self._properties["commit_message"] - - @property - def valid(self) -> bool: - """ - :returns: Boolean if the flow definition is valid. - """ - return self._properties["valid"] - - @property - def errors(self) -> List[object]: - """ - :returns: List of error in the flow definition. - """ - return self._properties["errors"] - - @property - def warnings(self) -> List[object]: - """ - :returns: List of warnings in the flow definition. - """ - return self._properties["warnings"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def webhook_url(self) -> str: - """ - :returns: - """ - return self._properties["webhook_url"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of the Flow's nested resources. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the FlowInstance diff --git a/twilio/rest/studio/v2/flow/execution/__init__.py b/twilio/rest/studio/v2/flow/execution/__init__.py index 3780b4574..422226fed 100644 --- a/twilio/rest/studio/v2/flow/execution/__init__.py +++ b/twilio/rest/studio/v2/flow/execution/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -30,28 +30,48 @@ class Status(object): ACTIVE = "active" ENDED = "ended" - def __init__(self, version, payload, flow_sid: str, sid: Optional[str] = None): - """ - Initialize the ExecutionInstance - """ + """ + :ivar sid: The unique string that we created to identify the Execution resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Execution resource. + :ivar flow_sid: The SID of the Flow. + :ivar contact_channel_address: The phone number, SIP address or Client identifier that triggered the Execution. Phone numbers are in E.164 format (e.g. +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. + :ivar context: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. + :ivar status: + :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 resource. + :ivar links: The URLs of nested resources. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + flow_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "flow_sid": payload.get("flow_sid"), - "contact_channel_address": payload.get("contact_channel_address"), - "context": payload.get("context"), - "status": payload.get("status"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.flow_sid: Optional[str] = payload.get("flow_sid") + self.contact_channel_address: Optional[str] = payload.get( + "contact_channel_address" + ) + self.context: Optional[Dict[str, object]] = payload.get("context") + self.status: Optional["ExecutionInstance.Status"] = payload.get("status") + 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 = { "flow_sid": flow_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ExecutionContext] = None @@ -71,76 +91,6 @@ def _proxy(self) -> "ExecutionContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Execution resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Execution resource. - """ - return self._properties["account_sid"] - - @property - def flow_sid(self) -> str: - """ - :returns: The SID of the Flow. - """ - return self._properties["flow_sid"] - - @property - def contact_channel_address(self) -> str: - """ - :returns: The phone number, SIP address or Client identifier that triggered the Execution. Phone numbers are in E.164 format (e.g. +16175551212). SIP addresses are formatted as `name@company.com`. Client identifiers are formatted `client:name`. - """ - return self._properties["contact_channel_address"] - - @property - def context(self) -> Dict[str, object]: - """ - :returns: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. - """ - return self._properties["context"] - - @property - def status(self) -> "ExecutionInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of nested resources. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the ExecutionInstance diff --git a/twilio/rest/studio/v2/flow/execution/execution_context.py b/twilio/rest/studio/v2/flow/execution/execution_context.py index 518b10b76..47628b1ea 100644 --- a/twilio/rest/studio/v2/flow/execution/execution_context.py +++ b/twilio/rest/studio/v2/flow/execution/execution_context.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -21,19 +21,29 @@ class ExecutionContextInstance(InstanceResource): - def __init__(self, version, payload, flow_sid: str, execution_sid: str): - """ - Initialize the ExecutionContextInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionContext resource. + :ivar context: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. + :ivar flow_sid: The SID of the Flow. + :ivar execution_sid: The SID of the context's Execution resource. + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + flow_sid: str, + execution_sid: str, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "context": payload.get("context"), - "flow_sid": payload.get("flow_sid"), - "execution_sid": payload.get("execution_sid"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.context: Optional[Dict[str, object]] = payload.get("context") + self.flow_sid: Optional[str] = payload.get("flow_sid") + self.execution_sid: Optional[str] = payload.get("execution_sid") + self.url: Optional[str] = payload.get("url") self._solution = { "flow_sid": flow_sid, @@ -57,41 +67,6 @@ def _proxy(self) -> "ExecutionContextContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionContext resource. - """ - return self._properties["account_sid"] - - @property - def context(self) -> Dict[str, object]: - """ - :returns: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. - """ - return self._properties["context"] - - @property - def flow_sid(self) -> str: - """ - :returns: The SID of the Flow. - """ - return self._properties["flow_sid"] - - @property - def execution_sid(self) -> str: - """ - :returns: The SID of the context's Execution resource. - """ - return self._properties["execution_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def fetch(self) -> "ExecutionContextInstance": """ Fetch the ExecutionContextInstance diff --git a/twilio/rest/studio/v2/flow/execution/execution_step/__init__.py b/twilio/rest/studio/v2/flow/execution/execution_step/__init__.py index 6e169b5f3..ffe1a0ff9 100644 --- a/twilio/rest/studio/v2/flow/execution/execution_step/__init__.py +++ b/twilio/rest/studio/v2/flow/execution/execution_step/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,38 +27,53 @@ class ExecutionStepInstance(InstanceResource): + + """ + :ivar sid: The unique string that we created to identify the ExecutionStep resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStep resource. + :ivar flow_sid: The SID of the Flow. + :ivar execution_sid: The SID of the Step's Execution resource. + :ivar name: The event that caused the Flow to transition to the Step. + :ivar context: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. + :ivar transitioned_from: The Widget that preceded the Widget for the Step. + :ivar transitioned_to: The Widget that will follow the Widget for the Step. + :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 resource. + :ivar links: The URLs of related resources. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], flow_sid: str, execution_sid: str, sid: Optional[str] = None, ): - """ - Initialize the ExecutionStepInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "flow_sid": payload.get("flow_sid"), - "execution_sid": payload.get("execution_sid"), - "name": payload.get("name"), - "context": payload.get("context"), - "transitioned_from": payload.get("transitioned_from"), - "transitioned_to": payload.get("transitioned_to"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.flow_sid: Optional[str] = payload.get("flow_sid") + self.execution_sid: Optional[str] = payload.get("execution_sid") + self.name: Optional[str] = payload.get("name") + self.context: Optional[Dict[str, object]] = payload.get("context") + self.transitioned_from: Optional[str] = payload.get("transitioned_from") + self.transitioned_to: Optional[str] = payload.get("transitioned_to") + 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 = { "flow_sid": flow_sid, "execution_sid": execution_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ExecutionStepContext] = None @@ -79,90 +94,6 @@ def _proxy(self) -> "ExecutionStepContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the ExecutionStep resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStep resource. - """ - return self._properties["account_sid"] - - @property - def flow_sid(self) -> str: - """ - :returns: The SID of the Flow. - """ - return self._properties["flow_sid"] - - @property - def execution_sid(self) -> str: - """ - :returns: The SID of the Step's Execution resource. - """ - return self._properties["execution_sid"] - - @property - def name(self) -> str: - """ - :returns: The event that caused the Flow to transition to the Step. - """ - return self._properties["name"] - - @property - def context(self) -> Dict[str, object]: - """ - :returns: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. - """ - return self._properties["context"] - - @property - def transitioned_from(self) -> str: - """ - :returns: The Widget that preceded the Widget for the Step. - """ - return self._properties["transitioned_from"] - - @property - def transitioned_to(self) -> str: - """ - :returns: The Widget that will follow the Widget for the Step. - """ - return self._properties["transitioned_to"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - def fetch(self) -> "ExecutionStepInstance": """ Fetch the ExecutionStepInstance diff --git a/twilio/rest/studio/v2/flow/execution/execution_step/execution_step_context.py b/twilio/rest/studio/v2/flow/execution/execution_step/execution_step_context.py index 0b3d3c236..5a8832159 100644 --- a/twilio/rest/studio/v2/flow/execution/execution_step/execution_step_context.py +++ b/twilio/rest/studio/v2/flow/execution/execution_step/execution_step_context.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -21,22 +21,32 @@ class ExecutionStepContextInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStepContext resource. + :ivar context: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. + :ivar execution_sid: The SID of the context's Execution resource. + :ivar flow_sid: The SID of the Flow. + :ivar step_sid: The SID of the Step that the context is associated with. + :ivar url: The absolute URL of the resource. + """ + def __init__( - self, version, payload, flow_sid: str, execution_sid: str, step_sid: str + self, + version: Version, + payload: Dict[str, Any], + flow_sid: str, + execution_sid: str, + step_sid: str, ): - """ - Initialize the ExecutionStepContextInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "context": payload.get("context"), - "execution_sid": payload.get("execution_sid"), - "flow_sid": payload.get("flow_sid"), - "step_sid": payload.get("step_sid"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.context: Optional[Dict[str, object]] = payload.get("context") + self.execution_sid: Optional[str] = payload.get("execution_sid") + self.flow_sid: Optional[str] = payload.get("flow_sid") + self.step_sid: Optional[str] = payload.get("step_sid") + self.url: Optional[str] = payload.get("url") self._solution = { "flow_sid": flow_sid, @@ -62,48 +72,6 @@ def _proxy(self) -> "ExecutionStepContextContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ExecutionStepContext resource. - """ - return self._properties["account_sid"] - - @property - def context(self) -> Dict[str, object]: - """ - :returns: The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution. - """ - return self._properties["context"] - - @property - def execution_sid(self) -> str: - """ - :returns: The SID of the context's Execution resource. - """ - return self._properties["execution_sid"] - - @property - def flow_sid(self) -> str: - """ - :returns: The SID of the Flow. - """ - return self._properties["flow_sid"] - - @property - def step_sid(self) -> str: - """ - :returns: The SID of the Step that the context is associated with. - """ - return self._properties["step_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def fetch(self) -> "ExecutionStepContextInstance": """ Fetch the ExecutionStepContextInstance diff --git a/twilio/rest/studio/v2/flow/flow_revision.py b/twilio/rest/studio/v2/flow/flow_revision.py index 478731f26..145d1720b 100644 --- a/twilio/rest/studio/v2/flow/flow_revision.py +++ b/twilio/rest/studio/v2/flow/flow_revision.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,30 +28,50 @@ class Status(object): DRAFT = "draft" PUBLISHED = "published" - def __init__(self, version, payload, sid: str, revision: Optional[str] = None): - """ - Initialize the FlowRevisionInstance - """ + """ + :ivar sid: The unique string that we created to identify the Flow resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flow resource. + :ivar friendly_name: The string that you assigned to describe the Flow. + :ivar definition: JSON representation of flow definition. + :ivar status: + :ivar revision: The latest revision number of the Flow's definition. + :ivar commit_message: Description of change made in the revision. + :ivar valid: Boolean if the flow definition is valid. + :ivar errors: List of error in the flow definition. + :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 resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + sid: str, + revision: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "definition": payload.get("definition"), - "status": payload.get("status"), - "revision": deserialize.integer(payload.get("revision")), - "commit_message": payload.get("commit_message"), - "valid": payload.get("valid"), - "errors": payload.get("errors"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + 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.definition: Optional[Dict[str, object]] = payload.get("definition") + self.status: Optional["FlowRevisionInstance.Status"] = payload.get("status") + self.revision: Optional[int] = deserialize.integer(payload.get("revision")) + self.commit_message: Optional[str] = payload.get("commit_message") + self.valid: Optional[bool] = payload.get("valid") + self.errors: Optional[List[object]] = payload.get("errors") + 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, - "revision": revision or self._properties["revision"], + "revision": revision or self.revision, } self._context: Optional[FlowRevisionContext] = None @@ -71,90 +91,6 @@ def _proxy(self) -> "FlowRevisionContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Flow resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Flow resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the Flow. - """ - return self._properties["friendly_name"] - - @property - def definition(self) -> Dict[str, object]: - """ - :returns: JSON representation of flow definition. - """ - return self._properties["definition"] - - @property - def status(self) -> "FlowRevisionInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def revision(self) -> int: - """ - :returns: The latest revision number of the Flow's definition. - """ - return self._properties["revision"] - - @property - def commit_message(self) -> str: - """ - :returns: Description of change made in the revision. - """ - return self._properties["commit_message"] - - @property - def valid(self) -> bool: - """ - :returns: Boolean if the flow definition is valid. - """ - return self._properties["valid"] - - @property - def errors(self) -> List[object]: - """ - :returns: List of error in the flow definition. - """ - return self._properties["errors"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def fetch(self) -> "FlowRevisionInstance": """ Fetch the FlowRevisionInstance diff --git a/twilio/rest/studio/v2/flow/flow_test_user.py b/twilio/rest/studio/v2/flow/flow_test_user.py index 9132c1268..69b6e890a 100644 --- a/twilio/rest/studio/v2/flow/flow_test_user.py +++ b/twilio/rest/studio/v2/flow/flow_test_user.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -22,17 +22,19 @@ class FlowTestUserInstance(InstanceResource): - def __init__(self, version, payload, sid: str): - """ - Initialize the FlowTestUserInstance - """ + + """ + :ivar sid: Unique identifier of the flow. + :ivar test_users: List of test user identities that can test draft versions of the flow. + :ivar url: The URL of this resource. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], sid: str): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "test_users": payload.get("test_users"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.test_users: Optional[List[str]] = payload.get("test_users") + self.url: Optional[str] = payload.get("url") self._solution = { "sid": sid, @@ -54,27 +56,6 @@ def _proxy(self) -> "FlowTestUserContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: Unique identifier of the flow. - """ - return self._properties["sid"] - - @property - def test_users(self) -> List[str]: - """ - :returns: List of test user identities that can test draft versions of the flow. - """ - return self._properties["test_users"] - - @property - def url(self) -> str: - """ - :returns: The URL of this resource. - """ - return self._properties["url"] - def fetch(self) -> "FlowTestUserInstance": """ Fetch the FlowTestUserInstance diff --git a/twilio/rest/studio/v2/flow_validate.py b/twilio/rest/studio/v2/flow_validate.py index bfde1beba..503be3cb3 100644 --- a/twilio/rest/studio/v2/flow_validate.py +++ b/twilio/rest/studio/v2/flow_validate.py @@ -13,6 +13,7 @@ """ +from typing import Any, Dict, Optional from twilio.base import serialize, values from twilio.base.instance_resource import InstanceResource @@ -21,25 +22,18 @@ class FlowValidateInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the FlowValidateInstance - """ + + """ + :ivar valid: Boolean if the flow definition is valid. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "valid": payload.get("valid"), - } + self.valid: Optional[bool] = payload.get("valid") self._solution = {} - @property - def valid(self) -> bool: - """ - :returns: Boolean if the flow definition is valid. - """ - return self._properties["valid"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/supersim/v1/esim_profile.py b/twilio/rest/supersim/v1/esim_profile.py index 86f91cbfb..83d9fba1b 100644 --- a/twilio/rest/supersim/v1/esim_profile.py +++ b/twilio/rest/supersim/v1/esim_profile.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -32,31 +32,49 @@ class Status(object): INSTALLED = "installed" FAILED = "failed" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the EsimProfileInstance - """ + """ + :ivar sid: The unique string that we created to identify the eSIM Profile resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) to which the eSIM Profile resource belongs. + :ivar iccid: The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) associated with the Sim resource. + :ivar sim_sid: The SID of the [Sim](https://www.twilio.com/docs/wireless/api/sim-resource) resource that this eSIM Profile controls. + :ivar status: + :ivar eid: Identifier of the eUICC that can claim the eSIM Profile. + :ivar smdp_plus_address: Address of the SM-DP+ server from which the Profile will be downloaded. The URL will appear once the eSIM Profile reaches the status `available`. + :ivar matching_id: Unique identifier of the eSIM profile that can be used to identify and download the eSIM profile from the SM-DP+ server. Populated if `generate_matching_id` is set to `true` when creating the eSIM profile reservation. + :ivar activation_code: Combined machine-readable activation code for acquiring an eSIM Profile with the Activation Code download method. Can be used in a QR code to download an eSIM profile. + :ivar error_code: Code indicating the failure if the download of the SIM Profile failed and the eSIM Profile is in `failed` state. + :ivar error_message: Error message describing the failure if the download of the SIM Profile failed and the eSIM Profile is in `failed` state. + :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 eSIM Profile resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "iccid": payload.get("iccid"), - "sim_sid": payload.get("sim_sid"), - "status": payload.get("status"), - "eid": payload.get("eid"), - "smdp_plus_address": payload.get("smdp_plus_address"), - "matching_id": payload.get("matching_id"), - "activation_code": payload.get("activation_code"), - "error_code": payload.get("error_code"), - "error_message": payload.get("error_message"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.iccid: Optional[str] = payload.get("iccid") + self.sim_sid: Optional[str] = payload.get("sim_sid") + self.status: Optional["EsimProfileInstance.Status"] = payload.get("status") + self.eid: Optional[str] = payload.get("eid") + self.smdp_plus_address: Optional[str] = payload.get("smdp_plus_address") + self.matching_id: Optional[str] = payload.get("matching_id") + self.activation_code: Optional[str] = payload.get("activation_code") + self.error_code: Optional[str] = payload.get("error_code") + self.error_message: Optional[str] = payload.get("error_message") + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[EsimProfileContext] = None @@ -75,104 +93,6 @@ def _proxy(self) -> "EsimProfileContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the eSIM Profile resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) to which the eSIM Profile resource belongs. - """ - return self._properties["account_sid"] - - @property - def iccid(self) -> str: - """ - :returns: The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) associated with the Sim resource. - """ - return self._properties["iccid"] - - @property - def sim_sid(self) -> str: - """ - :returns: The SID of the [Sim](https://www.twilio.com/docs/wireless/api/sim-resource) resource that this eSIM Profile controls. - """ - return self._properties["sim_sid"] - - @property - def status(self) -> "EsimProfileInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def eid(self) -> str: - """ - :returns: Identifier of the eUICC that can claim the eSIM Profile. - """ - return self._properties["eid"] - - @property - def smdp_plus_address(self) -> str: - """ - :returns: Address of the SM-DP+ server from which the Profile will be downloaded. The URL will appear once the eSIM Profile reaches the status `available`. - """ - return self._properties["smdp_plus_address"] - - @property - def matching_id(self) -> str: - """ - :returns: Unique identifier of the eSIM profile that can be used to identify and download the eSIM profile from the SM-DP+ server. Populated if `generate_matching_id` is set to `true` when creating the eSIM profile reservation. - """ - return self._properties["matching_id"] - - @property - def activation_code(self) -> str: - """ - :returns: Combined machine-readable activation code for acquiring an eSIM Profile with the Activation Code download method. Can be used in a QR code to download an eSIM profile. - """ - return self._properties["activation_code"] - - @property - def error_code(self) -> str: - """ - :returns: Code indicating the failure if the download of the SIM Profile failed and the eSIM Profile is in `failed` state. - """ - return self._properties["error_code"] - - @property - def error_message(self) -> str: - """ - :returns: Error message describing the failure if the download of the SIM Profile failed and the eSIM Profile is in `failed` state. - """ - return self._properties["error_message"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the eSIM Profile resource. - """ - return self._properties["url"] - def fetch(self) -> "EsimProfileInstance": """ Fetch the EsimProfileInstance diff --git a/twilio/rest/supersim/v1/fleet.py b/twilio/rest/supersim/v1/fleet.py index 7624e6888..a53a9fcd3 100644 --- a/twilio/rest/supersim/v1/fleet.py +++ b/twilio/rest/supersim/v1/fleet.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,32 +27,55 @@ class FleetInstance(InstanceResource): class DataMetering(object): PAYG = "payg" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the FleetInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Fleet resource. + :ivar sid: The unique string that we created to identify the Fleet resource. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + :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 Fleet resource. + :ivar data_enabled: Defines whether SIMs in the Fleet are capable of using 2G/3G/4G/LTE/CAT-M data connectivity. Defaults to `true`. + :ivar data_limit: The total data usage (download and upload combined) in Megabytes that each Super SIM assigned to the Fleet can consume during a billing period (normally one month). Value must be between 1MB (1) and 2TB (2,000,000). Defaults to 1GB (1,000). + :ivar data_metering: + :ivar sms_commands_enabled: Defines whether SIMs in the Fleet are capable of sending and receiving machine-to-machine SMS via Commands. Defaults to `true`. + :ivar sms_commands_url: The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the SMS Commands number. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. + :ivar sms_commands_method: A string representing the HTTP method to use when making a request to `sms_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. + :ivar network_access_profile_sid: The SID of the Network Access Profile that controls which cellular networks the Fleet's SIMs can connect to. + :ivar ip_commands_url: The URL that will receive a webhook when a Super SIM in the Fleet is used to send an IP Command from your device to a special IP address. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. + :ivar ip_commands_method: A string representing the HTTP method to use when making a request to `ip_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "data_enabled": payload.get("data_enabled"), - "data_limit": deserialize.integer(payload.get("data_limit")), - "data_metering": payload.get("data_metering"), - "sms_commands_enabled": payload.get("sms_commands_enabled"), - "sms_commands_url": payload.get("sms_commands_url"), - "sms_commands_method": payload.get("sms_commands_method"), - "network_access_profile_sid": payload.get("network_access_profile_sid"), - "ip_commands_url": payload.get("ip_commands_url"), - "ip_commands_method": payload.get("ip_commands_method"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + 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.data_enabled: Optional[bool] = payload.get("data_enabled") + self.data_limit: Optional[int] = deserialize.integer(payload.get("data_limit")) + self.data_metering: Optional["FleetInstance.DataMetering"] = payload.get( + "data_metering" + ) + self.sms_commands_enabled: Optional[bool] = payload.get("sms_commands_enabled") + self.sms_commands_url: Optional[str] = payload.get("sms_commands_url") + self.sms_commands_method: Optional[str] = payload.get("sms_commands_method") + self.network_access_profile_sid: Optional[str] = payload.get( + "network_access_profile_sid" + ) + self.ip_commands_url: Optional[str] = payload.get("ip_commands_url") + self.ip_commands_method: Optional[str] = payload.get("ip_commands_method") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[FleetContext] = None @@ -71,111 +94,6 @@ def _proxy(self) -> "FleetContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Fleet resource. - """ - return self._properties["account_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Fleet resource. - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - """ - return self._properties["unique_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Fleet resource. - """ - return self._properties["url"] - - @property - def data_enabled(self) -> bool: - """ - :returns: Defines whether SIMs in the Fleet are capable of using 2G/3G/4G/LTE/CAT-M data connectivity. Defaults to `true`. - """ - return self._properties["data_enabled"] - - @property - def data_limit(self) -> int: - """ - :returns: The total data usage (download and upload combined) in Megabytes that each Super SIM assigned to the Fleet can consume during a billing period (normally one month). Value must be between 1MB (1) and 2TB (2,000,000). Defaults to 1GB (1,000). - """ - return self._properties["data_limit"] - - @property - def data_metering(self) -> "FleetInstance.DataMetering": - """ - :returns: - """ - return self._properties["data_metering"] - - @property - def sms_commands_enabled(self) -> bool: - """ - :returns: Defines whether SIMs in the Fleet are capable of sending and receiving machine-to-machine SMS via Commands. Defaults to `true`. - """ - return self._properties["sms_commands_enabled"] - - @property - def sms_commands_url(self) -> str: - """ - :returns: The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the SMS Commands number. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. - """ - return self._properties["sms_commands_url"] - - @property - def sms_commands_method(self) -> str: - """ - :returns: A string representing the HTTP method to use when making a request to `sms_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. - """ - return self._properties["sms_commands_method"] - - @property - def network_access_profile_sid(self) -> str: - """ - :returns: The SID of the Network Access Profile that controls which cellular networks the Fleet's SIMs can connect to. - """ - return self._properties["network_access_profile_sid"] - - @property - def ip_commands_url(self) -> str: - """ - :returns: The URL that will receive a webhook when a Super SIM in the Fleet is used to send an IP Command from your device to a special IP address. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. - """ - return self._properties["ip_commands_url"] - - @property - def ip_commands_method(self) -> str: - """ - :returns: A string representing the HTTP method to use when making a request to `ip_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`. - """ - return self._properties["ip_commands_method"] - def fetch(self) -> "FleetInstance": """ Fetch the FleetInstance diff --git a/twilio/rest/supersim/v1/ip_command.py b/twilio/rest/supersim/v1/ip_command.py index 10f5d3aed..3deee5db6 100644 --- a/twilio/rest/supersim/v1/ip_command.py +++ b/twilio/rest/supersim/v1/ip_command.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -38,30 +38,53 @@ class Status(object): RECEIVED = "received" FAILED = "failed" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the IpCommandInstance - """ + """ + :ivar sid: The unique string that we created to identify the IP Command resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IP Command resource. + :ivar sim_sid: The SID of the [Super SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) that this IP Command was sent to or from. + :ivar sim_iccid: The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) of the [Super SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) that this IP Command was sent to or from. + :ivar status: + :ivar direction: + :ivar device_ip: The IP address of the device that the IP Command was sent to or received from. For an IP Command sent to a Super SIM, `device_ip` starts out as `null`, and once the IP Command is “sent”, the `device_ip` will be filled out. An IP Command sent from a Super SIM have its `device_ip` always set. + :ivar device_port: For an IP Command sent to a Super SIM, it would be the destination port of the IP message. For an IP Command sent from a Super SIM, it would be the source port of the IP message. + :ivar payload_type: + :ivar payload: The payload that is carried in the IP/UDP message. The payload can be encoded in either text or binary format. For text payload, UTF-8 encoding must be used. For an IP Command sent to a Super SIM, the payload is appended to the IP/UDP message “as is”. The payload should not exceed 1300 bytes. For an IP Command sent from a Super SIM, the payload from the received IP/UDP message is extracted and sent in binary encoding. For an IP Command sent from a Super SIM, the payload should not exceed 1300 bytes. If it is larger than 1300 bytes, there might be fragmentation on the upstream and the message may appear truncated. + :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 IP Command resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "sim_sid": payload.get("sim_sid"), - "sim_iccid": payload.get("sim_iccid"), - "status": payload.get("status"), - "direction": payload.get("direction"), - "device_ip": payload.get("device_ip"), - "device_port": deserialize.integer(payload.get("device_port")), - "payload_type": payload.get("payload_type"), - "payload": payload.get("payload"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.sim_sid: Optional[str] = payload.get("sim_sid") + self.sim_iccid: Optional[str] = payload.get("sim_iccid") + self.status: Optional["IpCommandInstance.Status"] = payload.get("status") + self.direction: Optional["IpCommandInstance.Direction"] = payload.get( + "direction" + ) + self.device_ip: Optional[str] = payload.get("device_ip") + self.device_port: Optional[int] = deserialize.integer( + payload.get("device_port") + ) + self.payload_type: Optional["IpCommandInstance.PayloadType"] = payload.get( + "payload_type" + ) + self.payload: Optional[str] = payload.get("payload") + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[IpCommandContext] = None @@ -80,97 +103,6 @@ def _proxy(self) -> "IpCommandContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the IP Command resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IP Command resource. - """ - return self._properties["account_sid"] - - @property - def sim_sid(self) -> str: - """ - :returns: The SID of the [Super SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) that this IP Command was sent to or from. - """ - return self._properties["sim_sid"] - - @property - def sim_iccid(self) -> str: - """ - :returns: The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) of the [Super SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) that this IP Command was sent to or from. - """ - return self._properties["sim_iccid"] - - @property - def status(self) -> "IpCommandInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def direction(self) -> "IpCommandInstance.Direction": - """ - :returns: - """ - return self._properties["direction"] - - @property - def device_ip(self) -> str: - """ - :returns: The IP address of the device that the IP Command was sent to or received from. For an IP Command sent to a Super SIM, `device_ip` starts out as `null`, and once the IP Command is “sent”, the `device_ip` will be filled out. An IP Command sent from a Super SIM have its `device_ip` always set. - """ - return self._properties["device_ip"] - - @property - def device_port(self) -> int: - """ - :returns: For an IP Command sent to a Super SIM, it would be the destination port of the IP message. For an IP Command sent from a Super SIM, it would be the source port of the IP message. - """ - return self._properties["device_port"] - - @property - def payload_type(self) -> "IpCommandInstance.PayloadType": - """ - :returns: - """ - return self._properties["payload_type"] - - @property - def payload(self) -> str: - """ - :returns: The payload that is carried in the IP/UDP message. The payload can be encoded in either text or binary format. For text payload, UTF-8 encoding must be used. For an IP Command sent to a Super SIM, the payload is appended to the IP/UDP message “as is”. The payload should not exceed 1300 bytes. For an IP Command sent from a Super SIM, the payload from the received IP/UDP message is extracted and sent in binary encoding. For an IP Command sent from a Super SIM, the payload should not exceed 1300 bytes. If it is larger than 1300 bytes, there might be fragmentation on the upstream and the message may appear truncated. - """ - return self._properties["payload"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the IP Command resource. - """ - return self._properties["url"] - def fetch(self) -> "IpCommandInstance": """ Fetch the IpCommandInstance diff --git a/twilio/rest/supersim/v1/network.py b/twilio/rest/supersim/v1/network.py index d59409cfc..848a2be6c 100644 --- a/twilio/rest/supersim/v1/network.py +++ b/twilio/rest/supersim/v1/network.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,22 +23,28 @@ class NetworkInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the NetworkInstance - """ + + """ + :ivar sid: The unique string that we created to identify the Network resource. + :ivar friendly_name: A human readable identifier of this resource. + :ivar url: The absolute URL of the Network resource. + :ivar iso_country: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Network resource. + :ivar identifiers: Array of objects identifying the [MCC-MNCs](https://en.wikipedia.org/wiki/Mobile_country_code) that are included in the Network resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "friendly_name": payload.get("friendly_name"), - "url": payload.get("url"), - "iso_country": payload.get("iso_country"), - "identifiers": payload.get("identifiers"), - } + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.url: Optional[str] = payload.get("url") + self.iso_country: Optional[str] = payload.get("iso_country") + self.identifiers: Optional[List[object]] = payload.get("identifiers") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[NetworkContext] = None @@ -57,41 +63,6 @@ def _proxy(self) -> "NetworkContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Network resource. - """ - return self._properties["sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: A human readable identifier of this resource. - """ - return self._properties["friendly_name"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Network resource. - """ - return self._properties["url"] - - @property - def iso_country(self) -> str: - """ - :returns: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Network resource. - """ - return self._properties["iso_country"] - - @property - def identifiers(self) -> List[object]: - """ - :returns: Array of objects identifying the [MCC-MNCs](https://en.wikipedia.org/wiki/Mobile_country_code) that are included in the Network resource. - """ - return self._properties["identifiers"] - def fetch(self) -> "NetworkInstance": """ Fetch the NetworkInstance diff --git a/twilio/rest/supersim/v1/network_access_profile/__init__.py b/twilio/rest/supersim/v1/network_access_profile/__init__.py index 25983defb..f63cb14be 100644 --- a/twilio/rest/supersim/v1/network_access_profile/__init__.py +++ b/twilio/rest/supersim/v1/network_access_profile/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,24 +27,36 @@ class NetworkAccessProfileInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the NetworkAccessProfileInstance - """ + + """ + :ivar sid: The unique string that identifies the Network Access Profile resource. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Network Access Profile belongs to. + :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 Network Access Profile resource. + :ivar links: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[NetworkAccessProfileContext] = None @@ -63,55 +75,6 @@ def _proxy(self) -> "NetworkAccessProfileContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that identifies the Network Access Profile resource. - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - """ - return self._properties["unique_name"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Network Access Profile belongs to. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Network Access Profile resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - def fetch(self) -> "NetworkAccessProfileInstance": """ Fetch the NetworkAccessProfileInstance diff --git a/twilio/rest/supersim/v1/network_access_profile/network_access_profile_network.py b/twilio/rest/supersim/v1/network_access_profile/network_access_profile_network.py index b597cfbce..daffab6f1 100644 --- a/twilio/rest/supersim/v1/network_access_profile/network_access_profile_network.py +++ b/twilio/rest/supersim/v1/network_access_profile/network_access_profile_network.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,30 +23,37 @@ class NetworkAccessProfileNetworkInstance(InstanceResource): + + """ + :ivar sid: The unique string that identifies the Network resource. + :ivar network_access_profile_sid: The unique string that identifies the Network resource's Network Access Profile resource. + :ivar friendly_name: A human readable identifier of the Network this resource refers to. + :ivar iso_country: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Network resource. + :ivar identifiers: Array of objects identifying the [MCC-MNCs](https://en.wikipedia.org/wiki/Mobile_country_code) that are included in the Network resource. + :ivar url: The absolute URL of the Network resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], network_access_profile_sid: str, sid: Optional[str] = None, ): - """ - Initialize the NetworkAccessProfileNetworkInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "network_access_profile_sid": payload.get("network_access_profile_sid"), - "friendly_name": payload.get("friendly_name"), - "iso_country": payload.get("iso_country"), - "identifiers": payload.get("identifiers"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.network_access_profile_sid: Optional[str] = payload.get( + "network_access_profile_sid" + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.iso_country: Optional[str] = payload.get("iso_country") + self.identifiers: Optional[List[object]] = payload.get("identifiers") + self.url: Optional[str] = payload.get("url") self._solution = { "network_access_profile_sid": network_access_profile_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[NetworkAccessProfileNetworkContext] = None @@ -66,48 +73,6 @@ def _proxy(self) -> "NetworkAccessProfileNetworkContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that identifies the Network resource. - """ - return self._properties["sid"] - - @property - def network_access_profile_sid(self) -> str: - """ - :returns: The unique string that identifies the Network resource's Network Access Profile resource. - """ - return self._properties["network_access_profile_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: A human readable identifier of the Network this resource refers to. - """ - return self._properties["friendly_name"] - - @property - def iso_country(self) -> str: - """ - :returns: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the Network resource. - """ - return self._properties["iso_country"] - - @property - def identifiers(self) -> List[object]: - """ - :returns: Array of objects identifying the [MCC-MNCs](https://en.wikipedia.org/wiki/Mobile_country_code) that are included in the Network resource. - """ - return self._properties["identifiers"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Network resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the NetworkAccessProfileNetworkInstance diff --git a/twilio/rest/supersim/v1/settings_update.py b/twilio/rest/supersim/v1/settings_update.py index b7178b8c3..795aaef3f 100644 --- a/twilio/rest/supersim/v1/settings_update.py +++ b/twilio/rest/supersim/v1/settings_update.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -30,83 +30,37 @@ class Status(object): SUCCESSFUL = "successful" FAILED = "failed" - def __init__(self, version, payload): - """ - Initialize the SettingsUpdateInstance - """ + """ + :ivar sid: The unique identifier of this Settings Update. + :ivar iccid: The [ICCID](https://en.wikipedia.org/wiki/SIM_card#ICCID) associated with the SIM. + :ivar sim_sid: The SID of the Super SIM to which this Settings Update was applied. + :ivar status: + :ivar packages: Array containing the different Settings Packages that will be applied to the SIM after the update completes. Each object within the array indicates the name and the version of the Settings Package that will be on the SIM if the update is successful. + :ivar date_completed: The time, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, when the update successfully completed and the new settings were applied to the SIM. + :ivar date_created: The date that this Settings Update was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date that this Settings Update was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "iccid": payload.get("iccid"), - "sim_sid": payload.get("sim_sid"), - "status": payload.get("status"), - "packages": payload.get("packages"), - "date_completed": deserialize.iso8601_datetime( - payload.get("date_completed") - ), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - } + self.sid: Optional[str] = payload.get("sid") + self.iccid: Optional[str] = payload.get("iccid") + self.sim_sid: Optional[str] = payload.get("sim_sid") + self.status: Optional["SettingsUpdateInstance.Status"] = payload.get("status") + self.packages: Optional[List[object]] = payload.get("packages") + self.date_completed: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_completed") + ) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) self._solution = {} - @property - def sid(self) -> str: - """ - :returns: The unique identifier of this Settings Update. - """ - return self._properties["sid"] - - @property - def iccid(self) -> str: - """ - :returns: The [ICCID](https://en.wikipedia.org/wiki/SIM_card#ICCID) associated with the SIM. - """ - return self._properties["iccid"] - - @property - def sim_sid(self) -> str: - """ - :returns: The SID of the Super SIM to which this Settings Update was applied. - """ - return self._properties["sim_sid"] - - @property - def status(self) -> "SettingsUpdateInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def packages(self) -> List[object]: - """ - :returns: Array containing the different Settings Packages that will be applied to the SIM after the update completes. Each object within the array indicates the name and the version of the Settings Package that will be on the SIM if the update is successful. - """ - return self._properties["packages"] - - @property - def date_completed(self) -> datetime: - """ - :returns: The time, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, when the update successfully completed and the new settings were applied to the SIM. - """ - return self._properties["date_completed"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this Settings Update was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this Settings Update was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/supersim/v1/sim/__init__.py b/twilio/rest/supersim/v1/sim/__init__.py index 388e10183..d3e212e61 100644 --- a/twilio/rest/supersim/v1/sim/__init__.py +++ b/twilio/rest/supersim/v1/sim/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -33,27 +33,41 @@ class Status(object): INACTIVE = "inactive" SCHEDULED = "scheduled" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the SimInstance - """ + """ + :ivar sid: The unique string that identifies the Sim resource. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Super SIM belongs to. + :ivar iccid: The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) associated with the SIM. + :ivar status: + :ivar fleet_sid: The unique ID of the Fleet configured for this SIM. + :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 Sim Resource. + :ivar links: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "account_sid": payload.get("account_sid"), - "iccid": payload.get("iccid"), - "status": payload.get("status"), - "fleet_sid": payload.get("fleet_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.account_sid: Optional[str] = payload.get("account_sid") + self.iccid: Optional[str] = payload.get("iccid") + self.status: Optional["SimInstance.Status"] = payload.get("status") + self.fleet_sid: Optional[str] = payload.get("fleet_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[SimContext] = None @@ -72,76 +86,6 @@ def _proxy(self) -> "SimContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that identifies the Sim resource. - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - """ - return self._properties["unique_name"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that the Super SIM belongs to. - """ - return self._properties["account_sid"] - - @property - def iccid(self) -> str: - """ - :returns: The [ICCID](https://en.wikipedia.org/wiki/Subscriber_identity_module#ICCID) associated with the SIM. - """ - return self._properties["iccid"] - - @property - def status(self) -> "SimInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def fleet_sid(self) -> str: - """ - :returns: The unique ID of the Fleet configured for this SIM. - """ - return self._properties["fleet_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Sim Resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - def fetch(self) -> "SimInstance": """ Fetch the SimInstance diff --git a/twilio/rest/supersim/v1/sim/billing_period.py b/twilio/rest/supersim/v1/sim/billing_period.py index da6a25e42..6a65919ae 100644 --- a/twilio/rest/supersim/v1/sim/billing_period.py +++ b/twilio/rest/supersim/v1/sim/billing_period.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -28,83 +28,43 @@ class BpType(object): READY = "ready" ACTIVE = "active" - def __init__(self, version, payload, sim_sid: str): - """ - Initialize the BillingPeriodInstance - """ + """ + :ivar sid: The SID of the Billing Period. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) the Super SIM belongs to. + :ivar sim_sid: The SID of the Super SIM the Billing Period belongs to. + :ivar start_time: The start time of the Billing Period specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar end_time: The end time of the Billing Period specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar period_type: + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], sim_sid: str): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "sim_sid": payload.get("sim_sid"), - "start_time": deserialize.iso8601_datetime(payload.get("start_time")), - "end_time": deserialize.iso8601_datetime(payload.get("end_time")), - "period_type": payload.get("period_type"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.sim_sid: Optional[str] = payload.get("sim_sid") + self.start_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("start_time") + ) + self.end_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("end_time") + ) + self.period_type: Optional["BillingPeriodInstance.BpType"] = payload.get( + "period_type" + ) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) self._solution = { "sim_sid": sim_sid, } - @property - def sid(self) -> str: - """ - :returns: The SID of the Billing Period. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) the Super SIM belongs to. - """ - return self._properties["account_sid"] - - @property - def sim_sid(self) -> str: - """ - :returns: The SID of the Super SIM the Billing Period belongs to. - """ - return self._properties["sim_sid"] - - @property - def start_time(self) -> datetime: - """ - :returns: The start time of the Billing Period specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["start_time"] - - @property - def end_time(self) -> datetime: - """ - :returns: The end time of the Billing Period specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["end_time"] - - @property - def period_type(self) -> "BillingPeriodInstance.BpType": - """ - :returns: - """ - return self._properties["period_type"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/supersim/v1/sim/sim_ip_address.py b/twilio/rest/supersim/v1/sim/sim_ip_address.py index 859d2a01b..24f45a385 100644 --- a/twilio/rest/supersim/v1/sim/sim_ip_address.py +++ b/twilio/rest/supersim/v1/sim/sim_ip_address.py @@ -13,7 +13,7 @@ """ -from typing import List +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_resource import InstanceResource @@ -27,35 +27,23 @@ class IpAddressVersion(object): IPV4 = "IPv4" IPV6 = "IPv6" - def __init__(self, version, payload, sim_sid: str): - """ - Initialize the SimIpAddressInstance - """ + """ + :ivar ip_address: IP address assigned to the given Super SIM + :ivar ip_address_version: + """ + + def __init__(self, version: Version, payload: Dict[str, Any], sim_sid: str): super().__init__(version) - self._properties = { - "ip_address": payload.get("ip_address"), - "ip_address_version": payload.get("ip_address_version"), - } + self.ip_address: Optional[str] = payload.get("ip_address") + self.ip_address_version: Optional[ + "SimIpAddressInstance.IpAddressVersion" + ] = payload.get("ip_address_version") self._solution = { "sim_sid": sim_sid, } - @property - def ip_address(self) -> str: - """ - :returns: IP address assigned to the given Super SIM - """ - return self._properties["ip_address"] - - @property - def ip_address_version(self) -> "SimIpAddressInstance.IpAddressVersion": - """ - :returns: - """ - return self._properties["ip_address_version"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/supersim/v1/sms_command.py b/twilio/rest/supersim/v1/sms_command.py index c2349d203..229bdf55b 100644 --- a/twilio/rest/supersim/v1/sms_command.py +++ b/twilio/rest/supersim/v1/sms_command.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -35,26 +35,41 @@ class Status(object): RECEIVED = "received" FAILED = "failed" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the SmsCommandInstance - """ + """ + :ivar sid: The unique string that we created to identify the SMS Command resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the SMS Command resource. + :ivar sim_sid: The SID of the [SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) that this SMS Command was sent to or from. + :ivar payload: The message body of the SMS Command sent to or from the SIM. For text mode messages, this can be up to 160 characters. + :ivar status: + :ivar direction: + :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 SMS Command resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "sim_sid": payload.get("sim_sid"), - "payload": payload.get("payload"), - "status": payload.get("status"), - "direction": payload.get("direction"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.sim_sid: Optional[str] = payload.get("sim_sid") + self.payload: Optional[str] = payload.get("payload") + self.status: Optional["SmsCommandInstance.Status"] = payload.get("status") + self.direction: Optional["SmsCommandInstance.Direction"] = payload.get( + "direction" + ) + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[SmsCommandContext] = None @@ -73,69 +88,6 @@ def _proxy(self) -> "SmsCommandContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the SMS Command resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the SMS Command resource. - """ - return self._properties["account_sid"] - - @property - def sim_sid(self) -> str: - """ - :returns: The SID of the [SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) that this SMS Command was sent to or from. - """ - return self._properties["sim_sid"] - - @property - def payload(self) -> str: - """ - :returns: The message body of the SMS Command sent to or from the SIM. For text mode messages, this can be up to 160 characters. - """ - return self._properties["payload"] - - @property - def status(self) -> "SmsCommandInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def direction(self) -> "SmsCommandInstance.Direction": - """ - :returns: - """ - return self._properties["direction"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the SMS Command resource. - """ - return self._properties["url"] - def fetch(self) -> "SmsCommandInstance": """ Fetch the SmsCommandInstance diff --git a/twilio/rest/supersim/v1/usage_record.py b/twilio/rest/supersim/v1/usage_record.py index bdf949680..f38fb5f1f 100644 --- a/twilio/rest/supersim/v1/usage_record.py +++ b/twilio/rest/supersim/v1/usage_record.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource @@ -34,105 +34,39 @@ class Group(object): NETWORK = "network" ISOCOUNTRY = "isoCountry" - def __init__(self, version, payload): - """ - Initialize the UsageRecordInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that incurred the usage. + :ivar sim_sid: SID of a Sim resource to which the UsageRecord belongs. Value will only be present when either a value for the `Sim` query parameter is provided or when UsageRecords are grouped by `sim`. Otherwise, the value will be `null`. + :ivar network_sid: SID of the Network resource the usage occurred on. Value will only be present when either a value for the `Network` query parameter is provided or when UsageRecords are grouped by `network`. Otherwise, the value will be `null`. + :ivar fleet_sid: SID of the Fleet resource the usage occurred on. Value will only be present when either a value for the `Fleet` query parameter is provided or when UsageRecords are grouped by `fleet`. Otherwise, the value will be `null`. + :ivar iso_country: Alpha-2 ISO Country Code that the usage occurred in. Value will only be present when either a value for the `IsoCountry` query parameter is provided or when UsageRecords are grouped by `isoCountry`. Otherwise, the value will be `null`. + :ivar period: The time period for which the usage is reported. The period is represented as a pair of `start_time` and `end_time` timestamps specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar data_upload: Total data uploaded in bytes, aggregated by the query parameters. + :ivar data_download: Total data downloaded in bytes, aggregated by the query parameters. + :ivar data_total: Total of data_upload and data_download. + :ivar data_total_billed: Total amount in the `billed_unit` that was charged for the data uploaded or downloaded. Will return 0 for usage prior to February 1, 2022. Value may be 0 despite `data_total` being greater than 0 if the data usage is still being processed by Twilio's billing system. Refer to [Data Usage Processing](https://www.twilio.com/docs/iot/supersim/api/usage-record-resource#data-usage-processing) for more details. + :ivar billed_unit: The currency in which the billed amounts are measured, specified in the 3 letter ISO 4127 format (e.g. `USD`, `EUR`, `JPY`). This can be null when data_toal_billed is 0 and we do not yet have billing information for the corresponding data usage. Refer to [Data Usage Processing](https://www.twilio.com/docs/iot/supersim/api/usage-record-resource#data-usage-processing) for more details. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "sim_sid": payload.get("sim_sid"), - "network_sid": payload.get("network_sid"), - "fleet_sid": payload.get("fleet_sid"), - "iso_country": payload.get("iso_country"), - "period": payload.get("period"), - "data_upload": payload.get("data_upload"), - "data_download": payload.get("data_download"), - "data_total": payload.get("data_total"), - "data_total_billed": deserialize.decimal(payload.get("data_total_billed")), - "billed_unit": payload.get("billed_unit"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.sim_sid: Optional[str] = payload.get("sim_sid") + self.network_sid: Optional[str] = payload.get("network_sid") + self.fleet_sid: Optional[str] = payload.get("fleet_sid") + self.iso_country: Optional[str] = payload.get("iso_country") + self.period: Optional[Dict[str, object]] = payload.get("period") + self.data_upload: Optional[int] = payload.get("data_upload") + self.data_download: Optional[int] = payload.get("data_download") + self.data_total: Optional[int] = payload.get("data_total") + self.data_total_billed: Optional[float] = deserialize.decimal( + payload.get("data_total_billed") + ) + self.billed_unit: Optional[str] = payload.get("billed_unit") self._solution = {} - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that incurred the usage. - """ - return self._properties["account_sid"] - - @property - def sim_sid(self) -> str: - """ - :returns: SID of a Sim resource to which the UsageRecord belongs. Value will only be present when either a value for the `Sim` query parameter is provided or when UsageRecords are grouped by `sim`. Otherwise, the value will be `null`. - """ - return self._properties["sim_sid"] - - @property - def network_sid(self) -> str: - """ - :returns: SID of the Network resource the usage occurred on. Value will only be present when either a value for the `Network` query parameter is provided or when UsageRecords are grouped by `network`. Otherwise, the value will be `null`. - """ - return self._properties["network_sid"] - - @property - def fleet_sid(self) -> str: - """ - :returns: SID of the Fleet resource the usage occurred on. Value will only be present when either a value for the `Fleet` query parameter is provided or when UsageRecords are grouped by `fleet`. Otherwise, the value will be `null`. - """ - return self._properties["fleet_sid"] - - @property - def iso_country(self) -> str: - """ - :returns: Alpha-2 ISO Country Code that the usage occurred in. Value will only be present when either a value for the `IsoCountry` query parameter is provided or when UsageRecords are grouped by `isoCountry`. Otherwise, the value will be `null`. - """ - return self._properties["iso_country"] - - @property - def period(self) -> Dict[str, object]: - """ - :returns: The time period for which the usage is reported. The period is represented as a pair of `start_time` and `end_time` timestamps specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["period"] - - @property - def data_upload(self) -> int: - """ - :returns: Total data uploaded in bytes, aggregated by the query parameters. - """ - return self._properties["data_upload"] - - @property - def data_download(self) -> int: - """ - :returns: Total data downloaded in bytes, aggregated by the query parameters. - """ - return self._properties["data_download"] - - @property - def data_total(self) -> int: - """ - :returns: Total of data_upload and data_download. - """ - return self._properties["data_total"] - - @property - def data_total_billed(self) -> float: - """ - :returns: Total amount in the `billed_unit` that was charged for the data uploaded or downloaded. Will return 0 for usage prior to February 1, 2022. Value may be 0 despite `data_total` being greater than 0 if the data usage is still being processed by Twilio's billing system. Refer to [Data Usage Processing](https://www.twilio.com/docs/iot/supersim/api/usage-record-resource#data-usage-processing) for more details. - """ - return self._properties["data_total_billed"] - - @property - def billed_unit(self) -> str: - """ - :returns: The currency in which the billed amounts are measured, specified in the 3 letter ISO 4127 format (e.g. `USD`, `EUR`, `JPY`). This can be null when data_toal_billed is 0 and we do not yet have billing information for the corresponding data usage. Refer to [Data Usage Processing](https://www.twilio.com/docs/iot/supersim/api/usage-record-resource#data-usage-processing) for more details. - """ - return self._properties["billed_unit"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/sync/v1/service/__init__.py b/twilio/rest/sync/v1/service/__init__.py index 975f32ef1..690932f8e 100644 --- a/twilio/rest/sync/v1/service/__init__.py +++ b/twilio/rest/sync/v1/service/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,37 +28,58 @@ class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the ServiceInstance - """ + + """ + :ivar sid: The unique string that we created to identify the Service resource. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. It is a read-only property, it cannot be assigned using REST API. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :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 Service resource. + :ivar webhook_url: The URL we call when Sync objects are manipulated. + :ivar webhooks_from_rest_enabled: Whether the Service instance should call `webhook_url` when the REST API is used to update Sync objects. The default is `false`. + :ivar reachability_webhooks_enabled: Whether the service instance calls `webhook_url` when client endpoints connect to Sync. The default is `false`. + :ivar acl_enabled: Whether token identities in the Service must be granted access to Sync objects by using the [Permissions](https://www.twilio.com/docs/sync/api/sync-permissions) resource. It is disabled (false) by default. + :ivar reachability_debouncing_enabled: Whether every `endpoint_disconnected` event should occur after a configurable delay. The default is `false`, where the `endpoint_disconnected` event occurs immediately after disconnection. When `true`, intervening reconnections can prevent the `endpoint_disconnected` event. + :ivar reachability_debouncing_window: The reachability event delay in milliseconds if `reachability_debouncing_enabled` = `true`. Must be between 1,000 and 30,000 and defaults to 5,000. This is the number of milliseconds after the last running client disconnects, and a Sync identity is declared offline, before `webhook_url` is called, if all endpoints remain offline. A reconnection from the same identity by any endpoint during this interval prevents the reachability event from occurring. + :ivar links: The URLs of related resources. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "webhook_url": payload.get("webhook_url"), - "webhooks_from_rest_enabled": payload.get("webhooks_from_rest_enabled"), - "reachability_webhooks_enabled": payload.get( - "reachability_webhooks_enabled" - ), - "acl_enabled": payload.get("acl_enabled"), - "reachability_debouncing_enabled": payload.get( - "reachability_debouncing_enabled" - ), - "reachability_debouncing_window": deserialize.integer( - payload.get("reachability_debouncing_window") - ), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.account_sid: Optional[str] = payload.get("account_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + 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.webhook_url: Optional[str] = payload.get("webhook_url") + self.webhooks_from_rest_enabled: Optional[bool] = payload.get( + "webhooks_from_rest_enabled" + ) + self.reachability_webhooks_enabled: Optional[bool] = payload.get( + "reachability_webhooks_enabled" + ) + self.acl_enabled: Optional[bool] = payload.get("acl_enabled") + self.reachability_debouncing_enabled: Optional[bool] = payload.get( + "reachability_debouncing_enabled" + ) + self.reachability_debouncing_window: Optional[int] = deserialize.integer( + payload.get("reachability_debouncing_window") + ) + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ServiceContext] = None @@ -77,104 +98,6 @@ def _proxy(self) -> "ServiceContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Service resource. - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. It is a read-only property, it cannot be assigned using REST API. - """ - return self._properties["unique_name"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Service resource. - """ - return self._properties["url"] - - @property - def webhook_url(self) -> str: - """ - :returns: The URL we call when Sync objects are manipulated. - """ - return self._properties["webhook_url"] - - @property - def webhooks_from_rest_enabled(self) -> bool: - """ - :returns: Whether the Service instance should call `webhook_url` when the REST API is used to update Sync objects. The default is `false`. - """ - return self._properties["webhooks_from_rest_enabled"] - - @property - def reachability_webhooks_enabled(self) -> bool: - """ - :returns: Whether the service instance calls `webhook_url` when client endpoints connect to Sync. The default is `false`. - """ - return self._properties["reachability_webhooks_enabled"] - - @property - def acl_enabled(self) -> bool: - """ - :returns: Whether token identities in the Service must be granted access to Sync objects by using the [Permissions](https://www.twilio.com/docs/sync/api/sync-permissions) resource. It is disabled (false) by default. - """ - return self._properties["acl_enabled"] - - @property - def reachability_debouncing_enabled(self) -> bool: - """ - :returns: Whether every `endpoint_disconnected` event should occur after a configurable delay. The default is `false`, where the `endpoint_disconnected` event occurs immediately after disconnection. When `true`, intervening reconnections can prevent the `endpoint_disconnected` event. - """ - return self._properties["reachability_debouncing_enabled"] - - @property - def reachability_debouncing_window(self) -> int: - """ - :returns: The reachability event delay in milliseconds if `reachability_debouncing_enabled` = `true`. Must be between 1,000 and 30,000 and defaults to 5,000. This is the number of milliseconds after the last running client disconnects, and a Sync identity is declared offline, before `webhook_url` is called, if all endpoints remain offline. A reconnection from the same identity by any endpoint during this interval prevents the reachability event from occurring. - """ - return self._properties["reachability_debouncing_window"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the ServiceInstance diff --git a/twilio/rest/sync/v1/service/document/__init__.py b/twilio/rest/sync/v1/service/document/__init__.py index 1f5ddf081..7a7032910 100644 --- a/twilio/rest/sync/v1/service/document/__init__.py +++ b/twilio/rest/sync/v1/service/document/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,30 +27,53 @@ class DocumentInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the DocumentInstance - """ + + """ + :ivar sid: The unique string that we created to identify the Document resource. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource and can be up to 320 characters long. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Document resource. + :ivar service_sid: The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. + :ivar url: The absolute URL of the Document resource. + :ivar links: The URLs of resources related to the Sync Document. + :ivar revision: The current revision of the Sync Document, represented as a string. The `revision` property is used with conditional updates to ensure data consistency. + :ivar data: An arbitrary, schema-less object that the Sync Document stores. Can be up to 16 KiB in length. + :ivar date_expires: The date and time in GMT when the Sync Document expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Sync Document does not expire, this value is `null`. The Document resource might not be deleted immediately after it expires. + :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 created_by: The identity of the Sync Document's creator. If the Sync Document is created from the client SDK, the value matches the Access Token's `identity` field. If the Sync Document was created from the REST API, the value is `system`. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "url": payload.get("url"), - "links": payload.get("links"), - "revision": payload.get("revision"), - "data": payload.get("data"), - "date_expires": deserialize.iso8601_datetime(payload.get("date_expires")), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "created_by": payload.get("created_by"), - } + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.revision: Optional[str] = payload.get("revision") + self.data: Optional[Dict[str, object]] = payload.get("data") + self.date_expires: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_expires") + ) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.created_by: Optional[str] = payload.get("created_by") self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[DocumentContext] = None @@ -70,90 +93,6 @@ def _proxy(self) -> "DocumentContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Document resource. - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource and can be up to 320 characters long. - """ - return self._properties["unique_name"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Document resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Document resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of resources related to the Sync Document. - """ - return self._properties["links"] - - @property - def revision(self) -> str: - """ - :returns: The current revision of the Sync Document, represented as a string. The `revision` property is used with conditional updates to ensure data consistency. - """ - return self._properties["revision"] - - @property - def data(self) -> Dict[str, object]: - """ - :returns: An arbitrary, schema-less object that the Sync Document stores. Can be up to 16 KiB in length. - """ - return self._properties["data"] - - @property - def date_expires(self) -> datetime: - """ - :returns: The date and time in GMT when the Sync Document expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Sync Document does not expire, this value is `null`. The Document resource might not be deleted immediately after it expires. - """ - return self._properties["date_expires"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def created_by(self) -> str: - """ - :returns: The identity of the Sync Document's creator. If the Sync Document is created from the client SDK, the value matches the Access Token's `identity` field. If the Sync Document was created from the REST API, the value is `system`. - """ - return self._properties["created_by"] - def delete(self) -> bool: """ Deletes the DocumentInstance diff --git a/twilio/rest/sync/v1/service/document/document_permission.py b/twilio/rest/sync/v1/service/document/document_permission.py index 24a060ad2..f951b99a8 100644 --- a/twilio/rest/sync/v1/service/document/document_permission.py +++ b/twilio/rest/sync/v1/service/document/document_permission.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,34 +23,41 @@ class DocumentPermissionInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Document Permission resource. + :ivar service_sid: The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. + :ivar document_sid: The SID of the Sync Document to which the Document Permission applies. + :ivar identity: The application-defined string that uniquely identifies the resource's User within the Service to an FPA token. + :ivar read: Whether the identity can read the Sync Document. + :ivar write: Whether the identity can update the Sync Document. + :ivar manage: Whether the identity can delete the Sync Document. + :ivar url: The absolute URL of the Sync Document Permission resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, document_sid: str, identity: Optional[str] = None, ): - """ - Initialize the DocumentPermissionInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "document_sid": payload.get("document_sid"), - "identity": payload.get("identity"), - "read": payload.get("read"), - "write": payload.get("write"), - "manage": payload.get("manage"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.document_sid: Optional[str] = payload.get("document_sid") + self.identity: Optional[str] = payload.get("identity") + self.read: Optional[bool] = payload.get("read") + self.write: Optional[bool] = payload.get("write") + self.manage: Optional[bool] = payload.get("manage") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, "document_sid": document_sid, - "identity": identity or self._properties["identity"], + "identity": identity or self.identity, } self._context: Optional[DocumentPermissionContext] = None @@ -71,62 +78,6 @@ def _proxy(self) -> "DocumentPermissionContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Document Permission resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def document_sid(self) -> str: - """ - :returns: The SID of the Sync Document to which the Document Permission applies. - """ - return self._properties["document_sid"] - - @property - def identity(self) -> str: - """ - :returns: The application-defined string that uniquely identifies the resource's User within the Service to an FPA token. - """ - return self._properties["identity"] - - @property - def read(self) -> bool: - """ - :returns: Whether the identity can read the Sync Document. - """ - return self._properties["read"] - - @property - def write(self) -> bool: - """ - :returns: Whether the identity can update the Sync Document. - """ - return self._properties["write"] - - @property - def manage(self) -> bool: - """ - :returns: Whether the identity can delete the Sync Document. - """ - return self._properties["manage"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Sync Document Permission resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the DocumentPermissionInstance diff --git a/twilio/rest/sync/v1/service/sync_list/__init__.py b/twilio/rest/sync/v1/service/sync_list/__init__.py index cc679bbf2..100dfd412 100644 --- a/twilio/rest/sync/v1/service/sync_list/__init__.py +++ b/twilio/rest/sync/v1/service/sync_list/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,29 +28,51 @@ class SyncListInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the SyncListInstance - """ + + """ + :ivar sid: The unique string that we created to identify the Sync List resource. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync List resource. + :ivar service_sid: The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. + :ivar url: The absolute URL of the Sync List resource. + :ivar links: The URLs of the Sync List's nested resources. + :ivar revision: The current revision of the Sync List, represented as a string. + :ivar date_expires: The date and time in GMT when the Sync List expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Sync List does not expire, this value is `null`. The Sync List might not be deleted immediately after it expires. + :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 created_by: The identity of the Sync List's creator. If the Sync List is created from the client SDK, the value matches the Access Token's `identity` field. If the Sync List was created from the REST API, the value is `system`. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "url": payload.get("url"), - "links": payload.get("links"), - "revision": payload.get("revision"), - "date_expires": deserialize.iso8601_datetime(payload.get("date_expires")), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "created_by": payload.get("created_by"), - } + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.revision: Optional[str] = payload.get("revision") + self.date_expires: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_expires") + ) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.created_by: Optional[str] = payload.get("created_by") self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[SyncListContext] = None @@ -70,83 +92,6 @@ def _proxy(self) -> "SyncListContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Sync List resource. - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - """ - return self._properties["unique_name"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync List resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Sync List resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of the Sync List's nested resources. - """ - return self._properties["links"] - - @property - def revision(self) -> str: - """ - :returns: The current revision of the Sync List, represented as a string. - """ - return self._properties["revision"] - - @property - def date_expires(self) -> datetime: - """ - :returns: The date and time in GMT when the Sync List expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Sync List does not expire, this value is `null`. The Sync List might not be deleted immediately after it expires. - """ - return self._properties["date_expires"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def created_by(self) -> str: - """ - :returns: The identity of the Sync List's creator. If the Sync List is created from the client SDK, the value matches the Access Token's `identity` field. If the Sync List was created from the REST API, the value is `system`. - """ - return self._properties["created_by"] - def delete(self) -> bool: """ Deletes the SyncListInstance diff --git a/twilio/rest/sync/v1/service/sync_list/sync_list_item.py b/twilio/rest/sync/v1/service/sync_list/sync_list_item.py index 5c23a85c7..f3928b4d4 100644 --- a/twilio/rest/sync/v1/service/sync_list/sync_list_item.py +++ b/twilio/rest/sync/v1/service/sync_list/sync_list_item.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -32,37 +32,52 @@ class QueryResultOrder(object): ASC = "asc" DESC = "desc" + """ + :ivar index: The automatically generated index of the List Item. The `index` values of the List Items in a Sync List can have gaps in their sequence. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the List Item resource. + :ivar service_sid: The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. + :ivar list_sid: The SID of the Sync List that contains the List Item. + :ivar url: The absolute URL of the List Item resource. + :ivar revision: The current revision of the item, represented as a string. + :ivar data: An arbitrary, schema-less object that the List Item stores. Can be up to 16 KiB in length. + :ivar date_expires: The date and time in GMT when the List Item expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the List Item does not expire, this value is `null`. The List Item resource might not be deleted immediately after it expires. + :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 created_by: The identity of the List Item's creator. If the item is created from the client SDK, the value matches the Access Token's `identity` field. If the item was created from the REST API, the value is `system`. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, list_sid: str, index: Optional[int] = None, ): - """ - Initialize the SyncListItemInstance - """ super().__init__(version) - self._properties = { - "index": deserialize.integer(payload.get("index")), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "list_sid": payload.get("list_sid"), - "url": payload.get("url"), - "revision": payload.get("revision"), - "data": payload.get("data"), - "date_expires": deserialize.iso8601_datetime(payload.get("date_expires")), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "created_by": payload.get("created_by"), - } + self.index: Optional[int] = deserialize.integer(payload.get("index")) + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.list_sid: Optional[str] = payload.get("list_sid") + self.url: Optional[str] = payload.get("url") + self.revision: Optional[str] = payload.get("revision") + self.data: Optional[Dict[str, object]] = payload.get("data") + self.date_expires: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_expires") + ) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.created_by: Optional[str] = payload.get("created_by") self._solution = { "service_sid": service_sid, "list_sid": list_sid, - "index": index or self._properties["index"], + "index": index or self.index, } self._context: Optional[SyncListItemContext] = None @@ -83,83 +98,6 @@ def _proxy(self) -> "SyncListItemContext": ) return self._context - @property - def index(self) -> int: - """ - :returns: The automatically generated index of the List Item. The `index` values of the List Items in a Sync List can have gaps in their sequence. - """ - return self._properties["index"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the List Item resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def list_sid(self) -> str: - """ - :returns: The SID of the Sync List that contains the List Item. - """ - return self._properties["list_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the List Item resource. - """ - return self._properties["url"] - - @property - def revision(self) -> str: - """ - :returns: The current revision of the item, represented as a string. - """ - return self._properties["revision"] - - @property - def data(self) -> Dict[str, object]: - """ - :returns: An arbitrary, schema-less object that the List Item stores. Can be up to 16 KiB in length. - """ - return self._properties["data"] - - @property - def date_expires(self) -> datetime: - """ - :returns: The date and time in GMT when the List Item expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the List Item does not expire, this value is `null`. The List Item resource might not be deleted immediately after it expires. - """ - return self._properties["date_expires"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def created_by(self) -> str: - """ - :returns: The identity of the List Item's creator. If the item is created from the client SDK, the value matches the Access Token's `identity` field. If the item was created from the REST API, the value is `system`. - """ - return self._properties["created_by"] - def delete(self, if_match=values.unset) -> bool: """ Deletes the SyncListItemInstance diff --git a/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py b/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py index f05b751a5..698b69975 100644 --- a/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py +++ b/twilio/rest/sync/v1/service/sync_list/sync_list_permission.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,34 +23,41 @@ class SyncListPermissionInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync List Permission resource. + :ivar service_sid: The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. + :ivar list_sid: The SID of the Sync List to which the Permission applies. + :ivar identity: The application-defined string that uniquely identifies the resource's User within the Service to an FPA token. + :ivar read: Whether the identity can read the Sync List and its Items. + :ivar write: Whether the identity can create, update, and delete Items in the Sync List. + :ivar manage: Whether the identity can delete the Sync List. + :ivar url: The absolute URL of the Sync List Permission resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, list_sid: str, identity: Optional[str] = None, ): - """ - Initialize the SyncListPermissionInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "list_sid": payload.get("list_sid"), - "identity": payload.get("identity"), - "read": payload.get("read"), - "write": payload.get("write"), - "manage": payload.get("manage"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.list_sid: Optional[str] = payload.get("list_sid") + self.identity: Optional[str] = payload.get("identity") + self.read: Optional[bool] = payload.get("read") + self.write: Optional[bool] = payload.get("write") + self.manage: Optional[bool] = payload.get("manage") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, "list_sid": list_sid, - "identity": identity or self._properties["identity"], + "identity": identity or self.identity, } self._context: Optional[SyncListPermissionContext] = None @@ -71,62 +78,6 @@ def _proxy(self) -> "SyncListPermissionContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync List Permission resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def list_sid(self) -> str: - """ - :returns: The SID of the Sync List to which the Permission applies. - """ - return self._properties["list_sid"] - - @property - def identity(self) -> str: - """ - :returns: The application-defined string that uniquely identifies the resource's User within the Service to an FPA token. - """ - return self._properties["identity"] - - @property - def read(self) -> bool: - """ - :returns: Whether the identity can read the Sync List and its Items. - """ - return self._properties["read"] - - @property - def write(self) -> bool: - """ - :returns: Whether the identity can create, update, and delete Items in the Sync List. - """ - return self._properties["write"] - - @property - def manage(self) -> bool: - """ - :returns: Whether the identity can delete the Sync List. - """ - return self._properties["manage"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Sync List Permission resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the SyncListPermissionInstance diff --git a/twilio/rest/sync/v1/service/sync_map/__init__.py b/twilio/rest/sync/v1/service/sync_map/__init__.py index dfdf1823c..82167ea6b 100644 --- a/twilio/rest/sync/v1/service/sync_map/__init__.py +++ b/twilio/rest/sync/v1/service/sync_map/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,29 +28,51 @@ class SyncMapInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the SyncMapInstance - """ + + """ + :ivar sid: The unique string that we created to identify the Sync Map resource. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync Map resource. + :ivar service_sid: The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. + :ivar url: The absolute URL of the Sync Map resource. + :ivar links: The URLs of the Sync Map's nested resources. + :ivar revision: The current revision of the Sync Map, represented as a string. + :ivar date_expires: The date and time in GMT when the Sync Map expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Sync Map does not expire, this value is `null`. The Sync Map might not be deleted immediately after it expires. + :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 created_by: The identity of the Sync Map's creator. If the Sync Map is created from the client SDK, the value matches the Access Token's `identity` field. If the Sync Map was created from the REST API, the value is `system`. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "url": payload.get("url"), - "links": payload.get("links"), - "revision": payload.get("revision"), - "date_expires": deserialize.iso8601_datetime(payload.get("date_expires")), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "created_by": payload.get("created_by"), - } + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.revision: Optional[str] = payload.get("revision") + self.date_expires: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_expires") + ) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.created_by: Optional[str] = payload.get("created_by") self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[SyncMapContext] = None @@ -70,83 +92,6 @@ def _proxy(self) -> "SyncMapContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Sync Map resource. - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - """ - return self._properties["unique_name"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync Map resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Sync Map resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of the Sync Map's nested resources. - """ - return self._properties["links"] - - @property - def revision(self) -> str: - """ - :returns: The current revision of the Sync Map, represented as a string. - """ - return self._properties["revision"] - - @property - def date_expires(self) -> datetime: - """ - :returns: The date and time in GMT when the Sync Map expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Sync Map does not expire, this value is `null`. The Sync Map might not be deleted immediately after it expires. - """ - return self._properties["date_expires"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def created_by(self) -> str: - """ - :returns: The identity of the Sync Map's creator. If the Sync Map is created from the client SDK, the value matches the Access Token's `identity` field. If the Sync Map was created from the REST API, the value is `system`. - """ - return self._properties["created_by"] - def delete(self) -> bool: """ Deletes the SyncMapInstance diff --git a/twilio/rest/sync/v1/service/sync_map/sync_map_item.py b/twilio/rest/sync/v1/service/sync_map/sync_map_item.py index 76c8981d3..39fb53ab3 100644 --- a/twilio/rest/sync/v1/service/sync_map/sync_map_item.py +++ b/twilio/rest/sync/v1/service/sync_map/sync_map_item.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -32,37 +32,52 @@ class QueryResultOrder(object): ASC = "asc" DESC = "desc" + """ + :ivar key: The unique, user-defined key for the Map Item. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Map Item resource. + :ivar service_sid: The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. + :ivar map_sid: The SID of the Sync Map that contains the Map Item. + :ivar url: The absolute URL of the Map Item resource. + :ivar revision: The current revision of the Map Item, represented as a string. + :ivar data: An arbitrary, schema-less object that the Map Item stores. Can be up to 16 KiB in length. + :ivar date_expires: The date and time in GMT when the Map Item expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Map Item does not expire, this value is `null`. The Map Item might not be deleted immediately after it expires. + :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 created_by: The identity of the Map Item's creator. If the Map Item is created from the client SDK, the value matches the Access Token's `identity` field. If the Map Item was created from the REST API, the value is `system`. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, map_sid: str, key: Optional[str] = None, ): - """ - Initialize the SyncMapItemInstance - """ super().__init__(version) - self._properties = { - "key": payload.get("key"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "map_sid": payload.get("map_sid"), - "url": payload.get("url"), - "revision": payload.get("revision"), - "data": payload.get("data"), - "date_expires": deserialize.iso8601_datetime(payload.get("date_expires")), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "created_by": payload.get("created_by"), - } + self.key: Optional[str] = payload.get("key") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.map_sid: Optional[str] = payload.get("map_sid") + self.url: Optional[str] = payload.get("url") + self.revision: Optional[str] = payload.get("revision") + self.data: Optional[Dict[str, object]] = payload.get("data") + self.date_expires: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_expires") + ) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.created_by: Optional[str] = payload.get("created_by") self._solution = { "service_sid": service_sid, "map_sid": map_sid, - "key": key or self._properties["key"], + "key": key or self.key, } self._context: Optional[SyncMapItemContext] = None @@ -83,83 +98,6 @@ def _proxy(self) -> "SyncMapItemContext": ) return self._context - @property - def key(self) -> str: - """ - :returns: The unique, user-defined key for the Map Item. - """ - return self._properties["key"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Map Item resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def map_sid(self) -> str: - """ - :returns: The SID of the Sync Map that contains the Map Item. - """ - return self._properties["map_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Map Item resource. - """ - return self._properties["url"] - - @property - def revision(self) -> str: - """ - :returns: The current revision of the Map Item, represented as a string. - """ - return self._properties["revision"] - - @property - def data(self) -> Dict[str, object]: - """ - :returns: An arbitrary, schema-less object that the Map Item stores. Can be up to 16 KiB in length. - """ - return self._properties["data"] - - @property - def date_expires(self) -> datetime: - """ - :returns: The date and time in GMT when the Map Item expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Map Item does not expire, this value is `null`. The Map Item might not be deleted immediately after it expires. - """ - return self._properties["date_expires"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def created_by(self) -> str: - """ - :returns: The identity of the Map Item's creator. If the Map Item is created from the client SDK, the value matches the Access Token's `identity` field. If the Map Item was created from the REST API, the value is `system`. - """ - return self._properties["created_by"] - def delete(self, if_match=values.unset) -> bool: """ Deletes the SyncMapItemInstance diff --git a/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py b/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py index 5fe3dd3b2..09b82b2ce 100644 --- a/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py +++ b/twilio/rest/sync/v1/service/sync_map/sync_map_permission.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,34 +23,41 @@ class SyncMapPermissionInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync Map Permission resource. + :ivar service_sid: The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. + :ivar map_sid: The SID of the Sync Map to which the Permission applies. + :ivar identity: The application-defined string that uniquely identifies the resource's User within the Service to an FPA token. + :ivar read: Whether the identity can read the Sync Map and its Items. + :ivar write: Whether the identity can create, update, and delete Items in the Sync Map. + :ivar manage: Whether the identity can delete the Sync Map. + :ivar url: The absolute URL of the Sync Map Permission resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, map_sid: str, identity: Optional[str] = None, ): - """ - Initialize the SyncMapPermissionInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "map_sid": payload.get("map_sid"), - "identity": payload.get("identity"), - "read": payload.get("read"), - "write": payload.get("write"), - "manage": payload.get("manage"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.map_sid: Optional[str] = payload.get("map_sid") + self.identity: Optional[str] = payload.get("identity") + self.read: Optional[bool] = payload.get("read") + self.write: Optional[bool] = payload.get("write") + self.manage: Optional[bool] = payload.get("manage") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, "map_sid": map_sid, - "identity": identity or self._properties["identity"], + "identity": identity or self.identity, } self._context: Optional[SyncMapPermissionContext] = None @@ -71,62 +78,6 @@ def _proxy(self) -> "SyncMapPermissionContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync Map Permission resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def map_sid(self) -> str: - """ - :returns: The SID of the Sync Map to which the Permission applies. - """ - return self._properties["map_sid"] - - @property - def identity(self) -> str: - """ - :returns: The application-defined string that uniquely identifies the resource's User within the Service to an FPA token. - """ - return self._properties["identity"] - - @property - def read(self) -> bool: - """ - :returns: Whether the identity can read the Sync Map and its Items. - """ - return self._properties["read"] - - @property - def write(self) -> bool: - """ - :returns: Whether the identity can create, update, and delete Items in the Sync Map. - """ - return self._properties["write"] - - @property - def manage(self) -> bool: - """ - :returns: Whether the identity can delete the Sync Map. - """ - return self._properties["manage"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Sync Map Permission resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the SyncMapPermissionInstance diff --git a/twilio/rest/sync/v1/service/sync_stream/__init__.py b/twilio/rest/sync/v1/service/sync_stream/__init__.py index 1c9d60f98..3f4fbce2f 100644 --- a/twilio/rest/sync/v1/service/sync_stream/__init__.py +++ b/twilio/rest/sync/v1/service/sync_stream/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -25,28 +25,49 @@ class SyncStreamInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the SyncStreamInstance - """ + + """ + :ivar sid: The unique string that we created to identify the Sync Stream resource. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync Stream resource. + :ivar service_sid: The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. + :ivar url: The absolute URL of the Message Stream resource. + :ivar links: The URLs of the Stream's nested resources. + :ivar date_expires: The date and time in GMT when the Message Stream expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Message Stream does not expire, this value is `null`. The Stream might not be deleted immediately after it expires. + :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 created_by: The identity of the Stream's creator. If the Stream is created from the client SDK, the value matches the Access Token's `identity` field. If the Stream was created from the REST API, the value is 'system'. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "url": payload.get("url"), - "links": payload.get("links"), - "date_expires": deserialize.iso8601_datetime(payload.get("date_expires")), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "created_by": payload.get("created_by"), - } + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.date_expires: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_expires") + ) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.created_by: Optional[str] = payload.get("created_by") self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[SyncStreamContext] = None @@ -66,76 +87,6 @@ def _proxy(self) -> "SyncStreamContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Sync Stream resource. - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - """ - return self._properties["unique_name"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Sync Stream resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Sync Service](https://www.twilio.com/docs/sync/api/service) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Message Stream resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of the Stream's nested resources. - """ - return self._properties["links"] - - @property - def date_expires(self) -> datetime: - """ - :returns: The date and time in GMT when the Message Stream expires and will be deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. If the Message Stream does not expire, this value is `null`. The Stream might not be deleted immediately after it expires. - """ - return self._properties["date_expires"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def created_by(self) -> str: - """ - :returns: The identity of the Stream's creator. If the Stream is created from the client SDK, the value matches the Access Token's `identity` field. If the Stream was created from the REST API, the value is 'system'. - """ - return self._properties["created_by"] - def delete(self) -> bool: """ Deletes the SyncStreamInstance diff --git a/twilio/rest/sync/v1/service/sync_stream/stream_message.py b/twilio/rest/sync/v1/service/sync_stream/stream_message.py index 71d917839..c3dfa904a 100644 --- a/twilio/rest/sync/v1/service/sync_stream/stream_message.py +++ b/twilio/rest/sync/v1/service/sync_stream/stream_message.py @@ -13,7 +13,7 @@ """ -from typing import Dict +from typing import Any, Dict, Optional from twilio.base import serialize, values from twilio.base.instance_resource import InstanceResource @@ -22,36 +22,29 @@ class StreamMessageInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, stream_sid: str): - """ - Initialize the StreamMessageInstance - """ + + """ + :ivar sid: The unique string that we created to identify the Stream Message resource. + :ivar data: An arbitrary, schema-less object that contains the Stream Message body. Can be up to 4 KiB in length. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + stream_sid: str, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "data": payload.get("data"), - } + self.sid: Optional[str] = payload.get("sid") + self.data: Optional[Dict[str, object]] = payload.get("data") self._solution = { "service_sid": service_sid, "stream_sid": stream_sid, } - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Stream Message resource. - """ - return self._properties["sid"] - - @property - def data(self) -> Dict[str, object]: - """ - :returns: An arbitrary, schema-less object that contains the Stream Message body. Can be up to 4 KiB in length. - """ - return self._properties["data"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/taskrouter/v1/workspace/__init__.py b/twilio/rest/taskrouter/v1/workspace/__init__.py index 9f20f7c61..73b559be7 100644 --- a/twilio/rest/taskrouter/v1/workspace/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -44,32 +44,53 @@ class QueueOrder(object): FIFO = "FIFO" LIFO = "LIFO" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the WorkspaceInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workspace resource. + :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 default_activity_name: The name of the default activity. + :ivar default_activity_sid: The SID of the Activity that will be used when new Workers are created in the Workspace. + :ivar event_callback_url: The URL we call when an event occurs. If provided, the Workspace will publish events to this URL, for example, to collect data for reporting. See [Workspace Events](https://www.twilio.com/docs/taskrouter/api/event) for more information. This parameter supports Twilio's [Webhooks (HTTP callbacks) Connection Overrides](https://www.twilio.com/docs/usage/webhooks/webhooks-connection-overrides). + :ivar events_filter: The list of Workspace events for which to call `event_callback_url`. For example, if `EventsFilter=task.created, task.canceled, worker.activity.update`, then TaskRouter will call event_callback_url only when a task is created, canceled, or a Worker activity is updated. + :ivar friendly_name: The string that you assigned to describe the Workspace resource. For example `Customer Support` or `2014 Election Campaign`. + :ivar multi_task_enabled: Whether multi-tasking is enabled. The default is `true`, which enables multi-tasking. Multi-tasking allows Workers to handle multiple Tasks simultaneously. When enabled (`true`), each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking each Worker would only receive a new reservation when the previous task is completed. Learn more at [Multitasking](https://www.twilio.com/docs/taskrouter/multitasking). + :ivar sid: The unique string that we created to identify the Workspace resource. + :ivar timeout_activity_name: The name of the timeout activity. + :ivar timeout_activity_sid: The SID of the Activity that will be assigned to a Worker when a Task reservation times out without a response. + :ivar prioritize_queue_order: + :ivar url: The absolute URL of the Workspace resource. + :ivar links: The URLs of related resources. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "default_activity_name": payload.get("default_activity_name"), - "default_activity_sid": payload.get("default_activity_sid"), - "event_callback_url": payload.get("event_callback_url"), - "events_filter": payload.get("events_filter"), - "friendly_name": payload.get("friendly_name"), - "multi_task_enabled": payload.get("multi_task_enabled"), - "sid": payload.get("sid"), - "timeout_activity_name": payload.get("timeout_activity_name"), - "timeout_activity_sid": payload.get("timeout_activity_sid"), - "prioritize_queue_order": payload.get("prioritize_queue_order"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.default_activity_name: Optional[str] = payload.get("default_activity_name") + self.default_activity_sid: Optional[str] = payload.get("default_activity_sid") + self.event_callback_url: Optional[str] = payload.get("event_callback_url") + self.events_filter: Optional[str] = payload.get("events_filter") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.multi_task_enabled: Optional[bool] = payload.get("multi_task_enabled") + self.sid: Optional[str] = payload.get("sid") + self.timeout_activity_name: Optional[str] = payload.get("timeout_activity_name") + self.timeout_activity_sid: Optional[str] = payload.get("timeout_activity_sid") + self.prioritize_queue_order: Optional[ + "WorkspaceInstance.QueueOrder" + ] = payload.get("prioritize_queue_order") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[WorkspaceContext] = None @@ -88,111 +109,6 @@ def _proxy(self) -> "WorkspaceContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workspace resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def default_activity_name(self) -> str: - """ - :returns: The name of the default activity. - """ - return self._properties["default_activity_name"] - - @property - def default_activity_sid(self) -> str: - """ - :returns: The SID of the Activity that will be used when new Workers are created in the Workspace. - """ - return self._properties["default_activity_sid"] - - @property - def event_callback_url(self) -> str: - """ - :returns: The URL we call when an event occurs. If provided, the Workspace will publish events to this URL, for example, to collect data for reporting. See [Workspace Events](https://www.twilio.com/docs/taskrouter/api/event) for more information. This parameter supports Twilio's [Webhooks (HTTP callbacks) Connection Overrides](https://www.twilio.com/docs/usage/webhooks/webhooks-connection-overrides). - """ - return self._properties["event_callback_url"] - - @property - def events_filter(self) -> str: - """ - :returns: The list of Workspace events for which to call `event_callback_url`. For example, if `EventsFilter=task.created, task.canceled, worker.activity.update`, then TaskRouter will call event_callback_url only when a task is created, canceled, or a Worker activity is updated. - """ - return self._properties["events_filter"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the Workspace resource. For example `Customer Support` or `2014 Election Campaign`. - """ - return self._properties["friendly_name"] - - @property - def multi_task_enabled(self) -> bool: - """ - :returns: Whether multi-tasking is enabled. The default is `true`, which enables multi-tasking. Multi-tasking allows Workers to handle multiple Tasks simultaneously. When enabled (`true`), each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking each Worker would only receive a new reservation when the previous task is completed. Learn more at [Multitasking](https://www.twilio.com/docs/taskrouter/multitasking). - """ - return self._properties["multi_task_enabled"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Workspace resource. - """ - return self._properties["sid"] - - @property - def timeout_activity_name(self) -> str: - """ - :returns: The name of the timeout activity. - """ - return self._properties["timeout_activity_name"] - - @property - def timeout_activity_sid(self) -> str: - """ - :returns: The SID of the Activity that will be assigned to a Worker when a Task reservation times out without a response. - """ - return self._properties["timeout_activity_sid"] - - @property - def prioritize_queue_order(self) -> "WorkspaceInstance.QueueOrder": - """ - :returns: - """ - return self._properties["prioritize_queue_order"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Workspace resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the WorkspaceInstance diff --git a/twilio/rest/taskrouter/v1/workspace/activity.py b/twilio/rest/taskrouter/v1/workspace/activity.py index 137986490..d66491eed 100644 --- a/twilio/rest/taskrouter/v1/workspace/activity.py +++ b/twilio/rest/taskrouter/v1/workspace/activity.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,27 +24,45 @@ class ActivityInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid: str, sid: Optional[str] = None): - """ - Initialize the ActivityInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Activity resource. + :ivar available: Whether the Worker is eligible to receive a Task when it occupies the Activity. A value of `true`, `1`, or `yes` indicates the Activity is available. All other values indicate that it is not. The value cannot be changed after the Activity is created. + :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 friendly_name: The string that you assigned to describe the Activity resource. + :ivar sid: The unique string that we created to identify the Activity resource. + :ivar workspace_sid: The SID of the Workspace that contains the Activity. + :ivar url: The absolute URL of the Activity resource. + :ivar links: + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + workspace_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "available": payload.get("available"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "sid": payload.get("sid"), - "workspace_sid": payload.get("workspace_sid"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.available: Optional[bool] = payload.get("available") + 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.friendly_name: Optional[str] = payload.get("friendly_name") + self.sid: Optional[str] = payload.get("sid") + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "workspace_sid": workspace_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ActivityContext] = None @@ -64,69 +82,6 @@ def _proxy(self) -> "ActivityContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Activity resource. - """ - return self._properties["account_sid"] - - @property - def available(self) -> bool: - """ - :returns: Whether the Worker is eligible to receive a Task when it occupies the Activity. A value of `true`, `1`, or `yes` indicates the Activity is available. All other values indicate that it is not. The value cannot be changed after the Activity is created. - """ - return self._properties["available"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the Activity resource. - """ - return self._properties["friendly_name"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Activity resource. - """ - return self._properties["sid"] - - @property - def workspace_sid(self) -> str: - """ - :returns: The SID of the Workspace that contains the Activity. - """ - return self._properties["workspace_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Activity resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the ActivityInstance diff --git a/twilio/rest/taskrouter/v1/workspace/event.py b/twilio/rest/taskrouter/v1/workspace/event.py index bdc272f8d..5272b8aa7 100644 --- a/twilio/rest/taskrouter/v1/workspace/event.py +++ b/twilio/rest/taskrouter/v1/workspace/event.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,35 +24,59 @@ class EventInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid: str, sid: Optional[str] = None): - """ - Initialize the EventInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Event resource. + :ivar actor_sid: The SID of the resource that triggered the event. + :ivar actor_type: The type of resource that triggered the event. + :ivar actor_url: The absolute URL of the resource that triggered the event. + :ivar description: A description of the event. + :ivar event_data: Data about the event. For more information, see [Event types](https://www.twilio.com/docs/taskrouter/api/event#event-types). + :ivar event_date: The time the event was sent, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar event_date_ms: The time the event was sent in milliseconds. + :ivar event_type: The identifier for the event. + :ivar resource_sid: The SID of the object the event is most relevant to, such as a TaskSid, ReservationSid, or a WorkerSid. + :ivar resource_type: The type of object the event is most relevant to, such as a Task, Reservation, or a Worker). + :ivar resource_url: The URL of the resource the event is most relevant to. + :ivar sid: The unique string that we created to identify the Event resource. + :ivar source: Where the Event originated. + :ivar source_ip_address: The IP from which the Event originated. + :ivar url: The absolute URL of the Event resource. + :ivar workspace_sid: The SID of the Workspace that contains the Event. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + workspace_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "actor_sid": payload.get("actor_sid"), - "actor_type": payload.get("actor_type"), - "actor_url": payload.get("actor_url"), - "description": payload.get("description"), - "event_data": payload.get("event_data"), - "event_date": deserialize.iso8601_datetime(payload.get("event_date")), - "event_date_ms": payload.get("event_date_ms"), - "event_type": payload.get("event_type"), - "resource_sid": payload.get("resource_sid"), - "resource_type": payload.get("resource_type"), - "resource_url": payload.get("resource_url"), - "sid": payload.get("sid"), - "source": payload.get("source"), - "source_ip_address": payload.get("source_ip_address"), - "url": payload.get("url"), - "workspace_sid": payload.get("workspace_sid"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.actor_sid: Optional[str] = payload.get("actor_sid") + self.actor_type: Optional[str] = payload.get("actor_type") + self.actor_url: Optional[str] = payload.get("actor_url") + self.description: Optional[str] = payload.get("description") + self.event_data: Optional[Dict[str, object]] = payload.get("event_data") + self.event_date: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("event_date") + ) + self.event_date_ms: Optional[int] = payload.get("event_date_ms") + self.event_type: Optional[str] = payload.get("event_type") + self.resource_sid: Optional[str] = payload.get("resource_sid") + self.resource_type: Optional[str] = payload.get("resource_type") + self.resource_url: Optional[str] = payload.get("resource_url") + self.sid: Optional[str] = payload.get("sid") + self.source: Optional[str] = payload.get("source") + self.source_ip_address: Optional[str] = payload.get("source_ip_address") + self.url: Optional[str] = payload.get("url") + self.workspace_sid: Optional[str] = payload.get("workspace_sid") self._solution = { "workspace_sid": workspace_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[EventContext] = None @@ -72,125 +96,6 @@ def _proxy(self) -> "EventContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Event resource. - """ - return self._properties["account_sid"] - - @property - def actor_sid(self) -> str: - """ - :returns: The SID of the resource that triggered the event. - """ - return self._properties["actor_sid"] - - @property - def actor_type(self) -> str: - """ - :returns: The type of resource that triggered the event. - """ - return self._properties["actor_type"] - - @property - def actor_url(self) -> str: - """ - :returns: The absolute URL of the resource that triggered the event. - """ - return self._properties["actor_url"] - - @property - def description(self) -> str: - """ - :returns: A description of the event. - """ - return self._properties["description"] - - @property - def event_data(self) -> Dict[str, object]: - """ - :returns: Data about the event. For more information, see [Event types](https://www.twilio.com/docs/taskrouter/api/event#event-types). - """ - return self._properties["event_data"] - - @property - def event_date(self) -> datetime: - """ - :returns: The time the event was sent, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["event_date"] - - @property - def event_date_ms(self) -> int: - """ - :returns: The time the event was sent in milliseconds. - """ - return self._properties["event_date_ms"] - - @property - def event_type(self) -> str: - """ - :returns: The identifier for the event. - """ - return self._properties["event_type"] - - @property - def resource_sid(self) -> str: - """ - :returns: The SID of the object the event is most relevant to, such as a TaskSid, ReservationSid, or a WorkerSid. - """ - return self._properties["resource_sid"] - - @property - def resource_type(self) -> str: - """ - :returns: The type of object the event is most relevant to, such as a Task, Reservation, or a Worker). - """ - return self._properties["resource_type"] - - @property - def resource_url(self) -> str: - """ - :returns: The URL of the resource the event is most relevant to. - """ - return self._properties["resource_url"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Event resource. - """ - return self._properties["sid"] - - @property - def source(self) -> str: - """ - :returns: Where the Event originated. - """ - return self._properties["source"] - - @property - def source_ip_address(self) -> str: - """ - :returns: The IP from which the Event originated. - """ - return self._properties["source_ip_address"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Event resource. - """ - return self._properties["url"] - - @property - def workspace_sid(self) -> str: - """ - :returns: The SID of the Workspace that contains the Event. - """ - return self._properties["workspace_sid"] - def fetch(self) -> "EventInstance": """ Fetch the EventInstance diff --git a/twilio/rest/taskrouter/v1/workspace/task/__init__.py b/twilio/rest/taskrouter/v1/workspace/task/__init__.py index 50aa5632d..bee9ab118 100644 --- a/twilio/rest/taskrouter/v1/workspace/task/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/task/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -33,41 +33,78 @@ class Status(object): COMPLETED = "completed" WRAPPING = "wrapping" - def __init__(self, version, payload, workspace_sid: str, sid: Optional[str] = None): - """ - Initialize the TaskInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Task resource. + :ivar age: The number of seconds since the Task was created. + :ivar assignment_status: + :ivar attributes: The JSON string with custom attributes of the work. **Note** If this property has been assigned a value, it will only be displayed in FETCH action that returns a single resource. Otherwise, it will be null. + :ivar addons: An object that contains the [addon](https://www.twilio.com/docs/taskrouter/marketplace) data for all installed addons. + :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 task_queue_entered_date: The date and time in GMT when the Task entered the TaskQueue, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar priority: The current priority score of the Task as assigned to a Worker by the workflow. Tasks with higher priority values will be assigned before Tasks with lower values. + :ivar reason: The reason the Task was canceled or completed, if applicable. + :ivar sid: The unique string that we created to identify the Task resource. + :ivar task_queue_sid: The SID of the TaskQueue. + :ivar task_queue_friendly_name: The friendly name of the TaskQueue. + :ivar task_channel_sid: The SID of the TaskChannel. + :ivar task_channel_unique_name: The unique name of the TaskChannel. + :ivar timeout: The amount of time in seconds that the Task can live before being assigned. + :ivar workflow_sid: The SID of the Workflow that is controlling the Task. + :ivar workflow_friendly_name: The friendly name of the Workflow that is controlling the Task. + :ivar workspace_sid: The SID of the Workspace that contains the Task. + :ivar url: The absolute URL of the Task resource. + :ivar links: The URLs of related resources. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + workspace_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "age": deserialize.integer(payload.get("age")), - "assignment_status": payload.get("assignment_status"), - "attributes": payload.get("attributes"), - "addons": payload.get("addons"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "task_queue_entered_date": deserialize.iso8601_datetime( - payload.get("task_queue_entered_date") - ), - "priority": deserialize.integer(payload.get("priority")), - "reason": payload.get("reason"), - "sid": payload.get("sid"), - "task_queue_sid": payload.get("task_queue_sid"), - "task_queue_friendly_name": payload.get("task_queue_friendly_name"), - "task_channel_sid": payload.get("task_channel_sid"), - "task_channel_unique_name": payload.get("task_channel_unique_name"), - "timeout": deserialize.integer(payload.get("timeout")), - "workflow_sid": payload.get("workflow_sid"), - "workflow_friendly_name": payload.get("workflow_friendly_name"), - "workspace_sid": payload.get("workspace_sid"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.age: Optional[int] = deserialize.integer(payload.get("age")) + self.assignment_status: Optional["TaskInstance.Status"] = payload.get( + "assignment_status" + ) + self.attributes: Optional[str] = payload.get("attributes") + self.addons: Optional[str] = payload.get("addons") + 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.task_queue_entered_date: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("task_queue_entered_date") + ) + self.priority: Optional[int] = deserialize.integer(payload.get("priority")) + self.reason: Optional[str] = payload.get("reason") + self.sid: Optional[str] = payload.get("sid") + self.task_queue_sid: Optional[str] = payload.get("task_queue_sid") + self.task_queue_friendly_name: Optional[str] = payload.get( + "task_queue_friendly_name" + ) + self.task_channel_sid: Optional[str] = payload.get("task_channel_sid") + self.task_channel_unique_name: Optional[str] = payload.get( + "task_channel_unique_name" + ) + self.timeout: Optional[int] = deserialize.integer(payload.get("timeout")) + self.workflow_sid: Optional[str] = payload.get("workflow_sid") + self.workflow_friendly_name: Optional[str] = payload.get( + "workflow_friendly_name" + ) + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "workspace_sid": workspace_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[TaskContext] = None @@ -87,153 +124,6 @@ def _proxy(self) -> "TaskContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Task resource. - """ - return self._properties["account_sid"] - - @property - def age(self) -> int: - """ - :returns: The number of seconds since the Task was created. - """ - return self._properties["age"] - - @property - def assignment_status(self) -> "TaskInstance.Status": - """ - :returns: - """ - return self._properties["assignment_status"] - - @property - def attributes(self) -> str: - """ - :returns: The JSON string with custom attributes of the work. **Note** If this property has been assigned a value, it will only be displayed in FETCH action that returns a single resource. Otherwise, it will be null. - """ - return self._properties["attributes"] - - @property - def addons(self) -> str: - """ - :returns: An object that contains the [addon](https://www.twilio.com/docs/taskrouter/marketplace) data for all installed addons. - """ - return self._properties["addons"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def task_queue_entered_date(self) -> datetime: - """ - :returns: The date and time in GMT when the Task entered the TaskQueue, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["task_queue_entered_date"] - - @property - def priority(self) -> int: - """ - :returns: The current priority score of the Task as assigned to a Worker by the workflow. Tasks with higher priority values will be assigned before Tasks with lower values. - """ - return self._properties["priority"] - - @property - def reason(self) -> str: - """ - :returns: The reason the Task was canceled or completed, if applicable. - """ - return self._properties["reason"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Task resource. - """ - return self._properties["sid"] - - @property - def task_queue_sid(self) -> str: - """ - :returns: The SID of the TaskQueue. - """ - return self._properties["task_queue_sid"] - - @property - def task_queue_friendly_name(self) -> str: - """ - :returns: The friendly name of the TaskQueue. - """ - return self._properties["task_queue_friendly_name"] - - @property - def task_channel_sid(self) -> str: - """ - :returns: The SID of the TaskChannel. - """ - return self._properties["task_channel_sid"] - - @property - def task_channel_unique_name(self) -> str: - """ - :returns: The unique name of the TaskChannel. - """ - return self._properties["task_channel_unique_name"] - - @property - def timeout(self) -> int: - """ - :returns: The amount of time in seconds that the Task can live before being assigned. - """ - return self._properties["timeout"] - - @property - def workflow_sid(self) -> str: - """ - :returns: The SID of the Workflow that is controlling the Task. - """ - return self._properties["workflow_sid"] - - @property - def workflow_friendly_name(self) -> str: - """ - :returns: The friendly name of the Workflow that is controlling the Task. - """ - return self._properties["workflow_friendly_name"] - - @property - def workspace_sid(self) -> str: - """ - :returns: The SID of the Workspace that contains the Task. - """ - return self._properties["workspace_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Task resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - def delete(self, if_match=values.unset) -> bool: """ Deletes the TaskInstance diff --git a/twilio/rest/taskrouter/v1/workspace/task/reservation.py b/twilio/rest/taskrouter/v1/workspace/task/reservation.py index b55d0333a..6bbcfa876 100644 --- a/twilio/rest/taskrouter/v1/workspace/task/reservation.py +++ b/twilio/rest/taskrouter/v1/workspace/task/reservation.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -34,37 +34,52 @@ class Status(object): WRAPPING = "wrapping" COMPLETED = "completed" + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskReservation resource. + :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 reservation_status: + :ivar sid: The unique string that we created to identify the TaskReservation resource. + :ivar task_sid: The SID of the reserved Task resource. + :ivar worker_name: The `friendly_name` of the Worker that is reserved. + :ivar worker_sid: The SID of the reserved Worker resource. + :ivar workspace_sid: The SID of the Workspace that this task is contained within. + :ivar url: The absolute URL of the TaskReservation reservation. + :ivar links: The URLs of related resources. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], workspace_sid: str, task_sid: str, sid: Optional[str] = None, ): - """ - Initialize the ReservationInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "reservation_status": payload.get("reservation_status"), - "sid": payload.get("sid"), - "task_sid": payload.get("task_sid"), - "worker_name": payload.get("worker_name"), - "worker_sid": payload.get("worker_sid"), - "workspace_sid": payload.get("workspace_sid"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.reservation_status: Optional["ReservationInstance.Status"] = payload.get( + "reservation_status" + ) + self.sid: Optional[str] = payload.get("sid") + self.task_sid: Optional[str] = payload.get("task_sid") + self.worker_name: Optional[str] = payload.get("worker_name") + self.worker_sid: Optional[str] = payload.get("worker_sid") + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "workspace_sid": workspace_sid, "task_sid": task_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ReservationContext] = None @@ -85,83 +100,6 @@ def _proxy(self) -> "ReservationContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskReservation resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def reservation_status(self) -> "ReservationInstance.Status": - """ - :returns: - """ - return self._properties["reservation_status"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the TaskReservation resource. - """ - return self._properties["sid"] - - @property - def task_sid(self) -> str: - """ - :returns: The SID of the reserved Task resource. - """ - return self._properties["task_sid"] - - @property - def worker_name(self) -> str: - """ - :returns: The `friendly_name` of the Worker that is reserved. - """ - return self._properties["worker_name"] - - @property - def worker_sid(self) -> str: - """ - :returns: The SID of the reserved Worker resource. - """ - return self._properties["worker_sid"] - - @property - def workspace_sid(self) -> str: - """ - :returns: The SID of the Workspace that this task is contained within. - """ - return self._properties["workspace_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the TaskReservation reservation. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - def fetch(self) -> "ReservationInstance": """ Fetch the ReservationInstance diff --git a/twilio/rest/taskrouter/v1/workspace/task_channel.py b/twilio/rest/taskrouter/v1/workspace/task_channel.py index ec8f16f2d..202df3608 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_channel.py +++ b/twilio/rest/taskrouter/v1/workspace/task_channel.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,28 +24,49 @@ class TaskChannelInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid: str, sid: Optional[str] = None): - """ - Initialize the TaskChannelInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Task Channel resource. + :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 friendly_name: The string that you assigned to describe the resource. + :ivar sid: The unique string that we created to identify the Task Channel resource. + :ivar unique_name: An application-defined string that uniquely identifies the Task Channel, such as `voice` or `sms`. + :ivar workspace_sid: The SID of the Workspace that contains the Task Channel. + :ivar channel_optimized_routing: Whether the Task Channel will prioritize Workers that have been idle. When `true`, Workers that have been idle the longest are prioritized. + :ivar url: The absolute URL of the Task Channel resource. + :ivar links: The URLs of related resources. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + workspace_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "workspace_sid": payload.get("workspace_sid"), - "channel_optimized_routing": payload.get("channel_optimized_routing"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.channel_optimized_routing: Optional[bool] = payload.get( + "channel_optimized_routing" + ) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "workspace_sid": workspace_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[TaskChannelContext] = None @@ -65,76 +86,6 @@ def _proxy(self) -> "TaskChannelContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Task Channel resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Task Channel resource. - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the Task Channel, such as `voice` or `sms`. - """ - return self._properties["unique_name"] - - @property - def workspace_sid(self) -> str: - """ - :returns: The SID of the Workspace that contains the Task Channel. - """ - return self._properties["workspace_sid"] - - @property - def channel_optimized_routing(self) -> bool: - """ - :returns: Whether the Task Channel will prioritize Workers that have been idle. When `true`, Workers that have been idle the longest are prioritized. - """ - return self._properties["channel_optimized_routing"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Task Channel resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the TaskChannelInstance diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py b/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py index 00d283a47..c84d7f641 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -40,35 +40,68 @@ class TaskOrder(object): FIFO = "FIFO" LIFO = "LIFO" - def __init__(self, version, payload, workspace_sid: str, sid: Optional[str] = None): - """ - Initialize the TaskQueueInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. + :ivar assignment_activity_sid: The SID of the Activity to assign Workers when a task is assigned for them. + :ivar assignment_activity_name: The name of the Activity to assign Workers when a task is assigned for them. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar max_reserved_workers: The maximum number of Workers to reserve for the assignment of a task in the queue. Can be an integer between 1 and 50, inclusive and defaults to 1. + :ivar reservation_activity_sid: The SID of the Activity to assign Workers once a task is reserved for them. + :ivar reservation_activity_name: The name of the Activity to assign Workers once a task is reserved for them. + :ivar sid: The unique string that we created to identify the TaskQueue resource. + :ivar target_workers: A string describing the Worker selection criteria for any Tasks that enter the TaskQueue. For example `'\"language\" == \"spanish\"'` If no TargetWorkers parameter is provided, Tasks will wait in the TaskQueue until they are either deleted or moved to another TaskQueue. Additional examples on how to describing Worker selection criteria below. Defaults to 1==1. + :ivar task_order: + :ivar url: The absolute URL of the TaskQueue resource. + :ivar workspace_sid: The SID of the Workspace that contains the TaskQueue. + :ivar links: The URLs of related resources. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + workspace_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "assignment_activity_sid": payload.get("assignment_activity_sid"), - "assignment_activity_name": payload.get("assignment_activity_name"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "max_reserved_workers": deserialize.integer( - payload.get("max_reserved_workers") - ), - "reservation_activity_sid": payload.get("reservation_activity_sid"), - "reservation_activity_name": payload.get("reservation_activity_name"), - "sid": payload.get("sid"), - "target_workers": payload.get("target_workers"), - "task_order": payload.get("task_order"), - "url": payload.get("url"), - "workspace_sid": payload.get("workspace_sid"), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.assignment_activity_sid: Optional[str] = payload.get( + "assignment_activity_sid" + ) + self.assignment_activity_name: Optional[str] = payload.get( + "assignment_activity_name" + ) + 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.friendly_name: Optional[str] = payload.get("friendly_name") + self.max_reserved_workers: Optional[int] = deserialize.integer( + payload.get("max_reserved_workers") + ) + self.reservation_activity_sid: Optional[str] = payload.get( + "reservation_activity_sid" + ) + self.reservation_activity_name: Optional[str] = payload.get( + "reservation_activity_name" + ) + self.sid: Optional[str] = payload.get("sid") + self.target_workers: Optional[str] = payload.get("target_workers") + self.task_order: Optional["TaskQueueInstance.TaskOrder"] = payload.get( + "task_order" + ) + self.url: Optional[str] = payload.get("url") + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "workspace_sid": workspace_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[TaskQueueContext] = None @@ -88,111 +121,6 @@ def _proxy(self) -> "TaskQueueContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. - """ - return self._properties["account_sid"] - - @property - def assignment_activity_sid(self) -> str: - """ - :returns: The SID of the Activity to assign Workers when a task is assigned for them. - """ - return self._properties["assignment_activity_sid"] - - @property - def assignment_activity_name(self) -> str: - """ - :returns: The name of the Activity to assign Workers when a task is assigned for them. - """ - return self._properties["assignment_activity_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def max_reserved_workers(self) -> int: - """ - :returns: The maximum number of Workers to reserve for the assignment of a task in the queue. Can be an integer between 1 and 50, inclusive and defaults to 1. - """ - return self._properties["max_reserved_workers"] - - @property - def reservation_activity_sid(self) -> str: - """ - :returns: The SID of the Activity to assign Workers once a task is reserved for them. - """ - return self._properties["reservation_activity_sid"] - - @property - def reservation_activity_name(self) -> str: - """ - :returns: The name of the Activity to assign Workers once a task is reserved for them. - """ - return self._properties["reservation_activity_name"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the TaskQueue resource. - """ - return self._properties["sid"] - - @property - def target_workers(self) -> str: - """ - :returns: A string describing the Worker selection criteria for any Tasks that enter the TaskQueue. For example `'\"language\" == \"spanish\"'` If no TargetWorkers parameter is provided, Tasks will wait in the TaskQueue until they are either deleted or moved to another TaskQueue. Additional examples on how to describing Worker selection criteria below. Defaults to 1==1. - """ - return self._properties["target_workers"] - - @property - def task_order(self) -> "TaskQueueInstance.TaskOrder": - """ - :returns: - """ - return self._properties["task_order"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the TaskQueue resource. - """ - return self._properties["url"] - - @property - def workspace_sid(self) -> str: - """ - :returns: The SID of the Workspace that contains the TaskQueue. - """ - return self._properties["workspace_sid"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the TaskQueueInstance diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py index b2718c822..0812d1f9c 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,52 +23,99 @@ class TaskQueueCumulativeStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid: str, task_queue_sid: str): - """ - Initialize the TaskQueueCumulativeStatisticsInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. + :ivar avg_task_acceptance_time: The average time in seconds between Task creation and acceptance. + :ivar start_time: The beginning of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar end_time: The end of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar reservations_created: The total number of Reservations created for Tasks in the TaskQueue. + :ivar reservations_accepted: The total number of Reservations accepted for Tasks in the TaskQueue. + :ivar reservations_rejected: The total number of Reservations rejected for Tasks in the TaskQueue. + :ivar reservations_timed_out: The total number of Reservations that timed out for Tasks in the TaskQueue. + :ivar reservations_canceled: The total number of Reservations canceled for Tasks in the TaskQueue. + :ivar reservations_rescinded: The total number of Reservations rescinded. + :ivar split_by_wait_time: A list of objects that describe the number of Tasks canceled and reservations accepted above and below the thresholds specified in seconds. + :ivar task_queue_sid: The SID of the TaskQueue from which these statistics were calculated. + :ivar wait_duration_until_accepted: The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks accepted while in the TaskQueue. Calculation is based on the time when the Tasks were created. For transfers, the wait duration is counted from the moment ***the Task was created***, and not from when the transfer was initiated. + :ivar wait_duration_until_canceled: The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks canceled while in the TaskQueue. + :ivar wait_duration_in_queue_until_accepted: The relative wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks accepted while in the TaskQueue. Calculation is based on the time when the Tasks entered the TaskQueue. + :ivar tasks_canceled: The total number of Tasks canceled in the TaskQueue. + :ivar tasks_completed: The total number of Tasks completed in the TaskQueue. + :ivar tasks_deleted: The total number of Tasks deleted in the TaskQueue. + :ivar tasks_entered: The total number of Tasks entered into the TaskQueue. + :ivar tasks_moved: The total number of Tasks that were moved from one queue to another. + :ivar workspace_sid: The SID of the Workspace that contains the TaskQueue. + :ivar url: The absolute URL of the TaskQueue statistics resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + workspace_sid: str, + task_queue_sid: str, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "avg_task_acceptance_time": deserialize.integer( - payload.get("avg_task_acceptance_time") - ), - "start_time": deserialize.iso8601_datetime(payload.get("start_time")), - "end_time": deserialize.iso8601_datetime(payload.get("end_time")), - "reservations_created": deserialize.integer( - payload.get("reservations_created") - ), - "reservations_accepted": deserialize.integer( - payload.get("reservations_accepted") - ), - "reservations_rejected": deserialize.integer( - payload.get("reservations_rejected") - ), - "reservations_timed_out": deserialize.integer( - payload.get("reservations_timed_out") - ), - "reservations_canceled": deserialize.integer( - payload.get("reservations_canceled") - ), - "reservations_rescinded": deserialize.integer( - payload.get("reservations_rescinded") - ), - "split_by_wait_time": payload.get("split_by_wait_time"), - "task_queue_sid": payload.get("task_queue_sid"), - "wait_duration_until_accepted": payload.get("wait_duration_until_accepted"), - "wait_duration_until_canceled": payload.get("wait_duration_until_canceled"), - "wait_duration_in_queue_until_accepted": payload.get( - "wait_duration_in_queue_until_accepted" - ), - "tasks_canceled": deserialize.integer(payload.get("tasks_canceled")), - "tasks_completed": deserialize.integer(payload.get("tasks_completed")), - "tasks_deleted": deserialize.integer(payload.get("tasks_deleted")), - "tasks_entered": deserialize.integer(payload.get("tasks_entered")), - "tasks_moved": deserialize.integer(payload.get("tasks_moved")), - "workspace_sid": payload.get("workspace_sid"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.avg_task_acceptance_time: Optional[int] = deserialize.integer( + payload.get("avg_task_acceptance_time") + ) + self.start_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("start_time") + ) + self.end_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("end_time") + ) + self.reservations_created: Optional[int] = deserialize.integer( + payload.get("reservations_created") + ) + self.reservations_accepted: Optional[int] = deserialize.integer( + payload.get("reservations_accepted") + ) + self.reservations_rejected: Optional[int] = deserialize.integer( + payload.get("reservations_rejected") + ) + self.reservations_timed_out: Optional[int] = deserialize.integer( + payload.get("reservations_timed_out") + ) + self.reservations_canceled: Optional[int] = deserialize.integer( + payload.get("reservations_canceled") + ) + self.reservations_rescinded: Optional[int] = deserialize.integer( + payload.get("reservations_rescinded") + ) + self.split_by_wait_time: Optional[Dict[str, object]] = payload.get( + "split_by_wait_time" + ) + self.task_queue_sid: Optional[str] = payload.get("task_queue_sid") + self.wait_duration_until_accepted: Optional[Dict[str, object]] = payload.get( + "wait_duration_until_accepted" + ) + self.wait_duration_until_canceled: Optional[Dict[str, object]] = payload.get( + "wait_duration_until_canceled" + ) + self.wait_duration_in_queue_until_accepted: Optional[ + Dict[str, object] + ] = payload.get("wait_duration_in_queue_until_accepted") + self.tasks_canceled: Optional[int] = deserialize.integer( + payload.get("tasks_canceled") + ) + self.tasks_completed: Optional[int] = deserialize.integer( + payload.get("tasks_completed") + ) + self.tasks_deleted: Optional[int] = deserialize.integer( + payload.get("tasks_deleted") + ) + self.tasks_entered: Optional[int] = deserialize.integer( + payload.get("tasks_entered") + ) + self.tasks_moved: Optional[int] = deserialize.integer( + payload.get("tasks_moved") + ) + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.url: Optional[str] = payload.get("url") self._solution = { "workspace_sid": workspace_sid, @@ -92,160 +139,6 @@ def _proxy(self) -> "TaskQueueCumulativeStatisticsContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. - """ - return self._properties["account_sid"] - - @property - def avg_task_acceptance_time(self) -> int: - """ - :returns: The average time in seconds between Task creation and acceptance. - """ - return self._properties["avg_task_acceptance_time"] - - @property - def start_time(self) -> datetime: - """ - :returns: The beginning of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["start_time"] - - @property - def end_time(self) -> datetime: - """ - :returns: The end of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["end_time"] - - @property - def reservations_created(self) -> int: - """ - :returns: The total number of Reservations created for Tasks in the TaskQueue. - """ - return self._properties["reservations_created"] - - @property - def reservations_accepted(self) -> int: - """ - :returns: The total number of Reservations accepted for Tasks in the TaskQueue. - """ - return self._properties["reservations_accepted"] - - @property - def reservations_rejected(self) -> int: - """ - :returns: The total number of Reservations rejected for Tasks in the TaskQueue. - """ - return self._properties["reservations_rejected"] - - @property - def reservations_timed_out(self) -> int: - """ - :returns: The total number of Reservations that timed out for Tasks in the TaskQueue. - """ - return self._properties["reservations_timed_out"] - - @property - def reservations_canceled(self) -> int: - """ - :returns: The total number of Reservations canceled for Tasks in the TaskQueue. - """ - return self._properties["reservations_canceled"] - - @property - def reservations_rescinded(self) -> int: - """ - :returns: The total number of Reservations rescinded. - """ - return self._properties["reservations_rescinded"] - - @property - def split_by_wait_time(self) -> Dict[str, object]: - """ - :returns: A list of objects that describe the number of Tasks canceled and reservations accepted above and below the thresholds specified in seconds. - """ - return self._properties["split_by_wait_time"] - - @property - def task_queue_sid(self) -> str: - """ - :returns: The SID of the TaskQueue from which these statistics were calculated. - """ - return self._properties["task_queue_sid"] - - @property - def wait_duration_until_accepted(self) -> Dict[str, object]: - """ - :returns: The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks accepted while in the TaskQueue. Calculation is based on the time when the Tasks were created. For transfers, the wait duration is counted from the moment ***the Task was created***, and not from when the transfer was initiated. - """ - return self._properties["wait_duration_until_accepted"] - - @property - def wait_duration_until_canceled(self) -> Dict[str, object]: - """ - :returns: The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks canceled while in the TaskQueue. - """ - return self._properties["wait_duration_until_canceled"] - - @property - def wait_duration_in_queue_until_accepted(self) -> Dict[str, object]: - """ - :returns: The relative wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks accepted while in the TaskQueue. Calculation is based on the time when the Tasks entered the TaskQueue. - """ - return self._properties["wait_duration_in_queue_until_accepted"] - - @property - def tasks_canceled(self) -> int: - """ - :returns: The total number of Tasks canceled in the TaskQueue. - """ - return self._properties["tasks_canceled"] - - @property - def tasks_completed(self) -> int: - """ - :returns: The total number of Tasks completed in the TaskQueue. - """ - return self._properties["tasks_completed"] - - @property - def tasks_deleted(self) -> int: - """ - :returns: The total number of Tasks deleted in the TaskQueue. - """ - return self._properties["tasks_deleted"] - - @property - def tasks_entered(self) -> int: - """ - :returns: The total number of Tasks entered into the TaskQueue. - """ - return self._properties["tasks_entered"] - - @property - def tasks_moved(self) -> int: - """ - :returns: The total number of Tasks that were moved from one queue to another. - """ - return self._properties["tasks_moved"] - - @property - def workspace_sid(self) -> str: - """ - :returns: The SID of the Workspace that contains the TaskQueue. - """ - return self._properties["workspace_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the TaskQueue statistics resource. - """ - return self._properties["url"] - def fetch( self, end_date=values.unset, diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py index 84310eb9a..31675f9d0 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -22,38 +22,67 @@ class TaskQueueRealTimeStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid: str, task_queue_sid: str): - """ - Initialize the TaskQueueRealTimeStatisticsInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. + :ivar activity_statistics: The number of current Workers by Activity. + :ivar longest_task_waiting_age: The age of the longest waiting Task. + :ivar longest_task_waiting_sid: The SID of the longest waiting Task. + :ivar longest_relative_task_age_in_queue: The relative age in the TaskQueue for the longest waiting Task. Calculation is based on the time when the Task entered the TaskQueue. + :ivar longest_relative_task_sid_in_queue: The Task SID of the Task waiting in the TaskQueue the longest. Calculation is based on the time when the Task entered the TaskQueue. + :ivar task_queue_sid: The SID of the TaskQueue from which these statistics were calculated. + :ivar tasks_by_priority: The number of Tasks by priority. For example: `{\"0\": \"10\", \"99\": \"5\"}` shows 10 Tasks at priority 0 and 5 at priority 99. + :ivar tasks_by_status: The number of Tasks by their current status. For example: `{\"pending\": \"1\", \"reserved\": \"3\", \"assigned\": \"2\", \"completed\": \"5\"}`. + :ivar total_available_workers: The total number of Workers available for Tasks in the TaskQueue. + :ivar total_eligible_workers: The total number of Workers eligible for Tasks in the TaskQueue, independent of their Activity state. + :ivar total_tasks: The total number of Tasks. + :ivar workspace_sid: The SID of the Workspace that contains the TaskQueue. + :ivar url: The absolute URL of the TaskQueue statistics resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + workspace_sid: str, + task_queue_sid: str, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "activity_statistics": payload.get("activity_statistics"), - "longest_task_waiting_age": deserialize.integer( - payload.get("longest_task_waiting_age") - ), - "longest_task_waiting_sid": payload.get("longest_task_waiting_sid"), - "longest_relative_task_age_in_queue": deserialize.integer( - payload.get("longest_relative_task_age_in_queue") - ), - "longest_relative_task_sid_in_queue": payload.get( - "longest_relative_task_sid_in_queue" - ), - "task_queue_sid": payload.get("task_queue_sid"), - "tasks_by_priority": payload.get("tasks_by_priority"), - "tasks_by_status": payload.get("tasks_by_status"), - "total_available_workers": deserialize.integer( - payload.get("total_available_workers") - ), - "total_eligible_workers": deserialize.integer( - payload.get("total_eligible_workers") - ), - "total_tasks": deserialize.integer(payload.get("total_tasks")), - "workspace_sid": payload.get("workspace_sid"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.activity_statistics: Optional[List[object]] = payload.get( + "activity_statistics" + ) + self.longest_task_waiting_age: Optional[int] = deserialize.integer( + payload.get("longest_task_waiting_age") + ) + self.longest_task_waiting_sid: Optional[str] = payload.get( + "longest_task_waiting_sid" + ) + self.longest_relative_task_age_in_queue: Optional[int] = deserialize.integer( + payload.get("longest_relative_task_age_in_queue") + ) + self.longest_relative_task_sid_in_queue: Optional[str] = payload.get( + "longest_relative_task_sid_in_queue" + ) + self.task_queue_sid: Optional[str] = payload.get("task_queue_sid") + self.tasks_by_priority: Optional[Dict[str, object]] = payload.get( + "tasks_by_priority" + ) + self.tasks_by_status: Optional[Dict[str, object]] = payload.get( + "tasks_by_status" + ) + self.total_available_workers: Optional[int] = deserialize.integer( + payload.get("total_available_workers") + ) + self.total_eligible_workers: Optional[int] = deserialize.integer( + payload.get("total_eligible_workers") + ) + self.total_tasks: Optional[int] = deserialize.integer( + payload.get("total_tasks") + ) + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.url: Optional[str] = payload.get("url") self._solution = { "workspace_sid": workspace_sid, @@ -77,104 +106,6 @@ def _proxy(self) -> "TaskQueueRealTimeStatisticsContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. - """ - return self._properties["account_sid"] - - @property - def activity_statistics(self) -> List[object]: - """ - :returns: The number of current Workers by Activity. - """ - return self._properties["activity_statistics"] - - @property - def longest_task_waiting_age(self) -> int: - """ - :returns: The age of the longest waiting Task. - """ - return self._properties["longest_task_waiting_age"] - - @property - def longest_task_waiting_sid(self) -> str: - """ - :returns: The SID of the longest waiting Task. - """ - return self._properties["longest_task_waiting_sid"] - - @property - def longest_relative_task_age_in_queue(self) -> int: - """ - :returns: The relative age in the TaskQueue for the longest waiting Task. Calculation is based on the time when the Task entered the TaskQueue. - """ - return self._properties["longest_relative_task_age_in_queue"] - - @property - def longest_relative_task_sid_in_queue(self) -> str: - """ - :returns: The Task SID of the Task waiting in the TaskQueue the longest. Calculation is based on the time when the Task entered the TaskQueue. - """ - return self._properties["longest_relative_task_sid_in_queue"] - - @property - def task_queue_sid(self) -> str: - """ - :returns: The SID of the TaskQueue from which these statistics were calculated. - """ - return self._properties["task_queue_sid"] - - @property - def tasks_by_priority(self) -> Dict[str, object]: - """ - :returns: The number of Tasks by priority. For example: `{\"0\": \"10\", \"99\": \"5\"}` shows 10 Tasks at priority 0 and 5 at priority 99. - """ - return self._properties["tasks_by_priority"] - - @property - def tasks_by_status(self) -> Dict[str, object]: - """ - :returns: The number of Tasks by their current status. For example: `{\"pending\": \"1\", \"reserved\": \"3\", \"assigned\": \"2\", \"completed\": \"5\"}`. - """ - return self._properties["tasks_by_status"] - - @property - def total_available_workers(self) -> int: - """ - :returns: The total number of Workers available for Tasks in the TaskQueue. - """ - return self._properties["total_available_workers"] - - @property - def total_eligible_workers(self) -> int: - """ - :returns: The total number of Workers eligible for Tasks in the TaskQueue, independent of their Activity state. - """ - return self._properties["total_eligible_workers"] - - @property - def total_tasks(self) -> int: - """ - :returns: The total number of Tasks. - """ - return self._properties["total_tasks"] - - @property - def workspace_sid(self) -> str: - """ - :returns: The SID of the Workspace that contains the TaskQueue. - """ - return self._properties["workspace_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the TaskQueue statistics resource. - """ - return self._properties["url"] - def fetch(self, task_channel=values.unset) -> "TaskQueueRealTimeStatisticsInstance": """ Fetch the TaskQueueRealTimeStatisticsInstance diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py index 55e1551e1..552ab37f0 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -22,20 +22,31 @@ class TaskQueueStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid: str, task_queue_sid: str): - """ - Initialize the TaskQueueStatisticsInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. + :ivar cumulative: An object that contains the cumulative statistics for the TaskQueue. + :ivar realtime: An object that contains the real-time statistics for the TaskQueue. + :ivar task_queue_sid: The SID of the TaskQueue from which these statistics were calculated. + :ivar workspace_sid: The SID of the Workspace that contains the TaskQueue. + :ivar url: The absolute URL of the TaskQueue statistics resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + workspace_sid: str, + task_queue_sid: str, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "cumulative": payload.get("cumulative"), - "realtime": payload.get("realtime"), - "task_queue_sid": payload.get("task_queue_sid"), - "workspace_sid": payload.get("workspace_sid"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.cumulative: Optional[Dict[str, object]] = payload.get("cumulative") + self.realtime: Optional[Dict[str, object]] = payload.get("realtime") + self.task_queue_sid: Optional[str] = payload.get("task_queue_sid") + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.url: Optional[str] = payload.get("url") self._solution = { "workspace_sid": workspace_sid, @@ -59,48 +70,6 @@ def _proxy(self) -> "TaskQueueStatisticsContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. - """ - return self._properties["account_sid"] - - @property - def cumulative(self) -> Dict[str, object]: - """ - :returns: An object that contains the cumulative statistics for the TaskQueue. - """ - return self._properties["cumulative"] - - @property - def realtime(self) -> Dict[str, object]: - """ - :returns: An object that contains the real-time statistics for the TaskQueue. - """ - return self._properties["realtime"] - - @property - def task_queue_sid(self) -> str: - """ - :returns: The SID of the TaskQueue from which these statistics were calculated. - """ - return self._properties["task_queue_sid"] - - @property - def workspace_sid(self) -> str: - """ - :returns: The SID of the Workspace that contains the TaskQueue. - """ - return self._properties["workspace_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the TaskQueue statistics resource. - """ - return self._properties["url"] - def fetch( self, end_date=values.unset, diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py index 6619908ba..cb8e36c69 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import serialize, values from twilio.base.instance_resource import InstanceResource @@ -23,59 +23,28 @@ class TaskQueuesStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid: str): - """ - Initialize the TaskQueuesStatisticsInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. + :ivar cumulative: An object that contains the cumulative statistics for the TaskQueues. + :ivar realtime: An object that contains the real-time statistics for the TaskQueues. + :ivar task_queue_sid: The SID of the TaskQueue from which these statistics were calculated. + :ivar workspace_sid: The SID of the Workspace that contains the TaskQueues. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], workspace_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "cumulative": payload.get("cumulative"), - "realtime": payload.get("realtime"), - "task_queue_sid": payload.get("task_queue_sid"), - "workspace_sid": payload.get("workspace_sid"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.cumulative: Optional[Dict[str, object]] = payload.get("cumulative") + self.realtime: Optional[Dict[str, object]] = payload.get("realtime") + self.task_queue_sid: Optional[str] = payload.get("task_queue_sid") + self.workspace_sid: Optional[str] = payload.get("workspace_sid") self._solution = { "workspace_sid": workspace_sid, } - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. - """ - return self._properties["account_sid"] - - @property - def cumulative(self) -> Dict[str, object]: - """ - :returns: An object that contains the cumulative statistics for the TaskQueues. - """ - return self._properties["cumulative"] - - @property - def realtime(self) -> Dict[str, object]: - """ - :returns: An object that contains the real-time statistics for the TaskQueues. - """ - return self._properties["realtime"] - - @property - def task_queue_sid(self) -> str: - """ - :returns: The SID of the TaskQueue from which these statistics were calculated. - """ - return self._properties["task_queue_sid"] - - @property - def workspace_sid(self) -> str: - """ - :returns: The SID of the Workspace that contains the TaskQueues. - """ - return self._properties["workspace_sid"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/taskrouter/v1/workspace/worker/__init__.py b/twilio/rest/taskrouter/v1/workspace/worker/__init__.py index e4b46396f..ead4cdedc 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -38,33 +38,55 @@ class WorkerInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid: str, sid: Optional[str] = None): - """ - Initialize the WorkerInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. + :ivar activity_name: The `friendly_name` of the Worker's current Activity. + :ivar activity_sid: The SID of the Worker's current Activity. + :ivar attributes: The JSON string that describes the Worker. For example: `{ \"email\": \"Bob@example.com\", \"phone\": \"+5095551234\" }`. **Note** If this property has been assigned a value, it will only be displayed in FETCH actions that return a single resource. Otherwise, this property will be null, even if it has a value. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. + :ivar available: Whether the Worker is available to perform tasks. + :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_status_changed: The date and time in GMT of the last change to the Worker's activity specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Used to calculate Workflow statistics. + :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 friendly_name: The string that you assigned to describe the resource. Friendly names are case insensitive, and unique within the TaskRouter Workspace. + :ivar sid: The unique string that we created to identify the Worker resource. + :ivar workspace_sid: The SID of the Workspace that contains the Worker. + :ivar url: The absolute URL of the Worker resource. + :ivar links: The URLs of related resources. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + workspace_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "activity_name": payload.get("activity_name"), - "activity_sid": payload.get("activity_sid"), - "attributes": payload.get("attributes"), - "available": payload.get("available"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_status_changed": deserialize.iso8601_datetime( - payload.get("date_status_changed") - ), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "sid": payload.get("sid"), - "workspace_sid": payload.get("workspace_sid"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.activity_name: Optional[str] = payload.get("activity_name") + self.activity_sid: Optional[str] = payload.get("activity_sid") + self.attributes: Optional[str] = payload.get("attributes") + self.available: Optional[bool] = payload.get("available") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_status_changed: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_status_changed") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.sid: Optional[str] = payload.get("sid") + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "workspace_sid": workspace_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[WorkerContext] = None @@ -84,97 +106,6 @@ def _proxy(self) -> "WorkerContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. - """ - return self._properties["account_sid"] - - @property - def activity_name(self) -> str: - """ - :returns: The `friendly_name` of the Worker's current Activity. - """ - return self._properties["activity_name"] - - @property - def activity_sid(self) -> str: - """ - :returns: The SID of the Worker's current Activity. - """ - return self._properties["activity_sid"] - - @property - def attributes(self) -> str: - """ - :returns: The JSON string that describes the Worker. For example: `{ \"email\": \"Bob@example.com\", \"phone\": \"+5095551234\" }`. **Note** If this property has been assigned a value, it will only be displayed in FETCH actions that return a single resource. Otherwise, this property will be null, even if it has a value. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker. - """ - return self._properties["attributes"] - - @property - def available(self) -> bool: - """ - :returns: Whether the Worker is available to perform tasks. - """ - return self._properties["available"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_status_changed(self) -> datetime: - """ - :returns: The date and time in GMT of the last change to the Worker's activity specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Used to calculate Workflow statistics. - """ - return self._properties["date_status_changed"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. Friendly names are case insensitive, and unique within the TaskRouter Workspace. - """ - return self._properties["friendly_name"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Worker resource. - """ - return self._properties["sid"] - - @property - def workspace_sid(self) -> str: - """ - :returns: The SID of the Workspace that contains the Worker. - """ - return self._properties["workspace_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Worker resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - def delete(self, if_match=values.unset) -> bool: """ Deletes the WorkerInstance diff --git a/twilio/rest/taskrouter/v1/workspace/worker/reservation.py b/twilio/rest/taskrouter/v1/workspace/worker/reservation.py index 993c5253f..089dca5d3 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/reservation.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/reservation.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -34,37 +34,52 @@ class Status(object): WRAPPING = "wrapping" COMPLETED = "completed" + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the WorkerReservation resource. + :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 reservation_status: + :ivar sid: The unique string that we created to identify the WorkerReservation resource. + :ivar task_sid: The SID of the reserved Task resource. + :ivar worker_name: The `friendly_name` of the Worker that is reserved. + :ivar worker_sid: The SID of the reserved Worker resource. + :ivar workspace_sid: The SID of the Workspace that this worker is contained within. + :ivar url: The absolute URL of the WorkerReservation resource. + :ivar links: The URLs of related resources. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], workspace_sid: str, worker_sid: str, sid: Optional[str] = None, ): - """ - Initialize the ReservationInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "reservation_status": payload.get("reservation_status"), - "sid": payload.get("sid"), - "task_sid": payload.get("task_sid"), - "worker_name": payload.get("worker_name"), - "worker_sid": payload.get("worker_sid"), - "workspace_sid": payload.get("workspace_sid"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.reservation_status: Optional["ReservationInstance.Status"] = payload.get( + "reservation_status" + ) + self.sid: Optional[str] = payload.get("sid") + self.task_sid: Optional[str] = payload.get("task_sid") + self.worker_name: Optional[str] = payload.get("worker_name") + self.worker_sid: Optional[str] = payload.get("worker_sid") + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "workspace_sid": workspace_sid, "worker_sid": worker_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ReservationContext] = None @@ -85,83 +100,6 @@ def _proxy(self) -> "ReservationContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the WorkerReservation resource. - """ - return self._properties["account_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def reservation_status(self) -> "ReservationInstance.Status": - """ - :returns: - """ - return self._properties["reservation_status"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the WorkerReservation resource. - """ - return self._properties["sid"] - - @property - def task_sid(self) -> str: - """ - :returns: The SID of the reserved Task resource. - """ - return self._properties["task_sid"] - - @property - def worker_name(self) -> str: - """ - :returns: The `friendly_name` of the Worker that is reserved. - """ - return self._properties["worker_name"] - - @property - def worker_sid(self) -> str: - """ - :returns: The SID of the reserved Worker resource. - """ - return self._properties["worker_sid"] - - @property - def workspace_sid(self) -> str: - """ - :returns: The SID of the Workspace that this worker is contained within. - """ - return self._properties["workspace_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the WorkerReservation resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - def fetch(self) -> "ReservationInstance": """ Fetch the ReservationInstance diff --git a/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py b/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py index be03ad3bf..4a25ccf49 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/worker_channel.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,43 +24,63 @@ class WorkerChannelInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. + :ivar assigned_tasks: The total number of Tasks assigned to Worker for the TaskChannel type. + :ivar available: Whether the Worker should receive Tasks of the TaskChannel type. + :ivar available_capacity_percentage: The current percentage of capacity the TaskChannel has available. Can be a number between `0` and `100`. A value of `0` indicates that TaskChannel has no capacity available and a value of `100` means the Worker is available to receive any Tasks of this TaskChannel type. + :ivar configured_capacity: The current configured capacity for the WorkerChannel. TaskRouter will not create any reservations after the assigned Tasks for the Worker reaches the value. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar sid: The unique string that we created to identify the WorkerChannel resource. + :ivar task_channel_sid: The SID of the TaskChannel. + :ivar task_channel_unique_name: The unique name of the TaskChannel, such as `voice` or `sms`. + :ivar worker_sid: The SID of the Worker that contains the WorkerChannel. + :ivar workspace_sid: The SID of the Workspace that contains the WorkerChannel. + :ivar url: The absolute URL of the WorkerChannel resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], workspace_sid: str, worker_sid: str, sid: Optional[str] = None, ): - """ - Initialize the WorkerChannelInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "assigned_tasks": deserialize.integer(payload.get("assigned_tasks")), - "available": payload.get("available"), - "available_capacity_percentage": deserialize.integer( - payload.get("available_capacity_percentage") - ), - "configured_capacity": deserialize.integer( - payload.get("configured_capacity") - ), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "sid": payload.get("sid"), - "task_channel_sid": payload.get("task_channel_sid"), - "task_channel_unique_name": payload.get("task_channel_unique_name"), - "worker_sid": payload.get("worker_sid"), - "workspace_sid": payload.get("workspace_sid"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.assigned_tasks: Optional[int] = deserialize.integer( + payload.get("assigned_tasks") + ) + self.available: Optional[bool] = payload.get("available") + self.available_capacity_percentage: Optional[int] = deserialize.integer( + payload.get("available_capacity_percentage") + ) + self.configured_capacity: Optional[int] = deserialize.integer( + payload.get("configured_capacity") + ) + 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.sid: Optional[str] = payload.get("sid") + self.task_channel_sid: Optional[str] = payload.get("task_channel_sid") + self.task_channel_unique_name: Optional[str] = payload.get( + "task_channel_unique_name" + ) + self.worker_sid: Optional[str] = payload.get("worker_sid") + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.url: Optional[str] = payload.get("url") self._solution = { "workspace_sid": workspace_sid, "worker_sid": worker_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[WorkerChannelContext] = None @@ -81,97 +101,6 @@ def _proxy(self) -> "WorkerChannelContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. - """ - return self._properties["account_sid"] - - @property - def assigned_tasks(self) -> int: - """ - :returns: The total number of Tasks assigned to Worker for the TaskChannel type. - """ - return self._properties["assigned_tasks"] - - @property - def available(self) -> bool: - """ - :returns: Whether the Worker should receive Tasks of the TaskChannel type. - """ - return self._properties["available"] - - @property - def available_capacity_percentage(self) -> int: - """ - :returns: The current percentage of capacity the TaskChannel has available. Can be a number between `0` and `100`. A value of `0` indicates that TaskChannel has no capacity available and a value of `100` means the Worker is available to receive any Tasks of this TaskChannel type. - """ - return self._properties["available_capacity_percentage"] - - @property - def configured_capacity(self) -> int: - """ - :returns: The current configured capacity for the WorkerChannel. TaskRouter will not create any reservations after the assigned Tasks for the Worker reaches the value. - """ - return self._properties["configured_capacity"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the WorkerChannel resource. - """ - return self._properties["sid"] - - @property - def task_channel_sid(self) -> str: - """ - :returns: The SID of the TaskChannel. - """ - return self._properties["task_channel_sid"] - - @property - def task_channel_unique_name(self) -> str: - """ - :returns: The unique name of the TaskChannel, such as `voice` or `sms`. - """ - return self._properties["task_channel_unique_name"] - - @property - def worker_sid(self) -> str: - """ - :returns: The SID of the Worker that contains the WorkerChannel. - """ - return self._properties["worker_sid"] - - @property - def workspace_sid(self) -> str: - """ - :returns: The SID of the Workspace that contains the WorkerChannel. - """ - return self._properties["workspace_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the WorkerChannel resource. - """ - return self._properties["url"] - def fetch(self) -> "WorkerChannelInstance": """ Fetch the WorkerChannelInstance diff --git a/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py index c482a1c3f..aefb8ccda 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/worker_statistics.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -22,19 +22,29 @@ class WorkerStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid: str, worker_sid: str): - """ - Initialize the WorkerStatisticsInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. + :ivar cumulative: An object that contains the cumulative statistics for the Worker. + :ivar worker_sid: The SID of the Worker that contains the WorkerChannel. + :ivar workspace_sid: The SID of the Workspace that contains the WorkerChannel. + :ivar url: The absolute URL of the WorkerChannel statistics resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + workspace_sid: str, + worker_sid: str, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "cumulative": payload.get("cumulative"), - "worker_sid": payload.get("worker_sid"), - "workspace_sid": payload.get("workspace_sid"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.cumulative: Optional[Dict[str, object]] = payload.get("cumulative") + self.worker_sid: Optional[str] = payload.get("worker_sid") + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.url: Optional[str] = payload.get("url") self._solution = { "workspace_sid": workspace_sid, @@ -58,41 +68,6 @@ def _proxy(self) -> "WorkerStatisticsContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. - """ - return self._properties["account_sid"] - - @property - def cumulative(self) -> Dict[str, object]: - """ - :returns: An object that contains the cumulative statistics for the Worker. - """ - return self._properties["cumulative"] - - @property - def worker_sid(self) -> str: - """ - :returns: The SID of the Worker that contains the WorkerChannel. - """ - return self._properties["worker_sid"] - - @property - def workspace_sid(self) -> str: - """ - :returns: The SID of the Workspace that contains the WorkerChannel. - """ - return self._properties["workspace_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the WorkerChannel statistics resource. - """ - return self._properties["url"] - def fetch( self, minutes=values.unset, diff --git a/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py index cb56af9b0..b5217675c 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,38 +23,55 @@ class WorkersCumulativeStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid: str): - """ - Initialize the WorkersCumulativeStatisticsInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. + :ivar start_time: The beginning of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar end_time: The end of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar activity_durations: The minimum, average, maximum, and total time (in seconds) that Workers spent in each Activity. + :ivar reservations_created: The total number of Reservations that were created. + :ivar reservations_accepted: The total number of Reservations that were accepted. + :ivar reservations_rejected: The total number of Reservations that were rejected. + :ivar reservations_timed_out: The total number of Reservations that were timed out. + :ivar reservations_canceled: The total number of Reservations that were canceled. + :ivar reservations_rescinded: The total number of Reservations that were rescinded. + :ivar workspace_sid: The SID of the Workspace that contains the Workers. + :ivar url: The absolute URL of the Workers statistics resource. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], workspace_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "start_time": deserialize.iso8601_datetime(payload.get("start_time")), - "end_time": deserialize.iso8601_datetime(payload.get("end_time")), - "activity_durations": payload.get("activity_durations"), - "reservations_created": deserialize.integer( - payload.get("reservations_created") - ), - "reservations_accepted": deserialize.integer( - payload.get("reservations_accepted") - ), - "reservations_rejected": deserialize.integer( - payload.get("reservations_rejected") - ), - "reservations_timed_out": deserialize.integer( - payload.get("reservations_timed_out") - ), - "reservations_canceled": deserialize.integer( - payload.get("reservations_canceled") - ), - "reservations_rescinded": deserialize.integer( - payload.get("reservations_rescinded") - ), - "workspace_sid": payload.get("workspace_sid"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.start_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("start_time") + ) + self.end_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("end_time") + ) + self.activity_durations: Optional[List[object]] = payload.get( + "activity_durations" + ) + self.reservations_created: Optional[int] = deserialize.integer( + payload.get("reservations_created") + ) + self.reservations_accepted: Optional[int] = deserialize.integer( + payload.get("reservations_accepted") + ) + self.reservations_rejected: Optional[int] = deserialize.integer( + payload.get("reservations_rejected") + ) + self.reservations_timed_out: Optional[int] = deserialize.integer( + payload.get("reservations_timed_out") + ) + self.reservations_canceled: Optional[int] = deserialize.integer( + payload.get("reservations_canceled") + ) + self.reservations_rescinded: Optional[int] = deserialize.integer( + payload.get("reservations_rescinded") + ) + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.url: Optional[str] = payload.get("url") self._solution = { "workspace_sid": workspace_sid, @@ -76,90 +93,6 @@ def _proxy(self) -> "WorkersCumulativeStatisticsContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. - """ - return self._properties["account_sid"] - - @property - def start_time(self) -> datetime: - """ - :returns: The beginning of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["start_time"] - - @property - def end_time(self) -> datetime: - """ - :returns: The end of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["end_time"] - - @property - def activity_durations(self) -> List[object]: - """ - :returns: The minimum, average, maximum, and total time (in seconds) that Workers spent in each Activity. - """ - return self._properties["activity_durations"] - - @property - def reservations_created(self) -> int: - """ - :returns: The total number of Reservations that were created. - """ - return self._properties["reservations_created"] - - @property - def reservations_accepted(self) -> int: - """ - :returns: The total number of Reservations that were accepted. - """ - return self._properties["reservations_accepted"] - - @property - def reservations_rejected(self) -> int: - """ - :returns: The total number of Reservations that were rejected. - """ - return self._properties["reservations_rejected"] - - @property - def reservations_timed_out(self) -> int: - """ - :returns: The total number of Reservations that were timed out. - """ - return self._properties["reservations_timed_out"] - - @property - def reservations_canceled(self) -> int: - """ - :returns: The total number of Reservations that were canceled. - """ - return self._properties["reservations_canceled"] - - @property - def reservations_rescinded(self) -> int: - """ - :returns: The total number of Reservations that were rescinded. - """ - return self._properties["reservations_rescinded"] - - @property - def workspace_sid(self) -> str: - """ - :returns: The SID of the Workspace that contains the Workers. - """ - return self._properties["workspace_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Workers statistics resource. - """ - return self._properties["url"] - def fetch( self, end_date=values.unset, diff --git a/twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py index 7fd911e38..7b3c5f20b 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -22,19 +22,27 @@ class WorkersRealTimeStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid: str): - """ - Initialize the WorkersRealTimeStatisticsInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. + :ivar activity_statistics: The number of current Workers by Activity. + :ivar total_workers: The total number of Workers. + :ivar workspace_sid: The SID of the Workspace that contains the Workers. + :ivar url: The absolute URL of the Workers statistics resource. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], workspace_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "activity_statistics": payload.get("activity_statistics"), - "total_workers": deserialize.integer(payload.get("total_workers")), - "workspace_sid": payload.get("workspace_sid"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.activity_statistics: Optional[List[object]] = payload.get( + "activity_statistics" + ) + self.total_workers: Optional[int] = deserialize.integer( + payload.get("total_workers") + ) + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.url: Optional[str] = payload.get("url") self._solution = { "workspace_sid": workspace_sid, @@ -56,41 +64,6 @@ def _proxy(self) -> "WorkersRealTimeStatisticsContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. - """ - return self._properties["account_sid"] - - @property - def activity_statistics(self) -> List[object]: - """ - :returns: The number of current Workers by Activity. - """ - return self._properties["activity_statistics"] - - @property - def total_workers(self) -> int: - """ - :returns: The total number of Workers. - """ - return self._properties["total_workers"] - - @property - def workspace_sid(self) -> str: - """ - :returns: The SID of the Workspace that contains the Workers. - """ - return self._properties["workspace_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Workers statistics resource. - """ - return self._properties["url"] - def fetch(self, task_channel=values.unset) -> "WorkersRealTimeStatisticsInstance": """ Fetch the WorkersRealTimeStatisticsInstance diff --git a/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py b/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py index 2506c8aee..6101e3410 100644 --- a/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/worker/workers_statistics.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -22,19 +22,23 @@ class WorkersStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid: str): - """ - Initialize the WorkersStatisticsInstance - """ + + """ + :ivar realtime: An object that contains the real-time statistics for the Worker. + :ivar cumulative: An object that contains the cumulative statistics for the Worker. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. + :ivar workspace_sid: The SID of the Workspace that contains the Worker. + :ivar url: The absolute URL of the Worker statistics resource. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], workspace_sid: str): super().__init__(version) - self._properties = { - "realtime": payload.get("realtime"), - "cumulative": payload.get("cumulative"), - "account_sid": payload.get("account_sid"), - "workspace_sid": payload.get("workspace_sid"), - "url": payload.get("url"), - } + self.realtime: Optional[Dict[str, object]] = payload.get("realtime") + self.cumulative: Optional[Dict[str, object]] = payload.get("cumulative") + self.account_sid: Optional[str] = payload.get("account_sid") + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.url: Optional[str] = payload.get("url") self._solution = { "workspace_sid": workspace_sid, @@ -56,41 +60,6 @@ def _proxy(self) -> "WorkersStatisticsContext": ) return self._context - @property - def realtime(self) -> Dict[str, object]: - """ - :returns: An object that contains the real-time statistics for the Worker. - """ - return self._properties["realtime"] - - @property - def cumulative(self) -> Dict[str, object]: - """ - :returns: An object that contains the cumulative statistics for the Worker. - """ - return self._properties["cumulative"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Worker resource. - """ - return self._properties["account_sid"] - - @property - def workspace_sid(self) -> str: - """ - :returns: The SID of the Workspace that contains the Worker. - """ - return self._properties["workspace_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Worker statistics resource. - """ - return self._properties["url"] - def fetch( self, minutes=values.unset, diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py b/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py index 89acf58dc..5834fdf21 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -33,35 +33,59 @@ class WorkflowInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid: str, sid: Optional[str] = None): - """ - Initialize the WorkflowInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workflow resource. + :ivar assignment_callback_url: The URL that we call when a task managed by the Workflow is assigned to a Worker. See Assignment Callback URL for more information. + :ivar configuration: A JSON string that contains the Workflow's configuration. See [Configuring Workflows](https://www.twilio.com/docs/taskrouter/workflow-configuration) for more information. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar document_content_type: The MIME type of the document. + :ivar fallback_assignment_callback_url: The URL that we call when a call to the `assignment_callback_url` fails. + :ivar friendly_name: The string that you assigned to describe the Workflow resource. For example, `Customer Support` or `2014 Election Campaign`. + :ivar sid: The unique string that we created to identify the Workflow resource. + :ivar task_reservation_timeout: How long TaskRouter will wait for a confirmation response from your application after it assigns a Task to a Worker. Can be up to `86,400` (24 hours) and the default is `120`. + :ivar workspace_sid: The SID of the Workspace that contains the Workflow. + :ivar url: The absolute URL of the Workflow resource. + :ivar links: The URLs of related resources. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + workspace_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "assignment_callback_url": payload.get("assignment_callback_url"), - "configuration": payload.get("configuration"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "document_content_type": payload.get("document_content_type"), - "fallback_assignment_callback_url": payload.get( - "fallback_assignment_callback_url" - ), - "friendly_name": payload.get("friendly_name"), - "sid": payload.get("sid"), - "task_reservation_timeout": deserialize.integer( - payload.get("task_reservation_timeout") - ), - "workspace_sid": payload.get("workspace_sid"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.assignment_callback_url: Optional[str] = payload.get( + "assignment_callback_url" + ) + self.configuration: Optional[str] = payload.get("configuration") + 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.document_content_type: Optional[str] = payload.get("document_content_type") + self.fallback_assignment_callback_url: Optional[str] = payload.get( + "fallback_assignment_callback_url" + ) + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.sid: Optional[str] = payload.get("sid") + self.task_reservation_timeout: Optional[int] = deserialize.integer( + payload.get("task_reservation_timeout") + ) + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "workspace_sid": workspace_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[WorkflowContext] = None @@ -81,97 +105,6 @@ def _proxy(self) -> "WorkflowContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workflow resource. - """ - return self._properties["account_sid"] - - @property - def assignment_callback_url(self) -> str: - """ - :returns: The URL that we call when a task managed by the Workflow is assigned to a Worker. See Assignment Callback URL for more information. - """ - return self._properties["assignment_callback_url"] - - @property - def configuration(self) -> str: - """ - :returns: A JSON string that contains the Workflow's configuration. See [Configuring Workflows](https://www.twilio.com/docs/taskrouter/workflow-configuration) for more information. - """ - return self._properties["configuration"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def document_content_type(self) -> str: - """ - :returns: The MIME type of the document. - """ - return self._properties["document_content_type"] - - @property - def fallback_assignment_callback_url(self) -> str: - """ - :returns: The URL that we call when a call to the `assignment_callback_url` fails. - """ - return self._properties["fallback_assignment_callback_url"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the Workflow resource. For example, `Customer Support` or `2014 Election Campaign`. - """ - return self._properties["friendly_name"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Workflow resource. - """ - return self._properties["sid"] - - @property - def task_reservation_timeout(self) -> int: - """ - :returns: How long TaskRouter will wait for a confirmation response from your application after it assigns a Task to a Worker. Can be up to `86,400` (24 hours) and the default is `120`. - """ - return self._properties["task_reservation_timeout"] - - @property - def workspace_sid(self) -> str: - """ - :returns: The SID of the Workspace that contains the Workflow. - """ - return self._properties["workspace_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Workflow resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the WorkflowInstance diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py index db9a63bc8..5e4d69133 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,52 +23,99 @@ class WorkflowCumulativeStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid: str, workflow_sid: str): - """ - Initialize the WorkflowCumulativeStatisticsInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workflow resource. + :ivar avg_task_acceptance_time: The average time in seconds between Task creation and acceptance. + :ivar start_time: The beginning of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar end_time: The end of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar reservations_created: The total number of Reservations that were created for Workers. + :ivar reservations_accepted: The total number of Reservations accepted by Workers. + :ivar reservations_rejected: The total number of Reservations that were rejected. + :ivar reservations_timed_out: The total number of Reservations that were timed out. + :ivar reservations_canceled: The total number of Reservations that were canceled. + :ivar reservations_rescinded: The total number of Reservations that were rescinded. + :ivar split_by_wait_time: A list of objects that describe the number of Tasks canceled and reservations accepted above and below the thresholds specified in seconds. + :ivar wait_duration_until_accepted: The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks that were accepted. + :ivar wait_duration_until_canceled: The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks that were canceled. + :ivar tasks_canceled: The total number of Tasks that were canceled. + :ivar tasks_completed: The total number of Tasks that were completed. + :ivar tasks_entered: The total number of Tasks that entered the Workflow. + :ivar tasks_deleted: The total number of Tasks that were deleted. + :ivar tasks_moved: The total number of Tasks that were moved from one queue to another. + :ivar tasks_timed_out_in_workflow: The total number of Tasks that were timed out of their Workflows (and deleted). + :ivar workflow_sid: Returns the list of Tasks that are being controlled by the Workflow with the specified Sid value. + :ivar workspace_sid: The SID of the Workspace that contains the Workflow. + :ivar url: The absolute URL of the Workflow statistics resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + workspace_sid: str, + workflow_sid: str, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "avg_task_acceptance_time": deserialize.integer( - payload.get("avg_task_acceptance_time") - ), - "start_time": deserialize.iso8601_datetime(payload.get("start_time")), - "end_time": deserialize.iso8601_datetime(payload.get("end_time")), - "reservations_created": deserialize.integer( - payload.get("reservations_created") - ), - "reservations_accepted": deserialize.integer( - payload.get("reservations_accepted") - ), - "reservations_rejected": deserialize.integer( - payload.get("reservations_rejected") - ), - "reservations_timed_out": deserialize.integer( - payload.get("reservations_timed_out") - ), - "reservations_canceled": deserialize.integer( - payload.get("reservations_canceled") - ), - "reservations_rescinded": deserialize.integer( - payload.get("reservations_rescinded") - ), - "split_by_wait_time": payload.get("split_by_wait_time"), - "wait_duration_until_accepted": payload.get("wait_duration_until_accepted"), - "wait_duration_until_canceled": payload.get("wait_duration_until_canceled"), - "tasks_canceled": deserialize.integer(payload.get("tasks_canceled")), - "tasks_completed": deserialize.integer(payload.get("tasks_completed")), - "tasks_entered": deserialize.integer(payload.get("tasks_entered")), - "tasks_deleted": deserialize.integer(payload.get("tasks_deleted")), - "tasks_moved": deserialize.integer(payload.get("tasks_moved")), - "tasks_timed_out_in_workflow": deserialize.integer( - payload.get("tasks_timed_out_in_workflow") - ), - "workflow_sid": payload.get("workflow_sid"), - "workspace_sid": payload.get("workspace_sid"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.avg_task_acceptance_time: Optional[int] = deserialize.integer( + payload.get("avg_task_acceptance_time") + ) + self.start_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("start_time") + ) + self.end_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("end_time") + ) + self.reservations_created: Optional[int] = deserialize.integer( + payload.get("reservations_created") + ) + self.reservations_accepted: Optional[int] = deserialize.integer( + payload.get("reservations_accepted") + ) + self.reservations_rejected: Optional[int] = deserialize.integer( + payload.get("reservations_rejected") + ) + self.reservations_timed_out: Optional[int] = deserialize.integer( + payload.get("reservations_timed_out") + ) + self.reservations_canceled: Optional[int] = deserialize.integer( + payload.get("reservations_canceled") + ) + self.reservations_rescinded: Optional[int] = deserialize.integer( + payload.get("reservations_rescinded") + ) + self.split_by_wait_time: Optional[Dict[str, object]] = payload.get( + "split_by_wait_time" + ) + self.wait_duration_until_accepted: Optional[Dict[str, object]] = payload.get( + "wait_duration_until_accepted" + ) + self.wait_duration_until_canceled: Optional[Dict[str, object]] = payload.get( + "wait_duration_until_canceled" + ) + self.tasks_canceled: Optional[int] = deserialize.integer( + payload.get("tasks_canceled") + ) + self.tasks_completed: Optional[int] = deserialize.integer( + payload.get("tasks_completed") + ) + self.tasks_entered: Optional[int] = deserialize.integer( + payload.get("tasks_entered") + ) + self.tasks_deleted: Optional[int] = deserialize.integer( + payload.get("tasks_deleted") + ) + self.tasks_moved: Optional[int] = deserialize.integer( + payload.get("tasks_moved") + ) + self.tasks_timed_out_in_workflow: Optional[int] = deserialize.integer( + payload.get("tasks_timed_out_in_workflow") + ) + self.workflow_sid: Optional[str] = payload.get("workflow_sid") + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.url: Optional[str] = payload.get("url") self._solution = { "workspace_sid": workspace_sid, @@ -92,160 +139,6 @@ def _proxy(self) -> "WorkflowCumulativeStatisticsContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workflow resource. - """ - return self._properties["account_sid"] - - @property - def avg_task_acceptance_time(self) -> int: - """ - :returns: The average time in seconds between Task creation and acceptance. - """ - return self._properties["avg_task_acceptance_time"] - - @property - def start_time(self) -> datetime: - """ - :returns: The beginning of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["start_time"] - - @property - def end_time(self) -> datetime: - """ - :returns: The end of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["end_time"] - - @property - def reservations_created(self) -> int: - """ - :returns: The total number of Reservations that were created for Workers. - """ - return self._properties["reservations_created"] - - @property - def reservations_accepted(self) -> int: - """ - :returns: The total number of Reservations accepted by Workers. - """ - return self._properties["reservations_accepted"] - - @property - def reservations_rejected(self) -> int: - """ - :returns: The total number of Reservations that were rejected. - """ - return self._properties["reservations_rejected"] - - @property - def reservations_timed_out(self) -> int: - """ - :returns: The total number of Reservations that were timed out. - """ - return self._properties["reservations_timed_out"] - - @property - def reservations_canceled(self) -> int: - """ - :returns: The total number of Reservations that were canceled. - """ - return self._properties["reservations_canceled"] - - @property - def reservations_rescinded(self) -> int: - """ - :returns: The total number of Reservations that were rescinded. - """ - return self._properties["reservations_rescinded"] - - @property - def split_by_wait_time(self) -> Dict[str, object]: - """ - :returns: A list of objects that describe the number of Tasks canceled and reservations accepted above and below the thresholds specified in seconds. - """ - return self._properties["split_by_wait_time"] - - @property - def wait_duration_until_accepted(self) -> Dict[str, object]: - """ - :returns: The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks that were accepted. - """ - return self._properties["wait_duration_until_accepted"] - - @property - def wait_duration_until_canceled(self) -> Dict[str, object]: - """ - :returns: The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks that were canceled. - """ - return self._properties["wait_duration_until_canceled"] - - @property - def tasks_canceled(self) -> int: - """ - :returns: The total number of Tasks that were canceled. - """ - return self._properties["tasks_canceled"] - - @property - def tasks_completed(self) -> int: - """ - :returns: The total number of Tasks that were completed. - """ - return self._properties["tasks_completed"] - - @property - def tasks_entered(self) -> int: - """ - :returns: The total number of Tasks that entered the Workflow. - """ - return self._properties["tasks_entered"] - - @property - def tasks_deleted(self) -> int: - """ - :returns: The total number of Tasks that were deleted. - """ - return self._properties["tasks_deleted"] - - @property - def tasks_moved(self) -> int: - """ - :returns: The total number of Tasks that were moved from one queue to another. - """ - return self._properties["tasks_moved"] - - @property - def tasks_timed_out_in_workflow(self) -> int: - """ - :returns: The total number of Tasks that were timed out of their Workflows (and deleted). - """ - return self._properties["tasks_timed_out_in_workflow"] - - @property - def workflow_sid(self) -> str: - """ - :returns: Returns the list of Tasks that are being controlled by the Workflow with the specified Sid value. - """ - return self._properties["workflow_sid"] - - @property - def workspace_sid(self) -> str: - """ - :returns: The SID of the Workspace that contains the Workflow. - """ - return self._properties["workspace_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Workflow statistics resource. - """ - return self._properties["url"] - def fetch( self, end_date=values.unset, diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py index 8778b6ee9..c5680a83d 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -22,25 +22,47 @@ class WorkflowRealTimeStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid: str, workflow_sid: str): - """ - Initialize the WorkflowRealTimeStatisticsInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workflow resource. + :ivar longest_task_waiting_age: The age of the longest waiting Task. + :ivar longest_task_waiting_sid: The SID of the longest waiting Task. + :ivar tasks_by_priority: The number of Tasks by priority. For example: `{\"0\": \"10\", \"99\": \"5\"}` shows 10 Tasks at priority 0 and 5 at priority 99. + :ivar tasks_by_status: The number of Tasks by their current status. For example: `{\"pending\": \"1\", \"reserved\": \"3\", \"assigned\": \"2\", \"completed\": \"5\"}`. + :ivar total_tasks: The total number of Tasks. + :ivar workflow_sid: Returns the list of Tasks that are being controlled by the Workflow with the specified SID value. + :ivar workspace_sid: The SID of the Workspace that contains the Workflow. + :ivar url: The absolute URL of the Workflow statistics resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + workspace_sid: str, + workflow_sid: str, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "longest_task_waiting_age": deserialize.integer( - payload.get("longest_task_waiting_age") - ), - "longest_task_waiting_sid": payload.get("longest_task_waiting_sid"), - "tasks_by_priority": payload.get("tasks_by_priority"), - "tasks_by_status": payload.get("tasks_by_status"), - "total_tasks": deserialize.integer(payload.get("total_tasks")), - "workflow_sid": payload.get("workflow_sid"), - "workspace_sid": payload.get("workspace_sid"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.longest_task_waiting_age: Optional[int] = deserialize.integer( + payload.get("longest_task_waiting_age") + ) + self.longest_task_waiting_sid: Optional[str] = payload.get( + "longest_task_waiting_sid" + ) + self.tasks_by_priority: Optional[Dict[str, object]] = payload.get( + "tasks_by_priority" + ) + self.tasks_by_status: Optional[Dict[str, object]] = payload.get( + "tasks_by_status" + ) + self.total_tasks: Optional[int] = deserialize.integer( + payload.get("total_tasks") + ) + self.workflow_sid: Optional[str] = payload.get("workflow_sid") + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.url: Optional[str] = payload.get("url") self._solution = { "workspace_sid": workspace_sid, @@ -64,69 +86,6 @@ def _proxy(self) -> "WorkflowRealTimeStatisticsContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workflow resource. - """ - return self._properties["account_sid"] - - @property - def longest_task_waiting_age(self) -> int: - """ - :returns: The age of the longest waiting Task. - """ - return self._properties["longest_task_waiting_age"] - - @property - def longest_task_waiting_sid(self) -> str: - """ - :returns: The SID of the longest waiting Task. - """ - return self._properties["longest_task_waiting_sid"] - - @property - def tasks_by_priority(self) -> Dict[str, object]: - """ - :returns: The number of Tasks by priority. For example: `{\"0\": \"10\", \"99\": \"5\"}` shows 10 Tasks at priority 0 and 5 at priority 99. - """ - return self._properties["tasks_by_priority"] - - @property - def tasks_by_status(self) -> Dict[str, object]: - """ - :returns: The number of Tasks by their current status. For example: `{\"pending\": \"1\", \"reserved\": \"3\", \"assigned\": \"2\", \"completed\": \"5\"}`. - """ - return self._properties["tasks_by_status"] - - @property - def total_tasks(self) -> int: - """ - :returns: The total number of Tasks. - """ - return self._properties["total_tasks"] - - @property - def workflow_sid(self) -> str: - """ - :returns: Returns the list of Tasks that are being controlled by the Workflow with the specified SID value. - """ - return self._properties["workflow_sid"] - - @property - def workspace_sid(self) -> str: - """ - :returns: The SID of the Workspace that contains the Workflow. - """ - return self._properties["workspace_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Workflow statistics resource. - """ - return self._properties["url"] - def fetch(self, task_channel=values.unset) -> "WorkflowRealTimeStatisticsInstance": """ Fetch the WorkflowRealTimeStatisticsInstance diff --git a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py index fce5a555d..a8656ed43 100644 --- a/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workflow/workflow_statistics.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -22,20 +22,31 @@ class WorkflowStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid: str, workflow_sid: str): - """ - Initialize the WorkflowStatisticsInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workflow resource. + :ivar cumulative: An object that contains the cumulative statistics for the Workflow. + :ivar realtime: An object that contains the real-time statistics for the Workflow. + :ivar workflow_sid: Returns the list of Tasks that are being controlled by the Workflow with the specified SID value. + :ivar workspace_sid: The SID of the Workspace that contains the Workflow. + :ivar url: The absolute URL of the Workflow statistics resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + workspace_sid: str, + workflow_sid: str, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "cumulative": payload.get("cumulative"), - "realtime": payload.get("realtime"), - "workflow_sid": payload.get("workflow_sid"), - "workspace_sid": payload.get("workspace_sid"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.cumulative: Optional[Dict[str, object]] = payload.get("cumulative") + self.realtime: Optional[Dict[str, object]] = payload.get("realtime") + self.workflow_sid: Optional[str] = payload.get("workflow_sid") + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.url: Optional[str] = payload.get("url") self._solution = { "workspace_sid": workspace_sid, @@ -59,48 +70,6 @@ def _proxy(self) -> "WorkflowStatisticsContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workflow resource. - """ - return self._properties["account_sid"] - - @property - def cumulative(self) -> Dict[str, object]: - """ - :returns: An object that contains the cumulative statistics for the Workflow. - """ - return self._properties["cumulative"] - - @property - def realtime(self) -> Dict[str, object]: - """ - :returns: An object that contains the real-time statistics for the Workflow. - """ - return self._properties["realtime"] - - @property - def workflow_sid(self) -> str: - """ - :returns: Returns the list of Tasks that are being controlled by the Workflow with the specified SID value. - """ - return self._properties["workflow_sid"] - - @property - def workspace_sid(self) -> str: - """ - :returns: The SID of the Workspace that contains the Workflow. - """ - return self._properties["workspace_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Workflow statistics resource. - """ - return self._properties["url"] - def fetch( self, minutes=values.unset, diff --git a/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py b/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py index cd97e1769..ed3f04031 100644 --- a/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,51 +23,91 @@ class WorkspaceCumulativeStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid: str): - """ - Initialize the WorkspaceCumulativeStatisticsInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workspace resource. + :ivar avg_task_acceptance_time: The average time in seconds between Task creation and acceptance. + :ivar start_time: The beginning of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar end_time: The end of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar reservations_created: The total number of Reservations that were created for Workers. + :ivar reservations_accepted: The total number of Reservations accepted by Workers. + :ivar reservations_rejected: The total number of Reservations that were rejected. + :ivar reservations_timed_out: The total number of Reservations that were timed out. + :ivar reservations_canceled: The total number of Reservations that were canceled. + :ivar reservations_rescinded: The total number of Reservations that were rescinded. + :ivar split_by_wait_time: A list of objects that describe the number of Tasks canceled and reservations accepted above and below the thresholds specified in seconds. + :ivar wait_duration_until_accepted: The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks that were accepted. + :ivar wait_duration_until_canceled: The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks that were canceled. + :ivar tasks_canceled: The total number of Tasks that were canceled. + :ivar tasks_completed: The total number of Tasks that were completed. + :ivar tasks_created: The total number of Tasks created. + :ivar tasks_deleted: The total number of Tasks that were deleted. + :ivar tasks_moved: The total number of Tasks that were moved from one queue to another. + :ivar tasks_timed_out_in_workflow: The total number of Tasks that were timed out of their Workflows (and deleted). + :ivar workspace_sid: The SID of the Workspace. + :ivar url: The absolute URL of the Workspace statistics resource. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], workspace_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "avg_task_acceptance_time": deserialize.integer( - payload.get("avg_task_acceptance_time") - ), - "start_time": deserialize.iso8601_datetime(payload.get("start_time")), - "end_time": deserialize.iso8601_datetime(payload.get("end_time")), - "reservations_created": deserialize.integer( - payload.get("reservations_created") - ), - "reservations_accepted": deserialize.integer( - payload.get("reservations_accepted") - ), - "reservations_rejected": deserialize.integer( - payload.get("reservations_rejected") - ), - "reservations_timed_out": deserialize.integer( - payload.get("reservations_timed_out") - ), - "reservations_canceled": deserialize.integer( - payload.get("reservations_canceled") - ), - "reservations_rescinded": deserialize.integer( - payload.get("reservations_rescinded") - ), - "split_by_wait_time": payload.get("split_by_wait_time"), - "wait_duration_until_accepted": payload.get("wait_duration_until_accepted"), - "wait_duration_until_canceled": payload.get("wait_duration_until_canceled"), - "tasks_canceled": deserialize.integer(payload.get("tasks_canceled")), - "tasks_completed": deserialize.integer(payload.get("tasks_completed")), - "tasks_created": deserialize.integer(payload.get("tasks_created")), - "tasks_deleted": deserialize.integer(payload.get("tasks_deleted")), - "tasks_moved": deserialize.integer(payload.get("tasks_moved")), - "tasks_timed_out_in_workflow": deserialize.integer( - payload.get("tasks_timed_out_in_workflow") - ), - "workspace_sid": payload.get("workspace_sid"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.avg_task_acceptance_time: Optional[int] = deserialize.integer( + payload.get("avg_task_acceptance_time") + ) + self.start_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("start_time") + ) + self.end_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("end_time") + ) + self.reservations_created: Optional[int] = deserialize.integer( + payload.get("reservations_created") + ) + self.reservations_accepted: Optional[int] = deserialize.integer( + payload.get("reservations_accepted") + ) + self.reservations_rejected: Optional[int] = deserialize.integer( + payload.get("reservations_rejected") + ) + self.reservations_timed_out: Optional[int] = deserialize.integer( + payload.get("reservations_timed_out") + ) + self.reservations_canceled: Optional[int] = deserialize.integer( + payload.get("reservations_canceled") + ) + self.reservations_rescinded: Optional[int] = deserialize.integer( + payload.get("reservations_rescinded") + ) + self.split_by_wait_time: Optional[Dict[str, object]] = payload.get( + "split_by_wait_time" + ) + self.wait_duration_until_accepted: Optional[Dict[str, object]] = payload.get( + "wait_duration_until_accepted" + ) + self.wait_duration_until_canceled: Optional[Dict[str, object]] = payload.get( + "wait_duration_until_canceled" + ) + self.tasks_canceled: Optional[int] = deserialize.integer( + payload.get("tasks_canceled") + ) + self.tasks_completed: Optional[int] = deserialize.integer( + payload.get("tasks_completed") + ) + self.tasks_created: Optional[int] = deserialize.integer( + payload.get("tasks_created") + ) + self.tasks_deleted: Optional[int] = deserialize.integer( + payload.get("tasks_deleted") + ) + self.tasks_moved: Optional[int] = deserialize.integer( + payload.get("tasks_moved") + ) + self.tasks_timed_out_in_workflow: Optional[int] = deserialize.integer( + payload.get("tasks_timed_out_in_workflow") + ) + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.url: Optional[str] = payload.get("url") self._solution = { "workspace_sid": workspace_sid, @@ -89,153 +129,6 @@ def _proxy(self) -> "WorkspaceCumulativeStatisticsContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workspace resource. - """ - return self._properties["account_sid"] - - @property - def avg_task_acceptance_time(self) -> int: - """ - :returns: The average time in seconds between Task creation and acceptance. - """ - return self._properties["avg_task_acceptance_time"] - - @property - def start_time(self) -> datetime: - """ - :returns: The beginning of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["start_time"] - - @property - def end_time(self) -> datetime: - """ - :returns: The end of the interval during which these statistics were calculated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["end_time"] - - @property - def reservations_created(self) -> int: - """ - :returns: The total number of Reservations that were created for Workers. - """ - return self._properties["reservations_created"] - - @property - def reservations_accepted(self) -> int: - """ - :returns: The total number of Reservations accepted by Workers. - """ - return self._properties["reservations_accepted"] - - @property - def reservations_rejected(self) -> int: - """ - :returns: The total number of Reservations that were rejected. - """ - return self._properties["reservations_rejected"] - - @property - def reservations_timed_out(self) -> int: - """ - :returns: The total number of Reservations that were timed out. - """ - return self._properties["reservations_timed_out"] - - @property - def reservations_canceled(self) -> int: - """ - :returns: The total number of Reservations that were canceled. - """ - return self._properties["reservations_canceled"] - - @property - def reservations_rescinded(self) -> int: - """ - :returns: The total number of Reservations that were rescinded. - """ - return self._properties["reservations_rescinded"] - - @property - def split_by_wait_time(self) -> Dict[str, object]: - """ - :returns: A list of objects that describe the number of Tasks canceled and reservations accepted above and below the thresholds specified in seconds. - """ - return self._properties["split_by_wait_time"] - - @property - def wait_duration_until_accepted(self) -> Dict[str, object]: - """ - :returns: The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks that were accepted. - """ - return self._properties["wait_duration_until_accepted"] - - @property - def wait_duration_until_canceled(self) -> Dict[str, object]: - """ - :returns: The wait duration statistics (`avg`, `min`, `max`, `total`) for Tasks that were canceled. - """ - return self._properties["wait_duration_until_canceled"] - - @property - def tasks_canceled(self) -> int: - """ - :returns: The total number of Tasks that were canceled. - """ - return self._properties["tasks_canceled"] - - @property - def tasks_completed(self) -> int: - """ - :returns: The total number of Tasks that were completed. - """ - return self._properties["tasks_completed"] - - @property - def tasks_created(self) -> int: - """ - :returns: The total number of Tasks created. - """ - return self._properties["tasks_created"] - - @property - def tasks_deleted(self) -> int: - """ - :returns: The total number of Tasks that were deleted. - """ - return self._properties["tasks_deleted"] - - @property - def tasks_moved(self) -> int: - """ - :returns: The total number of Tasks that were moved from one queue to another. - """ - return self._properties["tasks_moved"] - - @property - def tasks_timed_out_in_workflow(self) -> int: - """ - :returns: The total number of Tasks that were timed out of their Workflows (and deleted). - """ - return self._properties["tasks_timed_out_in_workflow"] - - @property - def workspace_sid(self) -> str: - """ - :returns: The SID of the Workspace. - """ - return self._properties["workspace_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Workspace statistics resource. - """ - return self._properties["url"] - def fetch( self, end_date=values.unset, diff --git a/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py index 105e3eb47..7d6bb93db 100644 --- a/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workspace_real_time_statistics.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -22,26 +22,47 @@ class WorkspaceRealTimeStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid: str): - """ - Initialize the WorkspaceRealTimeStatisticsInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workspace resource. + :ivar activity_statistics: The number of current Workers by Activity. + :ivar longest_task_waiting_age: The age of the longest waiting Task. + :ivar longest_task_waiting_sid: The SID of the longest waiting Task. + :ivar tasks_by_priority: The number of Tasks by priority. For example: `{\"0\": \"10\", \"99\": \"5\"}` shows 10 Tasks at priority 0 and 5 at priority 99. + :ivar tasks_by_status: The number of Tasks by their current status. For example: `{\"pending\": \"1\", \"reserved\": \"3\", \"assigned\": \"2\", \"completed\": \"5\"}`. + :ivar total_tasks: The total number of Tasks. + :ivar total_workers: The total number of Workers in the Workspace. + :ivar workspace_sid: The SID of the Workspace. + :ivar url: The absolute URL of the Workspace statistics resource. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], workspace_sid: str): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "activity_statistics": payload.get("activity_statistics"), - "longest_task_waiting_age": deserialize.integer( - payload.get("longest_task_waiting_age") - ), - "longest_task_waiting_sid": payload.get("longest_task_waiting_sid"), - "tasks_by_priority": payload.get("tasks_by_priority"), - "tasks_by_status": payload.get("tasks_by_status"), - "total_tasks": deserialize.integer(payload.get("total_tasks")), - "total_workers": deserialize.integer(payload.get("total_workers")), - "workspace_sid": payload.get("workspace_sid"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.activity_statistics: Optional[List[object]] = payload.get( + "activity_statistics" + ) + self.longest_task_waiting_age: Optional[int] = deserialize.integer( + payload.get("longest_task_waiting_age") + ) + self.longest_task_waiting_sid: Optional[str] = payload.get( + "longest_task_waiting_sid" + ) + self.tasks_by_priority: Optional[Dict[str, object]] = payload.get( + "tasks_by_priority" + ) + self.tasks_by_status: Optional[Dict[str, object]] = payload.get( + "tasks_by_status" + ) + self.total_tasks: Optional[int] = deserialize.integer( + payload.get("total_tasks") + ) + self.total_workers: Optional[int] = deserialize.integer( + payload.get("total_workers") + ) + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.url: Optional[str] = payload.get("url") self._solution = { "workspace_sid": workspace_sid, @@ -63,76 +84,6 @@ def _proxy(self) -> "WorkspaceRealTimeStatisticsContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workspace resource. - """ - return self._properties["account_sid"] - - @property - def activity_statistics(self) -> List[object]: - """ - :returns: The number of current Workers by Activity. - """ - return self._properties["activity_statistics"] - - @property - def longest_task_waiting_age(self) -> int: - """ - :returns: The age of the longest waiting Task. - """ - return self._properties["longest_task_waiting_age"] - - @property - def longest_task_waiting_sid(self) -> str: - """ - :returns: The SID of the longest waiting Task. - """ - return self._properties["longest_task_waiting_sid"] - - @property - def tasks_by_priority(self) -> Dict[str, object]: - """ - :returns: The number of Tasks by priority. For example: `{\"0\": \"10\", \"99\": \"5\"}` shows 10 Tasks at priority 0 and 5 at priority 99. - """ - return self._properties["tasks_by_priority"] - - @property - def tasks_by_status(self) -> Dict[str, object]: - """ - :returns: The number of Tasks by their current status. For example: `{\"pending\": \"1\", \"reserved\": \"3\", \"assigned\": \"2\", \"completed\": \"5\"}`. - """ - return self._properties["tasks_by_status"] - - @property - def total_tasks(self) -> int: - """ - :returns: The total number of Tasks. - """ - return self._properties["total_tasks"] - - @property - def total_workers(self) -> int: - """ - :returns: The total number of Workers in the Workspace. - """ - return self._properties["total_workers"] - - @property - def workspace_sid(self) -> str: - """ - :returns: The SID of the Workspace. - """ - return self._properties["workspace_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Workspace statistics resource. - """ - return self._properties["url"] - def fetch(self, task_channel=values.unset) -> "WorkspaceRealTimeStatisticsInstance": """ Fetch the WorkspaceRealTimeStatisticsInstance diff --git a/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py b/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py index e19ecdf83..ce1e4f2af 100644 --- a/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py +++ b/twilio/rest/taskrouter/v1/workspace/workspace_statistics.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base import serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -22,19 +22,23 @@ class WorkspaceStatisticsInstance(InstanceResource): - def __init__(self, version, payload, workspace_sid: str): - """ - Initialize the WorkspaceStatisticsInstance - """ + + """ + :ivar realtime: An object that contains the real-time statistics for the Workspace. + :ivar cumulative: An object that contains the cumulative statistics for the Workspace. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workspace resource. + :ivar workspace_sid: The SID of the Workspace. + :ivar url: The absolute URL of the Workspace statistics resource. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], workspace_sid: str): super().__init__(version) - self._properties = { - "realtime": payload.get("realtime"), - "cumulative": payload.get("cumulative"), - "account_sid": payload.get("account_sid"), - "workspace_sid": payload.get("workspace_sid"), - "url": payload.get("url"), - } + self.realtime: Optional[Dict[str, object]] = payload.get("realtime") + self.cumulative: Optional[Dict[str, object]] = payload.get("cumulative") + self.account_sid: Optional[str] = payload.get("account_sid") + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.url: Optional[str] = payload.get("url") self._solution = { "workspace_sid": workspace_sid, @@ -56,41 +60,6 @@ def _proxy(self) -> "WorkspaceStatisticsContext": ) return self._context - @property - def realtime(self) -> Dict[str, object]: - """ - :returns: An object that contains the real-time statistics for the Workspace. - """ - return self._properties["realtime"] - - @property - def cumulative(self) -> Dict[str, object]: - """ - :returns: An object that contains the cumulative statistics for the Workspace. - """ - return self._properties["cumulative"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Workspace resource. - """ - return self._properties["account_sid"] - - @property - def workspace_sid(self) -> str: - """ - :returns: The SID of the Workspace. - """ - return self._properties["workspace_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Workspace statistics resource. - """ - return self._properties["url"] - def fetch( self, minutes=values.unset, diff --git a/twilio/rest/trunking/v1/trunk/__init__.py b/twilio/rest/trunking/v1/trunk/__init__.py index ce04233a5..503a99457 100644 --- a/twilio/rest/trunking/v1/trunk/__init__.py +++ b/twilio/rest/trunking/v1/trunk/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -38,34 +38,61 @@ class TransferSetting(object): ENABLE_ALL = "enable-all" SIP_ONLY = "sip-only" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the TrunkInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Trunk resource. + :ivar domain_name: The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and `-` and must end with `pstn.twilio.com`. See [Termination Settings](https://www.twilio.com/docs/sip-trunking#termination) for more information. + :ivar disaster_recovery_method: The HTTP method we use to call the `disaster_recovery_url`. Can be: `GET` or `POST`. + :ivar disaster_recovery_url: The URL we call using the `disaster_recovery_method` if an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from this URL and execute the instructions like any other normal TwiML call. See [Disaster Recovery](https://www.twilio.com/docs/sip-trunking#disaster-recovery) for more information. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar secure: Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See [Secure Trunking](https://www.twilio.com/docs/sip-trunking#securetrunking) for more information. + :ivar recording: The recording settings for the trunk. Can be: `do-not-record`, `record-from-ringing`, `record-from-answer`. If set to `record-from-ringing` or `record-from-answer`, all calls going through the trunk will be recorded. The only way to change recording parameters is on a sub-resource of a Trunk after it has been created. e.g.`/Trunks/[Trunk_SID]/Recording -XPOST -d'Mode=record-from-answer'`. See [Recording](https://www.twilio.com/docs/sip-trunking#recording) for more information. + :ivar transfer_mode: + :ivar transfer_caller_id: + :ivar cnam_lookup_enabled: Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the SIP Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. + :ivar auth_type: The types of authentication mapped to the domain. Can be: `IP_ACL` and `CREDENTIAL_LIST`. If both are mapped, the values are returned in a comma delimited list. If empty, the domain will not receive any traffic. + :ivar auth_type_set: Reserved. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar sid: The unique string that we created to identify the Trunk resource. + :ivar url: The absolute URL of the resource. + :ivar links: The URLs of related resources. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "domain_name": payload.get("domain_name"), - "disaster_recovery_method": payload.get("disaster_recovery_method"), - "disaster_recovery_url": payload.get("disaster_recovery_url"), - "friendly_name": payload.get("friendly_name"), - "secure": payload.get("secure"), - "recording": payload.get("recording"), - "transfer_mode": payload.get("transfer_mode"), - "transfer_caller_id": payload.get("transfer_caller_id"), - "cnam_lookup_enabled": payload.get("cnam_lookup_enabled"), - "auth_type": payload.get("auth_type"), - "auth_type_set": payload.get("auth_type_set"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "sid": payload.get("sid"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.domain_name: Optional[str] = payload.get("domain_name") + self.disaster_recovery_method: Optional[str] = payload.get( + "disaster_recovery_method" + ) + self.disaster_recovery_url: Optional[str] = payload.get("disaster_recovery_url") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.secure: Optional[bool] = payload.get("secure") + self.recording: Optional[Dict[str, object]] = payload.get("recording") + self.transfer_mode: Optional["TrunkInstance.TransferSetting"] = payload.get( + "transfer_mode" + ) + self.transfer_caller_id: Optional[ + "TrunkInstance.TransferCallerId" + ] = payload.get("transfer_caller_id") + self.cnam_lookup_enabled: Optional[bool] = payload.get("cnam_lookup_enabled") + self.auth_type: Optional[str] = payload.get("auth_type") + self.auth_type_set: Optional[List[str]] = payload.get("auth_type_set") + 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.sid: Optional[str] = payload.get("sid") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[TrunkContext] = None @@ -84,125 +111,6 @@ def _proxy(self) -> "TrunkContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Trunk resource. - """ - return self._properties["account_sid"] - - @property - def domain_name(self) -> str: - """ - :returns: The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and `-` and must end with `pstn.twilio.com`. See [Termination Settings](https://www.twilio.com/docs/sip-trunking#termination) for more information. - """ - return self._properties["domain_name"] - - @property - def disaster_recovery_method(self) -> str: - """ - :returns: The HTTP method we use to call the `disaster_recovery_url`. Can be: `GET` or `POST`. - """ - return self._properties["disaster_recovery_method"] - - @property - def disaster_recovery_url(self) -> str: - """ - :returns: The URL we call using the `disaster_recovery_method` if an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from this URL and execute the instructions like any other normal TwiML call. See [Disaster Recovery](https://www.twilio.com/docs/sip-trunking#disaster-recovery) for more information. - """ - return self._properties["disaster_recovery_url"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def secure(self) -> bool: - """ - :returns: Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See [Secure Trunking](https://www.twilio.com/docs/sip-trunking#securetrunking) for more information. - """ - return self._properties["secure"] - - @property - def recording(self) -> Dict[str, object]: - """ - :returns: The recording settings for the trunk. Can be: `do-not-record`, `record-from-ringing`, `record-from-answer`. If set to `record-from-ringing` or `record-from-answer`, all calls going through the trunk will be recorded. The only way to change recording parameters is on a sub-resource of a Trunk after it has been created. e.g.`/Trunks/[Trunk_SID]/Recording -XPOST -d'Mode=record-from-answer'`. See [Recording](https://www.twilio.com/docs/sip-trunking#recording) for more information. - """ - return self._properties["recording"] - - @property - def transfer_mode(self) -> "TrunkInstance.TransferSetting": - """ - :returns: - """ - return self._properties["transfer_mode"] - - @property - def transfer_caller_id(self) -> "TrunkInstance.TransferCallerId": - """ - :returns: - """ - return self._properties["transfer_caller_id"] - - @property - def cnam_lookup_enabled(self) -> bool: - """ - :returns: Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the SIP Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. - """ - return self._properties["cnam_lookup_enabled"] - - @property - def auth_type(self) -> str: - """ - :returns: The types of authentication mapped to the domain. Can be: `IP_ACL` and `CREDENTIAL_LIST`. If both are mapped, the values are returned in a comma delimited list. If empty, the domain will not receive any traffic. - """ - return self._properties["auth_type"] - - @property - def auth_type_set(self) -> List[str]: - """ - :returns: Reserved. - """ - return self._properties["auth_type_set"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Trunk resource. - """ - return self._properties["sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the TrunkInstance diff --git a/twilio/rest/trunking/v1/trunk/credential_list.py b/twilio/rest/trunking/v1/trunk/credential_list.py index d06cf3705..695cff32f 100644 --- a/twilio/rest/trunking/v1/trunk/credential_list.py +++ b/twilio/rest/trunking/v1/trunk/credential_list.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,25 +24,41 @@ class CredentialListInstance(InstanceResource): - def __init__(self, version, payload, trunk_sid: str, sid: Optional[str] = None): - """ - Initialize the CredentialListInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialList resource. + :ivar sid: The unique string that we created to identify the CredentialList resource. + :ivar trunk_sid: The SID of the Trunk the credential list in associated with. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + trunk_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "sid": payload.get("sid"), - "trunk_sid": payload.get("trunk_sid"), - "friendly_name": payload.get("friendly_name"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.sid: Optional[str] = payload.get("sid") + self.trunk_sid: Optional[str] = payload.get("trunk_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + 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 = { "trunk_sid": trunk_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[CredentialListContext] = None @@ -62,55 +78,6 @@ def _proxy(self) -> "CredentialListContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CredentialList resource. - """ - return self._properties["account_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the CredentialList resource. - """ - return self._properties["sid"] - - @property - def trunk_sid(self) -> str: - """ - :returns: The SID of the Trunk the credential list in associated with. - """ - return self._properties["trunk_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the CredentialListInstance diff --git a/twilio/rest/trunking/v1/trunk/ip_access_control_list.py b/twilio/rest/trunking/v1/trunk/ip_access_control_list.py index cc3c473c5..22cc6789f 100644 --- a/twilio/rest/trunking/v1/trunk/ip_access_control_list.py +++ b/twilio/rest/trunking/v1/trunk/ip_access_control_list.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,25 +24,41 @@ class IpAccessControlListInstance(InstanceResource): - def __init__(self, version, payload, trunk_sid: str, sid: Optional[str] = None): - """ - Initialize the IpAccessControlListInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IpAccessControlList resource. + :ivar sid: The unique string that we created to identify the IpAccessControlList resource. + :ivar trunk_sid: The SID of the Trunk the resource is associated with. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + trunk_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "sid": payload.get("sid"), - "trunk_sid": payload.get("trunk_sid"), - "friendly_name": payload.get("friendly_name"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.sid: Optional[str] = payload.get("sid") + self.trunk_sid: Optional[str] = payload.get("trunk_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + 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 = { "trunk_sid": trunk_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[IpAccessControlListContext] = None @@ -62,55 +78,6 @@ def _proxy(self) -> "IpAccessControlListContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IpAccessControlList resource. - """ - return self._properties["account_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the IpAccessControlList resource. - """ - return self._properties["sid"] - - @property - def trunk_sid(self) -> str: - """ - :returns: The SID of the Trunk the resource is associated with. - """ - return self._properties["trunk_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the IpAccessControlListInstance diff --git a/twilio/rest/trunking/v1/trunk/origination_url.py b/twilio/rest/trunking/v1/trunk/origination_url.py index d479a30c2..06d03e940 100644 --- a/twilio/rest/trunking/v1/trunk/origination_url.py +++ b/twilio/rest/trunking/v1/trunk/origination_url.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,29 +24,49 @@ class OriginationUrlInstance(InstanceResource): - def __init__(self, version, payload, trunk_sid: str, sid: Optional[str] = None): - """ - Initialize the OriginationUrlInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the OriginationUrl resource. + :ivar sid: The unique string that we created to identify the OriginationUrl resource. + :ivar trunk_sid: The SID of the Trunk that owns the Origination URL. + :ivar weight: The value that determines the relative share of the load the URI should receive compared to other URIs with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. URLs with higher values receive more load than those with lower ones with the same priority. + :ivar enabled: Whether the URL is enabled. The default is `true`. + :ivar sip_url: The SIP address you want Twilio to route your Origination calls to. This must be a `sip:` schema. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar priority: The relative importance of the URI. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important URI. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + trunk_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "sid": payload.get("sid"), - "trunk_sid": payload.get("trunk_sid"), - "weight": deserialize.integer(payload.get("weight")), - "enabled": payload.get("enabled"), - "sip_url": payload.get("sip_url"), - "friendly_name": payload.get("friendly_name"), - "priority": deserialize.integer(payload.get("priority")), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.sid: Optional[str] = payload.get("sid") + self.trunk_sid: Optional[str] = payload.get("trunk_sid") + self.weight: Optional[int] = deserialize.integer(payload.get("weight")) + self.enabled: Optional[bool] = payload.get("enabled") + self.sip_url: Optional[str] = payload.get("sip_url") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.priority: Optional[int] = deserialize.integer(payload.get("priority")) + 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 = { "trunk_sid": trunk_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[OriginationUrlContext] = None @@ -66,83 +86,6 @@ def _proxy(self) -> "OriginationUrlContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the OriginationUrl resource. - """ - return self._properties["account_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the OriginationUrl resource. - """ - return self._properties["sid"] - - @property - def trunk_sid(self) -> str: - """ - :returns: The SID of the Trunk that owns the Origination URL. - """ - return self._properties["trunk_sid"] - - @property - def weight(self) -> int: - """ - :returns: The value that determines the relative share of the load the URI should receive compared to other URIs with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. URLs with higher values receive more load than those with lower ones with the same priority. - """ - return self._properties["weight"] - - @property - def enabled(self) -> bool: - """ - :returns: Whether the URL is enabled. The default is `true`. - """ - return self._properties["enabled"] - - @property - def sip_url(self) -> str: - """ - :returns: The SIP address you want Twilio to route your Origination calls to. This must be a `sip:` schema. - """ - return self._properties["sip_url"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def priority(self) -> int: - """ - :returns: The relative importance of the URI. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important URI. - """ - return self._properties["priority"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the OriginationUrlInstance diff --git a/twilio/rest/trunking/v1/trunk/phone_number.py b/twilio/rest/trunking/v1/trunk/phone_number.py index fb4d2da77..e9266c40b 100644 --- a/twilio/rest/trunking/v1/trunk/phone_number.py +++ b/twilio/rest/trunking/v1/trunk/phone_number.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -30,44 +30,84 @@ class AddressRequirement(object): LOCAL = "local" FOREIGN = "foreign" - def __init__(self, version, payload, trunk_sid: str, sid: Optional[str] = None): - """ - Initialize the PhoneNumberInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PhoneNumber resource. + :ivar address_requirements: + :ivar api_version: The API version used to start a new TwiML session. + :ivar beta: Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. + :ivar capabilities: The set of Boolean properties that indicate whether a phone number can receive calls or messages. Capabilities are `Voice`, `SMS`, and `MMS` and each capability can be: `true` or `false`. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar links: The URLs of related resources. + :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + :ivar sid: The unique string that we created to identify the PhoneNumber resource. + :ivar sms_application_sid: The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. + :ivar sms_fallback_method: The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. + :ivar sms_fallback_url: The URL that we call using the `sms_fallback_method` when an error occurs while retrieving or executing the TwiML from `sms_url`. + :ivar sms_method: The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. + :ivar sms_url: The URL we call using the `sms_method` when the phone number receives an incoming SMS message. + :ivar status_callback: The URL we call using the `status_callback_method` to send status information to your application. + :ivar status_callback_method: The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. + :ivar trunk_sid: The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice URLs and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. + :ivar url: The absolute URL of the resource. + :ivar voice_application_sid: The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice URLs and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. + :ivar voice_caller_id_lookup: Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. + :ivar voice_fallback_method: The HTTP method that we use to call `voice_fallback_url`. Can be: `GET` or `POST`. + :ivar voice_fallback_url: The URL that we call using the `voice_fallback_method` when an error occurs retrieving or executing the TwiML requested by `url`. + :ivar voice_method: The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. + :ivar voice_url: The URL we call using the `voice_method` when the phone number receives a call. The `voice_url` is not be used if a `voice_application_sid` or a `trunk_sid` is set. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + trunk_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "address_requirements": payload.get("address_requirements"), - "api_version": payload.get("api_version"), - "beta": payload.get("beta"), - "capabilities": payload.get("capabilities"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "links": payload.get("links"), - "phone_number": payload.get("phone_number"), - "sid": payload.get("sid"), - "sms_application_sid": payload.get("sms_application_sid"), - "sms_fallback_method": payload.get("sms_fallback_method"), - "sms_fallback_url": payload.get("sms_fallback_url"), - "sms_method": payload.get("sms_method"), - "sms_url": payload.get("sms_url"), - "status_callback": payload.get("status_callback"), - "status_callback_method": payload.get("status_callback_method"), - "trunk_sid": payload.get("trunk_sid"), - "url": payload.get("url"), - "voice_application_sid": payload.get("voice_application_sid"), - "voice_caller_id_lookup": payload.get("voice_caller_id_lookup"), - "voice_fallback_method": payload.get("voice_fallback_method"), - "voice_fallback_url": payload.get("voice_fallback_url"), - "voice_method": payload.get("voice_method"), - "voice_url": payload.get("voice_url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.address_requirements: Optional[ + "PhoneNumberInstance.AddressRequirement" + ] = payload.get("address_requirements") + self.api_version: Optional[str] = payload.get("api_version") + self.beta: Optional[bool] = payload.get("beta") + self.capabilities: Optional[Dict[str, object]] = payload.get("capabilities") + 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.friendly_name: Optional[str] = payload.get("friendly_name") + self.links: Optional[Dict[str, object]] = payload.get("links") + self.phone_number: Optional[str] = payload.get("phone_number") + self.sid: Optional[str] = payload.get("sid") + self.sms_application_sid: Optional[str] = payload.get("sms_application_sid") + self.sms_fallback_method: Optional[str] = payload.get("sms_fallback_method") + self.sms_fallback_url: Optional[str] = payload.get("sms_fallback_url") + self.sms_method: Optional[str] = payload.get("sms_method") + self.sms_url: Optional[str] = payload.get("sms_url") + self.status_callback: Optional[str] = payload.get("status_callback") + self.status_callback_method: Optional[str] = payload.get( + "status_callback_method" + ) + self.trunk_sid: Optional[str] = payload.get("trunk_sid") + self.url: Optional[str] = payload.get("url") + self.voice_application_sid: Optional[str] = payload.get("voice_application_sid") + self.voice_caller_id_lookup: Optional[bool] = payload.get( + "voice_caller_id_lookup" + ) + self.voice_fallback_method: Optional[str] = payload.get("voice_fallback_method") + self.voice_fallback_url: Optional[str] = payload.get("voice_fallback_url") + self.voice_method: Optional[str] = payload.get("voice_method") + self.voice_url: Optional[str] = payload.get("voice_url") self._solution = { "trunk_sid": trunk_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[PhoneNumberContext] = None @@ -87,188 +127,6 @@ def _proxy(self) -> "PhoneNumberContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PhoneNumber resource. - """ - return self._properties["account_sid"] - - @property - def address_requirements(self) -> "PhoneNumberInstance.AddressRequirement": - """ - :returns: - """ - return self._properties["address_requirements"] - - @property - def api_version(self) -> str: - """ - :returns: The API version used to start a new TwiML session. - """ - return self._properties["api_version"] - - @property - def beta(self) -> bool: - """ - :returns: Whether the phone number is new to the Twilio platform. Can be: `true` or `false`. - """ - return self._properties["beta"] - - @property - def capabilities(self) -> Dict[str, object]: - """ - :returns: The set of Boolean properties that indicate whether a phone number can receive calls or messages. Capabilities are `Voice`, `SMS`, and `MMS` and each capability can be: `true` or `false`. - """ - return self._properties["capabilities"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - - @property - def phone_number(self) -> str: - """ - :returns: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. - """ - return self._properties["phone_number"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the PhoneNumber resource. - """ - return self._properties["sid"] - - @property - def sms_application_sid(self) -> str: - """ - :returns: The SID of the application that handles SMS messages sent to the phone number. If an `sms_application_sid` is present, we ignore all `sms_*_url` values and use those of the application. - """ - return self._properties["sms_application_sid"] - - @property - def sms_fallback_method(self) -> str: - """ - :returns: The HTTP method we use to call `sms_fallback_url`. Can be: `GET` or `POST`. - """ - return self._properties["sms_fallback_method"] - - @property - def sms_fallback_url(self) -> str: - """ - :returns: The URL that we call using the `sms_fallback_method` when an error occurs while retrieving or executing the TwiML from `sms_url`. - """ - return self._properties["sms_fallback_url"] - - @property - def sms_method(self) -> str: - """ - :returns: The HTTP method we use to call `sms_url`. Can be: `GET` or `POST`. - """ - return self._properties["sms_method"] - - @property - def sms_url(self) -> str: - """ - :returns: The URL we call using the `sms_method` when the phone number receives an incoming SMS message. - """ - return self._properties["sms_url"] - - @property - def status_callback(self) -> str: - """ - :returns: The URL we call using the `status_callback_method` to send status information to your application. - """ - return self._properties["status_callback"] - - @property - def status_callback_method(self) -> str: - """ - :returns: The HTTP method we use to call `status_callback`. Can be: `GET` or `POST`. - """ - return self._properties["status_callback_method"] - - @property - def trunk_sid(self) -> str: - """ - :returns: The SID of the Trunk that handles calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice URLs and voice applications and use those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa. - """ - return self._properties["trunk_sid"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def voice_application_sid(self) -> str: - """ - :returns: The SID of the application that handles calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice URLs and use those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa. - """ - return self._properties["voice_application_sid"] - - @property - def voice_caller_id_lookup(self) -> bool: - """ - :returns: Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: `true` or `false`. - """ - return self._properties["voice_caller_id_lookup"] - - @property - def voice_fallback_method(self) -> str: - """ - :returns: The HTTP method that we use to call `voice_fallback_url`. Can be: `GET` or `POST`. - """ - return self._properties["voice_fallback_method"] - - @property - def voice_fallback_url(self) -> str: - """ - :returns: The URL that we call using the `voice_fallback_method` when an error occurs retrieving or executing the TwiML requested by `url`. - """ - return self._properties["voice_fallback_url"] - - @property - def voice_method(self) -> str: - """ - :returns: The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. - """ - return self._properties["voice_method"] - - @property - def voice_url(self) -> str: - """ - :returns: The URL we call using the `voice_method` when the phone number receives a call. The `voice_url` is not be used if a `voice_application_sid` or a `trunk_sid` is set. - """ - return self._properties["voice_url"] - def delete(self) -> bool: """ Deletes the PhoneNumberInstance diff --git a/twilio/rest/trunking/v1/trunk/recording.py b/twilio/rest/trunking/v1/trunk/recording.py index 2e2ba273c..8615b45d3 100644 --- a/twilio/rest/trunking/v1/trunk/recording.py +++ b/twilio/rest/trunking/v1/trunk/recording.py @@ -13,7 +13,7 @@ """ -from typing import Optional +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 @@ -33,16 +33,16 @@ class RecordingTrim(object): TRIM_SILENCE = "trim-silence" DO_NOT_TRIM = "do-not-trim" - def __init__(self, version, payload, trunk_sid: str): - """ - Initialize the RecordingInstance - """ + """ + :ivar mode: + :ivar trim: + """ + + def __init__(self, version: Version, payload: Dict[str, Any], trunk_sid: str): super().__init__(version) - self._properties = { - "mode": payload.get("mode"), - "trim": payload.get("trim"), - } + self.mode: Optional["RecordingInstance.RecordingMode"] = payload.get("mode") + self.trim: Optional["RecordingInstance.RecordingTrim"] = payload.get("trim") self._solution = { "trunk_sid": trunk_sid, @@ -64,20 +64,6 @@ def _proxy(self) -> "RecordingContext": ) return self._context - @property - def mode(self) -> "RecordingInstance.RecordingMode": - """ - :returns: - """ - return self._properties["mode"] - - @property - def trim(self) -> "RecordingInstance.RecordingTrim": - """ - :returns: - """ - return self._properties["trim"] - def fetch(self) -> "RecordingInstance": """ Fetch the RecordingInstance diff --git a/twilio/rest/trusthub/v1/customer_profiles/__init__.py b/twilio/rest/trusthub/v1/customer_profiles/__init__.py index 5ac7acb79..4931b0357 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/__init__.py +++ b/twilio/rest/trusthub/v1/customer_profiles/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -40,29 +40,47 @@ class Status(object): TWILIO_REJECTED = "twilio-rejected" TWILIO_APPROVED = "twilio-approved" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the CustomerProfilesInstance - """ + """ + :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._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "policy_sid": payload.get("policy_sid"), - "friendly_name": payload.get("friendly_name"), - "status": payload.get("status"), - "valid_until": deserialize.iso8601_datetime(payload.get("valid_until")), - "email": payload.get("email"), - "status_callback": payload.get("status_callback"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[CustomerProfilesContext] = None @@ -81,90 +99,6 @@ def _proxy(self) -> "CustomerProfilesContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Customer-Profile resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Customer-Profile resource. - """ - return self._properties["account_sid"] - - @property - def policy_sid(self) -> str: - """ - :returns: The unique string of a policy that is associated to the Customer-Profile resource. - """ - return self._properties["policy_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def status(self) -> "CustomerProfilesInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def valid_until(self) -> datetime: - """ - :returns: The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. - """ - return self._properties["valid_until"] - - @property - def email(self) -> str: - """ - :returns: The email address that will receive updates when the Customer-Profile resource changes status. - """ - return self._properties["email"] - - @property - def status_callback(self) -> str: - """ - :returns: The URL we call to inform your application of status changes. - """ - return self._properties["status_callback"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Customer-Profile resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of the Assigned Items of the Customer-Profile resource. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the CustomerProfilesInstance diff --git a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.py b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.py index 5a1a1d395..e7ea0ca95 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.py +++ b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_channel_endpoint_assignment.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,27 +24,39 @@ 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, payload, customer_profile_sid: str, sid: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + customer_profile_sid: str, + sid: Optional[str] = None, ): - """ - Initialize the CustomerProfilesChannelEndpointAssignmentInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "customer_profile_sid": payload.get("customer_profile_sid"), - "account_sid": payload.get("account_sid"), - "channel_endpoint_type": payload.get("channel_endpoint_type"), - "channel_endpoint_sid": payload.get("channel_endpoint_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "url": payload.get("url"), - } + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[CustomerProfilesChannelEndpointAssignmentContext] = None @@ -64,55 +76,6 @@ def _proxy(self) -> "CustomerProfilesChannelEndpointAssignmentContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Item Assignment resource. - """ - return self._properties["sid"] - - @property - def customer_profile_sid(self) -> str: - """ - :returns: The unique string that we created to identify the CustomerProfile resource. - """ - return self._properties["customer_profile_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource. - """ - return self._properties["account_sid"] - - @property - def channel_endpoint_type(self) -> str: - """ - :returns: The type of channel endpoint. eg: phone-number - """ - return self._properties["channel_endpoint_type"] - - @property - def channel_endpoint_sid(self) -> str: - """ - :returns: The SID of an channel endpoint - """ - return self._properties["channel_endpoint_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Identity resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the CustomerProfilesChannelEndpointAssignmentInstance diff --git a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.py b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.py index 3285de07b..6ea871cd5 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.py +++ b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_entity_assignments.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,26 +24,37 @@ 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, payload, customer_profile_sid: str, sid: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + customer_profile_sid: str, + sid: Optional[str] = None, ): - """ - Initialize the CustomerProfilesEntityAssignmentsInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "customer_profile_sid": payload.get("customer_profile_sid"), - "account_sid": payload.get("account_sid"), - "object_sid": payload.get("object_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "url": payload.get("url"), - } + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[CustomerProfilesEntityAssignmentsContext] = None @@ -63,48 +74,6 @@ def _proxy(self) -> "CustomerProfilesEntityAssignmentsContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Item Assignment resource. - """ - return self._properties["sid"] - - @property - def customer_profile_sid(self) -> str: - """ - :returns: The unique string that we created to identify the CustomerProfile resource. - """ - return self._properties["customer_profile_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource. - """ - return self._properties["account_sid"] - - @property - def object_sid(self) -> str: - """ - :returns: The SID of an object bag that holds information of the different items. - """ - return self._properties["object_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Identity resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the CustomerProfilesEntityAssignmentsInstance diff --git a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.py b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.py index f006550a5..6d8b7f606 100644 --- a/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.py +++ b/twilio/rest/trusthub/v1/customer_profiles/customer_profiles_evaluations.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,28 +28,42 @@ 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, payload, customer_profile_sid: str, sid: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + customer_profile_sid: str, + sid: Optional[str] = None, ): - """ - Initialize the CustomerProfilesEvaluationsInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "policy_sid": payload.get("policy_sid"), - "customer_profile_sid": payload.get("customer_profile_sid"), - "status": payload.get("status"), - "results": payload.get("results"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "url": payload.get("url"), - } + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[CustomerProfilesEvaluationsContext] = None @@ -69,62 +83,6 @@ def _proxy(self) -> "CustomerProfilesEvaluationsContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that identifies the Evaluation resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the customer_profile resource. - """ - return self._properties["account_sid"] - - @property - def policy_sid(self) -> str: - """ - :returns: The unique string of a policy that is associated to the customer_profile resource. - """ - return self._properties["policy_sid"] - - @property - def customer_profile_sid(self) -> str: - """ - :returns: The unique string that we created to identify the customer_profile resource. - """ - return self._properties["customer_profile_sid"] - - @property - def status(self) -> "CustomerProfilesEvaluationsInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def results(self) -> List[object]: - """ - :returns: The results of the Evaluation which includes the valid and invalid attributes. - """ - return self._properties["results"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def fetch(self) -> "CustomerProfilesEvaluationsInstance": """ Fetch the CustomerProfilesEvaluationsInstance diff --git a/twilio/rest/trusthub/v1/end_user.py b/twilio/rest/trusthub/v1/end_user.py index 91d44f08d..89384ee77 100644 --- a/twilio/rest/trusthub/v1/end_user.py +++ b/twilio/rest/trusthub/v1/end_user.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,25 +24,38 @@ class EndUserInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the EndUserInstance - """ + + """ + :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._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "type": payload.get("type"), - "attributes": payload.get("attributes"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[EndUserContext] = None @@ -61,62 +74,6 @@ def _proxy(self) -> "EndUserContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string created by Twilio to identify the End User resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the End User resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def type(self) -> str: - """ - :returns: The type of end user of the Bundle resource - can be `individual` or `business`. - """ - return self._properties["type"] - - @property - def attributes(self) -> Dict[str, object]: - """ - :returns: The set of parameters that are the attributes of the End Users resource which are listed in the End User Types. - """ - return self._properties["attributes"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the End User resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the EndUserInstance diff --git a/twilio/rest/trusthub/v1/end_user_type.py b/twilio/rest/trusthub/v1/end_user_type.py index cd3cbeee4..1fc367249 100644 --- a/twilio/rest/trusthub/v1/end_user_type.py +++ b/twilio/rest/trusthub/v1/end_user_type.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,22 +23,28 @@ class EndUserTypeInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the EndUserTypeInstance - """ + + """ + :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._properties = { - "sid": payload.get("sid"), - "friendly_name": payload.get("friendly_name"), - "machine_name": payload.get("machine_name"), - "fields": payload.get("fields"), - "url": payload.get("url"), - } + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[EndUserTypeContext] = None @@ -57,41 +63,6 @@ def _proxy(self) -> "EndUserTypeContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that identifies the End-User Type resource. - """ - return self._properties["sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: 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 - """ - return self._properties["friendly_name"] - - @property - def machine_name(self) -> str: - """ - :returns: A machine-readable description of the End-User Type resource. Examples can include first_name, last_name, email, business_name, etc. - """ - return self._properties["machine_name"] - - @property - def fields(self) -> List[object]: - """ - :returns: The required information for creating an End-User. The required fields will change as regulatory needs change and will differ for businesses and individuals. - """ - return self._properties["fields"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the End-User Type resource. - """ - return self._properties["url"] - def fetch(self) -> "EndUserTypeInstance": """ Fetch the EndUserTypeInstance diff --git a/twilio/rest/trusthub/v1/policies.py b/twilio/rest/trusthub/v1/policies.py index d5b583890..6bbe6aea1 100644 --- a/twilio/rest/trusthub/v1/policies.py +++ b/twilio/rest/trusthub/v1/policies.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,21 +23,26 @@ class PoliciesInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the PoliciesInstance - """ + + """ + :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._properties = { - "sid": payload.get("sid"), - "friendly_name": payload.get("friendly_name"), - "requirements": payload.get("requirements"), - "url": payload.get("url"), - } + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[PoliciesContext] = None @@ -56,34 +61,6 @@ def _proxy(self) -> "PoliciesContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that identifies the Policy resource. - """ - return self._properties["sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: A human-readable description that is assigned to describe the Policy resource. Examples can include Primary Customer profile policy - """ - return self._properties["friendly_name"] - - @property - def requirements(self) -> Dict[str, object]: - """ - :returns: The SID of an object that holds the policy information - """ - return self._properties["requirements"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Policy resource. - """ - return self._properties["url"] - def fetch(self) -> "PoliciesInstance": """ Fetch the PoliciesInstance diff --git a/twilio/rest/trusthub/v1/supporting_document.py b/twilio/rest/trusthub/v1/supporting_document.py index 57b2c6521..15d176a66 100644 --- a/twilio/rest/trusthub/v1/supporting_document.py +++ b/twilio/rest/trusthub/v1/supporting_document.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -32,27 +32,43 @@ class Status(object): EXPIRED = "expired" PROVISIONALLY_APPROVED = "provisionally-approved" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the SupportingDocumentInstance - """ + """ + :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._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "mime_type": payload.get("mime_type"), - "status": payload.get("status"), - "type": payload.get("type"), - "attributes": payload.get("attributes"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[SupportingDocumentContext] = None @@ -71,76 +87,6 @@ def _proxy(self) -> "SupportingDocumentContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string created by Twilio to identify the Supporting Document resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Document resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def mime_type(self) -> str: - """ - :returns: The image type uploaded in the Supporting Document container. - """ - return self._properties["mime_type"] - - @property - def status(self) -> "SupportingDocumentInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def type(self) -> str: - """ - :returns: The type of the Supporting Document. - """ - return self._properties["type"] - - @property - def attributes(self) -> Dict[str, object]: - """ - :returns: The set of parameters that are the attributes of the Supporting Documents resource which are listed in the Supporting Document Types. - """ - return self._properties["attributes"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Supporting Document resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the SupportingDocumentInstance diff --git a/twilio/rest/trusthub/v1/supporting_document_type.py b/twilio/rest/trusthub/v1/supporting_document_type.py index 186e7aefd..5c1732386 100644 --- a/twilio/rest/trusthub/v1/supporting_document_type.py +++ b/twilio/rest/trusthub/v1/supporting_document_type.py @@ -13,7 +13,7 @@ """ -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -23,22 +23,28 @@ class SupportingDocumentTypeInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the SupportingDocumentTypeInstance - """ + + """ + :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._properties = { - "sid": payload.get("sid"), - "friendly_name": payload.get("friendly_name"), - "machine_name": payload.get("machine_name"), - "fields": payload.get("fields"), - "url": payload.get("url"), - } + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[SupportingDocumentTypeContext] = None @@ -57,41 +63,6 @@ def _proxy(self) -> "SupportingDocumentTypeContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that identifies the Supporting Document Type resource. - """ - return self._properties["sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: A human-readable description of the Supporting Document Type resource. - """ - return self._properties["friendly_name"] - - @property - def machine_name(self) -> str: - """ - :returns: The machine-readable description of the Supporting Document Type resource. - """ - return self._properties["machine_name"] - - @property - def fields(self) -> List[object]: - """ - :returns: The required information for creating a Supporting Document. The required fields will change as regulatory needs change and will differ for businesses and individuals. - """ - return self._properties["fields"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Supporting Document Type resource. - """ - return self._properties["url"] - def fetch(self) -> "SupportingDocumentTypeInstance": """ Fetch the SupportingDocumentTypeInstance diff --git a/twilio/rest/trusthub/v1/trust_products/__init__.py b/twilio/rest/trusthub/v1/trust_products/__init__.py index 28cfd2fc0..02f8fd2a2 100644 --- a/twilio/rest/trusthub/v1/trust_products/__init__.py +++ b/twilio/rest/trusthub/v1/trust_products/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -40,29 +40,47 @@ class Status(object): TWILIO_REJECTED = "twilio-rejected" TWILIO_APPROVED = "twilio-approved" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the TrustProductsInstance - """ + """ + :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._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "policy_sid": payload.get("policy_sid"), - "friendly_name": payload.get("friendly_name"), - "status": payload.get("status"), - "valid_until": deserialize.iso8601_datetime(payload.get("valid_until")), - "email": payload.get("email"), - "status_callback": payload.get("status_callback"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[TrustProductsContext] = None @@ -81,90 +99,6 @@ def _proxy(self) -> "TrustProductsContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Customer-Profile resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Customer-Profile resource. - """ - return self._properties["account_sid"] - - @property - def policy_sid(self) -> str: - """ - :returns: The unique string of a policy that is associated to the Customer-Profile resource. - """ - return self._properties["policy_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def status(self) -> "TrustProductsInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def valid_until(self) -> datetime: - """ - :returns: The date and time in GMT in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format when the resource will be valid until. - """ - return self._properties["valid_until"] - - @property - def email(self) -> str: - """ - :returns: The email address that will receive updates when the Customer-Profile resource changes status. - """ - return self._properties["email"] - - @property - def status_callback(self) -> str: - """ - :returns: The URL we call to inform your application of status changes. - """ - return self._properties["status_callback"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Customer-Profile resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of the Assigned Items of the Customer-Profile resource. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the TrustProductsInstance diff --git a/twilio/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.py b/twilio/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.py index 7ea43fa67..ce81010ea 100644 --- a/twilio/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.py +++ b/twilio/rest/trusthub/v1/trust_products/trust_products_channel_endpoint_assignment.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,27 +24,39 @@ 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, payload, trust_product_sid: str, sid: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + trust_product_sid: str, + sid: Optional[str] = None, ): - """ - Initialize the TrustProductsChannelEndpointAssignmentInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "trust_product_sid": payload.get("trust_product_sid"), - "account_sid": payload.get("account_sid"), - "channel_endpoint_type": payload.get("channel_endpoint_type"), - "channel_endpoint_sid": payload.get("channel_endpoint_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "url": payload.get("url"), - } + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[TrustProductsChannelEndpointAssignmentContext] = None @@ -64,55 +76,6 @@ def _proxy(self) -> "TrustProductsChannelEndpointAssignmentContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Item Assignment resource. - """ - return self._properties["sid"] - - @property - def trust_product_sid(self) -> str: - """ - :returns: The unique string that we created to identify the CustomerProfile resource. - """ - return self._properties["trust_product_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource. - """ - return self._properties["account_sid"] - - @property - def channel_endpoint_type(self) -> str: - """ - :returns: The type of channel endpoint. eg: phone-number - """ - return self._properties["channel_endpoint_type"] - - @property - def channel_endpoint_sid(self) -> str: - """ - :returns: The SID of an channel endpoint - """ - return self._properties["channel_endpoint_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Identity resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the TrustProductsChannelEndpointAssignmentInstance diff --git a/twilio/rest/trusthub/v1/trust_products/trust_products_entity_assignments.py b/twilio/rest/trusthub/v1/trust_products/trust_products_entity_assignments.py index b1deaceaa..14a704ba1 100644 --- a/twilio/rest/trusthub/v1/trust_products/trust_products_entity_assignments.py +++ b/twilio/rest/trusthub/v1/trust_products/trust_products_entity_assignments.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,26 +24,37 @@ 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, payload, trust_product_sid: str, sid: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + trust_product_sid: str, + sid: Optional[str] = None, ): - """ - Initialize the TrustProductsEntityAssignmentsInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "trust_product_sid": payload.get("trust_product_sid"), - "account_sid": payload.get("account_sid"), - "object_sid": payload.get("object_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "url": payload.get("url"), - } + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[TrustProductsEntityAssignmentsContext] = None @@ -63,48 +74,6 @@ def _proxy(self) -> "TrustProductsEntityAssignmentsContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Item Assignment resource. - """ - return self._properties["sid"] - - @property - def trust_product_sid(self) -> str: - """ - :returns: The unique string that we created to identify the TrustProduct resource. - """ - return self._properties["trust_product_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Item Assignment resource. - """ - return self._properties["account_sid"] - - @property - def object_sid(self) -> str: - """ - :returns: The SID of an object bag that holds information of the different items. - """ - return self._properties["object_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Identity resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the TrustProductsEntityAssignmentsInstance diff --git a/twilio/rest/trusthub/v1/trust_products/trust_products_evaluations.py b/twilio/rest/trusthub/v1/trust_products/trust_products_evaluations.py index ab4f48bb8..154b63725 100644 --- a/twilio/rest/trusthub/v1/trust_products/trust_products_evaluations.py +++ b/twilio/rest/trusthub/v1/trust_products/trust_products_evaluations.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,28 +28,42 @@ 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, payload, trust_product_sid: str, sid: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + trust_product_sid: str, + sid: Optional[str] = None, ): - """ - Initialize the TrustProductsEvaluationsInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "policy_sid": payload.get("policy_sid"), - "trust_product_sid": payload.get("trust_product_sid"), - "status": payload.get("status"), - "results": payload.get("results"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "url": payload.get("url"), - } + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[TrustProductsEvaluationsContext] = None @@ -69,62 +83,6 @@ def _proxy(self) -> "TrustProductsEvaluationsContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that identifies the Evaluation resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the trust_product resource. - """ - return self._properties["account_sid"] - - @property - def policy_sid(self) -> str: - """ - :returns: The unique string of a policy that is associated to the trust_product resource. - """ - return self._properties["policy_sid"] - - @property - def trust_product_sid(self) -> str: - """ - :returns: The unique string that we created to identify the trust_product resource. - """ - return self._properties["trust_product_sid"] - - @property - def status(self) -> "TrustProductsEvaluationsInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def results(self) -> List[object]: - """ - :returns: The results of the Evaluation which includes the valid and invalid attributes. - """ - return self._properties["results"] - - @property - def date_created(self) -> datetime: - """ - :returns: - """ - return self._properties["date_created"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def fetch(self) -> "TrustProductsEvaluationsInstance": """ Fetch the TrustProductsEvaluationsInstance diff --git a/twilio/rest/verify/v2/form.py b/twilio/rest/verify/v2/form.py index b9df3aba4..2c03df398 100644 --- a/twilio/rest/verify/v2/form.py +++ b/twilio/rest/verify/v2/form.py @@ -13,7 +13,7 @@ """ -from typing import Dict, Optional +from typing import Any, Dict, Optional from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource from twilio.base.list_resource import ListResource @@ -24,21 +24,28 @@ class FormInstance(InstanceResource): class FormTypes(object): FORM_PUSH = "form-push" - def __init__(self, version, payload, form_type: Optional[FormTypes] = None): - """ - Initialize the FormInstance - """ + """ + :ivar form_type: + :ivar forms: Object that contains the available forms for this type. This available forms are given in the standard [JSON Schema](https://json-schema.org/) format + :ivar form_meta: Additional information for the available forms for this type. E.g. The separator string used for `binding` in a Factor push. + :ivar url: The URL to access the forms for this type. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + form_type: Optional[FormTypes] = None, + ): super().__init__(version) - self._properties = { - "form_type": payload.get("form_type"), - "forms": payload.get("forms"), - "form_meta": payload.get("form_meta"), - "url": payload.get("url"), - } + self.form_type: Optional["FormInstance.FormTypes"] = payload.get("form_type") + self.forms: Optional[Dict[str, object]] = payload.get("forms") + self.form_meta: Optional[Dict[str, object]] = payload.get("form_meta") + self.url: Optional[str] = payload.get("url") self._solution = { - "form_type": form_type or self._properties["form_type"], + "form_type": form_type or self.form_type, } self._context: Optional[FormContext] = None @@ -57,34 +64,6 @@ def _proxy(self) -> "FormContext": ) return self._context - @property - def form_type(self) -> "FormInstance.FormTypes": - """ - :returns: - """ - return self._properties["form_type"] - - @property - def forms(self) -> Dict[str, object]: - """ - :returns: Object that contains the available forms for this type. This available forms are given in the standard [JSON Schema](https://json-schema.org/) format - """ - return self._properties["forms"] - - @property - def form_meta(self) -> Dict[str, object]: - """ - :returns: Additional information for the available forms for this type. E.g. The separator string used for `binding` in a Factor push. - """ - return self._properties["form_meta"] - - @property - def url(self) -> str: - """ - :returns: The URL to access the forms for this type. - """ - return self._properties["url"] - def fetch(self) -> "FormInstance": """ Fetch the FormInstance diff --git a/twilio/rest/verify/v2/safelist.py b/twilio/rest/verify/v2/safelist.py index 5e9c58407..5bc2d131b 100644 --- a/twilio/rest/verify/v2/safelist.py +++ b/twilio/rest/verify/v2/safelist.py @@ -13,7 +13,7 @@ """ -from typing import Optional +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 @@ -22,20 +22,27 @@ class SafelistInstance(InstanceResource): - def __init__(self, version, payload, phone_number: Optional[str] = None): - """ - Initialize the SafelistInstance - """ + + """ + :ivar sid: The unique string that we created to identify the SafeList resource. + :ivar phone_number: The phone number in SafeList. + :ivar url: The absolute URL of the SafeList resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + phone_number: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "phone_number": payload.get("phone_number"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.phone_number: Optional[str] = payload.get("phone_number") + self.url: Optional[str] = payload.get("url") self._solution = { - "phone_number": phone_number or self._properties["phone_number"], + "phone_number": phone_number or self.phone_number, } self._context: Optional[SafelistContext] = None @@ -54,27 +61,6 @@ def _proxy(self) -> "SafelistContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the SafeList resource. - """ - return self._properties["sid"] - - @property - def phone_number(self) -> str: - """ - :returns: The phone number in SafeList. - """ - return self._properties["phone_number"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the SafeList resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the SafelistInstance diff --git a/twilio/rest/verify/v2/service/__init__.py b/twilio/rest/verify/v2/service/__init__.py index af8badd58..57f5192ae 100644 --- a/twilio/rest/verify/v2/service/__init__.py +++ b/twilio/rest/verify/v2/service/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -33,35 +33,64 @@ class ServiceInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the ServiceInstance - """ + + """ + :ivar sid: The unique string that we created to identify the Service resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. + :ivar friendly_name: The string that you assigned to describe the verification service. **This value should not contain PII.** + :ivar code_length: The length of the verification code to generate. + :ivar lookup_enabled: Whether to perform a lookup with each verification started and return info about the phone number. + :ivar psd2_enabled: Whether to pass PSD2 transaction parameters when starting a verification. + :ivar skip_sms_to_landlines: Whether to skip sending SMS verifications to landlines. Requires `lookup_enabled`. + :ivar dtmf_input_required: Whether to ask the user to press a number before delivering the verify code in a phone call. + :ivar tts_name: The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. + :ivar do_not_share_warning_enabled: Whether to add a security warning at the end of an SMS verification body. Disabled by default and applies only to SMS. Example SMS body: `Your AppName verification code is: 1234. Don’t share this code with anyone; our employees will never ask for the code` + :ivar custom_code_enabled: Whether to allow sending verifications with a custom code instead of a randomly generated one. Not available for all customers. + :ivar push: Configurations for the Push factors (channel) created under this Service. + :ivar totp: Configurations for the TOTP factors (channel) created under this Service. + :ivar default_template_sid: + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar url: The absolute URL of the resource. + :ivar links: The URLs of related resources. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "code_length": deserialize.integer(payload.get("code_length")), - "lookup_enabled": payload.get("lookup_enabled"), - "psd2_enabled": payload.get("psd2_enabled"), - "skip_sms_to_landlines": payload.get("skip_sms_to_landlines"), - "dtmf_input_required": payload.get("dtmf_input_required"), - "tts_name": payload.get("tts_name"), - "do_not_share_warning_enabled": payload.get("do_not_share_warning_enabled"), - "custom_code_enabled": payload.get("custom_code_enabled"), - "push": payload.get("push"), - "totp": payload.get("totp"), - "default_template_sid": payload.get("default_template_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + 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.code_length: Optional[int] = deserialize.integer( + payload.get("code_length") + ) + self.lookup_enabled: Optional[bool] = payload.get("lookup_enabled") + self.psd2_enabled: Optional[bool] = payload.get("psd2_enabled") + self.skip_sms_to_landlines: Optional[bool] = payload.get( + "skip_sms_to_landlines" + ) + self.dtmf_input_required: Optional[bool] = payload.get("dtmf_input_required") + self.tts_name: Optional[str] = payload.get("tts_name") + self.do_not_share_warning_enabled: Optional[bool] = payload.get( + "do_not_share_warning_enabled" + ) + self.custom_code_enabled: Optional[bool] = payload.get("custom_code_enabled") + self.push: Optional[Dict[str, object]] = payload.get("push") + self.totp: Optional[Dict[str, object]] = payload.get("totp") + self.default_template_sid: Optional[str] = payload.get("default_template_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ServiceContext] = None @@ -80,132 +109,6 @@ def _proxy(self) -> "ServiceContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Service resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the verification service. **This value should not contain PII.** - """ - return self._properties["friendly_name"] - - @property - def code_length(self) -> int: - """ - :returns: The length of the verification code to generate. - """ - return self._properties["code_length"] - - @property - def lookup_enabled(self) -> bool: - """ - :returns: Whether to perform a lookup with each verification started and return info about the phone number. - """ - return self._properties["lookup_enabled"] - - @property - def psd2_enabled(self) -> bool: - """ - :returns: Whether to pass PSD2 transaction parameters when starting a verification. - """ - return self._properties["psd2_enabled"] - - @property - def skip_sms_to_landlines(self) -> bool: - """ - :returns: Whether to skip sending SMS verifications to landlines. Requires `lookup_enabled`. - """ - return self._properties["skip_sms_to_landlines"] - - @property - def dtmf_input_required(self) -> bool: - """ - :returns: Whether to ask the user to press a number before delivering the verify code in a phone call. - """ - return self._properties["dtmf_input_required"] - - @property - def tts_name(self) -> str: - """ - :returns: The name of an alternative text-to-speech service to use in phone calls. Applies only to TTS languages. - """ - return self._properties["tts_name"] - - @property - def do_not_share_warning_enabled(self) -> bool: - """ - :returns: Whether to add a security warning at the end of an SMS verification body. Disabled by default and applies only to SMS. Example SMS body: `Your AppName verification code is: 1234. Don’t share this code with anyone; our employees will never ask for the code` - """ - return self._properties["do_not_share_warning_enabled"] - - @property - def custom_code_enabled(self) -> bool: - """ - :returns: Whether to allow sending verifications with a custom code instead of a randomly generated one. Not available for all customers. - """ - return self._properties["custom_code_enabled"] - - @property - def push(self) -> Dict[str, object]: - """ - :returns: Configurations for the Push factors (channel) created under this Service. - """ - return self._properties["push"] - - @property - def totp(self) -> Dict[str, object]: - """ - :returns: Configurations for the TOTP factors (channel) created under this Service. - """ - return self._properties["totp"] - - @property - def default_template_sid(self) -> str: - """ - :returns: - """ - return self._properties["default_template_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the ServiceInstance diff --git a/twilio/rest/verify/v2/service/access_token.py b/twilio/rest/verify/v2/service/access_token.py index 69ce663d6..b81b58e44 100644 --- a/twilio/rest/verify/v2/service/access_token.py +++ b/twilio/rest/verify/v2/service/access_token.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Optional +from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -26,28 +26,46 @@ class AccessTokenInstance(InstanceResource): class FactorTypes(object): PUSH = "push" - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the AccessTokenInstance - """ + """ + :ivar sid: A 34 character string that uniquely identifies this Access Token. + :ivar account_sid: The unique SID identifier of the Account. + :ivar service_sid: The unique SID identifier of the Verify Service. + :ivar entity_identity: The unique external identifier for the Entity of the Service. + :ivar factor_type: + :ivar factor_friendly_name: A human readable description of this factor, up to 64 characters. For a push factor, this can be the device's name. + :ivar token: The access token generated for enrollment, this is an encrypted json web token. + :ivar url: The URL of this resource. + :ivar ttl: How long, in seconds, the access token is valid. Max: 5 minutes + :ivar date_created: The date that this access token was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "entity_identity": payload.get("entity_identity"), - "factor_type": payload.get("factor_type"), - "factor_friendly_name": payload.get("factor_friendly_name"), - "token": payload.get("token"), - "url": payload.get("url"), - "ttl": deserialize.integer(payload.get("ttl")), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.entity_identity: Optional[str] = payload.get("entity_identity") + self.factor_type: Optional["AccessTokenInstance.FactorTypes"] = payload.get( + "factor_type" + ) + self.factor_friendly_name: Optional[str] = payload.get("factor_friendly_name") + self.token: Optional[str] = payload.get("token") + self.url: Optional[str] = payload.get("url") + self.ttl: Optional[int] = deserialize.integer(payload.get("ttl")) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[AccessTokenContext] = None @@ -67,76 +85,6 @@ def _proxy(self) -> "AccessTokenContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this Access Token. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The unique SID identifier of the Account. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The unique SID identifier of the Verify Service. - """ - return self._properties["service_sid"] - - @property - def entity_identity(self) -> str: - """ - :returns: The unique external identifier for the Entity of the Service. - """ - return self._properties["entity_identity"] - - @property - def factor_type(self) -> "AccessTokenInstance.FactorTypes": - """ - :returns: - """ - return self._properties["factor_type"] - - @property - def factor_friendly_name(self) -> str: - """ - :returns: A human readable description of this factor, up to 64 characters. For a push factor, this can be the device's name. - """ - return self._properties["factor_friendly_name"] - - @property - def token(self) -> str: - """ - :returns: The access token generated for enrollment, this is an encrypted json web token. - """ - return self._properties["token"] - - @property - def url(self) -> str: - """ - :returns: The URL of this resource. - """ - return self._properties["url"] - - @property - def ttl(self) -> int: - """ - :returns: How long, in seconds, the access token is valid. Max: 5 minutes - """ - return self._properties["ttl"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this access token was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - def fetch(self) -> "AccessTokenInstance": """ Fetch the AccessTokenInstance diff --git a/twilio/rest/verify/v2/service/entity/__init__.py b/twilio/rest/verify/v2/service/entity/__init__.py index d9676c9b2..1d330ce6d 100644 --- a/twilio/rest/verify/v2/service/entity/__init__.py +++ b/twilio/rest/verify/v2/service/entity/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,28 +27,43 @@ class EntityInstance(InstanceResource): + + """ + :ivar sid: A 34 character string that uniquely identifies this Entity. + :ivar identity: The unique external identifier for the Entity of the Service. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. + :ivar account_sid: The unique SID identifier of the Account. + :ivar service_sid: The unique SID identifier of the Service. + :ivar date_created: The date that this Entity was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date that this Entity was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar url: The URL of this resource. + :ivar links: Contains a dictionary of URL links to nested resources of this Entity. + """ + def __init__( - self, version, payload, service_sid: str, identity: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + identity: Optional[str] = None, ): - """ - Initialize the EntityInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "identity": payload.get("identity"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.identity: Optional[str] = payload.get("identity") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "service_sid": service_sid, - "identity": identity or self._properties["identity"], + "identity": identity or self.identity, } self._context: Optional[EntityContext] = None @@ -68,62 +83,6 @@ def _proxy(self) -> "EntityContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this Entity. - """ - return self._properties["sid"] - - @property - def identity(self) -> str: - """ - :returns: The unique external identifier for the Entity of the Service. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. - """ - return self._properties["identity"] - - @property - def account_sid(self) -> str: - """ - :returns: The unique SID identifier of the Account. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The unique SID identifier of the Service. - """ - return self._properties["service_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this Entity was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this Entity was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The URL of this resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: Contains a dictionary of URL links to nested resources of this Entity. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the EntityInstance diff --git a/twilio/rest/verify/v2/service/entity/challenge/__init__.py b/twilio/rest/verify/v2/service/entity/challenge/__init__.py index 36db924fc..971d4eb7f 100644 --- a/twilio/rest/verify/v2/service/entity/challenge/__init__.py +++ b/twilio/rest/verify/v2/service/entity/challenge/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -44,48 +44,74 @@ class ListOrders(object): ASC = "asc" DESC = "desc" + """ + :ivar sid: A 34 character string that uniquely identifies this Challenge. + :ivar account_sid: The unique SID identifier of the Account. + :ivar service_sid: The unique SID identifier of the Service. + :ivar entity_sid: The unique SID identifier of the Entity. + :ivar identity: Customer unique identity for the Entity owner of the Challenge. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. + :ivar factor_sid: The unique SID identifier of the Factor. + :ivar date_created: The date that this Challenge was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date that this Challenge was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_responded: The date that this Challenge was responded, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar expiration_date: The date-time when this Challenge expires, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. The default value is five (5) minutes after Challenge creation. The max value is sixty (60) minutes after creation. + :ivar status: + :ivar responded_reason: + :ivar details: Details provided to give context about the Challenge. Intended to be shown to the end user. + :ivar hidden_details: Details provided to give context about the Challenge. Intended to be hidden from the end user. It must be a stringified JSON with only strings values eg. `{\"ip\": \"172.168.1.234\"}` + :ivar metadata: Custom metadata associated with the challenge. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. `{\"os\": \"Android\"}`. Can be up to 1024 characters in length. + :ivar factor_type: + :ivar url: The URL of this resource. + :ivar links: Contains a dictionary of URL links to nested resources of this Challenge. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, identity: str, sid: Optional[str] = None, ): - """ - Initialize the ChallengeInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "entity_sid": payload.get("entity_sid"), - "identity": payload.get("identity"), - "factor_sid": payload.get("factor_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "date_responded": deserialize.iso8601_datetime( - payload.get("date_responded") - ), - "expiration_date": deserialize.iso8601_datetime( - payload.get("expiration_date") - ), - "status": payload.get("status"), - "responded_reason": payload.get("responded_reason"), - "details": payload.get("details"), - "hidden_details": payload.get("hidden_details"), - "metadata": payload.get("metadata"), - "factor_type": payload.get("factor_type"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.entity_sid: Optional[str] = payload.get("entity_sid") + self.identity: Optional[str] = payload.get("identity") + self.factor_sid: Optional[str] = payload.get("factor_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.date_responded: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_responded") + ) + self.expiration_date: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("expiration_date") + ) + self.status: Optional["ChallengeInstance.ChallengeStatuses"] = payload.get( + "status" + ) + self.responded_reason: Optional[ + "ChallengeInstance.ChallengeReasons" + ] = payload.get("responded_reason") + self.details: Optional[Dict[str, object]] = payload.get("details") + self.hidden_details: Optional[Dict[str, object]] = payload.get("hidden_details") + self.metadata: Optional[Dict[str, object]] = payload.get("metadata") + self.factor_type: Optional["ChallengeInstance.FactorTypes"] = payload.get( + "factor_type" + ) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "service_sid": service_sid, "identity": identity, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ChallengeContext] = None @@ -106,132 +132,6 @@ def _proxy(self) -> "ChallengeContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this Challenge. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The unique SID identifier of the Account. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The unique SID identifier of the Service. - """ - return self._properties["service_sid"] - - @property - def entity_sid(self) -> str: - """ - :returns: The unique SID identifier of the Entity. - """ - return self._properties["entity_sid"] - - @property - def identity(self) -> str: - """ - :returns: Customer unique identity for the Entity owner of the Challenge. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. - """ - return self._properties["identity"] - - @property - def factor_sid(self) -> str: - """ - :returns: The unique SID identifier of the Factor. - """ - return self._properties["factor_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this Challenge was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this Challenge was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def date_responded(self) -> datetime: - """ - :returns: The date that this Challenge was responded, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_responded"] - - @property - def expiration_date(self) -> datetime: - """ - :returns: The date-time when this Challenge expires, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. The default value is five (5) minutes after Challenge creation. The max value is sixty (60) minutes after creation. - """ - return self._properties["expiration_date"] - - @property - def status(self) -> "ChallengeInstance.ChallengeStatuses": - """ - :returns: - """ - return self._properties["status"] - - @property - def responded_reason(self) -> "ChallengeInstance.ChallengeReasons": - """ - :returns: - """ - return self._properties["responded_reason"] - - @property - def details(self) -> Dict[str, object]: - """ - :returns: Details provided to give context about the Challenge. Intended to be shown to the end user. - """ - return self._properties["details"] - - @property - def hidden_details(self) -> Dict[str, object]: - """ - :returns: Details provided to give context about the Challenge. Intended to be hidden from the end user. It must be a stringified JSON with only strings values eg. `{\"ip\": \"172.168.1.234\"}` - """ - return self._properties["hidden_details"] - - @property - def metadata(self) -> Dict[str, object]: - """ - :returns: Custom metadata associated with the challenge. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. `{\"os\": \"Android\"}`. Can be up to 1024 characters in length. - """ - return self._properties["metadata"] - - @property - def factor_type(self) -> "ChallengeInstance.FactorTypes": - """ - :returns: - """ - return self._properties["factor_type"] - - @property - def url(self) -> str: - """ - :returns: The URL of this resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: Contains a dictionary of URL links to nested resources of this Challenge. - """ - return self._properties["links"] - def fetch(self) -> "ChallengeInstance": """ Fetch the ChallengeInstance diff --git a/twilio/rest/verify/v2/service/entity/challenge/notification.py b/twilio/rest/verify/v2/service/entity/challenge/notification.py index af93ccdc6..e6e0bb631 100644 --- a/twilio/rest/verify/v2/service/entity/challenge/notification.py +++ b/twilio/rest/verify/v2/service/entity/challenge/notification.py @@ -14,6 +14,7 @@ from datetime import datetime +from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -22,25 +23,40 @@ class NotificationInstance(InstanceResource): + + """ + :ivar sid: A 34 character string that uniquely identifies this Notification. + :ivar account_sid: The unique SID identifier of the Account. + :ivar service_sid: The unique SID identifier of the Service. + :ivar entity_sid: The unique SID identifier of the Entity. + :ivar identity: Customer unique identity for the Entity owner of the Challenge. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. + :ivar challenge_sid: The unique SID identifier of the Challenge. + :ivar priority: The priority of the notification. For `push` Challenges it's always `high` which sends the notification immediately, and can wake up a sleeping device. + :ivar ttl: How long, in seconds, the notification is valid. Max: 5 minutes + :ivar date_created: The date that this Notification was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ + def __init__( - self, version, payload, service_sid: str, identity: str, challenge_sid: str + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + identity: str, + challenge_sid: str, ): - """ - Initialize the NotificationInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "entity_sid": payload.get("entity_sid"), - "identity": payload.get("identity"), - "challenge_sid": payload.get("challenge_sid"), - "priority": payload.get("priority"), - "ttl": deserialize.integer(payload.get("ttl")), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.entity_sid: Optional[str] = payload.get("entity_sid") + self.identity: Optional[str] = payload.get("identity") + self.challenge_sid: Optional[str] = payload.get("challenge_sid") + self.priority: Optional[str] = payload.get("priority") + self.ttl: Optional[int] = deserialize.integer(payload.get("ttl")) + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) self._solution = { "service_sid": service_sid, @@ -48,69 +64,6 @@ def __init__( "challenge_sid": challenge_sid, } - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this Notification. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The unique SID identifier of the Account. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The unique SID identifier of the Service. - """ - return self._properties["service_sid"] - - @property - def entity_sid(self) -> str: - """ - :returns: The unique SID identifier of the Entity. - """ - return self._properties["entity_sid"] - - @property - def identity(self) -> str: - """ - :returns: Customer unique identity for the Entity owner of the Challenge. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. - """ - return self._properties["identity"] - - @property - def challenge_sid(self) -> str: - """ - :returns: The unique SID identifier of the Challenge. - """ - return self._properties["challenge_sid"] - - @property - def priority(self) -> str: - """ - :returns: The priority of the notification. For `push` Challenges it's always `high` which sends the notification immediately, and can wake up a sleeping device. - """ - return self._properties["priority"] - - @property - def ttl(self) -> int: - """ - :returns: How long, in seconds, the notification is valid. Max: 5 minutes - """ - return self._properties["ttl"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this Notification was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/verify/v2/service/entity/factor.py b/twilio/rest/verify/v2/service/entity/factor.py index d7cf321cc..8a7eb9372 100644 --- a/twilio/rest/verify/v2/service/entity/factor.py +++ b/twilio/rest/verify/v2/service/entity/factor.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -32,39 +32,56 @@ class FactorTypes(object): PUSH = "push" TOTP = "totp" + """ + :ivar sid: A 34 character string that uniquely identifies this Factor. + :ivar account_sid: The unique SID identifier of the Account. + :ivar service_sid: The unique SID identifier of the Service. + :ivar entity_sid: The unique SID identifier of the Entity. + :ivar identity: Customer unique identity for the Entity owner of the Factor. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. + :ivar date_created: The date that this Factor was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date that this Factor was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar friendly_name: A human readable description of this resource, up to 64 characters. For a push factor, this can be the device's name. + :ivar status: + :ivar factor_type: + :ivar config: An object that contains configurations specific to a `factor_type`. + :ivar metadata: Custom metadata associated with the factor. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. `{\"os\": \"Android\"}`. Can be up to 1024 characters in length. + :ivar url: The URL of this resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, identity: str, sid: Optional[str] = None, ): - """ - Initialize the FactorInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "entity_sid": payload.get("entity_sid"), - "identity": payload.get("identity"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "status": payload.get("status"), - "factor_type": payload.get("factor_type"), - "config": payload.get("config"), - "metadata": payload.get("metadata"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.entity_sid: Optional[str] = payload.get("entity_sid") + self.identity: Optional[str] = payload.get("identity") + 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.friendly_name: Optional[str] = payload.get("friendly_name") + self.status: Optional["FactorInstance.FactorStatuses"] = payload.get("status") + self.factor_type: Optional["FactorInstance.FactorTypes"] = payload.get( + "factor_type" + ) + self.config: Optional[Dict[str, object]] = payload.get("config") + self.metadata: Optional[Dict[str, object]] = payload.get("metadata") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, "identity": identity, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[FactorContext] = None @@ -85,97 +102,6 @@ def _proxy(self) -> "FactorContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this Factor. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The unique SID identifier of the Account. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The unique SID identifier of the Service. - """ - return self._properties["service_sid"] - - @property - def entity_sid(self) -> str: - """ - :returns: The unique SID identifier of the Entity. - """ - return self._properties["entity_sid"] - - @property - def identity(self) -> str: - """ - :returns: Customer unique identity for the Entity owner of the Factor. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. - """ - return self._properties["identity"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this Factor was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this Factor was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: A human readable description of this resource, up to 64 characters. For a push factor, this can be the device's name. - """ - return self._properties["friendly_name"] - - @property - def status(self) -> "FactorInstance.FactorStatuses": - """ - :returns: - """ - return self._properties["status"] - - @property - def factor_type(self) -> "FactorInstance.FactorTypes": - """ - :returns: - """ - return self._properties["factor_type"] - - @property - def config(self) -> Dict[str, object]: - """ - :returns: An object that contains configurations specific to a `factor_type`. - """ - return self._properties["config"] - - @property - def metadata(self) -> Dict[str, object]: - """ - :returns: Custom metadata associated with the factor. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. `{\"os\": \"Android\"}`. Can be up to 1024 characters in length. - """ - return self._properties["metadata"] - - @property - def url(self) -> str: - """ - :returns: The URL of this resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the FactorInstance diff --git a/twilio/rest/verify/v2/service/entity/new_factor.py b/twilio/rest/verify/v2/service/entity/new_factor.py index 2e2cda1cb..621a43052 100644 --- a/twilio/rest/verify/v2/service/entity/new_factor.py +++ b/twilio/rest/verify/v2/service/entity/new_factor.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict +from typing import Any, Dict, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource @@ -31,132 +31,56 @@ class FactorTypes(object): PUSH = "push" TOTP = "totp" - def __init__(self, version, payload, service_sid: str, identity: str): - """ - Initialize the NewFactorInstance - """ + """ + :ivar sid: A 34 character string that uniquely identifies this Factor. + :ivar account_sid: The unique SID identifier of the Account. + :ivar service_sid: The unique SID identifier of the Service. + :ivar entity_sid: The unique SID identifier of the Entity. + :ivar identity: Customer unique identity for the Entity owner of the Factor. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. + :ivar binding: Contains the `factor_type` specific secret and metadata. For push, this is `binding.public_key` and `binding.alg`. For totp, this is `binding.secret` and `binding.uri`. The `binding.uri` property is generated following the [google authenticator key URI format](https://github.com/google/google-authenticator/wiki/Key-Uri-Format), and `Factor.friendly_name` is used for the “accountname” value and `Service.friendly_name` or `Service.totp.issuer` is used for the `issuer` value. The Binding property is ONLY returned upon Factor creation. + :ivar date_created: The date that this Factor was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date that this Factor was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar friendly_name: The friendly name of this Factor. This can be any string up to 64 characters, meant for humans to distinguish between Factors. For `factor_type` `push`, this could be a device name. For `factor_type` `totp`, this value is used as the “account name” in constructing the `binding.uri` property. At the same time, we recommend avoiding providing PII. + :ivar status: + :ivar factor_type: + :ivar config: An object that contains configurations specific to a `factor_type`. + :ivar metadata: Custom metadata associated with the factor. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. `{\"os\": \"Android\"}`. Can be up to 1024 characters in length. + :ivar url: The URL of this resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], service_sid: str, identity: str + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "entity_sid": payload.get("entity_sid"), - "identity": payload.get("identity"), - "binding": payload.get("binding"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "friendly_name": payload.get("friendly_name"), - "status": payload.get("status"), - "factor_type": payload.get("factor_type"), - "config": payload.get("config"), - "metadata": payload.get("metadata"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.entity_sid: Optional[str] = payload.get("entity_sid") + self.identity: Optional[str] = payload.get("identity") + self.binding: Optional[Dict[str, object]] = payload.get("binding") + 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.friendly_name: Optional[str] = payload.get("friendly_name") + self.status: Optional["NewFactorInstance.FactorStatuses"] = payload.get( + "status" + ) + self.factor_type: Optional["NewFactorInstance.FactorTypes"] = payload.get( + "factor_type" + ) + self.config: Optional[Dict[str, object]] = payload.get("config") + self.metadata: Optional[Dict[str, object]] = payload.get("metadata") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, "identity": identity, } - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this Factor. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The unique SID identifier of the Account. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The unique SID identifier of the Service. - """ - return self._properties["service_sid"] - - @property - def entity_sid(self) -> str: - """ - :returns: The unique SID identifier of the Entity. - """ - return self._properties["entity_sid"] - - @property - def identity(self) -> str: - """ - :returns: Customer unique identity for the Entity owner of the Factor. This identifier should be immutable, not PII, length between 8 and 64 characters, and generated by your external system, such as your user's UUID, GUID, or SID. It can only contain dash (-) separated alphanumeric characters. - """ - return self._properties["identity"] - - @property - def binding(self) -> Dict[str, object]: - """ - :returns: Contains the `factor_type` specific secret and metadata. For push, this is `binding.public_key` and `binding.alg`. For totp, this is `binding.secret` and `binding.uri`. The `binding.uri` property is generated following the [google authenticator key URI format](https://github.com/google/google-authenticator/wiki/Key-Uri-Format), and `Factor.friendly_name` is used for the “accountname” value and `Service.friendly_name` or `Service.totp.issuer` is used for the `issuer` value. The Binding property is ONLY returned upon Factor creation. - """ - return self._properties["binding"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this Factor was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this Factor was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def friendly_name(self) -> str: - """ - :returns: The friendly name of this Factor. This can be any string up to 64 characters, meant for humans to distinguish between Factors. For `factor_type` `push`, this could be a device name. For `factor_type` `totp`, this value is used as the “account name” in constructing the `binding.uri` property. At the same time, we recommend avoiding providing PII. - """ - return self._properties["friendly_name"] - - @property - def status(self) -> "NewFactorInstance.FactorStatuses": - """ - :returns: - """ - return self._properties["status"] - - @property - def factor_type(self) -> "NewFactorInstance.FactorTypes": - """ - :returns: - """ - return self._properties["factor_type"] - - @property - def config(self) -> Dict[str, object]: - """ - :returns: An object that contains configurations specific to a `factor_type`. - """ - return self._properties["config"] - - @property - def metadata(self) -> Dict[str, object]: - """ - :returns: Custom metadata associated with the factor. This is added by the Device/SDK directly to allow for the inclusion of device information. It must be a stringified JSON with only strings values eg. `{\"os\": \"Android\"}`. Can be up to 1024 characters in length. - """ - return self._properties["metadata"] - - @property - def url(self) -> str: - """ - :returns: The URL of this resource. - """ - return self._properties["url"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/verify/v2/service/messaging_configuration.py b/twilio/rest/verify/v2/service/messaging_configuration.py index ce609cef4..0f41cb165 100644 --- a/twilio/rest/verify/v2/service/messaging_configuration.py +++ b/twilio/rest/verify/v2/service/messaging_configuration.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,27 +24,41 @@ class MessagingConfigurationInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/verify/api/service) that the resource is associated with. + :ivar country: The [ISO-3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code of the country this configuration will be applied to. If this is a global configuration, Country will take the value `all`. + :ivar messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/sms/services/api) to be used to send SMS to the country of this configuration. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar url: The URL of this resource. + """ + def __init__( - self, version, payload, service_sid: str, country: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + country: Optional[str] = None, ): - """ - Initialize the MessagingConfigurationInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "country": payload.get("country"), - "messaging_service_sid": payload.get("messaging_service_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.country: Optional[str] = payload.get("country") + self.messaging_service_sid: Optional[str] = payload.get("messaging_service_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, - "country": country or self._properties["country"], + "country": country or self.country, } self._context: Optional[MessagingConfigurationContext] = None @@ -64,55 +78,6 @@ def _proxy(self) -> "MessagingConfigurationContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/verify/api/service) that the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def country(self) -> str: - """ - :returns: The [ISO-3166-1](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code of the country this configuration will be applied to. If this is a global configuration, Country will take the value `all`. - """ - return self._properties["country"] - - @property - def messaging_service_sid(self) -> str: - """ - :returns: The SID of the [Messaging Service](https://www.twilio.com/docs/sms/services/api) to be used to send SMS to the country of this configuration. - """ - return self._properties["messaging_service_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The URL of this resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the MessagingConfigurationInstance diff --git a/twilio/rest/verify/v2/service/rate_limit/__init__.py b/twilio/rest/verify/v2/service/rate_limit/__init__.py index e06d3f99a..2d6f8d85e 100644 --- a/twilio/rest/verify/v2/service/rate_limit/__init__.py +++ b/twilio/rest/verify/v2/service/rate_limit/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -25,27 +25,45 @@ class RateLimitInstance(InstanceResource): - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the RateLimitInstance - """ + + """ + :ivar sid: A 34 character string that uniquely identifies this Rate Limit. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/verify/api/service) the resource is associated with. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Rate Limit resource. + :ivar unique_name: Provides a unique and addressable name to be assigned to this Rate Limit, assigned by the developer, to be optionally used in addition to SID. **This value should not contain PII.** + :ivar description: Description of this Rate Limit + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar url: The URL of this resource. + :ivar links: The URLs of related resources. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "service_sid": payload.get("service_sid"), - "account_sid": payload.get("account_sid"), - "unique_name": payload.get("unique_name"), - "description": payload.get("description"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.description: Optional[str] = payload.get("description") + 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 = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[RateLimitContext] = None @@ -65,69 +83,6 @@ def _proxy(self) -> "RateLimitContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this Rate Limit. - """ - return self._properties["sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/verify/api/service) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Rate Limit resource. - """ - return self._properties["account_sid"] - - @property - def unique_name(self) -> str: - """ - :returns: Provides a unique and addressable name to be assigned to this Rate Limit, assigned by the developer, to be optionally used in addition to SID. **This value should not contain PII.** - """ - return self._properties["unique_name"] - - @property - def description(self) -> str: - """ - :returns: Description of this Rate Limit - """ - return self._properties["description"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The URL of this resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the RateLimitInstance diff --git a/twilio/rest/verify/v2/service/rate_limit/bucket.py b/twilio/rest/verify/v2/service/rate_limit/bucket.py index 5a7d5ca57..d86a572e4 100644 --- a/twilio/rest/verify/v2/service/rate_limit/bucket.py +++ b/twilio/rest/verify/v2/service/rate_limit/bucket.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,35 +24,47 @@ class BucketInstance(InstanceResource): + + """ + :ivar sid: A 34 character string that uniquely identifies this Bucket. + :ivar rate_limit_sid: The Twilio-provided string that uniquely identifies the Rate Limit resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/verify/api/service) the resource is associated with. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Rate Limit resource. + :ivar max: Maximum number of requests permitted in during the interval. + :ivar interval: Number of seconds that the rate limit will be enforced over. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar url: The URL of this resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], service_sid: str, rate_limit_sid: str, sid: Optional[str] = None, ): - """ - Initialize the BucketInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "rate_limit_sid": payload.get("rate_limit_sid"), - "service_sid": payload.get("service_sid"), - "account_sid": payload.get("account_sid"), - "max": deserialize.integer(payload.get("max")), - "interval": deserialize.integer(payload.get("interval")), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.rate_limit_sid: Optional[str] = payload.get("rate_limit_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.max: Optional[int] = deserialize.integer(payload.get("max")) + self.interval: Optional[int] = deserialize.integer(payload.get("interval")) + 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 = { "service_sid": service_sid, "rate_limit_sid": rate_limit_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[BucketContext] = None @@ -73,69 +85,6 @@ def _proxy(self) -> "BucketContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies this Bucket. - """ - return self._properties["sid"] - - @property - def rate_limit_sid(self) -> str: - """ - :returns: The Twilio-provided string that uniquely identifies the Rate Limit resource. - """ - return self._properties["rate_limit_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/verify/api/service) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Rate Limit resource. - """ - return self._properties["account_sid"] - - @property - def max(self) -> int: - """ - :returns: Maximum number of requests permitted in during the interval. - """ - return self._properties["max"] - - @property - def interval(self) -> int: - """ - :returns: Number of seconds that the rate limit will be enforced over. - """ - return self._properties["interval"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The URL of this resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the BucketInstance diff --git a/twilio/rest/verify/v2/service/verification.py b/twilio/rest/verify/v2/service/verification.py index 5d993554b..308e189a4 100644 --- a/twilio/rest/verify/v2/service/verification.py +++ b/twilio/rest/verify/v2/service/verification.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -30,33 +30,58 @@ class Channel(object): WHATSAPP = "whatsapp" SNA = "sna" - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the VerificationInstance - """ + """ + :ivar sid: The unique string that we created to identify the Verification resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/verify/api/service) the resource is associated with. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Verification resource. + :ivar to: The phone number or [email](https://www.twilio.com/docs/verify/email) being verified. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). + :ivar channel: + :ivar status: The status of the verification. One of: `pending`, `approved`, or `canceled` + :ivar valid: Use \"status\" instead. Legacy property indicating whether the verification was successful. + :ivar lookup: Information about the phone number being verified. + :ivar amount: The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. + :ivar payee: The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. + :ivar send_code_attempts: An array of verification attempt objects containing the channel attempted and the channel-specific transaction SID. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar sna: The set of fields used for a silent network auth (`sna`) verification. Contains a single field with the URL to be invoked to verify the phone number. + :ivar url: The absolute URL of the Verification resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "service_sid": payload.get("service_sid"), - "account_sid": payload.get("account_sid"), - "to": payload.get("to"), - "channel": payload.get("channel"), - "status": payload.get("status"), - "valid": payload.get("valid"), - "lookup": payload.get("lookup"), - "amount": payload.get("amount"), - "payee": payload.get("payee"), - "send_code_attempts": payload.get("send_code_attempts"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "sna": payload.get("sna"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.to: Optional[str] = payload.get("to") + self.channel: Optional["VerificationInstance.Channel"] = payload.get("channel") + self.status: Optional[str] = payload.get("status") + self.valid: Optional[bool] = payload.get("valid") + self.lookup: Optional[Dict[str, object]] = payload.get("lookup") + self.amount: Optional[str] = payload.get("amount") + self.payee: Optional[str] = payload.get("payee") + self.send_code_attempts: Optional[List[object]] = payload.get( + "send_code_attempts" + ) + 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.sna: Optional[Dict[str, object]] = payload.get("sna") + self.url: Optional[str] = payload.get("url") self._solution = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[VerificationContext] = None @@ -76,111 +101,6 @@ def _proxy(self) -> "VerificationContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Verification resource. - """ - return self._properties["sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/verify/api/service) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Verification resource. - """ - return self._properties["account_sid"] - - @property - def to(self) -> str: - """ - :returns: The phone number or [email](https://www.twilio.com/docs/verify/email) being verified. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). - """ - return self._properties["to"] - - @property - def channel(self) -> "VerificationInstance.Channel": - """ - :returns: - """ - return self._properties["channel"] - - @property - def status(self) -> str: - """ - :returns: The status of the verification. One of: `pending`, `approved`, or `canceled` - """ - return self._properties["status"] - - @property - def valid(self) -> bool: - """ - :returns: Use \"status\" instead. Legacy property indicating whether the verification was successful. - """ - return self._properties["valid"] - - @property - def lookup(self) -> Dict[str, object]: - """ - :returns: Information about the phone number being verified. - """ - return self._properties["lookup"] - - @property - def amount(self) -> str: - """ - :returns: The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. - """ - return self._properties["amount"] - - @property - def payee(self) -> str: - """ - :returns: The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. - """ - return self._properties["payee"] - - @property - def send_code_attempts(self) -> List[object]: - """ - :returns: An array of verification attempt objects containing the channel attempted and the channel-specific transaction SID. - """ - return self._properties["send_code_attempts"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def sna(self) -> Dict[str, object]: - """ - :returns: The set of fields used for a silent network auth (`sna`) verification. Contains a single field with the URL to be invoked to verify the phone number. - """ - return self._properties["sna"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Verification resource. - """ - return self._properties["url"] - def fetch(self) -> "VerificationInstance": """ Fetch the VerificationInstance diff --git a/twilio/rest/verify/v2/service/verification_check.py b/twilio/rest/verify/v2/service/verification_check.py index 034dfb3ab..0e85d3056 100644 --- a/twilio/rest/verify/v2/service/verification_check.py +++ b/twilio/rest/verify/v2/service/verification_check.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -30,115 +30,49 @@ class Channel(object): WHATSAPP = "whatsapp" SNA = "sna" - def __init__(self, version, payload, service_sid: str): - """ - Initialize the VerificationCheckInstance - """ + """ + :ivar sid: The unique string that we created to identify the VerificationCheck resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/verify/api/service) the resource is associated with. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the VerificationCheck resource. + :ivar to: The phone number or [email](https://www.twilio.com/docs/verify/email) being verified. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). + :ivar channel: + :ivar status: The status of the verification. Can be: `pending`, `approved`, or `canceled`. + :ivar valid: Use \"status\" instead. Legacy property indicating whether the verification was successful. + :ivar amount: The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. + :ivar payee: The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. + :ivar date_created: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the Verification Check resource was created. + :ivar date_updated: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the Verification Check resource was last updated. + :ivar sna_attempts_error_codes: List of error codes as a result of attempting a verification using the `sna` channel. The error codes are chronologically ordered, from the first attempt to the latest attempt. This will be an empty list if no errors occured or `null` if the last channel used wasn't `sna`. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], service_sid: str): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "service_sid": payload.get("service_sid"), - "account_sid": payload.get("account_sid"), - "to": payload.get("to"), - "channel": payload.get("channel"), - "status": payload.get("status"), - "valid": payload.get("valid"), - "amount": payload.get("amount"), - "payee": payload.get("payee"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "sna_attempts_error_codes": payload.get("sna_attempts_error_codes"), - } + self.sid: Optional[str] = payload.get("sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.to: Optional[str] = payload.get("to") + self.channel: Optional["VerificationCheckInstance.Channel"] = payload.get( + "channel" + ) + self.status: Optional[str] = payload.get("status") + self.valid: Optional[bool] = payload.get("valid") + self.amount: Optional[str] = payload.get("amount") + self.payee: Optional[str] = payload.get("payee") + 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.sna_attempts_error_codes: Optional[List[object]] = payload.get( + "sna_attempts_error_codes" + ) self._solution = { "service_sid": service_sid, } - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the VerificationCheck resource. - """ - return self._properties["sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/verify/api/service) the resource is associated with. - """ - return self._properties["service_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the VerificationCheck resource. - """ - return self._properties["account_sid"] - - @property - def to(self) -> str: - """ - :returns: The phone number or [email](https://www.twilio.com/docs/verify/email) being verified. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). - """ - return self._properties["to"] - - @property - def channel(self) -> "VerificationCheckInstance.Channel": - """ - :returns: - """ - return self._properties["channel"] - - @property - def status(self) -> str: - """ - :returns: The status of the verification. Can be: `pending`, `approved`, or `canceled`. - """ - return self._properties["status"] - - @property - def valid(self) -> bool: - """ - :returns: Use \"status\" instead. Legacy property indicating whether the verification was successful. - """ - return self._properties["valid"] - - @property - def amount(self) -> str: - """ - :returns: The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. - """ - return self._properties["amount"] - - @property - def payee(self) -> str: - """ - :returns: The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. - """ - return self._properties["payee"] - - @property - def date_created(self) -> datetime: - """ - :returns: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the Verification Check resource was created. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the Verification Check resource was last updated. - """ - return self._properties["date_updated"] - - @property - def sna_attempts_error_codes(self) -> List[object]: - """ - :returns: List of error codes as a result of attempting a verification using the `sna` channel. The error codes are chronologically ordered, from the first attempt to the latest attempt. This will be an empty list if no errors occured or `null` if the last channel used wasn't `sna`. - """ - return self._properties["sna_attempts_error_codes"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/verify/v2/service/webhook.py b/twilio/rest/verify/v2/service/webhook.py index c5844a6f2..e42bae66c 100644 --- a/twilio/rest/verify/v2/service/webhook.py +++ b/twilio/rest/verify/v2/service/webhook.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -36,30 +36,52 @@ class Version(object): V1 = "v1" V2 = "v2" - def __init__(self, version, payload, service_sid: str, sid: Optional[str] = None): - """ - Initialize the WebhookInstance - """ + """ + :ivar sid: The unique string that we created to identify the Webhook resource. + :ivar service_sid: The unique SID identifier of the Service. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. + :ivar friendly_name: The string that you assigned to describe the webhook. **This value should not contain PII.** + :ivar event_types: The array of events that this Webhook is subscribed to. Possible event types: `*, factor.deleted, factor.created, factor.verified, challenge.approved, challenge.denied` + :ivar status: + :ivar version: + :ivar webhook_url: The URL associated with this Webhook. + :ivar webhook_method: + :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 Webhook resource. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + service_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "service_sid": payload.get("service_sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "event_types": payload.get("event_types"), - "status": payload.get("status"), - "version": payload.get("version"), - "webhook_url": payload.get("webhook_url"), - "webhook_method": payload.get("webhook_method"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.event_types: Optional[List[str]] = payload.get("event_types") + self.status: Optional["WebhookInstance.Status"] = payload.get("status") + self.version: Optional["WebhookInstance.Version"] = payload.get("version") + self.webhook_url: Optional[str] = payload.get("webhook_url") + self.webhook_method: Optional["WebhookInstance.Methods"] = payload.get( + "webhook_method" + ) + 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 = { "service_sid": service_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[WebhookContext] = None @@ -79,90 +101,6 @@ def _proxy(self) -> "WebhookContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Webhook resource. - """ - return self._properties["sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The unique SID identifier of the Service. - """ - return self._properties["service_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Service resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the webhook. **This value should not contain PII.** - """ - return self._properties["friendly_name"] - - @property - def event_types(self) -> List[str]: - """ - :returns: The array of events that this Webhook is subscribed to. Possible event types: `*, factor.deleted, factor.created, factor.verified, challenge.approved, challenge.denied` - """ - return self._properties["event_types"] - - @property - def status(self) -> "WebhookInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def version(self) -> "WebhookInstance.Version": - """ - :returns: - """ - return self._properties["version"] - - @property - def webhook_url(self) -> str: - """ - :returns: The URL associated with this Webhook. - """ - return self._properties["webhook_url"] - - @property - def webhook_method(self) -> "WebhookInstance.Methods": - """ - :returns: - """ - return self._properties["webhook_method"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the Webhook resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the WebhookInstance diff --git a/twilio/rest/verify/v2/template.py b/twilio/rest/verify/v2/template.py index c5f101250..f07df9d05 100644 --- a/twilio/rest/verify/v2/template.py +++ b/twilio/rest/verify/v2/template.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_resource import InstanceResource @@ -23,56 +23,25 @@ class TemplateInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the TemplateInstance - """ - super().__init__(version) - - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "channels": payload.get("channels"), - "translations": payload.get("translations"), - } - - self._solution = {} - @property - def sid(self) -> str: - """ - :returns: A 34 character string that uniquely identifies a Verification Template. - """ - return self._properties["sid"] + """ + :ivar sid: A 34 character string that uniquely identifies a Verification Template. + :ivar account_sid: The unique SID identifier of the Account. + :ivar friendly_name: A descriptive string that you create to describe a Template. + :ivar channels: A list of channels that support the Template. Can include: sms, voice + :ivar translations: An object that contains the different translations of the template. Every translation is identified by the language short name and contains its respective information as the approval status, text and created/modified date. + """ - @property - def account_sid(self) -> str: - """ - :returns: The unique SID identifier of the Account. - """ - return self._properties["account_sid"] + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) - @property - def friendly_name(self) -> str: - """ - :returns: A descriptive string that you create to describe a Template. - """ - return self._properties["friendly_name"] + 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.channels: Optional[List[str]] = payload.get("channels") + self.translations: Optional[Dict[str, object]] = payload.get("translations") - @property - def channels(self) -> List[str]: - """ - :returns: A list of channels that support the Template. Can include: sms, voice - """ - return self._properties["channels"] - - @property - def translations(self) -> Dict[str, object]: - """ - :returns: An object that contains the different translations of the template. Every translation is identified by the language short name and contains its respective information as the approval status, text and created/modified date. - """ - return self._properties["translations"] + self._solution = {} def __repr__(self) -> str: """ diff --git a/twilio/rest/verify/v2/verification_attempt.py b/twilio/rest/verify/v2/verification_attempt.py index 071fb0c77..31e39a5ff 100644 --- a/twilio/rest/verify/v2/verification_attempt.py +++ b/twilio/rest/verify/v2/verification_attempt.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -34,28 +34,47 @@ class ConversionStatus(object): CONVERTED = "converted" UNCONVERTED = "unconverted" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the VerificationAttemptInstance - """ + """ + :ivar sid: The SID that uniquely identifies the verification attempt resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Verification resource. + :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/verify/api/service) used to generate the attempt. + :ivar verification_sid: The SID of the [Verification](https://www.twilio.com/docs/verify/api/verification) that generated the attempt. + :ivar date_created: The date that this Attempt was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date that this Attempt was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar conversion_status: + :ivar channel: + :ivar price: An object containing the charge for this verification attempt related to the channel costs and the currency used. The costs related to the succeeded verifications are not included. May not be immediately available. More information on pricing is available [here](https://www.twilio.com/verify/pricing). + :ivar channel_data: An object containing the channel specific information for an attempt. + :ivar url: + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "service_sid": payload.get("service_sid"), - "verification_sid": payload.get("verification_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "conversion_status": payload.get("conversion_status"), - "channel": payload.get("channel"), - "price": payload.get("price"), - "channel_data": payload.get("channel_data"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.service_sid: Optional[str] = payload.get("service_sid") + self.verification_sid: Optional[str] = payload.get("verification_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.conversion_status: Optional[ + "VerificationAttemptInstance.ConversionStatus" + ] = payload.get("conversion_status") + self.channel: Optional["VerificationAttemptInstance.Channels"] = payload.get( + "channel" + ) + self.price: Optional[Dict[str, object]] = payload.get("price") + self.channel_data: Optional[Dict[str, object]] = payload.get("channel_data") + self.url: Optional[str] = payload.get("url") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[VerificationAttemptContext] = None @@ -74,83 +93,6 @@ def _proxy(self) -> "VerificationAttemptContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The SID that uniquely identifies the verification attempt resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Verification resource. - """ - return self._properties["account_sid"] - - @property - def service_sid(self) -> str: - """ - :returns: The SID of the [Service](https://www.twilio.com/docs/verify/api/service) used to generate the attempt. - """ - return self._properties["service_sid"] - - @property - def verification_sid(self) -> str: - """ - :returns: The SID of the [Verification](https://www.twilio.com/docs/verify/api/verification) that generated the attempt. - """ - return self._properties["verification_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date that this Attempt was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date that this Attempt was updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def conversion_status(self) -> "VerificationAttemptInstance.ConversionStatus": - """ - :returns: - """ - return self._properties["conversion_status"] - - @property - def channel(self) -> "VerificationAttemptInstance.Channels": - """ - :returns: - """ - return self._properties["channel"] - - @property - def price(self) -> Dict[str, object]: - """ - :returns: An object containing the charge for this verification attempt related to the channel costs and the currency used. The costs related to the succeeded verifications are not included. May not be immediately available. More information on pricing is available [here](https://www.twilio.com/verify/pricing). - """ - return self._properties["price"] - - @property - def channel_data(self) -> Dict[str, object]: - """ - :returns: An object containing the channel specific information for an attempt. - """ - return self._properties["channel_data"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def fetch(self) -> "VerificationAttemptInstance": """ Fetch the VerificationAttemptInstance diff --git a/twilio/rest/verify/v2/verification_attempts_summary.py b/twilio/rest/verify/v2/verification_attempts_summary.py index f006572bd..dc756583e 100644 --- a/twilio/rest/verify/v2/verification_attempts_summary.py +++ b/twilio/rest/verify/v2/verification_attempts_summary.py @@ -13,7 +13,7 @@ """ -from typing import Optional +from typing import Any, Dict, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,21 +28,30 @@ class Channels(object): EMAIL = "email" WHATSAPP = "whatsapp" - def __init__(self, version, payload): - """ - Initialize the VerificationAttemptsSummaryInstance - """ + """ + :ivar total_attempts: Total of attempts made according to the provided filters + :ivar total_converted: Total of attempts made that were confirmed by the end user, according to the provided filters. + :ivar total_unconverted: Total of attempts made that were not confirmed by the end user, according to the provided filters. + :ivar conversion_rate_percentage: Percentage of the confirmed messages over the total, defined by (total_converted/total_attempts)*100. + :ivar url: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "total_attempts": deserialize.integer(payload.get("total_attempts")), - "total_converted": deserialize.integer(payload.get("total_converted")), - "total_unconverted": deserialize.integer(payload.get("total_unconverted")), - "conversion_rate_percentage": deserialize.decimal( - payload.get("conversion_rate_percentage") - ), - "url": payload.get("url"), - } + self.total_attempts: Optional[int] = deserialize.integer( + payload.get("total_attempts") + ) + self.total_converted: Optional[int] = deserialize.integer( + payload.get("total_converted") + ) + self.total_unconverted: Optional[int] = deserialize.integer( + payload.get("total_unconverted") + ) + self.conversion_rate_percentage: Optional[float] = deserialize.decimal( + payload.get("conversion_rate_percentage") + ) + self.url: Optional[str] = payload.get("url") self._solution = {} self._context: Optional[VerificationAttemptsSummaryContext] = None @@ -61,41 +70,6 @@ def _proxy(self) -> "VerificationAttemptsSummaryContext": ) return self._context - @property - def total_attempts(self) -> int: - """ - :returns: Total of attempts made according to the provided filters - """ - return self._properties["total_attempts"] - - @property - def total_converted(self) -> int: - """ - :returns: Total of attempts made that were confirmed by the end user, according to the provided filters. - """ - return self._properties["total_converted"] - - @property - def total_unconverted(self) -> int: - """ - :returns: Total of attempts made that were not confirmed by the end user, according to the provided filters. - """ - return self._properties["total_unconverted"] - - @property - def conversion_rate_percentage(self) -> float: - """ - :returns: Percentage of the confirmed messages over the total, defined by (total_converted/total_attempts)*100. - """ - return self._properties["conversion_rate_percentage"] - - @property - def url(self) -> str: - """ - :returns: - """ - return self._properties["url"] - def fetch( self, verify_service_sid=values.unset, diff --git a/twilio/rest/video/v1/composition.py b/twilio/rest/video/v1/composition.py index 74c837592..92c5d71b9 100644 --- a/twilio/rest/video/v1/composition.py +++ b/twilio/rest/video/v1/composition.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -35,40 +35,71 @@ class Status(object): DELETED = "deleted" FAILED = "failed" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the CompositionInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Composition resource. + :ivar status: + :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_completed: The date and time in GMT when the composition's media processing task finished, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_deleted: The date and time in GMT when the composition generated media was deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar sid: The unique string that we created to identify the Composition resource. + :ivar room_sid: The SID of the Group Room that generated the audio and video tracks used in the composition. All media sources included in a composition must belong to the same Group Room. + :ivar audio_sources: The array of track names to include in the composition. The composition includes all audio sources specified in `audio_sources` except those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` includes tracks named `student` as well as `studentTeam`. + :ivar audio_sources_excluded: The array of track names to exclude from the composition. The composition includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty. + :ivar video_layout: An object that describes the video layout of the composition in terms of regions. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. + :ivar resolution: The dimensions of the video image in pixels expressed as columns (width) and rows (height). The string's format is `{width}x{height}`, such as `640x480`. + :ivar trim: Whether to remove intervals with no media, as specified in the POST request that created the composition. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. + :ivar format: + :ivar bitrate: The average bit rate of the composition's media. + :ivar size: The size of the composed media file in bytes. + :ivar duration: The duration of the composition's media file in seconds. + :ivar media_external_location: The URL of the media file associated with the composition when stored externally. See [External S3 Compositions](/docs/video/api/external-s3-compositions) for more details. + :ivar status_callback: The URL called using the `status_callback_method` to send status information on every composition event. + :ivar status_callback_method: The HTTP method used to call `status_callback`. Can be: `POST` or `GET`, defaults to `POST`. + :ivar url: The absolute URL of the resource. + :ivar links: The URL of the media file associated with the composition. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "status": payload.get("status"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_completed": deserialize.iso8601_datetime( - payload.get("date_completed") - ), - "date_deleted": deserialize.iso8601_datetime(payload.get("date_deleted")), - "sid": payload.get("sid"), - "room_sid": payload.get("room_sid"), - "audio_sources": payload.get("audio_sources"), - "audio_sources_excluded": payload.get("audio_sources_excluded"), - "video_layout": payload.get("video_layout"), - "resolution": payload.get("resolution"), - "trim": payload.get("trim"), - "format": payload.get("format"), - "bitrate": deserialize.integer(payload.get("bitrate")), - "size": payload.get("size"), - "duration": deserialize.integer(payload.get("duration")), - "media_external_location": payload.get("media_external_location"), - "status_callback": payload.get("status_callback"), - "status_callback_method": payload.get("status_callback_method"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.status: Optional["CompositionInstance.Status"] = payload.get("status") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_completed: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_completed") + ) + self.date_deleted: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_deleted") + ) + self.sid: Optional[str] = payload.get("sid") + self.room_sid: Optional[str] = payload.get("room_sid") + self.audio_sources: Optional[List[str]] = payload.get("audio_sources") + self.audio_sources_excluded: Optional[List[str]] = payload.get( + "audio_sources_excluded" + ) + self.video_layout: Optional[Dict[str, object]] = payload.get("video_layout") + self.resolution: Optional[str] = payload.get("resolution") + self.trim: Optional[bool] = payload.get("trim") + self.format: Optional["CompositionInstance.Format"] = payload.get("format") + self.bitrate: Optional[int] = deserialize.integer(payload.get("bitrate")) + self.size: Optional[int] = payload.get("size") + self.duration: Optional[int] = deserialize.integer(payload.get("duration")) + self.media_external_location: Optional[str] = payload.get( + "media_external_location" + ) + self.status_callback: Optional[str] = payload.get("status_callback") + self.status_callback_method: Optional[str] = payload.get( + "status_callback_method" + ) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[CompositionContext] = None @@ -87,153 +118,6 @@ def _proxy(self) -> "CompositionContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Composition resource. - """ - return self._properties["account_sid"] - - @property - def status(self) -> "CompositionInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_completed(self) -> datetime: - """ - :returns: The date and time in GMT when the composition's media processing task finished, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_completed"] - - @property - def date_deleted(self) -> datetime: - """ - :returns: The date and time in GMT when the composition generated media was deleted, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_deleted"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Composition resource. - """ - return self._properties["sid"] - - @property - def room_sid(self) -> str: - """ - :returns: The SID of the Group Room that generated the audio and video tracks used in the composition. All media sources included in a composition must belong to the same Group Room. - """ - return self._properties["room_sid"] - - @property - def audio_sources(self) -> List[str]: - """ - :returns: The array of track names to include in the composition. The composition includes all audio sources specified in `audio_sources` except those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` includes tracks named `student` as well as `studentTeam`. - """ - return self._properties["audio_sources"] - - @property - def audio_sources_excluded(self) -> List[str]: - """ - :returns: The array of track names to exclude from the composition. The composition includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty. - """ - return self._properties["audio_sources_excluded"] - - @property - def video_layout(self) -> Dict[str, object]: - """ - :returns: An object that describes the video layout of the composition in terms of regions. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. - """ - return self._properties["video_layout"] - - @property - def resolution(self) -> str: - """ - :returns: The dimensions of the video image in pixels expressed as columns (width) and rows (height). The string's format is `{width}x{height}`, such as `640x480`. - """ - return self._properties["resolution"] - - @property - def trim(self) -> bool: - """ - :returns: Whether to remove intervals with no media, as specified in the POST request that created the composition. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. - """ - return self._properties["trim"] - - @property - def format(self) -> "CompositionInstance.Format": - """ - :returns: - """ - return self._properties["format"] - - @property - def bitrate(self) -> int: - """ - :returns: The average bit rate of the composition's media. - """ - return self._properties["bitrate"] - - @property - def size(self) -> int: - """ - :returns: The size of the composed media file in bytes. - """ - return self._properties["size"] - - @property - def duration(self) -> int: - """ - :returns: The duration of the composition's media file in seconds. - """ - return self._properties["duration"] - - @property - def media_external_location(self) -> str: - """ - :returns: The URL of the media file associated with the composition when stored externally. See [External S3 Compositions](/docs/video/api/external-s3-compositions) for more details. - """ - return self._properties["media_external_location"] - - @property - def status_callback(self) -> str: - """ - :returns: The URL called using the `status_callback_method` to send status information on every composition event. - """ - return self._properties["status_callback"] - - @property - def status_callback_method(self) -> str: - """ - :returns: The HTTP method used to call `status_callback`. Can be: `POST` or `GET`, defaults to `POST`. - """ - return self._properties["status_callback_method"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URL of the media file associated with the composition. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the CompositionInstance diff --git a/twilio/rest/video/v1/composition_hook.py b/twilio/rest/video/v1/composition_hook.py index 62bd0c6c0..eb36c3426 100644 --- a/twilio/rest/video/v1/composition_hook.py +++ b/twilio/rest/video/v1/composition_hook.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -28,32 +28,55 @@ class Format(object): MP4 = "mp4" WEBM = "webm" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the CompositionHookInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CompositionHook resource. + :ivar friendly_name: The string that you assigned to describe the resource. Can be up to 100 characters long and must be unique within the account. + :ivar enabled: Whether the CompositionHook is active. When `true`, the CompositionHook is triggered for every completed Group Room on the account. When `false`, the CompositionHook is never triggered. + :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 sid: The unique string that we created to identify the CompositionHook resource. + :ivar audio_sources: The array of track names to include in the compositions created by the composition hook. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` includes tracks named `student` as well as `studentTeam`. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request + :ivar audio_sources_excluded: The array of track names to exclude from the compositions created by the composition hook. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty. + :ivar video_layout: A JSON object that describes the video layout of the composition in terms of regions as specified in the HTTP POST request that created the CompositionHook resource. See [POST Parameters](https://www.twilio.com/docs/video/api/compositions-resource#http-post-parameters) for more information. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request + :ivar resolution: The dimensions of the video image in pixels expressed as columns (width) and rows (height). The string's format is `{width}x{height}`, such as `640x480`. + :ivar trim: Whether intervals with no media are clipped, as specified in the POST request that created the CompositionHook resource. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. + :ivar format: + :ivar status_callback: The URL we call using the `status_callback_method` to send status information to your application. + :ivar status_callback_method: The HTTP method we should use to call `status_callback`. Can be `POST` or `GET` and defaults to `POST`. + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "enabled": payload.get("enabled"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "sid": payload.get("sid"), - "audio_sources": payload.get("audio_sources"), - "audio_sources_excluded": payload.get("audio_sources_excluded"), - "video_layout": payload.get("video_layout"), - "resolution": payload.get("resolution"), - "trim": payload.get("trim"), - "format": payload.get("format"), - "status_callback": payload.get("status_callback"), - "status_callback_method": payload.get("status_callback_method"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.enabled: Optional[bool] = payload.get("enabled") + 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.sid: Optional[str] = payload.get("sid") + self.audio_sources: Optional[List[str]] = payload.get("audio_sources") + self.audio_sources_excluded: Optional[List[str]] = payload.get( + "audio_sources_excluded" + ) + self.video_layout: Optional[Dict[str, object]] = payload.get("video_layout") + self.resolution: Optional[str] = payload.get("resolution") + self.trim: Optional[bool] = payload.get("trim") + self.format: Optional["CompositionHookInstance.Format"] = payload.get("format") + self.status_callback: Optional[str] = payload.get("status_callback") + self.status_callback_method: Optional[str] = payload.get( + "status_callback_method" + ) + self.url: Optional[str] = payload.get("url") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[CompositionHookContext] = None @@ -72,111 +95,6 @@ def _proxy(self) -> "CompositionHookContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CompositionHook resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. Can be up to 100 characters long and must be unique within the account. - """ - return self._properties["friendly_name"] - - @property - def enabled(self) -> bool: - """ - :returns: Whether the CompositionHook is active. When `true`, the CompositionHook is triggered for every completed Group Room on the account. When `false`, the CompositionHook is never triggered. - """ - return self._properties["enabled"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the CompositionHook resource. - """ - return self._properties["sid"] - - @property - def audio_sources(self) -> List[str]: - """ - :returns: The array of track names to include in the compositions created by the composition hook. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` includes tracks named `student` as well as `studentTeam`. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request - """ - return self._properties["audio_sources"] - - @property - def audio_sources_excluded(self) -> List[str]: - """ - :returns: The array of track names to exclude from the compositions created by the composition hook. A composition triggered by the composition hook includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty. - """ - return self._properties["audio_sources_excluded"] - - @property - def video_layout(self) -> Dict[str, object]: - """ - :returns: A JSON object that describes the video layout of the composition in terms of regions as specified in the HTTP POST request that created the CompositionHook resource. See [POST Parameters](https://www.twilio.com/docs/video/api/compositions-resource#http-post-parameters) for more information. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request - """ - return self._properties["video_layout"] - - @property - def resolution(self) -> str: - """ - :returns: The dimensions of the video image in pixels expressed as columns (width) and rows (height). The string's format is `{width}x{height}`, such as `640x480`. - """ - return self._properties["resolution"] - - @property - def trim(self) -> bool: - """ - :returns: Whether intervals with no media are clipped, as specified in the POST request that created the CompositionHook resource. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. - """ - return self._properties["trim"] - - @property - def format(self) -> "CompositionHookInstance.Format": - """ - :returns: - """ - return self._properties["format"] - - @property - def status_callback(self) -> str: - """ - :returns: The URL we call using the `status_callback_method` to send status information to your application. - """ - return self._properties["status_callback"] - - @property - def status_callback_method(self) -> str: - """ - :returns: The HTTP method we should use to call `status_callback`. Can be `POST` or `GET` and defaults to `POST`. - """ - return self._properties["status_callback_method"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the CompositionHookInstance diff --git a/twilio/rest/video/v1/composition_settings.py b/twilio/rest/video/v1/composition_settings.py index c598f296c..391ca1fa5 100644 --- a/twilio/rest/video/v1/composition_settings.py +++ b/twilio/rest/video/v1/composition_settings.py @@ -13,7 +13,7 @@ """ -from typing import Optional +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 @@ -22,22 +22,29 @@ class CompositionSettingsInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the CompositionSettingsInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CompositionSettings resource. + :ivar friendly_name: The string that you assigned to describe the resource and that will be shown in the console + :ivar aws_credentials_sid: The SID of the stored Credential resource. + :ivar aws_s3_url: The URL of the AWS S3 bucket where the compositions are stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/compositions`, where `compositions` is the path in which you want the compositions to be stored. This URL accepts only URI-valid characters, as described in the RFC 3986. + :ivar aws_storage_enabled: Whether all compositions are written to the `aws_s3_url`. When `false`, all compositions are stored in our cloud. + :ivar encryption_key_sid: The SID of the Public Key resource used for encryption. + :ivar encryption_enabled: Whether all compositions are stored in an encrypted form. The default is `false`. + :ivar url: The absolute URL of the resource. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "aws_credentials_sid": payload.get("aws_credentials_sid"), - "aws_s3_url": payload.get("aws_s3_url"), - "aws_storage_enabled": payload.get("aws_storage_enabled"), - "encryption_key_sid": payload.get("encryption_key_sid"), - "encryption_enabled": payload.get("encryption_enabled"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.aws_credentials_sid: Optional[str] = payload.get("aws_credentials_sid") + self.aws_s3_url: Optional[str] = payload.get("aws_s3_url") + self.aws_storage_enabled: Optional[bool] = payload.get("aws_storage_enabled") + self.encryption_key_sid: Optional[str] = payload.get("encryption_key_sid") + self.encryption_enabled: Optional[bool] = payload.get("encryption_enabled") + self.url: Optional[str] = payload.get("url") self._solution = {} self._context: Optional[CompositionSettingsContext] = None @@ -56,62 +63,6 @@ def _proxy(self) -> "CompositionSettingsContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the CompositionSettings resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource and that will be shown in the console - """ - return self._properties["friendly_name"] - - @property - def aws_credentials_sid(self) -> str: - """ - :returns: The SID of the stored Credential resource. - """ - return self._properties["aws_credentials_sid"] - - @property - def aws_s3_url(self) -> str: - """ - :returns: The URL of the AWS S3 bucket where the compositions are stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/compositions`, where `compositions` is the path in which you want the compositions to be stored. This URL accepts only URI-valid characters, as described in the RFC 3986. - """ - return self._properties["aws_s3_url"] - - @property - def aws_storage_enabled(self) -> bool: - """ - :returns: Whether all compositions are written to the `aws_s3_url`. When `false`, all compositions are stored in our cloud. - """ - return self._properties["aws_storage_enabled"] - - @property - def encryption_key_sid(self) -> str: - """ - :returns: The SID of the Public Key resource used for encryption. - """ - return self._properties["encryption_key_sid"] - - @property - def encryption_enabled(self) -> bool: - """ - :returns: Whether all compositions are stored in an encrypted form. The default is `false`. - """ - return self._properties["encryption_enabled"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def create( self, friendly_name, diff --git a/twilio/rest/video/v1/recording.py b/twilio/rest/video/v1/recording.py index 69f5c908b..0200ce41c 100644 --- a/twilio/rest/video/v1/recording.py +++ b/twilio/rest/video/v1/recording.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -45,35 +45,61 @@ class Type(object): VIDEO = "video" DATA = "data" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the RecordingInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource. + :ivar status: + :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 sid: The unique string that we created to identify the Recording resource. + :ivar source_sid: The SID of the recording source. For a Room Recording, this value is a `track_sid`. + :ivar size: The size of the recorded track, in bytes. + :ivar url: The absolute URL of the resource. + :ivar type: + :ivar duration: The duration of the recording in seconds rounded to the nearest second. Sub-second tracks have a `Duration` property of 1 second + :ivar container_format: + :ivar codec: + :ivar grouping_sids: A list of SIDs related to the recording. Includes the `room_sid` and `participant_sid`. + :ivar track_name: The name that was given to the source track of the recording. If no name is given, the `source_sid` is used. + :ivar offset: The time in milliseconds elapsed between an arbitrary point in time, common to all group rooms, and the moment when the source room of this track started. This information provides a synchronization mechanism for recordings belonging to the same room. + :ivar media_external_location: The URL of the media file associated with the recording when stored externally. See [External S3 Recordings](/docs/video/api/external-s3-recordings) for more details. + :ivar status_callback: The URL called using the `status_callback_method` to send status information on every recording event. + :ivar status_callback_method: The HTTP method used to call `status_callback`. Can be: `POST` or `GET`, defaults to `POST`. + :ivar links: The URLs of related resources. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "status": payload.get("status"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "sid": payload.get("sid"), - "source_sid": payload.get("source_sid"), - "size": payload.get("size"), - "url": payload.get("url"), - "type": payload.get("type"), - "duration": deserialize.integer(payload.get("duration")), - "container_format": payload.get("container_format"), - "codec": payload.get("codec"), - "grouping_sids": payload.get("grouping_sids"), - "track_name": payload.get("track_name"), - "offset": payload.get("offset"), - "media_external_location": payload.get("media_external_location"), - "status_callback": payload.get("status_callback"), - "status_callback_method": payload.get("status_callback_method"), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.status: Optional["RecordingInstance.Status"] = payload.get("status") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.sid: Optional[str] = payload.get("sid") + self.source_sid: Optional[str] = payload.get("source_sid") + self.size: Optional[int] = payload.get("size") + self.url: Optional[str] = payload.get("url") + self.type: Optional["RecordingInstance.Type"] = payload.get("type") + self.duration: Optional[int] = deserialize.integer(payload.get("duration")) + self.container_format: Optional["RecordingInstance.Format"] = payload.get( + "container_format" + ) + self.codec: Optional["RecordingInstance.Codec"] = payload.get("codec") + self.grouping_sids: Optional[Dict[str, object]] = payload.get("grouping_sids") + self.track_name: Optional[str] = payload.get("track_name") + self.offset: Optional[int] = payload.get("offset") + self.media_external_location: Optional[str] = payload.get( + "media_external_location" + ) + self.status_callback: Optional[str] = payload.get("status_callback") + self.status_callback_method: Optional[str] = payload.get( + "status_callback_method" + ) + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[RecordingContext] = None @@ -92,132 +118,6 @@ def _proxy(self) -> "RecordingContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Recording resource. - """ - return self._properties["account_sid"] - - @property - def status(self) -> "RecordingInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Recording resource. - """ - return self._properties["sid"] - - @property - def source_sid(self) -> str: - """ - :returns: The SID of the recording source. For a Room Recording, this value is a `track_sid`. - """ - return self._properties["source_sid"] - - @property - def size(self) -> int: - """ - :returns: The size of the recorded track, in bytes. - """ - return self._properties["size"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def type(self) -> "RecordingInstance.Type": - """ - :returns: - """ - return self._properties["type"] - - @property - def duration(self) -> int: - """ - :returns: The duration of the recording in seconds rounded to the nearest second. Sub-second tracks have a `Duration` property of 1 second - """ - return self._properties["duration"] - - @property - def container_format(self) -> "RecordingInstance.Format": - """ - :returns: - """ - return self._properties["container_format"] - - @property - def codec(self) -> "RecordingInstance.Codec": - """ - :returns: - """ - return self._properties["codec"] - - @property - def grouping_sids(self) -> Dict[str, object]: - """ - :returns: A list of SIDs related to the recording. Includes the `room_sid` and `participant_sid`. - """ - return self._properties["grouping_sids"] - - @property - def track_name(self) -> str: - """ - :returns: The name that was given to the source track of the recording. If no name is given, the `source_sid` is used. - """ - return self._properties["track_name"] - - @property - def offset(self) -> int: - """ - :returns: The time in milliseconds elapsed between an arbitrary point in time, common to all group rooms, and the moment when the source room of this track started. This information provides a synchronization mechanism for recordings belonging to the same room. - """ - return self._properties["offset"] - - @property - def media_external_location(self) -> str: - """ - :returns: The URL of the media file associated with the recording when stored externally. See [External S3 Recordings](/docs/video/api/external-s3-recordings) for more details. - """ - return self._properties["media_external_location"] - - @property - def status_callback(self) -> str: - """ - :returns: The URL called using the `status_callback_method` to send status information on every recording event. - """ - return self._properties["status_callback"] - - @property - def status_callback_method(self) -> str: - """ - :returns: The HTTP method used to call `status_callback`. Can be: `POST` or `GET`, defaults to `POST`. - """ - return self._properties["status_callback_method"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the RecordingInstance diff --git a/twilio/rest/video/v1/recording_settings.py b/twilio/rest/video/v1/recording_settings.py index 81b6a501e..aa9b66360 100644 --- a/twilio/rest/video/v1/recording_settings.py +++ b/twilio/rest/video/v1/recording_settings.py @@ -13,7 +13,7 @@ """ -from typing import Optional +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 @@ -22,22 +22,29 @@ class RecordingSettingsInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the RecordingSettingsInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RecordingSettings resource. + :ivar friendly_name: The string that you assigned to describe the resource and show the user in the console + :ivar aws_credentials_sid: The SID of the stored Credential resource. + :ivar aws_s3_url: The URL of the AWS S3 bucket where the recordings are stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/recordings`, where `recordings` is the path in which you want the recordings to be stored. This URL accepts only URI-valid characters, as described in the RFC 3986. + :ivar aws_storage_enabled: Whether all recordings are written to the `aws_s3_url`. When `false`, all recordings are stored in our cloud. + :ivar encryption_key_sid: The SID of the Public Key resource used for encryption. + :ivar encryption_enabled: Whether all recordings are stored in an encrypted form. The default is `false`. + :ivar url: The absolute URL of the resource. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "aws_credentials_sid": payload.get("aws_credentials_sid"), - "aws_s3_url": payload.get("aws_s3_url"), - "aws_storage_enabled": payload.get("aws_storage_enabled"), - "encryption_key_sid": payload.get("encryption_key_sid"), - "encryption_enabled": payload.get("encryption_enabled"), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.aws_credentials_sid: Optional[str] = payload.get("aws_credentials_sid") + self.aws_s3_url: Optional[str] = payload.get("aws_s3_url") + self.aws_storage_enabled: Optional[bool] = payload.get("aws_storage_enabled") + self.encryption_key_sid: Optional[str] = payload.get("encryption_key_sid") + self.encryption_enabled: Optional[bool] = payload.get("encryption_enabled") + self.url: Optional[str] = payload.get("url") self._solution = {} self._context: Optional[RecordingSettingsContext] = None @@ -56,62 +63,6 @@ def _proxy(self) -> "RecordingSettingsContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RecordingSettings resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource and show the user in the console - """ - return self._properties["friendly_name"] - - @property - def aws_credentials_sid(self) -> str: - """ - :returns: The SID of the stored Credential resource. - """ - return self._properties["aws_credentials_sid"] - - @property - def aws_s3_url(self) -> str: - """ - :returns: The URL of the AWS S3 bucket where the recordings are stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/recordings`, where `recordings` is the path in which you want the recordings to be stored. This URL accepts only URI-valid characters, as described in the RFC 3986. - """ - return self._properties["aws_s3_url"] - - @property - def aws_storage_enabled(self) -> bool: - """ - :returns: Whether all recordings are written to the `aws_s3_url`. When `false`, all recordings are stored in our cloud. - """ - return self._properties["aws_storage_enabled"] - - @property - def encryption_key_sid(self) -> str: - """ - :returns: The SID of the Public Key resource used for encryption. - """ - return self._properties["encryption_key_sid"] - - @property - def encryption_enabled(self) -> bool: - """ - :returns: Whether all recordings are stored in an encrypted form. The default is `false`. - """ - return self._properties["encryption_enabled"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def create( self, friendly_name, diff --git a/twilio/rest/video/v1/room/__init__.py b/twilio/rest/video/v1/room/__init__.py index 691042c77..c237ebf30 100644 --- a/twilio/rest/video/v1/room/__init__.py +++ b/twilio/rest/video/v1/room/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -42,51 +42,87 @@ class VideoCodec(object): VP8 = "VP8" H264 = "H264" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the RoomInstance - """ + """ + :ivar sid: The unique string that we created to identify the Room resource. + :ivar status: + :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 account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Room resource. + :ivar enable_turn: Deprecated, now always considered to be true. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used as a `room_sid` in place of the resource's `sid` in the URL to address the resource, assuming it does not contain any [reserved characters](https://tools.ietf.org/html/rfc3986#section-2.2) that would need to be URL encoded. This value is unique for `in-progress` rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is `in-progress`. + :ivar status_callback: The URL we call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. + :ivar status_callback_method: The HTTP method we use to call `status_callback`. Can be `POST` or `GET` and defaults to `POST`. + :ivar end_time: The UTC end time of the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. + :ivar duration: The duration of the room in seconds. + :ivar type: + :ivar max_participants: The maximum number of concurrent Participants allowed in the room. + :ivar max_participant_duration: The maximum number of seconds a Participant can be connected to the room. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours). + :ivar max_concurrent_published_tracks: The maximum number of published audio, video, and data tracks all participants combined are allowed to publish in the room at the same time. Check [Programmable Video Limits](https://www.twilio.com/docs/video/programmable-video-limits) for more details. If it is set to 0 it means unconstrained. + :ivar record_participants_on_connect: Whether to start recording when Participants connect. ***This feature is not available in `peer-to-peer` rooms.*** + :ivar video_codecs: An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms*** + :ivar media_region: The region for the media server in Group Rooms. Can be: one of the [available Media Regions](https://www.twilio.com/docs/video/ip-address-whitelisting#media-servers). ***This feature is not available in `peer-to-peer` rooms.*** + :ivar audio_only: When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only. + :ivar empty_room_timeout: Specifies how long (in minutes) a room will remain active after last participant leaves. Can be configured when creating a room via REST API. For Ad-Hoc rooms this value cannot be changed. + :ivar unused_room_timeout: Specifies how long (in minutes) a room will remain active if no one joins. Can be configured when creating a room via REST API. For Ad-Hoc rooms this value cannot be changed. + :ivar large_room: Indicates if this is a large room. + :ivar url: The absolute URL of the resource. + :ivar links: The URLs of related resources. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "status": payload.get("status"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "account_sid": payload.get("account_sid"), - "enable_turn": payload.get("enable_turn"), - "unique_name": payload.get("unique_name"), - "status_callback": payload.get("status_callback"), - "status_callback_method": payload.get("status_callback_method"), - "end_time": deserialize.iso8601_datetime(payload.get("end_time")), - "duration": deserialize.integer(payload.get("duration")), - "type": payload.get("type"), - "max_participants": deserialize.integer(payload.get("max_participants")), - "max_participant_duration": deserialize.integer( - payload.get("max_participant_duration") - ), - "max_concurrent_published_tracks": deserialize.integer( - payload.get("max_concurrent_published_tracks") - ), - "record_participants_on_connect": payload.get( - "record_participants_on_connect" - ), - "video_codecs": payload.get("video_codecs"), - "media_region": payload.get("media_region"), - "audio_only": payload.get("audio_only"), - "empty_room_timeout": deserialize.integer( - payload.get("empty_room_timeout") - ), - "unused_room_timeout": deserialize.integer( - payload.get("unused_room_timeout") - ), - "large_room": payload.get("large_room"), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.status: Optional["RoomInstance.RoomStatus"] = payload.get("status") + 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.account_sid: Optional[str] = payload.get("account_sid") + self.enable_turn: Optional[bool] = payload.get("enable_turn") + self.unique_name: Optional[str] = payload.get("unique_name") + self.status_callback: Optional[str] = payload.get("status_callback") + self.status_callback_method: Optional[str] = payload.get( + "status_callback_method" + ) + self.end_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("end_time") + ) + self.duration: Optional[int] = deserialize.integer(payload.get("duration")) + self.type: Optional["RoomInstance.RoomType"] = payload.get("type") + self.max_participants: Optional[int] = deserialize.integer( + payload.get("max_participants") + ) + self.max_participant_duration: Optional[int] = deserialize.integer( + payload.get("max_participant_duration") + ) + self.max_concurrent_published_tracks: Optional[int] = deserialize.integer( + payload.get("max_concurrent_published_tracks") + ) + self.record_participants_on_connect: Optional[bool] = payload.get( + "record_participants_on_connect" + ) + self.video_codecs: Optional[List["RoomInstance.VideoCodec"]] = payload.get( + "video_codecs" + ) + self.media_region: Optional[str] = payload.get("media_region") + self.audio_only: Optional[bool] = payload.get("audio_only") + self.empty_room_timeout: Optional[int] = deserialize.integer( + payload.get("empty_room_timeout") + ) + self.unused_room_timeout: Optional[int] = deserialize.integer( + payload.get("unused_room_timeout") + ) + self.large_room: Optional[bool] = payload.get("large_room") + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[RoomContext] = None @@ -105,174 +141,6 @@ def _proxy(self) -> "RoomContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Room resource. - """ - return self._properties["sid"] - - @property - def status(self) -> "RoomInstance.RoomStatus": - """ - :returns: - """ - return self._properties["status"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Room resource. - """ - return self._properties["account_sid"] - - @property - def enable_turn(self) -> bool: - """ - :returns: Deprecated, now always considered to be true. - """ - return self._properties["enable_turn"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used as a `room_sid` in place of the resource's `sid` in the URL to address the resource, assuming it does not contain any [reserved characters](https://tools.ietf.org/html/rfc3986#section-2.2) that would need to be URL encoded. This value is unique for `in-progress` rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is `in-progress`. - """ - return self._properties["unique_name"] - - @property - def status_callback(self) -> str: - """ - :returns: The URL we call using the `status_callback_method` to send status information to your application on every room event. See [Status Callbacks](https://www.twilio.com/docs/video/api/status-callbacks) for more info. - """ - return self._properties["status_callback"] - - @property - def status_callback_method(self) -> str: - """ - :returns: The HTTP method we use to call `status_callback`. Can be `POST` or `GET` and defaults to `POST`. - """ - return self._properties["status_callback_method"] - - @property - def end_time(self) -> datetime: - """ - :returns: The UTC end time of the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. - """ - return self._properties["end_time"] - - @property - def duration(self) -> int: - """ - :returns: The duration of the room in seconds. - """ - return self._properties["duration"] - - @property - def type(self) -> "RoomInstance.RoomType": - """ - :returns: - """ - return self._properties["type"] - - @property - def max_participants(self) -> int: - """ - :returns: The maximum number of concurrent Participants allowed in the room. - """ - return self._properties["max_participants"] - - @property - def max_participant_duration(self) -> int: - """ - :returns: The maximum number of seconds a Participant can be connected to the room. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours). - """ - return self._properties["max_participant_duration"] - - @property - def max_concurrent_published_tracks(self) -> int: - """ - :returns: The maximum number of published audio, video, and data tracks all participants combined are allowed to publish in the room at the same time. Check [Programmable Video Limits](https://www.twilio.com/docs/video/programmable-video-limits) for more details. If it is set to 0 it means unconstrained. - """ - return self._properties["max_concurrent_published_tracks"] - - @property - def record_participants_on_connect(self) -> bool: - """ - :returns: Whether to start recording when Participants connect. ***This feature is not available in `peer-to-peer` rooms.*** - """ - return self._properties["record_participants_on_connect"] - - @property - def video_codecs(self) -> List["RoomInstance.VideoCodec"]: - """ - :returns: An array of the video codecs that are supported when publishing a track in the room. Can be: `VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms*** - """ - return self._properties["video_codecs"] - - @property - def media_region(self) -> str: - """ - :returns: The region for the media server in Group Rooms. Can be: one of the [available Media Regions](https://www.twilio.com/docs/video/ip-address-whitelisting#media-servers). ***This feature is not available in `peer-to-peer` rooms.*** - """ - return self._properties["media_region"] - - @property - def audio_only(self) -> bool: - """ - :returns: When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only. - """ - return self._properties["audio_only"] - - @property - def empty_room_timeout(self) -> int: - """ - :returns: Specifies how long (in minutes) a room will remain active after last participant leaves. Can be configured when creating a room via REST API. For Ad-Hoc rooms this value cannot be changed. - """ - return self._properties["empty_room_timeout"] - - @property - def unused_room_timeout(self) -> int: - """ - :returns: Specifies how long (in minutes) a room will remain active if no one joins. Can be configured when creating a room via REST API. For Ad-Hoc rooms this value cannot be changed. - """ - return self._properties["unused_room_timeout"] - - @property - def large_room(self) -> bool: - """ - :returns: Indicates if this is a large room. - """ - return self._properties["large_room"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - def fetch(self) -> "RoomInstance": """ Fetch the RoomInstance diff --git a/twilio/rest/video/v1/room/participant/__init__.py b/twilio/rest/video/v1/room/participant/__init__.py index 3c2fa2bb6..395d8f066 100644 --- a/twilio/rest/video/v1/room/participant/__init__.py +++ b/twilio/rest/video/v1/room/participant/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -32,30 +32,54 @@ class Status(object): CONNECTED = "connected" DISCONNECTED = "disconnected" - def __init__(self, version, payload, room_sid: str, sid: Optional[str] = None): - """ - Initialize the ParticipantInstance - """ + """ + :ivar sid: The unique string that we created to identify the RoomParticipant resource. + :ivar room_sid: The SID of the participant's room. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RoomParticipant resource. + :ivar status: + :ivar identity: The application-defined string that uniquely identifies the resource's User within a Room. If a client joins with an existing Identity, the existing client is disconnected. See [access tokens](https://www.twilio.com/docs/video/tutorials/user-identity-access-tokens) and [limits](https://www.twilio.com/docs/video/programmable-video-limits) for more info. + :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 start_time: The time of participant connected to the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. + :ivar end_time: The time when the participant disconnected from the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. + :ivar duration: The duration in seconds that the participant was `connected`. Populated only after the participant is `disconnected`. + :ivar url: The absolute URL of the resource. + :ivar links: The URLs of related resources. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + room_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "room_sid": payload.get("room_sid"), - "account_sid": payload.get("account_sid"), - "status": payload.get("status"), - "identity": payload.get("identity"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "start_time": deserialize.iso8601_datetime(payload.get("start_time")), - "end_time": deserialize.iso8601_datetime(payload.get("end_time")), - "duration": deserialize.integer(payload.get("duration")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.sid: Optional[str] = payload.get("sid") + self.room_sid: Optional[str] = payload.get("room_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.status: Optional["ParticipantInstance.Status"] = payload.get("status") + self.identity: Optional[str] = payload.get("identity") + 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.start_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("start_time") + ) + self.end_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("end_time") + ) + self.duration: Optional[int] = deserialize.integer(payload.get("duration")) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "room_sid": room_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ParticipantContext] = None @@ -75,90 +99,6 @@ def _proxy(self) -> "ParticipantContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the RoomParticipant resource. - """ - return self._properties["sid"] - - @property - def room_sid(self) -> str: - """ - :returns: The SID of the participant's room. - """ - return self._properties["room_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RoomParticipant resource. - """ - return self._properties["account_sid"] - - @property - def status(self) -> "ParticipantInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def identity(self) -> str: - """ - :returns: The application-defined string that uniquely identifies the resource's User within a Room. If a client joins with an existing Identity, the existing client is disconnected. See [access tokens](https://www.twilio.com/docs/video/tutorials/user-identity-access-tokens) and [limits](https://www.twilio.com/docs/video/programmable-video-limits) for more info. - """ - return self._properties["identity"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def start_time(self) -> datetime: - """ - :returns: The time of participant connected to the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. - """ - return self._properties["start_time"] - - @property - def end_time(self) -> datetime: - """ - :returns: The time when the participant disconnected from the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. - """ - return self._properties["end_time"] - - @property - def duration(self) -> int: - """ - :returns: The duration in seconds that the participant was `connected`. Populated only after the participant is `disconnected`. - """ - return self._properties["duration"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - def fetch(self) -> "ParticipantInstance": """ Fetch the ParticipantInstance diff --git a/twilio/rest/video/v1/room/participant/anonymize.py b/twilio/rest/video/v1/room/participant/anonymize.py index b87eca791..415c5b1f2 100644 --- a/twilio/rest/video/v1/room/participant/anonymize.py +++ b/twilio/rest/video/v1/room/participant/anonymize.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Optional +from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,25 +27,44 @@ class Status(object): CONNECTED = "connected" DISCONNECTED = "disconnected" - def __init__(self, version, payload, room_sid: str, sid: str): - """ - Initialize the AnonymizeInstance - """ + """ + :ivar sid: The unique string that we created to identify the RoomParticipant resource. + :ivar room_sid: The SID of the participant's room. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RoomParticipant resource. + :ivar status: + :ivar identity: The SID of the participant. + :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 start_time: The time of participant connected to the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. + :ivar end_time: The time when the participant disconnected from the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. + :ivar duration: The duration in seconds that the participant was `connected`. Populated only after the participant is `disconnected`. + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], room_sid: str, sid: str + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "room_sid": payload.get("room_sid"), - "account_sid": payload.get("account_sid"), - "status": payload.get("status"), - "identity": payload.get("identity"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "start_time": deserialize.iso8601_datetime(payload.get("start_time")), - "end_time": deserialize.iso8601_datetime(payload.get("end_time")), - "duration": deserialize.integer(payload.get("duration")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.room_sid: Optional[str] = payload.get("room_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.status: Optional["AnonymizeInstance.Status"] = payload.get("status") + self.identity: Optional[str] = payload.get("identity") + 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.start_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("start_time") + ) + self.end_time: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("end_time") + ) + self.duration: Optional[int] = deserialize.integer(payload.get("duration")) + self.url: Optional[str] = payload.get("url") self._solution = { "room_sid": room_sid, @@ -69,83 +88,6 @@ def _proxy(self) -> "AnonymizeContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the RoomParticipant resource. - """ - return self._properties["sid"] - - @property - def room_sid(self) -> str: - """ - :returns: The SID of the participant's room. - """ - return self._properties["room_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RoomParticipant resource. - """ - return self._properties["account_sid"] - - @property - def status(self) -> "AnonymizeInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def identity(self) -> str: - """ - :returns: The SID of the participant. - """ - return self._properties["identity"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def start_time(self) -> datetime: - """ - :returns: The time of participant connected to the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. - """ - return self._properties["start_time"] - - @property - def end_time(self) -> datetime: - """ - :returns: The time when the participant disconnected from the room in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format. - """ - return self._properties["end_time"] - - @property - def duration(self) -> int: - """ - :returns: The duration in seconds that the participant was `connected`. Populated only after the participant is `disconnected`. - """ - return self._properties["duration"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def update(self) -> "AnonymizeInstance": """ Update the AnonymizeInstance diff --git a/twilio/rest/video/v1/room/participant/published_track.py b/twilio/rest/video/v1/room/participant/published_track.py index 919ee043f..0146f3986 100644 --- a/twilio/rest/video/v1/room/participant/published_track.py +++ b/twilio/rest/video/v1/room/participant/published_track.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -29,35 +29,46 @@ class Kind(object): VIDEO = "video" DATA = "data" + """ + :ivar sid: The unique string that we created to identify the RoomParticipantPublishedTrack resource. + :ivar participant_sid: The SID of the Participant resource with the published track. + :ivar room_sid: The SID of the Room resource where the track is published. + :ivar name: The track name. Must be no more than 128 characters, and be unique among the participant's published tracks. + :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 enabled: Whether the track is enabled. + :ivar kind: + :ivar url: The absolute URL of the resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], room_sid: str, participant_sid: str, sid: Optional[str] = None, ): - """ - Initialize the PublishedTrackInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "participant_sid": payload.get("participant_sid"), - "room_sid": payload.get("room_sid"), - "name": payload.get("name"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "enabled": payload.get("enabled"), - "kind": payload.get("kind"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.participant_sid: Optional[str] = payload.get("participant_sid") + self.room_sid: Optional[str] = payload.get("room_sid") + self.name: Optional[str] = payload.get("name") + 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.enabled: Optional[bool] = payload.get("enabled") + self.kind: Optional["PublishedTrackInstance.Kind"] = payload.get("kind") + self.url: Optional[str] = payload.get("url") self._solution = { "room_sid": room_sid, "participant_sid": participant_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[PublishedTrackContext] = None @@ -78,69 +89,6 @@ def _proxy(self) -> "PublishedTrackContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the RoomParticipantPublishedTrack resource. - """ - return self._properties["sid"] - - @property - def participant_sid(self) -> str: - """ - :returns: The SID of the Participant resource with the published track. - """ - return self._properties["participant_sid"] - - @property - def room_sid(self) -> str: - """ - :returns: The SID of the Room resource where the track is published. - """ - return self._properties["room_sid"] - - @property - def name(self) -> str: - """ - :returns: The track name. Must be no more than 128 characters, and be unique among the participant's published tracks. - """ - return self._properties["name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def enabled(self) -> bool: - """ - :returns: Whether the track is enabled. - """ - return self._properties["enabled"] - - @property - def kind(self) -> "PublishedTrackInstance.Kind": - """ - :returns: - """ - return self._properties["kind"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def fetch(self) -> "PublishedTrackInstance": """ Fetch the PublishedTrackInstance diff --git a/twilio/rest/video/v1/room/participant/subscribe_rules.py b/twilio/rest/video/v1/room/participant/subscribe_rules.py index 77d0a0f0b..108909d98 100644 --- a/twilio/rest/video/v1/room/participant/subscribe_rules.py +++ b/twilio/rest/video/v1/room/participant/subscribe_rules.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource @@ -23,60 +23,39 @@ class SubscribeRulesInstance(InstanceResource): - def __init__(self, version, payload, room_sid: str, participant_sid: str): - """ - Initialize the SubscribeRulesInstance - """ + + """ + :ivar participant_sid: The SID of the Participant resource for the Subscribe Rules. + :ivar room_sid: The SID of the Room resource for the Subscribe Rules + :ivar rules: A collection of Subscribe Rules that describe how to include or exclude matching tracks. See the [Specifying Subscribe Rules](https://www.twilio.com/docs/video/api/track-subscriptions#specifying-sr) section for further information. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + room_sid: str, + participant_sid: str, + ): super().__init__(version) - self._properties = { - "participant_sid": payload.get("participant_sid"), - "room_sid": payload.get("room_sid"), - "rules": payload.get("rules"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - } + self.participant_sid: Optional[str] = payload.get("participant_sid") + self.room_sid: Optional[str] = payload.get("room_sid") + self.rules: Optional[List[str]] = payload.get("rules") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) self._solution = { "room_sid": room_sid, "participant_sid": participant_sid, } - @property - def participant_sid(self) -> str: - """ - :returns: The SID of the Participant resource for the Subscribe Rules. - """ - return self._properties["participant_sid"] - - @property - def room_sid(self) -> str: - """ - :returns: The SID of the Room resource for the Subscribe Rules - """ - return self._properties["room_sid"] - - @property - def rules(self) -> List[str]: - """ - :returns: A collection of Subscribe Rules that describe how to include or exclude matching tracks. See the [Specifying Subscribe Rules](https://www.twilio.com/docs/video/api/track-subscriptions#specifying-sr) section for further information. - """ - return self._properties["rules"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/video/v1/room/participant/subscribed_track.py b/twilio/rest/video/v1/room/participant/subscribed_track.py index 49afa8645..950ab6dd0 100644 --- a/twilio/rest/video/v1/room/participant/subscribed_track.py +++ b/twilio/rest/video/v1/room/participant/subscribed_track.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -29,36 +29,48 @@ class Kind(object): VIDEO = "video" DATA = "data" + """ + :ivar sid: The unique string that we created to identify the RoomParticipantSubscribedTrack resource. + :ivar participant_sid: The SID of the participant that subscribes to the track. + :ivar publisher_sid: The SID of the participant that publishes the track. + :ivar room_sid: The SID of the room where the track is published. + :ivar name: The track name. Must have no more than 128 characters and be unique among the participant's published tracks. + :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 enabled: Whether the track is enabled. + :ivar kind: + :ivar url: The absolute URL of the resource. + """ + def __init__( self, - version, - payload, + version: Version, + payload: Dict[str, Any], room_sid: str, participant_sid: str, sid: Optional[str] = None, ): - """ - Initialize the SubscribedTrackInstance - """ super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "participant_sid": payload.get("participant_sid"), - "publisher_sid": payload.get("publisher_sid"), - "room_sid": payload.get("room_sid"), - "name": payload.get("name"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "enabled": payload.get("enabled"), - "kind": payload.get("kind"), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.participant_sid: Optional[str] = payload.get("participant_sid") + self.publisher_sid: Optional[str] = payload.get("publisher_sid") + self.room_sid: Optional[str] = payload.get("room_sid") + self.name: Optional[str] = payload.get("name") + 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.enabled: Optional[bool] = payload.get("enabled") + self.kind: Optional["SubscribedTrackInstance.Kind"] = payload.get("kind") + self.url: Optional[str] = payload.get("url") self._solution = { "room_sid": room_sid, "participant_sid": participant_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[SubscribedTrackContext] = None @@ -79,76 +91,6 @@ def _proxy(self) -> "SubscribedTrackContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the RoomParticipantSubscribedTrack resource. - """ - return self._properties["sid"] - - @property - def participant_sid(self) -> str: - """ - :returns: The SID of the participant that subscribes to the track. - """ - return self._properties["participant_sid"] - - @property - def publisher_sid(self) -> str: - """ - :returns: The SID of the participant that publishes the track. - """ - return self._properties["publisher_sid"] - - @property - def room_sid(self) -> str: - """ - :returns: The SID of the room where the track is published. - """ - return self._properties["room_sid"] - - @property - def name(self) -> str: - """ - :returns: The track name. Must have no more than 128 characters and be unique among the participant's published tracks. - """ - return self._properties["name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - - @property - def enabled(self) -> bool: - """ - :returns: Whether the track is enabled. - """ - return self._properties["enabled"] - - @property - def kind(self) -> "SubscribedTrackInstance.Kind": - """ - :returns: - """ - return self._properties["kind"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def fetch(self) -> "SubscribedTrackInstance": """ Fetch the SubscribedTrackInstance diff --git a/twilio/rest/video/v1/room/recording_rules.py b/twilio/rest/video/v1/room/recording_rules.py index 86757280f..36ff60dc6 100644 --- a/twilio/rest/video/v1/room/recording_rules.py +++ b/twilio/rest/video/v1/room/recording_rules.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_resource import InstanceResource @@ -23,51 +23,30 @@ class RecordingRulesInstance(InstanceResource): - def __init__(self, version, payload, room_sid: str): - """ - Initialize the RecordingRulesInstance - """ + + """ + :ivar room_sid: The SID of the Room resource for the Recording Rules + :ivar rules: A collection of Recording Rules that describe how to include or exclude matching tracks for recording + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], room_sid: str): super().__init__(version) - self._properties = { - "room_sid": payload.get("room_sid"), - "rules": payload.get("rules"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - } + self.room_sid: Optional[str] = payload.get("room_sid") + self.rules: Optional[List[str]] = payload.get("rules") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) self._solution = { "room_sid": room_sid, } - @property - def room_sid(self) -> str: - """ - :returns: The SID of the Room resource for the Recording Rules - """ - return self._properties["room_sid"] - - @property - def rules(self) -> List[str]: - """ - :returns: A collection of Recording Rules that describe how to include or exclude matching tracks for recording - """ - return self._properties["rules"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_updated"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/video/v1/room/room_recording.py b/twilio/rest/video/v1/room/room_recording.py index 407741125..6461ed9cc 100644 --- a/twilio/rest/video/v1/room/room_recording.py +++ b/twilio/rest/video/v1/room/room_recording.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -45,35 +45,62 @@ class Type(object): VIDEO = "video" DATA = "data" - def __init__(self, version, payload, room_sid: str, sid: Optional[str] = None): - """ - Initialize the RoomRecordingInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RoomRecording resource. + :ivar status: + :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 sid: The unique string that we created to identify the RoomRecording resource. + :ivar source_sid: The SID of the recording source. For a Room Recording, this value is a `track_sid`. + :ivar size: The size of the recorded track in bytes. + :ivar url: The absolute URL of the resource. + :ivar type: + :ivar duration: The duration of the recording rounded to the nearest second. Sub-second duration tracks have a `duration` of 1 second + :ivar container_format: + :ivar codec: + :ivar grouping_sids: A list of SIDs related to the Recording. Includes the `room_sid` and `participant_sid`. + :ivar track_name: The name that was given to the source track of the recording. If no name is given, the `source_sid` is used. + :ivar offset: The time in milliseconds elapsed between an arbitrary point in time, common to all group rooms, and the moment when the source room of this track started. This information provides a synchronization mechanism for recordings belonging to the same room. + :ivar media_external_location: The URL of the media file associated with the recording when stored externally. See [External S3 Recordings](/docs/video/api/external-s3-recordings) for more details. + :ivar room_sid: The SID of the Room resource the recording is associated with. + :ivar links: The URLs of related resources. + """ + + def __init__( + self, + version: Version, + payload: Dict[str, Any], + room_sid: str, + sid: Optional[str] = None, + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "status": payload.get("status"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "sid": payload.get("sid"), - "source_sid": payload.get("source_sid"), - "size": payload.get("size"), - "url": payload.get("url"), - "type": payload.get("type"), - "duration": deserialize.integer(payload.get("duration")), - "container_format": payload.get("container_format"), - "codec": payload.get("codec"), - "grouping_sids": payload.get("grouping_sids"), - "track_name": payload.get("track_name"), - "offset": payload.get("offset"), - "media_external_location": payload.get("media_external_location"), - "room_sid": payload.get("room_sid"), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.status: Optional["RoomRecordingInstance.Status"] = payload.get("status") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.sid: Optional[str] = payload.get("sid") + self.source_sid: Optional[str] = payload.get("source_sid") + self.size: Optional[int] = payload.get("size") + self.url: Optional[str] = payload.get("url") + self.type: Optional["RoomRecordingInstance.Type"] = payload.get("type") + self.duration: Optional[int] = deserialize.integer(payload.get("duration")) + self.container_format: Optional["RoomRecordingInstance.Format"] = payload.get( + "container_format" + ) + self.codec: Optional["RoomRecordingInstance.Codec"] = payload.get("codec") + self.grouping_sids: Optional[Dict[str, object]] = payload.get("grouping_sids") + self.track_name: Optional[str] = payload.get("track_name") + self.offset: Optional[int] = payload.get("offset") + self.media_external_location: Optional[str] = payload.get( + "media_external_location" + ) + self.room_sid: Optional[str] = payload.get("room_sid") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { "room_sid": room_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[RoomRecordingContext] = None @@ -93,125 +120,6 @@ def _proxy(self) -> "RoomRecordingContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RoomRecording resource. - """ - return self._properties["account_sid"] - - @property - def status(self) -> "RoomRecordingInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - return self._properties["date_created"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the RoomRecording resource. - """ - return self._properties["sid"] - - @property - def source_sid(self) -> str: - """ - :returns: The SID of the recording source. For a Room Recording, this value is a `track_sid`. - """ - return self._properties["source_sid"] - - @property - def size(self) -> int: - """ - :returns: The size of the recorded track in bytes. - """ - return self._properties["size"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def type(self) -> "RoomRecordingInstance.Type": - """ - :returns: - """ - return self._properties["type"] - - @property - def duration(self) -> int: - """ - :returns: The duration of the recording rounded to the nearest second. Sub-second duration tracks have a `duration` of 1 second - """ - return self._properties["duration"] - - @property - def container_format(self) -> "RoomRecordingInstance.Format": - """ - :returns: - """ - return self._properties["container_format"] - - @property - def codec(self) -> "RoomRecordingInstance.Codec": - """ - :returns: - """ - return self._properties["codec"] - - @property - def grouping_sids(self) -> Dict[str, object]: - """ - :returns: A list of SIDs related to the Recording. Includes the `room_sid` and `participant_sid`. - """ - return self._properties["grouping_sids"] - - @property - def track_name(self) -> str: - """ - :returns: The name that was given to the source track of the recording. If no name is given, the `source_sid` is used. - """ - return self._properties["track_name"] - - @property - def offset(self) -> int: - """ - :returns: The time in milliseconds elapsed between an arbitrary point in time, common to all group rooms, and the moment when the source room of this track started. This information provides a synchronization mechanism for recordings belonging to the same room. - """ - return self._properties["offset"] - - @property - def media_external_location(self) -> str: - """ - :returns: The URL of the media file associated with the recording when stored externally. See [External S3 Recordings](/docs/video/api/external-s3-recordings) for more details. - """ - return self._properties["media_external_location"] - - @property - def room_sid(self) -> str: - """ - :returns: The SID of the Room resource the recording is associated with. - """ - return self._properties["room_sid"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the RoomRecordingInstance diff --git a/twilio/rest/voice/v1/byoc_trunk.py b/twilio/rest/voice/v1/byoc_trunk.py index d956e1b38..b965554d2 100644 --- a/twilio/rest/voice/v1/byoc_trunk.py +++ b/twilio/rest/voice/v1/byoc_trunk.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,32 +24,54 @@ class ByocTrunkInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the ByocTrunkInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the BYOC Trunk resource. + :ivar sid: The unique string that that we created to identify the BYOC Trunk resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar voice_url: The URL we call using the `voice_method` when the BYOC Trunk receives a call. + :ivar voice_method: The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. + :ivar voice_fallback_url: The URL that we call when an error occurs while retrieving or executing the TwiML requested from `voice_url`. + :ivar voice_fallback_method: The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. + :ivar status_callback_url: The URL that we call to pass status parameters (such as call ended) to your application. + :ivar status_callback_method: The HTTP method we use to call `status_callback_url`. Either `GET` or `POST`. + :ivar cnam_lookup_enabled: Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. + :ivar connection_policy_sid: The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure. + :ivar from_domain_sid: The SID of the SIP Domain that should be used in the `From` header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to \"call back\" an incoming call, configure this with a [SIP Domain](https://www.twilio.com/docs/voice/api/sending-sip) to ensure proper routing. If not configured, the from domain will default to \"sip.twilio.com\". + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "sid": payload.get("sid"), - "friendly_name": payload.get("friendly_name"), - "voice_url": payload.get("voice_url"), - "voice_method": payload.get("voice_method"), - "voice_fallback_url": payload.get("voice_fallback_url"), - "voice_fallback_method": payload.get("voice_fallback_method"), - "status_callback_url": payload.get("status_callback_url"), - "status_callback_method": payload.get("status_callback_method"), - "cnam_lookup_enabled": payload.get("cnam_lookup_enabled"), - "connection_policy_sid": payload.get("connection_policy_sid"), - "from_domain_sid": payload.get("from_domain_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.voice_url: Optional[str] = payload.get("voice_url") + self.voice_method: Optional[str] = payload.get("voice_method") + self.voice_fallback_url: Optional[str] = payload.get("voice_fallback_url") + self.voice_fallback_method: Optional[str] = payload.get("voice_fallback_method") + self.status_callback_url: Optional[str] = payload.get("status_callback_url") + self.status_callback_method: Optional[str] = payload.get( + "status_callback_method" + ) + self.cnam_lookup_enabled: Optional[bool] = payload.get("cnam_lookup_enabled") + self.connection_policy_sid: Optional[str] = payload.get("connection_policy_sid") + self.from_domain_sid: Optional[str] = payload.get("from_domain_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ByocTrunkContext] = None @@ -68,111 +90,6 @@ def _proxy(self) -> "ByocTrunkContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the BYOC Trunk resource. - """ - return self._properties["account_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that that we created to identify the BYOC Trunk resource. - """ - return self._properties["sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def voice_url(self) -> str: - """ - :returns: The URL we call using the `voice_method` when the BYOC Trunk receives a call. - """ - return self._properties["voice_url"] - - @property - def voice_method(self) -> str: - """ - :returns: The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. - """ - return self._properties["voice_method"] - - @property - def voice_fallback_url(self) -> str: - """ - :returns: The URL that we call when an error occurs while retrieving or executing the TwiML requested from `voice_url`. - """ - return self._properties["voice_fallback_url"] - - @property - def voice_fallback_method(self) -> str: - """ - :returns: The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. - """ - return self._properties["voice_fallback_method"] - - @property - def status_callback_url(self) -> str: - """ - :returns: The URL that we call to pass status parameters (such as call ended) to your application. - """ - return self._properties["status_callback_url"] - - @property - def status_callback_method(self) -> str: - """ - :returns: The HTTP method we use to call `status_callback_url`. Either `GET` or `POST`. - """ - return self._properties["status_callback_method"] - - @property - def cnam_lookup_enabled(self) -> bool: - """ - :returns: Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information. - """ - return self._properties["cnam_lookup_enabled"] - - @property - def connection_policy_sid(self) -> str: - """ - :returns: The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure. - """ - return self._properties["connection_policy_sid"] - - @property - def from_domain_sid(self) -> str: - """ - :returns: The SID of the SIP Domain that should be used in the `From` header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to \"call back\" an incoming call, configure this with a [SIP Domain](https://www.twilio.com/docs/voice/api/sending-sip) to ensure proper routing. If not configured, the from domain will default to \"sip.twilio.com\". - """ - return self._properties["from_domain_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the ByocTrunkInstance diff --git a/twilio/rest/voice/v1/connection_policy/__init__.py b/twilio/rest/voice/v1/connection_policy/__init__.py index 861b7a963..ab7c9e8d7 100644 --- a/twilio/rest/voice/v1/connection_policy/__init__.py +++ b/twilio/rest/voice/v1/connection_policy/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -27,24 +27,36 @@ class ConnectionPolicyInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the ConnectionPolicyInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Connection Policy resource. + :ivar sid: The unique string that we created to identify the Connection Policy resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar url: The absolute URL of the resource. + :ivar links: The URLs of related resources. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "sid": payload.get("sid"), - "friendly_name": payload.get("friendly_name"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ConnectionPolicyContext] = None @@ -63,55 +75,6 @@ def _proxy(self) -> "ConnectionPolicyContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Connection Policy resource. - """ - return self._properties["account_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Connection Policy resource. - """ - return self._properties["sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related resources. - """ - return self._properties["links"] - def delete(self) -> bool: """ Deletes the ConnectionPolicyInstance diff --git a/twilio/rest/voice/v1/connection_policy/connection_policy_target.py b/twilio/rest/voice/v1/connection_policy/connection_policy_target.py index 53204930c..f6d760d3b 100644 --- a/twilio/rest/voice/v1/connection_policy/connection_policy_target.py +++ b/twilio/rest/voice/v1/connection_policy/connection_policy_target.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,31 +24,49 @@ class ConnectionPolicyTargetInstance(InstanceResource): + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Target resource. + :ivar connection_policy_sid: The SID of the Connection Policy that owns the Target. + :ivar sid: The unique string that we created to identify the Target resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar target: The SIP address you want Twilio to route your calls to. This must be a `sip:` schema. `sips` is NOT supported. + :ivar priority: The relative importance of the target. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important target. + :ivar weight: The value that determines the relative share of the load the Target should receive compared to other Targets with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. Targets with higher values receive more load than those with lower ones with the same priority. + :ivar enabled: Whether the target is enabled. The default is `true`. + :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar url: The absolute URL of the resource. + """ + def __init__( - self, version, payload, connection_policy_sid: str, sid: Optional[str] = None + self, + version: Version, + payload: Dict[str, Any], + connection_policy_sid: str, + sid: Optional[str] = None, ): - """ - Initialize the ConnectionPolicyTargetInstance - """ super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "connection_policy_sid": payload.get("connection_policy_sid"), - "sid": payload.get("sid"), - "friendly_name": payload.get("friendly_name"), - "target": payload.get("target"), - "priority": deserialize.integer(payload.get("priority")), - "weight": deserialize.integer(payload.get("weight")), - "enabled": payload.get("enabled"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.connection_policy_sid: Optional[str] = payload.get("connection_policy_sid") + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.target: Optional[str] = payload.get("target") + self.priority: Optional[int] = deserialize.integer(payload.get("priority")) + self.weight: Optional[int] = deserialize.integer(payload.get("weight")) + self.enabled: Optional[bool] = payload.get("enabled") + 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 = { "connection_policy_sid": connection_policy_sid, - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[ConnectionPolicyTargetContext] = None @@ -68,83 +86,6 @@ def _proxy(self) -> "ConnectionPolicyTargetContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Target resource. - """ - return self._properties["account_sid"] - - @property - def connection_policy_sid(self) -> str: - """ - :returns: The SID of the Connection Policy that owns the Target. - """ - return self._properties["connection_policy_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Target resource. - """ - return self._properties["sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def target(self) -> str: - """ - :returns: The SIP address you want Twilio to route your calls to. This must be a `sip:` schema. `sips` is NOT supported. - """ - return self._properties["target"] - - @property - def priority(self) -> int: - """ - :returns: The relative importance of the target. Can be an integer from 0 to 65535, inclusive, and the default is 10. The lowest number represents the most important target. - """ - return self._properties["priority"] - - @property - def weight(self) -> int: - """ - :returns: The value that determines the relative share of the load the Target should receive compared to other Targets with the same priority. Can be an integer from 1 to 65535, inclusive, and the default is 10. Targets with higher values receive more load than those with lower ones with the same priority. - """ - return self._properties["weight"] - - @property - def enabled(self) -> bool: - """ - :returns: Whether the target is enabled. The default is `true`. - """ - return self._properties["enabled"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the ConnectionPolicyTargetInstance diff --git a/twilio/rest/voice/v1/dialing_permissions/bulk_country_update.py b/twilio/rest/voice/v1/dialing_permissions/bulk_country_update.py index ef4b91f03..cf99d13fd 100644 --- a/twilio/rest/voice/v1/dialing_permissions/bulk_country_update.py +++ b/twilio/rest/voice/v1/dialing_permissions/bulk_country_update.py @@ -13,6 +13,7 @@ """ +from typing import Any, Dict, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -21,32 +22,21 @@ class BulkCountryUpdateInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the BulkCountryUpdateInstance - """ - super().__init__(version) - self._properties = { - "update_count": deserialize.integer(payload.get("update_count")), - "update_request": payload.get("update_request"), - } + """ + :ivar update_count: The number of countries updated + :ivar update_request: A bulk update request to change voice dialing country permissions stored as a URL-encoded, JSON array of update objects. For example : `[ { \"iso_code\": \"GB\", \"low_risk_numbers_enabled\": \"true\", \"high_risk_special_numbers_enabled\":\"true\", \"high_risk_tollfraud_numbers_enabled\": \"false\" } ]` + """ - self._solution = {} + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) - @property - def update_count(self) -> int: - """ - :returns: The number of countries updated - """ - return self._properties["update_count"] + self.update_count: Optional[int] = deserialize.integer( + payload.get("update_count") + ) + self.update_request: Optional[str] = payload.get("update_request") - @property - def update_request(self) -> str: - """ - :returns: A bulk update request to change voice dialing country permissions stored as a URL-encoded, JSON array of update objects. For example : `[ { \"iso_code\": \"GB\", \"low_risk_numbers_enabled\": \"true\", \"high_risk_special_numbers_enabled\":\"true\", \"high_risk_tollfraud_numbers_enabled\": \"false\" } ]` - """ - return self._properties["update_request"] + self._solution = {} def __repr__(self) -> str: """ diff --git a/twilio/rest/voice/v1/dialing_permissions/country/__init__.py b/twilio/rest/voice/v1/dialing_permissions/country/__init__.py index d89517b22..36b0bdcab 100644 --- a/twilio/rest/voice/v1/dialing_permissions/country/__init__.py +++ b/twilio/rest/voice/v1/dialing_permissions/country/__init__.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -26,30 +26,42 @@ class CountryInstance(InstanceResource): - def __init__(self, version, payload, iso_code: Optional[str] = None): - """ - Initialize the CountryInstance - """ + + """ + :ivar iso_code: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + :ivar name: The name of the country. + :ivar continent: The name of the continent in which the country is located. + :ivar country_codes: The E.164 assigned [country codes(s)](https://www.itu.int/itudoc/itu-t/ob-lists/icc/e164_763.html) + :ivar low_risk_numbers_enabled: Whether dialing to low-risk numbers is enabled. + :ivar high_risk_special_numbers_enabled: Whether dialing to high-risk special services numbers is enabled. These prefixes include number ranges allocated by the country and include premium numbers, special services, shared cost, and others + :ivar high_risk_tollfraud_numbers_enabled: Whether dialing to high-risk [toll fraud](https://www.twilio.com/learn/voice-and-video/toll-fraud) numbers is enabled. These prefixes include narrow number ranges that have a high-risk of international revenue sharing fraud (IRSF) attacks, also known as [toll fraud](https://www.twilio.com/learn/voice-and-video/toll-fraud). These prefixes are collected from anti-fraud databases and verified by analyzing calls on our network. These prefixes are not available for download and are updated frequently + :ivar url: The absolute URL of this resource. + :ivar links: A list of URLs related to this resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], iso_code: Optional[str] = None + ): super().__init__(version) - self._properties = { - "iso_code": payload.get("iso_code"), - "name": payload.get("name"), - "continent": payload.get("continent"), - "country_codes": payload.get("country_codes"), - "low_risk_numbers_enabled": payload.get("low_risk_numbers_enabled"), - "high_risk_special_numbers_enabled": payload.get( - "high_risk_special_numbers_enabled" - ), - "high_risk_tollfraud_numbers_enabled": payload.get( - "high_risk_tollfraud_numbers_enabled" - ), - "url": payload.get("url"), - "links": payload.get("links"), - } + self.iso_code: Optional[str] = payload.get("iso_code") + self.name: Optional[str] = payload.get("name") + self.continent: Optional[str] = payload.get("continent") + self.country_codes: Optional[List[str]] = payload.get("country_codes") + self.low_risk_numbers_enabled: Optional[bool] = payload.get( + "low_risk_numbers_enabled" + ) + self.high_risk_special_numbers_enabled: Optional[bool] = payload.get( + "high_risk_special_numbers_enabled" + ) + self.high_risk_tollfraud_numbers_enabled: Optional[bool] = payload.get( + "high_risk_tollfraud_numbers_enabled" + ) + self.url: Optional[str] = payload.get("url") + self.links: Optional[Dict[str, object]] = payload.get("links") self._solution = { - "iso_code": iso_code or self._properties["iso_code"], + "iso_code": iso_code or self.iso_code, } self._context: Optional[CountryContext] = None @@ -68,69 +80,6 @@ def _proxy(self) -> "CountryContext": ) return self._context - @property - def iso_code(self) -> str: - """ - :returns: The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). - """ - return self._properties["iso_code"] - - @property - def name(self) -> str: - """ - :returns: The name of the country. - """ - return self._properties["name"] - - @property - def continent(self) -> str: - """ - :returns: The name of the continent in which the country is located. - """ - return self._properties["continent"] - - @property - def country_codes(self) -> List[str]: - """ - :returns: The E.164 assigned [country codes(s)](https://www.itu.int/itudoc/itu-t/ob-lists/icc/e164_763.html) - """ - return self._properties["country_codes"] - - @property - def low_risk_numbers_enabled(self) -> bool: - """ - :returns: Whether dialing to low-risk numbers is enabled. - """ - return self._properties["low_risk_numbers_enabled"] - - @property - def high_risk_special_numbers_enabled(self) -> bool: - """ - :returns: Whether dialing to high-risk special services numbers is enabled. These prefixes include number ranges allocated by the country and include premium numbers, special services, shared cost, and others - """ - return self._properties["high_risk_special_numbers_enabled"] - - @property - def high_risk_tollfraud_numbers_enabled(self) -> bool: - """ - :returns: Whether dialing to high-risk [toll fraud](https://www.twilio.com/learn/voice-and-video/toll-fraud) numbers is enabled. These prefixes include narrow number ranges that have a high-risk of international revenue sharing fraud (IRSF) attacks, also known as [toll fraud](https://www.twilio.com/learn/voice-and-video/toll-fraud). These prefixes are collected from anti-fraud databases and verified by analyzing calls on our network. These prefixes are not available for download and are updated frequently - """ - return self._properties["high_risk_tollfraud_numbers_enabled"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of this resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: A list of URLs related to this resource. - """ - return self._properties["links"] - def fetch(self) -> "CountryInstance": """ Fetch the CountryInstance diff --git a/twilio/rest/voice/v1/dialing_permissions/country/highrisk_special_prefix.py b/twilio/rest/voice/v1/dialing_permissions/country/highrisk_special_prefix.py index 1f07c7a00..2003b0f4b 100644 --- a/twilio/rest/voice/v1/dialing_permissions/country/highrisk_special_prefix.py +++ b/twilio/rest/voice/v1/dialing_permissions/country/highrisk_special_prefix.py @@ -13,7 +13,7 @@ """ -from typing import List +from typing import Any, Dict, List, Optional from twilio.base import values from twilio.base.instance_resource import InstanceResource @@ -23,27 +23,20 @@ class HighriskSpecialPrefixInstance(InstanceResource): - def __init__(self, version, payload, iso_code: str): - """ - Initialize the HighriskSpecialPrefixInstance - """ + + """ + :ivar prefix: A prefix is a contiguous number range for a block of E.164 numbers that includes the E.164 assigned country code. For example, a North American Numbering Plan prefix like `+1510720` written like `+1(510) 720` matches all numbers inclusive from `+1(510) 720-0000` to `+1(510) 720-9999`. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], iso_code: str): super().__init__(version) - self._properties = { - "prefix": payload.get("prefix"), - } + self.prefix: Optional[str] = payload.get("prefix") self._solution = { "iso_code": iso_code, } - @property - def prefix(self) -> str: - """ - :returns: A prefix is a contiguous number range for a block of E.164 numbers that includes the E.164 assigned country code. For example, a North American Numbering Plan prefix like `+1510720` written like `+1(510) 720` matches all numbers inclusive from `+1(510) 720-0000` to `+1(510) 720-9999`. - """ - return self._properties["prefix"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/voice/v1/dialing_permissions/settings.py b/twilio/rest/voice/v1/dialing_permissions/settings.py index 009a90379..86439dacc 100644 --- a/twilio/rest/voice/v1/dialing_permissions/settings.py +++ b/twilio/rest/voice/v1/dialing_permissions/settings.py @@ -13,7 +13,7 @@ """ -from typing import Optional +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 @@ -22,18 +22,19 @@ class SettingsInstance(InstanceResource): - def __init__(self, version, payload): - """ - Initialize the SettingsInstance - """ + + """ + :ivar dialing_permissions_inheritance: `true` if the sub-account will inherit voice dialing permissions from the Master Project; otherwise `false`. + :ivar url: The absolute URL of this resource. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "dialing_permissions_inheritance": payload.get( - "dialing_permissions_inheritance" - ), - "url": payload.get("url"), - } + self.dialing_permissions_inheritance: Optional[bool] = payload.get( + "dialing_permissions_inheritance" + ) + self.url: Optional[str] = payload.get("url") self._solution = {} self._context: Optional[SettingsContext] = None @@ -52,20 +53,6 @@ def _proxy(self) -> "SettingsContext": ) return self._context - @property - def dialing_permissions_inheritance(self) -> bool: - """ - :returns: `true` if the sub-account will inherit voice dialing permissions from the Master Project; otherwise `false`. - """ - return self._properties["dialing_permissions_inheritance"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of this resource. - """ - return self._properties["url"] - def fetch(self) -> "SettingsInstance": """ Fetch the SettingsInstance diff --git a/twilio/rest/voice/v1/ip_record.py b/twilio/rest/voice/v1/ip_record.py index 7611de957..25450a24b 100644 --- a/twilio/rest/voice/v1/ip_record.py +++ b/twilio/rest/voice/v1/ip_record.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,27 +24,40 @@ class IpRecordInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the IpRecordInstance - """ + + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IP Record resource. + :ivar sid: The unique string that we created to identify the IP Record resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar ip_address: An IP address in dotted decimal notation, IPv4 only. + :ivar cidr_prefix_length: An integer representing the length of the [CIDR](https://tools.ietf.org/html/rfc4632) prefix to use with this IP address. By default the entire IP address is used, which for IPv4 is value 32. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "sid": payload.get("sid"), - "friendly_name": payload.get("friendly_name"), - "ip_address": payload.get("ip_address"), - "cidr_prefix_length": deserialize.integer( - payload.get("cidr_prefix_length") - ), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.sid: Optional[str] = payload.get("sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.ip_address: Optional[str] = payload.get("ip_address") + self.cidr_prefix_length: Optional[int] = deserialize.integer( + payload.get("cidr_prefix_length") + ) + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[IpRecordContext] = None @@ -63,62 +76,6 @@ def _proxy(self) -> "IpRecordContext": ) return self._context - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IP Record resource. - """ - return self._properties["account_sid"] - - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the IP Record resource. - """ - return self._properties["sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def ip_address(self) -> str: - """ - :returns: An IP address in dotted decimal notation, IPv4 only. - """ - return self._properties["ip_address"] - - @property - def cidr_prefix_length(self) -> int: - """ - :returns: An integer representing the length of the [CIDR](https://tools.ietf.org/html/rfc4632) prefix to use with this IP address. By default the entire IP address is used, which for IPv4 is value 32. - """ - return self._properties["cidr_prefix_length"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the IpRecordInstance diff --git a/twilio/rest/voice/v1/source_ip_mapping.py b/twilio/rest/voice/v1/source_ip_mapping.py index d5a5267c1..84e6b8be7 100644 --- a/twilio/rest/voice/v1/source_ip_mapping.py +++ b/twilio/rest/voice/v1/source_ip_mapping.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,23 +24,34 @@ class SourceIpMappingInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the SourceIpMappingInstance - """ + + """ + :ivar sid: The unique string that we created to identify the IP Record resource. + :ivar ip_record_sid: The Twilio-provided string that uniquely identifies the IP Record resource to map from. + :ivar sip_domain_sid: The SID of the SIP Domain that the IP Record is mapped to. + :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "ip_record_sid": payload.get("ip_record_sid"), - "sip_domain_sid": payload.get("sip_domain_sid"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.ip_record_sid: Optional[str] = payload.get("ip_record_sid") + self.sip_domain_sid: Optional[str] = payload.get("sip_domain_sid") + self.date_created: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_created") + ) + self.date_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("date_updated") + ) + self.url: Optional[str] = payload.get("url") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[SourceIpMappingContext] = None @@ -59,48 +70,6 @@ def _proxy(self) -> "SourceIpMappingContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the IP Record resource. - """ - return self._properties["sid"] - - @property - def ip_record_sid(self) -> str: - """ - :returns: The Twilio-provided string that uniquely identifies the IP Record resource to map from. - """ - return self._properties["ip_record_sid"] - - @property - def sip_domain_sid(self) -> str: - """ - :returns: The SID of the SIP Domain that the IP Record is mapped to. - """ - return self._properties["sip_domain_sid"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the SourceIpMappingInstance diff --git a/twilio/rest/wireless/v1/command.py b/twilio/rest/wireless/v1/command.py index 110c1d912..714ddc3cd 100644 --- a/twilio/rest/wireless/v1/command.py +++ b/twilio/rest/wireless/v1/command.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -43,29 +43,49 @@ class Transport(object): SMS = "sms" IP = "ip" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the CommandInstance - """ + """ + :ivar sid: The unique string that we created to identify the Command resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Command resource. + :ivar sim_sid: The SID of the [Sim resource](https://www.twilio.com/docs/wireless/api/sim-resource) that the Command was sent to or from. + :ivar command: The message being sent to or from the SIM. For text mode messages, this can be up to 160 characters. For binary mode messages, this is a series of up to 140 bytes of data encoded using base64. + :ivar command_mode: + :ivar transport: + :ivar delivery_receipt_requested: Whether to request a delivery receipt. + :ivar status: + :ivar direction: + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "account_sid": payload.get("account_sid"), - "sim_sid": payload.get("sim_sid"), - "command": payload.get("command"), - "command_mode": payload.get("command_mode"), - "transport": payload.get("transport"), - "delivery_receipt_requested": payload.get("delivery_receipt_requested"), - "status": payload.get("status"), - "direction": payload.get("direction"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.sim_sid: Optional[str] = payload.get("sim_sid") + self.command: Optional[str] = payload.get("command") + self.command_mode: Optional["CommandInstance.CommandMode"] = payload.get( + "command_mode" + ) + self.transport: Optional["CommandInstance.Transport"] = payload.get("transport") + self.delivery_receipt_requested: Optional[bool] = payload.get( + "delivery_receipt_requested" + ) + self.status: Optional["CommandInstance.Status"] = payload.get("status") + self.direction: Optional["CommandInstance.Direction"] = payload.get("direction") + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[CommandContext] = None @@ -84,90 +104,6 @@ def _proxy(self) -> "CommandContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Command resource. - """ - return self._properties["sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Command resource. - """ - return self._properties["account_sid"] - - @property - def sim_sid(self) -> str: - """ - :returns: The SID of the [Sim resource](https://www.twilio.com/docs/wireless/api/sim-resource) that the Command was sent to or from. - """ - return self._properties["sim_sid"] - - @property - def command(self) -> str: - """ - :returns: The message being sent to or from the SIM. For text mode messages, this can be up to 160 characters. For binary mode messages, this is a series of up to 140 bytes of data encoded using base64. - """ - return self._properties["command"] - - @property - def command_mode(self) -> "CommandInstance.CommandMode": - """ - :returns: - """ - return self._properties["command_mode"] - - @property - def transport(self) -> "CommandInstance.Transport": - """ - :returns: - """ - return self._properties["transport"] - - @property - def delivery_receipt_requested(self) -> bool: - """ - :returns: Whether to request a delivery receipt. - """ - return self._properties["delivery_receipt_requested"] - - @property - def status(self) -> "CommandInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def direction(self) -> "CommandInstance.Direction": - """ - :returns: - """ - return self._properties["direction"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the CommandInstance diff --git a/twilio/rest/wireless/v1/rate_plan.py b/twilio/rest/wireless/v1/rate_plan.py index f93d5dce6..2b23e2076 100644 --- a/twilio/rest/wireless/v1/rate_plan.py +++ b/twilio/rest/wireless/v1/rate_plan.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, serialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -24,37 +24,62 @@ class RatePlanInstance(InstanceResource): - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the RatePlanInstance - """ + + """ + :ivar sid: The unique string that we created to identify the RatePlan resource. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RatePlan resource. + :ivar friendly_name: The string that you assigned to describe the resource. + :ivar data_enabled: Whether SIMs can use GPRS/3G/4G/LTE data connectivity. + :ivar data_metering: The model used to meter data usage. Can be: `payg` and `quota-1`, `quota-10`, and `quota-50`. Learn more about the available [data metering models](https://www.twilio.com/docs/wireless/api/rateplan-resource#payg-vs-quota-data-plans). + :ivar data_limit: The total data usage (download and upload combined) in Megabytes that the Network allows during one month on the home network (T-Mobile USA). The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB. + :ivar messaging_enabled: Whether SIMs can make, send, and receive SMS using [Commands](https://www.twilio.com/docs/wireless/api/command-resource). + :ivar voice_enabled: Deprecated. Whether SIMs can make and receive voice calls. + :ivar national_roaming_enabled: Whether SIMs can roam on networks other than the home network (T-Mobile USA) in the United States. See [national roaming](https://www.twilio.com/docs/wireless/api/rateplan-resource#national-roaming). + :ivar national_roaming_data_limit: The total data usage (download and upload combined) in Megabytes that the Network allows during one month on non-home networks in the United States. The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB. + :ivar international_roaming: The list of services that SIMs capable of using GPRS/3G/4G/LTE data connectivity can use outside of the United States. Can contain: `data` and `messaging`. + :ivar international_roaming_data_limit: The total data usage (download and upload combined) in Megabytes that the Network allows during one month when roaming outside the United States. Can be up to 2TB. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + :ivar url: The absolute URL of the resource. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "account_sid": payload.get("account_sid"), - "friendly_name": payload.get("friendly_name"), - "data_enabled": payload.get("data_enabled"), - "data_metering": payload.get("data_metering"), - "data_limit": deserialize.integer(payload.get("data_limit")), - "messaging_enabled": payload.get("messaging_enabled"), - "voice_enabled": payload.get("voice_enabled"), - "national_roaming_enabled": payload.get("national_roaming_enabled"), - "national_roaming_data_limit": deserialize.integer( - payload.get("national_roaming_data_limit") - ), - "international_roaming": payload.get("international_roaming"), - "international_roaming_data_limit": deserialize.integer( - payload.get("international_roaming_data_limit") - ), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - } + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.account_sid: Optional[str] = payload.get("account_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.data_enabled: Optional[bool] = payload.get("data_enabled") + self.data_metering: Optional[str] = payload.get("data_metering") + self.data_limit: Optional[int] = deserialize.integer(payload.get("data_limit")) + self.messaging_enabled: Optional[bool] = payload.get("messaging_enabled") + self.voice_enabled: Optional[bool] = payload.get("voice_enabled") + self.national_roaming_enabled: Optional[bool] = payload.get( + "national_roaming_enabled" + ) + self.national_roaming_data_limit: Optional[int] = deserialize.integer( + payload.get("national_roaming_data_limit") + ) + self.international_roaming: Optional[List[str]] = payload.get( + "international_roaming" + ) + self.international_roaming_data_limit: Optional[int] = deserialize.integer( + payload.get("international_roaming_data_limit") + ) + 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._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[RatePlanContext] = None @@ -73,118 +98,6 @@ def _proxy(self) -> "RatePlanContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the RatePlan resource. - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - """ - return self._properties["unique_name"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the RatePlan resource. - """ - return self._properties["account_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the resource. - """ - return self._properties["friendly_name"] - - @property - def data_enabled(self) -> bool: - """ - :returns: Whether SIMs can use GPRS/3G/4G/LTE data connectivity. - """ - return self._properties["data_enabled"] - - @property - def data_metering(self) -> str: - """ - :returns: The model used to meter data usage. Can be: `payg` and `quota-1`, `quota-10`, and `quota-50`. Learn more about the available [data metering models](https://www.twilio.com/docs/wireless/api/rateplan-resource#payg-vs-quota-data-plans). - """ - return self._properties["data_metering"] - - @property - def data_limit(self) -> int: - """ - :returns: The total data usage (download and upload combined) in Megabytes that the Network allows during one month on the home network (T-Mobile USA). The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB. - """ - return self._properties["data_limit"] - - @property - def messaging_enabled(self) -> bool: - """ - :returns: Whether SIMs can make, send, and receive SMS using [Commands](https://www.twilio.com/docs/wireless/api/command-resource). - """ - return self._properties["messaging_enabled"] - - @property - def voice_enabled(self) -> bool: - """ - :returns: Deprecated. Whether SIMs can make and receive voice calls. - """ - return self._properties["voice_enabled"] - - @property - def national_roaming_enabled(self) -> bool: - """ - :returns: Whether SIMs can roam on networks other than the home network (T-Mobile USA) in the United States. See [national roaming](https://www.twilio.com/docs/wireless/api/rateplan-resource#national-roaming). - """ - return self._properties["national_roaming_enabled"] - - @property - def national_roaming_data_limit(self) -> int: - """ - :returns: The total data usage (download and upload combined) in Megabytes that the Network allows during one month on non-home networks in the United States. The metering period begins the day of activation and ends on the same day in the following month. Can be up to 2TB. - """ - return self._properties["national_roaming_data_limit"] - - @property - def international_roaming(self) -> List[str]: - """ - :returns: The list of services that SIMs capable of using GPRS/3G/4G/LTE data connectivity can use outside of the United States. Can contain: `data` and `messaging`. - """ - return self._properties["international_roaming"] - - @property - def international_roaming_data_limit(self) -> int: - """ - :returns: The total data usage (download and upload combined) in Megabytes that the Network allows during one month when roaming outside the United States. Can be up to 2TB. - """ - return self._properties["international_roaming_data_limit"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - def delete(self) -> bool: """ Deletes the RatePlanInstance diff --git a/twilio/rest/wireless/v1/sim/__init__.py b/twilio/rest/wireless/v1/sim/__init__.py index 83e60b545..1602ea791 100644 --- a/twilio/rest/wireless/v1/sim/__init__.py +++ b/twilio/rest/wireless/v1/sim/__init__.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_context import InstanceContext from twilio.base.instance_resource import InstanceResource @@ -39,41 +39,73 @@ class Status(object): SCHEDULED = "scheduled" UPDATING = "updating" - def __init__(self, version, payload, sid: Optional[str] = None): - """ - Initialize the SimInstance - """ + """ + :ivar sid: The unique string that we created to identify the Sim resource. + :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) to which the Sim resource belongs. + :ivar rate_plan_sid: The SID of the [RatePlan resource](https://www.twilio.com/docs/wireless/api/rateplan-resource) to which the Sim resource is assigned. + :ivar friendly_name: The string that you assigned to describe the Sim resource. + :ivar iccid: The [ICCID](https://en.wikipedia.org/wiki/SIM_card#ICCID) associated with the SIM. + :ivar e_id: Deprecated. + :ivar status: + :ivar reset_status: + :ivar commands_callback_url: The URL we call using the `commands_callback_method` when the SIM originates a machine-to-machine [Command](https://www.twilio.com/docs/wireless/api/command-resource). Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. + :ivar commands_callback_method: The HTTP method we use to call `commands_callback_url`. Can be: `POST` or `GET`. Default is `POST`. + :ivar sms_fallback_method: Deprecated. + :ivar sms_fallback_url: Deprecated. + :ivar sms_method: Deprecated. + :ivar sms_url: Deprecated. + :ivar voice_fallback_method: Deprecated. The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. Default is `POST`. + :ivar voice_fallback_url: Deprecated. The URL we call using the `voice_fallback_method` when an error occurs while retrieving or executing the TwiML requested from `voice_url`. + :ivar voice_method: Deprecated. The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. Default is `POST`. + :ivar voice_url: Deprecated. The URL we call using the `voice_method` when the SIM-connected device makes a voice call. + :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + :ivar date_updated: The date and time in GMT when the Sim resource was last updated specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + :ivar url: The absolute URL of the resource. + :ivar links: The URLs of related subresources. + :ivar ip_address: Deprecated. + """ + + def __init__( + self, version: Version, payload: Dict[str, Any], sid: Optional[str] = None + ): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "unique_name": payload.get("unique_name"), - "account_sid": payload.get("account_sid"), - "rate_plan_sid": payload.get("rate_plan_sid"), - "friendly_name": payload.get("friendly_name"), - "iccid": payload.get("iccid"), - "e_id": payload.get("e_id"), - "status": payload.get("status"), - "reset_status": payload.get("reset_status"), - "commands_callback_url": payload.get("commands_callback_url"), - "commands_callback_method": payload.get("commands_callback_method"), - "sms_fallback_method": payload.get("sms_fallback_method"), - "sms_fallback_url": payload.get("sms_fallback_url"), - "sms_method": payload.get("sms_method"), - "sms_url": payload.get("sms_url"), - "voice_fallback_method": payload.get("voice_fallback_method"), - "voice_fallback_url": payload.get("voice_fallback_url"), - "voice_method": payload.get("voice_method"), - "voice_url": payload.get("voice_url"), - "date_created": deserialize.iso8601_datetime(payload.get("date_created")), - "date_updated": deserialize.iso8601_datetime(payload.get("date_updated")), - "url": payload.get("url"), - "links": payload.get("links"), - "ip_address": payload.get("ip_address"), - } + self.sid: Optional[str] = payload.get("sid") + self.unique_name: Optional[str] = payload.get("unique_name") + self.account_sid: Optional[str] = payload.get("account_sid") + self.rate_plan_sid: Optional[str] = payload.get("rate_plan_sid") + self.friendly_name: Optional[str] = payload.get("friendly_name") + self.iccid: Optional[str] = payload.get("iccid") + self.e_id: Optional[str] = payload.get("e_id") + self.status: Optional["SimInstance.Status"] = payload.get("status") + self.reset_status: Optional["SimInstance.ResetStatus"] = payload.get( + "reset_status" + ) + self.commands_callback_url: Optional[str] = payload.get("commands_callback_url") + self.commands_callback_method: Optional[str] = payload.get( + "commands_callback_method" + ) + self.sms_fallback_method: Optional[str] = payload.get("sms_fallback_method") + self.sms_fallback_url: Optional[str] = payload.get("sms_fallback_url") + self.sms_method: Optional[str] = payload.get("sms_method") + self.sms_url: Optional[str] = payload.get("sms_url") + self.voice_fallback_method: Optional[str] = payload.get("voice_fallback_method") + self.voice_fallback_url: Optional[str] = payload.get("voice_fallback_url") + self.voice_method: Optional[str] = payload.get("voice_method") + self.voice_url: Optional[str] = payload.get("voice_url") + 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.ip_address: Optional[str] = payload.get("ip_address") self._solution = { - "sid": sid or self._properties["sid"], + "sid": sid or self.sid, } self._context: Optional[SimContext] = None @@ -92,174 +124,6 @@ def _proxy(self) -> "SimContext": ) return self._context - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the Sim resource. - """ - return self._properties["sid"] - - @property - def unique_name(self) -> str: - """ - :returns: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - """ - return self._properties["unique_name"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) to which the Sim resource belongs. - """ - return self._properties["account_sid"] - - @property - def rate_plan_sid(self) -> str: - """ - :returns: The SID of the [RatePlan resource](https://www.twilio.com/docs/wireless/api/rateplan-resource) to which the Sim resource is assigned. - """ - return self._properties["rate_plan_sid"] - - @property - def friendly_name(self) -> str: - """ - :returns: The string that you assigned to describe the Sim resource. - """ - return self._properties["friendly_name"] - - @property - def iccid(self) -> str: - """ - :returns: The [ICCID](https://en.wikipedia.org/wiki/SIM_card#ICCID) associated with the SIM. - """ - return self._properties["iccid"] - - @property - def e_id(self) -> str: - """ - :returns: Deprecated. - """ - return self._properties["e_id"] - - @property - def status(self) -> "SimInstance.Status": - """ - :returns: - """ - return self._properties["status"] - - @property - def reset_status(self) -> "SimInstance.ResetStatus": - """ - :returns: - """ - return self._properties["reset_status"] - - @property - def commands_callback_url(self) -> str: - """ - :returns: The URL we call using the `commands_callback_method` when the SIM originates a machine-to-machine [Command](https://www.twilio.com/docs/wireless/api/command-resource). Your server should respond with an HTTP status code in the 200 range; any response body will be ignored. - """ - return self._properties["commands_callback_url"] - - @property - def commands_callback_method(self) -> str: - """ - :returns: The HTTP method we use to call `commands_callback_url`. Can be: `POST` or `GET`. Default is `POST`. - """ - return self._properties["commands_callback_method"] - - @property - def sms_fallback_method(self) -> str: - """ - :returns: Deprecated. - """ - return self._properties["sms_fallback_method"] - - @property - def sms_fallback_url(self) -> str: - """ - :returns: Deprecated. - """ - return self._properties["sms_fallback_url"] - - @property - def sms_method(self) -> str: - """ - :returns: Deprecated. - """ - return self._properties["sms_method"] - - @property - def sms_url(self) -> str: - """ - :returns: Deprecated. - """ - return self._properties["sms_url"] - - @property - def voice_fallback_method(self) -> str: - """ - :returns: Deprecated. The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`. Default is `POST`. - """ - return self._properties["voice_fallback_method"] - - @property - def voice_fallback_url(self) -> str: - """ - :returns: Deprecated. The URL we call using the `voice_fallback_method` when an error occurs while retrieving or executing the TwiML requested from `voice_url`. - """ - return self._properties["voice_fallback_url"] - - @property - def voice_method(self) -> str: - """ - :returns: Deprecated. The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`. Default is `POST`. - """ - return self._properties["voice_method"] - - @property - def voice_url(self) -> str: - """ - :returns: Deprecated. The URL we call using the `voice_method` when the SIM-connected device makes a voice call. - """ - return self._properties["voice_url"] - - @property - def date_created(self) -> datetime: - """ - :returns: The date and time in GMT when the resource was created specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. - """ - return self._properties["date_created"] - - @property - def date_updated(self) -> datetime: - """ - :returns: The date and time in GMT when the Sim resource was last updated specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. - """ - return self._properties["date_updated"] - - @property - def url(self) -> str: - """ - :returns: The absolute URL of the resource. - """ - return self._properties["url"] - - @property - def links(self) -> Dict[str, object]: - """ - :returns: The URLs of related subresources. - """ - return self._properties["links"] - - @property - def ip_address(self) -> str: - """ - :returns: Deprecated. - """ - return self._properties["ip_address"] - def delete(self) -> bool: """ Deletes the SimInstance diff --git a/twilio/rest/wireless/v1/sim/data_session.py b/twilio/rest/wireless/v1/sim/data_session.py index 677ba1b14..80913beb6 100644 --- a/twilio/rest/wireless/v1/sim/data_session.py +++ b/twilio/rest/wireless/v1/sim/data_session.py @@ -14,7 +14,7 @@ from datetime import datetime -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import deserialize, values from twilio.base.instance_resource import InstanceResource @@ -24,149 +24,60 @@ class DataSessionInstance(InstanceResource): - def __init__(self, version, payload, sim_sid: str): - """ - Initialize the DataSessionInstance - """ + + """ + :ivar sid: The unique string that we created to identify the DataSession resource. + :ivar sim_sid: The SID of the [Sim resource](https://www.twilio.com/docs/wireless/api/sim-resource) that the Data Session is for. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the DataSession resource. + :ivar radio_link: The generation of wireless technology that the device was using. + :ivar operator_mcc: The 'mobile country code' is the unique ID of the home country where the Data Session took place. See: [MCC/MNC lookup](http://mcc-mnc.com/). + :ivar operator_mnc: The 'mobile network code' is the unique ID specific to the mobile operator network where the Data Session took place. + :ivar operator_country: The three letter country code representing where the device's Data Session took place. This is determined by looking up the `operator_mcc`. + :ivar operator_name: The friendly name of the mobile operator network that the [SIM](https://www.twilio.com/docs/wireless/api/sim-resource)-connected device is attached to. This is determined by looking up the `operator_mnc`. + :ivar cell_id: The unique ID of the cellular tower that the device was attached to at the moment when the Data Session was last updated. + :ivar cell_location_estimate: An object that describes the estimated location in latitude and longitude where the device's Data Session took place. The location is derived from the `cell_id` when the Data Session was last updated. See [Cell Location Estimate Object](https://www.twilio.com/docs/wireless/api/datasession-resource#cell-location-estimate-object). + :ivar packets_uploaded: The number of packets uploaded by the device between the `start` time and when the Data Session was last updated. + :ivar packets_downloaded: The number of packets downloaded by the device between the `start` time and when the Data Session was last updated. + :ivar last_updated: The date that the resource was last updated, given as GMT in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + :ivar start: The date that the Data Session started, given as GMT in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + :ivar end: The date that the record ended, given as GMT in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + :ivar imei: The 'international mobile equipment identity' is the unique ID of the device using the SIM to connect. An IMEI is a 15-digit string: 14 digits for the device identifier plus a check digit calculated using the Luhn formula. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], sim_sid: str): super().__init__(version) - self._properties = { - "sid": payload.get("sid"), - "sim_sid": payload.get("sim_sid"), - "account_sid": payload.get("account_sid"), - "radio_link": payload.get("radio_link"), - "operator_mcc": payload.get("operator_mcc"), - "operator_mnc": payload.get("operator_mnc"), - "operator_country": payload.get("operator_country"), - "operator_name": payload.get("operator_name"), - "cell_id": payload.get("cell_id"), - "cell_location_estimate": payload.get("cell_location_estimate"), - "packets_uploaded": deserialize.integer(payload.get("packets_uploaded")), - "packets_downloaded": deserialize.integer( - payload.get("packets_downloaded") - ), - "last_updated": deserialize.iso8601_datetime(payload.get("last_updated")), - "start": deserialize.iso8601_datetime(payload.get("start")), - "end": deserialize.iso8601_datetime(payload.get("end")), - "imei": payload.get("imei"), - } + self.sid: Optional[str] = payload.get("sid") + self.sim_sid: Optional[str] = payload.get("sim_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.radio_link: Optional[str] = payload.get("radio_link") + self.operator_mcc: Optional[str] = payload.get("operator_mcc") + self.operator_mnc: Optional[str] = payload.get("operator_mnc") + self.operator_country: Optional[str] = payload.get("operator_country") + self.operator_name: Optional[str] = payload.get("operator_name") + self.cell_id: Optional[str] = payload.get("cell_id") + self.cell_location_estimate: Optional[Dict[str, object]] = payload.get( + "cell_location_estimate" + ) + self.packets_uploaded: Optional[int] = deserialize.integer( + payload.get("packets_uploaded") + ) + self.packets_downloaded: Optional[int] = deserialize.integer( + payload.get("packets_downloaded") + ) + self.last_updated: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("last_updated") + ) + self.start: Optional[datetime] = deserialize.iso8601_datetime( + payload.get("start") + ) + self.end: Optional[datetime] = deserialize.iso8601_datetime(payload.get("end")) + self.imei: Optional[str] = payload.get("imei") self._solution = { "sim_sid": sim_sid, } - @property - def sid(self) -> str: - """ - :returns: The unique string that we created to identify the DataSession resource. - """ - return self._properties["sid"] - - @property - def sim_sid(self) -> str: - """ - :returns: The SID of the [Sim resource](https://www.twilio.com/docs/wireless/api/sim-resource) that the Data Session is for. - """ - return self._properties["sim_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the DataSession resource. - """ - return self._properties["account_sid"] - - @property - def radio_link(self) -> str: - """ - :returns: The generation of wireless technology that the device was using. - """ - return self._properties["radio_link"] - - @property - def operator_mcc(self) -> str: - """ - :returns: The 'mobile country code' is the unique ID of the home country where the Data Session took place. See: [MCC/MNC lookup](http://mcc-mnc.com/). - """ - return self._properties["operator_mcc"] - - @property - def operator_mnc(self) -> str: - """ - :returns: The 'mobile network code' is the unique ID specific to the mobile operator network where the Data Session took place. - """ - return self._properties["operator_mnc"] - - @property - def operator_country(self) -> str: - """ - :returns: The three letter country code representing where the device's Data Session took place. This is determined by looking up the `operator_mcc`. - """ - return self._properties["operator_country"] - - @property - def operator_name(self) -> str: - """ - :returns: The friendly name of the mobile operator network that the [SIM](https://www.twilio.com/docs/wireless/api/sim-resource)-connected device is attached to. This is determined by looking up the `operator_mnc`. - """ - return self._properties["operator_name"] - - @property - def cell_id(self) -> str: - """ - :returns: The unique ID of the cellular tower that the device was attached to at the moment when the Data Session was last updated. - """ - return self._properties["cell_id"] - - @property - def cell_location_estimate(self) -> Dict[str, object]: - """ - :returns: An object that describes the estimated location in latitude and longitude where the device's Data Session took place. The location is derived from the `cell_id` when the Data Session was last updated. See [Cell Location Estimate Object](https://www.twilio.com/docs/wireless/api/datasession-resource#cell-location-estimate-object). - """ - return self._properties["cell_location_estimate"] - - @property - def packets_uploaded(self) -> int: - """ - :returns: The number of packets uploaded by the device between the `start` time and when the Data Session was last updated. - """ - return self._properties["packets_uploaded"] - - @property - def packets_downloaded(self) -> int: - """ - :returns: The number of packets downloaded by the device between the `start` time and when the Data Session was last updated. - """ - return self._properties["packets_downloaded"] - - @property - def last_updated(self) -> datetime: - """ - :returns: The date that the resource was last updated, given as GMT in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. - """ - return self._properties["last_updated"] - - @property - def start(self) -> datetime: - """ - :returns: The date that the Data Session started, given as GMT in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. - """ - return self._properties["start"] - - @property - def end(self) -> datetime: - """ - :returns: The date that the record ended, given as GMT in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. - """ - return self._properties["end"] - - @property - def imei(self) -> str: - """ - :returns: The 'international mobile equipment identity' is the unique ID of the device using the SIM to connect. An IMEI is a 15-digit string: 14 digits for the device identifier plus a check digit calculated using the Luhn formula. - """ - return self._properties["imei"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/wireless/v1/sim/usage_record.py b/twilio/rest/wireless/v1/sim/usage_record.py index 2af1b950b..67c33ec4d 100644 --- a/twilio/rest/wireless/v1/sim/usage_record.py +++ b/twilio/rest/wireless/v1/sim/usage_record.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import serialize, values from twilio.base.instance_resource import InstanceResource @@ -28,59 +28,27 @@ class Granularity(object): DAILY = "daily" ALL = "all" - def __init__(self, version, payload, sim_sid: str): - """ - Initialize the UsageRecordInstance - """ + """ + :ivar sim_sid: The SID of the [Sim resource](https://www.twilio.com/docs/wireless/api/sim-resource) that this Usage Record is for. + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageRecord resource. + :ivar period: The time period for which the usage is reported. Contains `start` and `end` datetime values given as GMT in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + :ivar commands: An object that describes the SIM's usage of Commands during the specified period. See [Commands Usage Object](https://www.twilio.com/docs/wireless/api/sim-usagerecord-resource#commands-usage-object). + :ivar data: An object that describes the SIM's data usage during the specified period. See [Data Usage Object](https://www.twilio.com/docs/wireless/api/sim-usagerecord-resource#data-usage-object). + """ + + def __init__(self, version: Version, payload: Dict[str, Any], sim_sid: str): super().__init__(version) - self._properties = { - "sim_sid": payload.get("sim_sid"), - "account_sid": payload.get("account_sid"), - "period": payload.get("period"), - "commands": payload.get("commands"), - "data": payload.get("data"), - } + self.sim_sid: Optional[str] = payload.get("sim_sid") + self.account_sid: Optional[str] = payload.get("account_sid") + self.period: Optional[Dict[str, object]] = payload.get("period") + self.commands: Optional[Dict[str, object]] = payload.get("commands") + self.data: Optional[Dict[str, object]] = payload.get("data") self._solution = { "sim_sid": sim_sid, } - @property - def sim_sid(self) -> str: - """ - :returns: The SID of the [Sim resource](https://www.twilio.com/docs/wireless/api/sim-resource) that this Usage Record is for. - """ - return self._properties["sim_sid"] - - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageRecord resource. - """ - return self._properties["account_sid"] - - @property - def period(self) -> Dict[str, object]: - """ - :returns: The time period for which the usage is reported. Contains `start` and `end` datetime values given as GMT in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. - """ - return self._properties["period"] - - @property - def commands(self) -> Dict[str, object]: - """ - :returns: An object that describes the SIM's usage of Commands during the specified period. See [Commands Usage Object](https://www.twilio.com/docs/wireless/api/sim-usagerecord-resource#commands-usage-object). - """ - return self._properties["commands"] - - @property - def data(self) -> Dict[str, object]: - """ - :returns: An object that describes the SIM's data usage during the specified period. See [Data Usage Object](https://www.twilio.com/docs/wireless/api/sim-usagerecord-resource#data-usage-object). - """ - return self._properties["data"] - def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/wireless/v1/usage_record.py b/twilio/rest/wireless/v1/usage_record.py index cd04069ec..255540dac 100644 --- a/twilio/rest/wireless/v1/usage_record.py +++ b/twilio/rest/wireless/v1/usage_record.py @@ -13,7 +13,7 @@ """ -from typing import Dict, List +from typing import Any, Dict, List, Optional from twilio.base import serialize, values from twilio.base.instance_resource import InstanceResource @@ -28,49 +28,23 @@ class Granularity(object): DAILY = "daily" ALL = "all" - def __init__(self, version, payload): - """ - Initialize the UsageRecordInstance - """ + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AccountUsageRecord resource. + :ivar period: The time period for which usage is reported. Contains `start` and `end` properties that describe the period using GMT date-time values specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. + :ivar commands: An object that describes the aggregated Commands usage for all SIMs during the specified period. See [Commands Usage Object](https://www.twilio.com/docs/wireless/api/account-usagerecord-resource#commands-usage-object). + :ivar data: An object that describes the aggregated Data usage for all SIMs over the period. See [Data Usage Object](https://www.twilio.com/docs/wireless/api/account-usagerecord-resource#data-usage-object). + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): super().__init__(version) - self._properties = { - "account_sid": payload.get("account_sid"), - "period": payload.get("period"), - "commands": payload.get("commands"), - "data": payload.get("data"), - } + self.account_sid: Optional[str] = payload.get("account_sid") + self.period: Optional[Dict[str, object]] = payload.get("period") + self.commands: Optional[Dict[str, object]] = payload.get("commands") + self.data: Optional[Dict[str, object]] = payload.get("data") self._solution = {} - @property - def account_sid(self) -> str: - """ - :returns: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the AccountUsageRecord resource. - """ - return self._properties["account_sid"] - - @property - def period(self) -> Dict[str, object]: - """ - :returns: The time period for which usage is reported. Contains `start` and `end` properties that describe the period using GMT date-time values specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. - """ - return self._properties["period"] - - @property - def commands(self) -> Dict[str, object]: - """ - :returns: An object that describes the aggregated Commands usage for all SIMs during the specified period. See [Commands Usage Object](https://www.twilio.com/docs/wireless/api/account-usagerecord-resource#commands-usage-object). - """ - return self._properties["commands"] - - @property - def data(self) -> Dict[str, object]: - """ - :returns: An object that describes the aggregated Data usage for all SIMs over the period. See [Data Usage Object](https://www.twilio.com/docs/wireless/api/account-usagerecord-resource#data-usage-object). - """ - return self._properties["data"] - def __repr__(self) -> str: """ Provide a friendly representation