Added working python generator in tests

This commit is contained in:
2024-01-05 16:50:27 +01:00
parent 0c9a8349a6
commit aa664dfce1
42 changed files with 2436 additions and 21 deletions

View File

@@ -9,6 +9,24 @@ from uvicorn.importer import import_from_string
import subprocess import subprocess
import shutil import shutil
import os
import re
def replace_line_in_file(file_path: Path, pattern: str, replacement: str) -> None:
with open(file_path, 'r') as file:
content = file.read()
updated_content = re.sub(pattern, replacement, content)
with open(file_path, 'w') as file:
file.write(updated_content)
def replace_in_directory(*, directory_path: Path, pattern: str, replacement: str) -> None:
for root, dirs, files in os.walk(directory_path):
for file in files:
file_path = Path(os.path.join(root, file))
replace_line_in_file(file_path, pattern, replacement)
def main() -> None: def main() -> None:
parser = argparse.ArgumentParser(prog="gen-openapi") parser = argparse.ArgumentParser(prog="gen-openapi")
parser.add_argument( parser.add_argument(
@@ -52,12 +70,22 @@ def main() -> None:
f"{gen_code}", f"{gen_code}",
"-i", "-i",
f"{openapi_p}", f"{openapi_p}",
"--additional-properties=generateSourceCodeOnly=true"
] ]
subprocess.run(cmd, check=True, text=True) subprocess.run(cmd, check=True, text=True)
dest_client: Path = args.out / "openapi_client"
shutil.rmtree(dest_client, ignore_errors=True) src_client: Path = gen_code / "openapi_client"
shutil.copytree(gen_code / "openapi_client", dest_client) pattern = r"from typing import Any, List, Optional"
replacement = "from typing import Any, List, Optional, Dict"
replace_in_directory(directory_path=src_client, pattern=pattern, replacement=replacement)
dst_client: Path = args.out / "openapi_client"
breakpoint()
shutil.rmtree(dst_client, ignore_errors=True)
shutil.copytree(src_client, dst_client)
if __name__ == "__main__": if __name__ == "__main__":

View File

@@ -29,7 +29,7 @@ log = logging.getLogger(__name__)
# # # #
######################### #########################
@router.post("/api/v1/service", response_model=Service, tags=[Tags.services]) @router.post("/api/v1/service", response_model=Service, tags=[Tags.services])
def create_service( async def create_service(
service: ServiceCreate, db: Session = Depends(sql_db.get_db) service: ServiceCreate, db: Session = Depends(sql_db.get_db)
) -> Service: ) -> Service:
# todo checken ob schon da ... # todo checken ob schon da ...
@@ -37,7 +37,7 @@ def create_service(
@router.get("/api/v1/services", response_model=List[Service], tags=[Tags.services]) @router.get("/api/v1/services", response_model=List[Service], tags=[Tags.services])
def get_all_services( async def get_all_services(
skip: int = 0, limit: int = 100, db: Session = Depends(sql_db.get_db) skip: int = 0, limit: int = 100, db: Session = Depends(sql_db.get_db)
) -> List[sql_models.Service]: ) -> List[sql_models.Service]:
services = sql_crud.get_services(db, skip=skip, limit=limit) services = sql_crud.get_services(db, skip=skip, limit=limit)
@@ -47,7 +47,7 @@ def get_all_services(
@router.get( @router.get(
"/api/v1/{entity_did}/service", response_model=List[Service], tags=[Tags.services] "/api/v1/{entity_did}/service", response_model=List[Service], tags=[Tags.services]
) )
def get_service_by_did( async def get_service_by_did(
entity_did: str = "did:sov:test:1234", entity_did: str = "did:sov:test:1234",
skip: int = 0, skip: int = 0,
limit: int = 100, limit: int = 100,
@@ -58,7 +58,7 @@ def get_service_by_did(
@router.delete("/api/v1/{entity_did}/service", tags=[Tags.services]) @router.delete("/api/v1/{entity_did}/service", tags=[Tags.services])
def delete_service( async def delete_service(
entity_did: str = "did:sov:test:1234", entity_did: str = "did:sov:test:1234",
db: Session = Depends(sql_db.get_db), db: Session = Depends(sql_db.get_db),
) -> dict[str, str]: ) -> dict[str, str]:
@@ -74,7 +74,7 @@ def delete_service(
@router.get( @router.get(
"/api/v1/{entity_did}/clients", response_model=List[Service], tags=[Tags.clients] "/api/v1/{entity_did}/clients", response_model=List[Service], tags=[Tags.clients]
) )
def get_all_clients( async def get_all_clients(
entity_did: str = "did:sov:test:1234", entity_did: str = "did:sov:test:1234",
skip: int = 0, skip: int = 0,
limit: int = 100, limit: int = 100,
@@ -98,7 +98,7 @@ def get_all_clients(
response_model=List[Service], response_model=List[Service],
tags=[Tags.repositories], tags=[Tags.repositories],
) )
def get_all_repositories( async def get_all_repositories(
skip: int = 0, limit: int = 100, db: Session = Depends(sql_db.get_db) skip: int = 0, limit: int = 100, db: Session = Depends(sql_db.get_db)
) -> List[sql_models.Service]: ) -> List[sql_models.Service]:
repositories = sql_crud.get_services(db, skip=skip, limit=limit) repositories = sql_crud.get_services(db, skip=skip, limit=limit)
@@ -111,14 +111,14 @@ def get_all_repositories(
# # # #
######################### #########################
@router.post("/api/v1/entity", response_model=Entity, tags=[Tags.entities]) @router.post("/api/v1/entity", response_model=Entity, tags=[Tags.entities])
def create_entity( async def create_entity(
entity: EntityCreate, db: Session = Depends(sql_db.get_db) entity: EntityCreate, db: Session = Depends(sql_db.get_db)
) -> EntityCreate: ) -> EntityCreate:
return sql_crud.create_entity(db, entity) return sql_crud.create_entity(db, entity)
@router.get("/api/v1/entities", response_model=List[Entity], tags=[Tags.entities]) @router.get("/api/v1/entities", response_model=List[Entity], tags=[Tags.entities])
def get_all_entities( async def get_all_entities(
skip: int = 0, limit: int = 100, db: Session = Depends(sql_db.get_db) skip: int = 0, limit: int = 100, db: Session = Depends(sql_db.get_db)
) -> List[sql_models.Entity]: ) -> List[sql_models.Entity]:
entities = sql_crud.get_entities(db, skip=skip, limit=limit) entities = sql_crud.get_entities(db, skip=skip, limit=limit)
@@ -128,7 +128,7 @@ def get_all_entities(
@router.get( @router.get(
"/api/v1/{entity_did}/entity", response_model=Optional[Entity], tags=[Tags.entities] "/api/v1/{entity_did}/entity", response_model=Optional[Entity], tags=[Tags.entities]
) )
def get_entity_by_did( async def get_entity_by_did(
entity_did: str = "did:sov:test:1234", entity_did: str = "did:sov:test:1234",
db: Session = Depends(sql_db.get_db), db: Session = Depends(sql_db.get_db),
) -> Optional[sql_models.Entity]: ) -> Optional[sql_models.Entity]:
@@ -141,7 +141,7 @@ def get_entity_by_did(
response_model=List[Entity], response_model=List[Entity],
tags=[Tags.entities], tags=[Tags.entities],
) )
def get_attached_entities( async def get_attached_entities(
skip: int = 0, limit: int = 100, db: Session = Depends(sql_db.get_db) skip: int = 0, limit: int = 100, db: Session = Depends(sql_db.get_db)
) -> List[sql_models.Entity]: ) -> List[sql_models.Entity]:
entities = sql_crud.get_attached_entities(db, skip=skip, limit=limit) entities = sql_crud.get_attached_entities(db, skip=skip, limit=limit)
@@ -196,7 +196,7 @@ def attach_entity_loc(db: Session, entity_did: str) -> None:
@router.delete("/api/v1/{entity_did}/entity", tags=[Tags.entities]) @router.delete("/api/v1/{entity_did}/entity", tags=[Tags.entities])
def delete_entity( async def delete_entity(
entity_did: str = "did:sov:test:1234", entity_did: str = "did:sov:test:1234",
db: Session = Depends(sql_db.get_db), db: Session = Depends(sql_db.get_db),
) -> dict[str, str]: ) -> dict[str, str]:
@@ -214,7 +214,7 @@ def delete_entity(
@router.get( @router.get(
"/api/v1/resolutions", response_model=List[Resolution], tags=[Tags.resolutions] "/api/v1/resolutions", response_model=List[Resolution], tags=[Tags.resolutions]
) )
def get_all_resolutions( async def get_all_resolutions(
skip: int = 0, limit: int = 100, db: Session = Depends(sql_db.get_db) skip: int = 0, limit: int = 100, db: Session = Depends(sql_db.get_db)
) -> List[Resolution]: ) -> List[Resolution]:
# TODO: Get resolutions from DLG entity # TODO: Get resolutions from DLG entity

View File

@@ -36,8 +36,10 @@
, mypy , mypy
, sqlalchemy , sqlalchemy
, websockets , websockets
, deal
, broadcaster , broadcaster
, aenum
, dateutil
, urllib3
}: }:
let let
@@ -48,7 +50,6 @@ let
sqlalchemy sqlalchemy
websockets websockets
broadcaster broadcaster
deal
]; ];
pytestDependencies = runtimeDependencies ++ dependencies ++ [ pytestDependencies = runtimeDependencies ++ dependencies ++ [
@@ -63,6 +64,10 @@ let
git git
gnupg gnupg
stdenv.cc stdenv.cc
# openapi client deps
dateutil
aenum
urllib3
]; ];
# Optional dependencies for clan cli, we re-expose them here to make sure they all build. # Optional dependencies for clan cli, we re-expose them here to make sure they all build.

View File

@@ -8,7 +8,6 @@
clan-cli = pkgs.python3.pkgs.callPackage ./default.nix { clan-cli = pkgs.python3.pkgs.callPackage ./default.nix {
inherit (self'.packages) ui-assets; inherit (self'.packages) ui-assets;
inherit (inputs) nixpkgs; inherit (inputs) nixpkgs;
inherit (inputs.nixpkgs-for-iosl.legacyPackages.${system}.python3Packages) deal;
inherit (inputs.nixpkgs-for-iosl.legacyPackages.${system}.python3Packages) broadcaster; inherit (inputs.nixpkgs-for-iosl.legacyPackages.${system}.python3Packages) broadcaster;
}; };
inherit (self'.packages.clan-cli) clan-openapi; inherit (self'.packages.clan-cli) clan-openapi;

View File

@@ -34,6 +34,7 @@ no_implicit_optional = true
exclude = [ exclude = [
"clan_cli.nixpkgs", "clan_cli.nixpkgs",
"tests/openapi_client", "tests/openapi_client",
"openapi_client",
] ]
[[tool.mypy.overrides]] [[tool.mypy.overrides]]

View File

@@ -1,9 +1,60 @@
import sys
import time
import urllib.request
from multiprocessing import Process
from typing import Generator
from urllib.error import URLError
import pytest import pytest
import uvicorn
from fastapi.testclient import TestClient from fastapi.testclient import TestClient
from openapi_client import ApiClient, Configuration
from clan_cli.webui.app import app from clan_cli.webui.app import app
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def api() -> TestClient: def test_client() -> TestClient:
return TestClient(app) return TestClient(app)
def get_health(*, url: str, max_retries: int = 20, delay: float = 0.2) -> str | None:
for attempt in range(max_retries):
try:
with urllib.request.urlopen(url) as response:
return response.read()
except URLError as e:
print(f"Attempt {attempt + 1} failed: {e.reason}", file=sys.stderr)
time.sleep(delay)
return None
# Pytest fixture to run the server in a separate process
@pytest.fixture(scope="session")
def server_url() -> Generator[str, None, None]:
port = 8000
host = "127.0.0.1"
proc = Process(
target=uvicorn.run,
args=(app,),
kwargs={"host": host, "port": port, "log_level": "info"},
daemon=True,
)
proc.start()
url = f"http://{host}:{port}"
res = get_health(url=url + "/health")
if res is None:
raise Exception(f"Couldn't reach {url} after starting server")
yield url
proc.terminate()
@pytest.fixture(scope="session")
def api_client(server_url: str) -> Generator[ApiClient, None, None]:
configuration = Configuration(host=server_url)
# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
yield api_client

View File

@@ -20,7 +20,7 @@ from pydantic import validate_arguments, ValidationError
from pydantic import StrictInt, StrictStr from pydantic import StrictInt, StrictStr
from typing import Any, List, Optional from typing import Any, List, Optional, Dict
from openapi_client.models.entity import Entity from openapi_client.models.entity import Entity
from openapi_client.models.entity_create import EntityCreate from openapi_client.models.entity_create import EntityCreate

View File

@@ -20,7 +20,7 @@ from pydantic import validate_arguments, ValidationError
from pydantic import StrictInt, StrictStr from pydantic import StrictInt, StrictStr
from typing import Any, List, Optional from typing import Any, List, Optional, Dict
from openapi_client.models.service import Service from openapi_client.models.service import Service
from openapi_client.models.service_create import ServiceCreate from openapi_client.models.service_create import ServiceCreate

View File

@@ -0,0 +1,77 @@
# openapi_client.ClientsApi
All URIs are relative to _http://localhost_
| Method | HTTP request | Description |
| ---------------------------------------------------- | ------------------------------------ | --------------- |
| [**get_all_clients**](ClientsApi.md#get_all_clients) | **GET** /api/v1/{entity_did}/clients | Get All Clients |
# **get_all_clients**
> List[Service] get_all_clients(entity_did, skip=skip, limit=limit)
Get All Clients
### Example
```python
import time
import os
import openapi_client
from openapi_client.models.service import Service
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.ClientsApi(api_client)
entity_did = 'entity_did_example' # str |
skip = 0 # int | (optional) (default to 0)
limit = 100 # int | (optional) (default to 100)
try:
# Get All Clients
api_response = api_instance.get_all_clients(entity_did, skip=skip, limit=limit)
print("The response of ClientsApi->get_all_clients:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ClientsApi->get_all_clients: %s\n" % e)
```
### Parameters
| Name | Type | Description | Notes |
| -------------- | ------- | ----------- | --------------------------- |
| **entity_did** | **str** | |
| **skip** | **int** | | [optional] [default to 0] |
| **limit** | **int** | | [optional] [default to 100] |
### Return type
[**List[Service]**](Service.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
| ----------- | ------------------- | ---------------- |
| **200** | Successful Response | - |
| **422** | Validation Error | - |
[[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)

View File

@@ -0,0 +1,193 @@
# openapi_client.DefaultApi
All URIs are relative to _http://localhost_
| Method | HTTP request | Description |
| ---------------------------------- | -------------------- | ----------- |
| [**get**](DefaultApi.md#get) | **GET** /ws2_example | Get |
| [**health**](DefaultApi.md#health) | **GET** /health | Health |
| [**root**](DefaultApi.md#root) | **GET** /{path_name} | Root |
# **get**
> get()
Get
### Example
```python
import time
import os
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.DefaultApi(api_client)
try:
# Get
api_instance.get()
except Exception as e:
print("Exception when calling DefaultApi->get: %s\n" % e)
```
### Parameters
This endpoint does not need any parameter.
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
| ----------- | ------------------- | ---------------- |
| **200** | Successful 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)
# **health**
> Machine health()
Health
### Example
```python
import time
import os
import openapi_client
from openapi_client.models.machine import Machine
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.DefaultApi(api_client)
try:
# Health
api_response = api_instance.health()
print("The response of DefaultApi->health:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DefaultApi->health: %s\n" % e)
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**Machine**](Machine.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
| ----------- | ------------------- | ---------------- |
| **200** | Successful 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)
# **root**
> root(path_name)
Root
### Example
```python
import time
import os
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.DefaultApi(api_client)
path_name = 'path_name_example' # str |
try:
# Root
api_instance.root(path_name)
except Exception as e:
print("Exception when calling DefaultApi->root: %s\n" % e)
```
### Parameters
| Name | Type | Description | Notes |
| ------------- | ------- | ----------- | ----- |
| **path_name** | **str** | |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
| ----------- | ------------------- | ---------------- |
| **200** | Successful Response | - |
| **422** | Validation Error | - |
[[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)

View File

@@ -0,0 +1,486 @@
# openapi_client.EntitiesApi
All URIs are relative to _http://localhost_
| Method | HTTP request | Description |
| ----------------------------------------------------------------- | -------------------------------------- | --------------------- |
| [**attach_entity**](EntitiesApi.md#attach_entity) | **POST** /api/v1/{entity_did}/attach | Attach Entity |
| [**create_entity**](EntitiesApi.md#create_entity) | **POST** /api/v1/entity | Create Entity |
| [**delete_entity**](EntitiesApi.md#delete_entity) | **DELETE** /api/v1/{entity_did}/entity | Delete Entity |
| [**detach_entity**](EntitiesApi.md#detach_entity) | **POST** /api/v1/{entity_did}/detach | Detach Entity |
| [**get_all_entities**](EntitiesApi.md#get_all_entities) | **GET** /api/v1/entities | Get All Entities |
| [**get_attached_entities**](EntitiesApi.md#get_attached_entities) | **GET** /api/v1/attached_entities | Get Attached Entities |
| [**get_entity_by_did**](EntitiesApi.md#get_entity_by_did) | **GET** /api/v1/{entity_did}/entity | Get Entity By Did |
# **attach_entity**
> Dict[str, str] attach_entity(entity_did, skip=skip, limit=limit)
Attach Entity
### Example
```python
import time
import os
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.EntitiesApi(api_client)
entity_did = 'entity_did_example' # str |
skip = 0 # int | (optional) (default to 0)
limit = 100 # int | (optional) (default to 100)
try:
# Attach Entity
api_response = api_instance.attach_entity(entity_did, skip=skip, limit=limit)
print("The response of EntitiesApi->attach_entity:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling EntitiesApi->attach_entity: %s\n" % e)
```
### Parameters
| Name | Type | Description | Notes |
| -------------- | ------- | ----------- | --------------------------- |
| **entity_did** | **str** | |
| **skip** | **int** | | [optional] [default to 0] |
| **limit** | **int** | | [optional] [default to 100] |
### Return type
**Dict[str, str]**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
| ----------- | ------------------- | ---------------- |
| **200** | Successful Response | - |
| **422** | Validation Error | - |
[[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)
# **create_entity**
> Entity create_entity(entity_create)
Create Entity
### Example
```python
import time
import os
import openapi_client
from openapi_client.models.entity import Entity
from openapi_client.models.entity_create import EntityCreate
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.EntitiesApi(api_client)
entity_create = openapi_client.EntityCreate() # EntityCreate |
try:
# Create Entity
api_response = api_instance.create_entity(entity_create)
print("The response of EntitiesApi->create_entity:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling EntitiesApi->create_entity: %s\n" % e)
```
### Parameters
| Name | Type | Description | Notes |
| ----------------- | ----------------------------------- | ----------- | ----- |
| **entity_create** | [**EntityCreate**](EntityCreate.md) | |
### Return type
[**Entity**](Entity.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
| ----------- | ------------------- | ---------------- |
| **200** | Successful Response | - |
| **422** | Validation Error | - |
[[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)
# **delete_entity**
> Dict[str, str] delete_entity(entity_did)
Delete Entity
### Example
```python
import time
import os
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.EntitiesApi(api_client)
entity_did = 'entity_did_example' # str |
try:
# Delete Entity
api_response = api_instance.delete_entity(entity_did)
print("The response of EntitiesApi->delete_entity:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling EntitiesApi->delete_entity: %s\n" % e)
```
### Parameters
| Name | Type | Description | Notes |
| -------------- | ------- | ----------- | ----- |
| **entity_did** | **str** | |
### Return type
**Dict[str, str]**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
| ----------- | ------------------- | ---------------- |
| **200** | Successful Response | - |
| **422** | Validation Error | - |
[[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)
# **detach_entity**
> Entity detach_entity(entity_did, skip=skip, limit=limit)
Detach Entity
### Example
```python
import time
import os
import openapi_client
from openapi_client.models.entity import Entity
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.EntitiesApi(api_client)
entity_did = 'entity_did_example' # str |
skip = 0 # int | (optional) (default to 0)
limit = 100 # int | (optional) (default to 100)
try:
# Detach Entity
api_response = api_instance.detach_entity(entity_did, skip=skip, limit=limit)
print("The response of EntitiesApi->detach_entity:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling EntitiesApi->detach_entity: %s\n" % e)
```
### Parameters
| Name | Type | Description | Notes |
| -------------- | ------- | ----------- | --------------------------- |
| **entity_did** | **str** | |
| **skip** | **int** | | [optional] [default to 0] |
| **limit** | **int** | | [optional] [default to 100] |
### Return type
[**Entity**](Entity.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
| ----------- | ------------------- | ---------------- |
| **200** | Successful Response | - |
| **422** | Validation Error | - |
[[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_all_entities**
> List[Entity] get_all_entities(skip=skip, limit=limit)
Get All Entities
### Example
```python
import time
import os
import openapi_client
from openapi_client.models.entity import Entity
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.EntitiesApi(api_client)
skip = 0 # int | (optional) (default to 0)
limit = 100 # int | (optional) (default to 100)
try:
# Get All Entities
api_response = api_instance.get_all_entities(skip=skip, limit=limit)
print("The response of EntitiesApi->get_all_entities:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling EntitiesApi->get_all_entities: %s\n" % e)
```
### Parameters
| Name | Type | Description | Notes |
| --------- | ------- | ----------- | --------------------------- |
| **skip** | **int** | | [optional] [default to 0] |
| **limit** | **int** | | [optional] [default to 100] |
### Return type
[**List[Entity]**](Entity.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
| ----------- | ------------------- | ---------------- |
| **200** | Successful Response | - |
| **422** | Validation Error | - |
[[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_attached_entities**
> List[Entity] get_attached_entities(skip=skip, limit=limit)
Get Attached Entities
### Example
```python
import time
import os
import openapi_client
from openapi_client.models.entity import Entity
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.EntitiesApi(api_client)
skip = 0 # int | (optional) (default to 0)
limit = 100 # int | (optional) (default to 100)
try:
# Get Attached Entities
api_response = api_instance.get_attached_entities(skip=skip, limit=limit)
print("The response of EntitiesApi->get_attached_entities:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling EntitiesApi->get_attached_entities: %s\n" % e)
```
### Parameters
| Name | Type | Description | Notes |
| --------- | ------- | ----------- | --------------------------- |
| **skip** | **int** | | [optional] [default to 0] |
| **limit** | **int** | | [optional] [default to 100] |
### Return type
[**List[Entity]**](Entity.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
| ----------- | ------------------- | ---------------- |
| **200** | Successful Response | - |
| **422** | Validation Error | - |
[[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_entity_by_did**
> Entity get_entity_by_did(entity_did)
Get Entity By Did
### Example
```python
import time
import os
import openapi_client
from openapi_client.models.entity import Entity
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.EntitiesApi(api_client)
entity_did = 'entity_did_example' # str |
try:
# Get Entity By Did
api_response = api_instance.get_entity_by_did(entity_did)
print("The response of EntitiesApi->get_entity_by_did:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling EntitiesApi->get_entity_by_did: %s\n" % e)
```
### Parameters
| Name | Type | Description | Notes |
| -------------- | ------- | ----------- | ----- |
| **entity_did** | **str** | |
### Return type
[**Entity**](Entity.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
| ----------- | ------------------- | ---------------- |
| **200** | Successful Response | - |
| **422** | Validation Error | - |
[[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)

View File

@@ -0,0 +1,32 @@
# Entity
## Properties
| Name | Type | Description | Notes |
| ------------ | ---------- | ----------- | ------------------------------------------- |
| **did** | **str** | | [optional] [default to 'did:sov:test:1234'] |
| **name** | **str** | | [optional] [default to 'C1'] |
| **ip** | **str** | | [optional] [default to '127.0.0.1'] |
| **visible** | **bool** | | [optional] [default to True] |
| **other** | **object** | | [optional] |
| **attached** | **bool** | |
## Example
```python
from openapi_client.models.entity import Entity
# TODO update the JSON string below
json = "{}"
# create an instance of Entity from a JSON string
entity_instance = Entity.from_json(json)
# print the JSON string representation of the object
print Entity.to_json()
# convert the object into a dict
entity_dict = entity_instance.to_dict()
# create an instance of Entity from a dict
entity_form_dict = entity.from_dict(entity_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,31 @@
# EntityCreate
## Properties
| Name | Type | Description | Notes |
| ----------- | ---------- | ----------- | ------------------------------------------- |
| **did** | **str** | | [optional] [default to 'did:sov:test:1234'] |
| **name** | **str** | | [optional] [default to 'C1'] |
| **ip** | **str** | | [optional] [default to '127.0.0.1'] |
| **visible** | **bool** | | [optional] [default to True] |
| **other** | **object** | | [optional] |
## Example
```python
from openapi_client.models.entity_create import EntityCreate
# TODO update the JSON string below
json = "{}"
# create an instance of EntityCreate from a JSON string
entity_create_instance = EntityCreate.from_json(json)
# print the JSON string representation of the object
print EntityCreate.to_json()
# convert the object into a dict
entity_create_dict = entity_create_instance.to_dict()
# create an instance of EntityCreate from a dict
entity_create_form_dict = entity_create.from_dict(entity_create_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,27 @@
# HTTPValidationError
## Properties
| Name | Type | Description | Notes |
| ---------- | ----------------------------------------------- | ----------- | ---------- |
| **detail** | [**List[ValidationError]**](ValidationError.md) | | [optional] |
## Example
```python
from openapi_client.models.http_validation_error import HTTPValidationError
# TODO update the JSON string below
json = "{}"
# create an instance of HTTPValidationError from a JSON string
http_validation_error_instance = HTTPValidationError.from_json(json)
# print the JSON string representation of the object
print HTTPValidationError.to_json()
# convert the object into a dict
http_validation_error_dict = http_validation_error_instance.to_dict()
# create an instance of HTTPValidationError from a dict
http_validation_error_form_dict = http_validation_error.from_dict(http_validation_error_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,28 @@
# Machine
## Properties
| Name | Type | Description | Notes |
| ---------- | ----------------------- | ----------- | ----- |
| **name** | **str** | |
| **status** | [**Status**](Status.md) | |
## Example
```python
from openapi_client.models.machine import Machine
# TODO update the JSON string below
json = "{}"
# create an instance of Machine from a JSON string
machine_instance = Machine.from_json(json)
# print the JSON string representation of the object
print Machine.to_json()
# convert the object into a dict
machine_dict = machine_instance.to_dict()
# create an instance of Machine from a dict
machine_form_dict = machine.from_dict(machine_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,75 @@
# openapi_client.RepositoriesApi
All URIs are relative to _http://localhost_
| Method | HTTP request | Description |
| ------------------------------------------------------------------- | ---------------------------- | -------------------- |
| [**get_all_repositories**](RepositoriesApi.md#get_all_repositories) | **GET** /api/v1/repositories | Get All Repositories |
# **get_all_repositories**
> List[Service] get_all_repositories(skip=skip, limit=limit)
Get All Repositories
### Example
```python
import time
import os
import openapi_client
from openapi_client.models.service import Service
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.RepositoriesApi(api_client)
skip = 0 # int | (optional) (default to 0)
limit = 100 # int | (optional) (default to 100)
try:
# Get All Repositories
api_response = api_instance.get_all_repositories(skip=skip, limit=limit)
print("The response of RepositoriesApi->get_all_repositories:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling RepositoriesApi->get_all_repositories: %s\n" % e)
```
### Parameters
| Name | Type | Description | Notes |
| --------- | ------- | ----------- | --------------------------- |
| **skip** | **int** | | [optional] [default to 0] |
| **limit** | **int** | | [optional] [default to 100] |
### Return type
[**List[Service]**](Service.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
| ----------- | ------------------- | ---------------- |
| **200** | Successful Response | - |
| **422** | Validation Error | - |
[[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)

View File

@@ -0,0 +1,32 @@
# Resolution
## Properties
| Name | Type | Description | Notes |
| ------------------ | ------------ | ----------- | ------------------------------------------- |
| **requester_name** | **str** | | [optional] [default to 'C1'] |
| **requester_did** | **str** | | [optional] [default to 'did:sov:test:1122'] |
| **resolved_did** | **str** | | [optional] [default to 'did:sov:test:1234'] |
| **other** | **object** | | [optional] |
| **timestamp** | **datetime** | |
| **id** | **int** | |
## Example
```python
from openapi_client.models.resolution import Resolution
# TODO update the JSON string below
json = "{}"
# create an instance of Resolution from a JSON string
resolution_instance = Resolution.from_json(json)
# print the JSON string representation of the object
print Resolution.to_json()
# convert the object into a dict
resolution_dict = resolution_instance.to_dict()
# create an instance of Resolution from a dict
resolution_form_dict = resolution.from_dict(resolution_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,75 @@
# openapi_client.ResolutionApi
All URIs are relative to _http://localhost_
| Method | HTTP request | Description |
| --------------------------------------------------------------- | --------------------------- | ------------------- |
| [**get_all_resolutions**](ResolutionApi.md#get_all_resolutions) | **GET** /api/v1/resolutions | Get All Resolutions |
# **get_all_resolutions**
> List[Resolution] get_all_resolutions(skip=skip, limit=limit)
Get All Resolutions
### Example
```python
import time
import os
import openapi_client
from openapi_client.models.resolution import Resolution
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.ResolutionApi(api_client)
skip = 0 # int | (optional) (default to 0)
limit = 100 # int | (optional) (default to 100)
try:
# Get All Resolutions
api_response = api_instance.get_all_resolutions(skip=skip, limit=limit)
print("The response of ResolutionApi->get_all_resolutions:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ResolutionApi->get_all_resolutions: %s\n" % e)
```
### Parameters
| Name | Type | Description | Notes |
| --------- | ------- | ----------- | --------------------------- |
| **skip** | **int** | | [optional] [default to 0] |
| **limit** | **int** | | [optional] [default to 100] |
### Return type
[**List[Resolution]**](Resolution.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
| ----------- | ------------------- | ---------------- |
| **200** | Successful Response | - |
| **422** | Validation Error | - |
[[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)

View File

@@ -0,0 +1,33 @@
# Service
## Properties
| Name | Type | Description | Notes |
| ---------------- | ---------- | ----------- | -------------------------------------------------------------- |
| **uuid** | **str** | | [optional] [default to '8e285c0c-4e40-430a-a477-26b3b81e30df'] |
| **service_name** | **str** | | [optional] [default to 'Carlos Printing'] |
| **service_type** | **str** | | [optional] [default to '3D Printing'] |
| **endpoint_url** | **str** | | [optional] [default to 'http://127.0.0.1:8000'] |
| **status** | **str** | | [optional] [default to 'unknown'] |
| **other** | **object** | | [optional] |
| **entity_did** | **str** | | [optional] [default to 'did:sov:test:1234'] |
## Example
```python
from openapi_client.models.service import Service
# TODO update the JSON string below
json = "{}"
# create an instance of Service from a JSON string
service_instance = Service.from_json(json)
# print the JSON string representation of the object
print Service.to_json()
# convert the object into a dict
service_dict = service_instance.to_dict()
# create an instance of Service from a dict
service_form_dict = service.from_dict(service_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,33 @@
# ServiceCreate
## Properties
| Name | Type | Description | Notes |
| ---------------- | ---------- | ----------- | -------------------------------------------------------------- |
| **uuid** | **str** | | [optional] [default to '8e285c0c-4e40-430a-a477-26b3b81e30df'] |
| **service_name** | **str** | | [optional] [default to 'Carlos Printing'] |
| **service_type** | **str** | | [optional] [default to '3D Printing'] |
| **endpoint_url** | **str** | | [optional] [default to 'http://127.0.0.1:8000'] |
| **status** | **str** | | [optional] [default to 'unknown'] |
| **other** | **object** | | [optional] |
| **entity_did** | **str** | | [optional] [default to 'did:sov:test:1234'] |
## Example
```python
from openapi_client.models.service_create import ServiceCreate
# TODO update the JSON string below
json = "{}"
# create an instance of ServiceCreate from a JSON string
service_create_instance = ServiceCreate.from_json(json)
# print the JSON string representation of the object
print ServiceCreate.to_json()
# convert the object into a dict
service_create_dict = service_create_instance.to_dict()
# create an instance of ServiceCreate from a dict
service_create_form_dict = service_create.from_dict(service_create_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,280 @@
# openapi_client.ServicesApi
All URIs are relative to _http://localhost_
| Method | HTTP request | Description |
| ----------------------------------------------------------- | --------------------------------------- | ------------------ |
| [**create_service**](ServicesApi.md#create_service) | **POST** /api/v1/service | Create Service |
| [**delete_service**](ServicesApi.md#delete_service) | **DELETE** /api/v1/{entity_did}/service | Delete Service |
| [**get_all_services**](ServicesApi.md#get_all_services) | **GET** /api/v1/services | Get All Services |
| [**get_service_by_did**](ServicesApi.md#get_service_by_did) | **GET** /api/v1/{entity_did}/service | Get Service By Did |
# **create_service**
> Service create_service(service_create)
Create Service
### Example
```python
import time
import os
import openapi_client
from openapi_client.models.service import Service
from openapi_client.models.service_create import ServiceCreate
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.ServicesApi(api_client)
service_create = openapi_client.ServiceCreate() # ServiceCreate |
try:
# Create Service
api_response = api_instance.create_service(service_create)
print("The response of ServicesApi->create_service:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ServicesApi->create_service: %s\n" % e)
```
### Parameters
| Name | Type | Description | Notes |
| ------------------ | ------------------------------------- | ----------- | ----- |
| **service_create** | [**ServiceCreate**](ServiceCreate.md) | |
### Return type
[**Service**](Service.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
| ----------- | ------------------- | ---------------- |
| **200** | Successful Response | - |
| **422** | Validation Error | - |
[[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)
# **delete_service**
> Dict[str, str] delete_service(entity_did)
Delete Service
### Example
```python
import time
import os
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.ServicesApi(api_client)
entity_did = 'entity_did_example' # str |
try:
# Delete Service
api_response = api_instance.delete_service(entity_did)
print("The response of ServicesApi->delete_service:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ServicesApi->delete_service: %s\n" % e)
```
### Parameters
| Name | Type | Description | Notes |
| -------------- | ------- | ----------- | ----- |
| **entity_did** | **str** | |
### Return type
**Dict[str, str]**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
| ----------- | ------------------- | ---------------- |
| **200** | Successful Response | - |
| **422** | Validation Error | - |
[[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_all_services**
> List[Service] get_all_services(skip=skip, limit=limit)
Get All Services
### Example
```python
import time
import os
import openapi_client
from openapi_client.models.service import Service
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.ServicesApi(api_client)
skip = 0 # int | (optional) (default to 0)
limit = 100 # int | (optional) (default to 100)
try:
# Get All Services
api_response = api_instance.get_all_services(skip=skip, limit=limit)
print("The response of ServicesApi->get_all_services:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ServicesApi->get_all_services: %s\n" % e)
```
### Parameters
| Name | Type | Description | Notes |
| --------- | ------- | ----------- | --------------------------- |
| **skip** | **int** | | [optional] [default to 0] |
| **limit** | **int** | | [optional] [default to 100] |
### Return type
[**List[Service]**](Service.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
| ----------- | ------------------- | ---------------- |
| **200** | Successful Response | - |
| **422** | Validation Error | - |
[[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_service_by_did**
> List[Service] get_service_by_did(entity_did, skip=skip, limit=limit)
Get Service By Did
### Example
```python
import time
import os
import openapi_client
from openapi_client.models.service import Service
from openapi_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
host = "http://localhost"
)
# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = openapi_client.ServicesApi(api_client)
entity_did = 'entity_did_example' # str |
skip = 0 # int | (optional) (default to 0)
limit = 100 # int | (optional) (default to 100)
try:
# Get Service By Did
api_response = api_instance.get_service_by_did(entity_did, skip=skip, limit=limit)
print("The response of ServicesApi->get_service_by_did:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ServicesApi->get_service_by_did: %s\n" % e)
```
### Parameters
| Name | Type | Description | Notes |
| -------------- | ------- | ----------- | --------------------------- |
| **entity_did** | **str** | |
| **skip** | **int** | | [optional] [default to 0] |
| **limit** | **int** | | [optional] [default to 100] |
### Return type
[**List[Service]**](Service.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
| ----------- | ------------------- | ---------------- |
| **200** | Successful Response | - |
| **422** | Validation Error | - |
[[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)

View File

@@ -0,0 +1,10 @@
# Status
An enumeration.
## Properties
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,29 @@
# ValidationError
## Properties
| Name | Type | Description | Notes |
| -------- | --------------------------------------------------------------- | ----------- | ----- |
| **loc** | [**List[ValidationErrorLocInner]**](ValidationErrorLocInner.md) | |
| **msg** | **str** | |
| **type** | **str** | |
## Example
```python
from openapi_client.models.validation_error import ValidationError
# TODO update the JSON string below
json = "{}"
# create an instance of ValidationError from a JSON string
validation_error_instance = ValidationError.from_json(json)
# print the JSON string representation of the object
print ValidationError.to_json()
# convert the object into a dict
validation_error_dict = validation_error_instance.to_dict()
# create an instance of ValidationError from a dict
validation_error_form_dict = validation_error.from_dict(validation_error_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,26 @@
# ValidationErrorLocInner
## Properties
| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
## Example
```python
from openapi_client.models.validation_error_loc_inner import ValidationErrorLocInner
# TODO update the JSON string below
json = "{}"
# create an instance of ValidationErrorLocInner from a JSON string
validation_error_loc_inner_instance = ValidationErrorLocInner.from_json(json)
# print the JSON string representation of the object
print ValidationErrorLocInner.to_json()
# convert the object into a dict
validation_error_loc_inner_dict = validation_error_loc_inner_instance.to_dict()
# create an instance of ValidationErrorLocInner from a dict
validation_error_loc_inner_form_dict = validation_error_loc_inner.from_dict(validation_error_loc_inner_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,38 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
from openapi_client.api.clients_api import ClientsApi # noqa: E501
class TestClientsApi(unittest.TestCase):
"""ClientsApi unit test stubs"""
def setUp(self) -> None:
self.api = ClientsApi() # noqa: E501
def tearDown(self) -> None:
pass
def test_get_all_clients(self) -> None:
"""Test case for get_all_clients
Get All Clients # noqa: E501
"""
pass
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,52 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
from openapi_client.api.default_api import DefaultApi # noqa: E501
class TestDefaultApi(unittest.TestCase):
"""DefaultApi unit test stubs"""
def setUp(self) -> None:
self.api = DefaultApi() # noqa: E501
def tearDown(self) -> None:
pass
def test_get(self) -> None:
"""Test case for get
Get # noqa: E501
"""
pass
def test_health(self) -> None:
"""Test case for health
Health # noqa: E501
"""
pass
def test_root(self) -> None:
"""Test case for root
Root # noqa: E501
"""
pass
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,80 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
from openapi_client.api.entities_api import EntitiesApi # noqa: E501
class TestEntitiesApi(unittest.TestCase):
"""EntitiesApi unit test stubs"""
def setUp(self) -> None:
self.api = EntitiesApi() # noqa: E501
def tearDown(self) -> None:
pass
def test_attach_entity(self) -> None:
"""Test case for attach_entity
Attach Entity # noqa: E501
"""
pass
def test_create_entity(self) -> None:
"""Test case for create_entity
Create Entity # noqa: E501
"""
pass
def test_delete_entity(self) -> None:
"""Test case for delete_entity
Delete Entity # noqa: E501
"""
pass
def test_detach_entity(self) -> None:
"""Test case for detach_entity
Detach Entity # noqa: E501
"""
pass
def test_get_all_entities(self) -> None:
"""Test case for get_all_entities
Get All Entities # noqa: E501
"""
pass
def test_get_attached_entities(self) -> None:
"""Test case for get_attached_entities
Get Attached Entities # noqa: E501
"""
pass
def test_get_entity_by_did(self) -> None:
"""Test case for get_entity_by_did
Get Entity By Did # noqa: E501
"""
pass
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,58 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
import datetime
from openapi_client.models.entity import Entity # noqa: E501
class TestEntity(unittest.TestCase):
"""Entity unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> Entity:
"""Test Entity
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `Entity`
"""
model = Entity() # noqa: E501
if include_optional:
return Entity(
did = 'did:sov:test:1234',
name = 'C1',
ip = '127.0.0.1',
visible = True,
other = openapi_client.models.other.Other(),
attached = True
)
else:
return Entity(
attached = True,
)
"""
def testEntity(self):
"""Test Entity"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,56 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
import datetime
from openapi_client.models.entity_create import EntityCreate # noqa: E501
class TestEntityCreate(unittest.TestCase):
"""EntityCreate unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> EntityCreate:
"""Test EntityCreate
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `EntityCreate`
"""
model = EntityCreate() # noqa: E501
if include_optional:
return EntityCreate(
did = 'did:sov:test:1234',
name = 'C1',
ip = '127.0.0.1',
visible = True,
other = openapi_client.models.other.Other()
)
else:
return EntityCreate(
)
"""
def testEntityCreate(self):
"""Test EntityCreate"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,59 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
import datetime
from openapi_client.models.http_validation_error import HTTPValidationError # noqa: E501
class TestHTTPValidationError(unittest.TestCase):
"""HTTPValidationError unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> HTTPValidationError:
"""Test HTTPValidationError
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `HTTPValidationError`
"""
model = HTTPValidationError() # noqa: E501
if include_optional:
return HTTPValidationError(
detail = [
openapi_client.models.validation_error.ValidationError(
loc = [
null
],
msg = '',
type = '', )
]
)
else:
return HTTPValidationError(
)
"""
def testHTTPValidationError(self):
"""Test HTTPValidationError"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,55 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
import datetime
from openapi_client.models.machine import Machine # noqa: E501
class TestMachine(unittest.TestCase):
"""Machine unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> Machine:
"""Test Machine
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `Machine`
"""
model = Machine() # noqa: E501
if include_optional:
return Machine(
name = '',
status = 'online'
)
else:
return Machine(
name = '',
status = 'online',
)
"""
def testMachine(self):
"""Test Machine"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,38 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
from openapi_client.api.repositories_api import RepositoriesApi # noqa: E501
class TestRepositoriesApi(unittest.TestCase):
"""RepositoriesApi unit test stubs"""
def setUp(self) -> None:
self.api = RepositoriesApi() # noqa: E501
def tearDown(self) -> None:
pass
def test_get_all_repositories(self) -> None:
"""Test case for get_all_repositories
Get All Repositories # noqa: E501
"""
pass
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,59 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
import datetime
from openapi_client.models.resolution import Resolution # noqa: E501
class TestResolution(unittest.TestCase):
"""Resolution unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> Resolution:
"""Test Resolution
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `Resolution`
"""
model = Resolution() # noqa: E501
if include_optional:
return Resolution(
requester_name = 'C1',
requester_did = 'did:sov:test:1122',
resolved_did = 'did:sov:test:1234',
other = openapi_client.models.other.Other(),
timestamp = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'),
id = 56
)
else:
return Resolution(
timestamp = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'),
id = 56,
)
"""
def testResolution(self):
"""Test Resolution"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,38 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
from openapi_client.api.resolution_api import ResolutionApi # noqa: E501
class TestResolutionApi(unittest.TestCase):
"""ResolutionApi unit test stubs"""
def setUp(self) -> None:
self.api = ResolutionApi() # noqa: E501
def tearDown(self) -> None:
pass
def test_get_all_resolutions(self) -> None:
"""Test case for get_all_resolutions
Get All Resolutions # noqa: E501
"""
pass
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,58 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
import datetime
from openapi_client.models.service import Service # noqa: E501
class TestService(unittest.TestCase):
"""Service unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> Service:
"""Test Service
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `Service`
"""
model = Service() # noqa: E501
if include_optional:
return Service(
uuid = '8e285c0c-4e40-430a-a477-26b3b81e30df',
service_name = 'Carlos Printing',
service_type = '3D Printing',
endpoint_url = 'http://127.0.0.1:8000',
status = 'unknown',
other = openapi_client.models.other.Other(),
entity_did = 'did:sov:test:1234'
)
else:
return Service(
)
"""
def testService(self):
"""Test Service"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,58 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
import datetime
from openapi_client.models.service_create import ServiceCreate # noqa: E501
class TestServiceCreate(unittest.TestCase):
"""ServiceCreate unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> ServiceCreate:
"""Test ServiceCreate
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `ServiceCreate`
"""
model = ServiceCreate() # noqa: E501
if include_optional:
return ServiceCreate(
uuid = '8e285c0c-4e40-430a-a477-26b3b81e30df',
service_name = 'Carlos Printing',
service_type = '3D Printing',
endpoint_url = 'http://127.0.0.1:8000',
status = 'unknown',
other = openapi_client.models.other.Other(),
entity_did = 'did:sov:test:1234'
)
else:
return ServiceCreate(
)
"""
def testServiceCreate(self):
"""Test ServiceCreate"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,59 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
from openapi_client.api.services_api import ServicesApi # noqa: E501
class TestServicesApi(unittest.TestCase):
"""ServicesApi unit test stubs"""
def setUp(self) -> None:
self.api = ServicesApi() # noqa: E501
def tearDown(self) -> None:
pass
def test_create_service(self) -> None:
"""Test case for create_service
Create Service # noqa: E501
"""
pass
def test_delete_service(self) -> None:
"""Test case for delete_service
Delete Service # noqa: E501
"""
pass
def test_get_all_services(self) -> None:
"""Test case for get_all_services
Get All Services # noqa: E501
"""
pass
def test_get_service_by_did(self) -> None:
"""Test case for get_service_by_did
Get Service By Did # noqa: E501
"""
pass
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,34 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
import datetime
from openapi_client.models.status import Status # noqa: E501
class TestStatus(unittest.TestCase):
"""Status unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def testStatus(self):
"""Test Status"""
# inst = Status()
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,61 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
import datetime
from openapi_client.models.validation_error import ValidationError # noqa: E501
class TestValidationError(unittest.TestCase):
"""ValidationError unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> ValidationError:
"""Test ValidationError
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `ValidationError`
"""
model = ValidationError() # noqa: E501
if include_optional:
return ValidationError(
loc = [
null
],
msg = '',
type = ''
)
else:
return ValidationError(
loc = [
null
],
msg = '',
type = '',
)
"""
def testValidationError(self):
"""Test ValidationError"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@@ -0,0 +1,51 @@
# coding: utf-8
"""
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 0.1.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
import unittest
import datetime
from openapi_client.models.validation_error_loc_inner import ValidationErrorLocInner # noqa: E501
class TestValidationErrorLocInner(unittest.TestCase):
"""ValidationErrorLocInner unit test stubs"""
def setUp(self):
pass
def tearDown(self):
pass
def make_instance(self, include_optional) -> ValidationErrorLocInner:
"""Test ValidationErrorLocInner
include_option is a boolean, when False only required
params are included, when True both required and
optional params are included """
# uncomment below to create an instance of `ValidationErrorLocInner`
"""
model = ValidationErrorLocInner() # noqa: E501
if include_optional:
return ValidationErrorLocInner(
)
else:
return ValidationErrorLocInner(
)
"""
def testValidationErrorLocInner(self):
"""Test ValidationErrorLocInner"""
# inst_req_only = self.make_instance(include_optional=False)
# inst_req_and_optional = self.make_instance(include_optional=True)
if __name__ == '__main__':
unittest.main()

View File

@@ -1,6 +1,16 @@
from openapi_client import ApiClient
from openapi_client.api import default_api
from openapi_client.models import Machine, Status
default_entity_did_url = "entity_did=did%3Asov%3Atest%3A1234" default_entity_did_url = "entity_did=did%3Asov%3Atest%3A1234"
default_entity_did = "did:sov:test:1234" default_entity_did = "did:sov:test:1234"
default_entity_did2 = "did:sov:test:1235" default_entity_did2 = "did:sov:test:1235"
default_entity_did3 = "did:sov:test:1236" default_entity_did3 = "did:sov:test:1236"
default_entity_did4 = "did:sov:test:1237" default_entity_did4 = "did:sov:test:1237"
default_entity_did5 = "did:sov:test:1238" default_entity_did5 = "did:sov:test:1238"
def test_health(api_client: ApiClient) -> None:
default = default_api.DefaultApi(api_client=api_client)
res: Machine = default.health()
assert res.status == Status.ONLINE