From f326018635722012d2f1f4413dd92685ba0c6839 Mon Sep 17 00:00:00 2001 From: Alex Arvanitidis Date: Thu, 28 Nov 2024 15:35:49 +0200 Subject: [PATCH] chore: update openapi (#128) * chore: update openapi * fix: update to new model types --- jaqpotpy/api/openapi/__init__.py | 4 + jaqpotpy/api/openapi/api/__init__.py | 2 + jaqpotpy/api/openapi/api/model_api.py | 866 +++++++++++++++++- jaqpotpy/api/openapi/api/user_api.py | 301 ++++++ jaqpotpy/api/openapi/api/user_settings_api.py | 97 +- jaqpotpy/api/openapi/models/__init__.py | 2 + .../models/archive_model200_response.py | 91 ++ jaqpotpy/api/openapi/models/mean_var_doa.py | 4 +- jaqpotpy/api/openapi/models/model.py | 8 +- jaqpotpy/api/openapi/models/model_type.py | 5 +- .../api/openapi/models/organization_user.py | 4 +- .../models/unarchive_model200_response.py | 88 ++ jaqpotpy/api/openapi/models/user.py | 8 +- jaqpotpy/api/openapi/models/user_settings.py | 12 +- jaqpotpy/jaqpot.py | 2 +- jaqpotpy/models/sklearn.py | 2 +- jaqpotpy/models/xgboost.py | 2 +- 17 files changed, 1402 insertions(+), 96 deletions(-) create mode 100644 jaqpotpy/api/openapi/api/user_api.py create mode 100644 jaqpotpy/api/openapi/models/archive_model200_response.py create mode 100644 jaqpotpy/api/openapi/models/unarchive_model200_response.py diff --git a/jaqpotpy/api/openapi/__init__.py b/jaqpotpy/api/openapi/__init__.py index 030d2daf..f3682dc3 100644 --- a/jaqpotpy/api/openapi/__init__.py +++ b/jaqpotpy/api/openapi/__init__.py @@ -27,6 +27,8 @@ from jaqpotpy.api.openapi.api.model_api import ModelApi from jaqpotpy.api.openapi.api.organization_api import OrganizationApi from jaqpotpy.api.openapi.api.organization_invitation_api import OrganizationInvitationApi +from jaqpotpy.api.openapi.api.user_api import UserApi +from jaqpotpy.api.openapi.api.user_settings_api import UserSettingsApi # import ApiClient from jaqpotpy.api.openapi.api_response import ApiResponse @@ -41,6 +43,7 @@ # import models into sdk package from jaqpotpy.api.openapi.models.api_key import ApiKey +from jaqpotpy.api.openapi.models.archive_model200_response import ArchiveModel200Response from jaqpotpy.api.openapi.models.binary_classification_scores import BinaryClassificationScores from jaqpotpy.api.openapi.models.bounding_box_doa import BoundingBoxDoa from jaqpotpy.api.openapi.models.city_block_doa import CityBlockDoa @@ -89,6 +92,7 @@ from jaqpotpy.api.openapi.models.regression_scores import RegressionScores from jaqpotpy.api.openapi.models.scores import Scores from jaqpotpy.api.openapi.models.transformer import Transformer +from jaqpotpy.api.openapi.models.unarchive_model200_response import UnarchiveModel200Response from jaqpotpy.api.openapi.models.update_api_key200_response import UpdateApiKey200Response from jaqpotpy.api.openapi.models.update_api_key_request import UpdateApiKeyRequest from jaqpotpy.api.openapi.models.user import User diff --git a/jaqpotpy/api/openapi/api/__init__.py b/jaqpotpy/api/openapi/api/__init__.py index 26684d5a..ffbffaa6 100644 --- a/jaqpotpy/api/openapi/api/__init__.py +++ b/jaqpotpy/api/openapi/api/__init__.py @@ -10,4 +10,6 @@ from jaqpotpy.api.openapi.api.model_api import ModelApi from jaqpotpy.api.openapi.api.organization_api import OrganizationApi from jaqpotpy.api.openapi.api.organization_invitation_api import OrganizationInvitationApi +from jaqpotpy.api.openapi.api.user_api import UserApi +from jaqpotpy.api.openapi.api.user_settings_api import UserSettingsApi diff --git a/jaqpotpy/api/openapi/api/model_api.py b/jaqpotpy/api/openapi/api/model_api.py index 75836c1f..d2f16984 100644 --- a/jaqpotpy/api/openapi/api/model_api.py +++ b/jaqpotpy/api/openapi/api/model_api.py @@ -20,11 +20,13 @@ from pydantic import Field, StrictInt, StrictStr from typing import List, Optional from typing_extensions import Annotated +from jaqpotpy.api.openapi.models.archive_model200_response import ArchiveModel200Response from jaqpotpy.api.openapi.models.dataset import Dataset from jaqpotpy.api.openapi.models.dataset_csv import DatasetCSV from jaqpotpy.api.openapi.models.get_models200_response import GetModels200Response from jaqpotpy.api.openapi.models.model import Model from jaqpotpy.api.openapi.models.partially_update_model_request import PartiallyUpdateModelRequest +from jaqpotpy.api.openapi.models.unarchive_model200_response import UnarchiveModel200Response from jaqpotpy.api.openapi.api_client import ApiClient, RequestSerialized from jaqpotpy.api.openapi.api_response import ApiResponse @@ -44,6 +46,274 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client + @validate_call + def archive_model( + self, + model_id: Annotated[StrictInt, Field(description="The ID of the model to archive")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ArchiveModel200Response: + """Archive a model + + Archives a model. Models that remain archived for more than 30 days will be permanently deleted. + + :param model_id: The ID of the model to archive (required) + :type model_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._archive_model_serialize( + model_id=model_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ArchiveModel200Response", + '404': None, + '409': None, + '403': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def archive_model_with_http_info( + self, + model_id: Annotated[StrictInt, Field(description="The ID of the model to archive")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ArchiveModel200Response]: + """Archive a model + + Archives a model. Models that remain archived for more than 30 days will be permanently deleted. + + :param model_id: The ID of the model to archive (required) + :type model_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._archive_model_serialize( + model_id=model_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ArchiveModel200Response", + '404': None, + '409': None, + '403': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def archive_model_without_preload_content( + self, + model_id: Annotated[StrictInt, Field(description="The ID of the model to archive")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Archive a model + + Archives a model. Models that remain archived for more than 30 days will be permanently deleted. + + :param model_id: The ID of the model to archive (required) + :type model_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._archive_model_serialize( + model_id=model_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ArchiveModel200Response", + '404': None, + '409': None, + '403': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _archive_model_serialize( + self, + model_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if model_id is not None: + _path_params['modelId'] = model_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'bearerAuth' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/models/{modelId}/archive', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + @validate_call def create_model( self, @@ -547,8 +817,304 @@ def _delete_model_by_id_serialize( ] return self.api_client.param_serialize( - method='DELETE', - resource_path='/v1/models/{id}', + method='DELETE', + resource_path='/v1/models/{id}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_all_models( + self, + page: Optional[StrictInt] = None, + size: Optional[StrictInt] = None, + sort: Optional[List[StrictStr]] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetModels200Response: + """Get paginated models + + + :param page: + :type page: int + :param size: + :type size: int + :param sort: + :type sort: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_models_serialize( + page=page, + size=size, + sort=sort, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetModels200Response", + '400': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_all_models_with_http_info( + self, + page: Optional[StrictInt] = None, + size: Optional[StrictInt] = None, + sort: Optional[List[StrictStr]] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetModels200Response]: + """Get paginated models + + + :param page: + :type page: int + :param size: + :type size: int + :param sort: + :type sort: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_models_serialize( + page=page, + size=size, + sort=sort, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetModels200Response", + '400': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_all_models_without_preload_content( + self, + page: Optional[StrictInt] = None, + size: Optional[StrictInt] = None, + sort: Optional[List[StrictStr]] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get paginated models + + + :param page: + :type page: int + :param size: + :type size: int + :param sort: + :type sort: List[str] + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_all_models_serialize( + page=page, + size=size, + sort=sort, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetModels200Response", + '400': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_all_models_serialize( + self, + page, + size, + sort, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'sort': 'multi', + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if page is not None: + + _query_params.append(('page', page)) + + if size is not None: + + _query_params.append(('size', size)) + + if sort is not None: + + _query_params.append(('sort', sort)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'bearerAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/models', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -565,7 +1131,7 @@ def _delete_model_by_id_serialize( @validate_call - def get_all_models( + def get_archived_models( self, page: Optional[StrictInt] = None, size: Optional[StrictInt] = None, @@ -583,8 +1149,9 @@ def get_all_models( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> GetModels200Response: - """Get paginated models + """Get paginated archived models + Retrieve a paginated list of models that have been archived by the user :param page: :type page: int @@ -614,7 +1181,7 @@ def get_all_models( :return: Returns the result object. """ # noqa: E501 - _param = self._get_all_models_serialize( + _param = self._get_archived_models_serialize( page=page, size=size, sort=sort, @@ -627,6 +1194,7 @@ def get_all_models( _response_types_map: Dict[str, Optional[str]] = { '200': "GetModels200Response", '400': None, + '403': None, } response_data = self.api_client.call_api( *_param, @@ -640,7 +1208,7 @@ def get_all_models( @validate_call - def get_all_models_with_http_info( + def get_archived_models_with_http_info( self, page: Optional[StrictInt] = None, size: Optional[StrictInt] = None, @@ -658,8 +1226,9 @@ def get_all_models_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[GetModels200Response]: - """Get paginated models + """Get paginated archived models + Retrieve a paginated list of models that have been archived by the user :param page: :type page: int @@ -689,7 +1258,7 @@ def get_all_models_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._get_all_models_serialize( + _param = self._get_archived_models_serialize( page=page, size=size, sort=sort, @@ -702,6 +1271,7 @@ def get_all_models_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "GetModels200Response", '400': None, + '403': None, } response_data = self.api_client.call_api( *_param, @@ -715,7 +1285,7 @@ def get_all_models_with_http_info( @validate_call - def get_all_models_without_preload_content( + def get_archived_models_without_preload_content( self, page: Optional[StrictInt] = None, size: Optional[StrictInt] = None, @@ -733,8 +1303,9 @@ def get_all_models_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Get paginated models + """Get paginated archived models + Retrieve a paginated list of models that have been archived by the user :param page: :type page: int @@ -764,7 +1335,7 @@ def get_all_models_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._get_all_models_serialize( + _param = self._get_archived_models_serialize( page=page, size=size, sort=sort, @@ -777,6 +1348,7 @@ def get_all_models_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "GetModels200Response", '400': None, + '403': None, } response_data = self.api_client.call_api( *_param, @@ -785,7 +1357,7 @@ def get_all_models_without_preload_content( return response_data.response - def _get_all_models_serialize( + def _get_archived_models_serialize( self, page, size, @@ -844,7 +1416,7 @@ def _get_all_models_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/v1/models', + resource_path='/v1/user/archived-models', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -3154,3 +3726,271 @@ def _search_models_serialize( ) + + + @validate_call + def unarchive_model( + self, + model_id: Annotated[StrictInt, Field(description="The ID of the model to unarchive")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UnarchiveModel200Response: + """Unarchive a model + + Unarchives a previously archived model. This will cancel any scheduled deletion. + + :param model_id: The ID of the model to unarchive (required) + :type model_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._unarchive_model_serialize( + model_id=model_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UnarchiveModel200Response", + '404': None, + '409': None, + '403': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def unarchive_model_with_http_info( + self, + model_id: Annotated[StrictInt, Field(description="The ID of the model to unarchive")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UnarchiveModel200Response]: + """Unarchive a model + + Unarchives a previously archived model. This will cancel any scheduled deletion. + + :param model_id: The ID of the model to unarchive (required) + :type model_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._unarchive_model_serialize( + model_id=model_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UnarchiveModel200Response", + '404': None, + '409': None, + '403': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def unarchive_model_without_preload_content( + self, + model_id: Annotated[StrictInt, Field(description="The ID of the model to unarchive")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Unarchive a model + + Unarchives a previously archived model. This will cancel any scheduled deletion. + + :param model_id: The ID of the model to unarchive (required) + :type model_id: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._unarchive_model_serialize( + model_id=model_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UnarchiveModel200Response", + '404': None, + '409': None, + '403': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _unarchive_model_serialize( + self, + model_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if model_id is not None: + _path_params['modelId'] = model_id + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'bearerAuth' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/v1/models/{modelId}/unarchive', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/jaqpotpy/api/openapi/api/user_api.py b/jaqpotpy/api/openapi/api/user_api.py new file mode 100644 index 00000000..86acee28 --- /dev/null +++ b/jaqpotpy/api/openapi/api/user_api.py @@ -0,0 +1,301 @@ +# coding: utf-8 + +""" + Jaqpot API + + A modern RESTful API for model management and prediction services, built using Spring Boot and Kotlin. Supports seamless integration with machine learning workflows. + + The version of the OpenAPI document: 1.0.0 + Contact: upci.ntua@gmail.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr +from typing_extensions import Annotated +from jaqpotpy.api.openapi.models.user import User + +from jaqpotpy.api.openapi.api_client import ApiClient, RequestSerialized +from jaqpotpy.api.openapi.api_response import ApiResponse +from jaqpotpy.api.openapi.rest import RESTResponseType + + +class UserApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def get_user( + self, + username: Annotated[StrictStr, Field(description="The ID of the user to retrieve")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> User: + """Get user data + + + :param username: The ID of the user to retrieve (required) + :type username: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_serialize( + username=username, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "User", + '401': None, + '404': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_user_with_http_info( + self, + username: Annotated[StrictStr, Field(description="The ID of the user to retrieve")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[User]: + """Get user data + + + :param username: The ID of the user to retrieve (required) + :type username: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_serialize( + username=username, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "User", + '401': None, + '404': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_user_without_preload_content( + self, + username: Annotated[StrictStr, Field(description="The ID of the user to retrieve")], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get user data + + + :param username: The ID of the user to retrieve (required) + :type username: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_user_serialize( + username=username, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "User", + '401': None, + '404': None, + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_user_serialize( + self, + username, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if username is not None: + _path_params['username'] = username + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'bearerAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/v1/users/{username}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/jaqpotpy/api/openapi/api/user_settings_api.py b/jaqpotpy/api/openapi/api/user_settings_api.py index 3d074b61..e2ee866b 100644 --- a/jaqpotpy/api/openapi/api/user_settings_api.py +++ b/jaqpotpy/api/openapi/api/user_settings_api.py @@ -38,7 +38,7 @@ def __init__(self, api_client=None) -> None: @validate_call - def get_user_settings( + def delete_user_avatar( self, _request_timeout: Union[ None, @@ -52,8 +52,8 @@ def get_user_settings( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> UserSettings: - """Get user settings + ) -> None: + """Delete user avatar :param _request_timeout: timeout setting for this request. If one @@ -78,7 +78,7 @@ def get_user_settings( :return: Returns the result object. """ # noqa: E501 - _param = self._get_user_settings_serialize( + _param = self._delete_user_avatar_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -86,7 +86,7 @@ def get_user_settings( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "UserSettings", + '204': None, '401': None, '404': None, } @@ -102,7 +102,7 @@ def get_user_settings( @validate_call - def get_user_settings_with_http_info( + def delete_user_avatar_with_http_info( self, _request_timeout: Union[ None, @@ -116,8 +116,8 @@ def get_user_settings_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[UserSettings]: - """Get user settings + ) -> ApiResponse[None]: + """Delete user avatar :param _request_timeout: timeout setting for this request. If one @@ -142,7 +142,7 @@ def get_user_settings_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._get_user_settings_serialize( + _param = self._delete_user_avatar_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -150,7 +150,7 @@ def get_user_settings_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "UserSettings", + '204': None, '401': None, '404': None, } @@ -166,7 +166,7 @@ def get_user_settings_with_http_info( @validate_call - def get_user_settings_without_preload_content( + def delete_user_avatar_without_preload_content( self, _request_timeout: Union[ None, @@ -181,7 +181,7 @@ def get_user_settings_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Get user settings + """Delete user avatar :param _request_timeout: timeout setting for this request. If one @@ -206,7 +206,7 @@ def get_user_settings_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._get_user_settings_serialize( + _param = self._delete_user_avatar_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -214,7 +214,7 @@ def get_user_settings_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "UserSettings", + '204': None, '401': None, '404': None, } @@ -225,7 +225,7 @@ def get_user_settings_without_preload_content( return response_data.response - def _get_user_settings_serialize( + def _delete_user_avatar_serialize( self, _request_auth, _content_type, @@ -252,13 +252,6 @@ def _get_user_settings_serialize( # process the body parameter - # set the HTTP header `Accept` - if 'Accept' not in _header_params: - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) # authentication setting @@ -267,8 +260,8 @@ def _get_user_settings_serialize( ] return self.api_client.param_serialize( - method='GET', - resource_path='/v1/user/settings', + method='DELETE', + resource_path='/v1/user/avatar', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -285,9 +278,8 @@ def _get_user_settings_serialize( @validate_call - def save_user_settings( + def get_user_settings( self, - user_settings: UserSettings, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -301,11 +293,9 @@ def save_user_settings( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> UserSettings: - """Create or update user settings + """Get user settings - :param user_settings: (required) - :type user_settings: UserSettings :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -328,8 +318,7 @@ def save_user_settings( :return: Returns the result object. """ # noqa: E501 - _param = self._save_user_settings_serialize( - user_settings=user_settings, + _param = self._get_user_settings_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -339,7 +328,7 @@ def save_user_settings( _response_types_map: Dict[str, Optional[str]] = { '200': "UserSettings", '401': None, - '400': None, + '404': None, } response_data = self.api_client.call_api( *_param, @@ -353,9 +342,8 @@ def save_user_settings( @validate_call - def save_user_settings_with_http_info( + def get_user_settings_with_http_info( self, - user_settings: UserSettings, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -369,11 +357,9 @@ def save_user_settings_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[UserSettings]: - """Create or update user settings + """Get user settings - :param user_settings: (required) - :type user_settings: UserSettings :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -396,8 +382,7 @@ def save_user_settings_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._save_user_settings_serialize( - user_settings=user_settings, + _param = self._get_user_settings_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -407,7 +392,7 @@ def save_user_settings_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "UserSettings", '401': None, - '400': None, + '404': None, } response_data = self.api_client.call_api( *_param, @@ -421,9 +406,8 @@ def save_user_settings_with_http_info( @validate_call - def save_user_settings_without_preload_content( + def get_user_settings_without_preload_content( self, - user_settings: UserSettings, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -437,11 +421,9 @@ def save_user_settings_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """Create or update user settings + """Get user settings - :param user_settings: (required) - :type user_settings: UserSettings :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -464,8 +446,7 @@ def save_user_settings_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._save_user_settings_serialize( - user_settings=user_settings, + _param = self._get_user_settings_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -475,7 +456,7 @@ def save_user_settings_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "UserSettings", '401': None, - '400': None, + '404': None, } response_data = self.api_client.call_api( *_param, @@ -484,9 +465,8 @@ def save_user_settings_without_preload_content( return response_data.response - def _save_user_settings_serialize( + def _get_user_settings_serialize( self, - user_settings, _request_auth, _content_type, _headers, @@ -510,8 +490,6 @@ def _save_user_settings_serialize( # process the header parameters # process the form parameters # process the body parameter - if user_settings is not None: - _body_params = user_settings # set the HTTP header `Accept` @@ -522,19 +500,6 @@ def _save_user_settings_serialize( ] ) - # set the HTTP header `Content-Type` - if _content_type: - _header_params['Content-Type'] = _content_type - else: - _default_content_type = ( - self.api_client.select_header_content_type( - [ - 'application/json' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type # authentication setting _auth_settings: List[str] = [ @@ -542,7 +507,7 @@ def _save_user_settings_serialize( ] return self.api_client.param_serialize( - method='POST', + method='GET', resource_path='/v1/user/settings', path_params=_path_params, query_params=_query_params, diff --git a/jaqpotpy/api/openapi/models/__init__.py b/jaqpotpy/api/openapi/models/__init__.py index 57dfacc1..d1931050 100644 --- a/jaqpotpy/api/openapi/models/__init__.py +++ b/jaqpotpy/api/openapi/models/__init__.py @@ -16,6 +16,7 @@ # import models into model package from jaqpotpy.api.openapi.models.api_key import ApiKey +from jaqpotpy.api.openapi.models.archive_model200_response import ArchiveModel200Response from jaqpotpy.api.openapi.models.binary_classification_scores import BinaryClassificationScores from jaqpotpy.api.openapi.models.bounding_box_doa import BoundingBoxDoa from jaqpotpy.api.openapi.models.city_block_doa import CityBlockDoa @@ -64,6 +65,7 @@ from jaqpotpy.api.openapi.models.regression_scores import RegressionScores from jaqpotpy.api.openapi.models.scores import Scores from jaqpotpy.api.openapi.models.transformer import Transformer +from jaqpotpy.api.openapi.models.unarchive_model200_response import UnarchiveModel200Response from jaqpotpy.api.openapi.models.update_api_key200_response import UpdateApiKey200Response from jaqpotpy.api.openapi.models.update_api_key_request import UpdateApiKeyRequest from jaqpotpy.api.openapi.models.user import User diff --git a/jaqpotpy/api/openapi/models/archive_model200_response.py b/jaqpotpy/api/openapi/models/archive_model200_response.py new file mode 100644 index 00000000..631e111a --- /dev/null +++ b/jaqpotpy/api/openapi/models/archive_model200_response.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Jaqpot API + + A modern RESTful API for model management and prediction services, built using Spring Boot and Kotlin. Supports seamless integration with machine learning workflows. + + The version of the OpenAPI document: 1.0.0 + Contact: upci.ntua@gmail.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ArchiveModel200Response(BaseModel): + """ + ArchiveModel200Response + """ # noqa: E501 + id: Optional[StrictInt] = None + archived_at: Optional[datetime] = Field(default=None, description="Timestamp when the model was archived", alias="archivedAt") + __properties: ClassVar[List[str]] = ["id", "archivedAt"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ArchiveModel200Response from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ArchiveModel200Response from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "archivedAt": obj.get("archivedAt") + }) + return _obj + + diff --git a/jaqpotpy/api/openapi/models/mean_var_doa.py b/jaqpotpy/api/openapi/models/mean_var_doa.py index 1add56be..997798ad 100644 --- a/jaqpotpy/api/openapi/models/mean_var_doa.py +++ b/jaqpotpy/api/openapi/models/mean_var_doa.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt from typing import Any, ClassVar, Dict, List, Optional, Union from typing_extensions import Annotated from typing import Optional, Set @@ -28,7 +28,7 @@ class MeanVarDoa(BaseModel): """ MeanVarDoa """ # noqa: E501 - bounds: Optional[List[Annotated[List[Union[Annotated[float, Field(strict=True)], Annotated[int, Field(strict=True)]]], Field(max_length=1000)]]] = None + bounds: Optional[Annotated[List[Annotated[List[Union[StrictFloat, StrictInt]], Field(max_length=1000)]], Field(max_length=1000)]] = None __properties: ClassVar[List[str]] = ["bounds"] model_config = ConfigDict( diff --git a/jaqpotpy/api/openapi/models/model.py b/jaqpotpy/api/openapi/models/model.py index 736735e2..786496e5 100644 --- a/jaqpotpy/api/openapi/models/model.py +++ b/jaqpotpy/api/openapi/models/model.py @@ -52,6 +52,8 @@ class Model(BaseModel): shared_with_organizations: Optional[List[Organization]] = Field(default=None, alias="sharedWithOrganizations") visibility: ModelVisibility task: ModelTask + archived: Optional[StrictBool] = None + archived_at: Optional[datetime] = Field(default=None, description="The date and time when the model was last archived.", alias="archivedAt") torch_config: Optional[Dict[str, Any]] = Field(default=None, alias="torchConfig") preprocessors: Optional[Annotated[List[Transformer], Field(max_length=50)]] = None featurizers: Optional[Annotated[List[Transformer], Field(max_length=50)]] = None @@ -66,8 +68,8 @@ class Model(BaseModel): scores: Optional[ModelScores] = None r_pbpk_config: Optional[RPbpkConfig] = Field(default=None, alias="rPbpkConfig") created_at: Optional[datetime] = Field(default=None, description="The date and time when the feature was created.", alias="createdAt") - updated_at: Optional[datetime] = Field(default=None, description="The date and time when the feature was last updated.", alias="updatedAt") - __properties: ClassVar[List[str]] = ["id", "name", "description", "type", "jaqpotpyVersion", "doas", "libraries", "dependentFeatures", "independentFeatures", "sharedWithOrganizations", "visibility", "task", "torchConfig", "preprocessors", "featurizers", "rawPreprocessor", "rawModel", "creator", "canEdit", "isAdmin", "selectedFeatures", "tags", "legacyPredictionService", "scores", "rPbpkConfig", "createdAt", "updatedAt"] + updated_at: Optional[datetime] = Field(default=None, description="The date and time when the model was last updated.", alias="updatedAt") + __properties: ClassVar[List[str]] = ["id", "name", "description", "type", "jaqpotpyVersion", "doas", "libraries", "dependentFeatures", "independentFeatures", "sharedWithOrganizations", "visibility", "task", "archived", "archivedAt", "torchConfig", "preprocessors", "featurizers", "rawPreprocessor", "rawModel", "creator", "canEdit", "isAdmin", "selectedFeatures", "tags", "legacyPredictionService", "scores", "rPbpkConfig", "createdAt", "updatedAt"] model_config = ConfigDict( populate_by_name=True, @@ -190,6 +192,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "sharedWithOrganizations": [Organization.from_dict(_item) for _item in obj["sharedWithOrganizations"]] if obj.get("sharedWithOrganizations") is not None else None, "visibility": obj.get("visibility"), "task": obj.get("task"), + "archived": obj.get("archived"), + "archivedAt": obj.get("archivedAt"), "torchConfig": obj.get("torchConfig"), "preprocessors": [Transformer.from_dict(_item) for _item in obj["preprocessors"]] if obj.get("preprocessors") is not None else None, "featurizers": [Transformer.from_dict(_item) for _item in obj["featurizers"]] if obj.get("featurizers") is not None else None, diff --git a/jaqpotpy/api/openapi/models/model_type.py b/jaqpotpy/api/openapi/models/model_type.py index aff24b80..1cc7fe22 100644 --- a/jaqpotpy/api/openapi/models/model_type.py +++ b/jaqpotpy/api/openapi/models/model_type.py @@ -27,8 +27,9 @@ class ModelType(str, Enum): """ allowed enum values """ - SKLEARN = 'SKLEARN' - TORCH_ONNX = 'TORCH_ONNX' + SKLEARN_ONNX = 'SKLEARN_ONNX' + TORCH_SEQUENCE_ONNX = 'TORCH_SEQUENCE_ONNX' + TORCH_GEOMETRIC_ONNX = 'TORCH_GEOMETRIC_ONNX' TORCHSCRIPT = 'TORCHSCRIPT' R_BNLEARN_DISCRETE = 'R_BNLEARN_DISCRETE' R_CARET = 'R_CARET' diff --git a/jaqpotpy/api/openapi/models/organization_user.py b/jaqpotpy/api/openapi/models/organization_user.py index e3d30055..4262351d 100644 --- a/jaqpotpy/api/openapi/models/organization_user.py +++ b/jaqpotpy/api/openapi/models/organization_user.py @@ -32,8 +32,9 @@ class OrganizationUser(BaseModel): user_id: StrictStr = Field(alias="userId") username: Optional[StrictStr] = None email: Optional[StrictStr] = None + avatar_url: Optional[StrictStr] = Field(default=None, alias="avatarUrl") association_type: OrganizationUserAssociationType = Field(alias="associationType") - __properties: ClassVar[List[str]] = ["id", "userId", "username", "email", "associationType"] + __properties: ClassVar[List[str]] = ["id", "userId", "username", "email", "avatarUrl", "associationType"] model_config = ConfigDict( populate_by_name=True, @@ -90,6 +91,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "userId": obj.get("userId"), "username": obj.get("username"), "email": obj.get("email"), + "avatarUrl": obj.get("avatarUrl"), "associationType": obj.get("associationType") }) return _obj diff --git a/jaqpotpy/api/openapi/models/unarchive_model200_response.py b/jaqpotpy/api/openapi/models/unarchive_model200_response.py new file mode 100644 index 00000000..c5df9a05 --- /dev/null +++ b/jaqpotpy/api/openapi/models/unarchive_model200_response.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Jaqpot API + + A modern RESTful API for model management and prediction services, built using Spring Boot and Kotlin. Supports seamless integration with machine learning workflows. + + The version of the OpenAPI document: 1.0.0 + Contact: upci.ntua@gmail.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class UnarchiveModel200Response(BaseModel): + """ + UnarchiveModel200Response + """ # noqa: E501 + id: Optional[StrictInt] = None + __properties: ClassVar[List[str]] = ["id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UnarchiveModel200Response from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UnarchiveModel200Response from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id") + }) + return _obj + + diff --git a/jaqpotpy/api/openapi/models/user.py b/jaqpotpy/api/openapi/models/user.py index 6f0655fe..a6729186 100644 --- a/jaqpotpy/api/openapi/models/user.py +++ b/jaqpotpy/api/openapi/models/user.py @@ -33,7 +33,9 @@ class User(BaseModel): last_name: Optional[StrictStr] = Field(default=None, alias="lastName") email: Optional[StrictStr] = None email_verified: Optional[StrictBool] = Field(default=None, alias="emailVerified") - __properties: ClassVar[List[str]] = ["id", "username", "firstName", "lastName", "email", "emailVerified"] + avatar_url: Optional[StrictStr] = Field(default=None, alias="avatarUrl") + can_edit: Optional[StrictBool] = Field(default=None, alias="canEdit") + __properties: ClassVar[List[str]] = ["id", "username", "firstName", "lastName", "email", "emailVerified", "avatarUrl", "canEdit"] model_config = ConfigDict( populate_by_name=True, @@ -91,7 +93,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "firstName": obj.get("firstName"), "lastName": obj.get("lastName"), "email": obj.get("email"), - "emailVerified": obj.get("emailVerified") + "emailVerified": obj.get("emailVerified"), + "avatarUrl": obj.get("avatarUrl"), + "canEdit": obj.get("canEdit") }) return _obj diff --git a/jaqpotpy/api/openapi/models/user_settings.py b/jaqpotpy/api/openapi/models/user_settings.py index 0a08ffb6..c0812f2b 100644 --- a/jaqpotpy/api/openapi/models/user_settings.py +++ b/jaqpotpy/api/openapi/models/user_settings.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self @@ -30,9 +30,10 @@ class UserSettings(BaseModel): id: Optional[StrictInt] = None dark_mode: Optional[StrictBool] = Field(default=False, alias="darkMode") collapse_sidebar: Optional[StrictBool] = Field(default=False, alias="collapseSidebar") + avatar_url: Optional[StrictStr] = Field(default=None, alias="avatarUrl") is_admin: Optional[StrictBool] = Field(default=None, alias="isAdmin") - is_upci: Optional[StrictBool] = Field(default=None, alias="isUpci") - __properties: ClassVar[List[str]] = ["id", "darkMode", "collapseSidebar", "isAdmin", "isUpci"] + is_upci_user: Optional[StrictBool] = Field(default=None, alias="isUpciUser") + __properties: ClassVar[List[str]] = ["id", "darkMode", "collapseSidebar", "avatarUrl", "isAdmin", "isUpciUser"] model_config = ConfigDict( populate_by_name=True, @@ -69,7 +70,7 @@ def to_dict(self) -> Dict[str, Any]: """ excluded_fields: Set[str] = set([ "is_admin", - "is_upci", + "is_upci_user", ]) _dict = self.model_dump( @@ -92,8 +93,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "id": obj.get("id"), "darkMode": obj.get("darkMode") if obj.get("darkMode") is not None else False, "collapseSidebar": obj.get("collapseSidebar") if obj.get("collapseSidebar") is not None else False, + "avatarUrl": obj.get("avatarUrl"), "isAdmin": obj.get("isAdmin"), - "isUpci": obj.get("isUpci") + "isUpciUser": obj.get("isUpciUser") }) return _obj diff --git a/jaqpotpy/jaqpot.py b/jaqpotpy/jaqpot.py index 883acb35..e8d63271 100644 --- a/jaqpotpy/jaqpot.py +++ b/jaqpotpy/jaqpot.py @@ -245,7 +245,7 @@ def deploy_torch_model( torch_config = featurizer.get_dict() body_model = Model( name=name, - type=ModelType.TORCH_ONNX, + type=ModelType.TORCH_GEOMETRIC_ONNX, jaqpotpy_version=jaqpotpy.__version__, libraries=get_installed_libraries(), dependent_features=[ diff --git a/jaqpotpy/models/sklearn.py b/jaqpotpy/models/sklearn.py index e5c7b551..a8586642 100644 --- a/jaqpotpy/models/sklearn.py +++ b/jaqpotpy/models/sklearn.py @@ -198,7 +198,7 @@ def __init__( self.initial_types = None self.onnx_preprocessor = None self.onnx_model = None - self.type = ModelType("SKLEARN") + self.type = ModelType.SKLEARN_ONNX self.independentFeatures = None self.dependentFeatures = None self.featurizers = [] diff --git a/jaqpotpy/models/xgboost.py b/jaqpotpy/models/xgboost.py index cf8020a3..8b72f734 100644 --- a/jaqpotpy/models/xgboost.py +++ b/jaqpotpy/models/xgboost.py @@ -72,7 +72,7 @@ def __init__( self.initial_types = None self.onnx_preprocessor = None self.onnx_model = None - self.type = ModelType("SKLEARN") + self.type = ModelType.SKLEARN_ONNX self.independentFeatures = None self.dependentFeatures = None self.featurizers = []