Skip to content

Commit

Permalink
feat: add return types to rest classes (#693)
Browse files Browse the repository at this point in the history
  • Loading branch information
childish-sambino authored Mar 24, 2023
1 parent c4feb04 commit e8de65a
Show file tree
Hide file tree
Showing 475 changed files with 18,820 additions and 38,942 deletions.
62 changes: 18 additions & 44 deletions twilio/rest/accounts/v1/auth_token_promotion.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"""


from datetime import datetime
from typing import Optional
from twilio.base import deserialize, values
from twilio.base.instance_context import InstanceContext
Expand All @@ -25,9 +26,6 @@ class AuthTokenPromotionInstance(InstanceResource):
def __init__(self, version, payload):
"""
Initialize the AuthTokenPromotionInstance
:returns: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionInstance
:rtype: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionInstance
"""
super().__init__(version)

Expand All @@ -43,13 +41,12 @@ def __init__(self, version, payload):
self._context: Optional[AuthTokenPromotionContext] = None

@property
def _proxy(self):
def _proxy(self) -> "AuthTokenPromotionContext":
"""
Generate an instance context for the instance, the context is capable of
performing various actions. All instance actions are proxied to the context
:returns: AuthTokenPromotionContext for this AuthTokenPromotionInstance
:rtype: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionContext
"""
if self._context is None:
self._context = AuthTokenPromotionContext(
Expand All @@ -58,71 +55,63 @@ def _proxy(self):
return self._context

@property
def account_sid(self):
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.
:rtype: str
"""
return self._properties["account_sid"]

@property
def auth_token(self):
def auth_token(self) -> str:
"""
:returns: The promoted Auth Token that must be used to authenticate future API requests.
:rtype: str
"""
return self._properties["auth_token"]

@property
def date_created(self):
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.
:rtype: datetime
"""
return self._properties["date_created"]

@property
def date_updated(self):
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.
:rtype: datetime
"""
return self._properties["date_updated"]

@property
def url(self):
def url(self) -> str:
"""
:returns: The URI for this resource, relative to `https://accounts.twilio.com`
:rtype: str
"""
return self._properties["url"]

def update(self):
def update(self) -> "AuthTokenPromotionInstance":
"""
Update the AuthTokenPromotionInstance
:returns: The updated AuthTokenPromotionInstance
:rtype: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionInstance
"""
return self._proxy.update()

async def update_async(self):
async def update_async(self) -> "AuthTokenPromotionInstance":
"""
Asynchronous coroutine to update the AuthTokenPromotionInstance
:returns: The updated AuthTokenPromotionInstance
:rtype: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionInstance
"""
return await self._proxy.update_async()

def __repr__(self):
def __repr__(self) -> str:
"""
Provide a friendly representation
:returns: Machine friendly representation
:rtype: str
"""
context = " ".join("{}={}".format(k, v) for k, v in self._solution.items())
return "<Twilio.Accounts.V1.AuthTokenPromotionInstance {}>".format(context)
Expand All @@ -133,22 +122,18 @@ def __init__(self, version: Version):
"""
Initialize the AuthTokenPromotionContext
:param Version version: Version that contains the resource
:returns: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionContext
:rtype: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionContext
:param version: Version that contains the resource
"""
super().__init__(version)

self._uri = "/AuthTokens/Promote"

def update(self):
def update(self) -> AuthTokenPromotionInstance:
"""
Update the AuthTokenPromotionInstance
:returns: The updated AuthTokenPromotionInstance
:rtype: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionInstance
"""
data = values.of({})

Expand All @@ -160,13 +145,12 @@ def update(self):

return AuthTokenPromotionInstance(self._version, payload)

async def update_async(self):
async def update_async(self) -> AuthTokenPromotionInstance:
"""
Asynchronous coroutine to update the AuthTokenPromotionInstance
:returns: The updated AuthTokenPromotionInstance
:rtype: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionInstance
"""
data = values.of({})

Expand All @@ -178,12 +162,11 @@ async def update_async(self):

return AuthTokenPromotionInstance(self._version, payload)

def __repr__(self):
def __repr__(self) -> str:
"""
Provide a friendly representation
:returns: Machine friendly representation
:rtype: str
"""

return "<Twilio.Accounts.V1.AuthTokenPromotionContext>"
Expand All @@ -194,38 +177,29 @@ def __init__(self, version: Version):
"""
Initialize the AuthTokenPromotionList
:param Version version: Version that contains the resource
:param version: Version that contains the resource
:returns: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionList
:rtype: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionList
"""
super().__init__(version)

def get(self):
def get(self) -> AuthTokenPromotionContext:
"""
Constructs a AuthTokenPromotionContext
:returns: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionContext
:rtype: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionContext
"""
return AuthTokenPromotionContext(self._version)

def __call__(self):
def __call__(self) -> AuthTokenPromotionContext:
"""
Constructs a AuthTokenPromotionContext
:returns: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionContext
:rtype: twilio.rest.accounts.v1.auth_token_promotion.AuthTokenPromotionContext
"""
return AuthTokenPromotionContext(self._version)

def __repr__(self):
def __repr__(self) -> str:
"""
Provide a friendly representation
:returns: Machine friendly representation
:rtype: str
"""
return "<Twilio.Accounts.V1.AuthTokenPromotionList>"
17 changes: 4 additions & 13 deletions twilio/rest/accounts/v1/credential/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ def __init__(self, version: Version):
"""
Initialize the CredentialList
:param Version version: Version that contains the resource
:param version: Version that contains the resource
:returns: twilio.rest.accounts.v1.credential.CredentialList
:rtype: twilio.rest.accounts.v1.credential.CredentialList
"""
super().__init__(version)

Expand All @@ -41,34 +39,27 @@ def __init__(self, version: Version):
self._public_key: Optional[PublicKeyList] = None

@property
def aws(self):
def aws(self) -> AwsList:
"""
Access the aws
:returns: twilio.rest.accounts.v1.credential.AwsList
:rtype: twilio.rest.accounts.v1.credential.AwsList
"""
if self._aws is None:
self._aws = AwsList(self._version)
return self._aws

@property
def public_key(self):
def public_key(self) -> PublicKeyList:
"""
Access the public_key
:returns: twilio.rest.accounts.v1.credential.PublicKeyList
:rtype: twilio.rest.accounts.v1.credential.PublicKeyList
"""
if self._public_key is None:
self._public_key = PublicKeyList(self._version)
return self._public_key

def __repr__(self):
def __repr__(self) -> str:
"""
Provide a friendly representation
:returns: Machine friendly representation
:rtype: str
"""
return "<Twilio.Accounts.V1.CredentialList>"
Loading

0 comments on commit e8de65a

Please sign in to comment.