# coding: utf-8

"""
    Collibra Data Governance Center Core API

    <p>The Core REST API allows you to create your own integrations with Collibra Data Governance Center.</p><p><i>Create custom applications to help users get access to the right data.</i></p>  # 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 collibra_core.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 get_activities(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 100 activities is 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.get_activities(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int offset: The first result to retrieve. If not set (offset = <code>0</code>), results will be retrieved starting from row <code>0</code>.
        :param int limit: The maximum number of results to retrieve. If not set (limit = <code>0</code>), the default limit will be used. The maximum allowed limit is 1000.
        :param int count_limit: Parameter not used in the context of activities, for performance reasons they are not counted.
        :param str task_id: The ID of the task which contains the basic find activities request.
        :param str context_id: The ID of the context which the activities should be searched for.
        :param list[str] involved_people_ids: The list of IDs of the people that should be involved in searched activities.
        :param list[str] involved_role_ids: The list of IDs of the roles that should be involved in searched activities.
        :param str performed_by_user_id: The ID of the user who performed searched activities.
        :param list[str] performed_by_role_ids: The list of IDs of the roles assigned to users who performed searched activities.
        :param str activity_type: The type of the activity.
        :param str call_id: The ID of the call.
        :param list[str] categories: The set of the categories of activities that should be searched. One of [ATTRIBUTE, ATTACHMENT, RELATION, COMMENT,<br/>STATUS, WORKFLOW, RESPONSIBILITY, USER, USER_GROUP, ROLE, TAGS, OTHERS].
        :param list[str] resource_types: The set of the resource types that searched activities refer to, i.e. [Community, Asset, Domain, Attribute,<br/>Relation, WorkflowInstance].
        :param int start_date: The start date of the searched activities, expressed as a Unix timestamp in milliseconds.
        :param int end_date: The end date of the searched activities, expressed as a Unix timestamp in milliseconds.
        :param bool call_count_enabled: Flag to indicate if the number of calls standing behind the activity should be returned or not.<br/>Note that by default that count will be not calculated as it brings an important performance penalty.
        :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.get_activities_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.get_activities_with_http_info(**kwargs)  # noqa: E501
            return data

    def get_activities_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 100 activities is 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.get_activities_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int offset: The first result to retrieve. If not set (offset = <code>0</code>), results will be retrieved starting from row <code>0</code>.
        :param int limit: The maximum number of results to retrieve. If not set (limit = <code>0</code>), the default limit will be used. The maximum allowed limit is 1000.
        :param int count_limit: Parameter not used in the context of activities, for performance reasons they are not counted.
        :param str task_id: The ID of the task which contains the basic find activities request.
        :param str context_id: The ID of the context which the activities should be searched for.
        :param list[str] involved_people_ids: The list of IDs of the people that should be involved in searched activities.
        :param list[str] involved_role_ids: The list of IDs of the roles that should be involved in searched activities.
        :param str performed_by_user_id: The ID of the user who performed searched activities.
        :param list[str] performed_by_role_ids: The list of IDs of the roles assigned to users who performed searched activities.
        :param str activity_type: The type of the activity.
        :param str call_id: The ID of the call.
        :param list[str] categories: The set of the categories of activities that should be searched. One of [ATTRIBUTE, ATTACHMENT, RELATION, COMMENT,<br/>STATUS, WORKFLOW, RESPONSIBILITY, USER, USER_GROUP, ROLE, TAGS, OTHERS].
        :param list[str] resource_types: The set of the resource types that searched activities refer to, i.e. [Community, Asset, Domain, Attribute,<br/>Relation, WorkflowInstance].
        :param int start_date: The start date of the searched activities, expressed as a Unix timestamp in milliseconds.
        :param int end_date: The end date of the searched activities, expressed as a Unix timestamp in milliseconds.
        :param bool call_count_enabled: Flag to indicate if the number of calls standing behind the activity should be returned or not.<br/>Note that by default that count will be not calculated as it brings an important performance penalty.
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['offset', 'limit', 'count_limit', 'task_id', 'context_id', 'involved_people_ids', 'involved_role_ids', 'performed_by_user_id', 'performed_by_role_ids', 'activity_type', 'call_id', 'categories', 'resource_types', 'start_date', 'end_date', 'call_count_enabled']  # 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 get_activities" % key
                )
            params[key] = val
        del params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'offset' in params:
            query_params.append(('offset', params['offset']))  # noqa: E501
        if 'limit' in params:
            query_params.append(('limit', params['limit']))  # noqa: E501
        if 'count_limit' in params:
            query_params.append(('countLimit', params['count_limit']))  # noqa: E501
        if 'task_id' in params:
            query_params.append(('taskId', params['task_id']))  # noqa: E501
        if 'context_id' in params:
            query_params.append(('contextId', params['context_id']))  # 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 'performed_by_user_id' in params:
            query_params.append(('performedByUserId', params['performed_by_user_id']))  # 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 '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 '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 'end_date' in params:
            query_params.append(('endDate', params['end_date']))  # noqa: E501
        if 'call_count_enabled' in params:
            query_params.append(('callCountEnabled', params['call_count_enabled']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # Authentication setting
        auth_settings = ['basicAuth']  # 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=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)
