# coding: utf-8
"""
Fortanix DSM REST API
This is a set of REST APIs for accessing the Fortanix Data Security Manager. This includes APIs for managing accounts, and for performing cryptographic and key management operations.
OpenAPI spec version: 1.0.0-20200608
Contact: support@fortanix.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from __future__ import absolute_import
import sys
import os
import re
# python 2 and python 3 compatibility library
from six import iteritems
from ..api_client import ApiClient
# 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
[docs]class UsersApi(object):
[docs] def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
[docs] def change_password(self, body, async_call=False, **kwargs):
"""
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type body: `PasswordChangeRequest`
:param body: Password change request (required)
:rtype: None
:return:
If the method is called asynchronously, returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if async_call:
return self.change_password_with_http_info(body, async_call=async_call, **kwargs)
else:
(data) = self.change_password_with_http_info(body, async_call=async_call, **kwargs)
return data
def change_password_with_http_info(self, body, async_call=False, **kwargs):
"""
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_call=True::
>>> thread = api.change_password_with_http_info(body, async_call=True)
>>> result = thread.get()
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type body: `PasswordChangeRequest`
:param body: Password change request (required)
:rtype: None
:return:
If the method is called asynchronously, returns the request thread.
"""
all_params = ['body']
all_params.append('async_call')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method change_password" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in params) or (params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `change_password`")
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
# Authentication setting
auth_settings = ['bearerToken']
return self.api_client.call_api('/sys/v1/users/change_password', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None,
auth_settings=auth_settings,
async_call=params.get('async_call'),
_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)
[docs] def confirm_email(self, user_id, body, async_call=False, **kwargs):
"""
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type user_id: `str`
:param user_id: User Identifier (required)
:type body: `ConfirmEmailRequest`
:param body: Validate user's email (required)
:rtype: `ConfirmEmailResponse`
:return:
If the method is called asynchronously, returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if async_call:
return self.confirm_email_with_http_info(user_id, body, async_call=async_call, **kwargs)
else:
(data) = self.confirm_email_with_http_info(user_id, body, async_call=async_call, **kwargs)
return data
def confirm_email_with_http_info(self, user_id, body, async_call=False, **kwargs):
"""
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_call=True::
>>> thread = api.confirm_email_with_http_info(user_id, body, async_call=True)
>>> result = thread.get()
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type user_id: `str`
:param user_id: User Identifier (required)
:type body: `ConfirmEmailRequest`
:param body: Validate user's email (required)
:rtype: `ConfirmEmailResponse`
:return:
If the method is called asynchronously, returns the request thread.
"""
all_params = ['user_id', 'body']
all_params.append('async_call')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method confirm_email" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'user_id' is set
if ('user_id' not in params) or (params['user_id'] is None):
raise ValueError("Missing the required parameter `user_id` when calling `confirm_email`")
# verify the required parameter 'body' is set
if ('body' not in params) or (params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `confirm_email`")
collection_formats = {}
path_params = {}
if 'user_id' in params:
path_params['user-id'] = params['user_id']
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
# Authentication setting
auth_settings = ['bearerToken']
return self.api_client.call_api('/sys/v1/users/{user-id}/confirm_email', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='ConfirmEmailResponse',
auth_settings=auth_settings,
async_call=params.get('async_call'),
_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)
[docs] def create_user(self, body, async_call=False, **kwargs):
"""
Signs up a new user.
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type body: `SignupRequest`
:param body: Email address of user (required)
:rtype: `User`
:return:
If the method is called asynchronously, returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if async_call:
return self.create_user_with_http_info(body, async_call=async_call, **kwargs)
else:
(data) = self.create_user_with_http_info(body, async_call=async_call, **kwargs)
return data
def create_user_with_http_info(self, body, async_call=False, **kwargs):
"""
Signs up a new user.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_call=True::
>>> thread = api.create_user_with_http_info(body, async_call=True)
>>> result = thread.get()
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type body: `SignupRequest`
:param body: Email address of user (required)
:rtype: `User`
:return:
If the method is called asynchronously, returns the request thread.
"""
all_params = ['body']
all_params.append('async_call')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method create_user" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in params) or (params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `create_user`")
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
# Authentication setting
auth_settings = ['bearerToken']
return self.api_client.call_api('/sys/v1/users', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='User',
auth_settings=auth_settings,
async_call=params.get('async_call'),
_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)
[docs] def delete_user(self, user_id, async_call=False, **kwargs):
"""
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type user_id: `str`
:param user_id: User Identifier (required)
:rtype: None
:return:
If the method is called asynchronously, returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if async_call:
return self.delete_user_with_http_info(user_id, async_call=async_call, **kwargs)
else:
(data) = self.delete_user_with_http_info(user_id, async_call=async_call, **kwargs)
return data
def delete_user_with_http_info(self, user_id, async_call=False, **kwargs):
"""
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_call=True::
>>> thread = api.delete_user_with_http_info(user_id, async_call=True)
>>> result = thread.get()
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type user_id: `str`
:param user_id: User Identifier (required)
:rtype: None
:return:
If the method is called asynchronously, returns the request thread.
"""
all_params = ['user_id']
all_params.append('async_call')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_user" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'user_id' is set
if ('user_id' not in params) or (params['user_id'] is None):
raise ValueError("Missing the required parameter `user_id` when calling `delete_user`")
collection_formats = {}
path_params = {}
if 'user_id' in params:
path_params['user-id'] = params['user_id']
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'])
# Authentication setting
auth_settings = ['bearerToken']
return self.api_client.call_api('/sys/v1/users/{user-id}/accounts', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None,
auth_settings=auth_settings,
async_call=params.get('async_call'),
_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)
[docs] def delete_user_account(self, async_call=False, **kwargs):
"""
Completely deletes the currently logged in user from the system.
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:rtype: None
:return:
If the method is called asynchronously, returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if async_call:
return self.delete_user_account_with_http_info(async_call=async_call, **kwargs)
else:
(data) = self.delete_user_account_with_http_info(async_call=async_call, **kwargs)
return data
def delete_user_account_with_http_info(self, async_call=False, **kwargs):
"""
Completely deletes the currently logged in user from the system.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_call=True::
>>> thread = api.delete_user_account_with_http_info(async_call=True)
>>> result = thread.get()
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:rtype: None
:return:
If the method is called asynchronously, returns the request thread.
"""
all_params = []
all_params.append('async_call')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_user_account" % 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'])
# Authentication setting
auth_settings = ['bearerToken']
return self.api_client.call_api('/sys/v1/users', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None,
auth_settings=auth_settings,
async_call=params.get('async_call'),
_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)
[docs] def forgot_password(self, body, async_call=False, **kwargs):
"""
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type body: `ForgotPasswordRequest`
:param body: Initiate forgot password sequrence (required)
:rtype: None
:return:
If the method is called asynchronously, returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if async_call:
return self.forgot_password_with_http_info(body, async_call=async_call, **kwargs)
else:
(data) = self.forgot_password_with_http_info(body, async_call=async_call, **kwargs)
return data
def forgot_password_with_http_info(self, body, async_call=False, **kwargs):
"""
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_call=True::
>>> thread = api.forgot_password_with_http_info(body, async_call=True)
>>> result = thread.get()
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type body: `ForgotPasswordRequest`
:param body: Initiate forgot password sequrence (required)
:rtype: None
:return:
If the method is called asynchronously, returns the request thread.
"""
all_params = ['body']
all_params.append('async_call')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method forgot_password" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in params) or (params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `forgot_password`")
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
# Authentication setting
auth_settings = ['bearerToken']
return self.api_client.call_api('/sys/v1/users/forgot_password', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None,
auth_settings=auth_settings,
async_call=params.get('async_call'),
_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)
[docs] def get_user(self, user_id, async_call=False, **kwargs):
"""
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type user_id: `str`
:param user_id: User Identifier (required)
:rtype: `User`
:return:
If the method is called asynchronously, returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if async_call:
return self.get_user_with_http_info(user_id, async_call=async_call, **kwargs)
else:
(data) = self.get_user_with_http_info(user_id, async_call=async_call, **kwargs)
return data
def get_user_with_http_info(self, user_id, async_call=False, **kwargs):
"""
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_call=True::
>>> thread = api.get_user_with_http_info(user_id, async_call=True)
>>> result = thread.get()
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type user_id: `str`
:param user_id: User Identifier (required)
:rtype: `User`
:return:
If the method is called asynchronously, returns the request thread.
"""
all_params = ['user_id']
all_params.append('async_call')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_user" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'user_id' is set
if ('user_id' not in params) or (params['user_id'] is None):
raise ValueError("Missing the required parameter `user_id` when calling `get_user`")
collection_formats = {}
path_params = {}
if 'user_id' in params:
path_params['user-id'] = params['user_id']
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'])
# Authentication setting
auth_settings = ['bearerToken']
return self.api_client.call_api('/sys/v1/users/{user-id}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='User',
auth_settings=auth_settings,
async_call=params.get('async_call'),
_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)
[docs] def get_user_account(self, async_call=False, **kwargs):
"""
Obtain the current user's account information.
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:rtype: `UserAccountMap`
:return:
If the method is called asynchronously, returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if async_call:
return self.get_user_account_with_http_info(async_call=async_call, **kwargs)
else:
(data) = self.get_user_account_with_http_info(async_call=async_call, **kwargs)
return data
def get_user_account_with_http_info(self, async_call=False, **kwargs):
"""
Obtain the current user's account information.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_call=True::
>>> thread = api.get_user_account_with_http_info(async_call=True)
>>> result = thread.get()
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:rtype: `UserAccountMap`
:return:
If the method is called asynchronously, returns the request thread.
"""
all_params = []
all_params.append('async_call')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_user_account" % 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'])
# Authentication setting
auth_settings = ['bearerToken']
return self.api_client.call_api('/sys/v1/users/accounts', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='UserAccountMap',
auth_settings=auth_settings,
async_call=params.get('async_call'),
_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)
[docs] def get_users(self, group_id=None, sort=None, start=None, limit=None, offset=None, async_call=False, **kwargs):
"""
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type group_id: `str`
:param group_id: Only retrieve users in the specified group.
:type sort: `str`
:param sort: This specifies the property (`user_id` only, for now) and order (ascending or descending) with which to sort the users. By default, users are sorted by `user_id` in ascending order. The syntax is \"<property>:[asc|desc]\" (e.g. \"user_id:desc\") or just \"<property>\" (ascending order by default).
:type start: `str`
:param start: If provided, this must be a value of the property specified in `sort`. Returned users will begin just above or just below this value (for asc/desc order resp.).
:type limit: `int`
:param limit: Maximum number of users to return. If not provided, the limit is 100.
:type offset: `int`
:param offset: Number of users past `start` to skip.
:rtype: list[`User`]
:return:
If the method is called asynchronously, returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if async_call:
return self.get_users_with_http_info(group_id=group_id, sort=sort, start=start, limit=limit, offset=offset, async_call=async_call, **kwargs)
else:
(data) = self.get_users_with_http_info(group_id=group_id, sort=sort, start=start, limit=limit, offset=offset, async_call=async_call, **kwargs)
return data
def get_users_with_http_info(self, group_id=None, sort=None, start=None, limit=None, offset=None, async_call=False, **kwargs):
"""
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_call=True::
>>> thread = api.get_users_with_http_info(async_call=True)
>>> result = thread.get()
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type group_id: `str`
:param group_id: Only retrieve users in the specified group.
:type sort: `str`
:param sort: This specifies the property (`user_id` only, for now) and order (ascending or descending) with which to sort the users. By default, users are sorted by `user_id` in ascending order. The syntax is \"<property>:[asc|desc]\" (e.g. \"user_id:desc\") or just \"<property>\" (ascending order by default).
:type start: `str`
:param start: If provided, this must be a value of the property specified in `sort`. Returned users will begin just above or just below this value (for asc/desc order resp.).
:type limit: `int`
:param limit: Maximum number of users to return. If not provided, the limit is 100.
:type offset: `int`
:param offset: Number of users past `start` to skip.
:rtype: list[`User`]
:return:
If the method is called asynchronously, returns the request thread.
"""
all_params = ['group_id', 'sort', 'start', 'limit', 'offset']
all_params.append('async_call')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_users" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
if 'group_id' in params:
query_params.append(('group_id', params['group_id']))
if 'sort' in params:
query_params.append(('sort', params['sort']))
if 'start' in params:
query_params.append(('start', params['start']))
if 'limit' in params:
query_params.append(('limit', params['limit']))
if 'offset' in params:
query_params.append(('offset', params['offset']))
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
# Authentication setting
auth_settings = ['bearerToken']
return self.api_client.call_api('/sys/v1/users', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='list[User]',
auth_settings=auth_settings,
async_call=params.get('async_call'),
_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)
[docs] def invite_user(self, body, async_call=False, **kwargs):
"""
Invite an existing user or new user to join an existing account. Only user email is required for invite API
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type body: `UserRequest`
:param body: Name of user (required)
:rtype: `User`
:return:
If the method is called asynchronously, returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if async_call:
return self.invite_user_with_http_info(body, async_call=async_call, **kwargs)
else:
(data) = self.invite_user_with_http_info(body, async_call=async_call, **kwargs)
return data
def invite_user_with_http_info(self, body, async_call=False, **kwargs):
"""
Invite an existing user or new user to join an existing account. Only user email is required for invite API
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_call=True::
>>> thread = api.invite_user_with_http_info(body, async_call=True)
>>> result = thread.get()
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type body: `UserRequest`
:param body: Name of user (required)
:rtype: `User`
:return:
If the method is called asynchronously, returns the request thread.
"""
all_params = ['body']
all_params.append('async_call')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method invite_user" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in params) or (params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `invite_user`")
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
# Authentication setting
auth_settings = ['bearerToken']
return self.api_client.call_api('/sys/v1/users/invite', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='User',
auth_settings=auth_settings,
async_call=params.get('async_call'),
_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)
[docs] def process_invitations(self, body, async_call=False, **kwargs):
"""
Process a user's pending invitations. It does both accepts and rejects.
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type body: `ProcessInviteRequest`
:param body: Process account invitation (both accepts and rejects) (required)
:rtype: None
:return:
If the method is called asynchronously, returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if async_call:
return self.process_invitations_with_http_info(body, async_call=async_call, **kwargs)
else:
(data) = self.process_invitations_with_http_info(body, async_call=async_call, **kwargs)
return data
def process_invitations_with_http_info(self, body, async_call=False, **kwargs):
"""
Process a user's pending invitations. It does both accepts and rejects.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_call=True::
>>> thread = api.process_invitations_with_http_info(body, async_call=True)
>>> result = thread.get()
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type body: `ProcessInviteRequest`
:param body: Process account invitation (both accepts and rejects) (required)
:rtype: None
:return:
If the method is called asynchronously, returns the request thread.
"""
all_params = ['body']
all_params.append('async_call')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method process_invitations" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if ('body' not in params) or (params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `process_invitations`")
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
# Authentication setting
auth_settings = ['bearerToken']
return self.api_client.call_api('/sys/v1/users/process_invite', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None,
auth_settings=auth_settings,
async_call=params.get('async_call'),
_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)
[docs] def resend_confirm_email(self, user_id, async_call=False, **kwargs):
"""
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type user_id: `str`
:param user_id: User Identifier (required)
:rtype: None
:return:
If the method is called asynchronously, returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if async_call:
return self.resend_confirm_email_with_http_info(user_id, async_call=async_call, **kwargs)
else:
(data) = self.resend_confirm_email_with_http_info(user_id, async_call=async_call, **kwargs)
return data
def resend_confirm_email_with_http_info(self, user_id, async_call=False, **kwargs):
"""
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_call=True::
>>> thread = api.resend_confirm_email_with_http_info(user_id, async_call=True)
>>> result = thread.get()
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type user_id: `str`
:param user_id: User Identifier (required)
:rtype: None
:return:
If the method is called asynchronously, returns the request thread.
"""
all_params = ['user_id']
all_params.append('async_call')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method resend_confirm_email" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'user_id' is set
if ('user_id' not in params) or (params['user_id'] is None):
raise ValueError("Missing the required parameter `user_id` when calling `resend_confirm_email`")
collection_formats = {}
path_params = {}
if 'user_id' in params:
path_params['user-id'] = params['user_id']
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'])
# Authentication setting
auth_settings = ['bearerToken']
return self.api_client.call_api('/sys/v1/users/{user-id}/resend_confirm_email', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None,
auth_settings=auth_settings,
async_call=params.get('async_call'),
_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)
[docs] def resend_invitation(self, user_id, async_call=False, **kwargs):
"""
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type user_id: `str`
:param user_id: User Identifier (required)
:rtype: None
:return:
If the method is called asynchronously, returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if async_call:
return self.resend_invitation_with_http_info(user_id, async_call=async_call, **kwargs)
else:
(data) = self.resend_invitation_with_http_info(user_id, async_call=async_call, **kwargs)
return data
def resend_invitation_with_http_info(self, user_id, async_call=False, **kwargs):
"""
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_call=True::
>>> thread = api.resend_invitation_with_http_info(user_id, async_call=True)
>>> result = thread.get()
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type user_id: `str`
:param user_id: User Identifier (required)
:rtype: None
:return:
If the method is called asynchronously, returns the request thread.
"""
all_params = ['user_id']
all_params.append('async_call')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method resend_invitation" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'user_id' is set
if ('user_id' not in params) or (params['user_id'] is None):
raise ValueError("Missing the required parameter `user_id` when calling `resend_invitation`")
collection_formats = {}
path_params = {}
if 'user_id' in params:
path_params['user-id'] = params['user_id']
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'])
# Authentication setting
auth_settings = ['bearerToken']
return self.api_client.call_api('/sys/v1/users/{user-id}/resend_invite', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None,
auth_settings=auth_settings,
async_call=params.get('async_call'),
_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)
[docs] def reset_password(self, user_id, body, async_call=False, **kwargs):
"""
Resetting a user's password. User must have a valid reset token from forgot password step.
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type user_id: `str`
:param user_id: User Identifier (required)
:type body: `PasswordResetRequest`
:param body: Reset password (required)
:rtype: None
:return:
If the method is called asynchronously, returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if async_call:
return self.reset_password_with_http_info(user_id, body, async_call=async_call, **kwargs)
else:
(data) = self.reset_password_with_http_info(user_id, body, async_call=async_call, **kwargs)
return data
def reset_password_with_http_info(self, user_id, body, async_call=False, **kwargs):
"""
Resetting a user's password. User must have a valid reset token from forgot password step.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_call=True::
>>> thread = api.reset_password_with_http_info(user_id, body, async_call=True)
>>> result = thread.get()
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type user_id: `str`
:param user_id: User Identifier (required)
:type body: `PasswordResetRequest`
:param body: Reset password (required)
:rtype: None
:return:
If the method is called asynchronously, returns the request thread.
"""
all_params = ['user_id', 'body']
all_params.append('async_call')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method reset_password" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'user_id' is set
if ('user_id' not in params) or (params['user_id'] is None):
raise ValueError("Missing the required parameter `user_id` when calling `reset_password`")
# verify the required parameter 'body' is set
if ('body' not in params) or (params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `reset_password`")
collection_formats = {}
path_params = {}
if 'user_id' in params:
path_params['user-id'] = params['user_id']
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
# Authentication setting
auth_settings = ['bearerToken']
return self.api_client.call_api('/sys/v1/users/{user-id}/reset_password', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None,
auth_settings=auth_settings,
async_call=params.get('async_call'),
_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)
[docs] def update_user(self, user_id, body, async_call=False, **kwargs):
"""
Change a user's properties.
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type user_id: `str`
:param user_id: User Identifier (required)
:type body: `UserRequest`
:param body: Name of user (required)
:rtype: `User`
:return:
If the method is called asynchronously, returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if async_call:
return self.update_user_with_http_info(user_id, body, async_call=async_call, **kwargs)
else:
(data) = self.update_user_with_http_info(user_id, body, async_call=async_call, **kwargs)
return data
def update_user_with_http_info(self, user_id, body, async_call=False, **kwargs):
"""
Change a user's properties.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_call=True::
>>> thread = api.update_user_with_http_info(user_id, body, async_call=True)
>>> result = thread.get()
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type user_id: `str`
:param user_id: User Identifier (required)
:type body: `UserRequest`
:param body: Name of user (required)
:rtype: `User`
:return:
If the method is called asynchronously, returns the request thread.
"""
all_params = ['user_id', 'body']
all_params.append('async_call')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method update_user" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'user_id' is set
if ('user_id' not in params) or (params['user_id'] is None):
raise ValueError("Missing the required parameter `user_id` when calling `update_user`")
# verify the required parameter 'body' is set
if ('body' not in params) or (params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `update_user`")
collection_formats = {}
path_params = {}
if 'user_id' in params:
path_params['user-id'] = params['user_id']
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
# Authentication setting
auth_settings = ['bearerToken']
return self.api_client.call_api('/sys/v1/users/{user-id}', 'PATCH',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='User',
auth_settings=auth_settings,
async_call=params.get('async_call'),
_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)
[docs] def validate_password_reset_token(self, user_id, body, async_call=False, **kwargs):
"""
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type user_id: `str`
:param user_id: User Identifier (required)
:type body: `ValidateTokenRequest`
:param body: Validate token (required)
:rtype: `ValidateTokenResponse`
:return:
If the method is called asynchronously, returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if async_call:
return self.validate_password_reset_token_with_http_info(user_id, body, async_call=async_call, **kwargs)
else:
(data) = self.validate_password_reset_token_with_http_info(user_id, body, async_call=async_call, **kwargs)
return data
def validate_password_reset_token_with_http_info(self, user_id, body, async_call=False, **kwargs):
"""
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_call=True::
>>> thread = api.validate_password_reset_token_with_http_info(user_id, body, async_call=True)
>>> result = thread.get()
:type async_call: bool
:param async_call: Whether the call should be performed asynchronously. (Default is False).
:type user_id: `str`
:param user_id: User Identifier (required)
:type body: `ValidateTokenRequest`
:param body: Validate token (required)
:rtype: `ValidateTokenResponse`
:return:
If the method is called asynchronously, returns the request thread.
"""
all_params = ['user_id', 'body']
all_params.append('async_call')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method validate_password_reset_token" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'user_id' is set
if ('user_id' not in params) or (params['user_id'] is None):
raise ValueError("Missing the required parameter `user_id` when calling `validate_password_reset_token`")
# verify the required parameter 'body' is set
if ('body' not in params) or (params['body'] is None):
raise ValueError("Missing the required parameter `body` when calling `validate_password_reset_token`")
collection_formats = {}
path_params = {}
if 'user_id' in params:
path_params['user-id'] = params['user_id']
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.\
select_header_accept(['application/json'])
# Authentication setting
auth_settings = ['bearerToken']
return self.api_client.call_api('/sys/v1/users/{user-id}/validate_token', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='ValidateTokenResponse',
auth_settings=auth_settings,
async_call=params.get('async_call'),
_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)