diff --git a/.gitignore b/.gitignore index a655050..43995bd 100644 --- a/.gitignore +++ b/.gitignore @@ -45,7 +45,9 @@ coverage.xml *,cover .hypothesis/ venv/ +.venv/ .python-version +.pytest_cache # Translations *.mo diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index 8c7fafd..ec87108 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -4.1.3 \ No newline at end of file +4.2.3 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 86211e2..388de83 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,9 @@ python: - "3.3" - "3.4" - "3.5" - #- "3.5-dev" # 3.5 development branch - #- "nightly" # points to the latest development branch e.g. 3.6-dev + - "3.6" + - "3.7" + - "3.8" # command to install dependencies install: "pip install -r requirements.txt" # command to run tests diff --git a/README.md b/README.md index 975c852..9e25aef 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ REST/HTTP binding (PSM) for the SysML v2 standard API. This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: 1.0.0 -- Package version: 2019-09 +- Package version: 2020-03-rc2 - Build package: org.openapitools.codegen.languages.PythonClientCodegen ## Requirements. @@ -23,7 +23,7 @@ pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git Then import the package: ```python -import sysml_v2_api_client +import sysml_v2_api_client ``` ### Setuptools @@ -54,17 +54,20 @@ from pprint import pprint # Defining host is optional and default to http://localhost configuration.host = "http://localhost" -# Create an instance of the API class -api_instance = sysml_v2_api_client.ElementApi(sysml_v2_api_client.ApiClient(configuration)) -body = None # dict(str, object) | - -try: - # Add a new element - api_response = api_instance.create_element(body) - pprint(api_response) -except ApiException as e: - print("Exception when calling ElementApi->create_element: %s\n" % e) - +# Enter a context with an instance of the API client +with sysml_v2_api_client.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = sysml_v2_api_client.CommitApi(api_client) + project_id = 'project_id_example' # str | ID of the project +commit_id = 'commit_id_example' # str | ID of the commit + + try: + # Get commit by project and ID + api_response = api_instance.get_commit_by_project_and_id(project_id, commit_id) + pprint(api_response) + except ApiException as e: + print("Exception when calling CommitApi->get_commit_by_project_and_id: %s\n" % e) + ``` ## Documentation for API Endpoints @@ -73,28 +76,29 @@ All URIs are relative to *http://localhost* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*ElementApi* | [**create_element**](docs/ElementApi.md#create_element) | **POST** /elements | Add a new element -*ElementApi* | [**get_element**](docs/ElementApi.md#get_element) | **GET** /elements/{identifier} | Get element by its ID -*ElementApi* | [**get_element_by_project_and_id**](docs/ElementApi.md#get_element_by_project_and_id) | **GET** /projects/{project_identifier}/elements/{element_identifier} | Get element by project ID and its ID -*ElementApi* | [**get_elements**](docs/ElementApi.md#get_elements) | **GET** /elements | Get all elements -*ElementApi* | [**get_elements_in_project**](docs/ElementApi.md#get_elements_in_project) | **GET** /projects/{project_identifier}/elements | Get all elements in the project -*ProjectApi* | [**create_project**](docs/ProjectApi.md#create_project) | **POST** /projects | Add a new project -*ProjectApi* | [**get_project**](docs/ProjectApi.md#get_project) | **GET** /projects/{identifier} | Get project by its ID -*ProjectApi* | [**get_projects**](docs/ProjectApi.md#get_projects) | **GET** /projects | Get all projects -*RelationshipApi* | [**create_relationship**](docs/RelationshipApi.md#create_relationship) | **POST** /relationships | Add a new relationship -*RelationshipApi* | [**get_relationship**](docs/RelationshipApi.md#get_relationship) | **GET** /relationships/{identifier} | Get relationship by its ID -*RelationshipApi* | [**get_relationships**](docs/RelationshipApi.md#get_relationships) | **GET** /relationships | Get all relationships -*RelationshipApi* | [**get_relationships_by_project**](docs/RelationshipApi.md#get_relationships_by_project) | **GET** /projects/{project_identifier}/relationships | Get all relationships in the project +*CommitApi* | [**get_commit_by_project_and_id**](docs/CommitApi.md#get_commit_by_project_and_id) | **GET** /projects/{projectId}/commits/{commitId} | Get commit by project and ID +*CommitApi* | [**get_commits_by_project**](docs/CommitApi.md#get_commits_by_project) | **GET** /projects/{projectId}/commits | Get commits by project +*CommitApi* | [**get_head_commit_by_project**](docs/CommitApi.md#get_head_commit_by_project) | **GET** /projects/{projectId}/head | Get head commit by project +*CommitApi* | [**post_commit_by_project**](docs/CommitApi.md#post_commit_by_project) | **POST** /projects/{projectId}/commits | Create commit by project +*ElementApi* | [**get_element_by_project_commit_id**](docs/ElementApi.md#get_element_by_project_commit_id) | **GET** /projects/{projectId}/commits/{commitId}/elements/{elementId} | Get element by project, commit and ID +*ElementApi* | [**get_elements_by_project_commit**](docs/ElementApi.md#get_elements_by_project_commit) | **GET** /projects/{projectId}/commits/{commitId}/elements | Get elements by project and commit +*ProjectApi* | [**get_project_by_id**](docs/ProjectApi.md#get_project_by_id) | **GET** /projects/{projectId} | Get project by ID +*ProjectApi* | [**get_projects**](docs/ProjectApi.md#get_projects) | **GET** /projects | Get projects +*ProjectApi* | [**post_project**](docs/ProjectApi.md#post_project) | **POST** /projects | Create project +*RelationshipApi* | [**get_relationships_by_project_commit_related_element**](docs/RelationshipApi.md#get_relationships_by_project_commit_related_element) | **GET** /projects/{projectId}/commits/{commitId}/elements/{relatedElementId}/relationships | Get relationships by project, commit, and related element. ## Documentation For Models + - [Commit](docs/Commit.md) - [Element](docs/Element.md) + - [ElementIdentity](docs/ElementIdentity.md) + - [ElementVersion](docs/ElementVersion.md) - [Error](docs/Error.md) - [Identified](docs/Identified.md) - [Project](docs/Project.md) + - [Record](docs/Record.md) - [Relationship](docs/Relationship.md) - - [RelationshipAllOf](docs/RelationshipAllOf.md) ## Documentation For Authorization diff --git a/docs/Commit.md b/docs/Commit.md new file mode 100644 index 0000000..8f5efcb --- /dev/null +++ b/docs/Commit.md @@ -0,0 +1,13 @@ +# Commit + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | | [optional] +**changes** | [**list[ElementVersion]**](ElementVersion.md) | | [optional] +**id** | **str** | | [optional] +**previous_commit** | [**Record**](Record.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CommitApi.md b/docs/CommitApi.md new file mode 100644 index 0000000..92a4d6f --- /dev/null +++ b/docs/CommitApi.md @@ -0,0 +1,247 @@ +# sysml_v2_api_client.CommitApi + +All URIs are relative to *http://localhost* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**get_commit_by_project_and_id**](CommitApi.md#get_commit_by_project_and_id) | **GET** /projects/{projectId}/commits/{commitId} | Get commit by project and ID +[**get_commits_by_project**](CommitApi.md#get_commits_by_project) | **GET** /projects/{projectId}/commits | Get commits by project +[**get_head_commit_by_project**](CommitApi.md#get_head_commit_by_project) | **GET** /projects/{projectId}/head | Get head commit by project +[**post_commit_by_project**](CommitApi.md#post_commit_by_project) | **POST** /projects/{projectId}/commits | Create commit by project + + +# **get_commit_by_project_and_id** +> Commit get_commit_by_project_and_id(project_id, commit_id) + +Get commit by project and ID + +### Example + +```python +from __future__ import print_function +import time +import sysml_v2_api_client +from sysml_v2_api_client.rest import ApiException +from pprint import pprint + +# Enter a context with an instance of the API client +with sysml_v2_api_client.ApiClient() as api_client: + # Create an instance of the API class + api_instance = sysml_v2_api_client.CommitApi(api_client) + project_id = 'project_id_example' # str | ID of the project +commit_id = 'commit_id_example' # str | ID of the commit + + try: + # Get commit by project and ID + api_response = api_instance.get_commit_by_project_and_id(project_id, commit_id) + pprint(api_response) + except ApiException as e: + print("Exception when calling CommitApi->get_commit_by_project_and_id: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **str**| ID of the project | + **commit_id** | **str**| ID of the commit | + +### Return type + +[**Commit**](Commit.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Ok | - | +**404** | Not found. | - | +**415** | The requested content type is not acceptable. | - | +**500** | Internal server error. | - | +**0** | Unexpected response. | - | + +[[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) + +# **get_commits_by_project** +> Commit get_commits_by_project(project_id) + +Get commits by project + +### Example + +```python +from __future__ import print_function +import time +import sysml_v2_api_client +from sysml_v2_api_client.rest import ApiException +from pprint import pprint + +# Enter a context with an instance of the API client +with sysml_v2_api_client.ApiClient() as api_client: + # Create an instance of the API class + api_instance = sysml_v2_api_client.CommitApi(api_client) + project_id = 'project_id_example' # str | ID of the project + + try: + # Get commits by project + api_response = api_instance.get_commits_by_project(project_id) + pprint(api_response) + except ApiException as e: + print("Exception when calling CommitApi->get_commits_by_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | [**str**](.md)| ID of the project | + +### Return type + +[**Commit**](Commit.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Ok | - | +**404** | Not found. | - | +**415** | The requested content type is not acceptable. | - | +**500** | Internal server error. | - | +**0** | Unexpected response. | - | + +[[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) + +# **get_head_commit_by_project** +> Commit get_head_commit_by_project(project_id) + +Get head commit by project + +### Example + +```python +from __future__ import print_function +import time +import sysml_v2_api_client +from sysml_v2_api_client.rest import ApiException +from pprint import pprint + +# Enter a context with an instance of the API client +with sysml_v2_api_client.ApiClient() as api_client: + # Create an instance of the API class + api_instance = sysml_v2_api_client.CommitApi(api_client) + project_id = 'project_id_example' # str | ID of the project + + try: + # Get head commit by project + api_response = api_instance.get_head_commit_by_project(project_id) + pprint(api_response) + except ApiException as e: + print("Exception when calling CommitApi->get_head_commit_by_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | **str**| ID of the project | + +### Return type + +[**Commit**](Commit.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Ok | - | +**404** | Not found. | - | +**415** | The requested content type is not acceptable. | - | +**500** | Internal server error. | - | +**0** | Unexpected response. | - | + +[[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) + +# **post_commit_by_project** +> Commit post_commit_by_project(project_id, body) + +Create commit by project + +### Example + +```python +from __future__ import print_function +import time +import sysml_v2_api_client +from sysml_v2_api_client.rest import ApiException +from pprint import pprint + +# Enter a context with an instance of the API client +with sysml_v2_api_client.ApiClient() as api_client: + # Create an instance of the API class + api_instance = sysml_v2_api_client.CommitApi(api_client) + project_id = 'project_id_example' # str | ID of the project +body = sysml_v2_api_client.Commit() # Commit | + + try: + # Create commit by project + api_response = api_instance.post_commit_by_project(project_id, body) + pprint(api_response) + except ApiException as e: + print("Exception when calling CommitApi->post_commit_by_project: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **project_id** | [**str**](.md)| ID of the project | + **body** | [**Commit**](Commit.md)| | + +### Return type + +[**Commit**](Commit.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**201** | Created | - | +**415** | The requested content type is not acceptable. | - | +**500** | Internal server error. | - | +**0** | Unexpected response. | - | + +[[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) + diff --git a/docs/Element.md b/docs/Element.md index 58569d8..e765451 100644 --- a/docs/Element.md +++ b/docs/Element.md @@ -4,7 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **type** | **str** | | [optional] -**containing_project** | [**Identified**](Identified.md) | | [optional] **identifier** | **str** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/ElementApi.md b/docs/ElementApi.md index 4996d53..17e2c85 100644 --- a/docs/ElementApi.md +++ b/docs/ElementApi.md @@ -4,17 +4,14 @@ All URIs are relative to *http://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- -[**create_element**](ElementApi.md#create_element) | **POST** /elements | Add a new element -[**get_element**](ElementApi.md#get_element) | **GET** /elements/{identifier} | Get element by its ID -[**get_element_by_project_and_id**](ElementApi.md#get_element_by_project_and_id) | **GET** /projects/{project_identifier}/elements/{element_identifier} | Get element by project ID and its ID -[**get_elements**](ElementApi.md#get_elements) | **GET** /elements | Get all elements -[**get_elements_in_project**](ElementApi.md#get_elements_in_project) | **GET** /projects/{project_identifier}/elements | Get all elements in the project +[**get_element_by_project_commit_id**](ElementApi.md#get_element_by_project_commit_id) | **GET** /projects/{projectId}/commits/{commitId}/elements/{elementId} | Get element by project, commit and ID +[**get_elements_by_project_commit**](ElementApi.md#get_elements_by_project_commit) | **GET** /projects/{projectId}/commits/{commitId}/elements | Get elements by project and commit -# **create_element** -> Element create_element(body) +# **get_element_by_project_commit_id** +> Element get_element_by_project_commit_id(project_id, commit_id, element_id) -Add a new element +Get element by project, commit and ID ### Example @@ -25,136 +22,29 @@ import sysml_v2_api_client from sysml_v2_api_client.rest import ApiException from pprint import pprint -# Create an instance of the API class -api_instance = sysml_v2_api_client.ElementApi() -body = None # dict(str, object) | - -try: - # Add a new element - api_response = api_instance.create_element(body) - pprint(api_response) -except ApiException as e: - print("Exception when calling ElementApi->create_element: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**dict(str, object)**](object.md)| | - -### Return type - -[**Element**](Element.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**201** | Created | - | -**415** | The requested content type is not acceptable. | - | -**500** | Internal server error. | - | -**0** | Unexpected response. | - | - -[[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) - -# **get_element** -> Element get_element(identifier) - -Get element by its ID - -### Example - -```python -from __future__ import print_function -import time -import sysml_v2_api_client -from sysml_v2_api_client.rest import ApiException -from pprint import pprint - -# Create an instance of the API class -api_instance = sysml_v2_api_client.ElementApi() -identifier = 'identifier_example' # str | ID of the element - -try: - # Get element by its ID - api_response = api_instance.get_element(identifier) - pprint(api_response) -except ApiException as e: - print("Exception when calling ElementApi->get_element: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **identifier** | **str**| ID of the element | - -### Return type - -[**Element**](Element.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Ok | - | -**404** | Not found. | - | -**415** | The requested content type is not acceptable. | - | -**500** | Internal server error. | - | -**0** | Unexpected response. | - | - -[[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) - -# **get_element_by_project_and_id** -> Element get_element_by_project_and_id(project_identifier, element_identifier) - -Get element by project ID and its ID - -### Example - -```python -from __future__ import print_function -import time -import sysml_v2_api_client -from sysml_v2_api_client.rest import ApiException -from pprint import pprint - -# Create an instance of the API class -api_instance = sysml_v2_api_client.ElementApi() -project_identifier = 'project_identifier_example' # str | ID of the project -element_identifier = 'element_identifier_example' # str | ID of the element - -try: - # Get element by project ID and its ID - api_response = api_instance.get_element_by_project_and_id(project_identifier, element_identifier) - pprint(api_response) -except ApiException as e: - print("Exception when calling ElementApi->get_element_by_project_and_id: %s\n" % e) +# Enter a context with an instance of the API client +with sysml_v2_api_client.ApiClient() as api_client: + # Create an instance of the API class + api_instance = sysml_v2_api_client.ElementApi(api_client) + project_id = 'project_id_example' # str | ID of the project +commit_id = 'commit_id_example' # str | ID of the commit +element_id = 'element_id_example' # str | ID of the element + + try: + # Get element by project, commit and ID + api_response = api_instance.get_element_by_project_commit_id(project_id, commit_id, element_id) + pprint(api_response) + except ApiException as e: + print("Exception when calling ElementApi->get_element_by_project_commit_id: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **project_identifier** | **str**| ID of the project | - **element_identifier** | **str**| ID of the element | + **project_id** | [**str**](.md)| ID of the project | + **commit_id** | [**str**](.md)| ID of the commit | + **element_id** | [**str**](.md)| ID of the element | ### Return type @@ -180,10 +70,10 @@ No authorization required [[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) -# **get_elements** -> list[Element] get_elements() +# **get_elements_by_project_commit** +> Element get_elements_by_project_commit(project_id, commit_id) -Get all elements +Get elements by project and commit ### Example @@ -194,74 +84,27 @@ import sysml_v2_api_client from sysml_v2_api_client.rest import ApiException from pprint import pprint -# Create an instance of the API class -api_instance = sysml_v2_api_client.ElementApi() - -try: - # Get all elements - api_response = api_instance.get_elements() - pprint(api_response) -except ApiException as e: - print("Exception when calling ElementApi->get_elements: %s\n" % e) -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -[**list[Element]**](Element.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Ok | - | -**415** | The requested content type is not acceptable. | - | -**500** | Internal server error. | - | -**0** | Unexpected response. | - | - -[[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) - -# **get_elements_in_project** -> Element get_elements_in_project(project_identifier) - -Get all elements in the project - -### Example - -```python -from __future__ import print_function -import time -import sysml_v2_api_client -from sysml_v2_api_client.rest import ApiException -from pprint import pprint - -# Create an instance of the API class -api_instance = sysml_v2_api_client.ElementApi() -project_identifier = 'project_identifier_example' # str | ID of the project - -try: - # Get all elements in the project - api_response = api_instance.get_elements_in_project(project_identifier) - pprint(api_response) -except ApiException as e: - print("Exception when calling ElementApi->get_elements_in_project: %s\n" % e) +# Enter a context with an instance of the API client +with sysml_v2_api_client.ApiClient() as api_client: + # Create an instance of the API class + api_instance = sysml_v2_api_client.ElementApi(api_client) + project_id = 'project_id_example' # str | ID of the project +commit_id = 'commit_id_example' # str | ID of the commit + + try: + # Get elements by project and commit + api_response = api_instance.get_elements_by_project_commit(project_id, commit_id) + pprint(api_response) + except ApiException as e: + print("Exception when calling ElementApi->get_elements_by_project_commit: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **project_identifier** | **str**| ID of the project | + **project_id** | [**str**](.md)| ID of the project | + **commit_id** | [**str**](.md)| ID of the commit | ### Return type diff --git a/docs/RelationshipAllOf.md b/docs/ElementIdentity.md similarity index 63% rename from docs/RelationshipAllOf.md rename to docs/ElementIdentity.md index 11950fa..9944db2 100644 --- a/docs/RelationshipAllOf.md +++ b/docs/ElementIdentity.md @@ -1,10 +1,10 @@ -# RelationshipAllOf +# ElementIdentity ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**source** | [**list[Identified]**](Identified.md) | | [optional] -**target** | [**list[Identified]**](Identified.md) | | [optional] +**type** | **str** | | [optional] +**id** | **str** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/ElementVersion.md b/docs/ElementVersion.md new file mode 100644 index 0000000..138d264 --- /dev/null +++ b/docs/ElementVersion.md @@ -0,0 +1,13 @@ +# ElementVersion + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | | [optional] +**data** | [**Element**](Element.md) | | [optional] +**id** | **str** | | [optional] +**identity** | [**ElementIdentity**](ElementIdentity.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Project.md b/docs/Project.md index 07c0430..4545040 100644 --- a/docs/Project.md +++ b/docs/Project.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **type** | **str** | | [optional] +**id** | **str** | | [optional] **name** | **str** | | [optional] -**identifier** | **str** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/ProjectApi.md b/docs/ProjectApi.md index 64a21fa..bc40b06 100644 --- a/docs/ProjectApi.md +++ b/docs/ProjectApi.md @@ -4,15 +4,15 @@ All URIs are relative to *http://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- -[**create_project**](ProjectApi.md#create_project) | **POST** /projects | Add a new project -[**get_project**](ProjectApi.md#get_project) | **GET** /projects/{identifier} | Get project by its ID -[**get_projects**](ProjectApi.md#get_projects) | **GET** /projects | Get all projects +[**get_project_by_id**](ProjectApi.md#get_project_by_id) | **GET** /projects/{projectId} | Get project by ID +[**get_projects**](ProjectApi.md#get_projects) | **GET** /projects | Get projects +[**post_project**](ProjectApi.md#post_project) | **POST** /projects | Create project -# **create_project** -> Project create_project(body=body) +# **get_project_by_id** +> Project get_project_by_id(project_id) -Add a new project +Get project by ID ### Example @@ -23,23 +23,25 @@ import sysml_v2_api_client from sysml_v2_api_client.rest import ApiException from pprint import pprint -# Create an instance of the API class -api_instance = sysml_v2_api_client.ProjectApi() -body = sysml_v2_api_client.Project() # Project | (optional) - -try: - # Add a new project - api_response = api_instance.create_project(body=body) - pprint(api_response) -except ApiException as e: - print("Exception when calling ProjectApi->create_project: %s\n" % e) +# Enter a context with an instance of the API client +with sysml_v2_api_client.ApiClient() as api_client: + # Create an instance of the API class + api_instance = sysml_v2_api_client.ProjectApi(api_client) + project_id = 'project_id_example' # str | ID of the project + + try: + # Get project by ID + api_response = api_instance.get_project_by_id(project_id) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectApi->get_project_by_id: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Project**](Project.md)| | [optional] + **project_id** | [**str**](.md)| ID of the project | ### Return type @@ -51,23 +53,24 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json + - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**201** | Created | - | +**200** | Ok | - | +**404** | Not found. | - | **415** | The requested content type is not acceptable. | - | **500** | Internal server error. | - | **0** | Unexpected response. | - | [[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) -# **get_project** -> Project get_project(identifier) +# **get_projects** +> list[Project] get_projects() -Get project by its ID +Get projects ### Example @@ -78,27 +81,25 @@ import sysml_v2_api_client from sysml_v2_api_client.rest import ApiException from pprint import pprint -# Create an instance of the API class -api_instance = sysml_v2_api_client.ProjectApi() -identifier = 'identifier_example' # str | ID of the project - -try: - # Get project by its ID - api_response = api_instance.get_project(identifier) - pprint(api_response) -except ApiException as e: - print("Exception when calling ProjectApi->get_project: %s\n" % e) +# Enter a context with an instance of the API client +with sysml_v2_api_client.ApiClient() as api_client: + # Create an instance of the API class + api_instance = sysml_v2_api_client.ProjectApi(api_client) + + try: + # Get projects + api_response = api_instance.get_projects() + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectApi->get_projects: %s\n" % e) ``` ### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **identifier** | **str**| ID of the project | +This endpoint does not need any parameter. ### Return type -[**Project**](Project.md) +[**list[Project]**](Project.md) ### Authorization @@ -113,17 +114,16 @@ No authorization required | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Ok | - | -**404** | Not found. | - | **415** | The requested content type is not acceptable. | - | **500** | Internal server error. | - | **0** | Unexpected response. | - | [[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) -# **get_projects** -> list[Project] get_projects() +# **post_project** +> Project post_project(body=body) -Get all projects +Create project ### Example @@ -134,23 +134,29 @@ import sysml_v2_api_client from sysml_v2_api_client.rest import ApiException from pprint import pprint -# Create an instance of the API class -api_instance = sysml_v2_api_client.ProjectApi() - -try: - # Get all projects - api_response = api_instance.get_projects() - pprint(api_response) -except ApiException as e: - print("Exception when calling ProjectApi->get_projects: %s\n" % e) +# Enter a context with an instance of the API client +with sysml_v2_api_client.ApiClient() as api_client: + # Create an instance of the API class + api_instance = sysml_v2_api_client.ProjectApi(api_client) + body = sysml_v2_api_client.Project() # Project | (optional) + + try: + # Create project + api_response = api_instance.post_project(body=body) + pprint(api_response) + except ApiException as e: + print("Exception when calling ProjectApi->post_project: %s\n" % e) ``` ### Parameters -This endpoint does not need any parameter. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Project**](Project.md)| | [optional] ### Return type -[**list[Project]**](Project.md) +[**Project**](Project.md) ### Authorization @@ -158,13 +164,13 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: application/json ### HTTP response details | Status code | Description | Response headers | |-------------|-------------|------------------| -**200** | Ok | - | +**201** | Created | - | **415** | The requested content type is not acceptable. | - | **500** | Internal server error. | - | **0** | Unexpected response. | - | diff --git a/docs/Record.md b/docs/Record.md new file mode 100644 index 0000000..7e9dcbb --- /dev/null +++ b/docs/Record.md @@ -0,0 +1,10 @@ +# Record + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Relationship.md b/docs/Relationship.md index 277656c..6900153 100644 --- a/docs/Relationship.md +++ b/docs/Relationship.md @@ -4,7 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **type** | **str** | | [optional] -**containing_project** | [**Identified**](Identified.md) | | [optional] **identifier** | **str** | | [optional] **source** | [**list[Identified]**](Identified.md) | | [optional] **target** | [**list[Identified]**](Identified.md) | | [optional] diff --git a/docs/RelationshipApi.md b/docs/RelationshipApi.md index 280ea4e..d03ac82 100644 --- a/docs/RelationshipApi.md +++ b/docs/RelationshipApi.md @@ -4,16 +4,13 @@ All URIs are relative to *http://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- -[**create_relationship**](RelationshipApi.md#create_relationship) | **POST** /relationships | Add a new relationship -[**get_relationship**](RelationshipApi.md#get_relationship) | **GET** /relationships/{identifier} | Get relationship by its ID -[**get_relationships**](RelationshipApi.md#get_relationships) | **GET** /relationships | Get all relationships -[**get_relationships_by_project**](RelationshipApi.md#get_relationships_by_project) | **GET** /projects/{project_identifier}/relationships | Get all relationships in the project +[**get_relationships_by_project_commit_related_element**](RelationshipApi.md#get_relationships_by_project_commit_related_element) | **GET** /projects/{projectId}/commits/{commitId}/elements/{relatedElementId}/relationships | Get relationships by project, commit, and related element. -# **create_relationship** -> Relationship create_relationship(body) +# **get_relationships_by_project_commit_related_element** +> list[Relationship] get_relationships_by_project_commit_related_element(project_id, commit_id, related_element_id) -Add a new relationship +Get relationships by project, commit, and related element. ### Example @@ -24,185 +21,29 @@ import sysml_v2_api_client from sysml_v2_api_client.rest import ApiException from pprint import pprint -# Create an instance of the API class -api_instance = sysml_v2_api_client.RelationshipApi() -body = sysml_v2_api_client.Relationship() # Relationship | - -try: - # Add a new relationship - api_response = api_instance.create_relationship(body) - pprint(api_response) -except ApiException as e: - print("Exception when calling RelationshipApi->create_relationship: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | [**Relationship**](Relationship.md)| | - -### Return type - -[**Relationship**](Relationship.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: application/json - - **Accept**: application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**201** | Created | - | -**415** | The requested content type is not acceptable. | - | -**500** | Internal server error. | - | -**0** | Unexpected response. | - | - -[[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) - -# **get_relationship** -> Relationship get_relationship(identifier) - -Get relationship by its ID - -### Example - -```python -from __future__ import print_function -import time -import sysml_v2_api_client -from sysml_v2_api_client.rest import ApiException -from pprint import pprint - -# Create an instance of the API class -api_instance = sysml_v2_api_client.RelationshipApi() -identifier = 'identifier_example' # str | ID of the relationship - -try: - # Get relationship by its ID - api_response = api_instance.get_relationship(identifier) - pprint(api_response) -except ApiException as e: - print("Exception when calling RelationshipApi->get_relationship: %s\n" % e) -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **identifier** | **str**| ID of the relationship | - -### Return type - -[**Relationship**](Relationship.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Ok | - | -**404** | Not found. | - | -**415** | The requested content type is not acceptable. | - | -**500** | Internal server error. | - | -**0** | Unexpected response. | - | - -[[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) - -# **get_relationships** -> list[Relationship] get_relationships() - -Get all relationships - -### Example - -```python -from __future__ import print_function -import time -import sysml_v2_api_client -from sysml_v2_api_client.rest import ApiException -from pprint import pprint - -# Create an instance of the API class -api_instance = sysml_v2_api_client.RelationshipApi() - -try: - # Get all relationships - api_response = api_instance.get_relationships() - pprint(api_response) -except ApiException as e: - print("Exception when calling RelationshipApi->get_relationships: %s\n" % e) -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -[**list[Relationship]**](Relationship.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Ok | - | -**415** | The requested content type is not acceptable. | - | -**500** | Internal server error. | - | -**0** | Unexpected response. | - | - -[[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) - -# **get_relationships_by_project** -> list[Relationship] get_relationships_by_project(project_identifier) - -Get all relationships in the project - -### Example - -```python -from __future__ import print_function -import time -import sysml_v2_api_client -from sysml_v2_api_client.rest import ApiException -from pprint import pprint - -# Create an instance of the API class -api_instance = sysml_v2_api_client.RelationshipApi() -project_identifier = 'project_identifier_example' # str | ID of the project - -try: - # Get all relationships in the project - api_response = api_instance.get_relationships_by_project(project_identifier) - pprint(api_response) -except ApiException as e: - print("Exception when calling RelationshipApi->get_relationships_by_project: %s\n" % e) +# Enter a context with an instance of the API client +with sysml_v2_api_client.ApiClient() as api_client: + # Create an instance of the API class + api_instance = sysml_v2_api_client.RelationshipApi(api_client) + project_id = 'project_id_example' # str | ID of the project +commit_id = 'commit_id_example' # str | ID of the commit +related_element_id = 'related_element_id_example' # str | ID of the related element + + try: + # Get relationships by project, commit, and related element. + api_response = api_instance.get_relationships_by_project_commit_related_element(project_id, commit_id, related_element_id) + pprint(api_response) + except ApiException as e: + print("Exception when calling RelationshipApi->get_relationships_by_project_commit_related_element: %s\n" % e) ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **project_identifier** | **str**| ID of the project | + **project_id** | [**str**](.md)| ID of the project | + **commit_id** | [**str**](.md)| ID of the commit | + **related_element_id** | [**str**](.md)| ID of the related element | ### Return type diff --git a/requirements.txt b/requirements.txt index bafdc07..eb358ef 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ certifi >= 14.05.14 +future; python_version<="2.7" six >= 1.10 python_dateutil >= 2.5.3 setuptools >= 21.0.0 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..11433ee --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[flake8] +max-line-length=99 diff --git a/setup.py b/setup.py index 771dda4..5be11e6 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "sysml-v2-api-client" -VERSION = "2019-09" +VERSION = "2020-03-rc2" # To install the library, run the following # # python setup.py install @@ -27,7 +27,8 @@ name=NAME, version=VERSION, description="SysML v2 API and Services", - author_email="", + author="OpenAPI Generator community", + author_email="team@openapitools.org", url="", keywords=["OpenAPI", "OpenAPI-Generator", "SysML v2 API and Services"], install_requires=REQUIRES, diff --git a/sysml_v2_api_client/__init__.py b/sysml_v2_api_client/__init__.py index c9db0ca..23e9422 100644 --- a/sysml_v2_api_client/__init__.py +++ b/sysml_v2_api_client/__init__.py @@ -14,9 +14,10 @@ from __future__ import absolute_import -__version__ = "2019-09" +__version__ = "2020-03-rc2" # import apis into sdk package +from sysml_v2_api_client.api.commit_api import CommitApi from sysml_v2_api_client.api.element_api import ElementApi from sysml_v2_api_client.api.project_api import ProjectApi from sysml_v2_api_client.api.relationship_api import RelationshipApi @@ -30,10 +31,13 @@ from sysml_v2_api_client.exceptions import ApiKeyError from sysml_v2_api_client.exceptions import ApiException # import models into sdk package +from sysml_v2_api_client.models.commit import Commit from sysml_v2_api_client.models.element import Element +from sysml_v2_api_client.models.element_identity import ElementIdentity +from sysml_v2_api_client.models.element_version import ElementVersion from sysml_v2_api_client.models.error import Error from sysml_v2_api_client.models.identified import Identified from sysml_v2_api_client.models.project import Project +from sysml_v2_api_client.models.record import Record from sysml_v2_api_client.models.relationship import Relationship -from sysml_v2_api_client.models.relationship_all_of import RelationshipAllOf diff --git a/sysml_v2_api_client/api/__init__.py b/sysml_v2_api_client/api/__init__.py index 9b43359..7e3a86e 100644 --- a/sysml_v2_api_client/api/__init__.py +++ b/sysml_v2_api_client/api/__init__.py @@ -3,6 +3,7 @@ # flake8: noqa # import apis into api package +from sysml_v2_api_client.api.commit_api import CommitApi from sysml_v2_api_client.api.element_api import ElementApi from sysml_v2_api_client.api.project_api import ProjectApi from sysml_v2_api_client.api.relationship_api import RelationshipApi diff --git a/sysml_v2_api_client/api/commit_api.py b/sysml_v2_api_client/api/commit_api.py new file mode 100644 index 0000000..8cb3b86 --- /dev/null +++ b/sysml_v2_api_client/api/commit_api.py @@ -0,0 +1,481 @@ +# coding: utf-8 + +""" + SysML v2 API and Services + + REST/HTTP binding (PSM) for the SysML v2 standard API. # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import re # noqa: F401 + +# python 2 and python 3 compatibility library +import six + +from sysml_v2_api_client.api_client import ApiClient +from sysml_v2_api_client.exceptions import ( + ApiTypeError, + ApiValueError +) + + +class CommitApi(object): + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient() + self.api_client = api_client + + def get_commit_by_project_and_id(self, project_id, commit_id, **kwargs): # noqa: E501 + """Get commit by project and ID # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_commit_by_project_and_id(project_id, commit_id, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str project_id: ID of the project (required) + :param str commit_id: ID of the commit (required) + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Commit + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.get_commit_by_project_and_id_with_http_info(project_id, commit_id, **kwargs) # noqa: E501 + + def get_commit_by_project_and_id_with_http_info(self, project_id, commit_id, **kwargs): # noqa: E501 + """Get commit by project and ID # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_commit_by_project_and_id_with_http_info(project_id, commit_id, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str project_id: ID of the project (required) + :param str commit_id: ID of the commit (required) + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: tuple(Commit, status_code(int), headers(HTTPHeaderDict)) + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = ['project_id', 'commit_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method get_commit_by_project_and_id" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'project_id' is set + if self.api_client.client_side_validation and ('project_id' not in local_var_params or # noqa: E501 + local_var_params['project_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `project_id` when calling `get_commit_by_project_and_id`") # noqa: E501 + # verify the required parameter 'commit_id' is set + if self.api_client.client_side_validation and ('commit_id' not in local_var_params or # noqa: E501 + local_var_params['commit_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `commit_id` when calling `get_commit_by_project_and_id`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'project_id' in local_var_params: + path_params['projectId'] = local_var_params['project_id'] # noqa: E501 + if 'commit_id' in local_var_params: + path_params['commitId'] = local_var_params['commit_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/projects/{projectId}/commits/{commitId}', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Commit', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_commits_by_project(self, project_id, **kwargs): # noqa: E501 + """Get commits by project # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_commits_by_project(project_id, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str project_id: ID of the project (required) + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Commit + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.get_commits_by_project_with_http_info(project_id, **kwargs) # noqa: E501 + + def get_commits_by_project_with_http_info(self, project_id, **kwargs): # noqa: E501 + """Get commits by project # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_commits_by_project_with_http_info(project_id, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str project_id: ID of the project (required) + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: tuple(Commit, status_code(int), headers(HTTPHeaderDict)) + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = ['project_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method get_commits_by_project" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'project_id' is set + if self.api_client.client_side_validation and ('project_id' not in local_var_params or # noqa: E501 + local_var_params['project_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `project_id` when calling `get_commits_by_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'project_id' in local_var_params: + path_params['projectId'] = local_var_params['project_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/projects/{projectId}/commits', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Commit', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) + + def get_head_commit_by_project(self, project_id, **kwargs): # noqa: E501 + """Get head commit by project # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_head_commit_by_project(project_id, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str project_id: ID of the project (required) + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Commit + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.get_head_commit_by_project_with_http_info(project_id, **kwargs) # noqa: E501 + + def get_head_commit_by_project_with_http_info(self, project_id, **kwargs): # noqa: E501 + """Get head commit by project # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.get_head_commit_by_project_with_http_info(project_id, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str project_id: ID of the project (required) + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: tuple(Commit, status_code(int), headers(HTTPHeaderDict)) + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = ['project_id'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method get_head_commit_by_project" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'project_id' is set + if self.api_client.client_side_validation and ('project_id' not in local_var_params or # noqa: E501 + local_var_params['project_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `project_id` when calling `get_head_commit_by_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'project_id' in local_var_params: + path_params['projectId'] = local_var_params['project_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/projects/{projectId}/head', 'GET', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Commit', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) + + def post_commit_by_project(self, project_id, body, **kwargs): # noqa: E501 + """Create commit by project # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_commit_by_project(project_id, body, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str project_id: ID of the project (required) + :param Commit body: (required) + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: Commit + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + return self.post_commit_by_project_with_http_info(project_id, body, **kwargs) # noqa: E501 + + def post_commit_by_project_with_http_info(self, project_id, body, **kwargs): # noqa: E501 + """Create commit by project # noqa: E501 + + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + >>> thread = api.post_commit_by_project_with_http_info(project_id, body, async_req=True) + >>> result = thread.get() + + :param async_req bool: execute request asynchronously + :param str project_id: ID of the project (required) + :param Commit body: (required) + :param _return_http_data_only: response data without head status code + and headers + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :return: tuple(Commit, status_code(int), headers(HTTPHeaderDict)) + If the method is called asynchronously, + returns the request thread. + """ + + local_var_params = locals() + + all_params = ['project_id', 'body'] # noqa: E501 + all_params.append('async_req') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + for key, val in six.iteritems(local_var_params['kwargs']): + if key not in all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method post_commit_by_project" % key + ) + local_var_params[key] = val + del local_var_params['kwargs'] + # verify the required parameter 'project_id' is set + if self.api_client.client_side_validation and ('project_id' not in local_var_params or # noqa: E501 + local_var_params['project_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `project_id` when calling `post_commit_by_project`") # noqa: E501 + # verify the required parameter 'body' is set + if self.api_client.client_side_validation and ('body' not in local_var_params or # noqa: E501 + local_var_params['body'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `body` when calling `post_commit_by_project`") # noqa: E501 + + collection_formats = {} + + path_params = {} + if 'project_id' in local_var_params: + path_params['projectId'] = local_var_params['project_id'] # noqa: E501 + + query_params = [] + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in local_var_params: + body_params = local_var_params['body'] + # HTTP header `Accept` + header_params['Accept'] = self.api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + + # Authentication setting + auth_settings = [] # noqa: E501 + + return self.api_client.call_api( + '/projects/{projectId}/commits', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='Commit', # noqa: E501 + auth_settings=auth_settings, + async_req=local_var_params.get('async_req'), + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=local_var_params.get('_preload_content', True), + _request_timeout=local_var_params.get('_request_timeout'), + collection_formats=collection_formats) diff --git a/sysml_v2_api_client/api/element_api.py b/sysml_v2_api_client/api/element_api.py index f9d5178..78a51ac 100644 --- a/sysml_v2_api_client/api/element_api.py +++ b/sysml_v2_api_client/api/element_api.py @@ -36,16 +36,18 @@ def __init__(self, api_client=None): api_client = ApiClient() self.api_client = api_client - def create_element(self, body, **kwargs): # noqa: E501 - """Add a new element # noqa: E501 + def get_element_by_project_commit_id(self, project_id, commit_id, element_id, **kwargs): # noqa: E501 + """Get element by project, commit and ID # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_element(body, async_req=True) + >>> thread = api.get_element_by_project_commit_id(project_id, commit_id, element_id, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously - :param dict(str, object) body: (required) + :param str project_id: ID of the project (required) + :param str commit_id: ID of the commit (required) + :param str element_id: ID of the element (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -58,18 +60,20 @@ def create_element(self, body, **kwargs): # noqa: E501 returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.create_element_with_http_info(body, **kwargs) # noqa: E501 + return self.get_element_by_project_commit_id_with_http_info(project_id, commit_id, element_id, **kwargs) # noqa: E501 - def create_element_with_http_info(self, body, **kwargs): # noqa: E501 - """Add a new element # noqa: E501 + def get_element_by_project_commit_id_with_http_info(self, project_id, commit_id, element_id, **kwargs): # noqa: E501 + """Get element by project, commit and ID # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_element_with_http_info(body, async_req=True) + >>> thread = api.get_element_by_project_commit_id_with_http_info(project_id, commit_id, element_id, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously - :param dict(str, object) body: (required) + :param str project_id: ID of the project (required) + :param str commit_id: ID of the commit (required) + :param str element_id: ID of the element (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -86,7 +90,7 @@ def create_element_with_http_info(self, body, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ['body'] # noqa: E501 + all_params = ['project_id', 'commit_id', 'element_id'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -96,130 +100,32 @@ def create_element_with_http_info(self, body, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method create_element" % key + " to method get_element_by_project_commit_id" % key ) local_var_params[key] = val del local_var_params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in local_var_params or - local_var_params['body'] is None): - raise ApiValueError("Missing the required parameter `body` when calling `create_element`") # noqa: E501 + # verify the required parameter 'project_id' is set + if self.api_client.client_side_validation and ('project_id' not in local_var_params or # noqa: E501 + local_var_params['project_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `project_id` when calling `get_element_by_project_commit_id`") # noqa: E501 + # verify the required parameter 'commit_id' is set + if self.api_client.client_side_validation and ('commit_id' not in local_var_params or # noqa: E501 + local_var_params['commit_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `commit_id` when calling `get_element_by_project_commit_id`") # noqa: E501 + # verify the required parameter 'element_id' is set + if self.api_client.client_side_validation and ('element_id' not in local_var_params or # noqa: E501 + local_var_params['element_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `element_id` when calling `get_element_by_project_commit_id`") # noqa: E501 collection_formats = {} path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in local_var_params: - body_params = local_var_params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/elements', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Element', # noqa: E501 - auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_element(self, identifier, **kwargs): # noqa: E501 - """Get element by its ID # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_element(identifier, async_req=True) - >>> result = thread.get() - - :param async_req bool: execute request asynchronously - :param str identifier: ID of the element (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Element - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - return self.get_element_with_http_info(identifier, **kwargs) # noqa: E501 - - def get_element_with_http_info(self, identifier, **kwargs): # noqa: E501 - """Get element by its ID # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_element_with_http_info(identifier, async_req=True) - >>> result = thread.get() - - :param async_req bool: execute request asynchronously - :param str identifier: ID of the element (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(Element, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. - """ - - local_var_params = locals() - - all_params = ['identifier'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - for key, val in six.iteritems(local_var_params['kwargs']): - if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_element" % key - ) - local_var_params[key] = val - del local_var_params['kwargs'] - # verify the required parameter 'identifier' is set - if ('identifier' not in local_var_params or - local_var_params['identifier'] is None): - raise ApiValueError("Missing the required parameter `identifier` when calling `get_element`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'identifier' in local_var_params: - path_params['identifier'] = local_var_params['identifier'] # noqa: E501 + if 'project_id' in local_var_params: + path_params['projectId'] = local_var_params['project_id'] # noqa: E501 + if 'commit_id' in local_var_params: + path_params['commitId'] = local_var_params['commit_id'] # noqa: E501 + if 'element_id' in local_var_params: + path_params['elementId'] = local_var_params['element_id'] # noqa: E501 query_params = [] @@ -237,7 +143,7 @@ def get_element_with_http_info(self, identifier, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/elements/{identifier}', 'GET', + '/projects/{projectId}/commits/{commitId}/elements/{elementId}', 'GET', path_params, query_params, header_params, @@ -252,228 +158,17 @@ def get_element_with_http_info(self, identifier, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def get_element_by_project_and_id(self, project_identifier, element_identifier, **kwargs): # noqa: E501 - """Get element by project ID and its ID # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_element_by_project_and_id(project_identifier, element_identifier, async_req=True) - >>> result = thread.get() - - :param async_req bool: execute request asynchronously - :param str project_identifier: ID of the project (required) - :param str element_identifier: ID of the element (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Element - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - return self.get_element_by_project_and_id_with_http_info(project_identifier, element_identifier, **kwargs) # noqa: E501 - - def get_element_by_project_and_id_with_http_info(self, project_identifier, element_identifier, **kwargs): # noqa: E501 - """Get element by project ID and its ID # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_element_by_project_and_id_with_http_info(project_identifier, element_identifier, async_req=True) - >>> result = thread.get() - - :param async_req bool: execute request asynchronously - :param str project_identifier: ID of the project (required) - :param str element_identifier: ID of the element (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(Element, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. - """ - - local_var_params = locals() - - all_params = ['project_identifier', 'element_identifier'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - for key, val in six.iteritems(local_var_params['kwargs']): - if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_element_by_project_and_id" % key - ) - local_var_params[key] = val - del local_var_params['kwargs'] - # verify the required parameter 'project_identifier' is set - if ('project_identifier' not in local_var_params or - local_var_params['project_identifier'] is None): - raise ApiValueError("Missing the required parameter `project_identifier` when calling `get_element_by_project_and_id`") # noqa: E501 - # verify the required parameter 'element_identifier' is set - if ('element_identifier' not in local_var_params or - local_var_params['element_identifier'] is None): - raise ApiValueError("Missing the required parameter `element_identifier` when calling `get_element_by_project_and_id`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'project_identifier' in local_var_params: - path_params['project_identifier'] = local_var_params['project_identifier'] # noqa: E501 - if 'element_identifier' in local_var_params: - path_params['element_identifier'] = local_var_params['element_identifier'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/projects/{project_identifier}/elements/{element_identifier}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Element', # noqa: E501 - auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_elements(self, **kwargs): # noqa: E501 - """Get all elements # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_elements(async_req=True) - >>> result = thread.get() - - :param async_req bool: execute request asynchronously - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: list[Element] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - return self.get_elements_with_http_info(**kwargs) # noqa: E501 - - def get_elements_with_http_info(self, **kwargs): # noqa: E501 - """Get all elements # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_elements_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req bool: execute request asynchronously - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(list[Element], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. - """ - - local_var_params = locals() - - all_params = [] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - for key, val in six.iteritems(local_var_params['kwargs']): - if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_elements" % key - ) - local_var_params[key] = val - del local_var_params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/elements', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[Element]', # noqa: E501 - auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_elements_in_project(self, project_identifier, **kwargs): # noqa: E501 - """Get all elements in the project # noqa: E501 + def get_elements_by_project_commit(self, project_id, commit_id, **kwargs): # noqa: E501 + """Get elements by project and commit # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_elements_in_project(project_identifier, async_req=True) + >>> thread = api.get_elements_by_project_commit(project_id, commit_id, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously - :param str project_identifier: ID of the project (required) + :param str project_id: ID of the project (required) + :param str commit_id: ID of the commit (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -486,18 +181,19 @@ def get_elements_in_project(self, project_identifier, **kwargs): # noqa: E501 returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.get_elements_in_project_with_http_info(project_identifier, **kwargs) # noqa: E501 + return self.get_elements_by_project_commit_with_http_info(project_id, commit_id, **kwargs) # noqa: E501 - def get_elements_in_project_with_http_info(self, project_identifier, **kwargs): # noqa: E501 - """Get all elements in the project # noqa: E501 + def get_elements_by_project_commit_with_http_info(self, project_id, commit_id, **kwargs): # noqa: E501 + """Get elements by project and commit # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_elements_in_project_with_http_info(project_identifier, async_req=True) + >>> thread = api.get_elements_by_project_commit_with_http_info(project_id, commit_id, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously - :param str project_identifier: ID of the project (required) + :param str project_id: ID of the project (required) + :param str commit_id: ID of the commit (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -514,7 +210,7 @@ def get_elements_in_project_with_http_info(self, project_identifier, **kwargs): local_var_params = locals() - all_params = ['project_identifier'] # noqa: E501 + all_params = ['project_id', 'commit_id'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -524,20 +220,26 @@ def get_elements_in_project_with_http_info(self, project_identifier, **kwargs): if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method get_elements_in_project" % key + " to method get_elements_by_project_commit" % key ) local_var_params[key] = val del local_var_params['kwargs'] - # verify the required parameter 'project_identifier' is set - if ('project_identifier' not in local_var_params or - local_var_params['project_identifier'] is None): - raise ApiValueError("Missing the required parameter `project_identifier` when calling `get_elements_in_project`") # noqa: E501 + # verify the required parameter 'project_id' is set + if self.api_client.client_side_validation and ('project_id' not in local_var_params or # noqa: E501 + local_var_params['project_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `project_id` when calling `get_elements_by_project_commit`") # noqa: E501 + # verify the required parameter 'commit_id' is set + if self.api_client.client_side_validation and ('commit_id' not in local_var_params or # noqa: E501 + local_var_params['commit_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `commit_id` when calling `get_elements_by_project_commit`") # noqa: E501 collection_formats = {} path_params = {} - if 'project_identifier' in local_var_params: - path_params['project_identifier'] = local_var_params['project_identifier'] # noqa: E501 + if 'project_id' in local_var_params: + path_params['projectId'] = local_var_params['project_id'] # noqa: E501 + if 'commit_id' in local_var_params: + path_params['commitId'] = local_var_params['commit_id'] # noqa: E501 query_params = [] @@ -555,7 +257,7 @@ def get_elements_in_project_with_http_info(self, project_identifier, **kwargs): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/projects/{project_identifier}/elements', 'GET', + '/projects/{projectId}/commits/{commitId}/elements', 'GET', path_params, query_params, header_params, diff --git a/sysml_v2_api_client/api/project_api.py b/sysml_v2_api_client/api/project_api.py index e14f1db..22c3fcb 100644 --- a/sysml_v2_api_client/api/project_api.py +++ b/sysml_v2_api_client/api/project_api.py @@ -36,16 +36,16 @@ def __init__(self, api_client=None): api_client = ApiClient() self.api_client = api_client - def create_project(self, **kwargs): # noqa: E501 - """Add a new project # noqa: E501 + def get_project_by_id(self, project_id, **kwargs): # noqa: E501 + """Get project by ID # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_project(async_req=True) + >>> thread = api.get_project_by_id(project_id, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously - :param Project body: + :param str project_id: ID of the project (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -58,18 +58,18 @@ def create_project(self, **kwargs): # noqa: E501 returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.create_project_with_http_info(**kwargs) # noqa: E501 + return self.get_project_by_id_with_http_info(project_id, **kwargs) # noqa: E501 - def create_project_with_http_info(self, **kwargs): # noqa: E501 - """Add a new project # noqa: E501 + def get_project_by_id_with_http_info(self, project_id, **kwargs): # noqa: E501 + """Get project by ID # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_project_with_http_info(async_req=True) + >>> thread = api.get_project_by_id_with_http_info(project_id, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously - :param Project body: + :param str project_id: ID of the project (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -86,7 +86,7 @@ def create_project_with_http_info(self, **kwargs): # noqa: E501 local_var_params = locals() - all_params = ['body'] # noqa: E501 + all_params = ['project_id'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -96,14 +96,20 @@ def create_project_with_http_info(self, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method create_project" % key + " to method get_project_by_id" % key ) local_var_params[key] = val del local_var_params['kwargs'] + # verify the required parameter 'project_id' is set + if self.api_client.client_side_validation and ('project_id' not in local_var_params or # noqa: E501 + local_var_params['project_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `project_id` when calling `get_project_by_id`") # noqa: E501 collection_formats = {} path_params = {} + if 'project_id' in local_var_params: + path_params['projectId'] = local_var_params['project_id'] # noqa: E501 query_params = [] @@ -113,21 +119,15 @@ def create_project_with_http_info(self, **kwargs): # noqa: E501 local_var_files = {} body_params = None - if 'body' in local_var_params: - body_params = local_var_params['body'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/projects', 'POST', + '/projects/{projectId}', 'GET', path_params, query_params, header_params, @@ -142,16 +142,15 @@ def create_project_with_http_info(self, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def get_project(self, identifier, **kwargs): # noqa: E501 - """Get project by its ID # noqa: E501 + def get_projects(self, **kwargs): # noqa: E501 + """Get projects # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_project(identifier, async_req=True) + >>> thread = api.get_projects(async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously - :param str identifier: ID of the project (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -159,23 +158,22 @@ def get_project(self, identifier, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: Project + :return: list[Project] If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.get_project_with_http_info(identifier, **kwargs) # noqa: E501 + return self.get_projects_with_http_info(**kwargs) # noqa: E501 - def get_project_with_http_info(self, identifier, **kwargs): # noqa: E501 - """Get project by its ID # noqa: E501 + def get_projects_with_http_info(self, **kwargs): # noqa: E501 + """Get projects # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_project_with_http_info(identifier, async_req=True) + >>> thread = api.get_projects_with_http_info(async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously - :param str identifier: ID of the project (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -185,14 +183,14 @@ def get_project_with_http_info(self, identifier, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(Project, status_code(int), headers(HTTPHeaderDict)) + :return: tuple(list[Project], status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = ['identifier'] # noqa: E501 + all_params = [] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -202,20 +200,14 @@ def get_project_with_http_info(self, identifier, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method get_project" % key + " to method get_projects" % key ) local_var_params[key] = val del local_var_params['kwargs'] - # verify the required parameter 'identifier' is set - if ('identifier' not in local_var_params or - local_var_params['identifier'] is None): - raise ApiValueError("Missing the required parameter `identifier` when calling `get_project`") # noqa: E501 collection_formats = {} path_params = {} - if 'identifier' in local_var_params: - path_params['identifier'] = local_var_params['identifier'] # noqa: E501 query_params = [] @@ -233,14 +225,14 @@ def get_project_with_http_info(self, identifier, **kwargs): # noqa: E501 auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/projects/{identifier}', 'GET', + '/projects', 'GET', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='Project', # noqa: E501 + response_type='list[Project]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -248,15 +240,16 @@ def get_project_with_http_info(self, identifier, **kwargs): # noqa: E501 _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def get_projects(self, **kwargs): # noqa: E501 - """Get all projects # noqa: E501 + def post_project(self, **kwargs): # noqa: E501 + """Create project # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_projects(async_req=True) + >>> thread = api.post_project(async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously + :param Project body: :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -264,22 +257,23 @@ def get_projects(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: list[Project] + :return: Project If the method is called asynchronously, returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.get_projects_with_http_info(**kwargs) # noqa: E501 + return self.post_project_with_http_info(**kwargs) # noqa: E501 - def get_projects_with_http_info(self, **kwargs): # noqa: E501 - """Get all projects # noqa: E501 + def post_project_with_http_info(self, **kwargs): # noqa: E501 + """Create project # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_projects_with_http_info(async_req=True) + >>> thread = api.post_project_with_http_info(async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously + :param Project body: :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -289,14 +283,14 @@ def get_projects_with_http_info(self, **kwargs): # noqa: E501 number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. - :return: tuple(list[Project], status_code(int), headers(HTTPHeaderDict)) + :return: tuple(Project, status_code(int), headers(HTTPHeaderDict)) If the method is called asynchronously, returns the request thread. """ local_var_params = locals() - all_params = [] # noqa: E501 + all_params = ['body'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -306,7 +300,7 @@ def get_projects_with_http_info(self, **kwargs): # noqa: E501 if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method get_projects" % key + " to method post_project" % key ) local_var_params[key] = val del local_var_params['kwargs'] @@ -323,22 +317,28 @@ def get_projects_with_http_info(self, **kwargs): # noqa: E501 local_var_files = {} body_params = None + if 'body' in local_var_params: + body_params = local_var_params['body'] # HTTP header `Accept` header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) # noqa: E501 + # HTTP header `Content-Type` + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 + # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/projects', 'GET', + '/projects', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, - response_type='list[Project]', # noqa: E501 + response_type='Project', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/sysml_v2_api_client/api/relationship_api.py b/sysml_v2_api_client/api/relationship_api.py index dedbf16..1d130dd 100644 --- a/sysml_v2_api_client/api/relationship_api.py +++ b/sysml_v2_api_client/api/relationship_api.py @@ -36,330 +36,18 @@ def __init__(self, api_client=None): api_client = ApiClient() self.api_client = api_client - def create_relationship(self, body, **kwargs): # noqa: E501 - """Add a new relationship # noqa: E501 + def get_relationships_by_project_commit_related_element(self, project_id, commit_id, related_element_id, **kwargs): # noqa: E501 + """Get relationships by project, commit, and related element. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_relationship(body, async_req=True) + >>> thread = api.get_relationships_by_project_commit_related_element(project_id, commit_id, related_element_id, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously - :param Relationship body: (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Relationship - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - return self.create_relationship_with_http_info(body, **kwargs) # noqa: E501 - - def create_relationship_with_http_info(self, body, **kwargs): # noqa: E501 - """Add a new relationship # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_relationship_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool: execute request asynchronously - :param Relationship body: (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(Relationship, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. - """ - - local_var_params = locals() - - all_params = ['body'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - for key, val in six.iteritems(local_var_params['kwargs']): - if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method create_relationship" % key - ) - local_var_params[key] = val - del local_var_params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in local_var_params or - local_var_params['body'] is None): - raise ApiValueError("Missing the required parameter `body` when calling `create_relationship`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in local_var_params: - body_params = local_var_params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/relationships', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Relationship', # noqa: E501 - auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_relationship(self, identifier, **kwargs): # noqa: E501 - """Get relationship by its ID # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_relationship(identifier, async_req=True) - >>> result = thread.get() - - :param async_req bool: execute request asynchronously - :param str identifier: ID of the relationship (required) - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Relationship - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - return self.get_relationship_with_http_info(identifier, **kwargs) # noqa: E501 - - def get_relationship_with_http_info(self, identifier, **kwargs): # noqa: E501 - """Get relationship by its ID # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_relationship_with_http_info(identifier, async_req=True) - >>> result = thread.get() - - :param async_req bool: execute request asynchronously - :param str identifier: ID of the relationship (required) - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(Relationship, status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. - """ - - local_var_params = locals() - - all_params = ['identifier'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - for key, val in six.iteritems(local_var_params['kwargs']): - if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_relationship" % key - ) - local_var_params[key] = val - del local_var_params['kwargs'] - # verify the required parameter 'identifier' is set - if ('identifier' not in local_var_params or - local_var_params['identifier'] is None): - raise ApiValueError("Missing the required parameter `identifier` when calling `get_relationship`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'identifier' in local_var_params: - path_params['identifier'] = local_var_params['identifier'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/relationships/{identifier}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='Relationship', # noqa: E501 - auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_relationships(self, **kwargs): # noqa: E501 - """Get all relationships # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_relationships(async_req=True) - >>> result = thread.get() - - :param async_req bool: execute request asynchronously - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: list[Relationship] - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - return self.get_relationships_with_http_info(**kwargs) # noqa: E501 - - def get_relationships_with_http_info(self, **kwargs): # noqa: E501 - """Get all relationships # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_relationships_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req bool: execute request asynchronously - :param _return_http_data_only: response data without head status code - and headers - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: tuple(list[Relationship], status_code(int), headers(HTTPHeaderDict)) - If the method is called asynchronously, - returns the request thread. - """ - - local_var_params = locals() - - all_params = [] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - for key, val in six.iteritems(local_var_params['kwargs']): - if key not in all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method get_relationships" % key - ) - local_var_params[key] = val - del local_var_params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/relationships', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[Relationship]', # noqa: E501 - auth_settings=auth_settings, - async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 - _preload_content=local_var_params.get('_preload_content', True), - _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_relationships_by_project(self, project_identifier, **kwargs): # noqa: E501 - """Get all relationships in the project # noqa: E501 - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_relationships_by_project(project_identifier, async_req=True) - >>> result = thread.get() - - :param async_req bool: execute request asynchronously - :param str project_identifier: ID of the project (required) + :param str project_id: ID of the project (required) + :param str commit_id: ID of the commit (required) + :param str related_element_id: ID of the related element (required) :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. @@ -372,18 +60,20 @@ def get_relationships_by_project(self, project_identifier, **kwargs): # noqa: E returns the request thread. """ kwargs['_return_http_data_only'] = True - return self.get_relationships_by_project_with_http_info(project_identifier, **kwargs) # noqa: E501 + return self.get_relationships_by_project_commit_related_element_with_http_info(project_id, commit_id, related_element_id, **kwargs) # noqa: E501 - def get_relationships_by_project_with_http_info(self, project_identifier, **kwargs): # noqa: E501 - """Get all relationships in the project # noqa: E501 + def get_relationships_by_project_commit_related_element_with_http_info(self, project_id, commit_id, related_element_id, **kwargs): # noqa: E501 + """Get relationships by project, commit, and related element. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_relationships_by_project_with_http_info(project_identifier, async_req=True) + >>> thread = api.get_relationships_by_project_commit_related_element_with_http_info(project_id, commit_id, related_element_id, async_req=True) >>> result = thread.get() :param async_req bool: execute request asynchronously - :param str project_identifier: ID of the project (required) + :param str project_id: ID of the project (required) + :param str commit_id: ID of the commit (required) + :param str related_element_id: ID of the related element (required) :param _return_http_data_only: response data without head status code and headers :param _preload_content: if False, the urllib3.HTTPResponse object will @@ -400,7 +90,7 @@ def get_relationships_by_project_with_http_info(self, project_identifier, **kwar local_var_params = locals() - all_params = ['project_identifier'] # noqa: E501 + all_params = ['project_id', 'commit_id', 'related_element_id'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -410,20 +100,32 @@ def get_relationships_by_project_with_http_info(self, project_identifier, **kwar if key not in all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method get_relationships_by_project" % key + " to method get_relationships_by_project_commit_related_element" % key ) local_var_params[key] = val del local_var_params['kwargs'] - # verify the required parameter 'project_identifier' is set - if ('project_identifier' not in local_var_params or - local_var_params['project_identifier'] is None): - raise ApiValueError("Missing the required parameter `project_identifier` when calling `get_relationships_by_project`") # noqa: E501 + # verify the required parameter 'project_id' is set + if self.api_client.client_side_validation and ('project_id' not in local_var_params or # noqa: E501 + local_var_params['project_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `project_id` when calling `get_relationships_by_project_commit_related_element`") # noqa: E501 + # verify the required parameter 'commit_id' is set + if self.api_client.client_side_validation and ('commit_id' not in local_var_params or # noqa: E501 + local_var_params['commit_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `commit_id` when calling `get_relationships_by_project_commit_related_element`") # noqa: E501 + # verify the required parameter 'related_element_id' is set + if self.api_client.client_side_validation and ('related_element_id' not in local_var_params or # noqa: E501 + local_var_params['related_element_id'] is None): # noqa: E501 + raise ApiValueError("Missing the required parameter `related_element_id` when calling `get_relationships_by_project_commit_related_element`") # noqa: E501 collection_formats = {} path_params = {} - if 'project_identifier' in local_var_params: - path_params['project_identifier'] = local_var_params['project_identifier'] # noqa: E501 + if 'project_id' in local_var_params: + path_params['projectId'] = local_var_params['project_id'] # noqa: E501 + if 'commit_id' in local_var_params: + path_params['commitId'] = local_var_params['commit_id'] # noqa: E501 + if 'related_element_id' in local_var_params: + path_params['relatedElementId'] = local_var_params['related_element_id'] # noqa: E501 query_params = [] @@ -441,7 +143,7 @@ def get_relationships_by_project_with_http_info(self, project_identifier, **kwar auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/projects/{project_identifier}/relationships', 'GET', + '/projects/{projectId}/commits/{commitId}/elements/{relatedElementId}/relationships', 'GET', path_params, query_params, header_params, diff --git a/sysml_v2_api_client/api_client.py b/sysml_v2_api_client/api_client.py index d700c30..36551e7 100644 --- a/sysml_v2_api_client/api_client.py +++ b/sysml_v2_api_client/api_client.py @@ -10,7 +10,9 @@ from __future__ import absolute_import +import atexit import datetime +from dateutil.parser import parse import json import mimetypes from multiprocessing.pool import ThreadPool @@ -76,13 +78,22 @@ def __init__(self, configuration=None, header_name=None, header_value=None, self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/2019-09/python' + self.user_agent = 'OpenAPI-Generator/2020-03-rc2/python' + self.client_side_validation = configuration.client_side_validation - def __del__(self): + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + self.close() + + def close(self): if self._pool: self._pool.close() self._pool.join() self._pool = None + if hasattr(atexit, 'unregister'): + atexit.unregister(self.close) @property def pool(self): @@ -90,6 +101,7 @@ def pool(self): avoids instantiating unused threadpool for blocking clients. """ if self._pool is None: + atexit.register(self.close) self._pool = ThreadPool(self.pool_threads) return self._pool @@ -286,7 +298,7 @@ def __deserialize(self, data, klass): elif klass == datetime.date: return self.__deserialize_date(data) elif klass == datetime.datetime: - return self.__deserialize_datatime(data) + return self.__deserialize_datetime(data) else: return self.__deserialize_model(data, klass) @@ -339,18 +351,19 @@ def call_api(self, resource_path, method, response_type, auth_settings, _return_http_data_only, collection_formats, _preload_content, _request_timeout, _host) - else: - thread = self.pool.apply_async(self.__call_api, (resource_path, - method, path_params, query_params, - header_params, body, - post_params, files, - response_type, auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, - _request_timeout, - _host)) - return thread + + return self.pool.apply_async(self.__call_api, (resource_path, + method, path_params, + query_params, + header_params, body, + post_params, files, + response_type, + auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, + _request_timeout, + _host)) def request(self, method, url, query_params=None, headers=None, post_params=None, body=None, _preload_content=True, @@ -372,10 +385,8 @@ def request(self, method, url, query_params=None, headers=None, return self.rest_client.OPTIONS(url, query_params=query_params, headers=headers, - post_params=post_params, _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + _request_timeout=_request_timeout) elif method == "POST": return self.rest_client.POST(url, query_params=query_params, @@ -512,9 +523,7 @@ def update_params_for_auth(self, headers, querys, auth_settings): for auth in auth_settings: auth_setting = self.configuration.auth_settings().get(auth) if auth_setting: - if not auth_setting['value']: - continue - elif auth_setting['in'] == 'cookie': + if auth_setting['in'] == 'cookie': headers['Cookie'] = auth_setting['value'] elif auth_setting['in'] == 'header': headers[auth_setting['key']] = auth_setting['value'] @@ -578,7 +587,6 @@ def __deserialize_date(self, string): :return: date. """ try: - from dateutil.parser import parse return parse(string).date() except ImportError: return string @@ -588,7 +596,7 @@ def __deserialize_date(self, string): reason="Failed to parse `{0}` as date object".format(string) ) - def __deserialize_datatime(self, string): + def __deserialize_datetime(self, string): """Deserializes string to datetime. The string should be in iso8601 datetime format. @@ -597,7 +605,6 @@ def __deserialize_datatime(self, string): :return: datetime. """ try: - from dateutil.parser import parse return parse(string) except ImportError: return string @@ -623,11 +630,11 @@ def __deserialize_model(self, data, klass): return data kwargs = {} - if klass.openapi_types is not None: + if (data is not None and + klass.openapi_types is not None and + isinstance(data, (list, dict))): for attr, attr_type in six.iteritems(klass.openapi_types): - if (data is not None and - klass.attribute_map[attr] in data and - isinstance(data, (list, dict))): + if klass.attribute_map[attr] in data: value = data[klass.attribute_map[attr]] kwargs[attr] = self.__deserialize(value, attr_type) diff --git a/sysml_v2_api_client/configuration.py b/sysml_v2_api_client/configuration.py index 3e76663..11cd9eb 100644 --- a/sysml_v2_api_client/configuration.py +++ b/sysml_v2_api_client/configuration.py @@ -12,7 +12,6 @@ from __future__ import absolute_import -import copy import logging import multiprocessing import sys @@ -22,36 +21,86 @@ from six.moves import http_client as httplib -class TypeWithDefault(type): - def __init__(cls, name, bases, dct): - super(TypeWithDefault, cls).__init__(name, bases, dct) - cls._default = None - - def __call__(cls, **kwargs): - if cls._default is None: - cls._default = type.__call__(cls, **kwargs) - return copy.copy(cls._default) - - def set_default(cls, default): - cls._default = copy.copy(default) - - -class Configuration(six.with_metaclass(TypeWithDefault, object)): +class Configuration(object): """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. :param host: Base url - :param api_key: Dict to store API key(s) + :param api_key: Dict to store API key(s). + Each entry in the dict specifies an API key. + The dict key is the name of the security scheme in the OAS specification. + The dict value is the API key secret. :param api_key_prefix: Dict to store API prefix (e.g. Bearer) + The dict key is the name of the security scheme in the OAS specification. + The dict value is an API key prefix when generating the auth data. :param username: Username for HTTP basic authentication :param password: Password for HTTP basic authentication + :param signing_info: Configuration parameters for HTTP signature. + Must be an instance of sysml_v2_api_client.signing.HttpSigningConfiguration + + :Example: + + Given the following security scheme in the OpenAPI specification: + components: + securitySchemes: + cookieAuth: # name for the security scheme + type: apiKey + in: cookie + name: JSESSIONID # cookie name + + You can programmatically set the cookie: + conf = sysml_v2_api_client.Configuration( + api_key={'cookieAuth': 'abc123'} + api_key_prefix={'cookieAuth': 'JSESSIONID'} + ) + The following cookie will be added to the HTTP request: + Cookie: JSESSIONID abc123 + + Configure API client with HTTP basic authentication: + conf = sysml_v2_api_client.Configuration( + username='the-user', + password='the-password', + ) + + Configure API client with HTTP signature authentication. Use the 'hs2019' signature scheme, + sign the HTTP requests with the RSA-SSA-PSS signature algorithm, and set the expiration time + of the signature to 5 minutes after the signature has been created. + Note you can use the constants defined in the sysml_v2_api_client.signing module, and you can + also specify arbitrary HTTP headers to be included in the HTTP signature, except for the + 'Authorization' header, which is used to carry the signature. + + One may be tempted to sign all headers by default, but in practice it rarely works. + This is beccause explicit proxies, transparent proxies, TLS termination endpoints or + load balancers may add/modify/remove headers. Include the HTTP headers that you know + are not going to be modified in transit. + + conf = sysml_v2_api_client.Configuration( + signing_info = sysml_v2_api_client.signing.HttpSigningConfiguration( + key_id = 'my-key-id', + private_key_path = 'rsa.pem', + signing_scheme = signing.SCHEME_HS2019, + signing_algorithm = signing.ALGORITHM_RSASSA_PSS, + signed_headers = [signing.HEADER_REQUEST_TARGET, + signing.HEADER_CREATED, + signing.HEADER_EXPIRES, + signing.HEADER_HOST, + signing.HEADER_DATE, + signing.HEADER_DIGEST, + 'Content-Type', + 'Content-Length', + 'User-Agent' + ], + signature_max_validity = datetime.timedelta(minutes=5) + ) + ) """ def __init__(self, host="http://localhost", - api_key={}, api_key_prefix={}, - username="", password=""): + api_key=None, api_key_prefix=None, + username=None, password=None, + signing_info=None): """Constructor """ self.host = host @@ -61,10 +110,14 @@ def __init__(self, host="http://localhost", """Temp file folder for downloading files """ # Authentication Settings - self.api_key = api_key + self.api_key = {} + if api_key: + self.api_key = api_key """dict to store API key(s) """ - self.api_key_prefix = api_key_prefix + self.api_key_prefix = {} + if api_key_prefix: + self.api_key_prefix = api_key_prefix """dict to store API prefix (e.g. Bearer) """ self.refresh_api_key_hook = None @@ -76,6 +129,11 @@ def __init__(self, host="http://localhost", self.password = password """Password for HTTP basic authentication """ + if signing_info is not None: + signing_info.host = host + self.signing_info = signing_info + """The HTTP signing configuration + """ self.logger = {} """Logging Settings """ @@ -135,6 +193,8 @@ def __init__(self, host="http://localhost", self.retries = None """Adding retries to override urllib3 default value 3 """ + # Disable client side validation + self.client_side_validation = True @property def logger_file(self): @@ -242,8 +302,14 @@ def get_basic_auth_token(self): :return: The token for basic HTTP authentication. """ + username = "" + if self.username is not None: + username = self.username + password = "" + if self.password is not None: + password = self.password return urllib3.util.make_headers( - basic_auth=self.username + ':' + self.password + basic_auth=username + ':' + password ).get('authorization') def auth_settings(self): @@ -251,8 +317,8 @@ def auth_settings(self): :return: The Auth Settings information dict. """ - return { - } + auth = {} + return auth def to_debug_report(self): """Gets the essential information for debugging. @@ -263,7 +329,7 @@ def to_debug_report(self): "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: 1.0.0\n"\ - "SDK Package Version: 2019-09".\ + "SDK Package Version: 2020-03-rc2".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): @@ -278,41 +344,37 @@ def get_host_settings(self): } ] - def get_host_from_settings(self, index, variables={}): + def get_host_from_settings(self, index, variables=None): """Gets host URL based on the index and variables :param index: array index of the host settings :param variables: hash of variable and the corresponding value :return: URL based on host settings """ - + variables = {} if variables is None else variables servers = self.get_host_settings() - # check array index out of bound - if index < 0 or index >= len(servers): + try: + server = servers[index] + except IndexError: raise ValueError( - "Invalid index {} when selecting the host settings. Must be less than {}" # noqa: E501 - .format(index, len(servers))) + "Invalid index {0} when selecting the host settings. " + "Must be less than {1}".format(index, len(servers))) - server = servers[index] url = server['url'] - # go through variable and assign a value - for variable_name in server['variables']: - if variable_name in variables: - if variables[variable_name] in server['variables'][ - variable_name]['enum_values']: - url = url.replace("{" + variable_name + "}", - variables[variable_name]) - else: - raise ValueError( - "The variable `{}` in the host URL has invalid value {}. Must be {}." # noqa: E501 - .format( - variable_name, variables[variable_name], - server['variables'][variable_name]['enum_values'])) - else: - # use default value - url = url.replace( - "{" + variable_name + "}", - server['variables'][variable_name]['default_value']) + # go through variables and replace placeholders + for variable_name, variable in server['variables'].items(): + used_value = variables.get( + variable_name, variable['default_value']) + + if 'enum_values' in variable \ + and used_value not in variable['enum_values']: + raise ValueError( + "The variable `{0}` in the host URL has invalid value " + "{1}. Must be {2}.".format( + variable_name, variables[variable_name], + variable['enum_values'])) + + url = url.replace("{" + variable_name + "}", used_value) return url diff --git a/sysml_v2_api_client/models/__init__.py b/sysml_v2_api_client/models/__init__.py index 773e5a2..6506da9 100644 --- a/sysml_v2_api_client/models/__init__.py +++ b/sysml_v2_api_client/models/__init__.py @@ -14,9 +14,12 @@ from __future__ import absolute_import # import models into model package +from sysml_v2_api_client.models.commit import Commit from sysml_v2_api_client.models.element import Element +from sysml_v2_api_client.models.element_identity import ElementIdentity +from sysml_v2_api_client.models.element_version import ElementVersion from sysml_v2_api_client.models.error import Error from sysml_v2_api_client.models.identified import Identified from sysml_v2_api_client.models.project import Project +from sysml_v2_api_client.models.record import Record from sysml_v2_api_client.models.relationship import Relationship -from sysml_v2_api_client.models.relationship_all_of import RelationshipAllOf diff --git a/sysml_v2_api_client/models/commit.py b/sysml_v2_api_client/models/commit.py new file mode 100644 index 0000000..69a09ff --- /dev/null +++ b/sysml_v2_api_client/models/commit.py @@ -0,0 +1,204 @@ +# coding: utf-8 + +""" + SysML v2 API and Services + + REST/HTTP binding (PSM) for the SysML v2 standard API. # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + +from sysml_v2_api_client.configuration import Configuration + + +class Commit(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'type': 'str', + 'changes': 'list[ElementVersion]', + 'id': 'str', + 'previous_commit': 'Record' + } + + attribute_map = { + 'type': '@type', + 'changes': 'changes', + 'id': 'id', + 'previous_commit': 'previousCommit' + } + + def __init__(self, type=None, changes=None, id=None, previous_commit=None, local_vars_configuration=None): # noqa: E501 + """Commit - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration + + self._type = None + self._changes = None + self._id = None + self._previous_commit = None + self.discriminator = None + + if type is not None: + self.type = type + if changes is not None: + self.changes = changes + if id is not None: + self.id = id + if previous_commit is not None: + self.previous_commit = previous_commit + + @property + def type(self): + """Gets the type of this Commit. # noqa: E501 + + + :return: The type of this Commit. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this Commit. + + + :param type: The type of this Commit. # noqa: E501 + :type: str + """ + allowed_values = ["Commit"] # noqa: E501 + if self.local_vars_configuration.client_side_validation and type not in allowed_values: # noqa: E501 + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def changes(self): + """Gets the changes of this Commit. # noqa: E501 + + + :return: The changes of this Commit. # noqa: E501 + :rtype: list[ElementVersion] + """ + return self._changes + + @changes.setter + def changes(self, changes): + """Sets the changes of this Commit. + + + :param changes: The changes of this Commit. # noqa: E501 + :type: list[ElementVersion] + """ + + self._changes = changes + + @property + def id(self): + """Gets the id of this Commit. # noqa: E501 + + + :return: The id of this Commit. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this Commit. + + + :param id: The id of this Commit. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def previous_commit(self): + """Gets the previous_commit of this Commit. # noqa: E501 + + + :return: The previous_commit of this Commit. # noqa: E501 + :rtype: Record + """ + return self._previous_commit + + @previous_commit.setter + def previous_commit(self, previous_commit): + """Sets the previous_commit of this Commit. + + + :param previous_commit: The previous_commit of this Commit. # noqa: E501 + :type: Record + """ + + self._previous_commit = previous_commit + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, Commit): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, Commit): + return True + + return self.to_dict() != other.to_dict() diff --git a/sysml_v2_api_client/models/element.py b/sysml_v2_api_client/models/element.py index 9f2d472..bb8b8c3 100644 --- a/sysml_v2_api_client/models/element.py +++ b/sysml_v2_api_client/models/element.py @@ -15,6 +15,8 @@ import six +from sysml_v2_api_client.configuration import Configuration + class Element(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -32,28 +34,26 @@ class Element(object): """ openapi_types = { 'type': 'str', - 'containing_project': 'Identified', 'identifier': 'str' } attribute_map = { 'type': '@type', - 'containing_project': 'containingProject', 'identifier': 'identifier' } - def __init__(self, type=None, containing_project=None, identifier=None): # noqa: E501 + def __init__(self, type=None, identifier=None, local_vars_configuration=None): # noqa: E501 """Element - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration self._type = None - self._containing_project = None self._identifier = None self.discriminator = None if type is not None: self.type = type - if containing_project is not None: - self.containing_project = containing_project if identifier is not None: self.identifier = identifier @@ -78,27 +78,6 @@ def type(self, type): self._type = type - @property - def containing_project(self): - """Gets the containing_project of this Element. # noqa: E501 - - - :return: The containing_project of this Element. # noqa: E501 - :rtype: Identified - """ - return self._containing_project - - @containing_project.setter - def containing_project(self, containing_project): - """Sets the containing_project of this Element. - - - :param containing_project: The containing_project of this Element. # noqa: E501 - :type: Identified - """ - - self._containing_project = containing_project - @property def identifier(self): """Gets the identifier of this Element. # noqa: E501 @@ -157,8 +136,11 @@ def __eq__(self, other): if not isinstance(other, Element): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, Element): + return True + + return self.to_dict() != other.to_dict() diff --git a/sysml_v2_api_client/models/element_identity.py b/sysml_v2_api_client/models/element_identity.py new file mode 100644 index 0000000..d2a793d --- /dev/null +++ b/sysml_v2_api_client/models/element_identity.py @@ -0,0 +1,152 @@ +# coding: utf-8 + +""" + SysML v2 API and Services + + REST/HTTP binding (PSM) for the SysML v2 standard API. # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + +from sysml_v2_api_client.configuration import Configuration + + +class ElementIdentity(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'type': 'str', + 'id': 'str' + } + + attribute_map = { + 'type': '@type', + 'id': 'id' + } + + def __init__(self, type=None, id=None, local_vars_configuration=None): # noqa: E501 + """ElementIdentity - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration + + self._type = None + self._id = None + self.discriminator = None + + if type is not None: + self.type = type + if id is not None: + self.id = id + + @property + def type(self): + """Gets the type of this ElementIdentity. # noqa: E501 + + + :return: The type of this ElementIdentity. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this ElementIdentity. + + + :param type: The type of this ElementIdentity. # noqa: E501 + :type: str + """ + allowed_values = ["ElementIdentity"] # noqa: E501 + if self.local_vars_configuration.client_side_validation and type not in allowed_values: # noqa: E501 + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def id(self): + """Gets the id of this ElementIdentity. # noqa: E501 + + + :return: The id of this ElementIdentity. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this ElementIdentity. + + + :param id: The id of this ElementIdentity. # noqa: E501 + :type: str + """ + + self._id = id + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ElementIdentity): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, ElementIdentity): + return True + + return self.to_dict() != other.to_dict() diff --git a/sysml_v2_api_client/models/element_version.py b/sysml_v2_api_client/models/element_version.py new file mode 100644 index 0000000..dc2e5aa --- /dev/null +++ b/sysml_v2_api_client/models/element_version.py @@ -0,0 +1,204 @@ +# coding: utf-8 + +""" + SysML v2 API and Services + + REST/HTTP binding (PSM) for the SysML v2 standard API. # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +import pprint +import re # noqa: F401 + +import six + +from sysml_v2_api_client.configuration import Configuration + + +class ElementVersion(object): + """NOTE: This class is auto generated by OpenAPI Generator. + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + """ + Attributes: + openapi_types (dict): The key is attribute name + and the value is attribute type. + attribute_map (dict): The key is attribute name + and the value is json key in definition. + """ + openapi_types = { + 'type': 'str', + 'data': 'Element', + 'id': 'str', + 'identity': 'ElementIdentity' + } + + attribute_map = { + 'type': '@type', + 'data': 'data', + 'id': 'id', + 'identity': 'identity' + } + + def __init__(self, type=None, data=None, id=None, identity=None, local_vars_configuration=None): # noqa: E501 + """ElementVersion - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration + + self._type = None + self._data = None + self._id = None + self._identity = None + self.discriminator = None + + if type is not None: + self.type = type + if data is not None: + self.data = data + if id is not None: + self.id = id + if identity is not None: + self.identity = identity + + @property + def type(self): + """Gets the type of this ElementVersion. # noqa: E501 + + + :return: The type of this ElementVersion. # noqa: E501 + :rtype: str + """ + return self._type + + @type.setter + def type(self, type): + """Sets the type of this ElementVersion. + + + :param type: The type of this ElementVersion. # noqa: E501 + :type: str + """ + allowed_values = ["ElementVersion"] # noqa: E501 + if self.local_vars_configuration.client_side_validation and type not in allowed_values: # noqa: E501 + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) + + self._type = type + + @property + def data(self): + """Gets the data of this ElementVersion. # noqa: E501 + + + :return: The data of this ElementVersion. # noqa: E501 + :rtype: Element + """ + return self._data + + @data.setter + def data(self, data): + """Sets the data of this ElementVersion. + + + :param data: The data of this ElementVersion. # noqa: E501 + :type: Element + """ + + self._data = data + + @property + def id(self): + """Gets the id of this ElementVersion. # noqa: E501 + + + :return: The id of this ElementVersion. # noqa: E501 + :rtype: str + """ + return self._id + + @id.setter + def id(self, id): + """Sets the id of this ElementVersion. + + + :param id: The id of this ElementVersion. # noqa: E501 + :type: str + """ + + self._id = id + + @property + def identity(self): + """Gets the identity of this ElementVersion. # noqa: E501 + + + :return: The identity of this ElementVersion. # noqa: E501 + :rtype: ElementIdentity + """ + return self._identity + + @identity.setter + def identity(self, identity): + """Sets the identity of this ElementVersion. + + + :param identity: The identity of this ElementVersion. # noqa: E501 + :type: ElementIdentity + """ + + self._identity = identity + + def to_dict(self): + """Returns the model properties as a dict""" + result = {} + + for attr, _ in six.iteritems(self.openapi_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """Returns the string representation of the model""" + return pprint.pformat(self.to_dict()) + + def __repr__(self): + """For `print` and `pprint`""" + return self.to_str() + + def __eq__(self, other): + """Returns true if both objects are equal""" + if not isinstance(other, ElementVersion): + return False + + return self.to_dict() == other.to_dict() + + def __ne__(self, other): + """Returns true if both objects are not equal""" + if not isinstance(other, ElementVersion): + return True + + return self.to_dict() != other.to_dict() diff --git a/sysml_v2_api_client/models/error.py b/sysml_v2_api_client/models/error.py index 2261262..a6ab95d 100644 --- a/sysml_v2_api_client/models/error.py +++ b/sysml_v2_api_client/models/error.py @@ -15,6 +15,8 @@ import six +from sysml_v2_api_client.configuration import Configuration + class Error(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -38,8 +40,11 @@ class Error(object): 'error': 'error' } - def __init__(self, error=None): # noqa: E501 + def __init__(self, error=None, local_vars_configuration=None): # noqa: E501 """Error - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration self._error = None self.discriminator = None @@ -105,8 +110,11 @@ def __eq__(self, other): if not isinstance(other, Error): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, Error): + return True + + return self.to_dict() != other.to_dict() diff --git a/sysml_v2_api_client/models/identified.py b/sysml_v2_api_client/models/identified.py index 96afd08..1eb3802 100644 --- a/sysml_v2_api_client/models/identified.py +++ b/sysml_v2_api_client/models/identified.py @@ -15,6 +15,8 @@ import six +from sysml_v2_api_client.configuration import Configuration + class Identified(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -38,8 +40,11 @@ class Identified(object): 'identifier': 'identifier' } - def __init__(self, identifier=None): # noqa: E501 + def __init__(self, identifier=None, local_vars_configuration=None): # noqa: E501 """Identified - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration self._identifier = None self.discriminator = None @@ -105,8 +110,11 @@ def __eq__(self, other): if not isinstance(other, Identified): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, Identified): + return True + + return self.to_dict() != other.to_dict() diff --git a/sysml_v2_api_client/models/project.py b/sysml_v2_api_client/models/project.py index 78741c3..4f8e9c8 100644 --- a/sysml_v2_api_client/models/project.py +++ b/sysml_v2_api_client/models/project.py @@ -15,6 +15,8 @@ import six +from sysml_v2_api_client.configuration import Configuration + class Project(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -32,30 +34,33 @@ class Project(object): """ openapi_types = { 'type': 'str', - 'name': 'str', - 'identifier': 'str' + 'id': 'str', + 'name': 'str' } attribute_map = { 'type': '@type', - 'name': 'name', - 'identifier': 'identifier' + 'id': 'id', + 'name': 'name' } - def __init__(self, type=None, name=None, identifier=None): # noqa: E501 + def __init__(self, type=None, id=None, name=None, local_vars_configuration=None): # noqa: E501 """Project - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration self._type = None + self._id = None self._name = None - self._identifier = None self.discriminator = None if type is not None: self.type = type + if id is not None: + self.id = id if name is not None: self.name = name - if identifier is not None: - self.identifier = identifier @property def type(self): @@ -75,50 +80,56 @@ def type(self, type): :param type: The type of this Project. # noqa: E501 :type: str """ + allowed_values = ["Project"] # noqa: E501 + if self.local_vars_configuration.client_side_validation and type not in allowed_values: # noqa: E501 + raise ValueError( + "Invalid value for `type` ({0}), must be one of {1}" # noqa: E501 + .format(type, allowed_values) + ) self._type = type @property - def name(self): - """Gets the name of this Project. # noqa: E501 + def id(self): + """Gets the id of this Project. # noqa: E501 - :return: The name of this Project. # noqa: E501 + :return: The id of this Project. # noqa: E501 :rtype: str """ - return self._name + return self._id - @name.setter - def name(self, name): - """Sets the name of this Project. + @id.setter + def id(self, id): + """Sets the id of this Project. - :param name: The name of this Project. # noqa: E501 + :param id: The id of this Project. # noqa: E501 :type: str """ - self._name = name + self._id = id @property - def identifier(self): - """Gets the identifier of this Project. # noqa: E501 + def name(self): + """Gets the name of this Project. # noqa: E501 - :return: The identifier of this Project. # noqa: E501 + :return: The name of this Project. # noqa: E501 :rtype: str """ - return self._identifier + return self._name - @identifier.setter - def identifier(self, identifier): - """Sets the identifier of this Project. + @name.setter + def name(self, name): + """Sets the name of this Project. - :param identifier: The identifier of this Project. # noqa: E501 + :param name: The name of this Project. # noqa: E501 :type: str """ - self._identifier = identifier + self._name = name def to_dict(self): """Returns the model properties as a dict""" @@ -157,8 +168,11 @@ def __eq__(self, other): if not isinstance(other, Project): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, Project): + return True + + return self.to_dict() != other.to_dict() diff --git a/sysml_v2_api_client/models/relationship_all_of.py b/sysml_v2_api_client/models/record.py similarity index 56% rename from sysml_v2_api_client/models/relationship_all_of.py rename to sysml_v2_api_client/models/record.py index 64e32e0..39535be 100644 --- a/sysml_v2_api_client/models/relationship_all_of.py +++ b/sysml_v2_api_client/models/record.py @@ -15,8 +15,10 @@ import six +from sysml_v2_api_client.configuration import Configuration -class RelationshipAllOf(object): + +class Record(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech @@ -31,68 +33,45 @@ class RelationshipAllOf(object): and the value is json key in definition. """ openapi_types = { - 'source': 'list[Identified]', - 'target': 'list[Identified]' + 'id': 'str' } attribute_map = { - 'source': 'source', - 'target': 'target' + 'id': 'id' } - def __init__(self, source=None, target=None): # noqa: E501 - """RelationshipAllOf - a model defined in OpenAPI""" # noqa: E501 + def __init__(self, id=None, local_vars_configuration=None): # noqa: E501 + """Record - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration - self._source = None - self._target = None + self._id = None self.discriminator = None - if source is not None: - self.source = source - if target is not None: - self.target = target - - @property - def source(self): - """Gets the source of this RelationshipAllOf. # noqa: E501 - - - :return: The source of this RelationshipAllOf. # noqa: E501 - :rtype: list[Identified] - """ - return self._source - - @source.setter - def source(self, source): - """Sets the source of this RelationshipAllOf. - - - :param source: The source of this RelationshipAllOf. # noqa: E501 - :type: list[Identified] - """ - - self._source = source + if id is not None: + self.id = id @property - def target(self): - """Gets the target of this RelationshipAllOf. # noqa: E501 + def id(self): + """Gets the id of this Record. # noqa: E501 - :return: The target of this RelationshipAllOf. # noqa: E501 - :rtype: list[Identified] + :return: The id of this Record. # noqa: E501 + :rtype: str """ - return self._target + return self._id - @target.setter - def target(self, target): - """Sets the target of this RelationshipAllOf. + @id.setter + def id(self, id): + """Sets the id of this Record. - :param target: The target of this RelationshipAllOf. # noqa: E501 - :type: list[Identified] + :param id: The id of this Record. # noqa: E501 + :type: str """ - self._target = target + self._id = id def to_dict(self): """Returns the model properties as a dict""" @@ -128,11 +107,14 @@ def __repr__(self): def __eq__(self, other): """Returns true if both objects are equal""" - if not isinstance(other, RelationshipAllOf): + if not isinstance(other, Record): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, Record): + return True + + return self.to_dict() != other.to_dict() diff --git a/sysml_v2_api_client/models/relationship.py b/sysml_v2_api_client/models/relationship.py index 7e882b9..39b6725 100644 --- a/sysml_v2_api_client/models/relationship.py +++ b/sysml_v2_api_client/models/relationship.py @@ -15,6 +15,8 @@ import six +from sysml_v2_api_client.configuration import Configuration + class Relationship(object): """NOTE: This class is auto generated by OpenAPI Generator. @@ -32,7 +34,6 @@ class Relationship(object): """ openapi_types = { 'type': 'str', - 'containing_project': 'Identified', 'identifier': 'str', 'source': 'list[Identified]', 'target': 'list[Identified]' @@ -40,17 +41,18 @@ class Relationship(object): attribute_map = { 'type': '@type', - 'containing_project': 'containingProject', 'identifier': 'identifier', 'source': 'source', 'target': 'target' } - def __init__(self, type=None, containing_project=None, identifier=None, source=None, target=None): # noqa: E501 + def __init__(self, type=None, identifier=None, source=None, target=None, local_vars_configuration=None): # noqa: E501 """Relationship - a model defined in OpenAPI""" # noqa: E501 + if local_vars_configuration is None: + local_vars_configuration = Configuration() + self.local_vars_configuration = local_vars_configuration self._type = None - self._containing_project = None self._identifier = None self._source = None self._target = None @@ -58,8 +60,6 @@ def __init__(self, type=None, containing_project=None, identifier=None, source=N if type is not None: self.type = type - if containing_project is not None: - self.containing_project = containing_project if identifier is not None: self.identifier = identifier if source is not None: @@ -88,27 +88,6 @@ def type(self, type): self._type = type - @property - def containing_project(self): - """Gets the containing_project of this Relationship. # noqa: E501 - - - :return: The containing_project of this Relationship. # noqa: E501 - :rtype: Identified - """ - return self._containing_project - - @containing_project.setter - def containing_project(self, containing_project): - """Sets the containing_project of this Relationship. - - - :param containing_project: The containing_project of this Relationship. # noqa: E501 - :type: Identified - """ - - self._containing_project = containing_project - @property def identifier(self): """Gets the identifier of this Relationship. # noqa: E501 @@ -209,8 +188,11 @@ def __eq__(self, other): if not isinstance(other, Relationship): return False - return self.__dict__ == other.__dict__ + return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" - return not self == other + if not isinstance(other, Relationship): + return True + + return self.to_dict() != other.to_dict() diff --git a/test-requirements.txt b/test-requirements.txt index 2702246..4ed3991 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,5 +1,3 @@ -coverage>=4.0.3 -nose>=1.3.7 -pluggy>=0.3.1 -py>=1.4.31 -randomize>=0.13 +pytest~=4.6.7 # needed for python 2.7+3.4 +pytest-cov>=2.8.1 +pytest-randomly==1.2.3 # needed for python 2.7+3.4 diff --git a/test/test_commit.py b/test/test_commit.py new file mode 100644 index 0000000..bf8d57a --- /dev/null +++ b/test/test_commit.py @@ -0,0 +1,66 @@ +# coding: utf-8 + +""" + SysML v2 API and Services + + REST/HTTP binding (PSM) for the SysML v2 standard API. # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import sysml_v2_api_client +from sysml_v2_api_client.models.commit import Commit # noqa: E501 +from sysml_v2_api_client.rest import ApiException + +class TestCommit(unittest.TestCase): + """Commit unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test Commit + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = sysml_v2_api_client.models.commit.Commit() # noqa: E501 + if include_optional : + return Commit( + type = 'Commit', + changes = [ + sysml_v2_api_client.models.element_version.ElementVersion( + @type = 'ElementVersion', + data = { + 'key' : None + }, + id = '0', + identity = sysml_v2_api_client.models.element_identity.ElementIdentity( + @type = 'ElementIdentity', + id = '0', ), ) + ], + id = '0', + previous_commit = sysml_v2_api_client.models.record.Record( + id = '0', ) + ) + else : + return Commit( + ) + + def testCommit(self): + """Test Commit""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_commit_api.py b/test/test_commit_api.py new file mode 100644 index 0000000..7bcb28a --- /dev/null +++ b/test/test_commit_api.py @@ -0,0 +1,61 @@ +# coding: utf-8 + +""" + SysML v2 API and Services + + REST/HTTP binding (PSM) for the SysML v2 standard API. # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest + +import sysml_v2_api_client +from sysml_v2_api_client.api.commit_api import CommitApi # noqa: E501 +from sysml_v2_api_client.rest import ApiException + + +class TestCommitApi(unittest.TestCase): + """CommitApi unit test stubs""" + + def setUp(self): + self.api = sysml_v2_api_client.api.commit_api.CommitApi() # noqa: E501 + + def tearDown(self): + pass + + def test_get_commit_by_project_and_id(self): + """Test case for get_commit_by_project_and_id + + Get commit by project and ID # noqa: E501 + """ + pass + + def test_get_commits_by_project(self): + """Test case for get_commits_by_project + + Get commits by project # noqa: E501 + """ + pass + + def test_get_head_commit_by_project(self): + """Test case for get_head_commit_by_project + + Get head commit by project # noqa: E501 + """ + pass + + def test_post_commit_by_project(self): + """Test case for post_commit_by_project + + Create commit by project # noqa: E501 + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_element.py b/test/test_element.py index df418c9..1571c6b 100644 --- a/test/test_element.py +++ b/test/test_element.py @@ -13,12 +13,12 @@ from __future__ import absolute_import import unittest +import datetime import sysml_v2_api_client from sysml_v2_api_client.models.element import Element # noqa: E501 from sysml_v2_api_client.rest import ApiException - class TestElement(unittest.TestCase): """Element unit test stubs""" @@ -28,11 +28,25 @@ def setUp(self): def tearDown(self): pass + def make_instance(self, include_optional): + """Test Element + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = sysml_v2_api_client.models.element.Element() # noqa: E501 + if include_optional : + return Element( + type = '0', + identifier = '0' + ) + else : + return Element( + ) + def testElement(self): """Test Element""" - # FIXME: construct object with mandatory attributes with example values - # model = sysml_v2_api_client.models.element.Element() # noqa: E501 - pass + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': diff --git a/test/test_element_api.py b/test/test_element_api.py index 6d21113..e98d766 100644 --- a/test/test_element_api.py +++ b/test/test_element_api.py @@ -28,38 +28,17 @@ def setUp(self): def tearDown(self): pass - def test_create_element(self): - """Test case for create_element + def test_get_element_by_project_commit_id(self): + """Test case for get_element_by_project_commit_id - Add a new element # noqa: E501 + Get element by project, commit and ID # noqa: E501 """ pass - def test_get_element(self): - """Test case for get_element + def test_get_elements_by_project_commit(self): + """Test case for get_elements_by_project_commit - Get element by its ID # noqa: E501 - """ - pass - - def test_get_element_by_project_and_id(self): - """Test case for get_element_by_project_and_id - - Get element by project ID and its ID # noqa: E501 - """ - pass - - def test_get_elements(self): - """Test case for get_elements - - Get all elements # noqa: E501 - """ - pass - - def test_get_elements_in_project(self): - """Test case for get_elements_in_project - - Get all elements in the project # noqa: E501 + Get elements by project and commit # noqa: E501 """ pass diff --git a/test/test_element_identity.py b/test/test_element_identity.py new file mode 100644 index 0000000..026d0bb --- /dev/null +++ b/test/test_element_identity.py @@ -0,0 +1,53 @@ +# coding: utf-8 + +""" + SysML v2 API and Services + + REST/HTTP binding (PSM) for the SysML v2 standard API. # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import sysml_v2_api_client +from sysml_v2_api_client.models.element_identity import ElementIdentity # noqa: E501 +from sysml_v2_api_client.rest import ApiException + +class TestElementIdentity(unittest.TestCase): + """ElementIdentity unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test ElementIdentity + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = sysml_v2_api_client.models.element_identity.ElementIdentity() # noqa: E501 + if include_optional : + return ElementIdentity( + type = 'ElementIdentity', + id = '0' + ) + else : + return ElementIdentity( + ) + + def testElementIdentity(self): + """Test ElementIdentity""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_element_version.py b/test/test_element_version.py new file mode 100644 index 0000000..81fec14 --- /dev/null +++ b/test/test_element_version.py @@ -0,0 +1,59 @@ +# coding: utf-8 + +""" + SysML v2 API and Services + + REST/HTTP binding (PSM) for the SysML v2 standard API. # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import sysml_v2_api_client +from sysml_v2_api_client.models.element_version import ElementVersion # noqa: E501 +from sysml_v2_api_client.rest import ApiException + +class TestElementVersion(unittest.TestCase): + """ElementVersion unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test ElementVersion + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = sysml_v2_api_client.models.element_version.ElementVersion() # noqa: E501 + if include_optional : + return ElementVersion( + type = 'ElementVersion', + data = { + 'key' : None + }, + id = '0', + identity = sysml_v2_api_client.models.element_identity.ElementIdentity( + @type = 'ElementIdentity', + id = '0', ) + ) + else : + return ElementVersion( + ) + + def testElementVersion(self): + """Test ElementVersion""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_error.py b/test/test_error.py index d8573ef..075cc13 100644 --- a/test/test_error.py +++ b/test/test_error.py @@ -13,12 +13,12 @@ from __future__ import absolute_import import unittest +import datetime import sysml_v2_api_client from sysml_v2_api_client.models.error import Error # noqa: E501 from sysml_v2_api_client.rest import ApiException - class TestError(unittest.TestCase): """Error unit test stubs""" @@ -28,11 +28,24 @@ def setUp(self): def tearDown(self): pass + def make_instance(self, include_optional): + """Test Error + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = sysml_v2_api_client.models.error.Error() # noqa: E501 + if include_optional : + return Error( + error = '0' + ) + else : + return Error( + ) + def testError(self): """Test Error""" - # FIXME: construct object with mandatory attributes with example values - # model = sysml_v2_api_client.models.error.Error() # noqa: E501 - pass + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': diff --git a/test/test_identified.py b/test/test_identified.py index 6d9cdd4..16c012d 100644 --- a/test/test_identified.py +++ b/test/test_identified.py @@ -13,12 +13,12 @@ from __future__ import absolute_import import unittest +import datetime import sysml_v2_api_client from sysml_v2_api_client.models.identified import Identified # noqa: E501 from sysml_v2_api_client.rest import ApiException - class TestIdentified(unittest.TestCase): """Identified unit test stubs""" @@ -28,11 +28,24 @@ def setUp(self): def tearDown(self): pass + def make_instance(self, include_optional): + """Test Identified + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = sysml_v2_api_client.models.identified.Identified() # noqa: E501 + if include_optional : + return Identified( + identifier = '0' + ) + else : + return Identified( + ) + def testIdentified(self): """Test Identified""" - # FIXME: construct object with mandatory attributes with example values - # model = sysml_v2_api_client.models.identified.Identified() # noqa: E501 - pass + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': diff --git a/test/test_project.py b/test/test_project.py index 27aa501..3d9bb91 100644 --- a/test/test_project.py +++ b/test/test_project.py @@ -13,12 +13,12 @@ from __future__ import absolute_import import unittest +import datetime import sysml_v2_api_client from sysml_v2_api_client.models.project import Project # noqa: E501 from sysml_v2_api_client.rest import ApiException - class TestProject(unittest.TestCase): """Project unit test stubs""" @@ -28,11 +28,26 @@ def setUp(self): def tearDown(self): pass + def make_instance(self, include_optional): + """Test Project + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = sysml_v2_api_client.models.project.Project() # noqa: E501 + if include_optional : + return Project( + type = 'Project', + id = '0', + name = '0' + ) + else : + return Project( + ) + def testProject(self): """Test Project""" - # FIXME: construct object with mandatory attributes with example values - # model = sysml_v2_api_client.models.project.Project() # noqa: E501 - pass + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': diff --git a/test/test_project_api.py b/test/test_project_api.py index 4be3640..9841646 100644 --- a/test/test_project_api.py +++ b/test/test_project_api.py @@ -28,24 +28,24 @@ def setUp(self): def tearDown(self): pass - def test_create_project(self): - """Test case for create_project + def test_get_project_by_id(self): + """Test case for get_project_by_id - Add a new project # noqa: E501 + Get project by ID # noqa: E501 """ pass - def test_get_project(self): - """Test case for get_project + def test_get_projects(self): + """Test case for get_projects - Get project by its ID # noqa: E501 + Get projects # noqa: E501 """ pass - def test_get_projects(self): - """Test case for get_projects + def test_post_project(self): + """Test case for post_project - Get all projects # noqa: E501 + Create project # noqa: E501 """ pass diff --git a/test/test_record.py b/test/test_record.py new file mode 100644 index 0000000..0720767 --- /dev/null +++ b/test/test_record.py @@ -0,0 +1,52 @@ +# coding: utf-8 + +""" + SysML v2 API and Services + + REST/HTTP binding (PSM) for the SysML v2 standard API. # noqa: E501 + + The version of the OpenAPI document: 1.0.0 + Generated by: https://openapi-generator.tech +""" + + +from __future__ import absolute_import + +import unittest +import datetime + +import sysml_v2_api_client +from sysml_v2_api_client.models.record import Record # noqa: E501 +from sysml_v2_api_client.rest import ApiException + +class TestRecord(unittest.TestCase): + """Record unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional): + """Test Record + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = sysml_v2_api_client.models.record.Record() # noqa: E501 + if include_optional : + return Record( + id = '0' + ) + else : + return Record( + ) + + def testRecord(self): + """Test Record""" + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_relationship.py b/test/test_relationship.py index 8b50fa3..f365cb9 100644 --- a/test/test_relationship.py +++ b/test/test_relationship.py @@ -13,12 +13,12 @@ from __future__ import absolute_import import unittest +import datetime import sysml_v2_api_client from sysml_v2_api_client.models.relationship import Relationship # noqa: E501 from sysml_v2_api_client.rest import ApiException - class TestRelationship(unittest.TestCase): """Relationship unit test stubs""" @@ -28,11 +28,33 @@ def setUp(self): def tearDown(self): pass + def make_instance(self, include_optional): + """Test Relationship + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # model = sysml_v2_api_client.models.relationship.Relationship() # noqa: E501 + if include_optional : + return Relationship( + type = '0', + identifier = '0', + source = [ + sysml_v2_api_client.models.identified.Identified( + identifier = '0', ) + ], + target = [ + sysml_v2_api_client.models.identified.Identified( + identifier = '0', ) + ] + ) + else : + return Relationship( + ) + def testRelationship(self): """Test Relationship""" - # FIXME: construct object with mandatory attributes with example values - # model = sysml_v2_api_client.models.relationship.Relationship() # noqa: E501 - pass + inst_req_only = self.make_instance(include_optional=False) + inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': diff --git a/test/test_relationship_all_of.py b/test/test_relationship_all_of.py deleted file mode 100644 index a8081ae..0000000 --- a/test/test_relationship_all_of.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding: utf-8 - -""" - SysML v2 API and Services - - REST/HTTP binding (PSM) for the SysML v2 standard API. # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -from __future__ import absolute_import - -import unittest - -import sysml_v2_api_client -from sysml_v2_api_client.models.relationship_all_of import RelationshipAllOf # noqa: E501 -from sysml_v2_api_client.rest import ApiException - - -class TestRelationshipAllOf(unittest.TestCase): - """RelationshipAllOf unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testRelationshipAllOf(self): - """Test RelationshipAllOf""" - # FIXME: construct object with mandatory attributes with example values - # model = sysml_v2_api_client.models.relationship_all_of.RelationshipAllOf() # noqa: E501 - pass - - -if __name__ == '__main__': - unittest.main() diff --git a/test/test_relationship_api.py b/test/test_relationship_api.py index 1d7ede3..ab13ee2 100644 --- a/test/test_relationship_api.py +++ b/test/test_relationship_api.py @@ -28,31 +28,10 @@ def setUp(self): def tearDown(self): pass - def test_create_relationship(self): - """Test case for create_relationship + def test_get_relationships_by_project_commit_related_element(self): + """Test case for get_relationships_by_project_commit_related_element - Add a new relationship # noqa: E501 - """ - pass - - def test_get_relationship(self): - """Test case for get_relationship - - Get relationship by its ID # noqa: E501 - """ - pass - - def test_get_relationships(self): - """Test case for get_relationships - - Get all relationships # noqa: E501 - """ - pass - - def test_get_relationships_by_project(self): - """Test case for get_relationships_by_project - - Get all relationships in the project # noqa: E501 + Get relationships by project, commit, and related element. # noqa: E501 """ pass diff --git a/tox.ini b/tox.ini index 3d0be61..bf5c223 100644 --- a/tox.ini +++ b/tox.ini @@ -6,5 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - nosetests \ - [] + pytest --cov=sysml_v2_api_client