Skip to content

Commit 68aa0c1

Browse files
author
Pedro Crespo
committed
imp ITISFoundation#186 webapi: autogenerated code from v1/...oas3.yaml
1 parent af55c54 commit 68aa0c1

File tree

13 files changed

+955
-0
lines changed

13 files changed

+955
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"""GENERATED CODE from codegen.sh
2+
It is advisable to not modify this code if possible.
3+
This will be overriden next time the code generator is called.
4+
"""
5+
from .generated_code import (
6+
models,
7+
util,
8+
routing
9+
)

services/web/server/src/simcore_service_webserver/rest/generated_code/__init__.py

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# coding: utf-8
2+
3+
# flake8: noqa
4+
from __future__ import absolute_import
5+
# import models into model package
6+
from .document import Document
7+
from .error import Error
8+
from .error_error import ErrorError
9+
from .registration_data import RegistrationData
10+
from .service_info import ServiceInfo
11+
from .service_info_data import ServiceInfoData
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import pprint
2+
3+
import six
4+
import typing
5+
6+
from .. import util
7+
8+
T = typing.TypeVar('T')
9+
10+
11+
class Model(object):
12+
# openapiTypes: The key is attribute name and the
13+
# value is attribute type.
14+
openapi_types = {}
15+
16+
# attributeMap: The key is attribute name and the
17+
# value is json key in definition.
18+
attribute_map = {}
19+
20+
@classmethod
21+
def from_dict(cls: typing.Type[T], dikt) -> T:
22+
"""Returns the dict as a model"""
23+
return util.deserialize_model(dikt, cls)
24+
25+
def to_dict(self):
26+
"""Returns the model properties as a dict
27+
28+
:rtype: dict
29+
"""
30+
result = {}
31+
32+
for attr, _ in six.iteritems(self.openapi_types):
33+
value = getattr(self, attr)
34+
if isinstance(value, list):
35+
result[attr] = list(map(
36+
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
37+
value
38+
))
39+
elif hasattr(value, "to_dict"):
40+
result[attr] = value.to_dict()
41+
elif isinstance(value, dict):
42+
result[attr] = dict(map(
43+
lambda item: (item[0], item[1].to_dict())
44+
if hasattr(item[1], "to_dict") else item,
45+
value.items()
46+
))
47+
else:
48+
result[attr] = value
49+
50+
return result
51+
52+
def to_str(self):
53+
"""Returns the string representation of the model
54+
55+
:rtype: str
56+
"""
57+
return pprint.pformat(self.to_dict())
58+
59+
def __repr__(self):
60+
"""For `print` and `pprint`"""
61+
return self.to_str()
62+
63+
def __eq__(self, other):
64+
"""Returns true if both objects are equal"""
65+
return self.__dict__ == other.__dict__
66+
67+
def __ne__(self, other):
68+
"""Returns true if both objects are not equal"""
69+
return not self == other
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# coding: utf-8
2+
3+
from __future__ import absolute_import
4+
from datetime import date, datetime # noqa: F401
5+
6+
from typing import List, Dict # noqa: F401
7+
8+
from .base_model_ import Model
9+
from .. import util
10+
11+
12+
class Document(Model):
13+
"""NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
14+
15+
Do not edit the class manually.
16+
"""
17+
18+
def __init__(self, doc_id: str=None, text: str=None): # noqa: E501
19+
"""Document - a model defined in OpenAPI
20+
21+
:param doc_id: The doc_id of this Document. # noqa: E501
22+
:type doc_id: str
23+
:param text: The text of this Document. # noqa: E501
24+
:type text: str
25+
"""
26+
self.openapi_types = {
27+
'doc_id': str,
28+
'text': str
29+
}
30+
31+
self.attribute_map = {
32+
'doc_id': 'doc_id',
33+
'text': 'text'
34+
}
35+
36+
self._doc_id = doc_id
37+
self._text = text
38+
39+
@classmethod
40+
def from_dict(cls, dikt) -> 'Document':
41+
"""Returns the dict as a model
42+
43+
:param dikt: A dict.
44+
:type: dict
45+
:return: The Document of this Document. # noqa: E501
46+
:rtype: Document
47+
"""
48+
return util.deserialize_model(dikt, cls)
49+
50+
@property
51+
def doc_id(self) -> str:
52+
"""Gets the doc_id of this Document.
53+
54+
55+
:return: The doc_id of this Document.
56+
:rtype: str
57+
"""
58+
return self._doc_id
59+
60+
@doc_id.setter
61+
def doc_id(self, doc_id: str):
62+
"""Sets the doc_id of this Document.
63+
64+
65+
:param doc_id: The doc_id of this Document.
66+
:type doc_id: str
67+
"""
68+
69+
self._doc_id = doc_id
70+
71+
@property
72+
def text(self) -> str:
73+
"""Gets the text of this Document.
74+
75+
76+
:return: The text of this Document.
77+
:rtype: str
78+
"""
79+
return self._text
80+
81+
@text.setter
82+
def text(self, text: str):
83+
"""Sets the text of this Document.
84+
85+
86+
:param text: The text of this Document.
87+
:type text: str
88+
"""
89+
if text is None:
90+
raise ValueError("Invalid value for `text`, must not be `None`") # noqa: E501
91+
92+
self._text = text
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# coding: utf-8
2+
3+
from __future__ import absolute_import
4+
from datetime import date, datetime # noqa: F401
5+
6+
from typing import List, Dict # noqa: F401
7+
8+
from .base_model_ import Model
9+
from .error_error import ErrorError # noqa: F401,E501
10+
from .. import util
11+
12+
13+
class Error(Model):
14+
"""NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
15+
16+
Do not edit the class manually.
17+
"""
18+
19+
def __init__(self, error: ErrorError=None): # noqa: E501
20+
"""Error - a model defined in OpenAPI
21+
22+
:param error: The error of this Error. # noqa: E501
23+
:type error: ErrorError
24+
"""
25+
self.openapi_types = {
26+
'error': ErrorError
27+
}
28+
29+
self.attribute_map = {
30+
'error': 'error'
31+
}
32+
33+
self._error = error
34+
35+
@classmethod
36+
def from_dict(cls, dikt) -> 'Error':
37+
"""Returns the dict as a model
38+
39+
:param dikt: A dict.
40+
:type: dict
41+
:return: The Error of this Error. # noqa: E501
42+
:rtype: Error
43+
"""
44+
return util.deserialize_model(dikt, cls)
45+
46+
@property
47+
def error(self) -> ErrorError:
48+
"""Gets the error of this Error.
49+
50+
51+
:return: The error of this Error.
52+
:rtype: ErrorError
53+
"""
54+
return self._error
55+
56+
@error.setter
57+
def error(self, error: ErrorError):
58+
"""Sets the error of this Error.
59+
60+
61+
:param error: The error of this Error.
62+
:type error: ErrorError
63+
"""
64+
65+
self._error = error
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# coding: utf-8
2+
3+
from __future__ import absolute_import
4+
from datetime import date, datetime # noqa: F401
5+
6+
from typing import List, Dict # noqa: F401
7+
8+
from .base_model_ import Model
9+
from .. import util
10+
11+
12+
class ErrorError(Model):
13+
"""NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
14+
15+
Do not edit the class manually.
16+
"""
17+
18+
def __init__(self, code: int=None, error: str=None, message: str=None, fields: Dict[str, str]=None): # noqa: E501
19+
"""ErrorError - a model defined in OpenAPI
20+
21+
:param code: The code of this ErrorError. # noqa: E501
22+
:type code: int
23+
:param error: The error of this ErrorError. # noqa: E501
24+
:type error: str
25+
:param message: The message of this ErrorError. # noqa: E501
26+
:type message: str
27+
:param fields: The fields of this ErrorError. # noqa: E501
28+
:type fields: Dict[str, str]
29+
"""
30+
self.openapi_types = {
31+
'code': int,
32+
'error': str,
33+
'message': str,
34+
'fields': Dict[str, str]
35+
}
36+
37+
self.attribute_map = {
38+
'code': 'code',
39+
'error': 'error',
40+
'message': 'message',
41+
'fields': 'fields'
42+
}
43+
44+
self._code = code
45+
self._error = error
46+
self._message = message
47+
self._fields = fields
48+
49+
@classmethod
50+
def from_dict(cls, dikt) -> 'ErrorError':
51+
"""Returns the dict as a model
52+
53+
:param dikt: A dict.
54+
:type: dict
55+
:return: The Error_error of this ErrorError. # noqa: E501
56+
:rtype: ErrorError
57+
"""
58+
return util.deserialize_model(dikt, cls)
59+
60+
@property
61+
def code(self) -> int:
62+
"""Gets the code of this ErrorError.
63+
64+
65+
:return: The code of this ErrorError.
66+
:rtype: int
67+
"""
68+
return self._code
69+
70+
@code.setter
71+
def code(self, code: int):
72+
"""Sets the code of this ErrorError.
73+
74+
75+
:param code: The code of this ErrorError.
76+
:type code: int
77+
"""
78+
79+
self._code = code
80+
81+
@property
82+
def error(self) -> str:
83+
"""Gets the error of this ErrorError.
84+
85+
86+
:return: The error of this ErrorError.
87+
:rtype: str
88+
"""
89+
return self._error
90+
91+
@error.setter
92+
def error(self, error: str):
93+
"""Sets the error of this ErrorError.
94+
95+
96+
:param error: The error of this ErrorError.
97+
:type error: str
98+
"""
99+
100+
self._error = error
101+
102+
@property
103+
def message(self) -> str:
104+
"""Gets the message of this ErrorError.
105+
106+
107+
:return: The message of this ErrorError.
108+
:rtype: str
109+
"""
110+
return self._message
111+
112+
@message.setter
113+
def message(self, message: str):
114+
"""Sets the message of this ErrorError.
115+
116+
117+
:param message: The message of this ErrorError.
118+
:type message: str
119+
"""
120+
121+
self._message = message
122+
123+
@property
124+
def fields(self) -> Dict[str, str]:
125+
"""Gets the fields of this ErrorError.
126+
127+
a dict with error messages specific fot request's fields # noqa: E501
128+
129+
:return: The fields of this ErrorError.
130+
:rtype: Dict[str, str]
131+
"""
132+
return self._fields
133+
134+
@fields.setter
135+
def fields(self, fields: Dict[str, str]):
136+
"""Sets the fields of this ErrorError.
137+
138+
a dict with error messages specific fot request's fields # noqa: E501
139+
140+
:param fields: The fields of this ErrorError.
141+
:type fields: Dict[str, str]
142+
"""
143+
144+
self._fields = fields

0 commit comments

Comments
 (0)