# 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 ReportingApi(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_insights_zip(self, **kwargs):  # noqa: E501
        """Reporting insights download  # noqa: E501

        Returns a Reporting Data archive (zip) file that contains Apache Parquet files with table content for each of the seven concepts (community, domain, asset, attribute, relation, responsibility and usage) for one day (=snapshot date). Please refer to the Reporting Data Layer product documentation for more information at [Working with your reporting data](https://productresources.collibra.com/docs/collibra/latest/Content/Reporting/co_working-with-data.htm).<br />Collibra Insights Data Access provides data that may be subject to access restrictions within your organization. Please ensure you follow your organization's policies and have approval to access this data.<br />This operation is deprecated and it will be removed in the future.  # 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_insights_zip(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str snapshot_date: Snapshot date for reporting insights data in ISO8601 format (e.g.: 2019-05-14)
        :param str format: Archive format. Currently only ZIP format is accepted
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_insights_zip_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.get_insights_zip_with_http_info(**kwargs)  # noqa: E501
            return data

    def get_insights_zip_with_http_info(self, **kwargs):  # noqa: E501
        """Reporting insights download  # noqa: E501

        Returns a Reporting Data archive (zip) file that contains Apache Parquet files with table content for each of the seven concepts (community, domain, asset, attribute, relation, responsibility and usage) for one day (=snapshot date). Please refer to the Reporting Data Layer product documentation for more information at [Working with your reporting data](https://productresources.collibra.com/docs/collibra/latest/Content/Reporting/co_working-with-data.htm).<br />Collibra Insights Data Access provides data that may be subject to access restrictions within your organization. Please ensure you follow your organization's policies and have approval to access this data.<br />This operation is deprecated and it will be removed in the future.  # 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_insights_zip_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str snapshot_date: Snapshot date for reporting insights data in ISO8601 format (e.g.: 2019-05-14)
        :param str format: Archive format. Currently only ZIP format is accepted
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['snapshot_date', 'format']  # 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_insights_zip" % key
                )
            params[key] = val
        del params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'snapshot_date' in params:
            query_params.append(('snapshotDate', params['snapshot_date']))  # noqa: E501
        if 'format' in params:
            query_params.append(('format', params['format']))  # 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 = ['basicAuth']  # noqa: E501

        return self.api_client.call_api(
            '/reporting/insights/download', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            #response_type='str',  # noqa: E501
            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 get_pre_signed_insights_zip(self, **kwargs):  # noqa: E501
        """Reporting insights download directly from cloud storage  # noqa: E501

        Returns a Reporting Data archive (zip) file that contains Apache Parquet files with table content for each of the seven concepts (community, domain, asset, attribute, relation, responsibility and usage) for one day (=snapshot date). Please refer to the Reporting Data Layer product documentation for more information at [Working with your reporting data](https://productresources.collibra.com/docs/collibra/latest/Content/Reporting/co_working-with-data.htm).<br />Collibra Insights Data Access provides data that may be subject to access restrictions within your organization. Please ensure you follow your organization's policies and have approval to access this data.<br />This endpoint redirects to download the Reporting Data archive (zip) file directly from cloud storage, bypassing the Collibra network. The redirect URL is temporary, valid for 60 seconds by default (see “pre-signed URL” in AWS and GCP docs for more details). You will need to allow redirects for this endpoint to work correctly.<br />Note: The \"Try it out\" button in the documentation UI might not work properly. To test this endpoint, please use curl with \"-L\" option to follow redirects.   # 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_pre_signed_insights_zip(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str snapshot_date: Snapshot date for reporting insights data in ISO8601 format (e.g.: 2019-05-14)
        :param str format: Archive format. Currently only ZIP format is accepted
        :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_pre_signed_insights_zip_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.get_pre_signed_insights_zip_with_http_info(**kwargs)  # noqa: E501
            return data

    def get_pre_signed_insights_zip_with_http_info(self, **kwargs):  # noqa: E501
        """Reporting insights download directly from cloud storage  # noqa: E501

        Returns a Reporting Data archive (zip) file that contains Apache Parquet files with table content for each of the seven concepts (community, domain, asset, attribute, relation, responsibility and usage) for one day (=snapshot date). Please refer to the Reporting Data Layer product documentation for more information at [Working with your reporting data](https://productresources.collibra.com/docs/collibra/latest/Content/Reporting/co_working-with-data.htm).<br />Collibra Insights Data Access provides data that may be subject to access restrictions within your organization. Please ensure you follow your organization's policies and have approval to access this data.<br />This endpoint redirects to download the Reporting Data archive (zip) file directly from cloud storage, bypassing the Collibra network. The redirect URL is temporary, valid for 60 seconds by default (see “pre-signed URL” in AWS and GCP docs for more details). You will need to allow redirects for this endpoint to work correctly.<br />Note: The \"Try it out\" button in the documentation UI might not work properly. To test this endpoint, please use curl with \"-L\" option to follow redirects.   # 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_pre_signed_insights_zip_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str snapshot_date: Snapshot date for reporting insights data in ISO8601 format (e.g.: 2019-05-14)
        :param str format: Archive format. Currently only ZIP format is accepted
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['snapshot_date', 'format']  # 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_pre_signed_insights_zip" % key
                )
            params[key] = val
        del params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'snapshot_date' in params:
            query_params.append(('snapshotDate', params['snapshot_date']))  # noqa: E501
        if 'format' in params:
            query_params.append(('format', params['format']))  # 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(
            '/reporting/insights/directDownload', '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)
