add markdown report

This commit is contained in:
锦呈 2024-12-12 17:35:11 +08:00
parent d033f710b8
commit dda30f1d9c
2 changed files with 294 additions and 16 deletions

View File

@ -0,0 +1,156 @@
# coding: utf-8
"""
knext
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from openapi_client.configuration import Configuration
class ReportMarkdownRequest(object):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
openapi_types = {"task_id": "int", "content": "str"}
attribute_map = {"task_id": "taskId", "content": "content"}
def __init__(
self, task_id=None, content=None, local_vars_configuration=None
): # noqa: E501
"""ReportMarkdownRequest - a model defined in OpenAPI""" # noqa: E501
if local_vars_configuration is None:
local_vars_configuration = Configuration()
self.local_vars_configuration = local_vars_configuration
self._task_id = None
self._content = None
self.discriminator = None
self.task_id = task_id
self.content = content
@property
def task_id(self):
"""Gets the task_id of this ReportMarkdownRequest. # noqa: E501
:return: The task_id of this ReportMarkdownRequest. # noqa: E501
:rtype: int
"""
return self._task_id
@task_id.setter
def task_id(self, task_id):
"""Sets the task_id of this ReportMarkdownRequest.
:param task_id: The task_id of this ReportMarkdownRequest. # noqa: E501
:type: int
"""
if (
self.local_vars_configuration.client_side_validation and task_id is None
): # noqa: E501
raise ValueError(
"Invalid value for `task_id`, must not be `None`"
) # noqa: E501
self._task_id = task_id
@property
def content(self):
"""Gets the content of this ReportMarkdownRequest. # noqa: E501
:return: The content of this ReportMarkdownRequest. # noqa: E501
:rtype: str
"""
return self._content
@content.setter
def content(self, content):
"""Sets the content of this ReportMarkdownRequest.
:param content: The content of this ReportMarkdownRequest. # noqa: E501
:type: str
"""
if (
self.local_vars_configuration.client_side_validation and content is None
): # noqa: E501
raise ValueError(
"Invalid value for `content`, must not be `None`"
) # noqa: E501
self._content = content
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(
map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value)
)
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(
map(
lambda item: (
(item[0], item[1].to_dict())
if hasattr(item[1], "to_dict")
else item
),
value.items(),
)
)
else:
result[attr] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, ReportMarkdownRequest):
return False
return self.to_dict() == other.to_dict()
def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, ReportMarkdownRequest):
return True
return self.to_dict() != other.to_dict()

View File

@ -133,10 +133,10 @@ class ReasonerApi(object):
) # noqa: E501
# HTTP header `Content-Type`
header_params[
"Content-Type"
] = self.api_client.select_header_content_type( # noqa: E501
["application/json"]
header_params["Content-Type"] = (
self.api_client.select_header_content_type( # noqa: E501
["application/json"]
)
) # noqa: E501
# Authentication setting
@ -369,10 +369,10 @@ class ReasonerApi(object):
) # noqa: E501
# HTTP header `Content-Type`
header_params[
"Content-Type"
] = self.api_client.select_header_content_type( # noqa: E501
["application/json"]
header_params["Content-Type"] = (
self.api_client.select_header_content_type( # noqa: E501
["application/json"]
)
) # noqa: E501
# Authentication setting
@ -489,10 +489,10 @@ class ReasonerApi(object):
) # noqa: E501
# HTTP header `Content-Type`
header_params[
"Content-Type"
] = self.api_client.select_header_content_type( # noqa: E501
["application/json"]
header_params["Content-Type"] = (
self.api_client.select_header_content_type( # noqa: E501
["application/json"]
)
) # noqa: E501
# Authentication setting
@ -625,10 +625,10 @@ class ReasonerApi(object):
) # noqa: E501
# HTTP header `Content-Type`
header_params[
"Content-Type"
] = self.api_client.select_header_content_type( # noqa: E501
["application/json"]
header_params["Content-Type"] = (
self.api_client.select_header_content_type( # noqa: E501
["application/json"]
)
) # noqa: E501
# Authentication setting
@ -653,3 +653,125 @@ class ReasonerApi(object):
_request_timeout=local_var_params.get("_request_timeout"),
collection_formats=collection_formats,
)
def reasoner_dialog_report_markdown_post(self, **kwargs): # noqa: E501
"""report_markdown # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.reasoner_dialog_report_markdown_post(async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param ReportMarkdownRequest report_markdown_request:
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: object
If the method is called asynchronously,
returns the request thread.
"""
kwargs["_return_http_data_only"] = True
return self.reasoner_dialog_report_markdown_post_with_http_info(
**kwargs
) # noqa: E501
def reasoner_dialog_report_markdown_post_with_http_info(
self, **kwargs
): # noqa: E501
"""report_markdown # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.reasoner_dialog_report_markdown_post_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param ReportMarkdownRequest report_markdown_request:
:param _return_http_data_only: response data without head status code
and headers
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: tuple(object, status_code(int), headers(HTTPHeaderDict))
If the method is called asynchronously,
returns the request thread.
"""
local_var_params = locals()
all_params = ["report_markdown_request"]
all_params.extend(
[
"async_req",
"_return_http_data_only",
"_preload_content",
"_request_timeout",
]
)
for key, val in six.iteritems(local_var_params["kwargs"]):
if key not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method reasoner_dialog_report_markdown_post" % key
)
local_var_params[key] = val
del local_var_params["kwargs"]
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if "report_markdown_request" in local_var_params:
body_params = local_var_params["report_markdown_request"]
# HTTP header `Accept`
header_params["Accept"] = self.api_client.select_header_accept(
["application/json"]
) # noqa: E501
# HTTP header `Content-Type`
header_params["Content-Type"] = (
self.api_client.select_header_content_type( # noqa: E501
["application/json"]
)
) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
"/reasoner/dialog/report/markdown",
"POST",
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type="object", # noqa: E501
auth_settings=auth_settings,
async_req=local_var_params.get("async_req"),
_return_http_data_only=local_var_params.get(
"_return_http_data_only"
), # noqa: E501
_preload_content=local_var_params.get("_preload_content", True),
_request_timeout=local_var_params.get("_request_timeout"),
collection_formats=collection_formats,
)