Skip to content

Commit 4d52c51

Browse files
committed
MINOR: Add leave project route (#449)
* Add leave project route * fix roles
1 parent 8b5446a commit 4d52c51

6 files changed

Lines changed: 343 additions & 12 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ Class | Method | HTTP request | Description
246246
*CollaborationApi* | [**get_self_user**](docs/CollaborationApi.md#get_self_user) | **GET** /user | Get info about the current user
247247
*CollaborationApi* | [**invite_cloud_user**](docs/CollaborationApi.md#invite_cloud_user) | **POST** /cloud/{cloud_pk}/invitation | Invite a cloud administrator
248248
*CollaborationApi* | [**invite_project_user**](docs/CollaborationApi.md#invite_project_user) | **POST** /cloud/{cloud_pk}/project/{project_pk}/invitation | Invite a project member
249+
*CollaborationApi* | [**leave_project**](docs/CollaborationApi.md#leave_project) | **POST** /cloud/{cloud_pk}/project/{id}/leave | Leave the project
249250
*CollaborationApi* | [**update_classification**](docs/CollaborationApi.md#update_classification) | **PATCH** /cloud/{cloud_pk}/project/{project_pk}/classification/{id} | Update some fields of a classification
250251
*CollaborationApi* | [**update_cloud**](docs/CollaborationApi.md#update_cloud) | **PATCH** /cloud/{id} | Update some fields of a cloud
251252
*CollaborationApi* | [**update_cloud_user**](docs/CollaborationApi.md#update_cloud_user) | **PATCH** /cloud/{cloud_pk}/user/{id} | Update some fields of a cloud user

bimdata_api_client/api/collaboration_api.py

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8052,6 +8052,125 @@ def invite_project_user_with_http_info(self, cloud_pk, project_pk, data, **kwarg
80528052
_request_timeout=local_var_params.get('_request_timeout'),
80538053
collection_formats=collection_formats)
80548054

8055+
def leave_project(self, cloud_pk, id, **kwargs): # noqa: E501
8056+
"""Leave the project # noqa: E501
8057+
8058+
Leave the project. Only authenticated users (no app) can call this route. Required scopes: org:manage # noqa: E501
8059+
This method makes a synchronous HTTP request by default. To make an
8060+
asynchronous HTTP request, please pass async_req=True
8061+
>>> thread = api.leave_project(cloud_pk, id, async_req=True)
8062+
>>> result = thread.get()
8063+
8064+
:param async_req bool: execute request asynchronously
8065+
:param str cloud_pk: (required)
8066+
:param int id: A unique integer value identifying this project. (required)
8067+
:param _preload_content: if False, the urllib3.HTTPResponse object will
8068+
be returned without reading/decoding response
8069+
data. Default is True.
8070+
:param _request_timeout: timeout setting for this request. If one
8071+
number provided, it will be total request
8072+
timeout. It can also be a pair (tuple) of
8073+
(connection, read) timeouts.
8074+
:return: None
8075+
If the method is called asynchronously,
8076+
returns the request thread.
8077+
"""
8078+
kwargs['_return_http_data_only'] = True
8079+
return self.leave_project_with_http_info(cloud_pk, id, **kwargs) # noqa: E501
8080+
8081+
def leave_project_with_http_info(self, cloud_pk, id, **kwargs): # noqa: E501
8082+
"""Leave the project # noqa: E501
8083+
8084+
Leave the project. Only authenticated users (no app) can call this route. Required scopes: org:manage # noqa: E501
8085+
This method makes a synchronous HTTP request by default. To make an
8086+
asynchronous HTTP request, please pass async_req=True
8087+
>>> thread = api.leave_project_with_http_info(cloud_pk, id, async_req=True)
8088+
>>> result = thread.get()
8089+
8090+
:param async_req bool: execute request asynchronously
8091+
:param str cloud_pk: (required)
8092+
:param int id: A unique integer value identifying this project. (required)
8093+
:param _return_http_data_only: response data without head status code
8094+
and headers
8095+
:param _preload_content: if False, the urllib3.HTTPResponse object will
8096+
be returned without reading/decoding response
8097+
data. Default is True.
8098+
:param _request_timeout: timeout setting for this request. If one
8099+
number provided, it will be total request
8100+
timeout. It can also be a pair (tuple) of
8101+
(connection, read) timeouts.
8102+
:return: None
8103+
If the method is called asynchronously,
8104+
returns the request thread.
8105+
"""
8106+
8107+
local_var_params = locals()
8108+
8109+
all_params = [
8110+
'cloud_pk',
8111+
'id'
8112+
]
8113+
all_params.extend(
8114+
[
8115+
'async_req',
8116+
'_return_http_data_only',
8117+
'_preload_content',
8118+
'_request_timeout'
8119+
]
8120+
)
8121+
8122+
for key, val in six.iteritems(local_var_params['kwargs']):
8123+
if key not in all_params:
8124+
raise ApiTypeError(
8125+
"Got an unexpected keyword argument '%s'"
8126+
" to method leave_project" % key
8127+
)
8128+
local_var_params[key] = val
8129+
del local_var_params['kwargs']
8130+
# verify the required parameter 'cloud_pk' is set
8131+
if self.api_client.client_side_validation and ('cloud_pk' not in local_var_params or # noqa: E501
8132+
local_var_params['cloud_pk'] is None): # noqa: E501
8133+
raise ApiValueError("Missing the required parameter `cloud_pk` when calling `leave_project`") # noqa: E501
8134+
# verify the required parameter 'id' is set
8135+
if self.api_client.client_side_validation and ('id' not in local_var_params or # noqa: E501
8136+
local_var_params['id'] is None): # noqa: E501
8137+
raise ApiValueError("Missing the required parameter `id` when calling `leave_project`") # noqa: E501
8138+
8139+
collection_formats = {}
8140+
8141+
path_params = {}
8142+
if 'cloud_pk' in local_var_params:
8143+
path_params['cloud_pk'] = local_var_params['cloud_pk'] # noqa: E501
8144+
if 'id' in local_var_params:
8145+
path_params['id'] = local_var_params['id'] # noqa: E501
8146+
8147+
query_params = []
8148+
8149+
header_params = {}
8150+
8151+
form_params = []
8152+
local_var_files = {}
8153+
8154+
body_params = None
8155+
# Authentication setting
8156+
auth_settings = ['Bearer', 'bimdata_connect', 'client_credentials'] # noqa: E501
8157+
8158+
return self.api_client.call_api(
8159+
'/cloud/{cloud_pk}/project/{id}/leave', 'POST',
8160+
path_params,
8161+
query_params,
8162+
header_params,
8163+
body=body_params,
8164+
post_params=form_params,
8165+
files=local_var_files,
8166+
response_type=None, # noqa: E501
8167+
auth_settings=auth_settings,
8168+
async_req=local_var_params.get('async_req'),
8169+
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
8170+
_preload_content=local_var_params.get('_preload_content', True),
8171+
_request_timeout=local_var_params.get('_request_timeout'),
8172+
collection_formats=collection_formats)
8173+
80558174
def update_classification(self, cloud_pk, id, project_pk, data, **kwargs): # noqa: E501
80568175
"""Update some fields of a classification # noqa: E501
80578176

docs/BcfApi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6456,7 +6456,7 @@ void (empty response body)
64566456
### HTTP response details
64576457
| Status code | Description | Response headers |
64586458
|-------------|-------------|------------------|
6459-
**204** | | - |
6459+
**204** | No content | - |
64606460
**400** | A required field is missing in the body | - |
64616461
**401** | The authentication failed. Your token may be expired, missing or malformed | - |
64626462
**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. | - |

docs/CollaborationApi.md

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ Method | HTTP request | Description
6666
[**get_self_user**](CollaborationApi.md#get_self_user) | **GET** /user | Get info about the current user
6767
[**invite_cloud_user**](CollaborationApi.md#invite_cloud_user) | **POST** /cloud/{cloud_pk}/invitation | Invite a cloud administrator
6868
[**invite_project_user**](CollaborationApi.md#invite_project_user) | **POST** /cloud/{cloud_pk}/project/{project_pk}/invitation | Invite a project member
69+
[**leave_project**](CollaborationApi.md#leave_project) | **POST** /cloud/{cloud_pk}/project/{id}/leave | Leave the project
6970
[**update_classification**](CollaborationApi.md#update_classification) | **PATCH** /cloud/{cloud_pk}/project/{project_pk}/classification/{id} | Update some fields of a classification
7071
[**update_cloud**](CollaborationApi.md#update_cloud) | **PATCH** /cloud/{id} | Update some fields of a cloud
7172
[**update_cloud_user**](CollaborationApi.md#update_cloud_user) | **PATCH** /cloud/{cloud_pk}/user/{id} | Update some fields of a cloud user
@@ -12989,6 +12990,209 @@ Name | Type | Description | Notes
1298912990

1299012991
[[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)
1299112992

12993+
# **leave_project**
12994+
> leave_project(cloud_pk, id)
12995+
12996+
Leave the project
12997+
12998+
Leave the project. Only authenticated users (no app) can call this route. Required scopes: org:manage
12999+
13000+
### Example
13001+
13002+
* Api Key Authentication (Bearer):
13003+
```python
13004+
from __future__ import print_function
13005+
import time
13006+
import bimdata_api_client
13007+
from bimdata_api_client.rest import ApiException
13008+
from pprint import pprint
13009+
# Defining the host is optional and defaults to https://api.bimdata.io
13010+
# See configuration.py for a list of all supported configuration parameters.
13011+
configuration = bimdata_api_client.Configuration(
13012+
host = "https://api.bimdata.io"
13013+
)
13014+
13015+
# The client must configure the authentication and authorization parameters
13016+
# in accordance with the API server security policy.
13017+
# Examples for each auth method are provided below, use the example that
13018+
# satisfies your auth use case.
13019+
13020+
# Configure API key authorization: Bearer
13021+
configuration = bimdata_api_client.Configuration(
13022+
host = "https://api.bimdata.io",
13023+
api_key = {
13024+
'Authorization': 'YOUR_API_KEY'
13025+
}
13026+
)
13027+
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
13028+
# configuration.api_key_prefix['Authorization'] = 'Bearer'
13029+
13030+
# Configure OAuth2 access token for authorization: bimdata_connect
13031+
configuration = bimdata_api_client.Configuration(
13032+
host = "https://api.bimdata.io"
13033+
)
13034+
configuration.access_token = 'YOUR_ACCESS_TOKEN'
13035+
13036+
# Configure OAuth2 access token for authorization: client_credentials
13037+
configuration = bimdata_api_client.Configuration(
13038+
host = "https://api.bimdata.io"
13039+
)
13040+
configuration.access_token = 'YOUR_ACCESS_TOKEN'
13041+
13042+
# Enter a context with an instance of the API client
13043+
with bimdata_api_client.ApiClient(configuration) as api_client:
13044+
# Create an instance of the API class
13045+
api_instance = bimdata_api_client.CollaborationApi(api_client)
13046+
cloud_pk = 'cloud_pk_example' # str |
13047+
id = 56 # int | A unique integer value identifying this project.
13048+
13049+
try:
13050+
# Leave the project
13051+
api_instance.leave_project(cloud_pk, id)
13052+
except ApiException as e:
13053+
print("Exception when calling CollaborationApi->leave_project: %s\n" % e)
13054+
```
13055+
13056+
* OAuth Authentication (bimdata_connect):
13057+
```python
13058+
from __future__ import print_function
13059+
import time
13060+
import bimdata_api_client
13061+
from bimdata_api_client.rest import ApiException
13062+
from pprint import pprint
13063+
# Defining the host is optional and defaults to https://api.bimdata.io
13064+
# See configuration.py for a list of all supported configuration parameters.
13065+
configuration = bimdata_api_client.Configuration(
13066+
host = "https://api.bimdata.io"
13067+
)
13068+
13069+
# The client must configure the authentication and authorization parameters
13070+
# in accordance with the API server security policy.
13071+
# Examples for each auth method are provided below, use the example that
13072+
# satisfies your auth use case.
13073+
13074+
# Configure API key authorization: Bearer
13075+
configuration = bimdata_api_client.Configuration(
13076+
host = "https://api.bimdata.io",
13077+
api_key = {
13078+
'Authorization': 'YOUR_API_KEY'
13079+
}
13080+
)
13081+
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
13082+
# configuration.api_key_prefix['Authorization'] = 'Bearer'
13083+
13084+
# Configure OAuth2 access token for authorization: bimdata_connect
13085+
configuration = bimdata_api_client.Configuration(
13086+
host = "https://api.bimdata.io"
13087+
)
13088+
configuration.access_token = 'YOUR_ACCESS_TOKEN'
13089+
13090+
# Configure OAuth2 access token for authorization: client_credentials
13091+
configuration = bimdata_api_client.Configuration(
13092+
host = "https://api.bimdata.io"
13093+
)
13094+
configuration.access_token = 'YOUR_ACCESS_TOKEN'
13095+
13096+
# Enter a context with an instance of the API client
13097+
with bimdata_api_client.ApiClient(configuration) as api_client:
13098+
# Create an instance of the API class
13099+
api_instance = bimdata_api_client.CollaborationApi(api_client)
13100+
cloud_pk = 'cloud_pk_example' # str |
13101+
id = 56 # int | A unique integer value identifying this project.
13102+
13103+
try:
13104+
# Leave the project
13105+
api_instance.leave_project(cloud_pk, id)
13106+
except ApiException as e:
13107+
print("Exception when calling CollaborationApi->leave_project: %s\n" % e)
13108+
```
13109+
13110+
* OAuth Authentication (client_credentials):
13111+
```python
13112+
from __future__ import print_function
13113+
import time
13114+
import bimdata_api_client
13115+
from bimdata_api_client.rest import ApiException
13116+
from pprint import pprint
13117+
# Defining the host is optional and defaults to https://api.bimdata.io
13118+
# See configuration.py for a list of all supported configuration parameters.
13119+
configuration = bimdata_api_client.Configuration(
13120+
host = "https://api.bimdata.io"
13121+
)
13122+
13123+
# The client must configure the authentication and authorization parameters
13124+
# in accordance with the API server security policy.
13125+
# Examples for each auth method are provided below, use the example that
13126+
# satisfies your auth use case.
13127+
13128+
# Configure API key authorization: Bearer
13129+
configuration = bimdata_api_client.Configuration(
13130+
host = "https://api.bimdata.io",
13131+
api_key = {
13132+
'Authorization': 'YOUR_API_KEY'
13133+
}
13134+
)
13135+
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
13136+
# configuration.api_key_prefix['Authorization'] = 'Bearer'
13137+
13138+
# Configure OAuth2 access token for authorization: bimdata_connect
13139+
configuration = bimdata_api_client.Configuration(
13140+
host = "https://api.bimdata.io"
13141+
)
13142+
configuration.access_token = 'YOUR_ACCESS_TOKEN'
13143+
13144+
# Configure OAuth2 access token for authorization: client_credentials
13145+
configuration = bimdata_api_client.Configuration(
13146+
host = "https://api.bimdata.io"
13147+
)
13148+
configuration.access_token = 'YOUR_ACCESS_TOKEN'
13149+
13150+
# Enter a context with an instance of the API client
13151+
with bimdata_api_client.ApiClient(configuration) as api_client:
13152+
# Create an instance of the API class
13153+
api_instance = bimdata_api_client.CollaborationApi(api_client)
13154+
cloud_pk = 'cloud_pk_example' # str |
13155+
id = 56 # int | A unique integer value identifying this project.
13156+
13157+
try:
13158+
# Leave the project
13159+
api_instance.leave_project(cloud_pk, id)
13160+
except ApiException as e:
13161+
print("Exception when calling CollaborationApi->leave_project: %s\n" % e)
13162+
```
13163+
13164+
### Parameters
13165+
13166+
Name | Type | Description | Notes
13167+
------------- | ------------- | ------------- | -------------
13168+
**cloud_pk** | **str**| |
13169+
**id** | **int**| A unique integer value identifying this project. |
13170+
13171+
### Return type
13172+
13173+
void (empty response body)
13174+
13175+
### Authorization
13176+
13177+
[Bearer](../README.md#Bearer), [bimdata_connect](../README.md#bimdata_connect), [client_credentials](../README.md#client_credentials)
13178+
13179+
### HTTP request headers
13180+
13181+
- **Content-Type**: Not defined
13182+
- **Accept**: Not defined
13183+
13184+
### HTTP response details
13185+
| Status code | Description | Response headers |
13186+
|-------------|-------------|------------------|
13187+
**204** | No content | - |
13188+
**400** | A required field is missing in the body | - |
13189+
**401** | The authentication failed. Your token may be expired, missing or malformed | - |
13190+
**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. | - |
13191+
**404** | The resource does not exist or you don't have the right to see if the resource exists | - |
13192+
**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. | - |
13193+
13194+
[[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)
13195+
1299213196
# **update_classification**
1299313197
> Classification update_classification(cloud_pk, id, project_pk, data)
1299413198

0 commit comments

Comments
 (0)