mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-07-21 23:41:28 +08:00
Improved API support
- Run comfyui workflows directly inside other python applications using EmbeddedComfyClient. - Optional telemetry in prompts and models using anonymity preserving Plausible self-hosted or hosted. - Better OpenAPI schema - Basic support for distributed ComfyUI backends. Limitations: no progress reporting, no easy way to start your own distributed backend, requires RabbitMQ as a message broker.
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
# do not import all endpoints into this module because that uses a lot of memory and stack frames
|
||||
# if you need the ability to import all endpoints from this module, import them with
|
||||
# from comfy.api.apis import path_to_api
|
||||
@@ -0,0 +1,5 @@
|
||||
# do not import all endpoints into this module because that uses a lot of memory and stack frames
|
||||
# if you need the ability to import all endpoints from this module, import them with
|
||||
# from comfy.api.apis.paths.api_v1_images_digest import ApiV1ImagesDigest
|
||||
|
||||
path = "/api/v1/images/{digest}"
|
||||
@@ -0,0 +1,162 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api import api_client, exceptions
|
||||
from comfy.api.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
from .. import path
|
||||
from .responses import (
|
||||
response_200,
|
||||
response_404,
|
||||
)
|
||||
from .parameters import parameter_0
|
||||
from .path_parameters import PathParameters, PathParametersDictInput, PathParametersDict
|
||||
path_parameter_classes = (
|
||||
parameter_0.Parameter0,
|
||||
)
|
||||
|
||||
|
||||
__StatusCodeToResponse = typing.TypedDict(
|
||||
'__StatusCodeToResponse',
|
||||
{
|
||||
'200': typing.Type[response_200.ResponseFor200],
|
||||
'404': typing.Type[response_404.ResponseFor404],
|
||||
}
|
||||
)
|
||||
_status_code_to_response: __StatusCodeToResponse = {
|
||||
'200': response_200.ResponseFor200,
|
||||
'404': response_404.ResponseFor404,
|
||||
}
|
||||
_non_error_status_codes = frozenset({
|
||||
'200',
|
||||
})
|
||||
_error_status_codes = frozenset({
|
||||
'404',
|
||||
})
|
||||
|
||||
_all_accept_content_types = (
|
||||
"image/png",
|
||||
)
|
||||
|
||||
|
||||
class BaseApi(api_client.Api):
|
||||
@typing.overload
|
||||
def _api_v1_images_digest_get(
|
||||
self,
|
||||
path_params: typing.Union[
|
||||
PathParametersDictInput,
|
||||
PathParametersDict
|
||||
],
|
||||
*,
|
||||
skip_deserialization: typing.Literal[False] = False,
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
) -> response_200.ApiResponse: ...
|
||||
|
||||
@typing.overload
|
||||
def _api_v1_images_digest_get(
|
||||
self,
|
||||
path_params: typing.Union[
|
||||
PathParametersDictInput,
|
||||
PathParametersDict
|
||||
],
|
||||
*,
|
||||
skip_deserialization: typing.Literal[True],
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
) -> api_response.ApiResponseWithoutDeserialization: ...
|
||||
|
||||
def _api_v1_images_digest_get(
|
||||
self,
|
||||
path_params: typing.Union[
|
||||
PathParametersDictInput,
|
||||
PathParametersDict
|
||||
],
|
||||
*,
|
||||
skip_deserialization: bool = False,
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
):
|
||||
"""
|
||||
(API) Get image
|
||||
:param skip_deserialization: If true then api_response.response will be set but
|
||||
api_response.body and api_response.headers will not be deserialized into schema
|
||||
class instances
|
||||
"""
|
||||
path_params = PathParameters.validate(
|
||||
path_params,
|
||||
configuration=self.api_client.schema_configuration
|
||||
)
|
||||
used_path, query_params_suffix = self._get_used_path(
|
||||
path,
|
||||
path_parameters=path_parameter_classes,
|
||||
path_params=path_params,
|
||||
skip_validation=True
|
||||
)
|
||||
headers = self._get_headers(accept_content_types=accept_content_types)
|
||||
# TODO add cookie handling
|
||||
host = self.api_client.configuration.get_server_url(
|
||||
"servers", server_index
|
||||
)
|
||||
|
||||
raw_response = self.api_client.call_api(
|
||||
resource_path=used_path,
|
||||
method='get',
|
||||
host=host,
|
||||
headers=headers,
|
||||
stream=stream,
|
||||
timeout=timeout,
|
||||
)
|
||||
|
||||
if skip_deserialization:
|
||||
skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response)
|
||||
self._verify_response_status(skip_deser_response)
|
||||
return skip_deser_response
|
||||
|
||||
status = str(raw_response.status)
|
||||
if status in _non_error_status_codes:
|
||||
status_code = typing.cast(
|
||||
typing.Literal[
|
||||
'200',
|
||||
],
|
||||
status
|
||||
)
|
||||
return _status_code_to_response[status_code].deserialize(
|
||||
raw_response, self.api_client.schema_configuration)
|
||||
elif status in _error_status_codes:
|
||||
error_status_code = typing.cast(
|
||||
typing.Literal[
|
||||
'404',
|
||||
],
|
||||
status
|
||||
)
|
||||
error_response = _status_code_to_response[error_status_code].deserialize(
|
||||
raw_response, self.api_client.schema_configuration)
|
||||
raise exceptions.ApiException(
|
||||
status=error_response.response.status,
|
||||
reason=error_response.response.reason,
|
||||
api_response=error_response
|
||||
)
|
||||
|
||||
response = api_response.ApiResponseWithoutDeserialization(response=raw_response)
|
||||
self._verify_response_status(response)
|
||||
return response
|
||||
|
||||
|
||||
class ApiV1ImagesDigestGet(BaseApi):
|
||||
# this class is used by api classes that refer to endpoints with operationId.snakeCase fn names
|
||||
api_v1_images_digest_get = BaseApi._api_v1_images_digest_get
|
||||
|
||||
|
||||
class ApiForGet(BaseApi):
|
||||
# this class is used by api classes that refer to endpoints by path and http method names
|
||||
get = BaseApi._api_v1_images_digest_get
|
||||
@@ -0,0 +1,16 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
from . import schema
|
||||
|
||||
|
||||
class Parameter0(api_client.PathParameter):
|
||||
name = "digest"
|
||||
style = api_client.ParameterStyle.SIMPLE
|
||||
schema: typing_extensions.TypeAlias = schema.Schema
|
||||
required = True
|
||||
@@ -0,0 +1,13 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
comfyui
|
||||
No description provided (generated by Openapi JSON Schema Generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) # noqa: E501
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
from comfy.api.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
Schema: typing_extensions.TypeAlias = schemas.StrSchema
|
||||
@@ -0,0 +1,97 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
comfyui
|
||||
No description provided (generated by Openapi JSON Schema Generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) # noqa: E501
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
from comfy.api.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema
|
||||
|
||||
from comfy.api.paths.api_v1_images_digest.get.parameters.parameter_0 import schema
|
||||
Properties = typing.TypedDict(
|
||||
'Properties',
|
||||
{
|
||||
"digest": typing.Type[schema.Schema],
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class PathParametersDict(schemas.immutabledict[str, str]):
|
||||
|
||||
__required_keys__: typing.FrozenSet[str] = frozenset({
|
||||
"digest",
|
||||
})
|
||||
__optional_keys__: typing.FrozenSet[str] = frozenset({
|
||||
})
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
*,
|
||||
digest: str,
|
||||
configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None,
|
||||
):
|
||||
arg_: typing.Dict[str, typing.Any] = {
|
||||
"digest": digest,
|
||||
}
|
||||
used_arg_ = typing.cast(PathParametersDictInput, arg_)
|
||||
return PathParameters.validate(used_arg_, configuration=configuration_)
|
||||
|
||||
@staticmethod
|
||||
def from_dict_(
|
||||
arg: typing.Union[
|
||||
PathParametersDictInput,
|
||||
PathParametersDict
|
||||
],
|
||||
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
||||
) -> PathParametersDict:
|
||||
return PathParameters.validate(arg, configuration=configuration)
|
||||
|
||||
@property
|
||||
def digest(self) -> str:
|
||||
return self.__getitem__("digest")
|
||||
PathParametersDictInput = typing.TypedDict(
|
||||
'PathParametersDictInput',
|
||||
{
|
||||
"digest": str,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class PathParameters(
|
||||
schemas.Schema[PathParametersDict, tuple]
|
||||
):
|
||||
types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict})
|
||||
required: typing.FrozenSet[str] = frozenset({
|
||||
"digest",
|
||||
})
|
||||
properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore
|
||||
additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore
|
||||
type_to_output_cls: typing.Mapping[
|
||||
typing.Type,
|
||||
typing.Type
|
||||
] = dataclasses.field(
|
||||
default_factory=lambda: {
|
||||
schemas.immutabledict: PathParametersDict
|
||||
}
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def validate(
|
||||
cls,
|
||||
arg: typing.Union[
|
||||
PathParametersDictInput,
|
||||
PathParametersDict,
|
||||
],
|
||||
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
||||
) -> PathParametersDict:
|
||||
return super().validate_base(
|
||||
arg,
|
||||
configuration=configuration,
|
||||
)
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
from .content.image_png import schema as image_png_schema
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class ApiResponse(api_response.ApiResponse):
|
||||
body: typing.Union[bytes, schemas.FileIO]
|
||||
headers: schemas.Unset
|
||||
|
||||
|
||||
class ResponseFor200(api_client.OpenApiResponse[ApiResponse]):
|
||||
@classmethod
|
||||
def get_response(cls, response, headers, body) -> ApiResponse:
|
||||
return ApiResponse(response=response, body=body, headers=headers)
|
||||
|
||||
|
||||
class ImagePngMediaType(api_client.MediaType):
|
||||
schema: typing_extensions.TypeAlias = image_png_schema.Schema
|
||||
content = {
|
||||
'image/png': ImagePngMediaType,
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
comfyui
|
||||
No description provided (generated by Openapi JSON Schema Generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) # noqa: E501
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
from comfy.api.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
Schema: typing_extensions.TypeAlias = schemas.BinarySchema
|
||||
@@ -0,0 +1,19 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class ApiResponse(api_response.ApiResponse):
|
||||
body: schemas.Unset
|
||||
headers: schemas.Unset
|
||||
|
||||
|
||||
class ResponseFor404(api_client.OpenApiResponse[ApiResponse]):
|
||||
@classmethod
|
||||
def get_response(cls, response, headers, body) -> ApiResponse:
|
||||
return ApiResponse(response=response, body=body, headers=headers)
|
||||
@@ -0,0 +1,5 @@
|
||||
# do not import all endpoints into this module because that uses a lot of memory and stack frames
|
||||
# if you need the ability to import all endpoints from this module, import them with
|
||||
# from comfy.api.apis.paths.api_v1_prompts import ApiV1Prompts
|
||||
|
||||
path = "/api/v1/prompts"
|
||||
@@ -0,0 +1,136 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api import api_client, exceptions
|
||||
from comfy.api.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
from .. import path
|
||||
from .responses import (
|
||||
response_200,
|
||||
response_404,
|
||||
)
|
||||
|
||||
|
||||
__StatusCodeToResponse = typing.TypedDict(
|
||||
'__StatusCodeToResponse',
|
||||
{
|
||||
'200': typing.Type[response_200.ResponseFor200],
|
||||
'404': typing.Type[response_404.ResponseFor404],
|
||||
}
|
||||
)
|
||||
_status_code_to_response: __StatusCodeToResponse = {
|
||||
'200': response_200.ResponseFor200,
|
||||
'404': response_404.ResponseFor404,
|
||||
}
|
||||
_non_error_status_codes = frozenset({
|
||||
'200',
|
||||
})
|
||||
_error_status_codes = frozenset({
|
||||
'404',
|
||||
})
|
||||
|
||||
_all_accept_content_types = (
|
||||
"application/json",
|
||||
)
|
||||
|
||||
|
||||
class BaseApi(api_client.Api):
|
||||
@typing.overload
|
||||
def _api_v1_prompts_get(
|
||||
self,
|
||||
*,
|
||||
skip_deserialization: typing.Literal[False] = False,
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
) -> response_200.ApiResponse: ...
|
||||
|
||||
@typing.overload
|
||||
def _api_v1_prompts_get(
|
||||
self,
|
||||
*,
|
||||
skip_deserialization: typing.Literal[True],
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
) -> api_response.ApiResponseWithoutDeserialization: ...
|
||||
|
||||
def _api_v1_prompts_get(
|
||||
self,
|
||||
*,
|
||||
skip_deserialization: bool = False,
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
):
|
||||
"""
|
||||
(API) Get prompt
|
||||
:param skip_deserialization: If true then api_response.response will be set but
|
||||
api_response.body and api_response.headers will not be deserialized into schema
|
||||
class instances
|
||||
"""
|
||||
used_path = path
|
||||
headers = self._get_headers(accept_content_types=accept_content_types)
|
||||
# TODO add cookie handling
|
||||
host = self.api_client.configuration.get_server_url(
|
||||
"servers", server_index
|
||||
)
|
||||
|
||||
raw_response = self.api_client.call_api(
|
||||
resource_path=used_path,
|
||||
method='get',
|
||||
host=host,
|
||||
headers=headers,
|
||||
stream=stream,
|
||||
timeout=timeout,
|
||||
)
|
||||
|
||||
if skip_deserialization:
|
||||
skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response)
|
||||
self._verify_response_status(skip_deser_response)
|
||||
return skip_deser_response
|
||||
|
||||
status = str(raw_response.status)
|
||||
if status in _non_error_status_codes:
|
||||
status_code = typing.cast(
|
||||
typing.Literal[
|
||||
'200',
|
||||
],
|
||||
status
|
||||
)
|
||||
return _status_code_to_response[status_code].deserialize(
|
||||
raw_response, self.api_client.schema_configuration)
|
||||
elif status in _error_status_codes:
|
||||
error_status_code = typing.cast(
|
||||
typing.Literal[
|
||||
'404',
|
||||
],
|
||||
status
|
||||
)
|
||||
error_response = _status_code_to_response[error_status_code].deserialize(
|
||||
raw_response, self.api_client.schema_configuration)
|
||||
raise exceptions.ApiException(
|
||||
status=error_response.response.status,
|
||||
reason=error_response.response.reason,
|
||||
api_response=error_response
|
||||
)
|
||||
|
||||
response = api_response.ApiResponseWithoutDeserialization(response=raw_response)
|
||||
self._verify_response_status(response)
|
||||
return response
|
||||
|
||||
|
||||
class ApiV1PromptsGet(BaseApi):
|
||||
# this class is used by api classes that refer to endpoints with operationId.snakeCase fn names
|
||||
api_v1_prompts_get = BaseApi._api_v1_prompts_get
|
||||
|
||||
|
||||
class ApiForGet(BaseApi):
|
||||
# this class is used by api classes that refer to endpoints by path and http method names
|
||||
get = BaseApi._api_v1_prompts_get
|
||||
@@ -0,0 +1,28 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
from .content.application_json import schema as application_json_schema
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class ApiResponse(api_response.ApiResponse):
|
||||
body: application_json_schema.prompt.PromptDict
|
||||
headers: schemas.Unset
|
||||
|
||||
|
||||
class ResponseFor200(api_client.OpenApiResponse[ApiResponse]):
|
||||
@classmethod
|
||||
def get_response(cls, response, headers, body) -> ApiResponse:
|
||||
return ApiResponse(response=response, body=body, headers=headers)
|
||||
|
||||
|
||||
class ApplicationJsonMediaType(api_client.MediaType):
|
||||
schema: typing_extensions.TypeAlias = application_json_schema.Schema2
|
||||
content = {
|
||||
'application/json': ApplicationJsonMediaType,
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
comfyui
|
||||
No description provided (generated by Openapi JSON Schema Generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) # noqa: E501
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
|
||||
from comfy.api.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
from comfy.api.components.schema import prompt
|
||||
Schema2: typing_extensions.TypeAlias = prompt.Prompt
|
||||
@@ -0,0 +1,19 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class ApiResponse(api_response.ApiResponse):
|
||||
body: schemas.Unset
|
||||
headers: schemas.Unset
|
||||
|
||||
|
||||
class ResponseFor404(api_client.OpenApiResponse[ApiResponse]):
|
||||
@classmethod
|
||||
def get_response(cls, response, headers, body) -> ApiResponse:
|
||||
return ApiResponse(response=response, body=body, headers=headers)
|
||||
@@ -0,0 +1,240 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api import api_client, exceptions
|
||||
from comfy.api.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
from comfy.api.components.schema import prompt
|
||||
from comfy.api.paths.api_v1_prompts.post.request_body.content.multipart_formdata import schema
|
||||
|
||||
from .. import path
|
||||
from .responses import (
|
||||
response_200,
|
||||
response_204,
|
||||
response_400,
|
||||
response_429,
|
||||
response_500,
|
||||
response_503,
|
||||
response_507,
|
||||
)
|
||||
from . import request_body
|
||||
|
||||
|
||||
__StatusCodeToResponse = typing.TypedDict(
|
||||
'__StatusCodeToResponse',
|
||||
{
|
||||
'200': typing.Type[response_200.ResponseFor200],
|
||||
'204': typing.Type[response_204.ResponseFor204],
|
||||
'400': typing.Type[response_400.ResponseFor400],
|
||||
'429': typing.Type[response_429.ResponseFor429],
|
||||
'500': typing.Type[response_500.ResponseFor500],
|
||||
'503': typing.Type[response_503.ResponseFor503],
|
||||
'507': typing.Type[response_507.ResponseFor507],
|
||||
}
|
||||
)
|
||||
_status_code_to_response: __StatusCodeToResponse = {
|
||||
'200': response_200.ResponseFor200,
|
||||
'204': response_204.ResponseFor204,
|
||||
'400': response_400.ResponseFor400,
|
||||
'429': response_429.ResponseFor429,
|
||||
'500': response_500.ResponseFor500,
|
||||
'503': response_503.ResponseFor503,
|
||||
'507': response_507.ResponseFor507,
|
||||
}
|
||||
_non_error_status_codes = frozenset({
|
||||
'200',
|
||||
'204',
|
||||
})
|
||||
_error_status_codes = frozenset({
|
||||
'400',
|
||||
'429',
|
||||
'500',
|
||||
'507',
|
||||
'503',
|
||||
})
|
||||
|
||||
_all_accept_content_types = (
|
||||
"application/json",
|
||||
)
|
||||
|
||||
|
||||
class BaseApi(api_client.Api):
|
||||
@typing.overload
|
||||
def _api_v1_prompts_post(
|
||||
self,
|
||||
body: typing.Union[
|
||||
prompt.PromptDictInput,
|
||||
prompt.PromptDict,
|
||||
schemas.Unset
|
||||
] = schemas.unset,
|
||||
*,
|
||||
skip_deserialization: typing.Literal[False] = False,
|
||||
content_type: typing.Literal["application/json"] = "application/json",
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
) -> typing.Union[
|
||||
response_200.ApiResponse,
|
||||
response_204.ApiResponse,
|
||||
]: ...
|
||||
|
||||
@typing.overload
|
||||
def _api_v1_prompts_post(
|
||||
self,
|
||||
body: typing.Union[
|
||||
prompt.PromptDictInput,
|
||||
prompt.PromptDict,
|
||||
schemas.Unset
|
||||
] = schemas.unset,
|
||||
*,
|
||||
skip_deserialization: typing.Literal[True],
|
||||
content_type: typing.Literal["application/json"] = "application/json",
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
) -> api_response.ApiResponseWithoutDeserialization: ...
|
||||
|
||||
@typing.overload
|
||||
def _api_v1_prompts_post(
|
||||
self,
|
||||
body: typing.Union[
|
||||
schema.SchemaDictInput,
|
||||
schema.SchemaDict,
|
||||
schemas.Unset
|
||||
] = schemas.unset,
|
||||
*,
|
||||
skip_deserialization: typing.Literal[False] = False,
|
||||
content_type: typing.Literal["multipart/formdata"],
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
) -> typing.Union[
|
||||
response_200.ApiResponse,
|
||||
response_204.ApiResponse,
|
||||
]: ...
|
||||
|
||||
@typing.overload
|
||||
def _api_v1_prompts_post(
|
||||
self,
|
||||
body: typing.Union[
|
||||
schema.SchemaDictInput,
|
||||
schema.SchemaDict,
|
||||
schemas.Unset
|
||||
] = schemas.unset,
|
||||
*,
|
||||
skip_deserialization: typing.Literal[True],
|
||||
content_type: typing.Literal["multipart/formdata"],
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
) -> api_response.ApiResponseWithoutDeserialization: ...
|
||||
|
||||
def _api_v1_prompts_post(
|
||||
self,
|
||||
body: typing.Union[
|
||||
typing.Union[
|
||||
prompt.PromptDictInput,
|
||||
prompt.PromptDict,
|
||||
],
|
||||
typing.Union[
|
||||
schema.SchemaDictInput,
|
||||
schema.SchemaDict,
|
||||
],
|
||||
schemas.Unset,
|
||||
] = schemas.unset,
|
||||
*,
|
||||
skip_deserialization: bool = False,
|
||||
content_type: typing.Literal[
|
||||
"application/json",
|
||||
"multipart/formdata",
|
||||
] = "application/json",
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
):
|
||||
"""
|
||||
(API) Generate image
|
||||
:param skip_deserialization: If true then api_response.response will be set but
|
||||
api_response.body and api_response.headers will not be deserialized into schema
|
||||
class instances
|
||||
"""
|
||||
used_path = path
|
||||
headers = self._get_headers(accept_content_types=accept_content_types)
|
||||
# TODO add cookie handling
|
||||
|
||||
fields, serialized_body = self._get_fields_and_body(
|
||||
request_body=request_body.RequestBody,
|
||||
body=body,
|
||||
content_type=content_type,
|
||||
headers=headers
|
||||
)
|
||||
host = self.api_client.configuration.get_server_url(
|
||||
"servers", server_index
|
||||
)
|
||||
|
||||
raw_response = self.api_client.call_api(
|
||||
resource_path=used_path,
|
||||
method='post',
|
||||
host=host,
|
||||
headers=headers,
|
||||
fields=fields,
|
||||
body=serialized_body,
|
||||
stream=stream,
|
||||
timeout=timeout,
|
||||
)
|
||||
|
||||
if skip_deserialization:
|
||||
skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response)
|
||||
self._verify_response_status(skip_deser_response)
|
||||
return skip_deser_response
|
||||
|
||||
status = str(raw_response.status)
|
||||
if status in _non_error_status_codes:
|
||||
status_code = typing.cast(
|
||||
typing.Literal[
|
||||
'200',
|
||||
'204',
|
||||
],
|
||||
status
|
||||
)
|
||||
return _status_code_to_response[status_code].deserialize(
|
||||
raw_response, self.api_client.schema_configuration)
|
||||
elif status in _error_status_codes:
|
||||
error_status_code = typing.cast(
|
||||
typing.Literal[
|
||||
'400',
|
||||
'429',
|
||||
'500',
|
||||
'507',
|
||||
'503',
|
||||
],
|
||||
status
|
||||
)
|
||||
error_response = _status_code_to_response[error_status_code].deserialize(
|
||||
raw_response, self.api_client.schema_configuration)
|
||||
raise exceptions.ApiException(
|
||||
status=error_response.response.status,
|
||||
reason=error_response.response.reason,
|
||||
api_response=error_response
|
||||
)
|
||||
|
||||
response = api_response.ApiResponseWithoutDeserialization(response=raw_response)
|
||||
self._verify_response_status(response)
|
||||
return response
|
||||
|
||||
|
||||
class ApiV1PromptsPost(BaseApi):
|
||||
# this class is used by api classes that refer to endpoints with operationId.snakeCase fn names
|
||||
api_v1_prompts_post = BaseApi._api_v1_prompts_post
|
||||
|
||||
|
||||
class ApiForPost(BaseApi):
|
||||
# this class is used by api classes that refer to endpoints by path and http method names
|
||||
post = BaseApi._api_v1_prompts_post
|
||||
@@ -0,0 +1,25 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
from .content.application_json import schema as application_json_schema
|
||||
from .content.multipart_formdata import schema as multipart_formdata_schema
|
||||
|
||||
|
||||
class RequestBody(api_client.RequestBody):
|
||||
|
||||
|
||||
class ApplicationJsonMediaType(api_client.MediaType):
|
||||
schema: typing_extensions.TypeAlias = application_json_schema.Schema2
|
||||
|
||||
|
||||
class MultipartFormdataMediaType(api_client.MediaType):
|
||||
schema: typing_extensions.TypeAlias = multipart_formdata_schema.Schema
|
||||
content = {
|
||||
'application/json': ApplicationJsonMediaType,
|
||||
'multipart/formdata': MultipartFormdataMediaType,
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
comfyui
|
||||
No description provided (generated by Openapi JSON Schema Generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) # noqa: E501
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
|
||||
from comfy.api.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
from comfy.api.components.schema import prompt
|
||||
Schema2: typing_extensions.TypeAlias = prompt.Prompt
|
||||
+186
@@ -0,0 +1,186 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
comfyui
|
||||
No description provided (generated by Openapi JSON Schema Generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) # noqa: E501
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
from comfy.api.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
Items: typing_extensions.TypeAlias = schemas.BinarySchema
|
||||
|
||||
|
||||
class FilesTuple(
|
||||
typing.Tuple[
|
||||
typing.Union[bytes, schemas.FileIO],
|
||||
...
|
||||
]
|
||||
):
|
||||
|
||||
def __new__(cls, arg: typing.Union[FilesTupleInput, FilesTuple], configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None):
|
||||
return Files.validate(arg, configuration=configuration)
|
||||
FilesTupleInput = typing.Union[
|
||||
typing.List[
|
||||
typing.Union[
|
||||
bytes,
|
||||
io.FileIO,
|
||||
io.BufferedReader,
|
||||
schemas.FileIO
|
||||
],
|
||||
],
|
||||
typing.Tuple[
|
||||
typing.Union[
|
||||
bytes,
|
||||
io.FileIO,
|
||||
io.BufferedReader,
|
||||
schemas.FileIO
|
||||
],
|
||||
...
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Files(
|
||||
schemas.Schema[schemas.immutabledict, FilesTuple]
|
||||
):
|
||||
types: typing.FrozenSet[typing.Type] = frozenset({tuple})
|
||||
items: typing.Type[Items] = dataclasses.field(default_factory=lambda: Items) # type: ignore
|
||||
type_to_output_cls: typing.Mapping[
|
||||
typing.Type,
|
||||
typing.Type
|
||||
] = dataclasses.field(
|
||||
default_factory=lambda: {
|
||||
tuple: FilesTuple
|
||||
}
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def validate(
|
||||
cls,
|
||||
arg: typing.Union[
|
||||
FilesTupleInput,
|
||||
FilesTuple,
|
||||
],
|
||||
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
||||
) -> FilesTuple:
|
||||
return super().validate_base(
|
||||
arg,
|
||||
configuration=configuration,
|
||||
)
|
||||
|
||||
from comfy.api.components.schema import prompt
|
||||
Properties = typing.TypedDict(
|
||||
'Properties',
|
||||
{
|
||||
"prompt": typing.Type[prompt.Prompt],
|
||||
"files": typing.Type[Files],
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class SchemaDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]):
|
||||
|
||||
__required_keys__: typing.FrozenSet[str] = frozenset({
|
||||
})
|
||||
__optional_keys__: typing.FrozenSet[str] = frozenset({
|
||||
"prompt",
|
||||
"files",
|
||||
})
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
*,
|
||||
prompt: typing.Union[
|
||||
prompt.PromptDictInput,
|
||||
prompt.PromptDict,
|
||||
schemas.Unset
|
||||
] = schemas.unset,
|
||||
files: typing.Union[
|
||||
FilesTupleInput,
|
||||
FilesTuple,
|
||||
schemas.Unset
|
||||
] = schemas.unset,
|
||||
configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None,
|
||||
**kwargs: schemas.INPUT_TYPES_ALL,
|
||||
):
|
||||
arg_: typing.Dict[str, typing.Any] = {}
|
||||
for key_, val in (
|
||||
("prompt", prompt),
|
||||
("files", files),
|
||||
):
|
||||
if isinstance(val, schemas.Unset):
|
||||
continue
|
||||
arg_[key_] = val
|
||||
arg_.update(kwargs)
|
||||
used_arg_ = typing.cast(SchemaDictInput, arg_)
|
||||
return Schema.validate(used_arg_, configuration=configuration_)
|
||||
|
||||
@staticmethod
|
||||
def from_dict_(
|
||||
arg: typing.Union[
|
||||
SchemaDictInput,
|
||||
SchemaDict
|
||||
],
|
||||
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
||||
) -> SchemaDict:
|
||||
return Schema.validate(arg, configuration=configuration)
|
||||
|
||||
@property
|
||||
def prompt(self) -> typing.Union[prompt.PromptDict, schemas.Unset]:
|
||||
val = self.get("prompt", schemas.unset)
|
||||
if isinstance(val, schemas.Unset):
|
||||
return val
|
||||
return typing.cast(
|
||||
prompt.PromptDict,
|
||||
val
|
||||
)
|
||||
|
||||
@property
|
||||
def files(self) -> typing.Union[FilesTuple, schemas.Unset]:
|
||||
val = self.get("files", schemas.unset)
|
||||
if isinstance(val, schemas.Unset):
|
||||
return val
|
||||
return typing.cast(
|
||||
FilesTuple,
|
||||
val
|
||||
)
|
||||
|
||||
def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]:
|
||||
schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__)
|
||||
return self.get(name, schemas.unset)
|
||||
SchemaDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Schema(
|
||||
schemas.Schema[SchemaDict, tuple]
|
||||
):
|
||||
types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict})
|
||||
properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore
|
||||
type_to_output_cls: typing.Mapping[
|
||||
typing.Type,
|
||||
typing.Type
|
||||
] = dataclasses.field(
|
||||
default_factory=lambda: {
|
||||
schemas.immutabledict: SchemaDict
|
||||
}
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def validate(
|
||||
cls,
|
||||
arg: typing.Union[
|
||||
SchemaDictInput,
|
||||
SchemaDict,
|
||||
],
|
||||
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
||||
) -> SchemaDict:
|
||||
return super().validate_base(
|
||||
arg,
|
||||
configuration=configuration,
|
||||
)
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
from .content.application_json import schema as application_json_schema
|
||||
from .headers import header_digest
|
||||
from .headers import header_content_disposition
|
||||
from .headers import header_location
|
||||
from . import header_parameters
|
||||
parameters: typing.Dict[str, typing.Type[api_client.HeaderParameterWithoutName]] = {
|
||||
'Digest': header_digest.Digest,
|
||||
'Content-Disposition': header_content_disposition.ContentDisposition,
|
||||
'Location': header_location.Location,
|
||||
}
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class ApiResponse(api_response.ApiResponse):
|
||||
body: application_json_schema.SchemaDict
|
||||
headers: header_parameters.HeadersDict
|
||||
|
||||
|
||||
class ResponseFor200(api_client.OpenApiResponse[ApiResponse]):
|
||||
@classmethod
|
||||
def get_response(cls, response, headers, body) -> ApiResponse:
|
||||
return ApiResponse(response=response, body=body, headers=headers)
|
||||
|
||||
|
||||
class ApplicationJsonMediaType(api_client.MediaType):
|
||||
schema: typing_extensions.TypeAlias = application_json_schema.Schema
|
||||
content = {
|
||||
'application/json': ApplicationJsonMediaType,
|
||||
}
|
||||
headers=parameters
|
||||
headers_schema = header_parameters.Headers
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
comfyui
|
||||
No description provided (generated by Openapi JSON Schema Generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) # noqa: E501
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
from comfy.api.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
Items: typing_extensions.TypeAlias = schemas.StrSchema
|
||||
|
||||
|
||||
class UrlsTuple(
|
||||
typing.Tuple[
|
||||
str,
|
||||
...
|
||||
]
|
||||
):
|
||||
|
||||
def __new__(cls, arg: typing.Union[UrlsTupleInput, UrlsTuple], configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None):
|
||||
return Urls.validate(arg, configuration=configuration)
|
||||
UrlsTupleInput = typing.Union[
|
||||
typing.List[
|
||||
str,
|
||||
],
|
||||
typing.Tuple[
|
||||
str,
|
||||
...
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Urls(
|
||||
schemas.Schema[schemas.immutabledict, UrlsTuple]
|
||||
):
|
||||
types: typing.FrozenSet[typing.Type] = frozenset({tuple})
|
||||
items: typing.Type[Items] = dataclasses.field(default_factory=lambda: Items) # type: ignore
|
||||
type_to_output_cls: typing.Mapping[
|
||||
typing.Type,
|
||||
typing.Type
|
||||
] = dataclasses.field(
|
||||
default_factory=lambda: {
|
||||
tuple: UrlsTuple
|
||||
}
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def validate(
|
||||
cls,
|
||||
arg: typing.Union[
|
||||
UrlsTupleInput,
|
||||
UrlsTuple,
|
||||
],
|
||||
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
||||
) -> UrlsTuple:
|
||||
return super().validate_base(
|
||||
arg,
|
||||
configuration=configuration,
|
||||
)
|
||||
Properties = typing.TypedDict(
|
||||
'Properties',
|
||||
{
|
||||
"urls": typing.Type[Urls],
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class SchemaDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]):
|
||||
|
||||
__required_keys__: typing.FrozenSet[str] = frozenset({
|
||||
})
|
||||
__optional_keys__: typing.FrozenSet[str] = frozenset({
|
||||
"urls",
|
||||
})
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
*,
|
||||
urls: typing.Union[
|
||||
UrlsTupleInput,
|
||||
UrlsTuple,
|
||||
schemas.Unset
|
||||
] = schemas.unset,
|
||||
configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None,
|
||||
**kwargs: schemas.INPUT_TYPES_ALL,
|
||||
):
|
||||
arg_: typing.Dict[str, typing.Any] = {}
|
||||
for key_, val in (
|
||||
("urls", urls),
|
||||
):
|
||||
if isinstance(val, schemas.Unset):
|
||||
continue
|
||||
arg_[key_] = val
|
||||
arg_.update(kwargs)
|
||||
used_arg_ = typing.cast(SchemaDictInput, arg_)
|
||||
return Schema.validate(used_arg_, configuration=configuration_)
|
||||
|
||||
@staticmethod
|
||||
def from_dict_(
|
||||
arg: typing.Union[
|
||||
SchemaDictInput,
|
||||
SchemaDict
|
||||
],
|
||||
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
||||
) -> SchemaDict:
|
||||
return Schema.validate(arg, configuration=configuration)
|
||||
|
||||
@property
|
||||
def urls(self) -> typing.Union[UrlsTuple, schemas.Unset]:
|
||||
val = self.get("urls", schemas.unset)
|
||||
if isinstance(val, schemas.Unset):
|
||||
return val
|
||||
return typing.cast(
|
||||
UrlsTuple,
|
||||
val
|
||||
)
|
||||
|
||||
def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]:
|
||||
schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__)
|
||||
return self.get(name, schemas.unset)
|
||||
SchemaDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Schema(
|
||||
schemas.Schema[SchemaDict, tuple]
|
||||
):
|
||||
types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict})
|
||||
properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore
|
||||
type_to_output_cls: typing.Mapping[
|
||||
typing.Type,
|
||||
typing.Type
|
||||
] = dataclasses.field(
|
||||
default_factory=lambda: {
|
||||
schemas.immutabledict: SchemaDict
|
||||
}
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def validate(
|
||||
cls,
|
||||
arg: typing.Union[
|
||||
SchemaDictInput,
|
||||
SchemaDict,
|
||||
],
|
||||
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
||||
) -> SchemaDict:
|
||||
return super().validate_base(
|
||||
arg,
|
||||
configuration=configuration,
|
||||
)
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
comfyui
|
||||
No description provided (generated by Openapi JSON Schema Generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) # noqa: E501
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
from comfy.api.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
AdditionalProperties: typing_extensions.TypeAlias = schemas.NotAnyTypeSchema
|
||||
|
||||
from comfy.api.paths.api_v1_prompts.post.responses.response_200.headers.header_content_disposition import schema as schema_2
|
||||
from comfy.api.paths.api_v1_prompts.post.responses.response_200.headers.header_digest import schema
|
||||
from comfy.api.paths.api_v1_prompts.post.responses.response_200.headers.header_location import schema as schema_3
|
||||
Properties = typing.TypedDict(
|
||||
'Properties',
|
||||
{
|
||||
"Digest": typing.Type[schema.Schema],
|
||||
"Content-Disposition": typing.Type[schema_2.Schema],
|
||||
"Location": typing.Type[schema_3.Schema],
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class HeadersDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]):
|
||||
|
||||
__required_keys__: typing.FrozenSet[str] = frozenset({
|
||||
})
|
||||
__optional_keys__: typing.FrozenSet[str] = frozenset({
|
||||
"Digest",
|
||||
"Content-Disposition",
|
||||
"Location",
|
||||
})
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
*,
|
||||
Digest: typing.Union[
|
||||
str,
|
||||
schemas.Unset
|
||||
] = schemas.unset,
|
||||
Location: typing.Union[
|
||||
str,
|
||||
schemas.Unset
|
||||
] = schemas.unset,
|
||||
configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None,
|
||||
):
|
||||
arg_: typing.Dict[str, typing.Any] = {}
|
||||
for key_, val in (
|
||||
("Digest", Digest),
|
||||
("Location", Location),
|
||||
):
|
||||
if isinstance(val, schemas.Unset):
|
||||
continue
|
||||
arg_[key_] = val
|
||||
used_arg_ = typing.cast(HeadersDictInput, arg_)
|
||||
return Headers.validate(used_arg_, configuration=configuration_)
|
||||
|
||||
@staticmethod
|
||||
def from_dict_(
|
||||
arg: typing.Union[
|
||||
HeadersDictInput,
|
||||
HeadersDict
|
||||
],
|
||||
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
||||
) -> HeadersDict:
|
||||
return Headers.validate(arg, configuration=configuration)
|
||||
|
||||
@property
|
||||
def Digest(self) -> typing.Union[str, schemas.Unset]:
|
||||
val = self.get("Digest", schemas.unset)
|
||||
if isinstance(val, schemas.Unset):
|
||||
return val
|
||||
return typing.cast(
|
||||
str,
|
||||
val
|
||||
)
|
||||
|
||||
@property
|
||||
def Location(self) -> typing.Union[str, schemas.Unset]:
|
||||
val = self.get("Location", schemas.unset)
|
||||
if isinstance(val, schemas.Unset):
|
||||
return val
|
||||
return typing.cast(
|
||||
str,
|
||||
val
|
||||
)
|
||||
HeadersDictInput = typing.TypedDict(
|
||||
'HeadersDictInput',
|
||||
{
|
||||
"Digest": str,
|
||||
"Content-Disposition": str,
|
||||
"Location": str,
|
||||
},
|
||||
total=False
|
||||
)
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Headers(
|
||||
schemas.Schema[HeadersDict, tuple]
|
||||
):
|
||||
types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict})
|
||||
properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore
|
||||
additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore
|
||||
type_to_output_cls: typing.Mapping[
|
||||
typing.Type,
|
||||
typing.Type
|
||||
] = dataclasses.field(
|
||||
default_factory=lambda: {
|
||||
schemas.immutabledict: HeadersDict
|
||||
}
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def validate(
|
||||
cls,
|
||||
arg: typing.Union[
|
||||
HeadersDictInput,
|
||||
HeadersDict,
|
||||
],
|
||||
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
||||
) -> HeadersDict:
|
||||
return super().validate_base(
|
||||
arg,
|
||||
configuration=configuration,
|
||||
)
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
from . import schema
|
||||
|
||||
|
||||
class ContentDisposition(api_client.HeaderParameterWithoutName):
|
||||
style = api_client.ParameterStyle.SIMPLE
|
||||
schema: typing_extensions.TypeAlias = schema.Schema
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
comfyui
|
||||
No description provided (generated by Openapi JSON Schema Generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) # noqa: E501
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
from comfy.api.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
Schema: typing_extensions.TypeAlias = schemas.StrSchema
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
from . import schema
|
||||
|
||||
|
||||
class Digest(api_client.HeaderParameterWithoutName):
|
||||
style = api_client.ParameterStyle.SIMPLE
|
||||
schema: typing_extensions.TypeAlias = schema.Schema
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
comfyui
|
||||
No description provided (generated by Openapi JSON Schema Generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) # noqa: E501
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
from comfy.api.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
Schema: typing_extensions.TypeAlias = schemas.StrSchema
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
from . import schema
|
||||
|
||||
|
||||
class Location(api_client.HeaderParameterWithoutName):
|
||||
style = api_client.ParameterStyle.SIMPLE
|
||||
schema: typing_extensions.TypeAlias = schema.Schema
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
comfyui
|
||||
No description provided (generated by Openapi JSON Schema Generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) # noqa: E501
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
from comfy.api.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
Schema: typing_extensions.TypeAlias = schemas.StrSchema
|
||||
@@ -0,0 +1,19 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class ApiResponse(api_response.ApiResponse):
|
||||
body: schemas.Unset
|
||||
headers: schemas.Unset
|
||||
|
||||
|
||||
class ResponseFor204(api_client.OpenApiResponse[ApiResponse]):
|
||||
@classmethod
|
||||
def get_response(cls, response, headers, body) -> ApiResponse:
|
||||
return ApiResponse(response=response, body=body, headers=headers)
|
||||
@@ -0,0 +1,19 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class ApiResponse(api_response.ApiResponse):
|
||||
body: schemas.Unset
|
||||
headers: schemas.Unset
|
||||
|
||||
|
||||
class ResponseFor400(api_client.OpenApiResponse[ApiResponse]):
|
||||
@classmethod
|
||||
def get_response(cls, response, headers, body) -> ApiResponse:
|
||||
return ApiResponse(response=response, body=body, headers=headers)
|
||||
@@ -0,0 +1,19 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class ApiResponse(api_response.ApiResponse):
|
||||
body: schemas.Unset
|
||||
headers: schemas.Unset
|
||||
|
||||
|
||||
class ResponseFor429(api_client.OpenApiResponse[ApiResponse]):
|
||||
@classmethod
|
||||
def get_response(cls, response, headers, body) -> ApiResponse:
|
||||
return ApiResponse(response=response, body=body, headers=headers)
|
||||
@@ -0,0 +1,19 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class ApiResponse(api_response.ApiResponse):
|
||||
body: schemas.Unset
|
||||
headers: schemas.Unset
|
||||
|
||||
|
||||
class ResponseFor500(api_client.OpenApiResponse[ApiResponse]):
|
||||
@classmethod
|
||||
def get_response(cls, response, headers, body) -> ApiResponse:
|
||||
return ApiResponse(response=response, body=body, headers=headers)
|
||||
@@ -0,0 +1,19 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class ApiResponse(api_response.ApiResponse):
|
||||
body: schemas.Unset
|
||||
headers: schemas.Unset
|
||||
|
||||
|
||||
class ResponseFor503(api_client.OpenApiResponse[ApiResponse]):
|
||||
@classmethod
|
||||
def get_response(cls, response, headers, body) -> ApiResponse:
|
||||
return ApiResponse(response=response, body=body, headers=headers)
|
||||
@@ -0,0 +1,19 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class ApiResponse(api_response.ApiResponse):
|
||||
body: schemas.Unset
|
||||
headers: schemas.Unset
|
||||
|
||||
|
||||
class ResponseFor507(api_client.OpenApiResponse[ApiResponse]):
|
||||
@classmethod
|
||||
def get_response(cls, response, headers, body) -> ApiResponse:
|
||||
return ApiResponse(response=response, body=body, headers=headers)
|
||||
@@ -0,0 +1,5 @@
|
||||
# do not import all endpoints into this module because that uses a lot of memory and stack frames
|
||||
# if you need the ability to import all endpoints from this module, import them with
|
||||
# from comfy.api.apis.paths.embeddings import Embeddings
|
||||
|
||||
path = "/embeddings"
|
||||
@@ -0,0 +1,114 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api import api_client
|
||||
from comfy.api.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
from .. import path
|
||||
from .responses import response_200
|
||||
|
||||
|
||||
__StatusCodeToResponse = typing.TypedDict(
|
||||
'__StatusCodeToResponse',
|
||||
{
|
||||
'200': typing.Type[response_200.ResponseFor200],
|
||||
}
|
||||
)
|
||||
_status_code_to_response: __StatusCodeToResponse = {
|
||||
'200': response_200.ResponseFor200,
|
||||
}
|
||||
_non_error_status_codes = frozenset({
|
||||
'200',
|
||||
})
|
||||
|
||||
_all_accept_content_types = (
|
||||
"application/json",
|
||||
)
|
||||
|
||||
|
||||
class BaseApi(api_client.Api):
|
||||
@typing.overload
|
||||
def _get_embeddings(
|
||||
self,
|
||||
*,
|
||||
skip_deserialization: typing.Literal[False] = False,
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
) -> response_200.ApiResponse: ...
|
||||
|
||||
@typing.overload
|
||||
def _get_embeddings(
|
||||
self,
|
||||
*,
|
||||
skip_deserialization: typing.Literal[True],
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
) -> api_response.ApiResponseWithoutDeserialization: ...
|
||||
|
||||
def _get_embeddings(
|
||||
self,
|
||||
*,
|
||||
skip_deserialization: bool = False,
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
):
|
||||
"""
|
||||
(UI) Get embeddings
|
||||
:param skip_deserialization: If true then api_response.response will be set but
|
||||
api_response.body and api_response.headers will not be deserialized into schema
|
||||
class instances
|
||||
"""
|
||||
used_path = path
|
||||
headers = self._get_headers(accept_content_types=accept_content_types)
|
||||
# TODO add cookie handling
|
||||
host = self.api_client.configuration.get_server_url(
|
||||
"servers", server_index
|
||||
)
|
||||
|
||||
raw_response = self.api_client.call_api(
|
||||
resource_path=used_path,
|
||||
method='get',
|
||||
host=host,
|
||||
headers=headers,
|
||||
stream=stream,
|
||||
timeout=timeout,
|
||||
)
|
||||
|
||||
if skip_deserialization:
|
||||
skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response)
|
||||
self._verify_response_status(skip_deser_response)
|
||||
return skip_deser_response
|
||||
|
||||
status = str(raw_response.status)
|
||||
if status in _non_error_status_codes:
|
||||
status_code = typing.cast(
|
||||
typing.Literal[
|
||||
'200',
|
||||
],
|
||||
status
|
||||
)
|
||||
return _status_code_to_response[status_code].deserialize(
|
||||
raw_response, self.api_client.schema_configuration)
|
||||
|
||||
response = api_response.ApiResponseWithoutDeserialization(response=raw_response)
|
||||
self._verify_response_status(response)
|
||||
return response
|
||||
|
||||
|
||||
class GetEmbeddings(BaseApi):
|
||||
# this class is used by api classes that refer to endpoints with operationId.snakeCase fn names
|
||||
get_embeddings = BaseApi._get_embeddings
|
||||
|
||||
|
||||
class ApiForGet(BaseApi):
|
||||
# this class is used by api classes that refer to endpoints by path and http method names
|
||||
get = BaseApi._get_embeddings
|
||||
@@ -0,0 +1,28 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
from .content.application_json import schema as application_json_schema
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class ApiResponse(api_response.ApiResponse):
|
||||
body: application_json_schema.SchemaTuple
|
||||
headers: schemas.Unset
|
||||
|
||||
|
||||
class ResponseFor200(api_client.OpenApiResponse[ApiResponse]):
|
||||
@classmethod
|
||||
def get_response(cls, response, headers, body) -> ApiResponse:
|
||||
return ApiResponse(response=response, body=body, headers=headers)
|
||||
|
||||
|
||||
class ApplicationJsonMediaType(api_client.MediaType):
|
||||
schema: typing_extensions.TypeAlias = application_json_schema.Schema
|
||||
content = {
|
||||
'application/json': ApplicationJsonMediaType,
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
comfyui
|
||||
No description provided (generated by Openapi JSON Schema Generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) # noqa: E501
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
from comfy.api.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
Items: typing_extensions.TypeAlias = schemas.StrSchema
|
||||
|
||||
|
||||
class SchemaTuple(
|
||||
typing.Tuple[
|
||||
str,
|
||||
...
|
||||
]
|
||||
):
|
||||
|
||||
def __new__(cls, arg: typing.Union[SchemaTupleInput, SchemaTuple], configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None):
|
||||
return Schema.validate(arg, configuration=configuration)
|
||||
SchemaTupleInput = typing.Union[
|
||||
typing.List[
|
||||
str,
|
||||
],
|
||||
typing.Tuple[
|
||||
str,
|
||||
...
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Schema(
|
||||
schemas.Schema[schemas.immutabledict, SchemaTuple]
|
||||
):
|
||||
types: typing.FrozenSet[typing.Type] = frozenset({tuple})
|
||||
items: typing.Type[Items] = dataclasses.field(default_factory=lambda: Items) # type: ignore
|
||||
type_to_output_cls: typing.Mapping[
|
||||
typing.Type,
|
||||
typing.Type
|
||||
] = dataclasses.field(
|
||||
default_factory=lambda: {
|
||||
tuple: SchemaTuple
|
||||
}
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def validate(
|
||||
cls,
|
||||
arg: typing.Union[
|
||||
SchemaTupleInput,
|
||||
SchemaTuple,
|
||||
],
|
||||
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
||||
) -> SchemaTuple:
|
||||
return super().validate_base(
|
||||
arg,
|
||||
configuration=configuration,
|
||||
)
|
||||
@@ -0,0 +1,5 @@
|
||||
# do not import all endpoints into this module because that uses a lot of memory and stack frames
|
||||
# if you need the ability to import all endpoints from this module, import them with
|
||||
# from comfy.api.apis.paths.extensions import Extensions
|
||||
|
||||
path = "/extensions"
|
||||
@@ -0,0 +1,114 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api import api_client
|
||||
from comfy.api.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
from .. import path
|
||||
from .responses import response_200
|
||||
|
||||
|
||||
__StatusCodeToResponse = typing.TypedDict(
|
||||
'__StatusCodeToResponse',
|
||||
{
|
||||
'200': typing.Type[response_200.ResponseFor200],
|
||||
}
|
||||
)
|
||||
_status_code_to_response: __StatusCodeToResponse = {
|
||||
'200': response_200.ResponseFor200,
|
||||
}
|
||||
_non_error_status_codes = frozenset({
|
||||
'200',
|
||||
})
|
||||
|
||||
_all_accept_content_types = (
|
||||
"application/json",
|
||||
)
|
||||
|
||||
|
||||
class BaseApi(api_client.Api):
|
||||
@typing.overload
|
||||
def _get_extensions(
|
||||
self,
|
||||
*,
|
||||
skip_deserialization: typing.Literal[False] = False,
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
) -> response_200.ApiResponse: ...
|
||||
|
||||
@typing.overload
|
||||
def _get_extensions(
|
||||
self,
|
||||
*,
|
||||
skip_deserialization: typing.Literal[True],
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
) -> api_response.ApiResponseWithoutDeserialization: ...
|
||||
|
||||
def _get_extensions(
|
||||
self,
|
||||
*,
|
||||
skip_deserialization: bool = False,
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
):
|
||||
"""
|
||||
(UI) Get extensions
|
||||
:param skip_deserialization: If true then api_response.response will be set but
|
||||
api_response.body and api_response.headers will not be deserialized into schema
|
||||
class instances
|
||||
"""
|
||||
used_path = path
|
||||
headers = self._get_headers(accept_content_types=accept_content_types)
|
||||
# TODO add cookie handling
|
||||
host = self.api_client.configuration.get_server_url(
|
||||
"servers", server_index
|
||||
)
|
||||
|
||||
raw_response = self.api_client.call_api(
|
||||
resource_path=used_path,
|
||||
method='get',
|
||||
host=host,
|
||||
headers=headers,
|
||||
stream=stream,
|
||||
timeout=timeout,
|
||||
)
|
||||
|
||||
if skip_deserialization:
|
||||
skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response)
|
||||
self._verify_response_status(skip_deser_response)
|
||||
return skip_deser_response
|
||||
|
||||
status = str(raw_response.status)
|
||||
if status in _non_error_status_codes:
|
||||
status_code = typing.cast(
|
||||
typing.Literal[
|
||||
'200',
|
||||
],
|
||||
status
|
||||
)
|
||||
return _status_code_to_response[status_code].deserialize(
|
||||
raw_response, self.api_client.schema_configuration)
|
||||
|
||||
response = api_response.ApiResponseWithoutDeserialization(response=raw_response)
|
||||
self._verify_response_status(response)
|
||||
return response
|
||||
|
||||
|
||||
class GetExtensions(BaseApi):
|
||||
# this class is used by api classes that refer to endpoints with operationId.snakeCase fn names
|
||||
get_extensions = BaseApi._get_extensions
|
||||
|
||||
|
||||
class ApiForGet(BaseApi):
|
||||
# this class is used by api classes that refer to endpoints by path and http method names
|
||||
get = BaseApi._get_extensions
|
||||
@@ -0,0 +1,28 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
from .content.application_json import schema as application_json_schema
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class ApiResponse(api_response.ApiResponse):
|
||||
body: application_json_schema.SchemaTuple
|
||||
headers: schemas.Unset
|
||||
|
||||
|
||||
class ResponseFor200(api_client.OpenApiResponse[ApiResponse]):
|
||||
@classmethod
|
||||
def get_response(cls, response, headers, body) -> ApiResponse:
|
||||
return ApiResponse(response=response, body=body, headers=headers)
|
||||
|
||||
|
||||
class ApplicationJsonMediaType(api_client.MediaType):
|
||||
schema: typing_extensions.TypeAlias = application_json_schema.Schema
|
||||
content = {
|
||||
'application/json': ApplicationJsonMediaType,
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
comfyui
|
||||
No description provided (generated by Openapi JSON Schema Generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) # noqa: E501
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
from comfy.api.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
Items: typing_extensions.TypeAlias = schemas.StrSchema
|
||||
|
||||
|
||||
class SchemaTuple(
|
||||
typing.Tuple[
|
||||
str,
|
||||
...
|
||||
]
|
||||
):
|
||||
|
||||
def __new__(cls, arg: typing.Union[SchemaTupleInput, SchemaTuple], configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None):
|
||||
return Schema.validate(arg, configuration=configuration)
|
||||
SchemaTupleInput = typing.Union[
|
||||
typing.List[
|
||||
str,
|
||||
],
|
||||
typing.Tuple[
|
||||
str,
|
||||
...
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Schema(
|
||||
schemas.Schema[schemas.immutabledict, SchemaTuple]
|
||||
):
|
||||
types: typing.FrozenSet[typing.Type] = frozenset({tuple})
|
||||
items: typing.Type[Items] = dataclasses.field(default_factory=lambda: Items) # type: ignore
|
||||
type_to_output_cls: typing.Mapping[
|
||||
typing.Type,
|
||||
typing.Type
|
||||
] = dataclasses.field(
|
||||
default_factory=lambda: {
|
||||
tuple: SchemaTuple
|
||||
}
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def validate(
|
||||
cls,
|
||||
arg: typing.Union[
|
||||
SchemaTupleInput,
|
||||
SchemaTuple,
|
||||
],
|
||||
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
||||
) -> SchemaTuple:
|
||||
return super().validate_base(
|
||||
arg,
|
||||
configuration=configuration,
|
||||
)
|
||||
@@ -0,0 +1,5 @@
|
||||
# do not import all endpoints into this module because that uses a lot of memory and stack frames
|
||||
# if you need the ability to import all endpoints from this module, import them with
|
||||
# from comfy.api.apis.paths.history import History
|
||||
|
||||
path = "/history"
|
||||
@@ -0,0 +1,114 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api import api_client
|
||||
from comfy.api.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
from .. import path
|
||||
from .responses import response_200
|
||||
|
||||
|
||||
__StatusCodeToResponse = typing.TypedDict(
|
||||
'__StatusCodeToResponse',
|
||||
{
|
||||
'200': typing.Type[response_200.ResponseFor200],
|
||||
}
|
||||
)
|
||||
_status_code_to_response: __StatusCodeToResponse = {
|
||||
'200': response_200.ResponseFor200,
|
||||
}
|
||||
_non_error_status_codes = frozenset({
|
||||
'200',
|
||||
})
|
||||
|
||||
_all_accept_content_types = (
|
||||
"application/json",
|
||||
)
|
||||
|
||||
|
||||
class BaseApi(api_client.Api):
|
||||
@typing.overload
|
||||
def _get_history(
|
||||
self,
|
||||
*,
|
||||
skip_deserialization: typing.Literal[False] = False,
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
) -> response_200.ApiResponse: ...
|
||||
|
||||
@typing.overload
|
||||
def _get_history(
|
||||
self,
|
||||
*,
|
||||
skip_deserialization: typing.Literal[True],
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
) -> api_response.ApiResponseWithoutDeserialization: ...
|
||||
|
||||
def _get_history(
|
||||
self,
|
||||
*,
|
||||
skip_deserialization: bool = False,
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
):
|
||||
"""
|
||||
(UI) Get history
|
||||
:param skip_deserialization: If true then api_response.response will be set but
|
||||
api_response.body and api_response.headers will not be deserialized into schema
|
||||
class instances
|
||||
"""
|
||||
used_path = path
|
||||
headers = self._get_headers(accept_content_types=accept_content_types)
|
||||
# TODO add cookie handling
|
||||
host = self.api_client.configuration.get_server_url(
|
||||
"servers", server_index
|
||||
)
|
||||
|
||||
raw_response = self.api_client.call_api(
|
||||
resource_path=used_path,
|
||||
method='get',
|
||||
host=host,
|
||||
headers=headers,
|
||||
stream=stream,
|
||||
timeout=timeout,
|
||||
)
|
||||
|
||||
if skip_deserialization:
|
||||
skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response)
|
||||
self._verify_response_status(skip_deser_response)
|
||||
return skip_deser_response
|
||||
|
||||
status = str(raw_response.status)
|
||||
if status in _non_error_status_codes:
|
||||
status_code = typing.cast(
|
||||
typing.Literal[
|
||||
'200',
|
||||
],
|
||||
status
|
||||
)
|
||||
return _status_code_to_response[status_code].deserialize(
|
||||
raw_response, self.api_client.schema_configuration)
|
||||
|
||||
response = api_response.ApiResponseWithoutDeserialization(response=raw_response)
|
||||
self._verify_response_status(response)
|
||||
return response
|
||||
|
||||
|
||||
class GetHistory(BaseApi):
|
||||
# this class is used by api classes that refer to endpoints with operationId.snakeCase fn names
|
||||
get_history = BaseApi._get_history
|
||||
|
||||
|
||||
class ApiForGet(BaseApi):
|
||||
# this class is used by api classes that refer to endpoints by path and http method names
|
||||
get = BaseApi._get_history
|
||||
@@ -0,0 +1,28 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
from .content.application_json import schema as application_json_schema
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class ApiResponse(api_response.ApiResponse):
|
||||
body: application_json_schema.SchemaDict
|
||||
headers: schemas.Unset
|
||||
|
||||
|
||||
class ResponseFor200(api_client.OpenApiResponse[ApiResponse]):
|
||||
@classmethod
|
||||
def get_response(cls, response, headers, body) -> ApiResponse:
|
||||
return ApiResponse(response=response, body=body, headers=headers)
|
||||
|
||||
|
||||
class ApplicationJsonMediaType(api_client.MediaType):
|
||||
schema: typing_extensions.TypeAlias = application_json_schema.Schema
|
||||
content = {
|
||||
'application/json': ApplicationJsonMediaType,
|
||||
}
|
||||
+221
@@ -0,0 +1,221 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
comfyui
|
||||
No description provided (generated by Openapi JSON Schema Generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) # noqa: E501
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
from comfy.api.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
Timestamp: typing_extensions.TypeAlias = schemas.NumberSchema
|
||||
Outputs: typing_extensions.TypeAlias = schemas.DictSchema
|
||||
|
||||
from comfy.api.components.schema import queue_tuple
|
||||
Properties = typing.TypedDict(
|
||||
'Properties',
|
||||
{
|
||||
"timestamp": typing.Type[Timestamp],
|
||||
"prompt": typing.Type[queue_tuple.QueueTuple],
|
||||
"outputs": typing.Type[Outputs],
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class AdditionalPropertiesDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]):
|
||||
|
||||
__required_keys__: typing.FrozenSet[str] = frozenset({
|
||||
})
|
||||
__optional_keys__: typing.FrozenSet[str] = frozenset({
|
||||
"timestamp",
|
||||
"prompt",
|
||||
"outputs",
|
||||
})
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
*,
|
||||
timestamp: typing.Union[
|
||||
int,
|
||||
float,
|
||||
schemas.Unset
|
||||
] = schemas.unset,
|
||||
prompt: typing.Union[
|
||||
queue_tuple.QueueTupleTupleInput,
|
||||
queue_tuple.QueueTupleTuple,
|
||||
schemas.Unset
|
||||
] = schemas.unset,
|
||||
outputs: typing.Union[
|
||||
typing.Mapping[str, schemas.INPUT_TYPES_ALL],
|
||||
schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES],
|
||||
schemas.Unset
|
||||
] = schemas.unset,
|
||||
configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None,
|
||||
**kwargs: schemas.INPUT_TYPES_ALL,
|
||||
):
|
||||
arg_: typing.Dict[str, typing.Any] = {}
|
||||
for key_, val in (
|
||||
("timestamp", timestamp),
|
||||
("prompt", prompt),
|
||||
("outputs", outputs),
|
||||
):
|
||||
if isinstance(val, schemas.Unset):
|
||||
continue
|
||||
arg_[key_] = val
|
||||
arg_.update(kwargs)
|
||||
used_arg_ = typing.cast(AdditionalPropertiesDictInput, arg_)
|
||||
return AdditionalProperties.validate(used_arg_, configuration=configuration_)
|
||||
|
||||
@staticmethod
|
||||
def from_dict_(
|
||||
arg: typing.Union[
|
||||
AdditionalPropertiesDictInput,
|
||||
AdditionalPropertiesDict
|
||||
],
|
||||
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
||||
) -> AdditionalPropertiesDict:
|
||||
return AdditionalProperties.validate(arg, configuration=configuration)
|
||||
|
||||
@property
|
||||
def timestamp(self) -> typing.Union[int, float, schemas.Unset]:
|
||||
val = self.get("timestamp", schemas.unset)
|
||||
if isinstance(val, schemas.Unset):
|
||||
return val
|
||||
return typing.cast(
|
||||
typing.Union[int, float],
|
||||
val
|
||||
)
|
||||
|
||||
@property
|
||||
def prompt(self) -> typing.Union[queue_tuple.QueueTupleTuple, schemas.Unset]:
|
||||
val = self.get("prompt", schemas.unset)
|
||||
if isinstance(val, schemas.Unset):
|
||||
return val
|
||||
return typing.cast(
|
||||
queue_tuple.QueueTupleTuple,
|
||||
val
|
||||
)
|
||||
|
||||
@property
|
||||
def outputs(self) -> typing.Union[schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES], schemas.Unset]:
|
||||
val = self.get("outputs", schemas.unset)
|
||||
if isinstance(val, schemas.Unset):
|
||||
return val
|
||||
return typing.cast(
|
||||
schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES],
|
||||
val
|
||||
)
|
||||
|
||||
def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]:
|
||||
schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__)
|
||||
return self.get(name, schemas.unset)
|
||||
AdditionalPropertiesDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class AdditionalProperties(
|
||||
schemas.Schema[AdditionalPropertiesDict, tuple]
|
||||
):
|
||||
types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict})
|
||||
properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore
|
||||
type_to_output_cls: typing.Mapping[
|
||||
typing.Type,
|
||||
typing.Type
|
||||
] = dataclasses.field(
|
||||
default_factory=lambda: {
|
||||
schemas.immutabledict: AdditionalPropertiesDict
|
||||
}
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def validate(
|
||||
cls,
|
||||
arg: typing.Union[
|
||||
AdditionalPropertiesDictInput,
|
||||
AdditionalPropertiesDict,
|
||||
],
|
||||
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
||||
) -> AdditionalPropertiesDict:
|
||||
return super().validate_base(
|
||||
arg,
|
||||
configuration=configuration,
|
||||
)
|
||||
|
||||
|
||||
|
||||
class SchemaDict(schemas.immutabledict[str, AdditionalPropertiesDict]):
|
||||
|
||||
__required_keys__: typing.FrozenSet[str] = frozenset({
|
||||
})
|
||||
__optional_keys__: typing.FrozenSet[str] = frozenset({
|
||||
})
|
||||
def __new__(
|
||||
cls,
|
||||
configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None,
|
||||
**kwargs: typing.Union[
|
||||
AdditionalPropertiesDictInput,
|
||||
AdditionalPropertiesDict,
|
||||
],
|
||||
):
|
||||
used_kwargs = typing.cast(SchemaDictInput, kwargs)
|
||||
return Schema.validate(used_kwargs, configuration=configuration_)
|
||||
|
||||
@staticmethod
|
||||
def from_dict_(
|
||||
arg: typing.Union[
|
||||
SchemaDictInput,
|
||||
SchemaDict
|
||||
],
|
||||
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
||||
) -> SchemaDict:
|
||||
return Schema.validate(arg, configuration=configuration)
|
||||
|
||||
def get_additional_property_(self, name: str) -> typing.Union[AdditionalPropertiesDict, schemas.Unset]:
|
||||
schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__)
|
||||
val = self.get(name, schemas.unset)
|
||||
if isinstance(val, schemas.Unset):
|
||||
return val
|
||||
return typing.cast(
|
||||
AdditionalPropertiesDict,
|
||||
val
|
||||
)
|
||||
SchemaDictInput = typing.Mapping[
|
||||
str,
|
||||
typing.Union[
|
||||
AdditionalPropertiesDictInput,
|
||||
AdditionalPropertiesDict,
|
||||
],
|
||||
]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Schema(
|
||||
schemas.Schema[SchemaDict, tuple]
|
||||
):
|
||||
types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict})
|
||||
additional_properties: typing.Type[AdditionalProperties] = dataclasses.field(default_factory=lambda: AdditionalProperties) # type: ignore
|
||||
type_to_output_cls: typing.Mapping[
|
||||
typing.Type,
|
||||
typing.Type
|
||||
] = dataclasses.field(
|
||||
default_factory=lambda: {
|
||||
schemas.immutabledict: SchemaDict
|
||||
}
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def validate(
|
||||
cls,
|
||||
arg: typing.Union[
|
||||
SchemaDictInput,
|
||||
SchemaDict,
|
||||
],
|
||||
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
||||
) -> SchemaDict:
|
||||
return super().validate_base(
|
||||
arg,
|
||||
configuration=configuration,
|
||||
)
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api import api_client
|
||||
from comfy.api.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
from comfy.api.paths.history.post.request_body.content.application_json import schema
|
||||
|
||||
from .. import path
|
||||
from .responses import response_200
|
||||
from . import request_body
|
||||
|
||||
|
||||
__StatusCodeToResponse = typing.TypedDict(
|
||||
'__StatusCodeToResponse',
|
||||
{
|
||||
'200': typing.Type[response_200.ResponseFor200],
|
||||
}
|
||||
)
|
||||
_status_code_to_response: __StatusCodeToResponse = {
|
||||
'200': response_200.ResponseFor200,
|
||||
}
|
||||
_non_error_status_codes = frozenset({
|
||||
'200',
|
||||
})
|
||||
|
||||
|
||||
class BaseApi(api_client.Api):
|
||||
@typing.overload
|
||||
def _post_history(
|
||||
self,
|
||||
body: typing.Union[
|
||||
schema.SchemaDictInput,
|
||||
schema.SchemaDict,
|
||||
schemas.Unset
|
||||
] = schemas.unset,
|
||||
*,
|
||||
skip_deserialization: typing.Literal[False] = False,
|
||||
content_type: typing.Literal["application/json"] = "application/json",
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
) -> response_200.ApiResponse: ...
|
||||
|
||||
@typing.overload
|
||||
def _post_history(
|
||||
self,
|
||||
body: typing.Union[
|
||||
schema.SchemaDictInput,
|
||||
schema.SchemaDict,
|
||||
schemas.Unset
|
||||
] = schemas.unset,
|
||||
*,
|
||||
skip_deserialization: typing.Literal[True],
|
||||
content_type: typing.Literal["application/json"] = "application/json",
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
) -> api_response.ApiResponseWithoutDeserialization: ...
|
||||
|
||||
def _post_history(
|
||||
self,
|
||||
body: typing.Union[
|
||||
schema.SchemaDictInput,
|
||||
schema.SchemaDict,
|
||||
schemas.Unset
|
||||
] = schemas.unset,
|
||||
*,
|
||||
skip_deserialization: bool = False,
|
||||
content_type: typing.Literal["application/json"] = "application/json",
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
):
|
||||
"""
|
||||
(UI) Post history
|
||||
:param skip_deserialization: If true then api_response.response will be set but
|
||||
api_response.body and api_response.headers will not be deserialized into schema
|
||||
class instances
|
||||
"""
|
||||
used_path = path
|
||||
headers = self._get_headers()
|
||||
# TODO add cookie handling
|
||||
|
||||
fields, serialized_body = self._get_fields_and_body(
|
||||
request_body=request_body.RequestBody,
|
||||
body=body,
|
||||
content_type=content_type,
|
||||
headers=headers
|
||||
)
|
||||
host = self.api_client.configuration.get_server_url(
|
||||
"servers", server_index
|
||||
)
|
||||
|
||||
raw_response = self.api_client.call_api(
|
||||
resource_path=used_path,
|
||||
method='post',
|
||||
host=host,
|
||||
headers=headers,
|
||||
fields=fields,
|
||||
body=serialized_body,
|
||||
stream=stream,
|
||||
timeout=timeout,
|
||||
)
|
||||
|
||||
if skip_deserialization:
|
||||
skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response)
|
||||
self._verify_response_status(skip_deser_response)
|
||||
return skip_deser_response
|
||||
|
||||
status = str(raw_response.status)
|
||||
if status in _non_error_status_codes:
|
||||
status_code = typing.cast(
|
||||
typing.Literal[
|
||||
'200',
|
||||
],
|
||||
status
|
||||
)
|
||||
return _status_code_to_response[status_code].deserialize(
|
||||
raw_response, self.api_client.schema_configuration)
|
||||
|
||||
response = api_response.ApiResponseWithoutDeserialization(response=raw_response)
|
||||
self._verify_response_status(response)
|
||||
return response
|
||||
|
||||
|
||||
class PostHistory(BaseApi):
|
||||
# this class is used by api classes that refer to endpoints with operationId.snakeCase fn names
|
||||
post_history = BaseApi._post_history
|
||||
|
||||
|
||||
class ApiForPost(BaseApi):
|
||||
# this class is used by api classes that refer to endpoints by path and http method names
|
||||
post = BaseApi._post_history
|
||||
@@ -0,0 +1,19 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.shared_imports.header_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
from .content.application_json import schema as application_json_schema
|
||||
|
||||
|
||||
class RequestBody(api_client.RequestBody):
|
||||
|
||||
|
||||
class ApplicationJsonMediaType(api_client.MediaType):
|
||||
schema: typing_extensions.TypeAlias = application_json_schema.Schema
|
||||
content = {
|
||||
'application/json': ApplicationJsonMediaType,
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
comfyui
|
||||
No description provided (generated by Openapi JSON Schema Generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) # noqa: E501
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
from comfy.api.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
Clear: typing_extensions.TypeAlias = schemas.BoolSchema
|
||||
Items: typing_extensions.TypeAlias = schemas.IntSchema
|
||||
|
||||
|
||||
class DeleteTuple(
|
||||
typing.Tuple[
|
||||
int,
|
||||
...
|
||||
]
|
||||
):
|
||||
|
||||
def __new__(cls, arg: typing.Union[DeleteTupleInput, DeleteTuple], configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None):
|
||||
return Delete.validate(arg, configuration=configuration)
|
||||
DeleteTupleInput = typing.Union[
|
||||
typing.List[
|
||||
int,
|
||||
],
|
||||
typing.Tuple[
|
||||
int,
|
||||
...
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Delete(
|
||||
schemas.Schema[schemas.immutabledict, DeleteTuple]
|
||||
):
|
||||
types: typing.FrozenSet[typing.Type] = frozenset({tuple})
|
||||
items: typing.Type[Items] = dataclasses.field(default_factory=lambda: Items) # type: ignore
|
||||
type_to_output_cls: typing.Mapping[
|
||||
typing.Type,
|
||||
typing.Type
|
||||
] = dataclasses.field(
|
||||
default_factory=lambda: {
|
||||
tuple: DeleteTuple
|
||||
}
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def validate(
|
||||
cls,
|
||||
arg: typing.Union[
|
||||
DeleteTupleInput,
|
||||
DeleteTuple,
|
||||
],
|
||||
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
||||
) -> DeleteTuple:
|
||||
return super().validate_base(
|
||||
arg,
|
||||
configuration=configuration,
|
||||
)
|
||||
Properties = typing.TypedDict(
|
||||
'Properties',
|
||||
{
|
||||
"clear": typing.Type[Clear],
|
||||
"delete": typing.Type[Delete],
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class SchemaDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]):
|
||||
|
||||
__required_keys__: typing.FrozenSet[str] = frozenset({
|
||||
})
|
||||
__optional_keys__: typing.FrozenSet[str] = frozenset({
|
||||
"clear",
|
||||
"delete",
|
||||
})
|
||||
|
||||
def __new__(
|
||||
cls,
|
||||
*,
|
||||
clear: typing.Union[
|
||||
bool,
|
||||
schemas.Unset
|
||||
] = schemas.unset,
|
||||
delete: typing.Union[
|
||||
DeleteTupleInput,
|
||||
DeleteTuple,
|
||||
schemas.Unset
|
||||
] = schemas.unset,
|
||||
configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None,
|
||||
**kwargs: schemas.INPUT_TYPES_ALL,
|
||||
):
|
||||
arg_: typing.Dict[str, typing.Any] = {}
|
||||
for key_, val in (
|
||||
("clear", clear),
|
||||
("delete", delete),
|
||||
):
|
||||
if isinstance(val, schemas.Unset):
|
||||
continue
|
||||
arg_[key_] = val
|
||||
arg_.update(kwargs)
|
||||
used_arg_ = typing.cast(SchemaDictInput, arg_)
|
||||
return Schema.validate(used_arg_, configuration=configuration_)
|
||||
|
||||
@staticmethod
|
||||
def from_dict_(
|
||||
arg: typing.Union[
|
||||
SchemaDictInput,
|
||||
SchemaDict
|
||||
],
|
||||
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
||||
) -> SchemaDict:
|
||||
return Schema.validate(arg, configuration=configuration)
|
||||
|
||||
@property
|
||||
def clear(self) -> typing.Union[bool, schemas.Unset]:
|
||||
val = self.get("clear", schemas.unset)
|
||||
if isinstance(val, schemas.Unset):
|
||||
return val
|
||||
return typing.cast(
|
||||
bool,
|
||||
val
|
||||
)
|
||||
|
||||
@property
|
||||
def delete(self) -> typing.Union[DeleteTuple, schemas.Unset]:
|
||||
val = self.get("delete", schemas.unset)
|
||||
if isinstance(val, schemas.Unset):
|
||||
return val
|
||||
return typing.cast(
|
||||
DeleteTuple,
|
||||
val
|
||||
)
|
||||
|
||||
def get_additional_property_(self, name: str) -> typing.Union[schemas.OUTPUT_BASE_TYPES, schemas.Unset]:
|
||||
schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__)
|
||||
return self.get(name, schemas.unset)
|
||||
SchemaDictInput = typing.Mapping[str, schemas.INPUT_TYPES_ALL]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Schema(
|
||||
schemas.Schema[SchemaDict, tuple]
|
||||
):
|
||||
types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict})
|
||||
properties: Properties = dataclasses.field(default_factory=lambda: schemas.typed_dict_to_instance(Properties)) # type: ignore
|
||||
type_to_output_cls: typing.Mapping[
|
||||
typing.Type,
|
||||
typing.Type
|
||||
] = dataclasses.field(
|
||||
default_factory=lambda: {
|
||||
schemas.immutabledict: SchemaDict
|
||||
}
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def validate(
|
||||
cls,
|
||||
arg: typing.Union[
|
||||
SchemaDictInput,
|
||||
SchemaDict,
|
||||
],
|
||||
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
||||
) -> SchemaDict:
|
||||
return super().validate_base(
|
||||
arg,
|
||||
configuration=configuration,
|
||||
)
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class ApiResponse(api_response.ApiResponse):
|
||||
body: schemas.Unset
|
||||
headers: schemas.Unset
|
||||
|
||||
|
||||
class ResponseFor200(api_client.OpenApiResponse[ApiResponse]):
|
||||
@classmethod
|
||||
def get_response(cls, response, headers, body) -> ApiResponse:
|
||||
return ApiResponse(response=response, body=body, headers=headers)
|
||||
@@ -0,0 +1,5 @@
|
||||
# do not import all endpoints into this module because that uses a lot of memory and stack frames
|
||||
# if you need the ability to import all endpoints from this module, import them with
|
||||
# from comfy.api.apis.paths.interrupt import Interrupt
|
||||
|
||||
path = "/interrupt"
|
||||
@@ -0,0 +1,105 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api import api_client
|
||||
from comfy.api.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
from .. import path
|
||||
from .responses import response_200
|
||||
|
||||
|
||||
__StatusCodeToResponse = typing.TypedDict(
|
||||
'__StatusCodeToResponse',
|
||||
{
|
||||
'200': typing.Type[response_200.ResponseFor200],
|
||||
}
|
||||
)
|
||||
_status_code_to_response: __StatusCodeToResponse = {
|
||||
'200': response_200.ResponseFor200,
|
||||
}
|
||||
_non_error_status_codes = frozenset({
|
||||
'200',
|
||||
})
|
||||
|
||||
|
||||
class BaseApi(api_client.Api):
|
||||
@typing.overload
|
||||
def _post_interrupt(
|
||||
self,
|
||||
*,
|
||||
skip_deserialization: typing.Literal[False] = False,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
) -> response_200.ApiResponse: ...
|
||||
|
||||
@typing.overload
|
||||
def _post_interrupt(
|
||||
self,
|
||||
*,
|
||||
skip_deserialization: typing.Literal[True],
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
) -> api_response.ApiResponseWithoutDeserialization: ...
|
||||
|
||||
def _post_interrupt(
|
||||
self,
|
||||
*,
|
||||
skip_deserialization: bool = False,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
):
|
||||
"""
|
||||
(UI) Post interrupt
|
||||
:param skip_deserialization: If true then api_response.response will be set but
|
||||
api_response.body and api_response.headers will not be deserialized into schema
|
||||
class instances
|
||||
"""
|
||||
used_path = path
|
||||
# TODO add cookie handling
|
||||
host = self.api_client.configuration.get_server_url(
|
||||
"servers", server_index
|
||||
)
|
||||
|
||||
raw_response = self.api_client.call_api(
|
||||
resource_path=used_path,
|
||||
method='post',
|
||||
host=host,
|
||||
stream=stream,
|
||||
timeout=timeout,
|
||||
)
|
||||
|
||||
if skip_deserialization:
|
||||
skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response)
|
||||
self._verify_response_status(skip_deser_response)
|
||||
return skip_deser_response
|
||||
|
||||
status = str(raw_response.status)
|
||||
if status in _non_error_status_codes:
|
||||
status_code = typing.cast(
|
||||
typing.Literal[
|
||||
'200',
|
||||
],
|
||||
status
|
||||
)
|
||||
return _status_code_to_response[status_code].deserialize(
|
||||
raw_response, self.api_client.schema_configuration)
|
||||
|
||||
response = api_response.ApiResponseWithoutDeserialization(response=raw_response)
|
||||
self._verify_response_status(response)
|
||||
return response
|
||||
|
||||
|
||||
class PostInterrupt(BaseApi):
|
||||
# this class is used by api classes that refer to endpoints with operationId.snakeCase fn names
|
||||
post_interrupt = BaseApi._post_interrupt
|
||||
|
||||
|
||||
class ApiForPost(BaseApi):
|
||||
# this class is used by api classes that refer to endpoints by path and http method names
|
||||
post = BaseApi._post_interrupt
|
||||
@@ -0,0 +1,19 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class ApiResponse(api_response.ApiResponse):
|
||||
body: schemas.Unset
|
||||
headers: schemas.Unset
|
||||
|
||||
|
||||
class ResponseFor200(api_client.OpenApiResponse[ApiResponse]):
|
||||
@classmethod
|
||||
def get_response(cls, response, headers, body) -> ApiResponse:
|
||||
return ApiResponse(response=response, body=body, headers=headers)
|
||||
@@ -0,0 +1,5 @@
|
||||
# do not import all endpoints into this module because that uses a lot of memory and stack frames
|
||||
# if you need the ability to import all endpoints from this module, import them with
|
||||
# from comfy.api.apis.paths.object_info import ObjectInfo
|
||||
|
||||
path = "/object_info"
|
||||
@@ -0,0 +1,114 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api import api_client
|
||||
from comfy.api.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
from .. import path
|
||||
from .responses import response_200
|
||||
|
||||
|
||||
__StatusCodeToResponse = typing.TypedDict(
|
||||
'__StatusCodeToResponse',
|
||||
{
|
||||
'200': typing.Type[response_200.ResponseFor200],
|
||||
}
|
||||
)
|
||||
_status_code_to_response: __StatusCodeToResponse = {
|
||||
'200': response_200.ResponseFor200,
|
||||
}
|
||||
_non_error_status_codes = frozenset({
|
||||
'200',
|
||||
})
|
||||
|
||||
_all_accept_content_types = (
|
||||
"application/json",
|
||||
)
|
||||
|
||||
|
||||
class BaseApi(api_client.Api):
|
||||
@typing.overload
|
||||
def _get_object_info(
|
||||
self,
|
||||
*,
|
||||
skip_deserialization: typing.Literal[False] = False,
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
) -> response_200.ApiResponse: ...
|
||||
|
||||
@typing.overload
|
||||
def _get_object_info(
|
||||
self,
|
||||
*,
|
||||
skip_deserialization: typing.Literal[True],
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
) -> api_response.ApiResponseWithoutDeserialization: ...
|
||||
|
||||
def _get_object_info(
|
||||
self,
|
||||
*,
|
||||
skip_deserialization: bool = False,
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
):
|
||||
"""
|
||||
(UI) Get object info
|
||||
:param skip_deserialization: If true then api_response.response will be set but
|
||||
api_response.body and api_response.headers will not be deserialized into schema
|
||||
class instances
|
||||
"""
|
||||
used_path = path
|
||||
headers = self._get_headers(accept_content_types=accept_content_types)
|
||||
# TODO add cookie handling
|
||||
host = self.api_client.configuration.get_server_url(
|
||||
"servers", server_index
|
||||
)
|
||||
|
||||
raw_response = self.api_client.call_api(
|
||||
resource_path=used_path,
|
||||
method='get',
|
||||
host=host,
|
||||
headers=headers,
|
||||
stream=stream,
|
||||
timeout=timeout,
|
||||
)
|
||||
|
||||
if skip_deserialization:
|
||||
skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response)
|
||||
self._verify_response_status(skip_deser_response)
|
||||
return skip_deser_response
|
||||
|
||||
status = str(raw_response.status)
|
||||
if status in _non_error_status_codes:
|
||||
status_code = typing.cast(
|
||||
typing.Literal[
|
||||
'200',
|
||||
],
|
||||
status
|
||||
)
|
||||
return _status_code_to_response[status_code].deserialize(
|
||||
raw_response, self.api_client.schema_configuration)
|
||||
|
||||
response = api_response.ApiResponseWithoutDeserialization(response=raw_response)
|
||||
self._verify_response_status(response)
|
||||
return response
|
||||
|
||||
|
||||
class GetObjectInfo(BaseApi):
|
||||
# this class is used by api classes that refer to endpoints with operationId.snakeCase fn names
|
||||
get_object_info = BaseApi._get_object_info
|
||||
|
||||
|
||||
class ApiForGet(BaseApi):
|
||||
# this class is used by api classes that refer to endpoints by path and http method names
|
||||
get = BaseApi._get_object_info
|
||||
@@ -0,0 +1,28 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
from .content.application_json import schema as application_json_schema
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class ApiResponse(api_response.ApiResponse):
|
||||
body: application_json_schema.SchemaDict
|
||||
headers: schemas.Unset
|
||||
|
||||
|
||||
class ResponseFor200(api_client.OpenApiResponse[ApiResponse]):
|
||||
@classmethod
|
||||
def get_response(cls, response, headers, body) -> ApiResponse:
|
||||
return ApiResponse(response=response, body=body, headers=headers)
|
||||
|
||||
|
||||
class ApplicationJsonMediaType(api_client.MediaType):
|
||||
schema: typing_extensions.TypeAlias = application_json_schema.Schema
|
||||
content = {
|
||||
'application/json': ApplicationJsonMediaType,
|
||||
}
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
comfyui
|
||||
No description provided (generated by Openapi JSON Schema Generator https://github.com/openapi-json-schema-tools/openapi-json-schema-generator) # noqa: E501
|
||||
The version of the OpenAPI document: 0.0.1
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
from comfy.api.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
|
||||
from comfy.api.components.schema import node
|
||||
|
||||
|
||||
class SchemaDict(schemas.immutabledict[str, node.NodeDict]):
|
||||
|
||||
__required_keys__: typing.FrozenSet[str] = frozenset({
|
||||
})
|
||||
__optional_keys__: typing.FrozenSet[str] = frozenset({
|
||||
})
|
||||
def __new__(
|
||||
cls,
|
||||
configuration_: typing.Optional[schema_configuration.SchemaConfiguration] = None,
|
||||
**kwargs: typing.Union[
|
||||
node.NodeDictInput,
|
||||
node.NodeDict,
|
||||
],
|
||||
):
|
||||
used_kwargs = typing.cast(SchemaDictInput, kwargs)
|
||||
return Schema.validate(used_kwargs, configuration=configuration_)
|
||||
|
||||
@staticmethod
|
||||
def from_dict_(
|
||||
arg: typing.Union[
|
||||
SchemaDictInput,
|
||||
SchemaDict
|
||||
],
|
||||
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
||||
) -> SchemaDict:
|
||||
return Schema.validate(arg, configuration=configuration)
|
||||
|
||||
def get_additional_property_(self, name: str) -> typing.Union[node.NodeDict, schemas.Unset]:
|
||||
schemas.raise_if_key_known(name, self.__required_keys__, self.__optional_keys__)
|
||||
val = self.get(name, schemas.unset)
|
||||
if isinstance(val, schemas.Unset):
|
||||
return val
|
||||
return typing.cast(
|
||||
node.NodeDict,
|
||||
val
|
||||
)
|
||||
SchemaDictInput = typing.Mapping[
|
||||
str,
|
||||
typing.Union[
|
||||
node.NodeDictInput,
|
||||
node.NodeDict,
|
||||
],
|
||||
]
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Schema(
|
||||
schemas.Schema[SchemaDict, tuple]
|
||||
):
|
||||
types: typing.FrozenSet[typing.Type] = frozenset({schemas.immutabledict})
|
||||
additional_properties: typing.Type[node.Node] = dataclasses.field(default_factory=lambda: node.Node) # type: ignore
|
||||
type_to_output_cls: typing.Mapping[
|
||||
typing.Type,
|
||||
typing.Type
|
||||
] = dataclasses.field(
|
||||
default_factory=lambda: {
|
||||
schemas.immutabledict: SchemaDict
|
||||
}
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def validate(
|
||||
cls,
|
||||
arg: typing.Union[
|
||||
SchemaDictInput,
|
||||
SchemaDict,
|
||||
],
|
||||
configuration: typing.Optional[schema_configuration.SchemaConfiguration] = None
|
||||
) -> SchemaDict:
|
||||
return super().validate_base(
|
||||
arg,
|
||||
configuration=configuration,
|
||||
)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
# do not import all endpoints into this module because that uses a lot of memory and stack frames
|
||||
# if you need the ability to import all endpoints from this module, import them with
|
||||
# from comfy.api.apis.paths.prompt import Prompt
|
||||
|
||||
path = "/prompt"
|
||||
@@ -0,0 +1,114 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api import api_client
|
||||
from comfy.api.shared_imports.operation_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
from .. import path
|
||||
from .responses import response_200
|
||||
|
||||
|
||||
__StatusCodeToResponse = typing.TypedDict(
|
||||
'__StatusCodeToResponse',
|
||||
{
|
||||
'200': typing.Type[response_200.ResponseFor200],
|
||||
}
|
||||
)
|
||||
_status_code_to_response: __StatusCodeToResponse = {
|
||||
'200': response_200.ResponseFor200,
|
||||
}
|
||||
_non_error_status_codes = frozenset({
|
||||
'200',
|
||||
})
|
||||
|
||||
_all_accept_content_types = (
|
||||
"application/json",
|
||||
)
|
||||
|
||||
|
||||
class BaseApi(api_client.Api):
|
||||
@typing.overload
|
||||
def _get_prompt(
|
||||
self,
|
||||
*,
|
||||
skip_deserialization: typing.Literal[False] = False,
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
) -> response_200.ApiResponse: ...
|
||||
|
||||
@typing.overload
|
||||
def _get_prompt(
|
||||
self,
|
||||
*,
|
||||
skip_deserialization: typing.Literal[True],
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
) -> api_response.ApiResponseWithoutDeserialization: ...
|
||||
|
||||
def _get_prompt(
|
||||
self,
|
||||
*,
|
||||
skip_deserialization: bool = False,
|
||||
accept_content_types: typing.Tuple[str, ...] = _all_accept_content_types,
|
||||
server_index: typing.Optional[int] = None,
|
||||
stream: bool = False,
|
||||
timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
|
||||
):
|
||||
"""
|
||||
(UI) Get queue info
|
||||
:param skip_deserialization: If true then api_response.response will be set but
|
||||
api_response.body and api_response.headers will not be deserialized into schema
|
||||
class instances
|
||||
"""
|
||||
used_path = path
|
||||
headers = self._get_headers(accept_content_types=accept_content_types)
|
||||
# TODO add cookie handling
|
||||
host = self.api_client.configuration.get_server_url(
|
||||
"servers", server_index
|
||||
)
|
||||
|
||||
raw_response = self.api_client.call_api(
|
||||
resource_path=used_path,
|
||||
method='get',
|
||||
host=host,
|
||||
headers=headers,
|
||||
stream=stream,
|
||||
timeout=timeout,
|
||||
)
|
||||
|
||||
if skip_deserialization:
|
||||
skip_deser_response = api_response.ApiResponseWithoutDeserialization(response=raw_response)
|
||||
self._verify_response_status(skip_deser_response)
|
||||
return skip_deser_response
|
||||
|
||||
status = str(raw_response.status)
|
||||
if status in _non_error_status_codes:
|
||||
status_code = typing.cast(
|
||||
typing.Literal[
|
||||
'200',
|
||||
],
|
||||
status
|
||||
)
|
||||
return _status_code_to_response[status_code].deserialize(
|
||||
raw_response, self.api_client.schema_configuration)
|
||||
|
||||
response = api_response.ApiResponseWithoutDeserialization(response=raw_response)
|
||||
self._verify_response_status(response)
|
||||
return response
|
||||
|
||||
|
||||
class GetPrompt(BaseApi):
|
||||
# this class is used by api classes that refer to endpoints with operationId.snakeCase fn names
|
||||
get_prompt = BaseApi._get_prompt
|
||||
|
||||
|
||||
class ApiForGet(BaseApi):
|
||||
# this class is used by api classes that refer to endpoints by path and http method names
|
||||
get = BaseApi._get_prompt
|
||||
@@ -0,0 +1,28 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
|
||||
"""
|
||||
|
||||
from comfy.api.shared_imports.response_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
|
||||
|
||||
from .content.application_json import schema as application_json_schema
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class ApiResponse(api_response.ApiResponse):
|
||||
body: application_json_schema.SchemaDict
|
||||
headers: schemas.Unset
|
||||
|
||||
|
||||
class ResponseFor200(api_client.OpenApiResponse[ApiResponse]):
|
||||
@classmethod
|
||||
def get_response(cls, response, headers, body) -> ApiResponse:
|
||||
return ApiResponse(response=response, body=body, headers=headers)
|
||||
|
||||
|
||||
class ApplicationJsonMediaType(api_client.MediaType):
|
||||
schema: typing_extensions.TypeAlias = application_json_schema.Schema
|
||||
content = {
|
||||
'application/json': ApplicationJsonMediaType,
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user