memos-script/memos/api/auth_service_api.py
2024-04-30 10:31:09 +08:00

491 lines
18 KiB
Python

# coding: utf-8
"""
api/v1/activity_service.proto
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: version not set
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3 compatibility library
import six
from memos.api_client import ApiClient
class AuthServiceApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def auth_service_get_auth_status(self, **kwargs): # noqa: E501
"""GetAuthStatus returns the current auth status of the user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.auth_service_get_auth_status(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: V1User
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.auth_service_get_auth_status_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.auth_service_get_auth_status_with_http_info(**kwargs) # noqa: E501
return data
def auth_service_get_auth_status_with_http_info(self, **kwargs): # noqa: E501
"""GetAuthStatus returns the current auth status of the user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.auth_service_get_auth_status_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: V1User
If the method is called asynchronously,
returns the request thread.
"""
all_params = [] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method auth_service_get_auth_status" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/api/v1/auth/status', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='V1User', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def auth_service_sign_in(self, **kwargs): # noqa: E501
"""SignIn signs in the user with the given username and password. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.auth_service_sign_in(async_req=True)
>>> result = thread.get()
:param async_req bool
:param str username: The username to sign in with.
:param str password: The password to sign in with.
:param bool never_expire: Whether the session should never expire.
:return: V1User
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.auth_service_sign_in_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.auth_service_sign_in_with_http_info(**kwargs) # noqa: E501
return data
def auth_service_sign_in_with_http_info(self, **kwargs): # noqa: E501
"""SignIn signs in the user with the given username and password. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.auth_service_sign_in_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param str username: The username to sign in with.
:param str password: The password to sign in with.
:param bool never_expire: Whether the session should never expire.
:return: V1User
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['username', 'password', 'never_expire'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method auth_service_sign_in" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
if 'username' in params:
query_params.append(('username', params['username'])) # noqa: E501
if 'password' in params:
query_params.append(('password', params['password'])) # noqa: E501
if 'never_expire' in params:
query_params.append(('neverExpire', params['never_expire'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/api/v1/auth/signin', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='V1User', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def auth_service_sign_in_with_sso(self, **kwargs): # noqa: E501
"""SignInWithSSO signs in the user with the given SSO code. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.auth_service_sign_in_with_sso(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int idp_id: The ID of the SSO provider.
:param str code: The code to sign in with.
:param str redirect_uri: The redirect URI.
:return: V1User
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.auth_service_sign_in_with_sso_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.auth_service_sign_in_with_sso_with_http_info(**kwargs) # noqa: E501
return data
def auth_service_sign_in_with_sso_with_http_info(self, **kwargs): # noqa: E501
"""SignInWithSSO signs in the user with the given SSO code. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.auth_service_sign_in_with_sso_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param int idp_id: The ID of the SSO provider.
:param str code: The code to sign in with.
:param str redirect_uri: The redirect URI.
:return: V1User
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['idp_id', 'code', 'redirect_uri'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method auth_service_sign_in_with_sso" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
if 'idp_id' in params:
query_params.append(('idpId', params['idp_id'])) # noqa: E501
if 'code' in params:
query_params.append(('code', params['code'])) # noqa: E501
if 'redirect_uri' in params:
query_params.append(('redirectUri', params['redirect_uri'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/api/v1/auth/signin/sso', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='V1User', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def auth_service_sign_out(self, **kwargs): # noqa: E501
"""SignOut signs out the user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.auth_service_sign_out(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: object
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.auth_service_sign_out_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.auth_service_sign_out_with_http_info(**kwargs) # noqa: E501
return data
def auth_service_sign_out_with_http_info(self, **kwargs): # noqa: E501
"""SignOut signs out the user. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.auth_service_sign_out_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: object
If the method is called asynchronously,
returns the request thread.
"""
all_params = [] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method auth_service_sign_out" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/api/v1/auth/signout', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='object', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def auth_service_sign_up(self, **kwargs): # noqa: E501
"""SignUp signs up the user with the given username and password. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.auth_service_sign_up(async_req=True)
>>> result = thread.get()
:param async_req bool
:param str username: The username to sign up with.
:param str password: The password to sign up with.
:return: V1User
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.auth_service_sign_up_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.auth_service_sign_up_with_http_info(**kwargs) # noqa: E501
return data
def auth_service_sign_up_with_http_info(self, **kwargs): # noqa: E501
"""SignUp signs up the user with the given username and password. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.auth_service_sign_up_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param str username: The username to sign up with.
:param str password: The password to sign up with.
:return: V1User
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['username', 'password'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method auth_service_sign_up" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
if 'username' in params:
query_params.append(('username', params['username'])) # noqa: E501
if 'password' in params:
query_params.append(('password', params['password'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/api/v1/auth/signup', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='V1User', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)