def upload_file( self: api_client.Api, body: typing.Union[SchemaForRequestBodyMultipartFormData, Unset] = unset, content_type: str = 'multipart/form-data', accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, skip_deserialization: bool = False, ) -> typing.Union[ApiResponseFor200, api_client.ApiResponseWithoutDeserialization]: """ uploads a file using multipart/form-data :param skip_deserialization: If true then api_response.response will be set but api_response.body and api_response.headers will not be deserialized into schema class instances """ _headers = HTTPHeaderDict() # TODO add cookie handling if accept_content_types: for accept_content_type in accept_content_types: _headers.add('Accept', accept_content_type) _fields = None _body = None if body is not unset: serialized_data = request_body_body.serialize(body, content_type) _headers.add('Content-Type', content_type) if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] response = self.api_client.call_api( resource_path=_path, method=_method, headers=_headers, fields=_fields, body=_body, stream=stream, timeout=timeout, ) if skip_deserialization: api_response = api_client.ApiResponseWithoutDeserialization( response=response) else: response_for_status = _status_code_to_response.get( str(response.status)) if response_for_status: api_response = response_for_status.deserialize( response, self.api_client.configuration) else: api_response = api_client.ApiResponseWithoutDeserialization( response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException(api_response=api_response) return api_response
def login_user( self: api_client.Api, query_params: RequestQueryParams = frozendict(), accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, skip_deserialization: bool = False, ) -> typing.Union[ApiResponseFor200, api_client.ApiResponseWithoutDeserialization]: """ Logs user into the system :param skip_deserialization: If true then api_response.response will be set but api_response.body and api_response.headers will not be deserialized into schema class instances """ self._verify_typed_dict_inputs(RequestQueryParams, query_params) _query_params = [] for parameter in ( request_query_username, request_query_password, ): parameter_data = query_params.get(parameter.name, unset) if parameter_data is unset: continue serialized_data = parameter.serialize(parameter_data) _query_params.extend(serialized_data) _headers = HTTPHeaderDict() # TODO add cookie handling if accept_content_types: for accept_content_type in accept_content_types: _headers.add('Accept', accept_content_type) response = self.api_client.call_api( resource_path=_path, method=_method, query_params=tuple(_query_params), headers=_headers, stream=stream, timeout=timeout, ) if skip_deserialization: api_response = api_client.ApiResponseWithoutDeserialization( response=response) else: response_for_status = _status_code_to_response.get( str(response.status)) if response_for_status: api_response = response_for_status.deserialize( response, self.api_client.configuration) else: api_response = api_client.ApiResponseWithoutDeserialization( response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException(api_response=api_response) return api_response
def classname( self: api_client.Api, body: typing.Union[SchemaForRequestBodyApplicationJson], content_type: str = 'application/json', accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, skip_deserialization: bool = False, ) -> typing.Union[ ApiResponseFor200, api_client.ApiResponseWithoutDeserialization ]: """ To test class name in snake case :param skip_deserialization: If true then api_response.response will be set but api_response.body and api_response.headers will not be deserialized into schema class instances """ _headers = HTTPHeaderDict() # TODO add cookie handling if accept_content_types: for accept_content_type in accept_content_types: _headers.add('Accept', accept_content_type) if body is unset: raise exceptions.ApiValueError( 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None serialized_data = request_body_client.serialize(body, content_type) _headers.add('Content-Type', content_type) if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] response = self.api_client.call_api( resource_path=_path, method=_method, headers=_headers, fields=_fields, body=_body, auth_settings=_auth, stream=stream, timeout=timeout, ) if skip_deserialization: api_response = api_client.ApiResponseWithoutDeserialization(response=response) else: response_for_status = _status_code_to_response.get(str(response.status)) if response_for_status: api_response = response_for_status.deserialize(response, self.api_client.configuration) else: api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException(api_response=api_response) return api_response
def query_parameter_collection_format( self: api_client.Api, query_params: RequestQueryParams = frozendict(), stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, skip_deserialization: bool = False, ) -> typing.Union[ApiResponseFor200, api_client.ApiResponseWithoutDeserialization]: """ :param skip_deserialization: If true then api_response.response will be set but api_response.body and api_response.headers will not be deserialized into schema class instances """ self._verify_typed_dict_inputs(RequestQueryParams, query_params) _query_params = [] for parameter in ( request_query_pipe, request_query_ioutil, request_query_http, request_query_url, request_query_context, request_query_ref_param, ): parameter_data = query_params.get(parameter.name, unset) if parameter_data is unset: continue serialized_data = parameter.serialize(parameter_data) _query_params.extend(serialized_data) # TODO add cookie handling response = self.api_client.call_api( resource_path=_path, method=_method, query_params=tuple(_query_params), stream=stream, timeout=timeout, ) if skip_deserialization: api_response = api_client.ApiResponseWithoutDeserialization( response=response) else: response_for_status = _status_code_to_response.get( str(response.status)) if response_for_status: api_response = response_for_status.deserialize( response, self.api_client.configuration) else: api_response = api_client.ApiResponseWithoutDeserialization( response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException(api_response=api_response) return api_response
def endpoint_parameters( self: api_client.Api, body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, Unset] = unset, content_type: str = 'application/x-www-form-urlencoded', stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, skip_deserialization: bool = False, ) -> typing.Union[api_client.ApiResponseWithoutDeserialization]: """ Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 :param skip_deserialization: If true then api_response.response will be set but api_response.body and api_response.headers will not be deserialized into schema class instances """ _headers = HTTPHeaderDict() # TODO add cookie handling _fields = None _body = None if body is not unset: serialized_data = request_body_body.serialize(body, content_type) _headers.add('Content-Type', content_type) if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] response = self.api_client.call_api( resource_path=_path, method=_method, headers=_headers, fields=_fields, body=_body, auth_settings=_auth, stream=stream, timeout=timeout, ) if skip_deserialization: api_response = api_client.ApiResponseWithoutDeserialization( response=response) else: response_for_status = _status_code_to_response.get( str(response.status)) if response_for_status: api_response = response_for_status.deserialize( response, self.api_client.configuration) else: api_response = api_client.ApiResponseWithoutDeserialization( response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException(api_response=api_response) return api_response
def delete_coffee( self: api_client.Api, path_params: RequestPathParams = frozendict(), stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, skip_deserialization: bool = False, ) -> typing.Union[ ApiResponseFor200, ApiResponseForDefault, api_client.ApiResponseWithoutDeserialization ]: """ Delete coffee :param skip_deserialization: If true then api_response.response will be set but api_response.body and api_response.headers will not be deserialized into schema class instances """ self._verify_typed_dict_inputs(RequestPathParams, path_params) _path_params = {} for parameter in ( request_path_id, ): parameter_data = path_params.get(parameter.name, unset) if parameter_data is unset: continue serialized_data = parameter.serialize(parameter_data) _path_params.update(serialized_data) # TODO add cookie handling response = self.api_client.call_api( resource_path=_path, method=_method, path_params=_path_params, stream=stream, timeout=timeout, ) if skip_deserialization: api_response = api_client.ApiResponseWithoutDeserialization(response=response) else: response_for_status = _status_code_to_response.get(str(response.status)) if response_for_status: api_response = response_for_status.deserialize(response, self.api_client.configuration) else: default_response = _status_code_to_response.get('default') if default_response: api_response = default_response.deserialize(response, self.api_client.configuration) else: api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException(api_response=api_response) return api_response
def foo_get( self: api_client.Api, accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, skip_deserialization: bool = False, ) -> typing.Union[ApiResponseForDefault, api_client.ApiResponseWithoutDeserialization]: """ :param skip_deserialization: If true then api_response.response will be set but api_response.body and api_response.headers will not be deserialized into schema class instances """ _headers = HTTPHeaderDict() # TODO add cookie handling if accept_content_types: for accept_content_type in accept_content_types: _headers.add('Accept', accept_content_type) response = self.api_client.call_api( resource_path=_path, method=_method, headers=_headers, stream=stream, timeout=timeout, ) if skip_deserialization: api_response = api_client.ApiResponseWithoutDeserialization( response=response) else: response_for_status = _status_code_to_response.get( str(response.status)) if response_for_status: api_response = response_for_status.deserialize( response, self.api_client.configuration) else: default_response = _status_code_to_response.get('default') if default_response: api_response = default_response.deserialize( response, self.api_client.configuration) else: api_response = api_client.ApiResponseWithoutDeserialization( response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException(api_response=api_response) return api_response
def logout_user( self: api_client.Api, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, skip_deserialization: bool = False, ) -> typing.Union[ApiResponseForDefault, api_client.ApiResponseWithoutDeserialization]: """ Logs out current logged in user session :param skip_deserialization: If true then api_response.response will be set but api_response.body and api_response.headers will not be deserialized into schema class instances """ # TODO add cookie handling response = self.api_client.call_api( resource_path=_path, method=_method, stream=stream, timeout=timeout, ) if skip_deserialization: api_response = api_client.ApiResponseWithoutDeserialization( response=response) else: response_for_status = _status_code_to_response.get( str(response.status)) if response_for_status: api_response = response_for_status.deserialize( response, self.api_client.configuration) else: default_response = _status_code_to_response.get('default') if default_response: api_response = default_response.deserialize( response, self.api_client.configuration) else: api_response = api_client.ApiResponseWithoutDeserialization( response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException(api_response=api_response) return api_response
def update_user( self: api_client.Api, body: typing.Union[SchemaForRequestBodyApplicationJson], path_params: RequestPathParams = frozendict(), content_type: str = 'application/json', stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, skip_deserialization: bool = False, ) -> typing.Union[ api_client.ApiResponseWithoutDeserialization ]: """ Updated user :param skip_deserialization: If true then api_response.response will be set but api_response.body and api_response.headers will not be deserialized into schema class instances """ self._verify_typed_dict_inputs(RequestPathParams, path_params) _path_params = {} for parameter in ( request_path_username, ): parameter_data = path_params.get(parameter.name, unset) if parameter_data is unset: continue serialized_data = parameter.serialize(parameter_data) _path_params.update(serialized_data) _headers = HTTPHeaderDict() # TODO add cookie handling if body is unset: raise exceptions.ApiValueError( 'The required body parameter has an invalid value of: unset. Set a valid value instead') _fields = None _body = None serialized_data = request_body_user.serialize(body, content_type) _headers.add('Content-Type', content_type) if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] response = self.api_client.call_api( resource_path=_path, method=_method, path_params=_path_params, headers=_headers, fields=_fields, body=_body, stream=stream, timeout=timeout, ) if skip_deserialization: api_response = api_client.ApiResponseWithoutDeserialization(response=response) else: response_for_status = _status_code_to_response.get(str(response.status)) if response_for_status: api_response = response_for_status.deserialize(response, self.api_client.configuration) else: api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException(api_response=api_response) return api_response
def update_pet_with_form( self: api_client.Api, body: typing.Union[SchemaForRequestBodyApplicationXWwwFormUrlencoded, Unset] = unset, path_params: RequestPathParams = frozendict(), content_type: str = 'application/x-www-form-urlencoded', stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, skip_deserialization: bool = False, ) -> typing.Union[ api_client.ApiResponseWithoutDeserialization ]: """ Updates a pet in the store with form data :param skip_deserialization: If true then api_response.response will be set but api_response.body and api_response.headers will not be deserialized into schema class instances """ self._verify_typed_dict_inputs(RequestPathParams, path_params) _path_params = {} for parameter in ( request_path_pet_id, ): parameter_data = path_params.get(parameter.name, unset) if parameter_data is unset: continue serialized_data = parameter.serialize(parameter_data) _path_params.update(serialized_data) _headers = HTTPHeaderDict() # TODO add cookie handling _fields = None _body = None if body is not unset: serialized_data = request_body_body.serialize(body, content_type) _headers.add('Content-Type', content_type) if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] response = self.api_client.call_api( resource_path=_path, method=_method, path_params=_path_params, headers=_headers, fields=_fields, body=_body, auth_settings=_auth, stream=stream, timeout=timeout, ) if skip_deserialization: api_response = api_client.ApiResponseWithoutDeserialization(response=response) else: response_for_status = _status_code_to_response.get(str(response.status)) if response_for_status: api_response = response_for_status.deserialize(response, self.api_client.configuration) else: api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException(api_response=api_response) return api_response
def parameter_collisions( self: api_client.Api, body: typing.Union[SchemaForRequestBodyApplicationJson, Unset] = unset, query_params: RequestQueryParams = frozendict(), header_params: RequestHeaderParams = frozendict(), path_params: RequestPathParams = frozendict(), cookie_params: RequestCookieParams = frozendict(), content_type: str = 'application/json', accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, skip_deserialization: bool = False, ) -> typing.Union[ApiResponseFor200, api_client.ApiResponseWithoutDeserialization]: """ parameter collision case :param skip_deserialization: If true then api_response.response will be set but api_response.body and api_response.headers will not be deserialized into schema class instances """ self._verify_typed_dict_inputs(RequestQueryParams, query_params) self._verify_typed_dict_inputs(RequestHeaderParams, header_params) self._verify_typed_dict_inputs(RequestPathParams, path_params) self._verify_typed_dict_inputs(RequestCookieParams, cookie_params) _path_params = {} for parameter in ( request_path__3, request_path_a_b5, request_path_ab2, request_path__self3, request_path_a_b6, ): parameter_data = path_params.get(parameter.name, unset) if parameter_data is unset: continue serialized_data = parameter.serialize(parameter_data) _path_params.update(serialized_data) _query_params = [] for parameter in ( request_query__1, request_query_a_b, request_query_ab, request_query__self, request_query_a_b2, ): parameter_data = query_params.get(parameter.name, unset) if parameter_data is unset: continue serialized_data = parameter.serialize(parameter_data) _query_params.extend(serialized_data) _headers = HTTPHeaderDict() for parameter in ( request_header__2, request_header_a_b3, request_header__self2, request_header_a_b4, ): parameter_data = header_params.get(parameter.name, unset) if parameter_data is unset: continue serialized_data = parameter.serialize(parameter_data) _headers.extend(serialized_data) # TODO add cookie handling if accept_content_types: for accept_content_type in accept_content_types: _headers.add('Accept', accept_content_type) _fields = None _body = None if body is not unset: serialized_data = request_body_body.serialize(body, content_type) _headers.add('Content-Type', content_type) if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] response = self.api_client.call_api( resource_path=_path, method=_method, path_params=_path_params, query_params=tuple(_query_params), headers=_headers, fields=_fields, body=_body, stream=stream, timeout=timeout, ) if skip_deserialization: api_response = api_client.ApiResponseWithoutDeserialization( response=response) else: response_for_status = _status_code_to_response.get( str(response.status)) if response_for_status: api_response = response_for_status.deserialize( response, self.api_client.configuration) else: api_response = api_client.ApiResponseWithoutDeserialization( response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException(api_response=api_response) return api_response
def group_parameters( self: api_client.Api, query_params: RequestQueryParams = frozendict(), header_params: RequestHeaderParams = frozendict(), stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, skip_deserialization: bool = False, ) -> typing.Union[api_client.ApiResponseWithoutDeserialization]: """ Fake endpoint to test group parameters (optional) :param skip_deserialization: If true then api_response.response will be set but api_response.body and api_response.headers will not be deserialized into schema class instances """ self._verify_typed_dict_inputs(RequestQueryParams, query_params) self._verify_typed_dict_inputs(RequestHeaderParams, header_params) _query_params = [] for parameter in ( request_query_required_string_group, request_query_required_int64_group, request_query_string_group, request_query_int64_group, ): parameter_data = query_params.get(parameter.name, unset) if parameter_data is unset: continue serialized_data = parameter.serialize(parameter_data) _query_params.extend(serialized_data) _headers = HTTPHeaderDict() for parameter in ( request_header_required_boolean_group, request_header_boolean_group, ): parameter_data = header_params.get(parameter.name, unset) if parameter_data is unset: continue serialized_data = parameter.serialize(parameter_data) _headers.extend(serialized_data) # TODO add cookie handling response = self.api_client.call_api( resource_path=_path, method=_method, query_params=tuple(_query_params), headers=_headers, auth_settings=_auth, stream=stream, timeout=timeout, ) if skip_deserialization: api_response = api_client.ApiResponseWithoutDeserialization( response=response) else: response_for_status = _status_code_to_response.get( str(response.status)) if response_for_status: api_response = response_for_status.deserialize( response, self.api_client.configuration) else: api_response = api_client.ApiResponseWithoutDeserialization( response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException(api_response=api_response) return api_response
def upload_file( self: api_client.Api, body: typing.Union[SchemaForRequestBodyMultipartFormData, Unset] = unset, path_params: RequestPathParams = frozendict(), content_type: str = 'multipart/form-data', accept_content_types: typing.Tuple[str] = _all_accept_content_types, ) -> typing.Union[ ApiResponseFor200, api_client.ApiResponseWithoutDeserialization ]: """ uploads an image Parameters use leading underscores to prevent collisions with user defined parameters from the source openapi spec """ self._verify_typed_dict_inputs(RequestPathParams, path_params) _path_params = {} for parameter in ( request_path_pet_id, ): parameter_data = path_params.get(parameter.name, unset) if parameter_data is unset: continue serialized_data = parameter.serialize(parameter_data) _path_params.update(serialized_data) _headers = HTTPHeaderDict() # TODO add cookie handling if accept_content_types: for accept_content_type in accept_content_types: _headers.add('Accept', accept_content_type) _fields = None _body = None if body is not unset: serialized_data = request_body_body.serialize(body, content_type) _headers.add('Content-Type', content_type) if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] response = self.api_client.call_api( resource_path=_path, method=_method, path_params=_path_params, headers=_headers, fields=_fields, body=_body, auth_settings=_auth, ) response_for_status = _status_code_to_response.get(str(response.status)) if response_for_status: api_response = response_for_status.deserialize(response, self.api_client.configuration) else: api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException(api_response=api_response) return api_response
def inline_composition( self: api_client.Api, body: typing.Union[SchemaForRequestBodyApplicationJson, SchemaForRequestBodyMultipartFormData, Unset] = unset, query_params: RequestQueryParams = frozendict(), content_type: str = 'application/json', accept_content_types: typing.Tuple[str] = _all_accept_content_types, stream: bool = False, timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None, skip_deserialization: bool = False, ) -> typing.Union[ ApiResponseFor200, api_client.ApiResponseWithoutDeserialization ]: """ testing composed schemas at inline locations :param skip_deserialization: If true then api_response.response will be set but api_response.body and api_response.headers will not be deserialized into schema class instances """ self._verify_typed_dict_inputs(RequestQueryParams, query_params) _query_params = [] for parameter in ( request_query_composition_at_root, request_query_composition_in_property, ): parameter_data = query_params.get(parameter.name, unset) if parameter_data is unset: continue serialized_data = parameter.serialize(parameter_data) _query_params.extend(serialized_data) _headers = HTTPHeaderDict() # TODO add cookie handling if accept_content_types: for accept_content_type in accept_content_types: _headers.add('Accept', accept_content_type) _fields = None _body = None if body is not unset: serialized_data = request_body_any_type.serialize(body, content_type) _headers.add('Content-Type', content_type) if 'fields' in serialized_data: _fields = serialized_data['fields'] elif 'body' in serialized_data: _body = serialized_data['body'] response = self.api_client.call_api( resource_path=_path, method=_method, query_params=tuple(_query_params), headers=_headers, fields=_fields, body=_body, stream=stream, timeout=timeout, ) if skip_deserialization: api_response = api_client.ApiResponseWithoutDeserialization(response=response) else: response_for_status = _status_code_to_response.get(str(response.status)) if response_for_status: api_response = response_for_status.deserialize(response, self.api_client.configuration) else: api_response = api_client.ApiResponseWithoutDeserialization(response=response) if not 200 <= response.status <= 299: raise exceptions.ApiException(api_response=api_response) return api_response