Skip to content

Commit cb68a0e

Browse files
committed
Add template models
1 parent 2e2fb27 commit cb68a0e

10 files changed

+2478
-1
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from setuptools import setup, find_packages # noqa: H301
1212

1313
NAME = "shotstack-sdk"
14-
VERSION = "0.1.0"
14+
VERSION = "0.2.0"
1515
# To install the library, run the following
1616
#
1717
# python setup.py install

shotstack_sdk/model/template.py

Lines changed: 271 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,271 @@
1+
"""
2+
Shotstack
3+
4+
Shotstack is a video, image and audio editing service that allows for the automated generation of videos, images and audio using JSON and a RESTful API. You arrange and configure an edit and POST it to the API which will render your media and provide a file location when complete. For more details visit [shotstack.io](https://shotstack.io) or checkout our [getting started](https://shotstack.io/docs/guide/) documentation. There are two main API's, one for editing and generating assets (Edit API) and one for managing hosted assets (Serve API). The Edit API base URL is: <b>https://api.shotstack.io/{version}</b> The Serve API base URL is: <b>https://api.shotstack.io/serve/{version}</b> # noqa: E501
5+
6+
The version of the OpenAPI document: v1
7+
Generated by: https://openapi-generator.tech
8+
"""
9+
10+
11+
import re # noqa: F401
12+
import sys # noqa: F401
13+
14+
from shotstack_sdk.model_utils import ( # noqa: F401
15+
ApiTypeError,
16+
ModelComposed,
17+
ModelNormal,
18+
ModelSimple,
19+
cached_property,
20+
change_keys_js_to_python,
21+
convert_js_args_to_python_args,
22+
date,
23+
datetime,
24+
file_type,
25+
none_type,
26+
validate_get_composed_info,
27+
OpenApiModel
28+
)
29+
from shotstack_sdk.exceptions import ApiAttributeError
30+
31+
32+
def lazy_import():
33+
from shotstack_sdk.model.edit import Edit
34+
globals()['Edit'] = Edit
35+
36+
37+
class Template(ModelNormal):
38+
"""NOTE: This class is auto generated by OpenAPI Generator.
39+
Ref: https://openapi-generator.tech
40+
41+
Do not edit the class manually.
42+
43+
Attributes:
44+
allowed_values (dict): The key is the tuple path to the attribute
45+
and the for var_name this is (var_name,). The value is a dict
46+
with a capitalized key describing the allowed value and an allowed
47+
value. These dicts store the allowed enum values.
48+
attribute_map (dict): The key is attribute name
49+
and the value is json key in definition.
50+
discriminator_value_class_map (dict): A dict to go from the discriminator
51+
variable value to the discriminator class name.
52+
validations (dict): The key is the tuple path to the attribute
53+
and the for var_name this is (var_name,). The value is a dict
54+
that stores validations for max_length, min_length, max_items,
55+
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
56+
inclusive_minimum, and regex.
57+
additional_properties_type (tuple): A tuple of classes accepted
58+
as additional properties values.
59+
"""
60+
61+
allowed_values = {
62+
}
63+
64+
validations = {
65+
}
66+
67+
@cached_property
68+
def additional_properties_type():
69+
"""
70+
This must be a method because a model may have properties that are
71+
of type self, this must run after the class is loaded
72+
"""
73+
lazy_import()
74+
return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
75+
76+
_nullable = False
77+
78+
@cached_property
79+
def openapi_types():
80+
"""
81+
This must be a method because a model may have properties that are
82+
of type self, this must run after the class is loaded
83+
84+
Returns
85+
openapi_types (dict): The key is attribute name
86+
and the value is attribute type.
87+
"""
88+
lazy_import()
89+
return {
90+
'name': (str,), # noqa: E501
91+
'template': (Edit,), # noqa: E501
92+
}
93+
94+
@cached_property
95+
def discriminator():
96+
return None
97+
98+
99+
attribute_map = {
100+
'name': 'name', # noqa: E501
101+
'template': 'template', # noqa: E501
102+
}
103+
104+
read_only_vars = {
105+
}
106+
107+
_composed_schemas = {}
108+
109+
@classmethod
110+
@convert_js_args_to_python_args
111+
def _from_openapi_data(cls, name, *args, **kwargs): # noqa: E501
112+
"""Template - a model defined in OpenAPI
113+
114+
Args:
115+
name (str): The template name
116+
117+
Keyword Args:
118+
_check_type (bool): if True, values for parameters in openapi_types
119+
will be type checked and a TypeError will be
120+
raised if the wrong type is input.
121+
Defaults to True
122+
_path_to_item (tuple/list): This is a list of keys or values to
123+
drill down to the model in received_data
124+
when deserializing a response
125+
_spec_property_naming (bool): True if the variable names in the input data
126+
are serialized names, as specified in the OpenAPI document.
127+
False if the variable names in the input data
128+
are pythonic names, e.g. snake case (default)
129+
_configuration (Configuration): the instance to use when
130+
deserializing a file_type parameter.
131+
If passed, type conversion is attempted
132+
If omitted no type conversion is done.
133+
_visited_composed_classes (tuple): This stores a tuple of
134+
classes that we have traveled through so that
135+
if we see that class again we will not use its
136+
discriminator again.
137+
When traveling through a discriminator, the
138+
composed schema that is
139+
is traveled through is added to this set.
140+
For example if Animal has a discriminator
141+
petType and we pass in "Dog", and the class Dog
142+
allOf includes Animal, we move through Animal
143+
once using the discriminator, and pick Dog.
144+
Then in Dog, we will make an instance of the
145+
Animal class but this time we won't travel
146+
through its discriminator because we passed in
147+
_visited_composed_classes = (Animal,)
148+
template (Edit): [optional] # noqa: E501
149+
"""
150+
151+
_check_type = kwargs.pop('_check_type', True)
152+
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
153+
_path_to_item = kwargs.pop('_path_to_item', ())
154+
_configuration = kwargs.pop('_configuration', None)
155+
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
156+
157+
self = super(OpenApiModel, cls).__new__(cls)
158+
159+
if args:
160+
raise ApiTypeError(
161+
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
162+
args,
163+
self.__class__.__name__,
164+
),
165+
path_to_item=_path_to_item,
166+
valid_classes=(self.__class__,),
167+
)
168+
169+
self._data_store = {}
170+
self._check_type = _check_type
171+
self._spec_property_naming = _spec_property_naming
172+
self._path_to_item = _path_to_item
173+
self._configuration = _configuration
174+
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
175+
176+
self.name = name
177+
for var_name, var_value in kwargs.items():
178+
if var_name not in self.attribute_map and \
179+
self._configuration is not None and \
180+
self._configuration.discard_unknown_keys and \
181+
self.additional_properties_type is None:
182+
# discard variable.
183+
continue
184+
setattr(self, var_name, var_value)
185+
return self
186+
187+
required_properties = set([
188+
'_data_store',
189+
'_check_type',
190+
'_spec_property_naming',
191+
'_path_to_item',
192+
'_configuration',
193+
'_visited_composed_classes',
194+
])
195+
196+
@convert_js_args_to_python_args
197+
def __init__(self, name, *args, **kwargs): # noqa: E501
198+
"""Template - a model defined in OpenAPI
199+
200+
Args:
201+
name (str): The template name
202+
203+
Keyword Args:
204+
_check_type (bool): if True, values for parameters in openapi_types
205+
will be type checked and a TypeError will be
206+
raised if the wrong type is input.
207+
Defaults to True
208+
_path_to_item (tuple/list): This is a list of keys or values to
209+
drill down to the model in received_data
210+
when deserializing a response
211+
_spec_property_naming (bool): True if the variable names in the input data
212+
are serialized names, as specified in the OpenAPI document.
213+
False if the variable names in the input data
214+
are pythonic names, e.g. snake case (default)
215+
_configuration (Configuration): the instance to use when
216+
deserializing a file_type parameter.
217+
If passed, type conversion is attempted
218+
If omitted no type conversion is done.
219+
_visited_composed_classes (tuple): This stores a tuple of
220+
classes that we have traveled through so that
221+
if we see that class again we will not use its
222+
discriminator again.
223+
When traveling through a discriminator, the
224+
composed schema that is
225+
is traveled through is added to this set.
226+
For example if Animal has a discriminator
227+
petType and we pass in "Dog", and the class Dog
228+
allOf includes Animal, we move through Animal
229+
once using the discriminator, and pick Dog.
230+
Then in Dog, we will make an instance of the
231+
Animal class but this time we won't travel
232+
through its discriminator because we passed in
233+
_visited_composed_classes = (Animal,)
234+
template (Edit): [optional] # noqa: E501
235+
"""
236+
237+
_check_type = kwargs.pop('_check_type', True)
238+
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
239+
_path_to_item = kwargs.pop('_path_to_item', ())
240+
_configuration = kwargs.pop('_configuration', None)
241+
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
242+
243+
if args:
244+
raise ApiTypeError(
245+
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
246+
args,
247+
self.__class__.__name__,
248+
),
249+
path_to_item=_path_to_item,
250+
valid_classes=(self.__class__,),
251+
)
252+
253+
self._data_store = {}
254+
self._check_type = _check_type
255+
self._spec_property_naming = _spec_property_naming
256+
self._path_to_item = _path_to_item
257+
self._configuration = _configuration
258+
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
259+
260+
self.name = name
261+
for var_name, var_value in kwargs.items():
262+
if var_name not in self.attribute_map and \
263+
self._configuration is not None and \
264+
self._configuration.discard_unknown_keys and \
265+
self.additional_properties_type is None:
266+
# discard variable.
267+
continue
268+
setattr(self, var_name, var_value)
269+
if var_name in self.read_only_vars:
270+
raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
271+
f"class with read only attributes.")

0 commit comments

Comments
 (0)