|
| 1 | +r""" |
| 2 | + This code was generated by |
| 3 | + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ |
| 4 | + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ |
| 5 | + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ |
| 6 | +
|
| 7 | + Twilio - Numbers |
| 8 | + This is the public Twilio REST API. |
| 9 | +
|
| 10 | + NOTE: This class is auto generated by OpenAPI Generator. |
| 11 | + https://openapi-generator.tech |
| 12 | + Do not edit the class manually. |
| 13 | +""" |
| 14 | + |
| 15 | + |
| 16 | +from datetime import date |
| 17 | +from typing import Any, Dict, List, Optional |
| 18 | +from twilio.base import deserialize |
| 19 | +from twilio.base.instance_context import InstanceContext |
| 20 | +from twilio.base.instance_resource import InstanceResource |
| 21 | +from twilio.base.list_resource import ListResource |
| 22 | +from twilio.base.version import Version |
| 23 | + |
| 24 | + |
| 25 | +class PortingPortInFetchInstance(InstanceResource): |
| 26 | + |
| 27 | + """ |
| 28 | + :ivar port_in_request_sid: The SID of the Port In request. This is a unique identifier of the port in request. |
| 29 | + :ivar url: The URL of this Port In request |
| 30 | + :ivar account_sid: The Account SID that the numbers will be added to after they are ported into Twilio. |
| 31 | + :ivar notification_emails: List of emails for getting notifications about the LOA signing process. Allowed Max 10 emails. |
| 32 | + :ivar target_port_in_date: Minimum number of days in the future (at least 2 days) needs to be established with the Ops team for validation. |
| 33 | + :ivar target_port_in_time_range_start: Minimum hour in the future needs to be established with the Ops team for validation. |
| 34 | + :ivar target_port_in_time_range_end: Maximum hour in the future needs to be established with the Ops team for validation. |
| 35 | + :ivar losing_carrier_information: The information for the losing carrier. |
| 36 | + :ivar phone_numbers: The list of phone numbers to Port in. Phone numbers are in E.164 format (e.g. +16175551212). |
| 37 | + :ivar documents: The list of documents SID referencing a utility bills |
| 38 | + """ |
| 39 | + |
| 40 | + def __init__( |
| 41 | + self, |
| 42 | + version: Version, |
| 43 | + payload: Dict[str, Any], |
| 44 | + port_in_request_sid: Optional[str] = None, |
| 45 | + ): |
| 46 | + super().__init__(version) |
| 47 | + |
| 48 | + self.port_in_request_sid: Optional[str] = payload.get("port_in_request_sid") |
| 49 | + self.url: Optional[str] = payload.get("url") |
| 50 | + self.account_sid: Optional[str] = payload.get("account_sid") |
| 51 | + self.notification_emails: Optional[List[str]] = payload.get( |
| 52 | + "notification_emails" |
| 53 | + ) |
| 54 | + self.target_port_in_date: Optional[date] = deserialize.iso8601_date( |
| 55 | + payload.get("target_port_in_date") |
| 56 | + ) |
| 57 | + self.target_port_in_time_range_start: Optional[str] = payload.get( |
| 58 | + "target_port_in_time_range_start" |
| 59 | + ) |
| 60 | + self.target_port_in_time_range_end: Optional[str] = payload.get( |
| 61 | + "target_port_in_time_range_end" |
| 62 | + ) |
| 63 | + self.losing_carrier_information: Optional[Dict[str, object]] = payload.get( |
| 64 | + "losing_carrier_information" |
| 65 | + ) |
| 66 | + self.phone_numbers: Optional[List[object]] = payload.get("phone_numbers") |
| 67 | + self.documents: Optional[List[str]] = payload.get("documents") |
| 68 | + |
| 69 | + self._solution = { |
| 70 | + "port_in_request_sid": port_in_request_sid or self.port_in_request_sid, |
| 71 | + } |
| 72 | + self._context: Optional[PortingPortInFetchContext] = None |
| 73 | + |
| 74 | + @property |
| 75 | + def _proxy(self) -> "PortingPortInFetchContext": |
| 76 | + """ |
| 77 | + Generate an instance context for the instance, the context is capable of |
| 78 | + performing various actions. All instance actions are proxied to the context |
| 79 | +
|
| 80 | + :returns: PortingPortInFetchContext for this PortingPortInFetchInstance |
| 81 | + """ |
| 82 | + if self._context is None: |
| 83 | + self._context = PortingPortInFetchContext( |
| 84 | + self._version, |
| 85 | + port_in_request_sid=self._solution["port_in_request_sid"], |
| 86 | + ) |
| 87 | + return self._context |
| 88 | + |
| 89 | + def fetch(self) -> "PortingPortInFetchInstance": |
| 90 | + """ |
| 91 | + Fetch the PortingPortInFetchInstance |
| 92 | +
|
| 93 | +
|
| 94 | + :returns: The fetched PortingPortInFetchInstance |
| 95 | + """ |
| 96 | + return self._proxy.fetch() |
| 97 | + |
| 98 | + async def fetch_async(self) -> "PortingPortInFetchInstance": |
| 99 | + """ |
| 100 | + Asynchronous coroutine to fetch the PortingPortInFetchInstance |
| 101 | +
|
| 102 | +
|
| 103 | + :returns: The fetched PortingPortInFetchInstance |
| 104 | + """ |
| 105 | + return await self._proxy.fetch_async() |
| 106 | + |
| 107 | + def __repr__(self) -> str: |
| 108 | + """ |
| 109 | + Provide a friendly representation |
| 110 | +
|
| 111 | + :returns: Machine friendly representation |
| 112 | + """ |
| 113 | + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) |
| 114 | + return "<Twilio.Numbers.V1.PortingPortInFetchInstance {}>".format(context) |
| 115 | + |
| 116 | + |
| 117 | +class PortingPortInFetchContext(InstanceContext): |
| 118 | + def __init__(self, version: Version, port_in_request_sid: str): |
| 119 | + """ |
| 120 | + Initialize the PortingPortInFetchContext |
| 121 | +
|
| 122 | + :param version: Version that contains the resource |
| 123 | + :param port_in_request_sid: The SID of the Port In request. This is a unique identifier of the port in request. |
| 124 | + """ |
| 125 | + super().__init__(version) |
| 126 | + |
| 127 | + # Path Solution |
| 128 | + self._solution = { |
| 129 | + "port_in_request_sid": port_in_request_sid, |
| 130 | + } |
| 131 | + self._uri = "/Porting/PortIn/{port_in_request_sid}".format(**self._solution) |
| 132 | + |
| 133 | + def fetch(self) -> PortingPortInFetchInstance: |
| 134 | + """ |
| 135 | + Fetch the PortingPortInFetchInstance |
| 136 | +
|
| 137 | +
|
| 138 | + :returns: The fetched PortingPortInFetchInstance |
| 139 | + """ |
| 140 | + |
| 141 | + payload = self._version.fetch( |
| 142 | + method="GET", |
| 143 | + uri=self._uri, |
| 144 | + ) |
| 145 | + |
| 146 | + return PortingPortInFetchInstance( |
| 147 | + self._version, |
| 148 | + payload, |
| 149 | + port_in_request_sid=self._solution["port_in_request_sid"], |
| 150 | + ) |
| 151 | + |
| 152 | + async def fetch_async(self) -> PortingPortInFetchInstance: |
| 153 | + """ |
| 154 | + Asynchronous coroutine to fetch the PortingPortInFetchInstance |
| 155 | +
|
| 156 | +
|
| 157 | + :returns: The fetched PortingPortInFetchInstance |
| 158 | + """ |
| 159 | + |
| 160 | + payload = await self._version.fetch_async( |
| 161 | + method="GET", |
| 162 | + uri=self._uri, |
| 163 | + ) |
| 164 | + |
| 165 | + return PortingPortInFetchInstance( |
| 166 | + self._version, |
| 167 | + payload, |
| 168 | + port_in_request_sid=self._solution["port_in_request_sid"], |
| 169 | + ) |
| 170 | + |
| 171 | + def __repr__(self) -> str: |
| 172 | + """ |
| 173 | + Provide a friendly representation |
| 174 | +
|
| 175 | + :returns: Machine friendly representation |
| 176 | + """ |
| 177 | + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) |
| 178 | + return "<Twilio.Numbers.V1.PortingPortInFetchContext {}>".format(context) |
| 179 | + |
| 180 | + |
| 181 | +class PortingPortInFetchList(ListResource): |
| 182 | + def __init__(self, version: Version): |
| 183 | + """ |
| 184 | + Initialize the PortingPortInFetchList |
| 185 | +
|
| 186 | + :param version: Version that contains the resource |
| 187 | +
|
| 188 | + """ |
| 189 | + super().__init__(version) |
| 190 | + |
| 191 | + def get(self, port_in_request_sid: str) -> PortingPortInFetchContext: |
| 192 | + """ |
| 193 | + Constructs a PortingPortInFetchContext |
| 194 | +
|
| 195 | + :param port_in_request_sid: The SID of the Port In request. This is a unique identifier of the port in request. |
| 196 | + """ |
| 197 | + return PortingPortInFetchContext( |
| 198 | + self._version, port_in_request_sid=port_in_request_sid |
| 199 | + ) |
| 200 | + |
| 201 | + def __call__(self, port_in_request_sid: str) -> PortingPortInFetchContext: |
| 202 | + """ |
| 203 | + Constructs a PortingPortInFetchContext |
| 204 | +
|
| 205 | + :param port_in_request_sid: The SID of the Port In request. This is a unique identifier of the port in request. |
| 206 | + """ |
| 207 | + return PortingPortInFetchContext( |
| 208 | + self._version, port_in_request_sid=port_in_request_sid |
| 209 | + ) |
| 210 | + |
| 211 | + def __repr__(self) -> str: |
| 212 | + """ |
| 213 | + Provide a friendly representation |
| 214 | +
|
| 215 | + :returns: Machine friendly representation |
| 216 | + """ |
| 217 | + return "<Twilio.Numbers.V1.PortingPortInFetchList>" |
0 commit comments