Initial commit: Email alerts application
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from twilio.base.domain import Domain
|
||||
from twilio.rest import Client
|
||||
from twilio.rest.oauth.v1 import V1
|
||||
|
||||
|
||||
class OauthBase(Domain):
|
||||
def __init__(self, twilio: Client):
|
||||
"""
|
||||
Initialize the Oauth Domain
|
||||
|
||||
:returns: Domain for Oauth
|
||||
"""
|
||||
super().__init__(twilio, "https://oauth.twilio.com")
|
||||
self._v1: Optional[V1] = None
|
||||
|
||||
@property
|
||||
def v1(self) -> V1:
|
||||
"""
|
||||
:returns: Versions v1 of Oauth
|
||||
"""
|
||||
if self._v1 is None:
|
||||
self._v1 = V1(self)
|
||||
return self._v1
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Oauth>"
|
||||
@@ -0,0 +1,55 @@
|
||||
from warnings import warn
|
||||
|
||||
from twilio.rest.oauth.OauthBase import OauthBase
|
||||
from twilio.rest.oauth.v1.device_code import DeviceCodeList
|
||||
from twilio.rest.oauth.v1.oauth import OauthList
|
||||
from twilio.rest.oauth.v1.openid_discovery import OpenidDiscoveryList
|
||||
from twilio.rest.oauth.v1.token import TokenList
|
||||
from twilio.rest.oauth.v1.user_info import UserInfoList
|
||||
|
||||
|
||||
class Oauth(OauthBase):
|
||||
@property
|
||||
def oauth(self) -> OauthList:
|
||||
warn(
|
||||
"oauth is deprecated. Use v1.oauth instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.oauth
|
||||
|
||||
@property
|
||||
def device_code(self) -> DeviceCodeList:
|
||||
warn(
|
||||
"device_code is deprecated. Use v1.device_code instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.device_code
|
||||
|
||||
@property
|
||||
def openid_discovery(self) -> OpenidDiscoveryList:
|
||||
warn(
|
||||
"openid_discovery is deprecated. Use v1.openid_discovery instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.openid_discovery
|
||||
|
||||
@property
|
||||
def token(self) -> TokenList:
|
||||
warn(
|
||||
"token is deprecated. Use v1.token instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.token
|
||||
|
||||
@property
|
||||
def user_info(self) -> UserInfoList:
|
||||
warn(
|
||||
"user_info is deprecated. Use v1.user_info instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
return self.v1.user_info
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,74 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Oauth
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
from typing import Optional
|
||||
from twilio.base.version import Version
|
||||
from twilio.base.domain import Domain
|
||||
from twilio.rest.oauth.v1.device_code import DeviceCodeList
|
||||
from twilio.rest.oauth.v1.oauth import OauthList
|
||||
from twilio.rest.oauth.v1.openid_discovery import OpenidDiscoveryList
|
||||
from twilio.rest.oauth.v1.token import TokenList
|
||||
from twilio.rest.oauth.v1.user_info import UserInfoList
|
||||
|
||||
|
||||
class V1(Version):
|
||||
def __init__(self, domain: Domain):
|
||||
"""
|
||||
Initialize the V1 version of Oauth
|
||||
|
||||
:param domain: The Twilio.oauth domain
|
||||
"""
|
||||
super().__init__(domain, "v1")
|
||||
self._device_code: Optional[DeviceCodeList] = None
|
||||
self._oauth: Optional[OauthList] = None
|
||||
self._openid_discovery: Optional[OpenidDiscoveryList] = None
|
||||
self._token: Optional[TokenList] = None
|
||||
self._user_info: Optional[UserInfoList] = None
|
||||
|
||||
@property
|
||||
def device_code(self) -> DeviceCodeList:
|
||||
if self._device_code is None:
|
||||
self._device_code = DeviceCodeList(self)
|
||||
return self._device_code
|
||||
|
||||
@property
|
||||
def oauth(self) -> OauthList:
|
||||
if self._oauth is None:
|
||||
self._oauth = OauthList(self)
|
||||
return self._oauth
|
||||
|
||||
@property
|
||||
def openid_discovery(self) -> OpenidDiscoveryList:
|
||||
if self._openid_discovery is None:
|
||||
self._openid_discovery = OpenidDiscoveryList(self)
|
||||
return self._openid_discovery
|
||||
|
||||
@property
|
||||
def token(self) -> TokenList:
|
||||
if self._token is None:
|
||||
self._token = TokenList(self)
|
||||
return self._token
|
||||
|
||||
@property
|
||||
def user_info(self) -> UserInfoList:
|
||||
if self._user_info is None:
|
||||
self._user_info = UserInfoList(self)
|
||||
return self._user_info
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Oauth.V1>"
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,137 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Oauth
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
from twilio.base import deserialize, serialize, values
|
||||
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
|
||||
|
||||
class DeviceCodeInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
: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.
|
||||
"""
|
||||
|
||||
def __init__(self, version: Version, payload: Dict[str, Any]):
|
||||
super().__init__(version)
|
||||
|
||||
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"))
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
|
||||
return "<Twilio.Oauth.V1.DeviceCodeInstance>"
|
||||
|
||||
|
||||
class DeviceCodeList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the DeviceCodeList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/device/code"
|
||||
|
||||
def create(
|
||||
self,
|
||||
client_sid: str,
|
||||
scopes: List[str],
|
||||
audiences: Union[List[str], object] = values.unset,
|
||||
) -> DeviceCodeInstance:
|
||||
"""
|
||||
Create the DeviceCodeInstance
|
||||
|
||||
:param client_sid: A 34 character string that uniquely identifies this OAuth App.
|
||||
:param scopes: An Array of scopes for authorization request
|
||||
:param audiences: An array of intended audiences for token requests
|
||||
|
||||
:returns: The created DeviceCodeInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"ClientSid": client_sid,
|
||||
"Scopes": serialize.map(scopes, lambda e: e),
|
||||
"Audiences": serialize.map(audiences, lambda e: e),
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return DeviceCodeInstance(self._version, payload)
|
||||
|
||||
async def create_async(
|
||||
self,
|
||||
client_sid: str,
|
||||
scopes: List[str],
|
||||
audiences: Union[List[str], object] = values.unset,
|
||||
) -> DeviceCodeInstance:
|
||||
"""
|
||||
Asynchronously create the DeviceCodeInstance
|
||||
|
||||
:param client_sid: A 34 character string that uniquely identifies this OAuth App.
|
||||
:param scopes: An Array of scopes for authorization request
|
||||
:param audiences: An array of intended audiences for token requests
|
||||
|
||||
:returns: The created DeviceCodeInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"ClientSid": client_sid,
|
||||
"Scopes": serialize.map(scopes, lambda e: e),
|
||||
"Audiences": serialize.map(audiences, lambda e: e),
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return DeviceCodeInstance(self._version, payload)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Oauth.V1.DeviceCodeList>"
|
||||
@@ -0,0 +1,167 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Oauth
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from typing import Any, Dict, Optional
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
|
||||
|
||||
class OauthInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
: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.keys: Optional[Dict[str, object]] = payload.get("keys")
|
||||
self.url: Optional[str] = payload.get("url")
|
||||
|
||||
self._context: Optional[OauthContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "OauthContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: OauthContext for this OauthInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = OauthContext(
|
||||
self._version,
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "OauthInstance":
|
||||
"""
|
||||
Fetch the OauthInstance
|
||||
|
||||
|
||||
:returns: The fetched OauthInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "OauthInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the OauthInstance
|
||||
|
||||
|
||||
:returns: The fetched OauthInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
|
||||
return "<Twilio.Oauth.V1.OauthInstance>"
|
||||
|
||||
|
||||
class OauthContext(InstanceContext):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the OauthContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/certs"
|
||||
|
||||
def fetch(self) -> OauthInstance:
|
||||
"""
|
||||
Fetch the OauthInstance
|
||||
|
||||
|
||||
:returns: The fetched OauthInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return OauthInstance(
|
||||
self._version,
|
||||
payload,
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> OauthInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the OauthInstance
|
||||
|
||||
|
||||
:returns: The fetched OauthInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return OauthInstance(
|
||||
self._version,
|
||||
payload,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
|
||||
return "<Twilio.Oauth.V1.OauthContext>"
|
||||
|
||||
|
||||
class OauthList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the OauthList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
def get(self) -> OauthContext:
|
||||
"""
|
||||
Constructs a OauthContext
|
||||
|
||||
"""
|
||||
return OauthContext(self._version)
|
||||
|
||||
def __call__(self) -> OauthContext:
|
||||
"""
|
||||
Constructs a OauthContext
|
||||
|
||||
"""
|
||||
return OauthContext(self._version)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Oauth.V1.OauthList>"
|
||||
@@ -0,0 +1,199 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Oauth
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from typing import Any, Dict, List, Optional
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
|
||||
|
||||
class OpenidDiscoveryInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
: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.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._context: Optional[OpenidDiscoveryContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "OpenidDiscoveryContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: OpenidDiscoveryContext for this OpenidDiscoveryInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = OpenidDiscoveryContext(
|
||||
self._version,
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "OpenidDiscoveryInstance":
|
||||
"""
|
||||
Fetch the OpenidDiscoveryInstance
|
||||
|
||||
|
||||
:returns: The fetched OpenidDiscoveryInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "OpenidDiscoveryInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the OpenidDiscoveryInstance
|
||||
|
||||
|
||||
:returns: The fetched OpenidDiscoveryInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
|
||||
return "<Twilio.Oauth.V1.OpenidDiscoveryInstance>"
|
||||
|
||||
|
||||
class OpenidDiscoveryContext(InstanceContext):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the OpenidDiscoveryContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/.well-known/openid-configuration"
|
||||
|
||||
def fetch(self) -> OpenidDiscoveryInstance:
|
||||
"""
|
||||
Fetch the OpenidDiscoveryInstance
|
||||
|
||||
|
||||
:returns: The fetched OpenidDiscoveryInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return OpenidDiscoveryInstance(
|
||||
self._version,
|
||||
payload,
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> OpenidDiscoveryInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the OpenidDiscoveryInstance
|
||||
|
||||
|
||||
:returns: The fetched OpenidDiscoveryInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return OpenidDiscoveryInstance(
|
||||
self._version,
|
||||
payload,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
|
||||
return "<Twilio.Oauth.V1.OpenidDiscoveryContext>"
|
||||
|
||||
|
||||
class OpenidDiscoveryList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the OpenidDiscoveryList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
def get(self) -> OpenidDiscoveryContext:
|
||||
"""
|
||||
Constructs a OpenidDiscoveryContext
|
||||
|
||||
"""
|
||||
return OpenidDiscoveryContext(self._version)
|
||||
|
||||
def __call__(self) -> OpenidDiscoveryContext:
|
||||
"""
|
||||
Constructs a OpenidDiscoveryContext
|
||||
|
||||
"""
|
||||
return OpenidDiscoveryContext(self._version)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Oauth.V1.OpenidDiscoveryList>"
|
||||
@@ -0,0 +1,168 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Oauth
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, Optional, Union
|
||||
from twilio.base import deserialize, values
|
||||
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
|
||||
|
||||
class TokenInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
: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.
|
||||
"""
|
||||
|
||||
def __init__(self, version: Version, payload: Dict[str, Any]):
|
||||
super().__init__(version)
|
||||
|
||||
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")
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
|
||||
return "<Twilio.Oauth.V1.TokenInstance>"
|
||||
|
||||
|
||||
class TokenList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the TokenList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/token"
|
||||
|
||||
def create(
|
||||
self,
|
||||
grant_type: str,
|
||||
client_sid: str,
|
||||
client_secret: Union[str, object] = values.unset,
|
||||
code: Union[str, object] = values.unset,
|
||||
code_verifier: Union[str, object] = values.unset,
|
||||
device_code: Union[str, object] = values.unset,
|
||||
refresh_token: Union[str, object] = values.unset,
|
||||
device_id: Union[str, object] = values.unset,
|
||||
) -> TokenInstance:
|
||||
"""
|
||||
Create the TokenInstance
|
||||
|
||||
:param grant_type: Grant type is a credential representing resource owner's authorization which can be used by client to obtain access token.
|
||||
:param client_sid: A 34 character string that uniquely identifies this OAuth App.
|
||||
:param client_secret: The credential for confidential OAuth App.
|
||||
:param code: JWT token related to the authorization code grant type.
|
||||
:param code_verifier: A code which is generation cryptographically.
|
||||
:param device_code: JWT token related to the device code grant type.
|
||||
:param refresh_token: JWT token related to the refresh token grant type.
|
||||
:param device_id: The Id of the device associated with the token (refresh token).
|
||||
|
||||
:returns: The created TokenInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"GrantType": grant_type,
|
||||
"ClientSid": client_sid,
|
||||
"ClientSecret": client_secret,
|
||||
"Code": code,
|
||||
"CodeVerifier": code_verifier,
|
||||
"DeviceCode": device_code,
|
||||
"RefreshToken": refresh_token,
|
||||
"DeviceId": device_id,
|
||||
}
|
||||
)
|
||||
|
||||
payload = self._version.create(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return TokenInstance(self._version, payload)
|
||||
|
||||
async def create_async(
|
||||
self,
|
||||
grant_type: str,
|
||||
client_sid: str,
|
||||
client_secret: Union[str, object] = values.unset,
|
||||
code: Union[str, object] = values.unset,
|
||||
code_verifier: Union[str, object] = values.unset,
|
||||
device_code: Union[str, object] = values.unset,
|
||||
refresh_token: Union[str, object] = values.unset,
|
||||
device_id: Union[str, object] = values.unset,
|
||||
) -> TokenInstance:
|
||||
"""
|
||||
Asynchronously create the TokenInstance
|
||||
|
||||
:param grant_type: Grant type is a credential representing resource owner's authorization which can be used by client to obtain access token.
|
||||
:param client_sid: A 34 character string that uniquely identifies this OAuth App.
|
||||
:param client_secret: The credential for confidential OAuth App.
|
||||
:param code: JWT token related to the authorization code grant type.
|
||||
:param code_verifier: A code which is generation cryptographically.
|
||||
:param device_code: JWT token related to the device code grant type.
|
||||
:param refresh_token: JWT token related to the refresh token grant type.
|
||||
:param device_id: The Id of the device associated with the token (refresh token).
|
||||
|
||||
:returns: The created TokenInstance
|
||||
"""
|
||||
data = values.of(
|
||||
{
|
||||
"GrantType": grant_type,
|
||||
"ClientSid": client_sid,
|
||||
"ClientSecret": client_secret,
|
||||
"Code": code,
|
||||
"CodeVerifier": code_verifier,
|
||||
"DeviceCode": device_code,
|
||||
"RefreshToken": refresh_token,
|
||||
"DeviceId": device_id,
|
||||
}
|
||||
)
|
||||
|
||||
payload = await self._version.create_async(
|
||||
method="POST",
|
||||
uri=self._uri,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return TokenInstance(self._version, payload)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Oauth.V1.TokenList>"
|
||||
@@ -0,0 +1,175 @@
|
||||
r"""
|
||||
This code was generated by
|
||||
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
|
||||
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
|
||||
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
|
||||
|
||||
Twilio - Oauth
|
||||
This is the public Twilio REST API.
|
||||
|
||||
NOTE: This class is auto generated by OpenAPI Generator.
|
||||
https://openapi-generator.tech
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from typing import Any, Dict, Optional
|
||||
from twilio.base.instance_context import InstanceContext
|
||||
from twilio.base.instance_resource import InstanceResource
|
||||
from twilio.base.list_resource import ListResource
|
||||
from twilio.base.version import Version
|
||||
|
||||
|
||||
class UserInfoInstance(InstanceResource):
|
||||
|
||||
"""
|
||||
: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.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._context: Optional[UserInfoContext] = None
|
||||
|
||||
@property
|
||||
def _proxy(self) -> "UserInfoContext":
|
||||
"""
|
||||
Generate an instance context for the instance, the context is capable of
|
||||
performing various actions. All instance actions are proxied to the context
|
||||
|
||||
:returns: UserInfoContext for this UserInfoInstance
|
||||
"""
|
||||
if self._context is None:
|
||||
self._context = UserInfoContext(
|
||||
self._version,
|
||||
)
|
||||
return self._context
|
||||
|
||||
def fetch(self) -> "UserInfoInstance":
|
||||
"""
|
||||
Fetch the UserInfoInstance
|
||||
|
||||
|
||||
:returns: The fetched UserInfoInstance
|
||||
"""
|
||||
return self._proxy.fetch()
|
||||
|
||||
async def fetch_async(self) -> "UserInfoInstance":
|
||||
"""
|
||||
Asynchronous coroutine to fetch the UserInfoInstance
|
||||
|
||||
|
||||
:returns: The fetched UserInfoInstance
|
||||
"""
|
||||
return await self._proxy.fetch_async()
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
|
||||
return "<Twilio.Oauth.V1.UserInfoInstance>"
|
||||
|
||||
|
||||
class UserInfoContext(InstanceContext):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the UserInfoContext
|
||||
|
||||
:param version: Version that contains the resource
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
self._uri = "/userinfo"
|
||||
|
||||
def fetch(self) -> UserInfoInstance:
|
||||
"""
|
||||
Fetch the UserInfoInstance
|
||||
|
||||
|
||||
:returns: The fetched UserInfoInstance
|
||||
"""
|
||||
|
||||
payload = self._version.fetch(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return UserInfoInstance(
|
||||
self._version,
|
||||
payload,
|
||||
)
|
||||
|
||||
async def fetch_async(self) -> UserInfoInstance:
|
||||
"""
|
||||
Asynchronous coroutine to fetch the UserInfoInstance
|
||||
|
||||
|
||||
:returns: The fetched UserInfoInstance
|
||||
"""
|
||||
|
||||
payload = await self._version.fetch_async(
|
||||
method="GET",
|
||||
uri=self._uri,
|
||||
)
|
||||
|
||||
return UserInfoInstance(
|
||||
self._version,
|
||||
payload,
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
|
||||
return "<Twilio.Oauth.V1.UserInfoContext>"
|
||||
|
||||
|
||||
class UserInfoList(ListResource):
|
||||
def __init__(self, version: Version):
|
||||
"""
|
||||
Initialize the UserInfoList
|
||||
|
||||
:param version: Version that contains the resource
|
||||
|
||||
"""
|
||||
super().__init__(version)
|
||||
|
||||
def get(self) -> UserInfoContext:
|
||||
"""
|
||||
Constructs a UserInfoContext
|
||||
|
||||
"""
|
||||
return UserInfoContext(self._version)
|
||||
|
||||
def __call__(self) -> UserInfoContext:
|
||||
"""
|
||||
Constructs a UserInfoContext
|
||||
|
||||
"""
|
||||
return UserInfoContext(self._version)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""
|
||||
Provide a friendly representation
|
||||
|
||||
:returns: Machine friendly representation
|
||||
"""
|
||||
return "<Twilio.Oauth.V1.UserInfoList>"
|
||||
Reference in New Issue
Block a user