# coding: utf-8

"""
    \"Data Governance Center: REST API v2\"

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

    OpenAPI spec version: 2.0
    
    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 swagger_client.api_client import ApiClient


class ActivitiesApi(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 resource_activity_stream_resource_get_activities_get(self, **kwargs):  # noqa: E501
        """Returns activities matching the given search criteria.  # noqa: E501

        Returns activities matching the given search criteria. Only parameters that are specified in this request and have not <code>null</code> values are used for filtering. All other parameters are ignored. The returned activities satisfy all constraints that are specified in this search criteria. By default a result containing 1000 activities is returned.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.resource_activity_stream_resource_get_activities_get(async=True)
        >>> result = thread.get()

        :param async bool
        :param str activity_type: The type of the activity
        :param str call_id: The <code>id</code> of the call
        :param list[str] categories: The set of the categories of activities that should be searched. One of [ATTRIBUTE, ATTACHMENT, RELATION, COMMENT, STATUS, WORKFLOW, RESPONSIBILITY, USER, USER_GROUP, ROLE, TAGS, OTHERS]
        :param str context_id: The <code>id</code> of the context which the activities should be searched for
        :param float end_date: The end date of the searched activities. It is the timestamp (in UTC time standard)
        :param list[str] involved_people_ids: The list of <code>id</code>s of the people that should be involved in searched activities
        :param list[str] involved_role_ids: The list of <code>id</code>s of the roles that should be involved in searched activities
        :param int limit: The maximum number of results to retrieve. If not set (value = <tt>0</tt>), the default limit will be used
        :param int offset: The first result to retrieve. If not set (value = <tt>0</tt>), results will be retrieved starting from row <tt>0</tt>
        :param list[str] performed_by_role_ids: The list of <code>id</code>s of the roles assigned to users who performed searched activities
        :param str performed_by_user_id: The <code>id</code> of the user who performed searched activities
        :param list[str] resource_types: The set of the resource types that searched activities refer to, i.e. [Community, Asset, Domain, Attribute, Relation, WorkflowInstance]
        :param float start_date: The start date of the searched activities. It is the timestamp (in UTC time standard)
        :param str task_id: The <code>id</code> of the task which contains the basic find activities request
        :return: JsonActivityImpl
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async'):
            return self.resource_activity_stream_resource_get_activities_get_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.resource_activity_stream_resource_get_activities_get_with_http_info(**kwargs)  # noqa: E501
            return data

    def resource_activity_stream_resource_get_activities_get_with_http_info(self, **kwargs):  # noqa: E501
        """Returns activities matching the given search criteria.  # noqa: E501

        Returns activities matching the given search criteria. Only parameters that are specified in this request and have not <code>null</code> values are used for filtering. All other parameters are ignored. The returned activities satisfy all constraints that are specified in this search criteria. By default a result containing 1000 activities is returned.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async=True
        >>> thread = api.resource_activity_stream_resource_get_activities_get_with_http_info(async=True)
        >>> result = thread.get()

        :param async bool
        :param str activity_type: The type of the activity
        :param str call_id: The <code>id</code> of the call
        :param list[str] categories: The set of the categories of activities that should be searched. One of [ATTRIBUTE, ATTACHMENT, RELATION, COMMENT, STATUS, WORKFLOW, RESPONSIBILITY, USER, USER_GROUP, ROLE, TAGS, OTHERS]
        :param str context_id: The <code>id</code> of the context which the activities should be searched for
        :param float end_date: The end date of the searched activities. It is the timestamp (in UTC time standard)
        :param list[str] involved_people_ids: The list of <code>id</code>s of the people that should be involved in searched activities
        :param list[str] involved_role_ids: The list of <code>id</code>s of the roles that should be involved in searched activities
        :param int limit: The maximum number of results to retrieve. If not set (value = <tt>0</tt>), the default limit will be used
        :param int offset: The first result to retrieve. If not set (value = <tt>0</tt>), results will be retrieved starting from row <tt>0</tt>
        :param list[str] performed_by_role_ids: The list of <code>id</code>s of the roles assigned to users who performed searched activities
        :param str performed_by_user_id: The <code>id</code> of the user who performed searched activities
        :param list[str] resource_types: The set of the resource types that searched activities refer to, i.e. [Community, Asset, Domain, Attribute, Relation, WorkflowInstance]
        :param float start_date: The start date of the searched activities. It is the timestamp (in UTC time standard)
        :param str task_id: The <code>id</code> of the task which contains the basic find activities request
        :return: JsonActivityImpl
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['activity_type', 'call_id', 'categories', 'context_id', 'end_date', 'involved_people_ids', 'involved_role_ids', 'limit', 'offset', 'performed_by_role_ids', 'performed_by_user_id', 'resource_types', 'start_date', 'task_id']  # noqa: E501
        all_params.append('async')
        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 resource_activity_stream_resource_get_activities_get" % key
                )
            params[key] = val
        del params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'activity_type' in params:
            query_params.append(('activityType', params['activity_type']))  # noqa: E501
        if 'call_id' in params:
            query_params.append(('callId', params['call_id']))  # noqa: E501
        if 'categories' in params:
            query_params.append(('categories', params['categories']))  # noqa: E501
            collection_formats['categories'] = 'multi'  # noqa: E501
        if 'context_id' in params:
            query_params.append(('contextId', params['context_id']))  # noqa: E501
        if 'end_date' in params:
            query_params.append(('endDate', params['end_date']))  # noqa: E501
        if 'involved_people_ids' in params:
            query_params.append(('involvedPeopleIds', params['involved_people_ids']))  # noqa: E501
            collection_formats['involvedPeopleIds'] = 'multi'  # noqa: E501
        if 'involved_role_ids' in params:
            query_params.append(('involvedRoleIds', params['involved_role_ids']))  # noqa: E501
            collection_formats['involvedRoleIds'] = 'multi'  # noqa: E501
        if 'limit' in params:
            query_params.append(('limit', params['limit']))  # noqa: E501
        if 'offset' in params:
            query_params.append(('offset', params['offset']))  # noqa: E501
        if 'performed_by_role_ids' in params:
            query_params.append(('performedByRoleIds', params['performed_by_role_ids']))  # noqa: E501
            collection_formats['performedByRoleIds'] = 'multi'  # noqa: E501
        if 'performed_by_user_id' in params:
            query_params.append(('performedByUserId', params['performed_by_user_id']))  # noqa: E501
        if 'resource_types' in params:
            query_params.append(('resourceTypes', params['resource_types']))  # noqa: E501
            collection_formats['resourceTypes'] = 'multi'  # noqa: E501
        if 'start_date' in params:
            query_params.append(('startDate', params['start_date']))  # noqa: E501
        if 'task_id' in params:
            query_params.append(('taskId', params['task_id']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/activities', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='JsonActivityImpl',  # noqa: E501
            auth_settings=auth_settings,
            async=params.get('async'),
            _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)
