"""
BackendStatisticTag automatically generated by SDKgen please do not edit this file manually
https://sdkgen.app
"""

import requests
import sdkgen

from backend_statistic_chart import BackendStatisticChart
from backend_statistic_count import BackendStatisticCount
from common_message_exception import CommonMessageException

class BackendStatisticTag(sdkgen.TagAbstract):
    def __init__(self, http_client: requests.Session, parser: sdkgen.Parser):
        super().__init__(http_client, parser)
    pass


    def get_used_points(self, start_index: int, count: int, search: str, _from: str, to: str, operation_id: int, app_id: int, user_id: int, ip: str, user_agent: str, method: str, path: str, header: str, body: str) -> BackendStatisticChart:
        try:
            pathParams = {}

            queryParams = {}
            queryParams["startIndex"] = start_index
            queryParams["count"] = count
            queryParams["search"] = search
            queryParams["from"] = _from
            queryParams["to"] = to
            queryParams["operationId"] = operation_id
            queryParams["appId"] = app_id
            queryParams["userId"] = user_id
            queryParams["ip"] = ip
            queryParams["userAgent"] = user_agent
            queryParams["method"] = method
            queryParams["path"] = path
            queryParams["header"] = header
            queryParams["body"] = body

            queryStructNames = [];

            url = self.parser.url("/backend/statistic/used_points", pathParams)

            headers = {}

            response = self.http_client.get(url, headers=headers, params=this.parser.query(queryParams, queryStructNames))

            if response.status_code >= 200 and response.status_code < 300:
                return BackendStatisticChart.from_json(response.content)

            if response.status_code == 401:
                raise CommonMessageException(CommonMessage.from_json(response.content))
            if response.status_code == 500:
                raise CommonMessageException(CommonMessage.from_json(response.content))

            raise sdkgen.UnknownStatusCodeException("The server returned an unknown status code")
        except Exception as e:
            raise sdkgen.ClientException("An unknown error occurred: " + str(e))
    pass

    def get_time_per_operation(self, start_index: int, count: int, search: str, _from: str, to: str, operation_id: int, app_id: int, user_id: int, ip: str, user_agent: str, method: str, path: str, header: str, body: str) -> BackendStatisticChart:
        try:
            pathParams = {}

            queryParams = {}
            queryParams["startIndex"] = start_index
            queryParams["count"] = count
            queryParams["search"] = search
            queryParams["from"] = _from
            queryParams["to"] = to
            queryParams["operationId"] = operation_id
            queryParams["appId"] = app_id
            queryParams["userId"] = user_id
            queryParams["ip"] = ip
            queryParams["userAgent"] = user_agent
            queryParams["method"] = method
            queryParams["path"] = path
            queryParams["header"] = header
            queryParams["body"] = body

            queryStructNames = [];

            url = self.parser.url("/backend/statistic/time_per_operation", pathParams)

            headers = {}

            response = self.http_client.get(url, headers=headers, params=this.parser.query(queryParams, queryStructNames))

            if response.status_code >= 200 and response.status_code < 300:
                return BackendStatisticChart.from_json(response.content)

            if response.status_code == 401:
                raise CommonMessageException(CommonMessage.from_json(response.content))
            if response.status_code == 500:
                raise CommonMessageException(CommonMessage.from_json(response.content))

            raise sdkgen.UnknownStatusCodeException("The server returned an unknown status code")
        except Exception as e:
            raise sdkgen.ClientException("An unknown error occurred: " + str(e))
    pass

    def get_time_average(self, start_index: int, count: int, search: str, _from: str, to: str, operation_id: int, app_id: int, user_id: int, ip: str, user_agent: str, method: str, path: str, header: str, body: str) -> BackendStatisticChart:
        try:
            pathParams = {}

            queryParams = {}
            queryParams["startIndex"] = start_index
            queryParams["count"] = count
            queryParams["search"] = search
            queryParams["from"] = _from
            queryParams["to"] = to
            queryParams["operationId"] = operation_id
            queryParams["appId"] = app_id
            queryParams["userId"] = user_id
            queryParams["ip"] = ip
            queryParams["userAgent"] = user_agent
            queryParams["method"] = method
            queryParams["path"] = path
            queryParams["header"] = header
            queryParams["body"] = body

            queryStructNames = [];

            url = self.parser.url("/backend/statistic/time_average", pathParams)

            headers = {}

            response = self.http_client.get(url, headers=headers, params=this.parser.query(queryParams, queryStructNames))

            if response.status_code >= 200 and response.status_code < 300:
                return BackendStatisticChart.from_json(response.content)

            if response.status_code == 401:
                raise CommonMessageException(CommonMessage.from_json(response.content))
            if response.status_code == 500:
                raise CommonMessageException(CommonMessage.from_json(response.content))

            raise sdkgen.UnknownStatusCodeException("The server returned an unknown status code")
        except Exception as e:
            raise sdkgen.ClientException("An unknown error occurred: " + str(e))
    pass

    def get_most_used_operations(self, start_index: int, count: int, search: str, _from: str, to: str, operation_id: int, app_id: int, user_id: int, ip: str, user_agent: str, method: str, path: str, header: str, body: str) -> BackendStatisticChart:
        try:
            pathParams = {}

            queryParams = {}
            queryParams["startIndex"] = start_index
            queryParams["count"] = count
            queryParams["search"] = search
            queryParams["from"] = _from
            queryParams["to"] = to
            queryParams["operationId"] = operation_id
            queryParams["appId"] = app_id
            queryParams["userId"] = user_id
            queryParams["ip"] = ip
            queryParams["userAgent"] = user_agent
            queryParams["method"] = method
            queryParams["path"] = path
            queryParams["header"] = header
            queryParams["body"] = body

            queryStructNames = [];

            url = self.parser.url("/backend/statistic/most_used_operations", pathParams)

            headers = {}

            response = self.http_client.get(url, headers=headers, params=this.parser.query(queryParams, queryStructNames))

            if response.status_code >= 200 and response.status_code < 300:
                return BackendStatisticChart.from_json(response.content)

            if response.status_code == 401:
                raise CommonMessageException(CommonMessage.from_json(response.content))
            if response.status_code == 500:
                raise CommonMessageException(CommonMessage.from_json(response.content))

            raise sdkgen.UnknownStatusCodeException("The server returned an unknown status code")
        except Exception as e:
            raise sdkgen.ClientException("An unknown error occurred: " + str(e))
    pass

    def get_most_used_apps(self, start_index: int, count: int, search: str, _from: str, to: str, operation_id: int, app_id: int, user_id: int, ip: str, user_agent: str, method: str, path: str, header: str, body: str) -> BackendStatisticChart:
        try:
            pathParams = {}

            queryParams = {}
            queryParams["startIndex"] = start_index
            queryParams["count"] = count
            queryParams["search"] = search
            queryParams["from"] = _from
            queryParams["to"] = to
            queryParams["operationId"] = operation_id
            queryParams["appId"] = app_id
            queryParams["userId"] = user_id
            queryParams["ip"] = ip
            queryParams["userAgent"] = user_agent
            queryParams["method"] = method
            queryParams["path"] = path
            queryParams["header"] = header
            queryParams["body"] = body

            queryStructNames = [];

            url = self.parser.url("/backend/statistic/most_used_apps", pathParams)

            headers = {}

            response = self.http_client.get(url, headers=headers, params=this.parser.query(queryParams, queryStructNames))

            if response.status_code >= 200 and response.status_code < 300:
                return BackendStatisticChart.from_json(response.content)

            if response.status_code == 401:
                raise CommonMessageException(CommonMessage.from_json(response.content))
            if response.status_code == 500:
                raise CommonMessageException(CommonMessage.from_json(response.content))

            raise sdkgen.UnknownStatusCodeException("The server returned an unknown status code")
        except Exception as e:
            raise sdkgen.ClientException("An unknown error occurred: " + str(e))
    pass

    def get_issued_tokens(self, start_index: int, count: int, search: str, _from: str, to: str, operation_id: int, app_id: int, user_id: int, ip: str, user_agent: str, method: str, path: str, header: str, body: str) -> BackendStatisticChart:
        try:
            pathParams = {}

            queryParams = {}
            queryParams["startIndex"] = start_index
            queryParams["count"] = count
            queryParams["search"] = search
            queryParams["from"] = _from
            queryParams["to"] = to
            queryParams["operationId"] = operation_id
            queryParams["appId"] = app_id
            queryParams["userId"] = user_id
            queryParams["ip"] = ip
            queryParams["userAgent"] = user_agent
            queryParams["method"] = method
            queryParams["path"] = path
            queryParams["header"] = header
            queryParams["body"] = body

            queryStructNames = [];

            url = self.parser.url("/backend/statistic/issued_tokens", pathParams)

            headers = {}

            response = self.http_client.get(url, headers=headers, params=this.parser.query(queryParams, queryStructNames))

            if response.status_code >= 200 and response.status_code < 300:
                return BackendStatisticChart.from_json(response.content)

            if response.status_code == 401:
                raise CommonMessageException(CommonMessage.from_json(response.content))
            if response.status_code == 500:
                raise CommonMessageException(CommonMessage.from_json(response.content))

            raise sdkgen.UnknownStatusCodeException("The server returned an unknown status code")
        except Exception as e:
            raise sdkgen.ClientException("An unknown error occurred: " + str(e))
    pass

    def get_incoming_transactions(self, start_index: int, count: int, search: str, _from: str, to: str, operation_id: int, app_id: int, user_id: int, ip: str, user_agent: str, method: str, path: str, header: str, body: str) -> BackendStatisticChart:
        try:
            pathParams = {}

            queryParams = {}
            queryParams["startIndex"] = start_index
            queryParams["count"] = count
            queryParams["search"] = search
            queryParams["from"] = _from
            queryParams["to"] = to
            queryParams["operationId"] = operation_id
            queryParams["appId"] = app_id
            queryParams["userId"] = user_id
            queryParams["ip"] = ip
            queryParams["userAgent"] = user_agent
            queryParams["method"] = method
            queryParams["path"] = path
            queryParams["header"] = header
            queryParams["body"] = body

            queryStructNames = [];

            url = self.parser.url("/backend/statistic/incoming_transactions", pathParams)

            headers = {}

            response = self.http_client.get(url, headers=headers, params=this.parser.query(queryParams, queryStructNames))

            if response.status_code >= 200 and response.status_code < 300:
                return BackendStatisticChart.from_json(response.content)

            if response.status_code == 401:
                raise CommonMessageException(CommonMessage.from_json(response.content))
            if response.status_code == 500:
                raise CommonMessageException(CommonMessage.from_json(response.content))

            raise sdkgen.UnknownStatusCodeException("The server returned an unknown status code")
        except Exception as e:
            raise sdkgen.ClientException("An unknown error occurred: " + str(e))
    pass

    def get_incoming_requests(self, start_index: int, count: int, search: str, _from: str, to: str, operation_id: int, app_id: int, user_id: int, ip: str, user_agent: str, method: str, path: str, header: str, body: str) -> BackendStatisticChart:
        try:
            pathParams = {}

            queryParams = {}
            queryParams["startIndex"] = start_index
            queryParams["count"] = count
            queryParams["search"] = search
            queryParams["from"] = _from
            queryParams["to"] = to
            queryParams["operationId"] = operation_id
            queryParams["appId"] = app_id
            queryParams["userId"] = user_id
            queryParams["ip"] = ip
            queryParams["userAgent"] = user_agent
            queryParams["method"] = method
            queryParams["path"] = path
            queryParams["header"] = header
            queryParams["body"] = body

            queryStructNames = [];

            url = self.parser.url("/backend/statistic/incoming_requests", pathParams)

            headers = {}

            response = self.http_client.get(url, headers=headers, params=this.parser.query(queryParams, queryStructNames))

            if response.status_code >= 200 and response.status_code < 300:
                return BackendStatisticChart.from_json(response.content)

            if response.status_code == 401:
                raise CommonMessageException(CommonMessage.from_json(response.content))
            if response.status_code == 500:
                raise CommonMessageException(CommonMessage.from_json(response.content))

            raise sdkgen.UnknownStatusCodeException("The server returned an unknown status code")
        except Exception as e:
            raise sdkgen.ClientException("An unknown error occurred: " + str(e))
    pass

    def get_errors_per_operation(self, start_index: int, count: int, search: str, _from: str, to: str, operation_id: int, app_id: int, user_id: int, ip: str, user_agent: str, method: str, path: str, header: str, body: str) -> BackendStatisticChart:
        try:
            pathParams = {}

            queryParams = {}
            queryParams["startIndex"] = start_index
            queryParams["count"] = count
            queryParams["search"] = search
            queryParams["from"] = _from
            queryParams["to"] = to
            queryParams["operationId"] = operation_id
            queryParams["appId"] = app_id
            queryParams["userId"] = user_id
            queryParams["ip"] = ip
            queryParams["userAgent"] = user_agent
            queryParams["method"] = method
            queryParams["path"] = path
            queryParams["header"] = header
            queryParams["body"] = body

            queryStructNames = [];

            url = self.parser.url("/backend/statistic/errors_per_operation", pathParams)

            headers = {}

            response = self.http_client.get(url, headers=headers, params=this.parser.query(queryParams, queryStructNames))

            if response.status_code >= 200 and response.status_code < 300:
                return BackendStatisticChart.from_json(response.content)

            if response.status_code == 401:
                raise CommonMessageException(CommonMessage.from_json(response.content))
            if response.status_code == 500:
                raise CommonMessageException(CommonMessage.from_json(response.content))

            raise sdkgen.UnknownStatusCodeException("The server returned an unknown status code")
        except Exception as e:
            raise sdkgen.ClientException("An unknown error occurred: " + str(e))
    pass

    def get_count_requests(self, start_index: int, count: int, search: str, _from: str, to: str, operation_id: int, app_id: int, user_id: int, ip: str, user_agent: str, method: str, path: str, header: str, body: str) -> BackendStatisticCount:
        try:
            pathParams = {}

            queryParams = {}
            queryParams["startIndex"] = start_index
            queryParams["count"] = count
            queryParams["search"] = search
            queryParams["from"] = _from
            queryParams["to"] = to
            queryParams["operationId"] = operation_id
            queryParams["appId"] = app_id
            queryParams["userId"] = user_id
            queryParams["ip"] = ip
            queryParams["userAgent"] = user_agent
            queryParams["method"] = method
            queryParams["path"] = path
            queryParams["header"] = header
            queryParams["body"] = body

            queryStructNames = [];

            url = self.parser.url("/backend/statistic/count_requests", pathParams)

            headers = {}

            response = self.http_client.get(url, headers=headers, params=this.parser.query(queryParams, queryStructNames))

            if response.status_code >= 200 and response.status_code < 300:
                return BackendStatisticCount.from_json(response.content)

            if response.status_code == 401:
                raise CommonMessageException(CommonMessage.from_json(response.content))
            if response.status_code == 500:
                raise CommonMessageException(CommonMessage.from_json(response.content))

            raise sdkgen.UnknownStatusCodeException("The server returned an unknown status code")
        except Exception as e:
            raise sdkgen.ClientException("An unknown error occurred: " + str(e))
    pass


