OAPI: generate Python and JS clients for jobs query endpoint

This commit is contained in:
Sybren A. Stüvel 2022-04-04 18:54:31 +02:00
parent a35a767ddb
commit 2b1e6c54a8
20 changed files with 1125 additions and 5 deletions

View File

@ -10,7 +10,7 @@
""" """
__version__ = "979792d1-dirty" __version__ = "781f1d93-dirty"
# import ApiClient # import ApiClient
from flamenco.manager.api_client import ApiClient from flamenco.manager.api_client import ApiClient

View File

@ -24,6 +24,8 @@ from flamenco.manager.model_utils import ( # noqa: F401
from flamenco.manager.model.available_job_types import AvailableJobTypes from flamenco.manager.model.available_job_types import AvailableJobTypes
from flamenco.manager.model.error import Error from flamenco.manager.model.error import Error
from flamenco.manager.model.job import Job from flamenco.manager.model.job import Job
from flamenco.manager.model.jobs_query import JobsQuery
from flamenco.manager.model.jobs_query_result import JobsQueryResult
from flamenco.manager.model.submitted_job import SubmittedJob from flamenco.manager.model.submitted_job import SubmittedJob
@ -129,6 +131,56 @@ class JobsApi(object):
}, },
api_client=api_client api_client=api_client
) )
self.query_jobs_endpoint = _Endpoint(
settings={
'response_type': (JobsQueryResult,),
'auth': [],
'endpoint_path': '/api/jobs/query',
'operation_id': 'query_jobs',
'http_method': 'POST',
'servers': None,
},
params_map={
'all': [
'jobs_query',
],
'required': [
'jobs_query',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'jobs_query':
(JobsQuery,),
},
'attribute_map': {
},
'location_map': {
'jobs_query': 'body',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json'
],
'content_type': [
'application/json'
]
},
api_client=api_client
)
self.submit_job_endpoint = _Endpoint( self.submit_job_endpoint = _Endpoint(
settings={ settings={
'response_type': (Job,), 'response_type': (Job,),
@ -329,6 +381,83 @@ class JobsApi(object):
kwargs['_host_index'] = kwargs.get('_host_index') kwargs['_host_index'] = kwargs.get('_host_index')
return self.get_job_types_endpoint.call_with_http_info(**kwargs) return self.get_job_types_endpoint.call_with_http_info(**kwargs)
def query_jobs(
self,
jobs_query,
**kwargs
):
"""Fetch list of jobs. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.query_jobs(jobs_query, async_req=True)
>>> result = thread.get()
Args:
jobs_query (JobsQuery): Specification of which jobs to get.
Keyword Args:
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (int/float/tuple): timeout setting for this request. If
one number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_content_type (str/None): force body content-type.
Default is None and content-type will be predicted by allowed
content-types and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
JobsQueryResult
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_spec_property_naming'] = kwargs.get(
'_spec_property_naming', False
)
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['jobs_query'] = \
jobs_query
return self.query_jobs_endpoint.call_with_http_info(**kwargs)
def submit_job( def submit_job(
self, self,
submitted_job, submitted_job,

View File

@ -76,7 +76,7 @@ class ApiClient(object):
self.default_headers[header_name] = header_value self.default_headers[header_name] = header_value
self.cookie = cookie self.cookie = cookie
# Set default User-Agent. # Set default User-Agent.
self.user_agent = 'Flamenco/979792d1-dirty (Blender add-on)' self.user_agent = 'Flamenco/781f1d93-dirty (Blender add-on)'
def __enter__(self): def __enter__(self):
return self return self

View File

@ -404,7 +404,7 @@ conf = flamenco.manager.Configuration(
"OS: {env}\n"\ "OS: {env}\n"\
"Python Version: {pyversion}\n"\ "Python Version: {pyversion}\n"\
"Version of the API: 1.0.0\n"\ "Version of the API: 1.0.0\n"\
"SDK Package Version: 979792d1-dirty".\ "SDK Package Version: 781f1d93-dirty".\
format(env=sys.platform, pyversion=sys.version) format(env=sys.platform, pyversion=sys.version)
def get_host_settings(self): def get_host_settings(self):

View File

@ -6,6 +6,7 @@ Method | HTTP request | Description
------------- | ------------- | ------------- ------------- | ------------- | -------------
[**fetch_job**](JobsApi.md#fetch_job) | **GET** /api/jobs/{job_id} | Fetch info about the job. [**fetch_job**](JobsApi.md#fetch_job) | **GET** /api/jobs/{job_id} | Fetch info about the job.
[**get_job_types**](JobsApi.md#get_job_types) | **GET** /api/jobs/types | Get list of job types and their parameters. [**get_job_types**](JobsApi.md#get_job_types) | **GET** /api/jobs/types | Get list of job types and their parameters.
[**query_jobs**](JobsApi.md#query_jobs) | **POST** /api/jobs/query | Fetch list of jobs.
[**submit_job**](JobsApi.md#submit_job) | **POST** /api/jobs | Submit a new job for Flamenco Manager to execute. [**submit_job**](JobsApi.md#submit_job) | **POST** /api/jobs | Submit a new job for Flamenco Manager to execute.
@ -135,6 +136,87 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **query_jobs**
> JobsQueryResult query_jobs(jobs_query)
Fetch list of jobs.
### Example
```python
import time
import flamenco.manager
from flamenco.manager.api import jobs_api
from flamenco.manager.model.error import Error
from flamenco.manager.model.jobs_query import JobsQuery
from flamenco.manager.model.jobs_query_result import JobsQueryResult
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = flamenco.manager.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with flamenco.manager.ApiClient() as api_client:
# Create an instance of the API class
api_instance = jobs_api.JobsApi(api_client)
jobs_query = JobsQuery(
offset=0,
limit=1,
order_by=[
"order_by_example",
],
status_in=[
JobStatus("active"),
],
metadata={
"key": "key_example",
},
settings={},
) # JobsQuery | Specification of which jobs to get.
# example passing only required values which don't have defaults set
try:
# Fetch list of jobs.
api_response = api_instance.query_jobs(jobs_query)
pprint(api_response)
except flamenco.manager.ApiException as e:
print("Exception when calling JobsApi->query_jobs: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**jobs_query** | [**JobsQuery**](JobsQuery.md)| Specification of which jobs to get. |
### Return type
[**JobsQueryResult**](JobsQueryResult.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Normal query response, can be empty list if nothing matched the query. | - |
**0** | Error message | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **submit_job** # **submit_job**
> Job submit_job(submitted_job) > Job submit_job(submitted_job)

View File

@ -0,0 +1,17 @@
# JobsQuery
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**offset** | **int** | | [optional]
**limit** | **int** | | [optional]
**order_by** | **[str]** | | [optional]
**status_in** | [**[JobStatus]**](JobStatus.md) | Return only jobs with a status in this array. | [optional]
**metadata** | **{str: (str,)}** | Filter by metadata, using `LIKE` notation. | [optional]
**settings** | **{str: (bool, date, datetime, dict, float, int, list, str, none_type)}** | Filter by job settings, using `LIKE` notation. | [optional]
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,12 @@
# JobsQueryResult
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**jobs** | [**[Job]**](Job.md) | |
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,287 @@
"""
Flamenco manager
Render Farm manager API # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from flamenco.manager.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal,
ModelSimple,
cached_property,
change_keys_js_to_python,
convert_js_args_to_python_args,
date,
datetime,
file_type,
none_type,
validate_get_composed_info,
OpenApiModel
)
from flamenco.manager.exceptions import ApiAttributeError
def lazy_import():
from flamenco.manager.model.job_status import JobStatus
globals()['JobStatus'] = JobStatus
class JobsQuery(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
additional_properties_type (tuple): A tuple of classes accepted
as additional properties values.
"""
allowed_values = {
}
validations = {
('offset',): {
'inclusive_minimum': 0,
},
('limit',): {
'inclusive_minimum': 1,
},
}
@cached_property
def additional_properties_type():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
"""
lazy_import()
return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@cached_property
def openapi_types():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
"""
lazy_import()
return {
'offset': (int,), # noqa: E501
'limit': (int,), # noqa: E501
'order_by': ([str],), # noqa: E501
'status_in': ([JobStatus],), # noqa: E501
'metadata': ({str: (str,)},), # noqa: E501
'settings': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501
}
@cached_property
def discriminator():
return None
attribute_map = {
'offset': 'offset', # noqa: E501
'limit': 'limit', # noqa: E501
'order_by': 'order_by', # noqa: E501
'status_in': 'status_in', # noqa: E501
'metadata': 'metadata', # noqa: E501
'settings': 'settings', # noqa: E501
}
read_only_vars = {
}
_composed_schemas = {}
@classmethod
@convert_js_args_to_python_args
def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
"""JobsQuery - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (tuple/list): This is a list of keys or values to
drill down to the model in received_data
when deserializing a response
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_configuration (Configuration): the instance to use when
deserializing a file_type parameter.
If passed, type conversion is attempted
If omitted no type conversion is done.
_visited_composed_classes (tuple): This stores a tuple of
classes that we have traveled through so that
if we see that class again we will not use its
discriminator again.
When traveling through a discriminator, the
composed schema that is
is traveled through is added to this set.
For example if Animal has a discriminator
petType and we pass in "Dog", and the class Dog
allOf includes Animal, we move through Animal
once using the discriminator, and pick Dog.
Then in Dog, we will make an instance of the
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
offset (int): [optional] # noqa: E501
limit (int): [optional] # noqa: E501
order_by ([str]): [optional] # noqa: E501
status_in ([JobStatus]): Return only jobs with a status in this array.. [optional] # noqa: E501
metadata ({str: (str,)}): Filter by metadata, using `LIKE` notation.. [optional] # noqa: E501
settings ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): Filter by job settings, using `LIKE` notation.. [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
self = super(OpenApiModel, cls).__new__(cls)
if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)
self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
# discard variable.
continue
setattr(self, var_name, var_value)
return self
required_properties = set([
'_data_store',
'_check_type',
'_spec_property_naming',
'_path_to_item',
'_configuration',
'_visited_composed_classes',
])
@convert_js_args_to_python_args
def __init__(self, *args, **kwargs): # noqa: E501
"""JobsQuery - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (tuple/list): This is a list of keys or values to
drill down to the model in received_data
when deserializing a response
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_configuration (Configuration): the instance to use when
deserializing a file_type parameter.
If passed, type conversion is attempted
If omitted no type conversion is done.
_visited_composed_classes (tuple): This stores a tuple of
classes that we have traveled through so that
if we see that class again we will not use its
discriminator again.
When traveling through a discriminator, the
composed schema that is
is traveled through is added to this set.
For example if Animal has a discriminator
petType and we pass in "Dog", and the class Dog
allOf includes Animal, we move through Animal
once using the discriminator, and pick Dog.
Then in Dog, we will make an instance of the
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
offset (int): [optional] # noqa: E501
limit (int): [optional] # noqa: E501
order_by ([str]): [optional] # noqa: E501
status_in ([JobStatus]): Return only jobs with a status in this array.. [optional] # noqa: E501
metadata ({str: (str,)}): Filter by metadata, using `LIKE` notation.. [optional] # noqa: E501
settings ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): Filter by job settings, using `LIKE` notation.. [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)
self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
# discard variable.
continue
setattr(self, var_name, var_value)
if var_name in self.read_only_vars:
raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
f"class with read only attributes.")

View File

@ -0,0 +1,267 @@
"""
Flamenco manager
Render Farm manager API # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from flamenco.manager.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal,
ModelSimple,
cached_property,
change_keys_js_to_python,
convert_js_args_to_python_args,
date,
datetime,
file_type,
none_type,
validate_get_composed_info,
OpenApiModel
)
from flamenco.manager.exceptions import ApiAttributeError
def lazy_import():
from flamenco.manager.model.job import Job
globals()['Job'] = Job
class JobsQueryResult(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
additional_properties_type (tuple): A tuple of classes accepted
as additional properties values.
"""
allowed_values = {
}
validations = {
}
@cached_property
def additional_properties_type():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
"""
lazy_import()
return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@cached_property
def openapi_types():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
"""
lazy_import()
return {
'jobs': ([Job],), # noqa: E501
}
@cached_property
def discriminator():
return None
attribute_map = {
'jobs': 'jobs', # noqa: E501
}
read_only_vars = {
}
_composed_schemas = {}
@classmethod
@convert_js_args_to_python_args
def _from_openapi_data(cls, jobs, *args, **kwargs): # noqa: E501
"""JobsQueryResult - a model defined in OpenAPI
Args:
jobs ([Job]):
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (tuple/list): This is a list of keys or values to
drill down to the model in received_data
when deserializing a response
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_configuration (Configuration): the instance to use when
deserializing a file_type parameter.
If passed, type conversion is attempted
If omitted no type conversion is done.
_visited_composed_classes (tuple): This stores a tuple of
classes that we have traveled through so that
if we see that class again we will not use its
discriminator again.
When traveling through a discriminator, the
composed schema that is
is traveled through is added to this set.
For example if Animal has a discriminator
petType and we pass in "Dog", and the class Dog
allOf includes Animal, we move through Animal
once using the discriminator, and pick Dog.
Then in Dog, we will make an instance of the
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
"""
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
self = super(OpenApiModel, cls).__new__(cls)
if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)
self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
self.jobs = jobs
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
# discard variable.
continue
setattr(self, var_name, var_value)
return self
required_properties = set([
'_data_store',
'_check_type',
'_spec_property_naming',
'_path_to_item',
'_configuration',
'_visited_composed_classes',
])
@convert_js_args_to_python_args
def __init__(self, jobs, *args, **kwargs): # noqa: E501
"""JobsQueryResult - a model defined in OpenAPI
Args:
jobs ([Job]):
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (tuple/list): This is a list of keys or values to
drill down to the model in received_data
when deserializing a response
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_configuration (Configuration): the instance to use when
deserializing a file_type parameter.
If passed, type conversion is attempted
If omitted no type conversion is done.
_visited_composed_classes (tuple): This stores a tuple of
classes that we have traveled through so that
if we see that class again we will not use its
discriminator again.
When traveling through a discriminator, the
composed schema that is
is traveled through is added to this set.
For example if Animal has a discriminator
petType and we pass in "Dog", and the class Dog
allOf includes Animal, we move through Animal
once using the discriminator, and pick Dog.
Then in Dog, we will make an instance of the
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
"""
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)
self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
self.jobs = jobs
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
# discard variable.
continue
setattr(self, var_name, var_value)
if var_name in self.read_only_vars:
raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
f"class with read only attributes.")

View File

@ -23,6 +23,8 @@ from flamenco.manager.model.job_all_of import JobAllOf
from flamenco.manager.model.job_metadata import JobMetadata from flamenco.manager.model.job_metadata import JobMetadata
from flamenco.manager.model.job_settings import JobSettings from flamenco.manager.model.job_settings import JobSettings
from flamenco.manager.model.job_status import JobStatus from flamenco.manager.model.job_status import JobStatus
from flamenco.manager.model.jobs_query import JobsQuery
from flamenco.manager.model.jobs_query_result import JobsQueryResult
from flamenco.manager.model.manager_configuration import ManagerConfiguration from flamenco.manager.model.manager_configuration import ManagerConfiguration
from flamenco.manager.model.registered_worker import RegisteredWorker from flamenco.manager.model.registered_worker import RegisteredWorker
from flamenco.manager.model.security_error import SecurityError from flamenco.manager.model.security_error import SecurityError

View File

@ -4,7 +4,7 @@ Render Farm manager API
The `flamenco.manager` package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: The `flamenco.manager` package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: 1.0.0 - API version: 1.0.0
- Package version: 979792d1-dirty - Package version: 781f1d93-dirty
- Build package: org.openapitools.codegen.languages.PythonClientCodegen - Build package: org.openapitools.codegen.languages.PythonClientCodegen
For more information, please visit [https://flamenco.io/](https://flamenco.io/) For more information, please visit [https://flamenco.io/](https://flamenco.io/)
@ -35,6 +35,8 @@ from flamenco.manager.api import jobs_api
from flamenco.manager.model.available_job_types import AvailableJobTypes from flamenco.manager.model.available_job_types import AvailableJobTypes
from flamenco.manager.model.error import Error from flamenco.manager.model.error import Error
from flamenco.manager.model.job import Job from flamenco.manager.model.job import Job
from flamenco.manager.model.jobs_query import JobsQuery
from flamenco.manager.model.jobs_query_result import JobsQueryResult
from flamenco.manager.model.submitted_job import SubmittedJob from flamenco.manager.model.submitted_job import SubmittedJob
# Defining the host is optional and defaults to http://localhost # Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters. # See configuration.py for a list of all supported configuration parameters.
@ -66,6 +68,7 @@ Class | Method | HTTP request | Description
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
*JobsApi* | [**fetch_job**](flamenco/manager/docs/JobsApi.md#fetch_job) | **GET** /api/jobs/{job_id} | Fetch info about the job. *JobsApi* | [**fetch_job**](flamenco/manager/docs/JobsApi.md#fetch_job) | **GET** /api/jobs/{job_id} | Fetch info about the job.
*JobsApi* | [**get_job_types**](flamenco/manager/docs/JobsApi.md#get_job_types) | **GET** /api/jobs/types | Get list of job types and their parameters. *JobsApi* | [**get_job_types**](flamenco/manager/docs/JobsApi.md#get_job_types) | **GET** /api/jobs/types | Get list of job types and their parameters.
*JobsApi* | [**query_jobs**](flamenco/manager/docs/JobsApi.md#query_jobs) | **POST** /api/jobs/query | Fetch list of jobs.
*JobsApi* | [**submit_job**](flamenco/manager/docs/JobsApi.md#submit_job) | **POST** /api/jobs | Submit a new job for Flamenco Manager to execute. *JobsApi* | [**submit_job**](flamenco/manager/docs/JobsApi.md#submit_job) | **POST** /api/jobs | Submit a new job for Flamenco Manager to execute.
*MetaApi* | [**get_configuration**](flamenco/manager/docs/MetaApi.md#get_configuration) | **GET** /api/configuration | Get the configuration of this Manager. *MetaApi* | [**get_configuration**](flamenco/manager/docs/MetaApi.md#get_configuration) | **GET** /api/configuration | Get the configuration of this Manager.
*MetaApi* | [**get_version**](flamenco/manager/docs/MetaApi.md#get_version) | **GET** /api/version | Get the Flamenco version of this Manager *MetaApi* | [**get_version**](flamenco/manager/docs/MetaApi.md#get_version) | **GET** /api/version | Get the Flamenco version of this Manager
@ -98,6 +101,8 @@ Class | Method | HTTP request | Description
- [JobMetadata](flamenco/manager/docs/JobMetadata.md) - [JobMetadata](flamenco/manager/docs/JobMetadata.md)
- [JobSettings](flamenco/manager/docs/JobSettings.md) - [JobSettings](flamenco/manager/docs/JobSettings.md)
- [JobStatus](flamenco/manager/docs/JobStatus.md) - [JobStatus](flamenco/manager/docs/JobStatus.md)
- [JobsQuery](flamenco/manager/docs/JobsQuery.md)
- [JobsQueryResult](flamenco/manager/docs/JobsQueryResult.md)
- [ManagerConfiguration](flamenco/manager/docs/ManagerConfiguration.md) - [ManagerConfiguration](flamenco/manager/docs/ManagerConfiguration.md)
- [RegisteredWorker](flamenco/manager/docs/RegisteredWorker.md) - [RegisteredWorker](flamenco/manager/docs/RegisteredWorker.md)
- [SecurityError](flamenco/manager/docs/SecurityError.md) - [SecurityError](flamenco/manager/docs/SecurityError.md)

View File

@ -121,6 +121,7 @@ Class | Method | HTTP request | Description
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
*flamencoManager.JobsApi* | [**fetchJob**](docs/JobsApi.md#fetchJob) | **GET** /api/jobs/{job_id} | Fetch info about the job. *flamencoManager.JobsApi* | [**fetchJob**](docs/JobsApi.md#fetchJob) | **GET** /api/jobs/{job_id} | Fetch info about the job.
*flamencoManager.JobsApi* | [**getJobTypes**](docs/JobsApi.md#getJobTypes) | **GET** /api/jobs/types | Get list of job types and their parameters. *flamencoManager.JobsApi* | [**getJobTypes**](docs/JobsApi.md#getJobTypes) | **GET** /api/jobs/types | Get list of job types and their parameters.
*flamencoManager.JobsApi* | [**queryJobs**](docs/JobsApi.md#queryJobs) | **POST** /api/jobs/query | Fetch list of jobs.
*flamencoManager.JobsApi* | [**submitJob**](docs/JobsApi.md#submitJob) | **POST** /api/jobs | Submit a new job for Flamenco Manager to execute. *flamencoManager.JobsApi* | [**submitJob**](docs/JobsApi.md#submitJob) | **POST** /api/jobs | Submit a new job for Flamenco Manager to execute.
*flamencoManager.MetaApi* | [**getConfiguration**](docs/MetaApi.md#getConfiguration) | **GET** /api/configuration | Get the configuration of this Manager. *flamencoManager.MetaApi* | [**getConfiguration**](docs/MetaApi.md#getConfiguration) | **GET** /api/configuration | Get the configuration of this Manager.
*flamencoManager.MetaApi* | [**getVersion**](docs/MetaApi.md#getVersion) | **GET** /api/version | Get the Flamenco version of this Manager *flamencoManager.MetaApi* | [**getVersion**](docs/MetaApi.md#getVersion) | **GET** /api/version | Get the Flamenco version of this Manager
@ -151,6 +152,8 @@ Class | Method | HTTP request | Description
- [flamencoManager.Job](docs/Job.md) - [flamencoManager.Job](docs/Job.md)
- [flamencoManager.JobAllOf](docs/JobAllOf.md) - [flamencoManager.JobAllOf](docs/JobAllOf.md)
- [flamencoManager.JobStatus](docs/JobStatus.md) - [flamencoManager.JobStatus](docs/JobStatus.md)
- [flamencoManager.JobsQuery](docs/JobsQuery.md)
- [flamencoManager.JobsQueryResult](docs/JobsQueryResult.md)
- [flamencoManager.ManagerConfiguration](docs/ManagerConfiguration.md) - [flamencoManager.ManagerConfiguration](docs/ManagerConfiguration.md)
- [flamencoManager.RegisteredWorker](docs/RegisteredWorker.md) - [flamencoManager.RegisteredWorker](docs/RegisteredWorker.md)
- [flamencoManager.SecurityError](docs/SecurityError.md) - [flamencoManager.SecurityError](docs/SecurityError.md)

View File

@ -6,6 +6,7 @@ Method | HTTP request | Description
------------- | ------------- | ------------- ------------- | ------------- | -------------
[**fetchJob**](JobsApi.md#fetchJob) | **GET** /api/jobs/{job_id} | Fetch info about the job. [**fetchJob**](JobsApi.md#fetchJob) | **GET** /api/jobs/{job_id} | Fetch info about the job.
[**getJobTypes**](JobsApi.md#getJobTypes) | **GET** /api/jobs/types | Get list of job types and their parameters. [**getJobTypes**](JobsApi.md#getJobTypes) | **GET** /api/jobs/types | Get list of job types and their parameters.
[**queryJobs**](JobsApi.md#queryJobs) | **POST** /api/jobs/query | Fetch list of jobs.
[**submitJob**](JobsApi.md#submitJob) | **POST** /api/jobs | Submit a new job for Flamenco Manager to execute. [**submitJob**](JobsApi.md#submitJob) | **POST** /api/jobs | Submit a new job for Flamenco Manager to execute.
@ -90,6 +91,48 @@ No authorization required
- **Accept**: application/json - **Accept**: application/json
## queryJobs
> JobsQueryResult queryJobs(jobsQuery)
Fetch list of jobs.
### Example
```javascript
import flamencoManager from 'flamenco-manager';
let apiInstance = new flamencoManager.JobsApi();
let jobsQuery = new flamencoManager.JobsQuery(); // JobsQuery | Specification of which jobs to get.
apiInstance.queryJobs(jobsQuery).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**jobsQuery** | [**JobsQuery**](JobsQuery.md)| Specification of which jobs to get. |
### Return type
[**JobsQueryResult**](JobsQueryResult.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## submitJob ## submitJob
> Job submitJob(submittedJob) > Job submitJob(submittedJob)

View File

@ -0,0 +1,14 @@
# flamencoManager.JobsQuery
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**offset** | **Number** | | [optional]
**limit** | **Number** | | [optional]
**orderBy** | **[String]** | | [optional]
**statusIn** | [**[JobStatus]**](JobStatus.md) | Return only jobs with a status in this array. | [optional]
**metadata** | **{String: String}** | Filter by metadata, using `LIKE` notation. | [optional]
**settings** | **{String: Object}** | Filter by job settings, using `LIKE` notation. | [optional]

View File

@ -0,0 +1,9 @@
# flamencoManager.JobsQueryResult
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**jobs** | [**[Job]**](Job.md) | |

View File

@ -55,7 +55,7 @@ class ApiClient {
* @default {} * @default {}
*/ */
this.defaultHeaders = { this.defaultHeaders = {
'User-Agent': 'Flamenco/80ffc7da-dirty / webbrowser' 'User-Agent': 'Flamenco/781f1d93-dirty / webbrowser'
}; };
/** /**

View File

@ -25,6 +25,8 @@ import FlamencoVersion from './model/FlamencoVersion';
import Job from './model/Job'; import Job from './model/Job';
import JobAllOf from './model/JobAllOf'; import JobAllOf from './model/JobAllOf';
import JobStatus from './model/JobStatus'; import JobStatus from './model/JobStatus';
import JobsQuery from './model/JobsQuery';
import JobsQueryResult from './model/JobsQueryResult';
import ManagerConfiguration from './model/ManagerConfiguration'; import ManagerConfiguration from './model/ManagerConfiguration';
import RegisteredWorker from './model/RegisteredWorker'; import RegisteredWorker from './model/RegisteredWorker';
import SecurityError from './model/SecurityError'; import SecurityError from './model/SecurityError';
@ -160,6 +162,18 @@ export {
*/ */
JobStatus, JobStatus,
/**
* The JobsQuery model constructor.
* @property {module:model/JobsQuery}
*/
JobsQuery,
/**
* The JobsQueryResult model constructor.
* @property {module:model/JobsQueryResult}
*/
JobsQueryResult,
/** /**
* The ManagerConfiguration model constructor. * The ManagerConfiguration model constructor.
* @property {module:model/ManagerConfiguration} * @property {module:model/ManagerConfiguration}

View File

@ -16,6 +16,8 @@ import ApiClient from "../ApiClient";
import AvailableJobTypes from '../model/AvailableJobTypes'; import AvailableJobTypes from '../model/AvailableJobTypes';
import Error from '../model/Error'; import Error from '../model/Error';
import Job from '../model/Job'; import Job from '../model/Job';
import JobsQuery from '../model/JobsQuery';
import JobsQueryResult from '../model/JobsQueryResult';
import SubmittedJob from '../model/SubmittedJob'; import SubmittedJob from '../model/SubmittedJob';
/** /**
@ -123,6 +125,51 @@ export default class JobsApi {
} }
/**
* Fetch list of jobs.
* @param {module:model/JobsQuery} jobsQuery Specification of which jobs to get.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/JobsQueryResult} and HTTP response
*/
queryJobsWithHttpInfo(jobsQuery) {
let postBody = jobsQuery;
// verify the required parameter 'jobsQuery' is set
if (jobsQuery === undefined || jobsQuery === null) {
throw new Error("Missing the required parameter 'jobsQuery' when calling queryJobs");
}
let pathParams = {
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = [];
let contentTypes = ['application/json'];
let accepts = ['application/json'];
let returnType = JobsQueryResult;
return this.apiClient.callApi(
'/api/jobs/query', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null
);
}
/**
* Fetch list of jobs.
* @param {module:model/JobsQuery} jobsQuery Specification of which jobs to get.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/JobsQueryResult}
*/
queryJobs(jobsQuery) {
return this.queryJobsWithHttpInfo(jobsQuery)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/** /**
* Submit a new job for Flamenco Manager to execute. * Submit a new job for Flamenco Manager to execute.
* @param {module:model/SubmittedJob} submittedJob Job to submit * @param {module:model/SubmittedJob} submittedJob Job to submit

View File

@ -0,0 +1,115 @@
/**
* Flamenco manager
* Render Farm manager API
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*
*/
import ApiClient from '../ApiClient';
import JobStatus from './JobStatus';
/**
* The JobsQuery model module.
* @module model/JobsQuery
* @version 0.0.0
*/
class JobsQuery {
/**
* Constructs a new <code>JobsQuery</code>.
* @alias module:model/JobsQuery
*/
constructor() {
JobsQuery.initialize(this);
}
/**
* Initializes the fields of this object.
* This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
* Only for internal use.
*/
static initialize(obj) {
}
/**
* Constructs a <code>JobsQuery</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/JobsQuery} obj Optional instance to populate.
* @return {module:model/JobsQuery} The populated <code>JobsQuery</code> instance.
*/
static constructFromObject(data, obj) {
if (data) {
obj = obj || new JobsQuery();
if (data.hasOwnProperty('offset')) {
obj['offset'] = ApiClient.convertToType(data['offset'], 'Number');
}
if (data.hasOwnProperty('limit')) {
obj['limit'] = ApiClient.convertToType(data['limit'], 'Number');
}
if (data.hasOwnProperty('order_by')) {
obj['order_by'] = ApiClient.convertToType(data['order_by'], ['String']);
}
if (data.hasOwnProperty('status_in')) {
obj['status_in'] = ApiClient.convertToType(data['status_in'], [JobStatus]);
}
if (data.hasOwnProperty('metadata')) {
obj['metadata'] = ApiClient.convertToType(data['metadata'], {'String': 'String'});
}
if (data.hasOwnProperty('settings')) {
obj['settings'] = ApiClient.convertToType(data['settings'], {'String': Object});
}
}
return obj;
}
}
/**
* @member {Number} offset
*/
JobsQuery.prototype['offset'] = undefined;
/**
* @member {Number} limit
*/
JobsQuery.prototype['limit'] = undefined;
/**
* @member {Array.<String>} order_by
*/
JobsQuery.prototype['order_by'] = undefined;
/**
* Return only jobs with a status in this array.
* @member {Array.<module:model/JobStatus>} status_in
*/
JobsQuery.prototype['status_in'] = undefined;
/**
* Filter by metadata, using `LIKE` notation.
* @member {Object.<String, String>} metadata
*/
JobsQuery.prototype['metadata'] = undefined;
/**
* Filter by job settings, using `LIKE` notation.
* @member {Object.<String, Object>} settings
*/
JobsQuery.prototype['settings'] = undefined;
export default JobsQuery;

View File

@ -0,0 +1,74 @@
/**
* Flamenco manager
* Render Farm manager API
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*
*/
import ApiClient from '../ApiClient';
import Job from './Job';
/**
* The JobsQueryResult model module.
* @module model/JobsQueryResult
* @version 0.0.0
*/
class JobsQueryResult {
/**
* Constructs a new <code>JobsQueryResult</code>.
* @alias module:model/JobsQueryResult
* @param jobs {Array.<module:model/Job>}
*/
constructor(jobs) {
JobsQueryResult.initialize(this, jobs);
}
/**
* Initializes the fields of this object.
* This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
* Only for internal use.
*/
static initialize(obj, jobs) {
obj['jobs'] = jobs;
}
/**
* Constructs a <code>JobsQueryResult</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @param {module:model/JobsQueryResult} obj Optional instance to populate.
* @return {module:model/JobsQueryResult} The populated <code>JobsQueryResult</code> instance.
*/
static constructFromObject(data, obj) {
if (data) {
obj = obj || new JobsQueryResult();
if (data.hasOwnProperty('jobs')) {
obj['jobs'] = ApiClient.convertToType(data['jobs'], [Job]);
}
}
return obj;
}
}
/**
* @member {Array.<module:model/Job>} jobs
*/
JobsQueryResult.prototype['jobs'] = undefined;
export default JobsQueryResult;