|
12 | 12 | Do not edit the class manually.
|
13 | 13 | """
|
14 | 14 |
|
15 |
| - |
16 |
| -from datetime import date, datetime |
17 |
| -from decimal import Decimal |
18 |
| -from typing import Any, Dict, List, Optional, Union, Iterator, AsyncIterator |
19 |
| -from twilio.base import deserialize, serialize, values |
| 15 | +from typing import Any, Dict, Optional, Union |
| 16 | +from twilio.base import values |
20 | 17 |
|
21 | 18 | from twilio.base.instance_resource import InstanceResource
|
22 | 19 | from twilio.base.list_resource import ListResource
|
23 | 20 | from twilio.base.version import Version
|
24 | 21 |
|
25 | 22 |
|
26 |
| - |
27 | 23 | class AuthorizeInstance(InstanceResource):
|
28 |
| - |
29 | 24 | """
|
30 | 25 | :ivar redirect_to: The callback URL
|
31 | 26 | """
|
32 | 27 |
|
33 | 28 | def __init__(self, version: Version, payload: Dict[str, Any]):
|
34 | 29 | super().__init__(version)
|
35 | 30 |
|
36 |
| - |
37 | 31 | self.redirect_to: Optional[str] = payload.get("redirect_to")
|
38 | 32 |
|
39 |
| - |
40 |
| - |
41 |
| - |
42 | 33 | def __repr__(self) -> str:
|
43 | 34 | """
|
44 | 35 | Provide a friendly representation
|
45 | 36 |
|
46 | 37 | :returns: Machine friendly representation
|
47 | 38 | """
|
48 |
| - |
49 |
| - return '<Twilio.PreviewIam.V1.AuthorizeInstance>' |
50 |
| - |
51 | 39 |
|
| 40 | + return "<Twilio.PreviewIam.V1.AuthorizeInstance>" |
52 | 41 |
|
53 | 42 |
|
54 | 43 | class AuthorizeList(ListResource):
|
55 |
| - |
| 44 | + |
56 | 45 | def __init__(self, version: Version):
|
57 | 46 | """
|
58 | 47 | Initialize the AuthorizeList
|
59 | 48 |
|
60 | 49 | :param version: Version that contains the resource
|
61 |
| - |
| 50 | +
|
62 | 51 | """
|
63 | 52 | super().__init__(version)
|
64 | 53 |
|
65 |
| - |
66 |
| - self._uri = '/authorize' |
67 |
| - |
68 |
| - |
69 |
| - |
70 |
| - def fetch(self, response_type: Union[str, object]=values.unset, client_id: Union[str, object]=values.unset, redirect_uri: Union[str, object]=values.unset, scope: Union[str, object]=values.unset, state: Union[str, object]=values.unset) -> AuthorizeInstance: |
| 54 | + self._uri = "/authorize" |
| 55 | + |
| 56 | + def fetch( |
| 57 | + self, |
| 58 | + response_type: Union[str, object] = values.unset, |
| 59 | + client_id: Union[str, object] = values.unset, |
| 60 | + redirect_uri: Union[str, object] = values.unset, |
| 61 | + scope: Union[str, object] = values.unset, |
| 62 | + state: Union[str, object] = values.unset, |
| 63 | + ) -> AuthorizeInstance: |
71 | 64 | """
|
72 | 65 | Asynchronously fetch the AuthorizeInstance
|
73 | 66 |
|
74 | 67 | :param response_type: Response Type:param client_id: The Client Identifier:param redirect_uri: The url to which response will be redirected to:param scope: The scope of the access request:param state: An opaque value which can be used to maintain state between the request and callback
|
75 | 68 | :returns: The fetched AuthorizeInstance
|
76 | 69 | """
|
77 |
| - headers = values.of({ |
78 |
| - 'Content-Type': 'application/x-www-form-urlencoded' |
79 |
| - }) |
80 |
| - |
81 |
| - params = values.of({ |
82 |
| - 'response_type': response_type, |
83 |
| - 'client_id': client_id, |
84 |
| - 'redirect_uri': redirect_uri, |
85 |
| - 'scope': scope, |
86 |
| - 'state': state, |
87 |
| - |
88 |
| - }) |
89 |
| - |
90 |
| - payload = self._version.fetch(method='GET', uri=self._uri, headers=headers, params=params) |
| 70 | + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) |
| 71 | + |
| 72 | + params = values.of( |
| 73 | + { |
| 74 | + "response_type": response_type, |
| 75 | + "client_id": client_id, |
| 76 | + "redirect_uri": redirect_uri, |
| 77 | + "scope": scope, |
| 78 | + "state": state, |
| 79 | + } |
| 80 | + ) |
| 81 | + |
| 82 | + payload = self._version.fetch( |
| 83 | + method="GET", uri=self._uri, headers=headers, params=params |
| 84 | + ) |
91 | 85 |
|
92 | 86 | return AuthorizeInstance(self._version, payload)
|
93 | 87 |
|
94 |
| - async def fetch_async(self, response_type: Union[str, object]=values.unset, client_id: Union[str, object]=values.unset, redirect_uri: Union[str, object]=values.unset, scope: Union[str, object]=values.unset, state: Union[str, object]=values.unset) -> AuthorizeInstance: |
| 88 | + async def fetch_async( |
| 89 | + self, |
| 90 | + response_type: Union[str, object] = values.unset, |
| 91 | + client_id: Union[str, object] = values.unset, |
| 92 | + redirect_uri: Union[str, object] = values.unset, |
| 93 | + scope: Union[str, object] = values.unset, |
| 94 | + state: Union[str, object] = values.unset, |
| 95 | + ) -> AuthorizeInstance: |
95 | 96 | """
|
96 | 97 | Asynchronously fetch the AuthorizeInstance
|
97 | 98 |
|
98 | 99 | :param response_type: Response Type:param client_id: The Client Identifier:param redirect_uri: The url to which response will be redirected to:param scope: The scope of the access request:param state: An opaque value which can be used to maintain state between the request and callback
|
99 | 100 | :returns: The fetched AuthorizeInstance
|
100 | 101 | """
|
101 |
| - headers = values.of({ |
102 |
| - 'Content-Type': 'application/x-www-form-urlencoded' |
103 |
| - }) |
104 |
| - |
105 |
| - params = values.of({ |
106 |
| - 'response_type': response_type, |
107 |
| - 'client_id': client_id, |
108 |
| - 'redirect_uri': redirect_uri, |
109 |
| - 'scope': scope, |
110 |
| - 'state': state, |
111 |
| - |
112 |
| - }) |
113 |
| - |
114 |
| - payload = await self._version.fetch_async(method='GET', uri=self._uri, headers=headers, params=params) |
| 102 | + headers = values.of({"Content-Type": "application/x-www-form-urlencoded"}) |
| 103 | + |
| 104 | + params = values.of( |
| 105 | + { |
| 106 | + "response_type": response_type, |
| 107 | + "client_id": client_id, |
| 108 | + "redirect_uri": redirect_uri, |
| 109 | + "scope": scope, |
| 110 | + "state": state, |
| 111 | + } |
| 112 | + ) |
| 113 | + |
| 114 | + payload = await self._version.fetch_async( |
| 115 | + method="GET", uri=self._uri, headers=headers, params=params |
| 116 | + ) |
115 | 117 |
|
116 | 118 | return AuthorizeInstance(self._version, payload)
|
117 | 119 |
|
118 |
| - |
119 |
| - |
120 | 120 | def __repr__(self) -> str:
|
121 | 121 | """
|
122 | 122 | Provide a friendly representation
|
123 | 123 |
|
124 | 124 | :returns: Machine friendly representation
|
125 | 125 | """
|
126 |
| - return '<Twilio.PreviewIam.V1.AuthorizeList>' |
127 |
| - |
| 126 | + return "<Twilio.PreviewIam.V1.AuthorizeList>" |
0 commit comments