Skip to content

Commit d6eecfd

Browse files
Bimdata-ioAmoki
andcommitted
MINOR: add available_models to ProjectAccessToken (#1025)
* MINOR: add available_models to ProjectAccessToken * add migration * remove prints, better doc * Fixes after rebase --------- Co-authored-by: Amoki <hugo@bimdata.io>
1 parent 20b08e1 commit d6eecfd

12 files changed

Lines changed: 64 additions & 51 deletions

bimdata_api_client/api/collaboration_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9344,7 +9344,7 @@ def create_document(
93449344
):
93459345
"""Create a document # noqa: E501
93469346

9347-
Create a document. If the document is one of {'DXF', 'DWG', 'IFC', 'GLTF', 'POINT_CLOUD', 'PHOTOSPHERE', 'OBJ'}, a model will be created and attached to this document Required scopes: document:write # noqa: E501
9347+
Create a document. If the document is one of {'IFC', 'OBJ', 'PHOTOSPHERE', 'DWG', 'GLTF', 'DXF', 'POINT_CLOUD'}, a model will be created and attached to this document Required scopes: document:write # noqa: E501
93489348
This method makes a synchronous HTTP request by default. To make an
93499349
asynchronous HTTP request, please pass async_req=True
93509350

bimdata_api_client/model/document_text.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ class DocumentText(ModelNormal):
5858
allowed_values = {
5959
('language',): {
6060
'None': None,
61-
'SPANISH': "spanish",
62-
'GERMAN': "german",
6361
'ENGLISH': "english",
64-
'FRENCH': "french",
62+
'GERMAN': "german",
63+
'SPANISH': "spanish",
6564
'ITALIAN': "italian",
65+
'FRENCH': "french",
6666
'NULL': "null",
6767
},
6868
}
@@ -153,7 +153,7 @@ def _from_openapi_data(cls, id, *args, **kwargs): # noqa: E501
153153
through its discriminator because we passed in
154154
_visited_composed_classes = (Animal,)
155155
text (str, none_type): The full text representation of a document if the feature is enabled and the file format supported. [optional] # noqa: E501
156-
language (str, none_type): * `spanish` - spanish * `german` - german * `english` - english * `french` - french * `italian` - italian. [optional] # noqa: E501
156+
language (str, none_type): * `english` - english * `german` - german * `spanish` - spanish * `italian` - italian * `french` - french. [optional] # noqa: E501
157157
"""
158158

159159
_check_type = kwargs.pop('_check_type', True)
@@ -237,7 +237,7 @@ def __init__(self, *args, **kwargs): # noqa: E501
237237
through its discriminator because we passed in
238238
_visited_composed_classes = (Animal,)
239239
text (str, none_type): The full text representation of a document if the feature is enabled and the file format supported. [optional] # noqa: E501
240-
language (str, none_type): * `spanish` - spanish * `german` - german * `english` - english * `french` - french * `italian` - italian. [optional] # noqa: E501
240+
language (str, none_type): * `english` - english * `german` - german * `spanish` - spanish * `italian` - italian * `french` - french. [optional] # noqa: E501
241241
"""
242242

243243
_check_type = kwargs.pop('_check_type', True)

bimdata_api_client/model/patched_document_text_request.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ class PatchedDocumentTextRequest(ModelNormal):
5858
allowed_values = {
5959
('language',): {
6060
'None': None,
61-
'SPANISH': "spanish",
62-
'GERMAN': "german",
6361
'ENGLISH': "english",
64-
'FRENCH': "french",
62+
'GERMAN': "german",
63+
'SPANISH': "spanish",
6564
'ITALIAN': "italian",
65+
'FRENCH': "french",
6666
'NULL': "null",
6767
},
6868
}
@@ -147,7 +147,7 @@ def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
147147
through its discriminator because we passed in
148148
_visited_composed_classes = (Animal,)
149149
text (str, none_type): The full text representation of a document if the feature is enabled and the file format supported. [optional] # noqa: E501
150-
language (str, none_type): * `spanish` - spanish * `german` - german * `english` - english * `french` - french * `italian` - italian. [optional] # noqa: E501
150+
language (str, none_type): * `english` - english * `german` - german * `spanish` - spanish * `italian` - italian * `french` - french. [optional] # noqa: E501
151151
"""
152152

153153
_check_type = kwargs.pop('_check_type', True)
@@ -230,7 +230,7 @@ def __init__(self, *args, **kwargs): # noqa: E501
230230
through its discriminator because we passed in
231231
_visited_composed_classes = (Animal,)
232232
text (str, none_type): The full text representation of a document if the feature is enabled and the file format supported. [optional] # noqa: E501
233-
language (str, none_type): * `spanish` - spanish * `german` - german * `english` - english * `french` - french * `italian` - italian. [optional] # noqa: E501
233+
language (str, none_type): * `english` - english * `german` - german * `spanish` - spanish * `italian` - italian * `french` - french. [optional] # noqa: E501
234234
"""
235235

236236
_check_type = kwargs.pop('_check_type', True)

bimdata_api_client/model/project_access_token.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def openapi_types():
9696
'scopes': ([str],), # noqa: E501
9797
'expires_at': (datetime,), # noqa: E501
9898
'email_impersonation': (str, none_type,), # noqa: E501
99+
'available_models': ([int],), # noqa: E501
99100
}
100101

101102
@cached_property
@@ -108,6 +109,7 @@ def discriminator():
108109
'scopes': 'scopes', # noqa: E501
109110
'expires_at': 'expires_at', # noqa: E501
110111
'email_impersonation': 'email_impersonation', # noqa: E501
112+
'available_models': 'available_models', # noqa: E501
111113
}
112114

113115
read_only_vars = {
@@ -157,7 +159,8 @@ def _from_openapi_data(cls, token, scopes, *args, **kwargs): # noqa: E501
157159
through its discriminator because we passed in
158160
_visited_composed_classes = (Animal,)
159161
expires_at (datetime): [optional] # noqa: E501
160-
email_impersonation (str, none_type): If the request is made from an SSO application, you can link the token to a user. All calls made with the token will populate created_by fields with the user. If the user don't have access to some data, the token won't have access. . [optional] # noqa: E501
162+
email_impersonation (str, none_type): If the request is made from an SSO application, you can link the token to a user. All calls made with the token will populate created_by fields with the user. If the user don't have access to some data, the token won't have access. `available_models` can't be set when a user is impersonated. . [optional] # noqa: E501
163+
available_models ([int]): List of model IDs that the token can access. If not specified, the token can access all models of the project. This field can't be set if email_impersonation is set. This field can't be set if `document:read` is in scopes. . [optional] # noqa: E501
161164
"""
162165

163166
_check_type = kwargs.pop('_check_type', True)
@@ -244,7 +247,8 @@ def __init__(self, scopes, *args, **kwargs): # noqa: E501
244247
through its discriminator because we passed in
245248
_visited_composed_classes = (Animal,)
246249
expires_at (datetime): [optional] # noqa: E501
247-
email_impersonation (str, none_type): If the request is made from an SSO application, you can link the token to a user. All calls made with the token will populate created_by fields with the user. If the user don't have access to some data, the token won't have access. . [optional] # noqa: E501
250+
email_impersonation (str, none_type): If the request is made from an SSO application, you can link the token to a user. All calls made with the token will populate created_by fields with the user. If the user don't have access to some data, the token won't have access. `available_models` can't be set when a user is impersonated. . [optional] # noqa: E501
251+
available_models ([int]): List of model IDs that the token can access. If not specified, the token can access all models of the project. This field can't be set if email_impersonation is set. This field can't be set if `document:read` is in scopes. . [optional] # noqa: E501
248252
"""
249253

250254
_check_type = kwargs.pop('_check_type', True)

bimdata_api_client/model/project_access_token_request.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ def openapi_types():
9898
'scopes': ([str],), # noqa: E501
9999
'expires_at': (datetime,), # noqa: E501
100100
'email_impersonation': (str, none_type,), # noqa: E501
101+
'available_models': ([int],), # noqa: E501
101102
}
102103

103104
@cached_property
@@ -109,6 +110,7 @@ def discriminator():
109110
'scopes': 'scopes', # noqa: E501
110111
'expires_at': 'expires_at', # noqa: E501
111112
'email_impersonation': 'email_impersonation', # noqa: E501
113+
'available_models': 'available_models', # noqa: E501
112114
}
113115

114116
read_only_vars = {
@@ -156,7 +158,8 @@ def _from_openapi_data(cls, scopes, *args, **kwargs): # noqa: E501
156158
through its discriminator because we passed in
157159
_visited_composed_classes = (Animal,)
158160
expires_at (datetime): [optional] # noqa: E501
159-
email_impersonation (str, none_type): If the request is made from an SSO application, you can link the token to a user. All calls made with the token will populate created_by fields with the user. If the user don't have access to some data, the token won't have access. . [optional] # noqa: E501
161+
email_impersonation (str, none_type): If the request is made from an SSO application, you can link the token to a user. All calls made with the token will populate created_by fields with the user. If the user don't have access to some data, the token won't have access. `available_models` can't be set when a user is impersonated. . [optional] # noqa: E501
162+
available_models ([int]): List of model IDs that the token can access. If not specified, the token can access all models of the project. This field can't be set if email_impersonation is set. This field can't be set if `document:read` is in scopes. . [optional] # noqa: E501
160163
"""
161164

162165
_check_type = kwargs.pop('_check_type', True)
@@ -243,7 +246,8 @@ def __init__(self, scopes, *args, **kwargs): # noqa: E501
243246
through its discriminator because we passed in
244247
_visited_composed_classes = (Animal,)
245248
expires_at (datetime): [optional] # noqa: E501
246-
email_impersonation (str, none_type): If the request is made from an SSO application, you can link the token to a user. All calls made with the token will populate created_by fields with the user. If the user don't have access to some data, the token won't have access. . [optional] # noqa: E501
249+
email_impersonation (str, none_type): If the request is made from an SSO application, you can link the token to a user. All calls made with the token will populate created_by fields with the user. If the user don't have access to some data, the token won't have access. `available_models` can't be set when a user is impersonated. . [optional] # noqa: E501
250+
available_models ([int]): List of model IDs that the token can access. If not specified, the token can access all models of the project. This field can't be set if email_impersonation is set. This field can't be set if `document:read` is in scopes. . [optional] # noqa: E501
247251
"""
248252

249253
_check_type = kwargs.pop('_check_type', True)

bimdata_api_client/model/write_folder.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,15 @@ def openapi_types():
107107
"""
108108
lazy_import()
109109
return {
110-
'groups_permissions': ([GroupFolderRead],), # noqa: E501
111-
'type': (str,), # noqa: E501
112110
'created_at': (datetime,), # noqa: E501
113-
'nature': (str,), # noqa: E501
114-
'created_by': (bool, date, datetime, dict, float, int, list, str, none_type,), # noqa: E501
115111
'updated_at': (datetime,), # noqa: E501
116-
'user_permission': (int,), # noqa: E501
117112
'name': (str,), # noqa: E501
113+
'groups_permissions': ([GroupFolderRead],), # noqa: E501
114+
'type': (str,), # noqa: E501
115+
'user_permission': (int,), # noqa: E501
116+
'created_by': (bool, date, datetime, dict, float, int, list, str, none_type,), # noqa: E501
118117
'id': (int,), # noqa: E501
118+
'nature': (str,), # noqa: E501
119119
'default_permission': (int,), # noqa: E501
120120
'parent_id': (int, none_type,), # noqa: E501
121121
'children': ([WriteFolder], none_type,), # noqa: E501
@@ -127,48 +127,48 @@ def discriminator():
127127

128128

129129
attribute_map = {
130-
'groups_permissions': 'groups_permissions', # noqa: E501
131-
'type': 'type', # noqa: E501
132130
'created_at': 'created_at', # noqa: E501
133-
'nature': 'nature', # noqa: E501
134-
'created_by': 'created_by', # noqa: E501
135131
'updated_at': 'updated_at', # noqa: E501
136-
'user_permission': 'user_permission', # noqa: E501
137132
'name': 'name', # noqa: E501
133+
'groups_permissions': 'groups_permissions', # noqa: E501
134+
'type': 'type', # noqa: E501
135+
'user_permission': 'user_permission', # noqa: E501
136+
'created_by': 'created_by', # noqa: E501
138137
'id': 'id', # noqa: E501
138+
'nature': 'nature', # noqa: E501
139139
'default_permission': 'default_permission', # noqa: E501
140140
'parent_id': 'parent_id', # noqa: E501
141141
'children': 'children', # noqa: E501
142142
}
143143

144144
read_only_vars = {
145-
'groups_permissions', # noqa: E501
146-
'type', # noqa: E501
147145
'created_at', # noqa: E501
148-
'nature', # noqa: E501
149-
'created_by', # noqa: E501
150146
'updated_at', # noqa: E501
147+
'groups_permissions', # noqa: E501
148+
'type', # noqa: E501
151149
'user_permission', # noqa: E501
150+
'created_by', # noqa: E501
152151
'id', # noqa: E501
152+
'nature', # noqa: E501
153153
}
154154

155155
_composed_schemas = {}
156156

157157
@classmethod
158158
@convert_js_args_to_python_args
159-
def _from_openapi_data(cls, groups_permissions, type, created_at, nature, created_by, updated_at, user_permission, name, id, *args, **kwargs): # noqa: E501
159+
def _from_openapi_data(cls, created_at, updated_at, name, groups_permissions, type, user_permission, created_by, id, nature, *args, **kwargs): # noqa: E501
160160
"""WriteFolder - a model defined in OpenAPI
161161
162162
Args:
163-
groups_permissions ([GroupFolderRead]): List of group permissions
164-
type (str): DEPRECATED: Use 'nature' instead. Value is \"Folder\". It is usefull to parse the tree and discriminate folders and files
165163
created_at (datetime): Creation date
166-
nature (str): Value is \"Folder\". It is usefull to parse the tree and discriminate folders and files
167-
created_by (bool, date, datetime, dict, float, int, list, str, none_type):
168164
updated_at (datetime): Date of the last update
169-
user_permission (int): Aggregate of group user permissions and folder default permission
170165
name (str): Name of the folder
166+
groups_permissions ([GroupFolderRead]): List of group permissions
167+
type (str): DEPRECATED: Use 'nature' instead. Value is \"Folder\". It is usefull to parse the tree and discriminate folders and files
168+
user_permission (int): Aggregate of group user permissions and folder default permission
169+
created_by (bool, date, datetime, dict, float, int, list, str, none_type):
171170
id (int):
171+
nature (str): Value is \"Folder\". It is usefull to parse the tree and discriminate folders and files
172172
173173
Keyword Args:
174174
_check_type (bool): if True, values for parameters in openapi_types
@@ -231,15 +231,15 @@ def _from_openapi_data(cls, groups_permissions, type, created_at, nature, create
231231
self._configuration = _configuration
232232
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
233233

234-
self.groups_permissions = groups_permissions
235-
self.type = type
236234
self.created_at = created_at
237-
self.nature = nature
238-
self.created_by = created_by
239235
self.updated_at = updated_at
240-
self.user_permission = user_permission
241236
self.name = name
237+
self.groups_permissions = groups_permissions
238+
self.type = type
239+
self.user_permission = user_permission
240+
self.created_by = created_by
242241
self.id = id
242+
self.nature = nature
243243
for var_name, var_value in kwargs.items():
244244
if var_name not in self.attribute_map and \
245245
self._configuration is not None and \

docs/CollaborationApi.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,7 +1872,7 @@ Name | Type | Description | Notes
18721872

18731873
Create a document
18741874

1875-
Create a document. If the document is one of {'DXF', 'DWG', 'IFC', 'GLTF', 'POINT_CLOUD', 'PHOTOSPHERE', 'OBJ'}, a model will be created and attached to this document Required scopes: document:write
1875+
Create a document. If the document is one of {'IFC', 'OBJ', 'PHOTOSPHERE', 'DWG', 'GLTF', 'DXF', 'POINT_CLOUD'}, a model will be created and attached to this document Required scopes: document:write
18761876

18771877
### Example
18781878

@@ -2407,6 +2407,9 @@ with bimdata_api_client.ApiClient(configuration) as api_client:
24072407
],
24082408
expires_at=dateutil_parser('1970-01-01T00:00:00.00Z'),
24092409
email_impersonation="email_impersonation_example",
2410+
available_models=[
2411+
1,
2412+
],
24102413
) # ProjectAccessTokenRequest |
24112414

24122415
# example passing only required values which don't have defaults set
@@ -11262,7 +11265,7 @@ with bimdata_api_client.ApiClient(configuration) as api_client:
1126211265
project_pk = 1 # int | A unique integer value identifying this project.
1126311266
patched_document_text_request = PatchedDocumentTextRequest(
1126411267
text="text_example",
11265-
language="spanish",
11268+
language="english",
1126611269
) # PatchedDocumentTextRequest | (optional)
1126711270

1126811271
# example passing only required values which don't have defaults set

docs/DocumentText.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
77
**id** | **int** | | [readonly]
88
**text** | **str, none_type** | The full text representation of a document if the feature is enabled and the file format supported | [optional]
9-
**language** | **str, none_type** | * &#x60;spanish&#x60; - spanish * &#x60;german&#x60; - german * &#x60;english&#x60; - english * &#x60;french&#x60; - french * &#x60;italian&#x60; - italian | [optional]
9+
**language** | **str, none_type** | * &#x60;english&#x60; - english * &#x60;german&#x60; - german * &#x60;spanish&#x60; - spanish * &#x60;italian&#x60; - italian * &#x60;french&#x60; - french | [optional]
1010
**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]
1111

1212
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

docs/PatchedDocumentTextRequest.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
77
**text** | **str, none_type** | The full text representation of a document if the feature is enabled and the file format supported | [optional]
8-
**language** | **str, none_type** | * &#x60;spanish&#x60; - spanish * &#x60;german&#x60; - german * &#x60;english&#x60; - english * &#x60;french&#x60; - french * &#x60;italian&#x60; - italian | [optional]
8+
**language** | **str, none_type** | * &#x60;english&#x60; - english * &#x60;german&#x60; - german * &#x60;spanish&#x60; - spanish * &#x60;italian&#x60; - italian * &#x60;french&#x60; - french | [optional]
99
**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]
1010

1111
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

0 commit comments

Comments
 (0)