"""
    HCL AppScan on Cloud (v2)

    This API allows you to interact with the service. The API allows you to perform many of the operations available in the UI and more.</br>For authentication, use the relevant APIs in the Account section. A successful authentication response includes a bearer token for use in subsequent API calls. Pasting this token in the 'Access token' field above will automatically add the authorization header to any API call that requires a valid session.

    OpenAPI spec version: v2

    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


import re  # noqa: F401

# python 2 and python 3 compatibility library
from pyasoc.api_client import ApiClient


class PresencesApi:
    """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 presences_create_presence(self, new_presence, **kwargs):
        """Create a new presence

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.presences_create_presence(new_presence, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param UserSiteCommonModelsNewPresence new_presence: Presence properties (required)
        :return: UserSiteCommonModelsPresence
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.presences_create_presence_with_http_info(new_presence, **kwargs)
        else:
            (data) = self.presences_create_presence_with_http_info(new_presence, **kwargs)
            return data

    def presences_create_presence_with_http_info(self, new_presence, **kwargs):
        """Create a new presence

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.presences_create_presence_with_http_info(new_presence, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param UserSiteCommonModelsNewPresence new_presence: Presence properties (required)
        :return: UserSiteCommonModelsPresence
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["new_presence"]
        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 params["kwargs"].items():
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method presences_create_presence" % key
                )
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'new_presence' is set
        if self.api_client.client_side_validation and (
            "new_presence" not in params or params["new_presence"] is None
        ):
            raise ValueError(
                "Missing the required parameter `new_presence` when calling `presences_create_presence`"
            )

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = ["AccessToken"]

        return self.api_client.call_api(
            "/api/v2/Presences",
            "POST",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="UserSiteCommonModelsPresence",
            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 presences_delete_presence_by_presenceid(self, presence_id, **kwargs):
        """Delete the presence

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.presences_delete_presence_by_presenceid(presence_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str presence_id: ID of presence to be deleted (required)
        :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.presences_delete_presence_by_presenceid_with_http_info(
                presence_id, **kwargs
            )
        else:
            (data) = self.presences_delete_presence_by_presenceid_with_http_info(
                presence_id, **kwargs
            )
            return data

    def presences_delete_presence_by_presenceid_with_http_info(self, presence_id, **kwargs):
        """Delete the presence

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.presences_delete_presence_by_presenceid_with_http_info(presence_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str presence_id: ID of presence to be deleted (required)
        :return: object
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["presence_id"]
        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 params["kwargs"].items():
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method presences_delete_presence_by_presenceid" % key
                )
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'presence_id' is set
        if self.api_client.client_side_validation and (
            "presence_id" not in params or params["presence_id"] is None
        ):
            raise ValueError(
                "Missing the required parameter `presence_id` when calling `presences_delete_presence_by_presenceid`"
            )

        collection_formats = {}

        path_params = {}
        if "presence_id" in params:
            path_params["presenceId"] = params["presence_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", "text/json", "text/csv"]
        )

        # Authentication setting
        auth_settings = ["AccessToken"]

        return self.api_client.call_api(
            "/api/v2/Presences/{presenceId}",
            "DELETE",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="object",
            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 presences_download_by_presenceid_and_osflavor_and_presenceversion(
        self, presence_id, os_flavor, presence_version, **kwargs
    ):
        """Download the AppScan Presence tool. Tool includes a new generated presence key

        This API is obsolete. Please refer to API: POST /api/v2/Presences/{presenceId}/DownloadV2
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.presences_download_by_presenceid_and_osflavor_and_presenceversion(presence_id, os_flavor, presence_version, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str presence_id: The presenceId (required)
        :param str os_flavor: OS flavor (required)
        :param str presence_version: Presence major version (required)
        :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.presences_download_by_presenceid_and_osflavor_and_presenceversion_with_http_info(
                presence_id, os_flavor, presence_version, **kwargs
            )
        else:
            (
                data
            ) = self.presences_download_by_presenceid_and_osflavor_and_presenceversion_with_http_info(
                presence_id, os_flavor, presence_version, **kwargs
            )
            return data

    def presences_download_by_presenceid_and_osflavor_and_presenceversion_with_http_info(
        self, presence_id, os_flavor, presence_version, **kwargs
    ):
        """Download the AppScan Presence tool. Tool includes a new generated presence key

        This API is obsolete. Please refer to API: POST /api/v2/Presences/{presenceId}/DownloadV2
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.presences_download_by_presenceid_and_osflavor_and_presenceversion_with_http_info(presence_id, os_flavor, presence_version, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str presence_id: The presenceId (required)
        :param str os_flavor: OS flavor (required)
        :param str presence_version: Presence major version (required)
        :return: object
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["presence_id", "os_flavor", "presence_version"]
        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 params["kwargs"].items():
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method presences_download_by_presenceid_and_osflavor_and_presenceversion"
                    % key
                )
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'presence_id' is set
        if self.api_client.client_side_validation and (
            "presence_id" not in params or params["presence_id"] is None
        ):
            raise ValueError(
                "Missing the required parameter `presence_id` when calling `presences_download_by_presenceid_and_osflavor_and_presenceversion`"
            )
        # verify the required parameter 'os_flavor' is set
        if self.api_client.client_side_validation and (
            "os_flavor" not in params or params["os_flavor"] is None
        ):
            raise ValueError(
                "Missing the required parameter `os_flavor` when calling `presences_download_by_presenceid_and_osflavor_and_presenceversion`"
            )
        # verify the required parameter 'presence_version' is set
        if self.api_client.client_side_validation and (
            "presence_version" not in params or params["presence_version"] is None
        ):
            raise ValueError(
                "Missing the required parameter `presence_version` when calling `presences_download_by_presenceid_and_osflavor_and_presenceversion`"
            )

        collection_formats = {}

        path_params = {}
        if "presence_id" in params:
            path_params["presenceId"] = params["presence_id"]
        if "os_flavor" in params:
            path_params["osFlavor"] = params["os_flavor"]
        if "presence_version" in params:
            path_params["presenceVersion"] = params["presence_version"]

        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", "text/csv"]
        )

        # Authentication setting
        auth_settings = ["AccessToken"]

        return self.api_client.call_api(
            "/api/v2/Presences/{presenceId}/Download/{osFlavor}/{presenceVersion}",
            "POST",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="object",
            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 presences_download_v2_by_presenceid(self, presence_id, platform, **kwargs):
        """Download the AppScan Presence tool. Tool includes a new generated presence key

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.presences_download_v2_by_presenceid(presence_id, platform, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str presence_id: The presenceId (required)
        :param str platform: Pss platform (required)
        :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.presences_download_v2_by_presenceid_with_http_info(
                presence_id, platform, **kwargs
            )
        else:
            (data) = self.presences_download_v2_by_presenceid_with_http_info(
                presence_id, platform, **kwargs
            )
            return data

    def presences_download_v2_by_presenceid_with_http_info(self, presence_id, platform, **kwargs):
        """Download the AppScan Presence tool. Tool includes a new generated presence key

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.presences_download_v2_by_presenceid_with_http_info(presence_id, platform, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str presence_id: The presenceId (required)
        :param str platform: Pss platform (required)
        :return: object
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["presence_id", "platform"]
        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 params["kwargs"].items():
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method presences_download_v2_by_presenceid" % key
                )
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'presence_id' is set
        if self.api_client.client_side_validation and (
            "presence_id" not in params or params["presence_id"] is None
        ):
            raise ValueError(
                "Missing the required parameter `presence_id` when calling `presences_download_v2_by_presenceid`"
            )
        # verify the required parameter 'platform' is set
        if self.api_client.client_side_validation and (
            "platform" not in params or params["platform"] is None
        ):
            raise ValueError(
                "Missing the required parameter `platform` when calling `presences_download_v2_by_presenceid`"
            )

        collection_formats = {}

        path_params = {}
        if "presence_id" in params:
            path_params["presenceId"] = params["presence_id"]

        query_params = []
        if "platform" in params:
            query_params.append(("platform", params["platform"]))

        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", "text/csv"]
        )

        # Authentication setting
        auth_settings = ["AccessToken"]

        return self.api_client.call_api(
            "/api/v2/Presences/{presenceId}/DownloadV2",
            "POST",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="object",
            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 presences_get_presence_by_presenceid(self, presence_id, **kwargs):
        """Get details of a presence

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.presences_get_presence_by_presenceid(presence_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str presence_id: Presence ID (required)
        :return: UserSiteCommonModelsPresence
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.presences_get_presence_by_presenceid_with_http_info(presence_id, **kwargs)
        else:
            (data) = self.presences_get_presence_by_presenceid_with_http_info(presence_id, **kwargs)
            return data

    def presences_get_presence_by_presenceid_with_http_info(self, presence_id, **kwargs):
        """Get details of a presence

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.presences_get_presence_by_presenceid_with_http_info(presence_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str presence_id: Presence ID (required)
        :return: UserSiteCommonModelsPresence
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["presence_id"]
        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 params["kwargs"].items():
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method presences_get_presence_by_presenceid" % key
                )
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'presence_id' is set
        if self.api_client.client_side_validation and (
            "presence_id" not in params or params["presence_id"] is None
        ):
            raise ValueError(
                "Missing the required parameter `presence_id` when calling `presences_get_presence_by_presenceid`"
            )

        collection_formats = {}

        path_params = {}
        if "presence_id" in params:
            path_params["presenceId"] = params["presence_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", "text/json", "text/csv"]
        )

        # Authentication setting
        auth_settings = ["AccessToken"]

        return self.api_client.call_api(
            "/api/v2/Presences/{presenceId}",
            "GET",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="UserSiteCommonModelsPresence",
            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 presences_get_presences(self, **kwargs):
        """Get all the Presences in the current context

        This action returns all the presences that can be accessed using the provided access token</br>OData V3 compliant
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.presences_get_presences(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int top: The max number of records. (Up to 5000)
        :param int skip: The number of records to skip.
        :param str filter: A function that must evaluate to true for a record to be returned. (e.g. Name eq 'sam' or Name eq 'dan'). To filter an Id Property, open the model and see if its type is \"string\" or \"string($uuid)\". - For string no change is needed. - For \"string($uuid)\" add \"Guid\" immediately before the string (e.g. Id eq Guid'00000000-0000-0000-0000-000000000000')
        :param str select: Specifies a subset of properties to return.
        :param str orderby: Determines what values are used to order a collection of records. (e.g. Name,Id)
        :param str expand: Specifies the related resources to be included in line with retrieved resources.
        :return: list[UserSiteCommonModelsPresence]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.presences_get_presences_with_http_info(**kwargs)
        else:
            (data) = self.presences_get_presences_with_http_info(**kwargs)
            return data

    def presences_get_presences_with_http_info(self, **kwargs):
        """Get all the Presences in the current context

        This action returns all the presences that can be accessed using the provided access token</br>OData V3 compliant
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.presences_get_presences_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int top: The max number of records. (Up to 5000)
        :param int skip: The number of records to skip.
        :param str filter: A function that must evaluate to true for a record to be returned. (e.g. Name eq 'sam' or Name eq 'dan'). To filter an Id Property, open the model and see if its type is \"string\" or \"string($uuid)\". - For string no change is needed. - For \"string($uuid)\" add \"Guid\" immediately before the string (e.g. Id eq Guid'00000000-0000-0000-0000-000000000000')
        :param str select: Specifies a subset of properties to return.
        :param str orderby: Determines what values are used to order a collection of records. (e.g. Name,Id)
        :param str expand: Specifies the related resources to be included in line with retrieved resources.
        :return: list[UserSiteCommonModelsPresence]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = [
            "top",
            "skip",
            "filter",
            "select",
            "orderby",
            "expand",
        ]
        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 params["kwargs"].items():
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method presences_get_presences" % key
                )
            params[key] = val
        del params["kwargs"]

        collection_formats = {}

        path_params = {}

        query_params = []
        if "top" in params:
            query_params.append(("$top", params["top"]))
        if "skip" in params:
            query_params.append(("$skip", params["skip"]))
        if "filter" in params:
            query_params.append(("$filter", params["filter"]))
        if "select" in params:
            query_params.append(("$select", params["select"]))
        if "orderby" in params:
            query_params.append(("$orderby", params["orderby"]))
        if "expand" in params:
            query_params.append(("$expand", params["expand"]))

        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", "text/csv"]
        )

        # Authentication setting
        auth_settings = ["AccessToken"]

        return self.api_client.call_api(
            "/api/v2/Presences",
            "GET",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="list[UserSiteCommonModelsPresence]",
            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 presences_new_key_by_presenceid(self, presence_id, **kwargs):
        """Generate a new key for the given presence and return it.

        This action invalidates the previous key.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.presences_new_key_by_presenceid(presence_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str presence_id: Presence ID (required)
        :return: UserSiteCommonModelsNewKey
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs["_return_http_data_only"] = True
        if kwargs.get("async_req"):
            return self.presences_new_key_by_presenceid_with_http_info(presence_id, **kwargs)
        else:
            (data) = self.presences_new_key_by_presenceid_with_http_info(presence_id, **kwargs)
            return data

    def presences_new_key_by_presenceid_with_http_info(self, presence_id, **kwargs):
        """Generate a new key for the given presence and return it.

        This action invalidates the previous key.
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.presences_new_key_by_presenceid_with_http_info(presence_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str presence_id: Presence ID (required)
        :return: UserSiteCommonModelsNewKey
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["presence_id"]
        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 params["kwargs"].items():
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method presences_new_key_by_presenceid" % key
                )
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'presence_id' is set
        if self.api_client.client_side_validation and (
            "presence_id" not in params or params["presence_id"] is None
        ):
            raise ValueError(
                "Missing the required parameter `presence_id` when calling `presences_new_key_by_presenceid`"
            )

        collection_formats = {}

        path_params = {}
        if "presence_id" in params:
            path_params["presenceId"] = params["presence_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", "text/json", "text/csv"]
        )

        # Authentication setting
        auth_settings = ["AccessToken"]

        return self.api_client.call_api(
            "/api/v2/Presences/{presenceId}/NewKey",
            "GET",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="UserSiteCommonModelsNewKey",
            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 presences_update_presence_by_presenceid(self, presence_id, presence_data, **kwargs):
        """Modify presence data

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.presences_update_presence_by_presenceid(presence_id, presence_data, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str presence_id: ID of presence to be modified (required)
        :param UserSiteCommonModelsUpdatePresence presence_data: New presence data (required)
        :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.presences_update_presence_by_presenceid_with_http_info(
                presence_id, presence_data, **kwargs
            )
        else:
            (data) = self.presences_update_presence_by_presenceid_with_http_info(
                presence_id, presence_data, **kwargs
            )
            return data

    def presences_update_presence_by_presenceid_with_http_info(
        self, presence_id, presence_data, **kwargs
    ):
        """Modify presence data

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.presences_update_presence_by_presenceid_with_http_info(presence_id, presence_data, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str presence_id: ID of presence to be modified (required)
        :param UserSiteCommonModelsUpdatePresence presence_data: New presence data (required)
        :return: object
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ["presence_id", "presence_data"]
        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 params["kwargs"].items():
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method presences_update_presence_by_presenceid" % key
                )
            params[key] = val
        del params["kwargs"]
        # verify the required parameter 'presence_id' is set
        if self.api_client.client_side_validation and (
            "presence_id" not in params or params["presence_id"] is None
        ):
            raise ValueError(
                "Missing the required parameter `presence_id` when calling `presences_update_presence_by_presenceid`"
            )
        # verify the required parameter 'presence_data' is set
        if self.api_client.client_side_validation and (
            "presence_data" not in params or params["presence_data"] is None
        ):
            raise ValueError(
                "Missing the required parameter `presence_data` when calling `presences_update_presence_by_presenceid`"
            )

        collection_formats = {}

        path_params = {}
        if "presence_id" in params:
            path_params["presenceId"] = params["presence_id"]

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = ["AccessToken"]

        return self.api_client.call_api(
            "/api/v2/Presences/{presenceId}",
            "PUT",
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type="object",
            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,
        )
