You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

824 lines
34 KiB
Python

# Copyright (C) 2022 CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
# CVAT REST API
#
# REST API for Computer Vision Annotation Tool (CVAT) # noqa: E501
#
# The version of the OpenAPI document: alpha (2.0)
# Contact: support@cvat.ai
# Generated by: https://openapi-generator.tech
from __future__ import annotations
import re # noqa: F401
import typing
from typing import TYPE_CHECKING
import urllib3
from cvat_sdk.api_client import ApiClient
from cvat_sdk.api_client import Endpoint as _Endpoint
from cvat_sdk.model.about import About
from cvat_sdk.model.dataset_formats import DatasetFormats
from cvat_sdk.model.exception import Exception
from cvat_sdk.model.exception_request import ExceptionRequest
from cvat_sdk.model.file_info import FileInfo
from cvat_sdk.model.log_event import LogEvent
from cvat_sdk.model.log_event_request import LogEventRequest
from cvat_sdk.model.plugins import Plugins
from cvat_sdk.model_utils import date, datetime, file_type, none_type # noqa: F401
if TYPE_CHECKING:
# Enable introspection. Can't work normally due to cyclic imports
from cvat_sdk.apis import *
from cvat_sdk.models import *
class ServerApi(object):
"""NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
self.create_exception_endpoint = _Endpoint(
settings={
"response_schema": (Exception,),
"auth": ["SignatureAuthentication", "basicAuth", "cookieAuth", "tokenAuth"],
"endpoint_path": "/api/server/exception",
"operation_id": "create_exception",
"http_method": "POST",
"servers": None,
},
params_map={
"all": [
"exception_request",
"x_organization",
"org",
"org_id",
],
"required": [
"exception_request",
],
"nullable": [],
"enum": [],
"validation": [],
},
root_map={
"validations": {},
"allowed_values": {},
"openapi_types": {
"exception_request": (ExceptionRequest,),
"x_organization": (str,),
"org": (str,),
"org_id": (int,),
},
"attribute_map": {
"x_organization": "X-Organization",
"org": "org",
"org_id": "org_id",
},
"location_map": {
"exception_request": "body",
"x_organization": "header",
"org": "query",
"org_id": "query",
},
"collection_format_map": {},
},
headers_map={
"accept": ["application/vnd.cvat+json"],
"content_type": [
"application/json",
"application/x-www-form-urlencoded",
"multipart/form-data",
"application/offset+octet-stream",
],
},
api_client=api_client,
)
self.create_logs_endpoint = _Endpoint(
settings={
"response_schema": ([LogEvent],),
"auth": ["SignatureAuthentication", "basicAuth", "cookieAuth", "tokenAuth"],
"endpoint_path": "/api/server/logs",
"operation_id": "create_logs",
"http_method": "POST",
"servers": None,
},
params_map={
"all": [
"log_event_request",
"x_organization",
"org",
"org_id",
],
"required": [
"log_event_request",
],
"nullable": [],
"enum": [],
"validation": [],
},
root_map={
"validations": {},
"allowed_values": {},
"openapi_types": {
"log_event_request": ([LogEventRequest],),
"x_organization": (str,),
"org": (str,),
"org_id": (int,),
},
"attribute_map": {
"x_organization": "X-Organization",
"org": "org",
"org_id": "org_id",
},
"location_map": {
"log_event_request": "body",
"x_organization": "header",
"org": "query",
"org_id": "query",
},
"collection_format_map": {},
},
headers_map={
"accept": ["application/vnd.cvat+json"],
"content_type": [
"application/json",
"application/x-www-form-urlencoded",
"multipart/form-data",
"application/offset+octet-stream",
],
},
api_client=api_client,
)
self.list_share_endpoint = _Endpoint(
settings={
"response_schema": ([FileInfo],),
"auth": ["SignatureAuthentication", "basicAuth", "cookieAuth", "tokenAuth"],
"endpoint_path": "/api/server/share",
"operation_id": "list_share",
"http_method": "GET",
"servers": None,
},
params_map={
"all": [
"x_organization",
"directory",
"org",
"org_id",
],
"required": [],
"nullable": [],
"enum": [],
"validation": [],
},
root_map={
"validations": {},
"allowed_values": {},
"openapi_types": {
"x_organization": (str,),
"directory": (str,),
"org": (str,),
"org_id": (int,),
},
"attribute_map": {
"x_organization": "X-Organization",
"directory": "directory",
"org": "org",
"org_id": "org_id",
},
"location_map": {
"x_organization": "header",
"directory": "query",
"org": "query",
"org_id": "query",
},
"collection_format_map": {},
},
headers_map={
"accept": ["application/vnd.cvat+json"],
"content_type": [],
},
api_client=api_client,
)
self.retrieve_about_endpoint = _Endpoint(
settings={
"response_schema": (About,),
"auth": ["SignatureAuthentication", "basicAuth", "cookieAuth", "tokenAuth"],
"endpoint_path": "/api/server/about",
"operation_id": "retrieve_about",
"http_method": "GET",
"servers": None,
},
params_map={
"all": [
"x_organization",
"org",
"org_id",
],
"required": [],
"nullable": [],
"enum": [],
"validation": [],
},
root_map={
"validations": {},
"allowed_values": {},
"openapi_types": {
"x_organization": (str,),
"org": (str,),
"org_id": (int,),
},
"attribute_map": {
"x_organization": "X-Organization",
"org": "org",
"org_id": "org_id",
},
"location_map": {
"x_organization": "header",
"org": "query",
"org_id": "query",
},
"collection_format_map": {},
},
headers_map={
"accept": ["application/vnd.cvat+json"],
"content_type": [],
},
api_client=api_client,
)
self.retrieve_annotation_formats_endpoint = _Endpoint(
settings={
"response_schema": (DatasetFormats,),
"auth": ["SignatureAuthentication", "basicAuth", "cookieAuth", "tokenAuth"],
"endpoint_path": "/api/server/annotation/formats",
"operation_id": "retrieve_annotation_formats",
"http_method": "GET",
"servers": None,
},
params_map={
"all": [
"x_organization",
"org",
"org_id",
],
"required": [],
"nullable": [],
"enum": [],
"validation": [],
},
root_map={
"validations": {},
"allowed_values": {},
"openapi_types": {
"x_organization": (str,),
"org": (str,),
"org_id": (int,),
},
"attribute_map": {
"x_organization": "X-Organization",
"org": "org",
"org_id": "org_id",
},
"location_map": {
"x_organization": "header",
"org": "query",
"org_id": "query",
},
"collection_format_map": {},
},
headers_map={
"accept": ["application/vnd.cvat+json"],
"content_type": [],
},
api_client=api_client,
)
self.retrieve_plugins_endpoint = _Endpoint(
settings={
"response_schema": (Plugins,),
"auth": ["SignatureAuthentication", "basicAuth", "cookieAuth", "tokenAuth"],
"endpoint_path": "/api/server/plugins",
"operation_id": "retrieve_plugins",
"http_method": "GET",
"servers": None,
},
params_map={
"all": [
"x_organization",
"org",
"org_id",
],
"required": [],
"nullable": [],
"enum": [],
"validation": [],
},
root_map={
"validations": {},
"allowed_values": {},
"openapi_types": {
"x_organization": (str,),
"org": (str,),
"org_id": (int,),
},
"attribute_map": {
"x_organization": "X-Organization",
"org": "org",
"org_id": "org_id",
},
"location_map": {
"x_organization": "header",
"org": "query",
"org_id": "query",
},
"collection_format_map": {},
},
headers_map={
"accept": ["application/vnd.cvat+json"],
"content_type": [],
},
api_client=api_client,
)
def create_exception(
self,
exception_request: ExceptionRequest,
*,
_parse_response: bool = True,
_request_timeout: typing.Union[int, float, tuple] = None,
_validate_inputs: bool = True,
_validate_outputs: bool = True,
_check_status: bool = True,
_spec_property_naming: bool = False,
_content_type: typing.Optional[str] = None,
_host_index: typing.Optional[int] = None,
_request_auths: typing.Optional[typing.List] = None,
_async_call: bool = False,
**kwargs,
) -> typing.Tuple[typing.Optional[Exception], urllib3.HTTPResponse]:
"""Method saves an exception from a client on the server # noqa: E501
Sends logs to the ELK if it is connected # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass _async_call=True
>>> thread = api.create_exception(exception_request, _async_call=True)
>>> result = thread.get()
Args:
exception_request (ExceptionRequest):
Keyword Args:
x_organization (str): [optional]
org (str): Organization unique slug. [optional]
org_id (int): Organization identifier. [optional]
_parse_response (bool): if False, the response data will not be parsed,
None is returned for data.
Default is True.
_request_timeout (int/float/tuple): 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.
Default is None.
_validate_inputs (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_validate_outputs (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_check_status (bool): whether to check response status
for being positive or not.
Default is True
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
_async_call (bool): execute request asynchronously
Returns:
(Exception, HTTPResponse)
If the method is called asynchronously, returns the request
thread.
"""
kwargs["_async_call"] = _async_call
kwargs["_parse_response"] = _parse_response
kwargs["_request_timeout"] = _request_timeout
kwargs["_validate_inputs"] = _validate_inputs
kwargs["_validate_outputs"] = _validate_outputs
kwargs["_check_status"] = _check_status
kwargs["_spec_property_naming"] = _spec_property_naming
kwargs["_content_type"] = _content_type
kwargs["_host_index"] = _host_index
kwargs["_request_auths"] = _request_auths
kwargs["exception_request"] = exception_request
return self.create_exception_endpoint.call_with_http_info(**kwargs)
def create_logs(
self,
log_event_request: typing.List[LogEventRequest],
*,
_parse_response: bool = True,
_request_timeout: typing.Union[int, float, tuple] = None,
_validate_inputs: bool = True,
_validate_outputs: bool = True,
_check_status: bool = True,
_spec_property_naming: bool = False,
_content_type: typing.Optional[str] = None,
_host_index: typing.Optional[int] = None,
_request_auths: typing.Optional[typing.List] = None,
_async_call: bool = False,
**kwargs,
) -> typing.Tuple[typing.Optional[typing.List[LogEvent]], urllib3.HTTPResponse]:
"""Method saves logs from a client on the server # noqa: E501
Sends logs to the ELK if it is connected # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass _async_call=True
>>> thread = api.create_logs(log_event_request, _async_call=True)
>>> result = thread.get()
Args:
log_event_request ([LogEventRequest]):
Keyword Args:
x_organization (str): [optional]
org (str): Organization unique slug. [optional]
org_id (int): Organization identifier. [optional]
_parse_response (bool): if False, the response data will not be parsed,
None is returned for data.
Default is True.
_request_timeout (int/float/tuple): 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.
Default is None.
_validate_inputs (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_validate_outputs (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_check_status (bool): whether to check response status
for being positive or not.
Default is True
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
_async_call (bool): execute request asynchronously
Returns:
([LogEvent], HTTPResponse)
If the method is called asynchronously, returns the request
thread.
"""
kwargs["_async_call"] = _async_call
kwargs["_parse_response"] = _parse_response
kwargs["_request_timeout"] = _request_timeout
kwargs["_validate_inputs"] = _validate_inputs
kwargs["_validate_outputs"] = _validate_outputs
kwargs["_check_status"] = _check_status
kwargs["_spec_property_naming"] = _spec_property_naming
kwargs["_content_type"] = _content_type
kwargs["_host_index"] = _host_index
kwargs["_request_auths"] = _request_auths
kwargs["log_event_request"] = log_event_request
return self.create_logs_endpoint.call_with_http_info(**kwargs)
def list_share(
self,
*,
_parse_response: bool = True,
_request_timeout: typing.Union[int, float, tuple] = None,
_validate_inputs: bool = True,
_validate_outputs: bool = True,
_check_status: bool = True,
_spec_property_naming: bool = False,
_content_type: typing.Optional[str] = None,
_host_index: typing.Optional[int] = None,
_request_auths: typing.Optional[typing.List] = None,
_async_call: bool = False,
**kwargs,
) -> typing.Tuple[typing.Optional[typing.List[FileInfo]], urllib3.HTTPResponse]:
"""Returns all files and folders that are on the server along specified path # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass _async_call=True
>>> thread = api.list_share(_async_call=True)
>>> result = thread.get()
Keyword Args:
x_organization (str): [optional]
directory (str): Directory to browse. [optional]
org (str): Organization unique slug. [optional]
org_id (int): Organization identifier. [optional]
_parse_response (bool): if False, the response data will not be parsed,
None is returned for data.
Default is True.
_request_timeout (int/float/tuple): 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.
Default is None.
_validate_inputs (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_validate_outputs (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_check_status (bool): whether to check response status
for being positive or not.
Default is True
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
_async_call (bool): execute request asynchronously
Returns:
([FileInfo], HTTPResponse)
If the method is called asynchronously, returns the request
thread.
"""
kwargs["_async_call"] = _async_call
kwargs["_parse_response"] = _parse_response
kwargs["_request_timeout"] = _request_timeout
kwargs["_validate_inputs"] = _validate_inputs
kwargs["_validate_outputs"] = _validate_outputs
kwargs["_check_status"] = _check_status
kwargs["_spec_property_naming"] = _spec_property_naming
kwargs["_content_type"] = _content_type
kwargs["_host_index"] = _host_index
kwargs["_request_auths"] = _request_auths
return self.list_share_endpoint.call_with_http_info(**kwargs)
def retrieve_about(
self,
*,
_parse_response: bool = True,
_request_timeout: typing.Union[int, float, tuple] = None,
_validate_inputs: bool = True,
_validate_outputs: bool = True,
_check_status: bool = True,
_spec_property_naming: bool = False,
_content_type: typing.Optional[str] = None,
_host_index: typing.Optional[int] = None,
_request_auths: typing.Optional[typing.List] = None,
_async_call: bool = False,
**kwargs,
) -> typing.Tuple[typing.Optional[About], urllib3.HTTPResponse]:
"""Method provides basic CVAT information # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass _async_call=True
>>> thread = api.retrieve_about(_async_call=True)
>>> result = thread.get()
Keyword Args:
x_organization (str): [optional]
org (str): Organization unique slug. [optional]
org_id (int): Organization identifier. [optional]
_parse_response (bool): if False, the response data will not be parsed,
None is returned for data.
Default is True.
_request_timeout (int/float/tuple): 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.
Default is None.
_validate_inputs (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_validate_outputs (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_check_status (bool): whether to check response status
for being positive or not.
Default is True
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
_async_call (bool): execute request asynchronously
Returns:
(About, HTTPResponse)
If the method is called asynchronously, returns the request
thread.
"""
kwargs["_async_call"] = _async_call
kwargs["_parse_response"] = _parse_response
kwargs["_request_timeout"] = _request_timeout
kwargs["_validate_inputs"] = _validate_inputs
kwargs["_validate_outputs"] = _validate_outputs
kwargs["_check_status"] = _check_status
kwargs["_spec_property_naming"] = _spec_property_naming
kwargs["_content_type"] = _content_type
kwargs["_host_index"] = _host_index
kwargs["_request_auths"] = _request_auths
return self.retrieve_about_endpoint.call_with_http_info(**kwargs)
def retrieve_annotation_formats(
self,
*,
_parse_response: bool = True,
_request_timeout: typing.Union[int, float, tuple] = None,
_validate_inputs: bool = True,
_validate_outputs: bool = True,
_check_status: bool = True,
_spec_property_naming: bool = False,
_content_type: typing.Optional[str] = None,
_host_index: typing.Optional[int] = None,
_request_auths: typing.Optional[typing.List] = None,
_async_call: bool = False,
**kwargs,
) -> typing.Tuple[typing.Optional[DatasetFormats], urllib3.HTTPResponse]:
"""Method provides the list of supported annotations formats # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass _async_call=True
>>> thread = api.retrieve_annotation_formats(_async_call=True)
>>> result = thread.get()
Keyword Args:
x_organization (str): [optional]
org (str): Organization unique slug. [optional]
org_id (int): Organization identifier. [optional]
_parse_response (bool): if False, the response data will not be parsed,
None is returned for data.
Default is True.
_request_timeout (int/float/tuple): 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.
Default is None.
_validate_inputs (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_validate_outputs (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_check_status (bool): whether to check response status
for being positive or not.
Default is True
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
_async_call (bool): execute request asynchronously
Returns:
(DatasetFormats, HTTPResponse)
If the method is called asynchronously, returns the request
thread.
"""
kwargs["_async_call"] = _async_call
kwargs["_parse_response"] = _parse_response
kwargs["_request_timeout"] = _request_timeout
kwargs["_validate_inputs"] = _validate_inputs
kwargs["_validate_outputs"] = _validate_outputs
kwargs["_check_status"] = _check_status
kwargs["_spec_property_naming"] = _spec_property_naming
kwargs["_content_type"] = _content_type
kwargs["_host_index"] = _host_index
kwargs["_request_auths"] = _request_auths
return self.retrieve_annotation_formats_endpoint.call_with_http_info(**kwargs)
def retrieve_plugins(
self,
*,
_parse_response: bool = True,
_request_timeout: typing.Union[int, float, tuple] = None,
_validate_inputs: bool = True,
_validate_outputs: bool = True,
_check_status: bool = True,
_spec_property_naming: bool = False,
_content_type: typing.Optional[str] = None,
_host_index: typing.Optional[int] = None,
_request_auths: typing.Optional[typing.List] = None,
_async_call: bool = False,
**kwargs,
) -> typing.Tuple[typing.Optional[Plugins], urllib3.HTTPResponse]:
"""Method provides allowed plugins # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass _async_call=True
>>> thread = api.retrieve_plugins(_async_call=True)
>>> result = thread.get()
Keyword Args:
x_organization (str): [optional]
org (str): Organization unique slug. [optional]
org_id (int): Organization identifier. [optional]
_parse_response (bool): if False, the response data will not be parsed,
None is returned for data.
Default is True.
_request_timeout (int/float/tuple): 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.
Default is None.
_validate_inputs (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_validate_outputs (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_check_status (bool): whether to check response status
for being positive or not.
Default is True
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
_async_call (bool): execute request asynchronously
Returns:
(Plugins, HTTPResponse)
If the method is called asynchronously, returns the request
thread.
"""
kwargs["_async_call"] = _async_call
kwargs["_parse_response"] = _parse_response
kwargs["_request_timeout"] = _request_timeout
kwargs["_validate_inputs"] = _validate_inputs
kwargs["_validate_outputs"] = _validate_outputs
kwargs["_check_status"] = _check_status
kwargs["_spec_property_naming"] = _spec_property_naming
kwargs["_content_type"] = _content_type
kwargs["_host_index"] = _host_index
kwargs["_request_auths"] = _request_auths
return self.retrieve_plugins_endpoint.call_with_http_info(**kwargs)