|
| 1 | +""" |
| 2 | + Apideck |
| 3 | +
|
| 4 | + The Apideck OpenAPI Spec: SDK Optimized # noqa: E501 |
| 5 | +
|
| 6 | + The version of the OpenAPI document: 10.4.0 |
| 7 | + Generated by: https://openapi-generator.tech |
| 8 | +""" |
| 9 | + |
| 10 | + |
| 11 | +import re # noqa: F401 |
| 12 | +import sys # noqa: F401 |
| 13 | + |
| 14 | +from apideck.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 apideck.exceptions import ApiAttributeError |
| 30 | + |
| 31 | + |
| 32 | +def lazy_import(): |
| 33 | + from apideck.model.sort_direction import SortDirection |
| 34 | + globals()['SortDirection'] = SortDirection |
| 35 | + |
| 36 | + |
| 37 | +class OrdersSort(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 | + ('by',): { |
| 63 | + 'CREATED_AT': "created_at", |
| 64 | + 'UPDATED_AT': "updated_at", |
| 65 | + 'NAME': "name", |
| 66 | + }, |
| 67 | + } |
| 68 | + |
| 69 | + validations = { |
| 70 | + } |
| 71 | + |
| 72 | + additional_properties_type = None |
| 73 | + |
| 74 | + _nullable = False |
| 75 | + |
| 76 | + @cached_property |
| 77 | + def openapi_types(): |
| 78 | + """ |
| 79 | + This must be a method because a model may have properties that are |
| 80 | + of type self, this must run after the class is loaded |
| 81 | +
|
| 82 | + Returns |
| 83 | + openapi_types (dict): The key is attribute name |
| 84 | + and the value is attribute type. |
| 85 | + """ |
| 86 | + lazy_import() |
| 87 | + return { |
| 88 | + 'by': (str,), # noqa: E501 |
| 89 | + 'direction': (SortDirection,), # noqa: E501 |
| 90 | + } |
| 91 | + |
| 92 | + @cached_property |
| 93 | + def discriminator(): |
| 94 | + return None |
| 95 | + |
| 96 | + |
| 97 | + attribute_map = { |
| 98 | + 'by': 'by', # noqa: E501 |
| 99 | + 'direction': 'direction', # noqa: E501 |
| 100 | + } |
| 101 | + |
| 102 | + read_only_vars = { |
| 103 | + } |
| 104 | + |
| 105 | + _composed_schemas = {} |
| 106 | + |
| 107 | + @classmethod |
| 108 | + @convert_js_args_to_python_args |
| 109 | + def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 |
| 110 | + """OrdersSort - a model defined in OpenAPI |
| 111 | +
|
| 112 | + Keyword Args: |
| 113 | + _check_type (bool): if True, values for parameters in openapi_types |
| 114 | + will be type checked and a TypeError will be |
| 115 | + raised if the wrong type is input. |
| 116 | + Defaults to True |
| 117 | + _path_to_item (tuple/list): This is a list of keys or values to |
| 118 | + drill down to the model in received_data |
| 119 | + when deserializing a response |
| 120 | + _spec_property_naming (bool): True if the variable names in the input data |
| 121 | + are serialized names, as specified in the OpenAPI document. |
| 122 | + False if the variable names in the input data |
| 123 | + are pythonic names, e.g. snake case (default) |
| 124 | + _configuration (Configuration): the instance to use when |
| 125 | + deserializing a file_type parameter. |
| 126 | + If passed, type conversion is attempted |
| 127 | + If omitted no type conversion is done. |
| 128 | + _visited_composed_classes (tuple): This stores a tuple of |
| 129 | + classes that we have traveled through so that |
| 130 | + if we see that class again we will not use its |
| 131 | + discriminator again. |
| 132 | + When traveling through a discriminator, the |
| 133 | + composed schema that is |
| 134 | + is traveled through is added to this set. |
| 135 | + For example if Animal has a discriminator |
| 136 | + petType and we pass in "Dog", and the class Dog |
| 137 | + allOf includes Animal, we move through Animal |
| 138 | + once using the discriminator, and pick Dog. |
| 139 | + Then in Dog, we will make an instance of the |
| 140 | + Animal class but this time we won't travel |
| 141 | + through its discriminator because we passed in |
| 142 | + _visited_composed_classes = (Animal,) |
| 143 | + by (str): The field on which to sort the Orders. [optional] # noqa: E501 |
| 144 | + direction (SortDirection): [optional] # noqa: E501 |
| 145 | + """ |
| 146 | + |
| 147 | + _check_type = kwargs.pop('_check_type', True) |
| 148 | + _spec_property_naming = kwargs.pop('_spec_property_naming', False) |
| 149 | + _path_to_item = kwargs.pop('_path_to_item', ()) |
| 150 | + _configuration = kwargs.pop('_configuration', None) |
| 151 | + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) |
| 152 | + |
| 153 | + self = super(OpenApiModel, cls).__new__(cls) |
| 154 | + |
| 155 | + if args: |
| 156 | + raise ApiTypeError( |
| 157 | + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( |
| 158 | + args, |
| 159 | + self.__class__.__name__, |
| 160 | + ), |
| 161 | + path_to_item=_path_to_item, |
| 162 | + valid_classes=(self.__class__,), |
| 163 | + ) |
| 164 | + |
| 165 | + self._data_store = {} |
| 166 | + self._check_type = _check_type |
| 167 | + self._spec_property_naming = _spec_property_naming |
| 168 | + self._path_to_item = _path_to_item |
| 169 | + self._configuration = _configuration |
| 170 | + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) |
| 171 | + |
| 172 | + for var_name, var_value in kwargs.items(): |
| 173 | + if var_name not in self.attribute_map and \ |
| 174 | + self._configuration is not None and \ |
| 175 | + self._configuration.discard_unknown_keys and \ |
| 176 | + self.additional_properties_type is None: |
| 177 | + # discard variable. |
| 178 | + continue |
| 179 | + setattr(self, var_name, var_value) |
| 180 | + return self |
| 181 | + |
| 182 | + required_properties = set([ |
| 183 | + '_data_store', |
| 184 | + '_check_type', |
| 185 | + '_spec_property_naming', |
| 186 | + '_path_to_item', |
| 187 | + '_configuration', |
| 188 | + '_visited_composed_classes', |
| 189 | + ]) |
| 190 | + |
| 191 | + @convert_js_args_to_python_args |
| 192 | + def __init__(self, *args, **kwargs): # noqa: E501 |
| 193 | + """OrdersSort - a model defined in OpenAPI |
| 194 | +
|
| 195 | + Keyword Args: |
| 196 | + _check_type (bool): if True, values for parameters in openapi_types |
| 197 | + will be type checked and a TypeError will be |
| 198 | + raised if the wrong type is input. |
| 199 | + Defaults to True |
| 200 | + _path_to_item (tuple/list): This is a list of keys or values to |
| 201 | + drill down to the model in received_data |
| 202 | + when deserializing a response |
| 203 | + _spec_property_naming (bool): True if the variable names in the input data |
| 204 | + are serialized names, as specified in the OpenAPI document. |
| 205 | + False if the variable names in the input data |
| 206 | + are pythonic names, e.g. snake case (default) |
| 207 | + _configuration (Configuration): the instance to use when |
| 208 | + deserializing a file_type parameter. |
| 209 | + If passed, type conversion is attempted |
| 210 | + If omitted no type conversion is done. |
| 211 | + _visited_composed_classes (tuple): This stores a tuple of |
| 212 | + classes that we have traveled through so that |
| 213 | + if we see that class again we will not use its |
| 214 | + discriminator again. |
| 215 | + When traveling through a discriminator, the |
| 216 | + composed schema that is |
| 217 | + is traveled through is added to this set. |
| 218 | + For example if Animal has a discriminator |
| 219 | + petType and we pass in "Dog", and the class Dog |
| 220 | + allOf includes Animal, we move through Animal |
| 221 | + once using the discriminator, and pick Dog. |
| 222 | + Then in Dog, we will make an instance of the |
| 223 | + Animal class but this time we won't travel |
| 224 | + through its discriminator because we passed in |
| 225 | + _visited_composed_classes = (Animal,) |
| 226 | + by (str): The field on which to sort the Orders. [optional] # noqa: E501 |
| 227 | + direction (SortDirection): [optional] # noqa: E501 |
| 228 | + """ |
| 229 | + |
| 230 | + _check_type = kwargs.pop('_check_type', True) |
| 231 | + _spec_property_naming = kwargs.pop('_spec_property_naming', False) |
| 232 | + _path_to_item = kwargs.pop('_path_to_item', ()) |
| 233 | + _configuration = kwargs.pop('_configuration', None) |
| 234 | + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) |
| 235 | + |
| 236 | + if args: |
| 237 | + raise ApiTypeError( |
| 238 | + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( |
| 239 | + args, |
| 240 | + self.__class__.__name__, |
| 241 | + ), |
| 242 | + path_to_item=_path_to_item, |
| 243 | + valid_classes=(self.__class__,), |
| 244 | + ) |
| 245 | + |
| 246 | + self._data_store = {} |
| 247 | + self._check_type = _check_type |
| 248 | + self._spec_property_naming = _spec_property_naming |
| 249 | + self._path_to_item = _path_to_item |
| 250 | + self._configuration = _configuration |
| 251 | + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) |
| 252 | + |
| 253 | + for var_name, var_value in kwargs.items(): |
| 254 | + if var_name not in self.attribute_map and \ |
| 255 | + self._configuration is not None and \ |
| 256 | + self._configuration.discard_unknown_keys and \ |
| 257 | + self.additional_properties_type is None: |
| 258 | + # discard variable. |
| 259 | + continue |
| 260 | + setattr(self, var_name, var_value) |
| 261 | + if var_name in self.read_only_vars: |
| 262 | + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " |
| 263 | + f"class with read only attributes.") |
0 commit comments