Skip to content

Commit 9aa819b

Browse files
committed
PATCH: delete all document version on delete (#525)
* delete all document version on delete * versioning: add delete history route
1 parent c7a0657 commit 9aa819b

4 files changed

Lines changed: 265 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ Class | Method | HTTP request | Description
258258
*CollaborationApi* | [**create_validation**](docs/CollaborationApi.md#create_validation) | **POST** /cloud/{cloud_pk}/project/{project_pk}/document/{document_pk}/visa/{visa_pk}/validation | Add a validation to a visa
259259
*CollaborationApi* | [**create_visa**](docs/CollaborationApi.md#create_visa) | **POST** /cloud/{cloud_pk}/project/{project_pk}/document/{document_pk}/visa | Create a visa
260260
*CollaborationApi* | [**create_visa_comment**](docs/CollaborationApi.md#create_visa_comment) | **POST** /cloud/{cloud_pk}/project/{project_pk}/document/{document_pk}/visa/{visa_pk}/comment | Add a comment
261+
*CollaborationApi* | [**delete_all_history**](docs/CollaborationApi.md#delete_all_history) | **DELETE** /cloud/{cloud_pk}/project/{project_pk}/document/{document_pk}/history/delete | Delete all document history
261262
*CollaborationApi* | [**delete_classification**](docs/CollaborationApi.md#delete_classification) | **DELETE** /cloud/{cloud_pk}/project/{project_pk}/classification/{id} | Delete a classification
262263
*CollaborationApi* | [**delete_cloud**](docs/CollaborationApi.md#delete_cloud) | **DELETE** /cloud/{id} | Delete a cloud
263264
*CollaborationApi* | [**delete_cloud_user**](docs/CollaborationApi.md#delete_cloud_user) | **DELETE** /cloud/{cloud_pk}/user/{id} | Remove a user from a cloud

bimdata_api_client/api/collaboration_api.py

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,6 +1524,70 @@ def __init__(self, api_client=None):
15241524
},
15251525
api_client=api_client
15261526
)
1527+
self.delete_all_history_endpoint = _Endpoint(
1528+
settings={
1529+
'response_type': None,
1530+
'auth': [
1531+
'ApiKey',
1532+
'BIMData_Connect',
1533+
'BIMData_Connect',
1534+
'Bearer'
1535+
],
1536+
'endpoint_path': '/cloud/{cloud_pk}/project/{project_pk}/document/{document_pk}/history/delete',
1537+
'operation_id': 'delete_all_history',
1538+
'http_method': 'DELETE',
1539+
'servers': None,
1540+
},
1541+
params_map={
1542+
'all': [
1543+
'cloud_pk',
1544+
'document_pk',
1545+
'project_pk',
1546+
],
1547+
'required': [
1548+
'cloud_pk',
1549+
'document_pk',
1550+
'project_pk',
1551+
],
1552+
'nullable': [
1553+
],
1554+
'enum': [
1555+
],
1556+
'validation': [
1557+
]
1558+
},
1559+
root_map={
1560+
'validations': {
1561+
},
1562+
'allowed_values': {
1563+
},
1564+
'openapi_types': {
1565+
'cloud_pk':
1566+
(int,),
1567+
'document_pk':
1568+
(int,),
1569+
'project_pk':
1570+
(int,),
1571+
},
1572+
'attribute_map': {
1573+
'cloud_pk': 'cloud_pk',
1574+
'document_pk': 'document_pk',
1575+
'project_pk': 'project_pk',
1576+
},
1577+
'location_map': {
1578+
'cloud_pk': 'path',
1579+
'document_pk': 'path',
1580+
'project_pk': 'path',
1581+
},
1582+
'collection_format_map': {
1583+
}
1584+
},
1585+
headers_map={
1586+
'accept': [],
1587+
'content_type': [],
1588+
},
1589+
api_client=api_client
1590+
)
15271591
self.delete_classification_endpoint = _Endpoint(
15281592
settings={
15291593
'response_type': None,
@@ -8549,6 +8613,92 @@ def create_visa_comment(
85498613
visa_pk
85508614
return self.create_visa_comment_endpoint.call_with_http_info(**kwargs)
85518615

8616+
def delete_all_history(
8617+
self,
8618+
cloud_pk,
8619+
document_pk,
8620+
project_pk,
8621+
**kwargs
8622+
):
8623+
"""Delete all document history # noqa: E501
8624+
8625+
Delete all document history Required scopes: document:write # noqa: E501
8626+
This method makes a synchronous HTTP request by default. To make an
8627+
asynchronous HTTP request, please pass async_req=True
8628+
8629+
>>> thread = api.delete_all_history(cloud_pk, document_pk, project_pk, async_req=True)
8630+
>>> result = thread.get()
8631+
8632+
Args:
8633+
cloud_pk (int): A unique integer value identifying this cloud.
8634+
document_pk (int): A unique integer value identifying this document.
8635+
project_pk (int): A unique integer value identifying this project.
8636+
8637+
Keyword Args:
8638+
_return_http_data_only (bool): response data without head status
8639+
code and headers. Default is True.
8640+
_preload_content (bool): if False, the urllib3.HTTPResponse object
8641+
will be returned without reading/decoding response data.
8642+
Default is True.
8643+
_request_timeout (int/float/tuple): timeout setting for this request. If
8644+
one number provided, it will be total request timeout. It can also
8645+
be a pair (tuple) of (connection, read) timeouts.
8646+
Default is None.
8647+
_check_input_type (bool): specifies if type checking
8648+
should be done one the data sent to the server.
8649+
Default is True.
8650+
_check_return_type (bool): specifies if type checking
8651+
should be done one the data received from the server.
8652+
Default is True.
8653+
_spec_property_naming (bool): True if the variable names in the input data
8654+
are serialized names, as specified in the OpenAPI document.
8655+
False if the variable names in the input data
8656+
are pythonic names, e.g. snake case (default)
8657+
_content_type (str/None): force body content-type.
8658+
Default is None and content-type will be predicted by allowed
8659+
content-types and body.
8660+
_host_index (int/None): specifies the index of the server
8661+
that we want to use.
8662+
Default is read from the configuration.
8663+
async_req (bool): execute request asynchronously
8664+
8665+
Returns:
8666+
None
8667+
If the method is called asynchronously, returns the request
8668+
thread.
8669+
"""
8670+
kwargs['async_req'] = kwargs.get(
8671+
'async_req', False
8672+
)
8673+
kwargs['_return_http_data_only'] = kwargs.get(
8674+
'_return_http_data_only', True
8675+
)
8676+
kwargs['_preload_content'] = kwargs.get(
8677+
'_preload_content', True
8678+
)
8679+
kwargs['_request_timeout'] = kwargs.get(
8680+
'_request_timeout', None
8681+
)
8682+
kwargs['_check_input_type'] = kwargs.get(
8683+
'_check_input_type', True
8684+
)
8685+
kwargs['_check_return_type'] = kwargs.get(
8686+
'_check_return_type', True
8687+
)
8688+
kwargs['_spec_property_naming'] = kwargs.get(
8689+
'_spec_property_naming', False
8690+
)
8691+
kwargs['_content_type'] = kwargs.get(
8692+
'_content_type')
8693+
kwargs['_host_index'] = kwargs.get('_host_index')
8694+
kwargs['cloud_pk'] = \
8695+
cloud_pk
8696+
kwargs['document_pk'] = \
8697+
document_pk
8698+
kwargs['project_pk'] = \
8699+
project_pk
8700+
return self.delete_all_history_endpoint.call_with_http_info(**kwargs)
8701+
85528702
def delete_classification(
85538703
self,
85548704
cloud_pk,

docs/CollaborationApi.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Method | HTTP request | Description
2424
[**create_validation**](CollaborationApi.md#create_validation) | **POST** /cloud/{cloud_pk}/project/{project_pk}/document/{document_pk}/visa/{visa_pk}/validation | Add a validation to a visa
2525
[**create_visa**](CollaborationApi.md#create_visa) | **POST** /cloud/{cloud_pk}/project/{project_pk}/document/{document_pk}/visa | Create a visa
2626
[**create_visa_comment**](CollaborationApi.md#create_visa_comment) | **POST** /cloud/{cloud_pk}/project/{project_pk}/document/{document_pk}/visa/{visa_pk}/comment | Add a comment
27+
[**delete_all_history**](CollaborationApi.md#delete_all_history) | **DELETE** /cloud/{cloud_pk}/project/{project_pk}/document/{document_pk}/history/delete | Delete all document history
2728
[**delete_classification**](CollaborationApi.md#delete_classification) | **DELETE** /cloud/{cloud_pk}/project/{project_pk}/classification/{id} | Delete a classification
2829
[**delete_cloud**](CollaborationApi.md#delete_cloud) | **DELETE** /cloud/{id} | Delete a cloud
2930
[**delete_cloud_user**](CollaborationApi.md#delete_cloud_user) | **DELETE** /cloud/{cloud_pk}/user/{id} | Remove a user from a cloud
@@ -2361,6 +2362,112 @@ Name | Type | Description | Notes
23612362

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

2365+
# **delete_all_history**
2366+
> delete_all_history(cloud_pk, document_pk, project_pk)
2367+
2368+
Delete all document history
2369+
2370+
Delete all document history Required scopes: document:write
2371+
2372+
### Example
2373+
2374+
* Api Key Authentication (ApiKey):
2375+
* OAuth Authentication (BIMData_Connect):
2376+
* OAuth Authentication (BIMData_Connect):
2377+
* Api Key Authentication (Bearer):
2378+
2379+
```python
2380+
import time
2381+
import bimdata_api_client
2382+
from bimdata_api_client.api import collaboration_api
2383+
from pprint import pprint
2384+
# Defining the host is optional and defaults to http://localhost
2385+
# See configuration.py for a list of all supported configuration parameters.
2386+
configuration = bimdata_api_client.Configuration(
2387+
host = "http://localhost"
2388+
)
2389+
2390+
# The client must configure the authentication and authorization parameters
2391+
# in accordance with the API server security policy.
2392+
# Examples for each auth method are provided below, use the example that
2393+
# satisfies your auth use case.
2394+
2395+
# Configure API key authorization: ApiKey
2396+
configuration.api_key['ApiKey'] = 'YOUR_API_KEY'
2397+
2398+
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
2399+
# configuration.api_key_prefix['ApiKey'] = 'Bearer'
2400+
2401+
# Configure OAuth2 access token for authorization: BIMData_Connect
2402+
configuration = bimdata_api_client.Configuration(
2403+
host = "http://localhost"
2404+
)
2405+
configuration.access_token = 'YOUR_ACCESS_TOKEN'
2406+
2407+
# Configure OAuth2 access token for authorization: BIMData_Connect
2408+
configuration = bimdata_api_client.Configuration(
2409+
host = "http://localhost"
2410+
)
2411+
configuration.access_token = 'YOUR_ACCESS_TOKEN'
2412+
2413+
# Configure API key authorization: Bearer
2414+
configuration.api_key['Bearer'] = 'YOUR_API_KEY'
2415+
2416+
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
2417+
# configuration.api_key_prefix['Bearer'] = 'Bearer'
2418+
2419+
# Enter a context with an instance of the API client
2420+
with bimdata_api_client.ApiClient(configuration) as api_client:
2421+
# Create an instance of the API class
2422+
api_instance = collaboration_api.CollaborationApi(api_client)
2423+
cloud_pk = 1 # int | A unique integer value identifying this cloud.
2424+
document_pk = 1 # int | A unique integer value identifying this document.
2425+
project_pk = 1 # int | A unique integer value identifying this project.
2426+
2427+
# example passing only required values which don't have defaults set
2428+
try:
2429+
# Delete all document history
2430+
api_instance.delete_all_history(cloud_pk, document_pk, project_pk)
2431+
except bimdata_api_client.ApiException as e:
2432+
print("Exception when calling CollaborationApi->delete_all_history: %s\n" % e)
2433+
```
2434+
2435+
2436+
### Parameters
2437+
2438+
Name | Type | Description | Notes
2439+
------------- | ------------- | ------------- | -------------
2440+
**cloud_pk** | **int**| A unique integer value identifying this cloud. |
2441+
**document_pk** | **int**| A unique integer value identifying this document. |
2442+
**project_pk** | **int**| A unique integer value identifying this project. |
2443+
2444+
### Return type
2445+
2446+
void (empty response body)
2447+
2448+
### Authorization
2449+
2450+
[ApiKey](../README.md#ApiKey), [BIMData_Connect](../README.md#BIMData_Connect), [BIMData_Connect](../README.md#BIMData_Connect), [Bearer](../README.md#Bearer)
2451+
2452+
### HTTP request headers
2453+
2454+
- **Content-Type**: Not defined
2455+
- **Accept**: Not defined
2456+
2457+
2458+
### HTTP response details
2459+
2460+
| Status code | Description | Response headers |
2461+
|-------------|-------------|------------------|
2462+
**204** | No response body | - |
2463+
**400** | A required field is missing in the body | - |
2464+
**401** | The authentication failed. Your token may be expired, missing or malformed | - |
2465+
**403** | You don't have the authorization to access this resource. Check if the resource is exclusive to users or app (eg: /user is exclusive to users) or if your user has the right to access this resource. | - |
2466+
**404** | The resource does not exist or you don't have the right to see if the resource exists | - |
2467+
**500** | Something really bad happened. Check if your route is correct. By example: /cloud/[object Object]/project may raise a 500. An alert is automatically sent to us, we'll look at it shortly. | - |
2468+
2469+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
2470+
23642471
# **delete_classification**
23652472
> delete_classification(cloud_pk, id, project_pk)
23662473

test/test_collaboration_api.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ def test_create_visa_comment(self):
164164
"""
165165
pass
166166

167+
def test_delete_all_history(self):
168+
"""Test case for delete_all_history
169+
170+
Delete all document history # noqa: E501
171+
"""
172+
pass
173+
167174
def test_delete_classification(self):
168175
"""Test case for delete_classification
169176

0 commit comments

Comments
 (0)