Skip to content

Commit

Permalink
chore: regenerate storage sdk 🔁 (#7)
Browse files Browse the repository at this point in the history
Co-authored-by: simon-schoonjans <[email protected]>
  • Loading branch information
otomator and simon-schoonjans authored Apr 15, 2024
1 parent 77a74b1 commit 15c28ad
Show file tree
Hide file tree
Showing 14 changed files with 201 additions and 182 deletions.
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,22 @@ from waylay.sdk.api.api_exceptions import ApiError
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed
from waylay.services.storage.models.tenant_status_report import TenantStatusReport
try:
# Version
# calls `GET /storage/v1/`
api_response = await waylay_client.storage.about.version(
# Status
# calls `GET /storage/v1/status`
api_response = await waylay_client.storage.about.status(
# query parameters:
query = {
'include_buckets': True
'include_queues': True
'include_disk_usage': False
},
)
print("The response of storage.about.version:\n")
print("The response of storage.about.status:\n")
pprint(api_response)
except ApiError as e:
print("Exception when calling storage.about.version: %s\n" % e)
print("Exception when calling storage.about.status: %s\n" % e)
```


Expand All @@ -56,8 +63,8 @@ All URIs are relative to *https://api.waylay.io*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AboutApi* | [**get**](docs/AboutApi.md#get) | **GET** /storage/v1/ | Version
*AboutApi* | [**status**](docs/AboutApi.md#status) | **GET** /storage/v1/status | Status
*AboutApi* | [**version**](docs/AboutApi.md#version) | **GET** /storage/v1/ | Version
*BucketApi* | [**get**](docs/BucketApi.md#get) | **GET** /storage/v1/bucket/{bucket_name} | Get Bucket
*BucketApi* | [**list**](docs/BucketApi.md#list) | **GET** /storage/v1/bucket | List Buckets
*ObjectApi* | [**copy_or_move**](docs/ObjectApi.md#copy_or_move) | **PUT** /storage/v1/bucket/{bucket_name}/{target_path} | Copy Or Move Object
Expand Down
84 changes: 42 additions & 42 deletions docs/AboutApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@ All URIs are relative to *https://api.waylay.io*

Method | HTTP request | Description
------------- | ------------- | -------------
[**get**](AboutApi.md#get) | **GET** /storage/v1/ | Version
[**status**](AboutApi.md#status) | **GET** /storage/v1/status | Status
[**version**](AboutApi.md#version) | **GET** /storage/v1/ | Version

# **status**
> status(
> query: StatusQuery,
# **get**
> get(
> headers
> ) -> TenantStatusReport
> ) -> str
Status
Version

Validate consistency of buckets and notification queues for this tenant.
Get the application version.

### Example

Expand All @@ -30,44 +29,31 @@ from waylay.sdk.api.api_exceptions import ApiError
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed
from waylay.services.storage.models.tenant_status_report import TenantStatusReport
try:
# Status
# calls `GET /storage/v1/status`
api_response = await waylay_client.storage.about.status(
# query parameters:
query = {
'include_buckets': True
'include_queues': True
'include_disk_usage': False
},
# Version
# calls `GET /storage/v1/`
api_response = await waylay_client.storage.about.get(
)
print("The response of storage.about.status:\n")
print("The response of storage.about.get:\n")
pprint(api_response)
except ApiError as e:
print("Exception when calling storage.about.status: %s\n" % e)
print("Exception when calling storage.about.get: %s\n" % e)
```

### Endpoint
```
GET /storage/v1/status
GET /storage/v1/
```
### Parameters

Name | Type | API binding | Description | Notes
-------- | ----- | ------------- | ------------- | -------------
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
**query['store']** (dict) <br> **query.store** (Query) | **str** | query parameter `"store"` | | [optional]
**query['include_buckets']** (dict) <br> **query.include_buckets** (Query) | **bool** | query parameter `"include_buckets"` | | [optional] [default True]
**query['include_queues']** (dict) <br> **query.include_queues** (Query) | **bool** | query parameter `"include_queues"` | | [optional] [default True]
**query['include_disk_usage']** (dict) <br> **query.include_disk_usage** (Query) | **bool** | query parameter `"include_disk_usage"` | | [optional] [default False]
This endpoint does not need any parameter.
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |

### Return type

Selected path param | Raw response param | Return Type | Description | Links
------------------- | ------------------ | ------------ | ----------- | -----
Literal[""] _(default)_ | False _(default)_ | **`TenantStatusReport`** | | [TenantStatusReport](TenantStatusReport.md)
Literal[""] _(default)_ | False _(default)_ | **`str`** | |
str | False _(default)_ | **`Any`** | If any other string value for the selected path is provided, the exact type of the response will only be known at runtime. |
/ | True | `Response` | The raw http response object.

Expand All @@ -81,18 +67,18 @@ str | False _(default)_ | **`Any`** | If any other string value for the selected
| 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)

# **version**
> version(
# **status**
> status(
> query: StatusQuery,
> headers
> ) -> str
> ) -> TenantStatusReport
Version
Status

Get the application version.
Validate consistency of buckets and notification queues for this tenant.

### Example

Expand All @@ -107,31 +93,44 @@ from waylay.sdk.api.api_exceptions import ApiError
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed
from waylay.services.storage.models.tenant_status_report import TenantStatusReport
try:
# Version
# calls `GET /storage/v1/`
api_response = await waylay_client.storage.about.version(
# Status
# calls `GET /storage/v1/status`
api_response = await waylay_client.storage.about.status(
# query parameters:
query = {
'include_buckets': True
'include_queues': True
'include_disk_usage': False
},
)
print("The response of storage.about.version:\n")
print("The response of storage.about.status:\n")
pprint(api_response)
except ApiError as e:
print("Exception when calling storage.about.version: %s\n" % e)
print("Exception when calling storage.about.status: %s\n" % e)
```

### Endpoint
```
GET /storage/v1/
GET /storage/v1/status
```
### Parameters

This endpoint does not need any parameter.
Name | Type | API binding | Description | Notes
-------- | ----- | ------------- | ------------- | -------------
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
**query['store']** (dict) <br> **query.store** (Query) | **str** | query parameter `"store"` | | [optional]
**query['include_buckets']** (dict) <br> **query.include_buckets** (Query) | **bool** | query parameter `"include_buckets"` | | [optional] [default True]
**query['include_queues']** (dict) <br> **query.include_queues** (Query) | **bool** | query parameter `"include_queues"` | | [optional] [default True]
**query['include_disk_usage']** (dict) <br> **query.include_disk_usage** (Query) | **bool** | query parameter `"include_disk_usage"` | | [optional] [default False]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |

### Return type

Selected path param | Raw response param | Return Type | Description | Links
------------------- | ------------------ | ------------ | ----------- | -----
Literal[""] _(default)_ | False _(default)_ | **`str`** | |
Literal[""] _(default)_ | False _(default)_ | **`TenantStatusReport`** | | [TenantStatusReport](TenantStatusReport.md)
str | False _(default)_ | **`Any`** | If any other string value for the selected path is provided, the exact type of the response will only be known at runtime. |
/ | True | `Response` | The raw http response object.

Expand All @@ -145,6 +144,7 @@ str | False _(default)_ | **`Any`** | If any other string value for the selected
| 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)

4 changes: 2 additions & 2 deletions openapi/storage.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -764,15 +764,15 @@ paths:
- About
summary: Version
description: Get the application version.
operationId: version_about
operationId: get_about
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: string
title: Response Version
title: Response Get
security: *id001
/storage/v1/status:
get:
Expand Down
6 changes: 3 additions & 3 deletions openapi/storage.transformed.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -920,18 +920,18 @@ paths:
- About
summary: Version
description: Get the application version.
operationId: version_about
operationId: get_about
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: string
title: Response Version
title: Response Get
security:
- waylayApiKeySecret: []
x-py-method: version
x-py-method: get
x-consumes-multipart: false
x-consumes-urlencoded: false
x-consumes-json: false
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pydantic ~= 2.6
typing-extensions ~= 4.9
waylay-sdk-core@git+https://github.com/waylayio/waylay-sdk-py@cc464ef9ee120bc54ff6381add0c92a2d06e2944
waylay-sdk-core ~= 0.2.0
80 changes: 39 additions & 41 deletions test/api/about_api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,45 @@ def test_registered(waylay_client: WaylayClient):
assert isinstance(waylay_client.storage.about, AboutApi)


def _get_set_mock_response(httpx_mock: HTTPXMock, gateway_url: str):
mock_response = "''"
httpx_mock_kwargs = {
"method": "GET",
"url": re.compile(f"^{gateway_url}/storage/v1/(\\?.*)?"),
"content": json.dumps(mock_response, default=str),
"status_code": 200,
}
httpx_mock.add_response(**httpx_mock_kwargs)


@pytest.mark.asyncio
@pytest.mark.skipif(not MODELS_AVAILABLE, reason="Types not installed.")
async def test_get(service: StorageService, gateway_url: str, httpx_mock: HTTPXMock):
"""Test case for get
Version
"""
# set path params
kwargs = {}
_get_set_mock_response(httpx_mock, gateway_url)
resp = await service.about.get(**kwargs)
check_type(resp, Union[str,])


@pytest.mark.asyncio
@pytest.mark.skipif(MODELS_AVAILABLE, reason="Types installed.")
async def test_get_without_types(
service: StorageService, gateway_url: str, httpx_mock: HTTPXMock
):
"""Test case for get with models not installed
Version
"""
# set path params
kwargs = {}
_get_set_mock_response(httpx_mock, gateway_url)
resp = await service.about.get(**kwargs)
check_type(resp, Model)


def _status_set_mock_response(httpx_mock: HTTPXMock, gateway_url: str):
mock_response = TenantStatusReportStub.create_json()
httpx_mock_kwargs = {
Expand Down Expand Up @@ -98,44 +137,3 @@ async def test_status_without_types(
_status_set_mock_response(httpx_mock, gateway_url)
resp = await service.about.status(**kwargs)
check_type(resp, Model)


def _version_set_mock_response(httpx_mock: HTTPXMock, gateway_url: str):
mock_response = "''"
httpx_mock_kwargs = {
"method": "GET",
"url": re.compile(f"^{gateway_url}/storage/v1/(\\?.*)?"),
"content": json.dumps(mock_response, default=str),
"status_code": 200,
}
httpx_mock.add_response(**httpx_mock_kwargs)


@pytest.mark.asyncio
@pytest.mark.skipif(not MODELS_AVAILABLE, reason="Types not installed.")
async def test_version(
service: StorageService, gateway_url: str, httpx_mock: HTTPXMock
):
"""Test case for version
Version
"""
# set path params
kwargs = {}
_version_set_mock_response(httpx_mock, gateway_url)
resp = await service.about.version(**kwargs)
check_type(resp, Union[str,])


@pytest.mark.asyncio
@pytest.mark.skipif(MODELS_AVAILABLE, reason="Types installed.")
async def test_version_without_types(
service: StorageService, gateway_url: str, httpx_mock: HTTPXMock
):
"""Test case for version with models not installed
Version
"""
# set path params
kwargs = {}
_version_set_mock_response(httpx_mock, gateway_url)
resp = await service.about.version(**kwargs)
check_type(resp, Model)
17 changes: 12 additions & 5 deletions waylay-sdk-storage-types/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,22 @@ from waylay.sdk.api.api_exceptions import ApiError
waylay_client = WaylayClient.from_profile()

# Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed
from waylay.services.storage.models.tenant_status_report import TenantStatusReport
try:
# Version
# calls `GET /storage/v1/`
api_response = await waylay_client.storage.about.version(
# Status
# calls `GET /storage/v1/status`
api_response = await waylay_client.storage.about.status(
# query parameters:
query = {
'include_buckets': True
'include_queues': True
'include_disk_usage': False
},
)
print("The response of storage.about.version:\n")
print("The response of storage.about.status:\n")
pprint(api_response)
except ApiError as e:
print("Exception when calling storage.about.version: %s\n" % e)
print("Exception when calling storage.about.status: %s\n" % e)
```


Expand Down
4 changes: 2 additions & 2 deletions waylay-sdk-storage-types/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "waylay-sdk-storage-types"
version = "0.4.1"
version = "0.4.1.20240415"
description = "Waylay Storage Types "
authors = [
{ name = "Waylay", email = "[email protected]"}
Expand All @@ -13,7 +13,7 @@ keywords = ["Waylay Storage" , "Types"]
requires-python = ">= 3.9"
dependencies = [
"waylay-sdk-core ~= 0.2.0",
"waylay-sdk-storage == 0.4.1",
"waylay-sdk-storage == 0.4.1.20240415",
"pydantic ~= 2.6",
"typing-extensions ~= 4.10",
"eval-type-backport ~= 0.1.3; python_version < '3.10'",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Do not edit the class manually.
"""

__version__ = "0.4.1"
__version__ = "0.4.1.20240415"

# import models into model package
from .auth import AUTH
Expand Down
Loading

0 comments on commit 15c28ad

Please sign in to comment.