# Code generated by Lark OpenAPI.

import io
from typing import Any, Optional, Union, Dict, List, Set, IO, Callable, Type
from lark_oapi.core.const import UTF_8, CONTENT_TYPE, APPLICATION_JSON
from lark_oapi.core import JSON
from lark_oapi.core.token import verify
from lark_oapi.core.http import Transport
from lark_oapi.core.model import Config, RequestOption, RawResponse
from lark_oapi.core.utils import Files
from requests_toolbelt import MultipartEncoder
from ..model.audit_log_list_application_audit_log_request import AuditLogListApplicationAuditLogRequest
from ..model.audit_log_list_application_audit_log_response import AuditLogListApplicationAuditLogResponse
from ..model.data_change_log_detail_application_audit_log_request import DataChangeLogDetailApplicationAuditLogRequest
from ..model.data_change_log_detail_application_audit_log_response import DataChangeLogDetailApplicationAuditLogResponse
from ..model.data_change_logs_list_application_audit_log_request import DataChangeLogsListApplicationAuditLogRequest
from ..model.data_change_logs_list_application_audit_log_response import DataChangeLogsListApplicationAuditLogResponse
from ..model.get_application_audit_log_request import GetApplicationAuditLogRequest
from ..model.get_application_audit_log_response import GetApplicationAuditLogResponse


class ApplicationAuditLog(object):
    def __init__(self, config: Config) -> None:
        self.config: Config = config

    def audit_log_list(self, request: AuditLogListApplicationAuditLogRequest,
                       option: Optional[RequestOption] = None) -> AuditLogListApplicationAuditLogResponse:
        if option is None:
            option = RequestOption()

        # 鉴权、获取 token
        verify(self.config, request, option)

        # 添加 content-type
        if request.body is not None:
            option.headers[CONTENT_TYPE] = f"{APPLICATION_JSON}; charset=utf-8"

        # 发起请求
        resp: RawResponse = Transport.execute(self.config, request, option)

        # 反序列化
        response: AuditLogListApplicationAuditLogResponse = JSON.unmarshal(str(resp.content, UTF_8),
                                                                           AuditLogListApplicationAuditLogResponse)
        response.raw = resp

        return response

    async def aaudit_log_list(self, request: AuditLogListApplicationAuditLogRequest,
                              option: Optional[RequestOption] = None) -> AuditLogListApplicationAuditLogResponse:
        if option is None:
            option = RequestOption()

        # 鉴权、获取 token
        verify(self.config, request, option)

        # 发起请求
        resp: RawResponse = await Transport.aexecute(self.config, request, option)

        # 反序列化
        response: AuditLogListApplicationAuditLogResponse = JSON.unmarshal(str(resp.content, UTF_8),
                                                                           AuditLogListApplicationAuditLogResponse)
        response.raw = resp

        return response

    def data_change_log_detail(self, request: DataChangeLogDetailApplicationAuditLogRequest, option: Optional[
        RequestOption] = None) -> DataChangeLogDetailApplicationAuditLogResponse:
        if option is None:
            option = RequestOption()

        # 鉴权、获取 token
        verify(self.config, request, option)

        # 添加 content-type
        if request.body is not None:
            option.headers[CONTENT_TYPE] = f"{APPLICATION_JSON}; charset=utf-8"

        # 发起请求
        resp: RawResponse = Transport.execute(self.config, request, option)

        # 反序列化
        response: DataChangeLogDetailApplicationAuditLogResponse = JSON.unmarshal(str(resp.content, UTF_8),
                                                                                  DataChangeLogDetailApplicationAuditLogResponse)
        response.raw = resp

        return response

    async def adata_change_log_detail(self, request: DataChangeLogDetailApplicationAuditLogRequest, option: Optional[
        RequestOption] = None) -> DataChangeLogDetailApplicationAuditLogResponse:
        if option is None:
            option = RequestOption()

        # 鉴权、获取 token
        verify(self.config, request, option)

        # 发起请求
        resp: RawResponse = await Transport.aexecute(self.config, request, option)

        # 反序列化
        response: DataChangeLogDetailApplicationAuditLogResponse = JSON.unmarshal(str(resp.content, UTF_8),
                                                                                  DataChangeLogDetailApplicationAuditLogResponse)
        response.raw = resp

        return response

    def data_change_logs_list(self, request: DataChangeLogsListApplicationAuditLogRequest,
                              option: Optional[RequestOption] = None) -> DataChangeLogsListApplicationAuditLogResponse:
        if option is None:
            option = RequestOption()

        # 鉴权、获取 token
        verify(self.config, request, option)

        # 添加 content-type
        if request.body is not None:
            option.headers[CONTENT_TYPE] = f"{APPLICATION_JSON}; charset=utf-8"

        # 发起请求
        resp: RawResponse = Transport.execute(self.config, request, option)

        # 反序列化
        response: DataChangeLogsListApplicationAuditLogResponse = JSON.unmarshal(str(resp.content, UTF_8),
                                                                                 DataChangeLogsListApplicationAuditLogResponse)
        response.raw = resp

        return response

    async def adata_change_logs_list(self, request: DataChangeLogsListApplicationAuditLogRequest, option: Optional[
        RequestOption] = None) -> DataChangeLogsListApplicationAuditLogResponse:
        if option is None:
            option = RequestOption()

        # 鉴权、获取 token
        verify(self.config, request, option)

        # 发起请求
        resp: RawResponse = await Transport.aexecute(self.config, request, option)

        # 反序列化
        response: DataChangeLogsListApplicationAuditLogResponse = JSON.unmarshal(str(resp.content, UTF_8),
                                                                                 DataChangeLogsListApplicationAuditLogResponse)
        response.raw = resp

        return response

    def get(self, request: GetApplicationAuditLogRequest,
            option: Optional[RequestOption] = None) -> GetApplicationAuditLogResponse:
        if option is None:
            option = RequestOption()

        # 鉴权、获取 token
        verify(self.config, request, option)

        # 添加 content-type
        if request.body is not None:
            option.headers[CONTENT_TYPE] = f"{APPLICATION_JSON}; charset=utf-8"

        # 发起请求
        resp: RawResponse = Transport.execute(self.config, request, option)

        # 反序列化
        response: GetApplicationAuditLogResponse = JSON.unmarshal(str(resp.content, UTF_8),
                                                                  GetApplicationAuditLogResponse)
        response.raw = resp

        return response

    async def aget(self, request: GetApplicationAuditLogRequest,
                   option: Optional[RequestOption] = None) -> GetApplicationAuditLogResponse:
        if option is None:
            option = RequestOption()

        # 鉴权、获取 token
        verify(self.config, request, option)

        # 发起请求
        resp: RawResponse = await Transport.aexecute(self.config, request, option)

        # 反序列化
        response: GetApplicationAuditLogResponse = JSON.unmarshal(str(resp.content, UTF_8),
                                                                  GetApplicationAuditLogResponse)
        response.raw = resp

        return response
