# coding: utf-8

"""
Alteryx Server API V3

No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)  # noqa: E501

OpenAPI spec version: 3

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 src.server_client.api_client import ApiClient


class UsersApi(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 users_create_user(self, user_contract, **kwargs):  # noqa: E501
        """Create a new user.  # noqa: E501

        Only Curators can use this API endpoint.  This endpoint cannot be used for Windows Authentication configured
          Server instances.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.users_create_user(user_contract, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param CreateUserContract user_contract: The request body structure required to make a new user (required)
        :return: UserView
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.users_create_user_with_http_info(user_contract, **kwargs)  # noqa: E501
        else:
            (data) = self.users_create_user_with_http_info(user_contract, **kwargs)  # noqa: E501
            return data

    def users_create_user_with_http_info(self, user_contract, **kwargs):  # noqa: E501
        """Create a new user.  # noqa: E501

        Only Curators can use this API endpoint.  This endpoint cannot be used for Windows Authentication configured
          Server instances.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.users_create_user_with_http_info(user_contract, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param CreateUserContract user_contract: The request body structure required to make a new user (required)
        :return: UserView
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["user_contract"]  # 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 users_create_user" % key)
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'user_contract' is set
        if self.api_client.client_side_validation and (
            "user_contract" not in params or params["user_contract"] is None
        ):  # noqa: E501
            raise ValueError("Missing the required parameter `user_contract` when calling `users_create_user`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if "user_contract" in params:
            body_params = params["user_contract"]
        # HTTP header `Accept`
        header_params["Accept"] = self.api_client.select_header_accept(
            ["application/json", "text/json", "application/xml", "text/xml"]
        )  # noqa: E501

        # HTTP header `Content-Type`
        header_params["Content-Type"] = self.api_client.select_header_content_type(  # noqa: E501
            ["application/json", "text/json", "application/xml", "text/xml", "application/x-www-form-urlencoded"]
        )  # noqa: E501

        # Authentication setting
        auth_settings = ["oauth2"]  # noqa: E501

        return self.api_client.call_api(
            "/v3/users",
            "POST",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="UserView",  # 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 users_deactivate_user(self, user_id, **kwargs):  # noqa: E501
        """Update an existing user as inactive.  # noqa: E501

        Only Curators can use this API endpoint.   An array of user group IDs that the deactivated user is removed from.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.users_deactivate_user(user_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str user_id: Identifier for an existing user. (required)
        :return: list[str]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.users_deactivate_user_with_http_info(user_id, **kwargs)  # noqa: E501
        else:
            (data) = self.users_deactivate_user_with_http_info(user_id, **kwargs)  # noqa: E501
            return data

    def users_deactivate_user_with_http_info(self, user_id, **kwargs):  # noqa: E501
        """Update an existing user as inactive.  # noqa: E501

        Only Curators can use this API endpoint.   An array of user group IDs that the deactivated user is removed from.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.users_deactivate_user_with_http_info(user_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str user_id: Identifier for an existing user. (required)
        :return: list[str]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["user_id"]  # 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 users_deactivate_user" % key)
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'user_id' is set
        if self.api_client.client_side_validation and ("user_id" not in params or params["user_id"] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `user_id` when calling `users_deactivate_user`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if "user_id" in params:
            path_params["userId"] = params["user_id"]  # noqa: E501

        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", "text/json", "application/xml", "text/xml"]
        )  # noqa: E501

        # Authentication setting
        auth_settings = ["oauth2"]  # noqa: E501

        return self.api_client.call_api(
            "/v3/users/{userId}/deactivate",
            "POST",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="list[str]",  # 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 users_delete_user(self, user_id, **kwargs):  # noqa: E501
        """Delete an existing user.  # noqa: E501

        Only Curators can use this API endpoint.  If the user has any assets(workflows, schedules, collections) 
        or exists within any user groups, then the user cannot be deleted.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.users_delete_user(user_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str user_id: Identifier for an existing user. (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.users_delete_user_with_http_info(user_id, **kwargs)  # noqa: E501
        else:
            (data) = self.users_delete_user_with_http_info(user_id, **kwargs)  # noqa: E501
            return data

    def users_delete_user_with_http_info(self, user_id, **kwargs):  # noqa: E501
        """Delete an existing user.  # noqa: E501

        Only Curators can use this API endpoint.  If the user has any assets(workflows, schedules, collections)
          or exists within any user groups, then the user cannot be deleted.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.users_delete_user_with_http_info(user_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str user_id: Identifier for an existing user. (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["user_id"]  # 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 users_delete_user" % key)
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'user_id' is set
        if self.api_client.client_side_validation and ("user_id" not in params or params["user_id"] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `user_id` when calling `users_delete_user`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if "user_id" in params:
            path_params["userId"] = params["user_id"]  # noqa: E501

        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", "text/json", "application/xml", "text/xml"]
        )  # noqa: E501

        # Authentication setting
        auth_settings = ["oauth2"]  # noqa: E501

        return self.api_client.call_api(
            "/v3/users/{userId}",
            "DELETE",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # 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 users_get_user(self, user_id, **kwargs):  # noqa: E501
        """Retrieve details about an existing user.  # noqa: E501

        Only Curators can use this API endpoint.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.users_get_user(user_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str user_id: Identifier for an existing user. (required)
        :return: UserView
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.users_get_user_with_http_info(user_id, **kwargs)  # noqa: E501
        else:
            (data) = self.users_get_user_with_http_info(user_id, **kwargs)  # noqa: E501
            return data

    def users_get_user_with_http_info(self, user_id, **kwargs):  # noqa: E501
        """Retrieve details about an existing user.  # noqa: E501

        Only Curators can use this API endpoint.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.users_get_user_with_http_info(user_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str user_id: Identifier for an existing user. (required)
        :return: UserView
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["user_id"]  # 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 users_get_user" % key)
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'user_id' is set
        if self.api_client.client_side_validation and ("user_id" not in params or params["user_id"] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `user_id` when calling `users_get_user`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if "user_id" in params:
            path_params["userId"] = params["user_id"]  # noqa: E501

        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", "text/json", "application/xml", "text/xml"]
        )  # noqa: E501

        # Authentication setting
        auth_settings = ["oauth2"]  # noqa: E501

        return self.api_client.call_api(
            "/v3/users/{userId}",
            "GET",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="UserView",  # 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 users_get_users(self, **kwargs):  # noqa: E501
        """Retrieve all accessible user records.  # noqa: E501

        Only Curators can use this API endpoint.  If the searchContract.Verbose is set to false, then a reduced view
          object will be returned.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.users_get_users(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str view:
        :param bool active:
        :param str email:
        :param str role:
        :param str first_name:
        :param str last_name:
        :param datetime created_after:
        :param datetime created_before:
        :return: list[UserView]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.users_get_users_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.users_get_users_with_http_info(**kwargs)  # noqa: E501
            return data

    def users_get_users_with_http_info(self, **kwargs):  # noqa: E501
        """Retrieve all accessible user records.  # noqa: E501

        Only Curators can use this API endpoint.  If the searchContract.Verbose is set to false, then a reduced view
        object will be returned.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.users_get_users_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str view:
        :param bool active:
        :param str email:
        :param str role:
        :param str first_name:
        :param str last_name:
        :param datetime created_after:
        :param datetime created_before:
        :return: list[UserView]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["view", "active", "email", "role", "first_name", "last_name", "created_after", "created_before"]  # 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 users_get_users" % key)
            params[key] = val
        del params["kwargs"]

        collection_formats = {}

        path_params = {}

        query_params = []
        if "view" in params:
            query_params.append(("view", params["view"]))  # noqa: E501
        if "active" in params:
            query_params.append(("active", params["active"]))  # noqa: E501
        if "email" in params:
            query_params.append(("email", params["email"]))  # noqa: E501
        if "role" in params:
            query_params.append(("role", params["role"]))  # noqa: E501
        if "first_name" in params:
            query_params.append(("firstName", params["first_name"]))  # noqa: E501
        if "last_name" in params:
            query_params.append(("lastName", params["last_name"]))  # noqa: E501
        if "created_after" in params:
            query_params.append(("createdAfter", params["created_after"]))  # noqa: E501
        if "created_before" in params:
            query_params.append(("createdBefore", params["created_before"]))  # 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", "text/json", "application/xml", "text/xml"]
        )  # noqa: E501

        # Authentication setting
        auth_settings = ["oauth2"]  # noqa: E501

        return self.api_client.call_api(
            "/v3/users",
            "GET",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="list[UserView]",  # 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 users_get_users_assets(self, user_id, **kwargs):  # noqa: E501
        """Retrieve all accessible assets owned by an existing user.  # noqa: E501

        Only Curators can use this API endpoint.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.users_get_users_assets(user_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str user_id: Identifier for an existing user. (required)
        :param str asset_type: The type of assets I want to return (defaulted to All)
        :return: AssetsView
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.users_get_users_assets_with_http_info(user_id, **kwargs)  # noqa: E501
        else:
            (data) = self.users_get_users_assets_with_http_info(user_id, **kwargs)  # noqa: E501
            return data

    def users_get_users_assets_with_http_info(self, user_id, **kwargs):  # noqa: E501
        """Retrieve all accessible assets owned by an existing user.  # noqa: E501

        Only Curators can use this API endpoint.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.users_get_users_assets_with_http_info(user_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str user_id: Identifier for an existing user. (required)
        :param str asset_type: The type of assets I want to return (defaulted to All)
        :return: AssetsView
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["user_id", "asset_type"]  # 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 users_get_users_assets" % key)
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'user_id' is set
        if self.api_client.client_side_validation and ("user_id" not in params or params["user_id"] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `user_id` when calling `users_get_users_assets`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if "user_id" in params:
            path_params["userId"] = params["user_id"]  # noqa: E501

        query_params = []
        if "asset_type" in params:
            query_params.append(("assetType", params["asset_type"]))  # 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", "text/json", "application/xml", "text/xml"]
        )  # noqa: E501

        # Authentication setting
        auth_settings = ["oauth2"]  # noqa: E501

        return self.api_client.call_api(
            "/v3/users/{userId}/assets",
            "GET",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="AssetsView",  # 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 users_send_password_reset(self, user_id, **kwargs):  # noqa: E501
        """Send a password reset email to an existing user.  # noqa: E501

        Only Curators can use this API endpoint.  This endpoint cannot be used for Windows Authentication
          configured Server instances.  This endpoint cannot be used for SAML Authentication configured 
          Server instances.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.users_send_password_reset(user_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str user_id: Identifier for an existing user. (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.users_send_password_reset_with_http_info(user_id, **kwargs)  # noqa: E501
        else:
            (data) = self.users_send_password_reset_with_http_info(user_id, **kwargs)  # noqa: E501
            return data

    def users_send_password_reset_with_http_info(self, user_id, **kwargs):  # noqa: E501
        """Send a password reset email to an existing user.  # noqa: E501

        Only Curators can use this API endpoint.  This endpoint cannot be used for Windows Authentication configured
          Server instances.  This endpoint cannot be used for SAML Authentication configured Server instances.
              # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.users_send_password_reset_with_http_info(user_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str user_id: Identifier for an existing user. (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["user_id"]  # 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 users_send_password_reset" % key)
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'user_id' is set
        if self.api_client.client_side_validation and ("user_id" not in params or params["user_id"] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `user_id` when calling `users_send_password_reset`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if "user_id" in params:
            path_params["userId"] = params["user_id"]  # noqa: E501

        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", "text/json", "application/xml", "text/xml"]
        )  # noqa: E501

        # Authentication setting
        auth_settings = ["oauth2"]  # noqa: E501

        return self.api_client.call_api(
            "/v3/users/{userId}/passwordReset",
            "POST",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # 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 users_transfer_assets(self, user_id, contract, **kwargs):  # noqa: E501
        """Transfer all assets (workflows, schedules, collections) owned by one user to another.  # noqa: E501

        If any of the workflows require DCM connections, server connections, or specific run as credentials to run,
        these items will need to be updated before the workflow can run.   Additionally, if users are not in the
        same studio, when a workflow is transferred to the new studio, all other users in the new owner's studio
        will also receive access to the workflow, and all users from the old studio will lose access.
        Returns a list of schedule ids that will be broken or disabled after transfer if user is deleted.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.users_transfer_assets(user_id, contract, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str user_id: Id of the user to transfer assets from. (required)
        :param TransferUserAssetsContract contract:  (required)
        :return: list[AffectedScheduleView]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.users_transfer_assets_with_http_info(user_id, contract, **kwargs)  # noqa: E501
        else:
            (data) = self.users_transfer_assets_with_http_info(user_id, contract, **kwargs)  # noqa: E501
            return data

    def users_transfer_assets_with_http_info(self, user_id, contract, **kwargs):  # noqa: E501
        """Transfer all assets (workflows, schedules, collections) owned by one user to another.  # noqa: E501

        If any of the workflows require DCM connections, server connections, or specific run as credentials to run,
        these items will need to be updated before the workflow can run.   
        Additionally, if users are not in the same studio, when a workflow is transferred to the new studio, 
        all other users in the new owner's studio will also receive access to the workflow,   
        and all users from the old studio will lose access.
        Returns a list of schedule ids that will be broken or disabled after transfer if user is deleted.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.users_transfer_assets_with_http_info(user_id, contract, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str user_id: Id of the user to transfer assets from. (required)
        :param TransferUserAssetsContract contract:  (required)
        :return: list[AffectedScheduleView]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["user_id", "contract"]  # 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 users_transfer_assets" % key)
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'user_id' is set
        if self.api_client.client_side_validation and ("user_id" not in params or params["user_id"] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `user_id` when calling `users_transfer_assets`")  # noqa: E501
        # verify the required parameter 'contract' is set
        if self.api_client.client_side_validation and ("contract" not in params or params["contract"] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `contract` when calling `users_transfer_assets`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if "user_id" in params:
            path_params["userId"] = params["user_id"]  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if "contract" in params:
            body_params = params["contract"]
        # HTTP header `Accept`
        header_params["Accept"] = self.api_client.select_header_accept(
            ["application/json", "text/json", "application/xml", "text/xml"]
        )  # noqa: E501

        # HTTP header `Content-Type`
        header_params["Content-Type"] = self.api_client.select_header_content_type(  # noqa: E501
            ["application/json", "text/json", "application/xml", "text/xml", "application/x-www-form-urlencoded"]
        )  # noqa: E501

        # Authentication setting
        auth_settings = ["oauth2"]  # noqa: E501

        return self.api_client.call_api(
            "/v3/users/{userId}/assetTransfer",
            "PUT",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="list[AffectedScheduleView]",  # 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 users_update_user(self, user_id, update_contract, **kwargs):  # noqa: E501
        """Update details of an existing user.  # noqa: E501

        Only Curators can use this API endpoint.  The Id of the updateContract will be 
        overwritten by the id value in the URL.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.users_update_user(user_id, update_contract, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str user_id: Identifier for an existing user. (required)
        :param UpdateUserContract update_contract: The request body structure (required)
        :return: UserView
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.users_update_user_with_http_info(user_id, update_contract, **kwargs)  # noqa: E501
        else:
            (data) = self.users_update_user_with_http_info(user_id, update_contract, **kwargs)  # noqa: E501
            return data

    def users_update_user_with_http_info(self, user_id, update_contract, **kwargs):  # noqa: E501
        """Update details of an existing user.  # noqa: E501

        Only Curators can use this API endpoint.  The Id of the updateContract will be overwritten by
          the id value in the URL.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.users_update_user_with_http_info(user_id, update_contract, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str user_id: Identifier for an existing user. (required)
        :param UpdateUserContract update_contract: The request body structure (required)
        :return: UserView
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["user_id", "update_contract"]  # 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 users_update_user" % key)
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'user_id' is set
        if self.api_client.client_side_validation and ("user_id" not in params or params["user_id"] is None):  # noqa: E501
            raise ValueError("Missing the required parameter `user_id` when calling `users_update_user`")  # noqa: E501
        # verify the required parameter 'update_contract' is set
        if self.api_client.client_side_validation and (
            "update_contract" not in params or params["update_contract"] is None
        ):  # noqa: E501
            raise ValueError("Missing the required parameter `update_contract` when calling `users_update_user`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if "user_id" in params:
            path_params["userId"] = params["user_id"]  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if "update_contract" in params:
            body_params = params["update_contract"]
        # HTTP header `Accept`
        header_params["Accept"] = self.api_client.select_header_accept(
            ["application/json", "text/json", "application/xml", "text/xml"]
        )  # noqa: E501

        # HTTP header `Content-Type`
        header_params["Content-Type"] = self.api_client.select_header_content_type(  # noqa: E501
            ["application/json", "text/json", "application/xml", "text/xml", "application/x-www-form-urlencoded"]
        )  # noqa: E501

        # Authentication setting
        auth_settings = ["oauth2"]  # noqa: E501

        return self.api_client.call_api(
            "/v3/users/{userId}",
            "PUT",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="UserView",  # 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,
        )
