|
| 1 | +# coding: utf-8 |
| 2 | + |
| 3 | +""" |
| 4 | + Coinbase Platform API |
| 5 | +
|
| 6 | + This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. |
| 7 | +
|
| 8 | + The version of the OpenAPI document: 0.0.1-alpha |
| 9 | + Generated by OpenAPI Generator (https://openapi-generator.tech) |
| 10 | +
|
| 11 | + Do not edit the class manually. |
| 12 | +""" # noqa: E501 |
| 13 | + |
| 14 | +import warnings |
| 15 | +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt |
| 16 | +from typing import Any, Dict, List, Optional, Tuple, Union |
| 17 | +from typing_extensions import Annotated |
| 18 | + |
| 19 | +from pydantic import Field, StrictInt, StrictStr |
| 20 | +from typing import Optional |
| 21 | +from typing_extensions import Annotated |
| 22 | +from cdp.client.models.onchain_name_list import OnchainNameList |
| 23 | + |
| 24 | +from cdp.client.api_client import ApiClient, RequestSerialized |
| 25 | +from cdp.client.api_response import ApiResponse |
| 26 | +from cdp.client.rest import RESTResponseType |
| 27 | + |
| 28 | + |
| 29 | +class OnchainIdentityApi: |
| 30 | + """NOTE: This class is auto generated by OpenAPI Generator |
| 31 | + Ref: https://openapi-generator.tech |
| 32 | +
|
| 33 | + Do not edit the class manually. |
| 34 | + """ |
| 35 | + |
| 36 | + def __init__(self, api_client=None) -> None: |
| 37 | + if api_client is None: |
| 38 | + api_client = ApiClient.get_default() |
| 39 | + self.api_client = api_client |
| 40 | + |
| 41 | + |
| 42 | + @validate_call |
| 43 | + def resolve_identity_by_address( |
| 44 | + self, |
| 45 | + network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network")], |
| 46 | + address_id: Annotated[StrictStr, Field(description="The ID of the address to fetch the identity for")], |
| 47 | + limit: Annotated[Optional[StrictInt], Field(description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.")] = None, |
| 48 | + page: Annotated[Optional[Annotated[str, Field(strict=True, max_length=5000)]], Field(description="A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.")] = None, |
| 49 | + _request_timeout: Union[ |
| 50 | + None, |
| 51 | + Annotated[StrictFloat, Field(gt=0)], |
| 52 | + Tuple[ |
| 53 | + Annotated[StrictFloat, Field(gt=0)], |
| 54 | + Annotated[StrictFloat, Field(gt=0)] |
| 55 | + ] |
| 56 | + ] = None, |
| 57 | + _request_auth: Optional[Dict[StrictStr, Any]] = None, |
| 58 | + _content_type: Optional[StrictStr] = None, |
| 59 | + _headers: Optional[Dict[StrictStr, Any]] = None, |
| 60 | + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, |
| 61 | + ) -> OnchainNameList: |
| 62 | + """Obtains onchain identity for an address on a specific network |
| 63 | +
|
| 64 | + Obtains onchain identity for an address on a specific network |
| 65 | +
|
| 66 | + :param network_id: The ID of the blockchain network (required) |
| 67 | + :type network_id: str |
| 68 | + :param address_id: The ID of the address to fetch the identity for (required) |
| 69 | + :type address_id: str |
| 70 | + :param limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. |
| 71 | + :type limit: int |
| 72 | + :param page: A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. |
| 73 | + :type page: str |
| 74 | + :param _request_timeout: timeout setting for this request. If one |
| 75 | + number provided, it will be total request |
| 76 | + timeout. It can also be a pair (tuple) of |
| 77 | + (connection, read) timeouts. |
| 78 | + :type _request_timeout: int, tuple(int, int), optional |
| 79 | + :param _request_auth: set to override the auth_settings for an a single |
| 80 | + request; this effectively ignores the |
| 81 | + authentication in the spec for a single request. |
| 82 | + :type _request_auth: dict, optional |
| 83 | + :param _content_type: force content-type for the request. |
| 84 | + :type _content_type: str, Optional |
| 85 | + :param _headers: set to override the headers for a single |
| 86 | + request; this effectively ignores the headers |
| 87 | + in the spec for a single request. |
| 88 | + :type _headers: dict, optional |
| 89 | + :param _host_index: set to override the host_index for a single |
| 90 | + request; this effectively ignores the host_index |
| 91 | + in the spec for a single request. |
| 92 | + :type _host_index: int, optional |
| 93 | + :return: Returns the result object. |
| 94 | + """ # noqa: E501 |
| 95 | + |
| 96 | + _param = self._resolve_identity_by_address_serialize( |
| 97 | + network_id=network_id, |
| 98 | + address_id=address_id, |
| 99 | + limit=limit, |
| 100 | + page=page, |
| 101 | + _request_auth=_request_auth, |
| 102 | + _content_type=_content_type, |
| 103 | + _headers=_headers, |
| 104 | + _host_index=_host_index |
| 105 | + ) |
| 106 | + |
| 107 | + _response_types_map: Dict[str, Optional[str]] = { |
| 108 | + '200': "OnchainNameList", |
| 109 | + } |
| 110 | + response_data = self.api_client.call_api( |
| 111 | + *_param, |
| 112 | + _request_timeout=_request_timeout |
| 113 | + ) |
| 114 | + response_data.read() |
| 115 | + return self.api_client.response_deserialize( |
| 116 | + response_data=response_data, |
| 117 | + response_types_map=_response_types_map, |
| 118 | + ).data |
| 119 | + |
| 120 | + |
| 121 | + @validate_call |
| 122 | + def resolve_identity_by_address_with_http_info( |
| 123 | + self, |
| 124 | + network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network")], |
| 125 | + address_id: Annotated[StrictStr, Field(description="The ID of the address to fetch the identity for")], |
| 126 | + limit: Annotated[Optional[StrictInt], Field(description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.")] = None, |
| 127 | + page: Annotated[Optional[Annotated[str, Field(strict=True, max_length=5000)]], Field(description="A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.")] = None, |
| 128 | + _request_timeout: Union[ |
| 129 | + None, |
| 130 | + Annotated[StrictFloat, Field(gt=0)], |
| 131 | + Tuple[ |
| 132 | + Annotated[StrictFloat, Field(gt=0)], |
| 133 | + Annotated[StrictFloat, Field(gt=0)] |
| 134 | + ] |
| 135 | + ] = None, |
| 136 | + _request_auth: Optional[Dict[StrictStr, Any]] = None, |
| 137 | + _content_type: Optional[StrictStr] = None, |
| 138 | + _headers: Optional[Dict[StrictStr, Any]] = None, |
| 139 | + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, |
| 140 | + ) -> ApiResponse[OnchainNameList]: |
| 141 | + """Obtains onchain identity for an address on a specific network |
| 142 | +
|
| 143 | + Obtains onchain identity for an address on a specific network |
| 144 | +
|
| 145 | + :param network_id: The ID of the blockchain network (required) |
| 146 | + :type network_id: str |
| 147 | + :param address_id: The ID of the address to fetch the identity for (required) |
| 148 | + :type address_id: str |
| 149 | + :param limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. |
| 150 | + :type limit: int |
| 151 | + :param page: A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. |
| 152 | + :type page: str |
| 153 | + :param _request_timeout: timeout setting for this request. If one |
| 154 | + number provided, it will be total request |
| 155 | + timeout. It can also be a pair (tuple) of |
| 156 | + (connection, read) timeouts. |
| 157 | + :type _request_timeout: int, tuple(int, int), optional |
| 158 | + :param _request_auth: set to override the auth_settings for an a single |
| 159 | + request; this effectively ignores the |
| 160 | + authentication in the spec for a single request. |
| 161 | + :type _request_auth: dict, optional |
| 162 | + :param _content_type: force content-type for the request. |
| 163 | + :type _content_type: str, Optional |
| 164 | + :param _headers: set to override the headers for a single |
| 165 | + request; this effectively ignores the headers |
| 166 | + in the spec for a single request. |
| 167 | + :type _headers: dict, optional |
| 168 | + :param _host_index: set to override the host_index for a single |
| 169 | + request; this effectively ignores the host_index |
| 170 | + in the spec for a single request. |
| 171 | + :type _host_index: int, optional |
| 172 | + :return: Returns the result object. |
| 173 | + """ # noqa: E501 |
| 174 | + |
| 175 | + _param = self._resolve_identity_by_address_serialize( |
| 176 | + network_id=network_id, |
| 177 | + address_id=address_id, |
| 178 | + limit=limit, |
| 179 | + page=page, |
| 180 | + _request_auth=_request_auth, |
| 181 | + _content_type=_content_type, |
| 182 | + _headers=_headers, |
| 183 | + _host_index=_host_index |
| 184 | + ) |
| 185 | + |
| 186 | + _response_types_map: Dict[str, Optional[str]] = { |
| 187 | + '200': "OnchainNameList", |
| 188 | + } |
| 189 | + response_data = self.api_client.call_api( |
| 190 | + *_param, |
| 191 | + _request_timeout=_request_timeout |
| 192 | + ) |
| 193 | + response_data.read() |
| 194 | + return self.api_client.response_deserialize( |
| 195 | + response_data=response_data, |
| 196 | + response_types_map=_response_types_map, |
| 197 | + ) |
| 198 | + |
| 199 | + |
| 200 | + @validate_call |
| 201 | + def resolve_identity_by_address_without_preload_content( |
| 202 | + self, |
| 203 | + network_id: Annotated[StrictStr, Field(description="The ID of the blockchain network")], |
| 204 | + address_id: Annotated[StrictStr, Field(description="The ID of the address to fetch the identity for")], |
| 205 | + limit: Annotated[Optional[StrictInt], Field(description="A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.")] = None, |
| 206 | + page: Annotated[Optional[Annotated[str, Field(strict=True, max_length=5000)]], Field(description="A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.")] = None, |
| 207 | + _request_timeout: Union[ |
| 208 | + None, |
| 209 | + Annotated[StrictFloat, Field(gt=0)], |
| 210 | + Tuple[ |
| 211 | + Annotated[StrictFloat, Field(gt=0)], |
| 212 | + Annotated[StrictFloat, Field(gt=0)] |
| 213 | + ] |
| 214 | + ] = None, |
| 215 | + _request_auth: Optional[Dict[StrictStr, Any]] = None, |
| 216 | + _content_type: Optional[StrictStr] = None, |
| 217 | + _headers: Optional[Dict[StrictStr, Any]] = None, |
| 218 | + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, |
| 219 | + ) -> RESTResponseType: |
| 220 | + """Obtains onchain identity for an address on a specific network |
| 221 | +
|
| 222 | + Obtains onchain identity for an address on a specific network |
| 223 | +
|
| 224 | + :param network_id: The ID of the blockchain network (required) |
| 225 | + :type network_id: str |
| 226 | + :param address_id: The ID of the address to fetch the identity for (required) |
| 227 | + :type address_id: str |
| 228 | + :param limit: A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. |
| 229 | + :type limit: int |
| 230 | + :param page: A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. |
| 231 | + :type page: str |
| 232 | + :param _request_timeout: timeout setting for this request. If one |
| 233 | + number provided, it will be total request |
| 234 | + timeout. It can also be a pair (tuple) of |
| 235 | + (connection, read) timeouts. |
| 236 | + :type _request_timeout: int, tuple(int, int), optional |
| 237 | + :param _request_auth: set to override the auth_settings for an a single |
| 238 | + request; this effectively ignores the |
| 239 | + authentication in the spec for a single request. |
| 240 | + :type _request_auth: dict, optional |
| 241 | + :param _content_type: force content-type for the request. |
| 242 | + :type _content_type: str, Optional |
| 243 | + :param _headers: set to override the headers for a single |
| 244 | + request; this effectively ignores the headers |
| 245 | + in the spec for a single request. |
| 246 | + :type _headers: dict, optional |
| 247 | + :param _host_index: set to override the host_index for a single |
| 248 | + request; this effectively ignores the host_index |
| 249 | + in the spec for a single request. |
| 250 | + :type _host_index: int, optional |
| 251 | + :return: Returns the result object. |
| 252 | + """ # noqa: E501 |
| 253 | + |
| 254 | + _param = self._resolve_identity_by_address_serialize( |
| 255 | + network_id=network_id, |
| 256 | + address_id=address_id, |
| 257 | + limit=limit, |
| 258 | + page=page, |
| 259 | + _request_auth=_request_auth, |
| 260 | + _content_type=_content_type, |
| 261 | + _headers=_headers, |
| 262 | + _host_index=_host_index |
| 263 | + ) |
| 264 | + |
| 265 | + _response_types_map: Dict[str, Optional[str]] = { |
| 266 | + '200': "OnchainNameList", |
| 267 | + } |
| 268 | + response_data = self.api_client.call_api( |
| 269 | + *_param, |
| 270 | + _request_timeout=_request_timeout |
| 271 | + ) |
| 272 | + return response_data.response |
| 273 | + |
| 274 | + |
| 275 | + def _resolve_identity_by_address_serialize( |
| 276 | + self, |
| 277 | + network_id, |
| 278 | + address_id, |
| 279 | + limit, |
| 280 | + page, |
| 281 | + _request_auth, |
| 282 | + _content_type, |
| 283 | + _headers, |
| 284 | + _host_index, |
| 285 | + ) -> RequestSerialized: |
| 286 | + |
| 287 | + _host = None |
| 288 | + |
| 289 | + _collection_formats: Dict[str, str] = { |
| 290 | + } |
| 291 | + |
| 292 | + _path_params: Dict[str, str] = {} |
| 293 | + _query_params: List[Tuple[str, str]] = [] |
| 294 | + _header_params: Dict[str, Optional[str]] = _headers or {} |
| 295 | + _form_params: List[Tuple[str, str]] = [] |
| 296 | + _files: Dict[str, Union[str, bytes]] = {} |
| 297 | + _body_params: Optional[bytes] = None |
| 298 | + |
| 299 | + # process the path parameters |
| 300 | + if network_id is not None: |
| 301 | + _path_params['network_id'] = network_id |
| 302 | + if address_id is not None: |
| 303 | + _path_params['address_id'] = address_id |
| 304 | + # process the query parameters |
| 305 | + if limit is not None: |
| 306 | + |
| 307 | + _query_params.append(('limit', limit)) |
| 308 | + |
| 309 | + if page is not None: |
| 310 | + |
| 311 | + _query_params.append(('page', page)) |
| 312 | + |
| 313 | + # process the header parameters |
| 314 | + # process the form parameters |
| 315 | + # process the body parameter |
| 316 | + |
| 317 | + |
| 318 | + # set the HTTP header `Accept` |
| 319 | + if 'Accept' not in _header_params: |
| 320 | + _header_params['Accept'] = self.api_client.select_header_accept( |
| 321 | + [ |
| 322 | + 'application/json' |
| 323 | + ] |
| 324 | + ) |
| 325 | + |
| 326 | + |
| 327 | + # authentication setting |
| 328 | + _auth_settings: List[str] = [ |
| 329 | + ] |
| 330 | + |
| 331 | + return self.api_client.param_serialize( |
| 332 | + method='GET', |
| 333 | + resource_path='/v1/networks/{network_id}/addresses/{address_id}/identity', |
| 334 | + path_params=_path_params, |
| 335 | + query_params=_query_params, |
| 336 | + header_params=_header_params, |
| 337 | + body=_body_params, |
| 338 | + post_params=_form_params, |
| 339 | + files=_files, |
| 340 | + auth_settings=_auth_settings, |
| 341 | + collection_formats=_collection_formats, |
| 342 | + _host=_host, |
| 343 | + _request_auth=_request_auth |
| 344 | + ) |
| 345 | + |
| 346 | + |
0 commit comments