From 3280bea05c8ede82ceb810f79aa824ed7ef41638 Mon Sep 17 00:00:00 2001 From: jcschaff Date: Mon, 8 Jul 2024 22:58:41 -0400 Subject: [PATCH] updated OpenAPI spec and libraries for magic link email endpoints --- python-restclient/README.md | 2 + python-restclient/docs/UsersResourceApi.md | 137 +++++ .../vcell_client/api/users_resource_api.py | 520 ++++++++++++++++++ tools/openapi.yaml | 45 ++ vcell-restclient/README.md | 4 + vcell-restclient/api/openapi.yaml | 56 ++ vcell-restclient/docs/UsersResourceApi.md | 278 ++++++++++ .../restclient/api/UsersResourceApi.java | 174 ++++++ .../openapi/api/users-resource.service.ts | 133 +++++ .../api/users-resource.serviceInterface.ts | 15 + 10 files changed, 1364 insertions(+) diff --git a/python-restclient/README.md b/python-restclient/README.md index 4ffdd688c4..efd0c19f95 100644 --- a/python-restclient/README.md +++ b/python-restclient/README.md @@ -105,6 +105,8 @@ Class | Method | HTTP request | Description *UsersResourceApi* | [**get_me**](docs/UsersResourceApi.md#get_me) | **GET** /api/v1/users/me | Get current user *UsersResourceApi* | [**map_new_user**](docs/UsersResourceApi.md#map_new_user) | **POST** /api/v1/users/newUser | create vcell user *UsersResourceApi* | [**map_user**](docs/UsersResourceApi.md#map_user) | **POST** /api/v1/users/mapUser | map vcell user +*UsersResourceApi* | [**process_magic_link**](docs/UsersResourceApi.md#process_magic_link) | **POST** /api/v1/users/processMagicLink | Process the magic link and map the user +*UsersResourceApi* | [**request_recovery_email**](docs/UsersResourceApi.md#request_recovery_email) | **POST** /api/v1/users/requestRecoveryEmail | request a recovery email to link a VCell account. *UsersResourceApi* | [**unmap_user**](docs/UsersResourceApi.md#unmap_user) | **PUT** /api/v1/users/unmapUser/{userName} | remove vcell identity mapping diff --git a/python-restclient/docs/UsersResourceApi.md b/python-restclient/docs/UsersResourceApi.md index 540b54c976..2bb198b0cb 100644 --- a/python-restclient/docs/UsersResourceApi.md +++ b/python-restclient/docs/UsersResourceApi.md @@ -11,6 +11,8 @@ Method | HTTP request | Description [**get_me**](UsersResourceApi.md#get_me) | **GET** /api/v1/users/me | Get current user [**map_new_user**](UsersResourceApi.md#map_new_user) | **POST** /api/v1/users/newUser | create vcell user [**map_user**](UsersResourceApi.md#map_user) | **POST** /api/v1/users/mapUser | map vcell user +[**process_magic_link**](UsersResourceApi.md#process_magic_link) | **POST** /api/v1/users/processMagicLink | Process the magic link and map the user +[**request_recovery_email**](UsersResourceApi.md#request_recovery_email) | **POST** /api/v1/users/requestRecoveryEmail | request a recovery email to link a VCell account. [**unmap_user**](UsersResourceApi.md#unmap_user) | **PUT** /api/v1/users/unmapUser/{userName} | remove vcell identity mapping @@ -480,6 +482,141 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **process_magic_link** +> process_magic_link(magic=magic) + +Process the magic link and map the user + +### Example + +```python +import time +import os +import vcell_client +from vcell_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://vcell-dev.cam.uchc.edu +# See configuration.py for a list of all supported configuration parameters. +configuration = vcell_client.Configuration( + host = "https://vcell-dev.cam.uchc.edu" +) + + +# Enter a context with an instance of the API client +with vcell_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = vcell_client.UsersResourceApi(api_client) + magic = 'magic_example' # str | (optional) + + try: + # Process the magic link and map the user + api_instance.process_magic_link(magic=magic) + except Exception as e: + print("Exception when calling UsersResourceApi->process_magic_link: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **magic** | **str**| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | User mapped successfully | - | +**400** | Invalid or expired magic link | - | +**406** | User not mapped | - | +**500** | Internal server error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **request_recovery_email** +> request_recovery_email(email=email, user_id=user_id) + +request a recovery email to link a VCell account. + +### Example + +```python +import time +import os +import vcell_client +from vcell_client.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://vcell-dev.cam.uchc.edu +# See configuration.py for a list of all supported configuration parameters. +configuration = vcell_client.Configuration( + host = "https://vcell-dev.cam.uchc.edu" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Enter a context with an instance of the API client +with vcell_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = vcell_client.UsersResourceApi(api_client) + email = 'email_example' # str | (optional) + user_id = 'user_id_example' # str | (optional) + + try: + # request a recovery email to link a VCell account. + api_instance.request_recovery_email(email=email, user_id=user_id) + except Exception as e: + print("Exception when calling UsersResourceApi->request_recovery_email: %s\n" % e) +``` + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **email** | **str**| | [optional] + **user_id** | **str**| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[openId](../README.md#openId) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | magic link sent in email if appropriate | - | +**403** | Not Allowed | - | +**401** | Not Authorized | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **unmap_user** > bool unmap_user(user_name) diff --git a/python-restclient/vcell_client/api/users_resource_api.py b/python-restclient/vcell_client/api/users_resource_api.py index 590d845602..548ed3c96d 100644 --- a/python-restclient/vcell_client/api/users_resource_api.py +++ b/python-restclient/vcell_client/api/users_resource_api.py @@ -1831,6 +1831,526 @@ def _map_user_serialize( + @validate_call + def process_magic_link( + self, + magic: Optional[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, + ) -> None: + """Process the magic link and map the user + + + :param magic: + :type magic: 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._process_magic_link_serialize( + magic=magic, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + + } + 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 process_magic_link_with_http_info( + self, + magic: Optional[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[None]: + """Process the magic link and map the user + + + :param magic: + :type magic: 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._process_magic_link_serialize( + magic=magic, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + + } + 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 process_magic_link_without_preload_content( + self, + magic: Optional[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: + """Process the magic link and map the user + + + :param magic: + :type magic: 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._process_magic_link_serialize( + magic=magic, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _process_magic_link_serialize( + self, + magic, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + + _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, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if magic is not None: + + _query_params.append(('magic', magic)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/api/v1/users/processMagicLink', + 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 request_recovery_email( + self, + email: Optional[StrictStr] = None, + user_id: Optional[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, + ) -> None: + """request a recovery email to link a VCell account. + + + :param email: + :type email: str + :param user_id: + :type user_id: 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._request_recovery_email_serialize( + email=email, + user_id=user_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + + } + 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 request_recovery_email_with_http_info( + self, + email: Optional[StrictStr] = None, + user_id: Optional[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[None]: + """request a recovery email to link a VCell account. + + + :param email: + :type email: str + :param user_id: + :type user_id: 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._request_recovery_email_serialize( + email=email, + user_id=user_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + + } + 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 request_recovery_email_without_preload_content( + self, + email: Optional[StrictStr] = None, + user_id: Optional[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: + """request a recovery email to link a VCell account. + + + :param email: + :type email: str + :param user_id: + :type user_id: 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._request_recovery_email_serialize( + email=email, + user_id=user_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _request_recovery_email_serialize( + self, + email, + user_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> Tuple: + + _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, str] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if email is not None: + + _query_params.append(('email', email)) + + if user_id is not None: + + _query_params.append(('userID', user_id)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + + + # authentication setting + _auth_settings: List[str] = [ + 'openId' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/api/v1/users/requestRecoveryEmail', + 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 unmap_user( self, diff --git a/tools/openapi.yaml b/tools/openapi.yaml index 6fe7a54487..1bdb3a9fc1 100644 --- a/tools/openapi.yaml +++ b/tools/openapi.yaml @@ -413,6 +413,51 @@ paths: security: - openId: - user + /api/v1/users/processMagicLink: + post: + tags: + - Users Resource + summary: Process the magic link and map the user + operationId: processMagicLink + parameters: + - name: magic + in: query + schema: + type: string + responses: + "200": + description: User mapped successfully + "400": + description: Invalid or expired magic link + "406": + description: User not mapped + "500": + description: Internal server error + /api/v1/users/requestRecoveryEmail: + post: + tags: + - Users Resource + summary: request a recovery email to link a VCell account. + operationId: requestRecoveryEmail + parameters: + - name: email + in: query + schema: + type: string + - name: userID + in: query + schema: + type: string + responses: + "200": + description: magic link sent in email if appropriate + "403": + description: Not Allowed + "401": + description: Not Authorized + security: + - openId: + - user /api/v1/users/unmapUser/{userName}: put: tags: diff --git a/vcell-restclient/README.md b/vcell-restclient/README.md index 4411a244ad..6cadde0b71 100644 --- a/vcell-restclient/README.md +++ b/vcell-restclient/README.md @@ -145,6 +145,10 @@ Class | Method | HTTP request | Description *UsersResourceApi* | [**mapNewUserWithHttpInfo**](docs/UsersResourceApi.md#mapNewUserWithHttpInfo) | **POST** /api/v1/users/newUser | create vcell user *UsersResourceApi* | [**mapUser**](docs/UsersResourceApi.md#mapUser) | **POST** /api/v1/users/mapUser | map vcell user *UsersResourceApi* | [**mapUserWithHttpInfo**](docs/UsersResourceApi.md#mapUserWithHttpInfo) | **POST** /api/v1/users/mapUser | map vcell user +*UsersResourceApi* | [**processMagicLink**](docs/UsersResourceApi.md#processMagicLink) | **POST** /api/v1/users/processMagicLink | Process the magic link and map the user +*UsersResourceApi* | [**processMagicLinkWithHttpInfo**](docs/UsersResourceApi.md#processMagicLinkWithHttpInfo) | **POST** /api/v1/users/processMagicLink | Process the magic link and map the user +*UsersResourceApi* | [**requestRecoveryEmail**](docs/UsersResourceApi.md#requestRecoveryEmail) | **POST** /api/v1/users/requestRecoveryEmail | request a recovery email to link a VCell account. +*UsersResourceApi* | [**requestRecoveryEmailWithHttpInfo**](docs/UsersResourceApi.md#requestRecoveryEmailWithHttpInfo) | **POST** /api/v1/users/requestRecoveryEmail | request a recovery email to link a VCell account. *UsersResourceApi* | [**unmapUser**](docs/UsersResourceApi.md#unmapUser) | **PUT** /api/v1/users/unmapUser/{userName} | remove vcell identity mapping *UsersResourceApi* | [**unmapUserWithHttpInfo**](docs/UsersResourceApi.md#unmapUserWithHttpInfo) | **PUT** /api/v1/users/unmapUser/{userName} | remove vcell identity mapping diff --git a/vcell-restclient/api/openapi.yaml b/vcell-restclient/api/openapi.yaml index 9b85075888..4d9d3d9f0b 100644 --- a/vcell-restclient/api/openapi.yaml +++ b/vcell-restclient/api/openapi.yaml @@ -460,6 +460,62 @@ paths: - Users Resource x-content-type: application/json x-accepts: application/json + /api/v1/users/processMagicLink: + post: + operationId: processMagicLink + parameters: + - explode: true + in: query + name: magic + required: false + schema: + type: string + style: form + responses: + "200": + description: User mapped successfully + "400": + description: Invalid or expired magic link + "406": + description: User not mapped + "500": + description: Internal server error + summary: Process the magic link and map the user + tags: + - Users Resource + x-accepts: application/json + /api/v1/users/requestRecoveryEmail: + post: + operationId: requestRecoveryEmail + parameters: + - explode: true + in: query + name: email + required: false + schema: + type: string + style: form + - explode: true + in: query + name: userID + required: false + schema: + type: string + style: form + responses: + "200": + description: magic link sent in email if appropriate + "403": + description: Not Allowed + "401": + description: Not Authorized + security: + - openId: + - user + summary: request a recovery email to link a VCell account. + tags: + - Users Resource + x-accepts: application/json /api/v1/users/unmapUser/{userName}: put: operationId: unmapUser diff --git a/vcell-restclient/docs/UsersResourceApi.md b/vcell-restclient/docs/UsersResourceApi.md index bf3d89664b..41e21ede6a 100644 --- a/vcell-restclient/docs/UsersResourceApi.md +++ b/vcell-restclient/docs/UsersResourceApi.md @@ -18,6 +18,10 @@ All URIs are relative to *https://vcell-dev.cam.uchc.edu* | [**mapNewUserWithHttpInfo**](UsersResourceApi.md#mapNewUserWithHttpInfo) | **POST** /api/v1/users/newUser | create vcell user | | [**mapUser**](UsersResourceApi.md#mapUser) | **POST** /api/v1/users/mapUser | map vcell user | | [**mapUserWithHttpInfo**](UsersResourceApi.md#mapUserWithHttpInfo) | **POST** /api/v1/users/mapUser | map vcell user | +| [**processMagicLink**](UsersResourceApi.md#processMagicLink) | **POST** /api/v1/users/processMagicLink | Process the magic link and map the user | +| [**processMagicLinkWithHttpInfo**](UsersResourceApi.md#processMagicLinkWithHttpInfo) | **POST** /api/v1/users/processMagicLink | Process the magic link and map the user | +| [**requestRecoveryEmail**](UsersResourceApi.md#requestRecoveryEmail) | **POST** /api/v1/users/requestRecoveryEmail | request a recovery email to link a VCell account. | +| [**requestRecoveryEmailWithHttpInfo**](UsersResourceApi.md#requestRecoveryEmailWithHttpInfo) | **POST** /api/v1/users/requestRecoveryEmail | request a recovery email to link a VCell account. | | [**unmapUser**](UsersResourceApi.md#unmapUser) | **PUT** /api/v1/users/unmapUser/{userName} | remove vcell identity mapping | | [**unmapUserWithHttpInfo**](UsersResourceApi.md#unmapUserWithHttpInfo) | **PUT** /api/v1/users/unmapUser/{userName} | remove vcell identity mapping | @@ -941,6 +945,280 @@ ApiResponse<**Boolean**> | **403** | Not Allowed | - | +## processMagicLink + +> void processMagicLink(magic) + +Process the magic link and map the user + +### Example + +```java +// Import classes: +import org.vcell.restclient.ApiClient; +import org.vcell.restclient.ApiException; +import org.vcell.restclient.Configuration; +import org.vcell.restclient.models.*; +import org.vcell.restclient.api.UsersResourceApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://vcell-dev.cam.uchc.edu"); + + UsersResourceApi apiInstance = new UsersResourceApi(defaultClient); + String magic = "magic_example"; // String | + try { + apiInstance.processMagicLink(magic); + } catch (ApiException e) { + System.err.println("Exception when calling UsersResourceApi#processMagicLink"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **magic** | **String**| | [optional] | + +### Return type + + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | User mapped successfully | - | +| **400** | Invalid or expired magic link | - | +| **406** | User not mapped | - | +| **500** | Internal server error | - | + +## processMagicLinkWithHttpInfo + +> ApiResponse processMagicLink processMagicLinkWithHttpInfo(magic) + +Process the magic link and map the user + +### Example + +```java +// Import classes: +import org.vcell.restclient.ApiClient; +import org.vcell.restclient.ApiException; +import org.vcell.restclient.ApiResponse; +import org.vcell.restclient.Configuration; +import org.vcell.restclient.models.*; +import org.vcell.restclient.api.UsersResourceApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://vcell-dev.cam.uchc.edu"); + + UsersResourceApi apiInstance = new UsersResourceApi(defaultClient); + String magic = "magic_example"; // String | + try { + ApiResponse response = apiInstance.processMagicLinkWithHttpInfo(magic); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UsersResourceApi#processMagicLink"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **magic** | **String**| | [optional] | + +### Return type + + +ApiResponse + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | User mapped successfully | - | +| **400** | Invalid or expired magic link | - | +| **406** | User not mapped | - | +| **500** | Internal server error | - | + + +## requestRecoveryEmail + +> void requestRecoveryEmail(email, userID) + +request a recovery email to link a VCell account. + +### Example + +```java +// Import classes: +import org.vcell.restclient.ApiClient; +import org.vcell.restclient.ApiException; +import org.vcell.restclient.Configuration; +import org.vcell.restclient.auth.*; +import org.vcell.restclient.models.*; +import org.vcell.restclient.api.UsersResourceApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://vcell-dev.cam.uchc.edu"); + + + UsersResourceApi apiInstance = new UsersResourceApi(defaultClient); + String email = "email_example"; // String | + String userID = "userID_example"; // String | + try { + apiInstance.requestRecoveryEmail(email, userID); + } catch (ApiException e) { + System.err.println("Exception when calling UsersResourceApi#requestRecoveryEmail"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **email** | **String**| | [optional] | +| **userID** | **String**| | [optional] | + +### Return type + + +null (empty response body) + +### Authorization + +[openId](../README.md#openId) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | magic link sent in email if appropriate | - | +| **403** | Not Allowed | - | +| **401** | Not Authorized | - | + +## requestRecoveryEmailWithHttpInfo + +> ApiResponse requestRecoveryEmail requestRecoveryEmailWithHttpInfo(email, userID) + +request a recovery email to link a VCell account. + +### Example + +```java +// Import classes: +import org.vcell.restclient.ApiClient; +import org.vcell.restclient.ApiException; +import org.vcell.restclient.ApiResponse; +import org.vcell.restclient.Configuration; +import org.vcell.restclient.auth.*; +import org.vcell.restclient.models.*; +import org.vcell.restclient.api.UsersResourceApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://vcell-dev.cam.uchc.edu"); + + + UsersResourceApi apiInstance = new UsersResourceApi(defaultClient); + String email = "email_example"; // String | + String userID = "userID_example"; // String | + try { + ApiResponse response = apiInstance.requestRecoveryEmailWithHttpInfo(email, userID); + System.out.println("Status code: " + response.getStatusCode()); + System.out.println("Response headers: " + response.getHeaders()); + } catch (ApiException e) { + System.err.println("Exception when calling UsersResourceApi#requestRecoveryEmail"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Response headers: " + e.getResponseHeaders()); + System.err.println("Reason: " + e.getResponseBody()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **email** | **String**| | [optional] | +| **userID** | **String**| | [optional] | + +### Return type + + +ApiResponse + +### Authorization + +[openId](../README.md#openId) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | magic link sent in email if appropriate | - | +| **403** | Not Allowed | - | +| **401** | Not Authorized | - | + + ## unmapUser > Boolean unmapUser(userName) diff --git a/vcell-restclient/src/main/java/org/vcell/restclient/api/UsersResourceApi.java b/vcell-restclient/src/main/java/org/vcell/restclient/api/UsersResourceApi.java index 3d02747865..c611a08b0c 100644 --- a/vcell-restclient/src/main/java/org/vcell/restclient/api/UsersResourceApi.java +++ b/vcell-restclient/src/main/java/org/vcell/restclient/api/UsersResourceApi.java @@ -579,6 +579,180 @@ private HttpRequest.Builder mapUserRequestBuilder(UserLoginInfoForMapping userLo } return localVarRequestBuilder; } + /** + * Process the magic link and map the user + * + * @param magic (optional) + * @throws ApiException if fails to make API call + */ + public void processMagicLink(String magic) throws ApiException { + processMagicLinkWithHttpInfo(magic); + } + + /** + * Process the magic link and map the user + * + * @param magic (optional) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse processMagicLinkWithHttpInfo(String magic) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = processMagicLinkRequestBuilder(magic); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("processMagicLink", localVarResponse); + } + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder processMagicLinkRequestBuilder(String magic) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/v1/users/processMagicLink"; + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "magic"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("magic", magic)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + /** + * request a recovery email to link a VCell account. + * + * @param email (optional) + * @param userID (optional) + * @throws ApiException if fails to make API call + */ + public void requestRecoveryEmail(String email, String userID) throws ApiException { + requestRecoveryEmailWithHttpInfo(email, userID); + } + + /** + * request a recovery email to link a VCell account. + * + * @param email (optional) + * @param userID (optional) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + */ + public ApiResponse requestRecoveryEmailWithHttpInfo(String email, String userID) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = requestRecoveryEmailRequestBuilder(email, userID); + try { + HttpResponse localVarResponse = memberVarHttpClient.send( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()); + if (memberVarResponseInterceptor != null) { + memberVarResponseInterceptor.accept(localVarResponse); + } + try { + if (localVarResponse.statusCode()/ 100 != 2) { + throw getApiException("requestRecoveryEmail", localVarResponse); + } + return new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ); + } finally { + // Drain the InputStream + while (localVarResponse.body().read() != -1) { + // Ignore + } + localVarResponse.body().close(); + } + } catch (IOException e) { + throw new ApiException(e); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new ApiException(e); + } + } + + private HttpRequest.Builder requestRecoveryEmailRequestBuilder(String email, String userID) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/api/v1/users/requestRecoveryEmail"; + + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "email"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("email", email)); + localVarQueryParameterBaseName = "userID"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("userID", userID)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } /** * remove vcell identity mapping * diff --git a/webapp-ng/src/app/core/modules/openapi/api/users-resource.service.ts b/webapp-ng/src/app/core/modules/openapi/api/users-resource.service.ts index 95483ad5c3..8656aa6a42 100644 --- a/webapp-ng/src/app/core/modules/openapi/api/users-resource.service.ts +++ b/webapp-ng/src/app/core/modules/openapi/api/users-resource.service.ts @@ -538,6 +538,139 @@ export class UsersResourceService implements UsersResourceServiceInterface { ); } + /** + * Process the magic link and map the user + * @param magic + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public processMagicLink(magic?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable; + public processMagicLink(magic?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; + public processMagicLink(magic?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; + public processMagicLink(magic?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable { + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + if (magic !== undefined && magic !== null) { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + magic, 'magic'); + } + + let localVarHeaders = this.defaultHeaders; + + let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; + if (localVarHttpHeaderAcceptSelected === undefined) { + // to determine the Accept header + const httpHeaderAccepts: string[] = [ + ]; + localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); + } + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + let localVarHttpContext: HttpContext | undefined = options && options.context; + if (localVarHttpContext === undefined) { + localVarHttpContext = new HttpContext(); + } + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/v1/users/processMagicLink`; + return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + withCredentials: this.configuration.withCredentials, + headers: localVarHeaders, + observe: observe, + reportProgress: reportProgress + } + ); + } + + /** + * request a recovery email to link a VCell account. + * @param email + * @param userID + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public requestRecoveryEmail(email?: string, userID?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable; + public requestRecoveryEmail(email?: string, userID?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; + public requestRecoveryEmail(email?: string, userID?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; + public requestRecoveryEmail(email?: string, userID?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable { + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + if (email !== undefined && email !== null) { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + email, 'email'); + } + if (userID !== undefined && userID !== null) { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + userID, 'userID'); + } + + let localVarHeaders = this.defaultHeaders; + + let localVarCredential: string | undefined; + // authentication (openId) required + localVarCredential = this.configuration.lookupCredential('openId'); + if (localVarCredential) { + } + + let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; + if (localVarHttpHeaderAcceptSelected === undefined) { + // to determine the Accept header + const httpHeaderAccepts: string[] = [ + ]; + localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); + } + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + let localVarHttpContext: HttpContext | undefined = options && options.context; + if (localVarHttpContext === undefined) { + localVarHttpContext = new HttpContext(); + } + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/v1/users/requestRecoveryEmail`; + return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + withCredentials: this.configuration.withCredentials, + headers: localVarHeaders, + observe: observe, + reportProgress: reportProgress + } + ); + } + /** * remove vcell identity mapping * @param userName diff --git a/webapp-ng/src/app/core/modules/openapi/api/users-resource.serviceInterface.ts b/webapp-ng/src/app/core/modules/openapi/api/users-resource.serviceInterface.ts index 70245be68b..51929301f1 100644 --- a/webapp-ng/src/app/core/modules/openapi/api/users-resource.serviceInterface.ts +++ b/webapp-ng/src/app/core/modules/openapi/api/users-resource.serviceInterface.ts @@ -73,6 +73,21 @@ export interface UsersResourceServiceInterface { */ mapUser(userLoginInfoForMapping?: UserLoginInfoForMapping, extraHttpRequestParams?: any): Observable; + /** + * Process the magic link and map the user + * + * @param magic + */ + processMagicLink(magic?: string, extraHttpRequestParams?: any): Observable<{}>; + + /** + * request a recovery email to link a VCell account. + * + * @param email + * @param userID + */ + requestRecoveryEmail(email?: string, userID?: string, extraHttpRequestParams?: any): Observable<{}>; + /** * remove vcell identity mapping *