|
| 1 | +""" |
| 2 | + BIMData API |
| 3 | +
|
| 4 | + BIMData API is a tool to interact with your models stored on BIMData’s servers. Through the API, you can manage your projects, the clouds, upload your IFC files and manage them through endpoints. # noqa: E501 |
| 5 | +
|
| 6 | + The version of the OpenAPI document: v1 (v1) |
| 7 | + Contact: support@bimdata.io |
| 8 | + Generated by: https://openapi-generator.tech |
| 9 | +""" |
| 10 | + |
| 11 | + |
| 12 | +import re # noqa: F401 |
| 13 | +import sys # noqa: F401 |
| 14 | + |
| 15 | +from bimdata_api_client.model_utils import ( # noqa: F401 |
| 16 | + ApiTypeError, |
| 17 | + ModelComposed, |
| 18 | + ModelNormal, |
| 19 | + ModelSimple, |
| 20 | + cached_property, |
| 21 | + change_keys_js_to_python, |
| 22 | + convert_js_args_to_python_args, |
| 23 | + date, |
| 24 | + datetime, |
| 25 | + file_type, |
| 26 | + none_type, |
| 27 | + validate_get_composed_info, |
| 28 | + OpenApiModel |
| 29 | +) |
| 30 | +from bimdata_api_client.exceptions import ApiAttributeError |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | +class ModelDocument(ModelNormal): |
| 35 | + """NOTE: This class is auto generated by OpenAPI Generator. |
| 36 | + Ref: https://openapi-generator.tech |
| 37 | +
|
| 38 | + Do not edit the class manually. |
| 39 | +
|
| 40 | + Attributes: |
| 41 | + allowed_values (dict): The key is the tuple path to the attribute |
| 42 | + and the for var_name this is (var_name,). The value is a dict |
| 43 | + with a capitalized key describing the allowed value and an allowed |
| 44 | + value. These dicts store the allowed enum values. |
| 45 | + attribute_map (dict): The key is attribute name |
| 46 | + and the value is json key in definition. |
| 47 | + discriminator_value_class_map (dict): A dict to go from the discriminator |
| 48 | + variable value to the discriminator class name. |
| 49 | + validations (dict): The key is the tuple path to the attribute |
| 50 | + and the for var_name this is (var_name,). The value is a dict |
| 51 | + that stores validations for max_length, min_length, max_items, |
| 52 | + min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, |
| 53 | + inclusive_minimum, and regex. |
| 54 | + additional_properties_type (tuple): A tuple of classes accepted |
| 55 | + as additional properties values. |
| 56 | + """ |
| 57 | + |
| 58 | + allowed_values = { |
| 59 | + ('user_permission',): { |
| 60 | + '1': 1, |
| 61 | + '50': 50, |
| 62 | + '100': 100, |
| 63 | + }, |
| 64 | + } |
| 65 | + |
| 66 | + validations = { |
| 67 | + ('name',): { |
| 68 | + 'max_length': 512, |
| 69 | + }, |
| 70 | + ('file_name',): { |
| 71 | + 'max_length': 512, |
| 72 | + }, |
| 73 | + } |
| 74 | + |
| 75 | + @cached_property |
| 76 | + def additional_properties_type(): |
| 77 | + """ |
| 78 | + This must be a method because a model may have properties that are |
| 79 | + of type self, this must run after the class is loaded |
| 80 | + """ |
| 81 | + return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 |
| 82 | + |
| 83 | + _nullable = False |
| 84 | + |
| 85 | + @cached_property |
| 86 | + def openapi_types(): |
| 87 | + """ |
| 88 | + This must be a method because a model may have properties that are |
| 89 | + of type self, this must run after the class is loaded |
| 90 | +
|
| 91 | + Returns |
| 92 | + openapi_types (dict): The key is attribute name |
| 93 | + and the value is attribute type. |
| 94 | + """ |
| 95 | + return { |
| 96 | + 'id': (int,), # noqa: E501 |
| 97 | + 'name': (str,), # noqa: E501 |
| 98 | + 'file': (str,), # noqa: E501 |
| 99 | + 'size': (int, none_type,), # noqa: E501 |
| 100 | + 'created_at': (datetime,), # noqa: E501 |
| 101 | + 'updated_at': (datetime,), # noqa: E501 |
| 102 | + 'head_id': (int, none_type,), # noqa: E501 |
| 103 | + 'is_head_version': (bool,), # noqa: E501 |
| 104 | + 'history_count': (int, none_type,), # noqa: E501 |
| 105 | + 'user_permission': (int,), # noqa: E501 |
| 106 | + 'office_preview': (str, none_type,), # noqa: E501 |
| 107 | + 'file_name': (str,), # noqa: E501 |
| 108 | + 'description': (str, none_type,), # noqa: E501 |
| 109 | + } |
| 110 | + |
| 111 | + @cached_property |
| 112 | + def discriminator(): |
| 113 | + return None |
| 114 | + |
| 115 | + |
| 116 | + attribute_map = { |
| 117 | + 'id': 'id', # noqa: E501 |
| 118 | + 'name': 'name', # noqa: E501 |
| 119 | + 'file': 'file', # noqa: E501 |
| 120 | + 'size': 'size', # noqa: E501 |
| 121 | + 'created_at': 'created_at', # noqa: E501 |
| 122 | + 'updated_at': 'updated_at', # noqa: E501 |
| 123 | + 'head_id': 'head_id', # noqa: E501 |
| 124 | + 'is_head_version': 'is_head_version', # noqa: E501 |
| 125 | + 'history_count': 'history_count', # noqa: E501 |
| 126 | + 'user_permission': 'user_permission', # noqa: E501 |
| 127 | + 'office_preview': 'office_preview', # noqa: E501 |
| 128 | + 'file_name': 'file_name', # noqa: E501 |
| 129 | + 'description': 'description', # noqa: E501 |
| 130 | + } |
| 131 | + |
| 132 | + read_only_vars = { |
| 133 | + 'id', # noqa: E501 |
| 134 | + 'size', # noqa: E501 |
| 135 | + 'created_at', # noqa: E501 |
| 136 | + 'updated_at', # noqa: E501 |
| 137 | + 'head_id', # noqa: E501 |
| 138 | + 'is_head_version', # noqa: E501 |
| 139 | + 'history_count', # noqa: E501 |
| 140 | + 'user_permission', # noqa: E501 |
| 141 | + 'office_preview', # noqa: E501 |
| 142 | + } |
| 143 | + |
| 144 | + _composed_schemas = {} |
| 145 | + |
| 146 | + @classmethod |
| 147 | + @convert_js_args_to_python_args |
| 148 | + def _from_openapi_data(cls, id, name, file, size, created_at, updated_at, head_id, is_head_version, history_count, user_permission, office_preview, *args, **kwargs): # noqa: E501 |
| 149 | + """ModelDocument - a model defined in OpenAPI |
| 150 | +
|
| 151 | + Args: |
| 152 | + id (int): |
| 153 | + name (str): Shown name of the file |
| 154 | + file (str): |
| 155 | + size (int, none_type): Size of the file. |
| 156 | + created_at (datetime): Creation date |
| 157 | + updated_at (datetime): Date of the last update |
| 158 | + head_id (int, none_type): Document id of head version |
| 159 | + is_head_version (bool): Document is a head of version or is owned by another document |
| 160 | + history_count (int, none_type): Number of previous versions |
| 161 | + user_permission (int): Aggregate of group user permissions and folder default permission |
| 162 | + office_preview (str, none_type): Office files will be converted as pdf to provide a web preview. Supported extensions are .ppt, .pptx, .odp, .xls, .xlsx, .ods, .doc, .docx, .odt |
| 163 | +
|
| 164 | + Keyword Args: |
| 165 | + _check_type (bool): if True, values for parameters in openapi_types |
| 166 | + will be type checked and a TypeError will be |
| 167 | + raised if the wrong type is input. |
| 168 | + Defaults to True |
| 169 | + _path_to_item (tuple/list): This is a list of keys or values to |
| 170 | + drill down to the model in received_data |
| 171 | + when deserializing a response |
| 172 | + _spec_property_naming (bool): True if the variable names in the input data |
| 173 | + are serialized names, as specified in the OpenAPI document. |
| 174 | + False if the variable names in the input data |
| 175 | + are pythonic names, e.g. snake case (default) |
| 176 | + _configuration (Configuration): the instance to use when |
| 177 | + deserializing a file_type parameter. |
| 178 | + If passed, type conversion is attempted |
| 179 | + If omitted no type conversion is done. |
| 180 | + _visited_composed_classes (tuple): This stores a tuple of |
| 181 | + classes that we have traveled through so that |
| 182 | + if we see that class again we will not use its |
| 183 | + discriminator again. |
| 184 | + When traveling through a discriminator, the |
| 185 | + composed schema that is |
| 186 | + is traveled through is added to this set. |
| 187 | + For example if Animal has a discriminator |
| 188 | + petType and we pass in "Dog", and the class Dog |
| 189 | + allOf includes Animal, we move through Animal |
| 190 | + once using the discriminator, and pick Dog. |
| 191 | + Then in Dog, we will make an instance of the |
| 192 | + Animal class but this time we won't travel |
| 193 | + through its discriminator because we passed in |
| 194 | + _visited_composed_classes = (Animal,) |
| 195 | + file_name (str): Full name of the file. [optional] # noqa: E501 |
| 196 | + description (str, none_type): Description of the file. [optional] # noqa: E501 |
| 197 | + """ |
| 198 | + |
| 199 | + _check_type = kwargs.pop('_check_type', True) |
| 200 | + _spec_property_naming = kwargs.pop('_spec_property_naming', False) |
| 201 | + _path_to_item = kwargs.pop('_path_to_item', ()) |
| 202 | + _configuration = kwargs.pop('_configuration', None) |
| 203 | + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) |
| 204 | + |
| 205 | + self = super(OpenApiModel, cls).__new__(cls) |
| 206 | + |
| 207 | + if args: |
| 208 | + raise ApiTypeError( |
| 209 | + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( |
| 210 | + args, |
| 211 | + self.__class__.__name__, |
| 212 | + ), |
| 213 | + path_to_item=_path_to_item, |
| 214 | + valid_classes=(self.__class__,), |
| 215 | + ) |
| 216 | + |
| 217 | + self._data_store = {} |
| 218 | + self._check_type = _check_type |
| 219 | + self._spec_property_naming = _spec_property_naming |
| 220 | + self._path_to_item = _path_to_item |
| 221 | + self._configuration = _configuration |
| 222 | + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) |
| 223 | + |
| 224 | + self.id = id |
| 225 | + self.name = name |
| 226 | + self.file = file |
| 227 | + self.size = size |
| 228 | + self.created_at = created_at |
| 229 | + self.updated_at = updated_at |
| 230 | + self.head_id = head_id |
| 231 | + self.is_head_version = is_head_version |
| 232 | + self.history_count = history_count |
| 233 | + self.user_permission = user_permission |
| 234 | + self.office_preview = office_preview |
| 235 | + for var_name, var_value in kwargs.items(): |
| 236 | + if var_name not in self.attribute_map and \ |
| 237 | + self._configuration is not None and \ |
| 238 | + self._configuration.discard_unknown_keys and \ |
| 239 | + self.additional_properties_type is None: |
| 240 | + # discard variable. |
| 241 | + continue |
| 242 | + setattr(self, var_name, var_value) |
| 243 | + return self |
| 244 | + |
| 245 | + required_properties = set([ |
| 246 | + '_data_store', |
| 247 | + '_check_type', |
| 248 | + '_spec_property_naming', |
| 249 | + '_path_to_item', |
| 250 | + '_configuration', |
| 251 | + '_visited_composed_classes', |
| 252 | + ]) |
| 253 | + |
| 254 | + @convert_js_args_to_python_args |
| 255 | + def __init__(self, name, file, *args, **kwargs): # noqa: E501 |
| 256 | + """ModelDocument - a model defined in OpenAPI |
| 257 | +
|
| 258 | + name (str): Shown name of the file |
| 259 | + file (str): |
| 260 | + Keyword Args: |
| 261 | + _check_type (bool): if True, values for parameters in openapi_types |
| 262 | + will be type checked and a TypeError will be |
| 263 | + raised if the wrong type is input. |
| 264 | + Defaults to True |
| 265 | + _path_to_item (tuple/list): This is a list of keys or values to |
| 266 | + drill down to the model in received_data |
| 267 | + when deserializing a response |
| 268 | + _spec_property_naming (bool): True if the variable names in the input data |
| 269 | + are serialized names, as specified in the OpenAPI document. |
| 270 | + False if the variable names in the input data |
| 271 | + are pythonic names, e.g. snake case (default) |
| 272 | + _configuration (Configuration): the instance to use when |
| 273 | + deserializing a file_type parameter. |
| 274 | + If passed, type conversion is attempted |
| 275 | + If omitted no type conversion is done. |
| 276 | + _visited_composed_classes (tuple): This stores a tuple of |
| 277 | + classes that we have traveled through so that |
| 278 | + if we see that class again we will not use its |
| 279 | + discriminator again. |
| 280 | + When traveling through a discriminator, the |
| 281 | + composed schema that is |
| 282 | + is traveled through is added to this set. |
| 283 | + For example if Animal has a discriminator |
| 284 | + petType and we pass in "Dog", and the class Dog |
| 285 | + allOf includes Animal, we move through Animal |
| 286 | + once using the discriminator, and pick Dog. |
| 287 | + Then in Dog, we will make an instance of the |
| 288 | + Animal class but this time we won't travel |
| 289 | + through its discriminator because we passed in |
| 290 | + _visited_composed_classes = (Animal,) |
| 291 | + file_name (str): Full name of the file. [optional] # noqa: E501 |
| 292 | + description (str, none_type): Description of the file. [optional] # noqa: E501 |
| 293 | + """ |
| 294 | + |
| 295 | + _check_type = kwargs.pop('_check_type', True) |
| 296 | + _spec_property_naming = kwargs.pop('_spec_property_naming', False) |
| 297 | + _path_to_item = kwargs.pop('_path_to_item', ()) |
| 298 | + _configuration = kwargs.pop('_configuration', None) |
| 299 | + _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) |
| 300 | + |
| 301 | + if args: |
| 302 | + raise ApiTypeError( |
| 303 | + "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( |
| 304 | + args, |
| 305 | + self.__class__.__name__, |
| 306 | + ), |
| 307 | + path_to_item=_path_to_item, |
| 308 | + valid_classes=(self.__class__,), |
| 309 | + ) |
| 310 | + |
| 311 | + self._data_store = {} |
| 312 | + self._check_type = _check_type |
| 313 | + self._spec_property_naming = _spec_property_naming |
| 314 | + self._path_to_item = _path_to_item |
| 315 | + self._configuration = _configuration |
| 316 | + self._visited_composed_classes = _visited_composed_classes + (self.__class__,) |
| 317 | + |
| 318 | + self.name = name |
| 319 | + self.file = file |
| 320 | + for var_name, var_value in kwargs.items(): |
| 321 | + if var_name not in self.attribute_map and \ |
| 322 | + self._configuration is not None and \ |
| 323 | + self._configuration.discard_unknown_keys and \ |
| 324 | + self.additional_properties_type is None: |
| 325 | + # discard variable. |
| 326 | + continue |
| 327 | + setattr(self, var_name, var_value) |
| 328 | + if var_name in self.read_only_vars: |
| 329 | + raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " |
| 330 | + f"class with read only attributes.") |
0 commit comments