From 79c6c3c669b0ba79e8e2739d02930d318c12ed77 Mon Sep 17 00:00:00 2001 From: Shahar Shaki Date: Sun, 8 Feb 2026 12:12:23 +0200 Subject: [PATCH 1/6] Add ObjectStorage API support - Add ObjectStorageApi with upload, download, list, delete, and info methods - Add ObjectStorage model classes (DeleteFileResponse, DownloadFileResponse, FileInfo, etc.) - Add ObjectStorage documentation and test files - Update __init__.py files to export ObjectStorage classes Co-authored-by: Cursor --- docs/DeleteFileResponse.md | 30 + docs/DownloadFileResponse.md | 32 + docs/FileInfo.md | 34 + docs/GetFileInfoResponse.md | 31 + docs/ListFilesResponse.md | 32 + docs/ObjectStorageApi.md | 348 +++++ docs/UploadFileResponse.md | 32 + monday_code/__init__.py | 7 + monday_code/api/__init__.py | 1 + monday_code/api/object_storage_api.py | 1442 ++++++++++++++++++ monday_code/models/__init__.py | 6 + monday_code/models/delete_file_response.py | 89 ++ monday_code/models/download_file_response.py | 93 ++ monday_code/models/file_info.py | 98 ++ monday_code/models/get_file_info_response.py | 95 ++ monday_code/models/list_files_response.py | 101 ++ monday_code/models/upload_file_response.py | 93 ++ test/test_delete_file_response.py | 53 + test/test_download_file_response.py | 55 + test/test_file_info.py | 66 + test/test_get_file_info_response.py | 62 + test/test_list_files_response.py | 65 + test/test_object_storage_api.py | 61 + test/test_upload_file_response.py | 55 + 24 files changed, 2981 insertions(+) create mode 100644 docs/DeleteFileResponse.md create mode 100644 docs/DownloadFileResponse.md create mode 100644 docs/FileInfo.md create mode 100644 docs/GetFileInfoResponse.md create mode 100644 docs/ListFilesResponse.md create mode 100644 docs/ObjectStorageApi.md create mode 100644 docs/UploadFileResponse.md create mode 100644 monday_code/api/object_storage_api.py create mode 100644 monday_code/models/delete_file_response.py create mode 100644 monday_code/models/download_file_response.py create mode 100644 monday_code/models/file_info.py create mode 100644 monday_code/models/get_file_info_response.py create mode 100644 monday_code/models/list_files_response.py create mode 100644 monday_code/models/upload_file_response.py create mode 100644 test/test_delete_file_response.py create mode 100644 test/test_download_file_response.py create mode 100644 test/test_file_info.py create mode 100644 test/test_get_file_info_response.py create mode 100644 test/test_list_files_response.py create mode 100644 test/test_object_storage_api.py create mode 100644 test/test_upload_file_response.py diff --git a/docs/DeleteFileResponse.md b/docs/DeleteFileResponse.md new file mode 100644 index 0000000..f8a2103 --- /dev/null +++ b/docs/DeleteFileResponse.md @@ -0,0 +1,30 @@ +# DeleteFileResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | | +**error** | **str** | | [optional] + +## Example + +```python +from monday_code.models.delete_file_response import DeleteFileResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of DeleteFileResponse from a JSON string +delete_file_response_instance = DeleteFileResponse.from_json(json) +# print the JSON string representation of the object +print(DeleteFileResponse.to_json()) + +# convert the object into a dict +delete_file_response_dict = delete_file_response_instance.to_dict() +# create an instance of DeleteFileResponse from a dict +delete_file_response_from_dict = DeleteFileResponse.from_dict(delete_file_response_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) + + diff --git a/docs/DownloadFileResponse.md b/docs/DownloadFileResponse.md new file mode 100644 index 0000000..de9a250 --- /dev/null +++ b/docs/DownloadFileResponse.md @@ -0,0 +1,32 @@ +# DownloadFileResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | | +**error** | **str** | | [optional] +**content** | **bytearray** | | [optional] +**content_type** | **str** | | [optional] + +## Example + +```python +from monday_code.models.download_file_response import DownloadFileResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of DownloadFileResponse from a JSON string +download_file_response_instance = DownloadFileResponse.from_json(json) +# print the JSON string representation of the object +print(DownloadFileResponse.to_json()) + +# convert the object into a dict +download_file_response_dict = download_file_response_instance.to_dict() +# create an instance of DownloadFileResponse from a dict +download_file_response_from_dict = DownloadFileResponse.from_dict(download_file_response_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) + + diff --git a/docs/FileInfo.md b/docs/FileInfo.md new file mode 100644 index 0000000..ce72d33 --- /dev/null +++ b/docs/FileInfo.md @@ -0,0 +1,34 @@ +# FileInfo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | **Dict[str, str]** | Construct a type with a set of properties K of type T | +**etag** | **str** | | +**last_modified** | **datetime** | | +**content_type** | **str** | | +**size** | **float** | | +**name** | **str** | | + +## Example + +```python +from monday_code.models.file_info import FileInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of FileInfo from a JSON string +file_info_instance = FileInfo.from_json(json) +# print the JSON string representation of the object +print(FileInfo.to_json()) + +# convert the object into a dict +file_info_dict = file_info_instance.to_dict() +# create an instance of FileInfo from a dict +file_info_from_dict = FileInfo.from_dict(file_info_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) + + diff --git a/docs/GetFileInfoResponse.md b/docs/GetFileInfoResponse.md new file mode 100644 index 0000000..7e5452a --- /dev/null +++ b/docs/GetFileInfoResponse.md @@ -0,0 +1,31 @@ +# GetFileInfoResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | | +**error** | **str** | | [optional] +**file_info** | [**FileInfo**](FileInfo.md) | | [optional] + +## Example + +```python +from monday_code.models.get_file_info_response import GetFileInfoResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of GetFileInfoResponse from a JSON string +get_file_info_response_instance = GetFileInfoResponse.from_json(json) +# print the JSON string representation of the object +print(GetFileInfoResponse.to_json()) + +# convert the object into a dict +get_file_info_response_dict = get_file_info_response_instance.to_dict() +# create an instance of GetFileInfoResponse from a dict +get_file_info_response_from_dict = GetFileInfoResponse.from_dict(get_file_info_response_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) + + diff --git a/docs/ListFilesResponse.md b/docs/ListFilesResponse.md new file mode 100644 index 0000000..d98aab6 --- /dev/null +++ b/docs/ListFilesResponse.md @@ -0,0 +1,32 @@ +# ListFilesResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | | +**error** | **str** | | [optional] +**files** | [**List[FileInfo]**](FileInfo.md) | | [optional] +**next_page_token** | **str** | | [optional] + +## Example + +```python +from monday_code.models.list_files_response import ListFilesResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of ListFilesResponse from a JSON string +list_files_response_instance = ListFilesResponse.from_json(json) +# print the JSON string representation of the object +print(ListFilesResponse.to_json()) + +# convert the object into a dict +list_files_response_dict = list_files_response_instance.to_dict() +# create an instance of ListFilesResponse from a dict +list_files_response_from_dict = ListFilesResponse.from_dict(list_files_response_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) + + diff --git a/docs/ObjectStorageApi.md b/docs/ObjectStorageApi.md new file mode 100644 index 0000000..67d6b5b --- /dev/null +++ b/docs/ObjectStorageApi.md @@ -0,0 +1,348 @@ +# monday_code.ObjectStorageApi + +All URIs are relative to *http://localhost:59999* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**delete_file**](ObjectStorageApi.md#delete_file) | **DELETE** /object-storage/files/{filename} | +[**download_file**](ObjectStorageApi.md#download_file) | **GET** /object-storage/files/{filename} | +[**get_file_info**](ObjectStorageApi.md#get_file_info) | **GET** /object-storage/files/{filename}/info | +[**list_files**](ObjectStorageApi.md#list_files) | **GET** /object-storage/files | +[**upload_file**](ObjectStorageApi.md#upload_file) | **POST** /object-storage/files | + + +# **delete_file** +> DeleteFileResponse delete_file(filename) + +### Example + + +```python +import monday_code +from monday_code.models.delete_file_response import DeleteFileResponse +from monday_code.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:59999 +# See configuration.py for a list of all supported configuration parameters. +configuration = monday_code.Configuration( + host = "http://localhost:59999" +) + + +# Enter a context with an instance of the API client +with monday_code.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = monday_code.ObjectStorageApi(api_client) + filename = 'filename_example' # str | + + try: + api_response = api_instance.delete_file(filename) + print("The response of ObjectStorageApi->delete_file:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ObjectStorageApi->delete_file: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **filename** | **str**| | + +### Return type + +[**DeleteFileResponse**](DeleteFileResponse.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 | - | +**500** | | - | + +[[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) + +# **download_file** +> DownloadFileResponse download_file(filename) + +### Example + + +```python +import monday_code +from monday_code.models.download_file_response import DownloadFileResponse +from monday_code.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:59999 +# See configuration.py for a list of all supported configuration parameters. +configuration = monday_code.Configuration( + host = "http://localhost:59999" +) + + +# Enter a context with an instance of the API client +with monday_code.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = monday_code.ObjectStorageApi(api_client) + filename = 'filename_example' # str | + + try: + api_response = api_instance.download_file(filename) + print("The response of ObjectStorageApi->download_file:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ObjectStorageApi->download_file: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **filename** | **str**| | + +### Return type + +[**DownloadFileResponse**](DownloadFileResponse.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 | - | +**500** | | - | + +[[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_file_info** +> GetFileInfoResponse get_file_info(filename) + +### Example + + +```python +import monday_code +from monday_code.models.get_file_info_response import GetFileInfoResponse +from monday_code.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:59999 +# See configuration.py for a list of all supported configuration parameters. +configuration = monday_code.Configuration( + host = "http://localhost:59999" +) + + +# Enter a context with an instance of the API client +with monday_code.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = monday_code.ObjectStorageApi(api_client) + filename = 'filename_example' # str | + + try: + api_response = api_instance.get_file_info(filename) + print("The response of ObjectStorageApi->get_file_info:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ObjectStorageApi->get_file_info: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **filename** | **str**| | + +### Return type + +[**GetFileInfoResponse**](GetFileInfoResponse.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 | - | +**500** | | - | + +[[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) + +# **list_files** +> ListFilesResponse list_files(prefix=prefix, max_results=max_results, page_token=page_token) + +### Example + + +```python +import monday_code +from monday_code.models.list_files_response import ListFilesResponse +from monday_code.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:59999 +# See configuration.py for a list of all supported configuration parameters. +configuration = monday_code.Configuration( + host = "http://localhost:59999" +) + + +# Enter a context with an instance of the API client +with monday_code.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = monday_code.ObjectStorageApi(api_client) + prefix = 'prefix_example' # str | (optional) + max_results = 3.4 # float | (optional) + page_token = 'page_token_example' # str | (optional) + + try: + api_response = api_instance.list_files(prefix=prefix, max_results=max_results, page_token=page_token) + print("The response of ObjectStorageApi->list_files:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ObjectStorageApi->list_files: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **prefix** | **str**| | [optional] + **max_results** | **float**| | [optional] + **page_token** | **str**| | [optional] + +### Return type + +[**ListFilesResponse**](ListFilesResponse.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 | - | +**500** | | - | + +[[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) + +# **upload_file** +> UploadFileResponse upload_file(content=content, filename=filename, content_type=content_type, metadata=metadata) + +Upload file with unified content parameter +This endpoint accepts all content types through a single 'content' parameter +String content should be encoded as bytes and sent as file upload + +### Example + + +```python +import monday_code +from monday_code.models.upload_file_response import UploadFileResponse +from monday_code.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to http://localhost:59999 +# See configuration.py for a list of all supported configuration parameters. +configuration = monday_code.Configuration( + host = "http://localhost:59999" +) + + +# Enter a context with an instance of the API client +with monday_code.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = monday_code.ObjectStorageApi(api_client) + content = None # bytearray | (optional) + filename = 'filename_example' # str | (optional) + content_type = 'content_type_example' # str | (optional) + metadata = 'metadata_example' # str | (optional) + + try: + api_response = api_instance.upload_file(content=content, filename=filename, content_type=content_type, metadata=metadata) + print("The response of ObjectStorageApi->upload_file:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ObjectStorageApi->upload_file: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **content** | **bytearray**| | [optional] + **filename** | **str**| | [optional] + **content_type** | **str**| | [optional] + **metadata** | **str**| | [optional] + +### Return type + +[**UploadFileResponse**](UploadFileResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**400** | | - | +**500** | | - | + +[[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/UploadFileResponse.md b/docs/UploadFileResponse.md new file mode 100644 index 0000000..a75f445 --- /dev/null +++ b/docs/UploadFileResponse.md @@ -0,0 +1,32 @@ +# UploadFileResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**success** | **bool** | | +**error** | **str** | | [optional] +**file_name** | **str** | | [optional] +**file_url** | **str** | | [optional] + +## Example + +```python +from monday_code.models.upload_file_response import UploadFileResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of UploadFileResponse from a JSON string +upload_file_response_instance = UploadFileResponse.from_json(json) +# print the JSON string representation of the object +print(UploadFileResponse.to_json()) + +# convert the object into a dict +upload_file_response_dict = upload_file_response_instance.to_dict() +# create an instance of UploadFileResponse from a dict +upload_file_response_from_dict = UploadFileResponse.from_dict(upload_file_response_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) + + diff --git a/monday_code/__init__.py b/monday_code/__init__.py index 5d0f828..10fe1bd 100644 --- a/monday_code/__init__.py +++ b/monday_code/__init__.py @@ -19,6 +19,7 @@ # import apis into sdk package from monday_code.api.environment_variables_api import EnvironmentVariablesApi from monday_code.api.logs_api import LogsApi +from monday_code.api.object_storage_api import ObjectStorageApi from monday_code.api.queue_api import QueueApi from monday_code.api.secrets_api import SecretsApi from monday_code.api.secure_storage_api import SecureStorageApi @@ -36,18 +37,24 @@ from monday_code.exceptions import ApiException # import models into sdk package +from monday_code.models.delete_file_response import DeleteFileResponse +from monday_code.models.download_file_response import DownloadFileResponse +from monday_code.models.file_info import FileInfo from monday_code.models.get_by_key_from_storage404_response import GetByKeyFromStorage404Response from monday_code.models.get_by_key_from_storage500_response import GetByKeyFromStorage500Response +from monday_code.models.get_file_info_response import GetFileInfoResponse from monday_code.models.increment_counter200_response import IncrementCounter200Response from monday_code.models.increment_counter200_response_any_of import IncrementCounter200ResponseAnyOf from monday_code.models.increment_counter200_response_any_of1 import IncrementCounter200ResponseAnyOf1 from monday_code.models.increment_counter_params import IncrementCounterParams from monday_code.models.json_data_contract import JsonDataContract +from monday_code.models.list_files_response import ListFilesResponse from monday_code.models.log_methods import LogMethods from monday_code.models.period import Period from monday_code.models.publish_message_params import PublishMessageParams from monday_code.models.publish_message_response import PublishMessageResponse from monday_code.models.storage_data_contract import StorageDataContract +from monday_code.models.upload_file_response import UploadFileResponse from monday_code.models.upsert_by_key_from_storage200_response import UpsertByKeyFromStorage200Response from monday_code.models.upsert_by_key_from_storage200_response_any_of import UpsertByKeyFromStorage200ResponseAnyOf from monday_code.models.upsert_by_key_from_storage200_response_any_of1 import UpsertByKeyFromStorage200ResponseAnyOf1 diff --git a/monday_code/api/__init__.py b/monday_code/api/__init__.py index 080d087..f2a2860 100644 --- a/monday_code/api/__init__.py +++ b/monday_code/api/__init__.py @@ -3,6 +3,7 @@ # import apis into api package from monday_code.api.environment_variables_api import EnvironmentVariablesApi from monday_code.api.logs_api import LogsApi +from monday_code.api.object_storage_api import ObjectStorageApi from monday_code.api.queue_api import QueueApi from monday_code.api.secrets_api import SecretsApi from monday_code.api.secure_storage_api import SecureStorageApi diff --git a/monday_code/api/object_storage_api.py b/monday_code/api/object_storage_api.py new file mode 100644 index 0000000..061305c --- /dev/null +++ b/monday_code/api/object_storage_api.py @@ -0,0 +1,1442 @@ +# coding: utf-8 + +""" + mcode-sdk-api + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.2.3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import StrictBytes, StrictFloat, StrictInt, StrictStr +from typing import Optional, Tuple, Union +from monday_code.models.delete_file_response import DeleteFileResponse +from monday_code.models.download_file_response import DownloadFileResponse +from monday_code.models.get_file_info_response import GetFileInfoResponse +from monday_code.models.list_files_response import ListFilesResponse +from monday_code.models.upload_file_response import UploadFileResponse + +from monday_code.api_client import ApiClient, RequestSerialized +from monday_code.api_response import ApiResponse +from monday_code.rest import RESTResponseType + + +class ObjectStorageApi: + """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) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def delete_file( + self, + filename: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DeleteFileResponse: + """delete_file + + + :param filename: (required) + :type filename: str + :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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_file_serialize( + filename=filename, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeleteFileResponse", + '500': "GetByKeyFromStorage500Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def delete_file_with_http_info( + self, + filename: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DeleteFileResponse]: + """delete_file + + + :param filename: (required) + :type filename: str + :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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_file_serialize( + filename=filename, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeleteFileResponse", + '500': "GetByKeyFromStorage500Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def delete_file_without_preload_content( + self, + filename: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """delete_file + + + :param filename: (required) + :type filename: str + :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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._delete_file_serialize( + filename=filename, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DeleteFileResponse", + '500': "GetByKeyFromStorage500Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _delete_file_serialize( + self, + filename, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if filename is not None: + _path_params['filename'] = filename + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='DELETE', + resource_path='/object-storage/files/{filename}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def download_file( + self, + filename: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> DownloadFileResponse: + """download_file + + + :param filename: (required) + :type filename: str + :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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._download_file_serialize( + filename=filename, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DownloadFileResponse", + '500': "GetByKeyFromStorage500Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def download_file_with_http_info( + self, + filename: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[DownloadFileResponse]: + """download_file + + + :param filename: (required) + :type filename: str + :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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._download_file_serialize( + filename=filename, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DownloadFileResponse", + '500': "GetByKeyFromStorage500Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def download_file_without_preload_content( + self, + filename: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """download_file + + + :param filename: (required) + :type filename: str + :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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._download_file_serialize( + filename=filename, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DownloadFileResponse", + '500': "GetByKeyFromStorage500Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _download_file_serialize( + self, + filename, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if filename is not None: + _path_params['filename'] = filename + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/object-storage/files/{filename}', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_file_info( + self, + filename: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> GetFileInfoResponse: + """get_file_info + + + :param filename: (required) + :type filename: str + :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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_file_info_serialize( + filename=filename, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetFileInfoResponse", + '500': "GetByKeyFromStorage500Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_file_info_with_http_info( + self, + filename: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[GetFileInfoResponse]: + """get_file_info + + + :param filename: (required) + :type filename: str + :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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_file_info_serialize( + filename=filename, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetFileInfoResponse", + '500': "GetByKeyFromStorage500Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_file_info_without_preload_content( + self, + filename: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """get_file_info + + + :param filename: (required) + :type filename: str + :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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_file_info_serialize( + filename=filename, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "GetFileInfoResponse", + '500': "GetByKeyFromStorage500Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_file_info_serialize( + self, + filename, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if filename is not None: + _path_params['filename'] = filename + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/object-storage/files/{filename}/info', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def list_files( + self, + prefix: Optional[StrictStr] = None, + max_results: Optional[Union[StrictFloat, StrictInt]] = None, + page_token: Optional[StrictStr] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ListFilesResponse: + """list_files + + + :param prefix: + :type prefix: str + :param max_results: + :type max_results: float + :param page_token: + :type page_token: str + :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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_files_serialize( + prefix=prefix, + max_results=max_results, + page_token=page_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListFilesResponse", + '500': "GetByKeyFromStorage500Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def list_files_with_http_info( + self, + prefix: Optional[StrictStr] = None, + max_results: Optional[Union[StrictFloat, StrictInt]] = None, + page_token: Optional[StrictStr] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ListFilesResponse]: + """list_files + + + :param prefix: + :type prefix: str + :param max_results: + :type max_results: float + :param page_token: + :type page_token: str + :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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_files_serialize( + prefix=prefix, + max_results=max_results, + page_token=page_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListFilesResponse", + '500': "GetByKeyFromStorage500Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def list_files_without_preload_content( + self, + prefix: Optional[StrictStr] = None, + max_results: Optional[Union[StrictFloat, StrictInt]] = None, + page_token: Optional[StrictStr] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """list_files + + + :param prefix: + :type prefix: str + :param max_results: + :type max_results: float + :param page_token: + :type page_token: str + :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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._list_files_serialize( + prefix=prefix, + max_results=max_results, + page_token=page_token, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ListFilesResponse", + '500': "GetByKeyFromStorage500Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _list_files_serialize( + self, + prefix, + max_results, + page_token, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if prefix is not None: + + _query_params.append(('prefix', prefix)) + + if max_results is not None: + + _query_params.append(('maxResults', max_results)) + + if page_token is not None: + + _query_params.append(('pageToken', page_token)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/object-storage/files', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def upload_file( + self, + content: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None, + filename: Optional[StrictStr] = None, + content_type: Optional[StrictStr] = None, + metadata: Optional[StrictStr] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> UploadFileResponse: + """upload_file + + Upload file with unified content parameter This endpoint accepts all content types through a single 'content' parameter String content should be encoded as bytes and sent as file upload + + :param content: + :type content: bytearray + :param filename: + :type filename: str + :param content_type: + :type content_type: str + :param metadata: + :type metadata: str + :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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._upload_file_serialize( + content=content, + filename=filename, + content_type=content_type, + metadata=metadata, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UploadFileResponse", + '400': "GetByKeyFromStorage404Response", + '500': "GetByKeyFromStorage500Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def upload_file_with_http_info( + self, + content: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None, + filename: Optional[StrictStr] = None, + content_type: Optional[StrictStr] = None, + metadata: Optional[StrictStr] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[UploadFileResponse]: + """upload_file + + Upload file with unified content parameter This endpoint accepts all content types through a single 'content' parameter String content should be encoded as bytes and sent as file upload + + :param content: + :type content: bytearray + :param filename: + :type filename: str + :param content_type: + :type content_type: str + :param metadata: + :type metadata: str + :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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._upload_file_serialize( + content=content, + filename=filename, + content_type=content_type, + metadata=metadata, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UploadFileResponse", + '400': "GetByKeyFromStorage404Response", + '500': "GetByKeyFromStorage500Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def upload_file_without_preload_content( + self, + content: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None, + filename: Optional[StrictStr] = None, + content_type: Optional[StrictStr] = None, + metadata: Optional[StrictStr] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """upload_file + + Upload file with unified content parameter This endpoint accepts all content types through a single 'content' parameter String content should be encoded as bytes and sent as file upload + + :param content: + :type content: bytearray + :param filename: + :type filename: str + :param content_type: + :type content_type: str + :param metadata: + :type metadata: str + :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. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._upload_file_serialize( + content=content, + filename=filename, + content_type=content_type, + metadata=metadata, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "UploadFileResponse", + '400': "GetByKeyFromStorage404Response", + '500': "GetByKeyFromStorage500Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _upload_file_serialize( + self, + content, + filename, + content_type, + metadata, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + if content is not None: + _files['content'] = content + if filename is not None: + _form_params.append(('filename', filename)) + if content_type is not None: + _form_params.append(('contentType', content_type)) + if metadata is not None: + _form_params.append(('metadata', metadata)) + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'multipart/form-data' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/object-storage/files', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/monday_code/models/__init__.py b/monday_code/models/__init__.py index c4b9e55..76b36d7 100644 --- a/monday_code/models/__init__.py +++ b/monday_code/models/__init__.py @@ -14,18 +14,24 @@ # import models into model package +from monday_code.models.delete_file_response import DeleteFileResponse +from monday_code.models.download_file_response import DownloadFileResponse +from monday_code.models.file_info import FileInfo from monday_code.models.get_by_key_from_storage404_response import GetByKeyFromStorage404Response from monday_code.models.get_by_key_from_storage500_response import GetByKeyFromStorage500Response +from monday_code.models.get_file_info_response import GetFileInfoResponse from monday_code.models.increment_counter200_response import IncrementCounter200Response from monday_code.models.increment_counter200_response_any_of import IncrementCounter200ResponseAnyOf from monday_code.models.increment_counter200_response_any_of1 import IncrementCounter200ResponseAnyOf1 from monday_code.models.increment_counter_params import IncrementCounterParams from monday_code.models.json_data_contract import JsonDataContract +from monday_code.models.list_files_response import ListFilesResponse from monday_code.models.log_methods import LogMethods from monday_code.models.period import Period from monday_code.models.publish_message_params import PublishMessageParams from monday_code.models.publish_message_response import PublishMessageResponse from monday_code.models.storage_data_contract import StorageDataContract +from monday_code.models.upload_file_response import UploadFileResponse from monday_code.models.upsert_by_key_from_storage200_response import UpsertByKeyFromStorage200Response from monday_code.models.upsert_by_key_from_storage200_response_any_of import UpsertByKeyFromStorage200ResponseAnyOf from monday_code.models.upsert_by_key_from_storage200_response_any_of1 import UpsertByKeyFromStorage200ResponseAnyOf1 diff --git a/monday_code/models/delete_file_response.py b/monday_code/models/delete_file_response.py new file mode 100644 index 0000000..ab11780 --- /dev/null +++ b/monday_code/models/delete_file_response.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +""" + mcode-sdk-api + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.2.3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class DeleteFileResponse(BaseModel): + """ + DeleteFileResponse + """ # noqa: E501 + success: StrictBool + error: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["success", "error"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DeleteFileResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DeleteFileResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "success": obj.get("success"), + "error": obj.get("error") + }) + return _obj + + diff --git a/monday_code/models/download_file_response.py b/monday_code/models/download_file_response.py new file mode 100644 index 0000000..70ec953 --- /dev/null +++ b/monday_code/models/download_file_response.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + mcode-sdk-api + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.2.3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictBytes, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from typing import Optional, Set +from typing_extensions import Self + +class DownloadFileResponse(BaseModel): + """ + DownloadFileResponse + """ # noqa: E501 + success: StrictBool + error: Optional[StrictStr] = None + content: Optional[Union[StrictBytes, StrictStr]] = None + content_type: Optional[StrictStr] = Field(default=None, alias="contentType") + __properties: ClassVar[List[str]] = ["success", "error", "content", "contentType"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DownloadFileResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DownloadFileResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "success": obj.get("success"), + "error": obj.get("error"), + "content": obj.get("content"), + "contentType": obj.get("contentType") + }) + return _obj + + diff --git a/monday_code/models/file_info.py b/monday_code/models/file_info.py new file mode 100644 index 0000000..edabf63 --- /dev/null +++ b/monday_code/models/file_info.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + mcode-sdk-api + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.2.3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + +class FileInfo(BaseModel): + """ + FileInfo + """ # noqa: E501 + metadata: Dict[str, StrictStr] = Field(description="Construct a type with a set of properties K of type T") + etag: StrictStr + last_modified: datetime = Field(alias="lastModified") + content_type: StrictStr = Field(alias="contentType") + size: Union[StrictFloat, StrictInt] + name: StrictStr + __properties: ClassVar[List[str]] = ["metadata", "etag", "lastModified", "contentType", "size", "name"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FileInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FileInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "metadata": obj.get("metadata"), + "etag": obj.get("etag"), + "lastModified": obj.get("lastModified"), + "contentType": obj.get("contentType"), + "size": obj.get("size"), + "name": obj.get("name") + }) + return _obj + + diff --git a/monday_code/models/get_file_info_response.py b/monday_code/models/get_file_info_response.py new file mode 100644 index 0000000..8f07833 --- /dev/null +++ b/monday_code/models/get_file_info_response.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + mcode-sdk-api + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.2.3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from monday_code.models.file_info import FileInfo +from typing import Optional, Set +from typing_extensions import Self + +class GetFileInfoResponse(BaseModel): + """ + GetFileInfoResponse + """ # noqa: E501 + success: StrictBool + error: Optional[StrictStr] = None + file_info: Optional[FileInfo] = Field(default=None, alias="fileInfo") + __properties: ClassVar[List[str]] = ["success", "error", "fileInfo"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of GetFileInfoResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of file_info + if self.file_info: + _dict['fileInfo'] = self.file_info.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of GetFileInfoResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "success": obj.get("success"), + "error": obj.get("error"), + "fileInfo": FileInfo.from_dict(obj["fileInfo"]) if obj.get("fileInfo") is not None else None + }) + return _obj + + diff --git a/monday_code/models/list_files_response.py b/monday_code/models/list_files_response.py new file mode 100644 index 0000000..7874751 --- /dev/null +++ b/monday_code/models/list_files_response.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + mcode-sdk-api + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.2.3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from monday_code.models.file_info import FileInfo +from typing import Optional, Set +from typing_extensions import Self + +class ListFilesResponse(BaseModel): + """ + ListFilesResponse + """ # noqa: E501 + success: StrictBool + error: Optional[StrictStr] = None + files: Optional[List[FileInfo]] = None + next_page_token: Optional[StrictStr] = Field(default=None, alias="nextPageToken") + __properties: ClassVar[List[str]] = ["success", "error", "files", "nextPageToken"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ListFilesResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in files (list) + _items = [] + if self.files: + for _item_files in self.files: + if _item_files: + _items.append(_item_files.to_dict()) + _dict['files'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ListFilesResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "success": obj.get("success"), + "error": obj.get("error"), + "files": [FileInfo.from_dict(_item) for _item in obj["files"]] if obj.get("files") is not None else None, + "nextPageToken": obj.get("nextPageToken") + }) + return _obj + + diff --git a/monday_code/models/upload_file_response.py b/monday_code/models/upload_file_response.py new file mode 100644 index 0000000..d7c865d --- /dev/null +++ b/monday_code/models/upload_file_response.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + mcode-sdk-api + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.2.3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class UploadFileResponse(BaseModel): + """ + UploadFileResponse + """ # noqa: E501 + success: StrictBool + error: Optional[StrictStr] = None + file_name: Optional[StrictStr] = Field(default=None, alias="fileName") + file_url: Optional[StrictStr] = Field(default=None, alias="fileUrl") + __properties: ClassVar[List[str]] = ["success", "error", "fileName", "fileUrl"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UploadFileResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UploadFileResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "success": obj.get("success"), + "error": obj.get("error"), + "fileName": obj.get("fileName"), + "fileUrl": obj.get("fileUrl") + }) + return _obj + + diff --git a/test/test_delete_file_response.py b/test/test_delete_file_response.py new file mode 100644 index 0000000..727ab41 --- /dev/null +++ b/test/test_delete_file_response.py @@ -0,0 +1,53 @@ +# coding: utf-8 + +""" + mcode-sdk-api + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.2.3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from monday_code.models.delete_file_response import DeleteFileResponse + +class TestDeleteFileResponse(unittest.TestCase): + """DeleteFileResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DeleteFileResponse: + """Test DeleteFileResponse + include_optional 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 `DeleteFileResponse` + """ + model = DeleteFileResponse() + if include_optional: + return DeleteFileResponse( + success = True, + error = '' + ) + else: + return DeleteFileResponse( + success = True, + ) + """ + + def testDeleteFileResponse(self): + """Test DeleteFileResponse""" + # 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_download_file_response.py b/test/test_download_file_response.py new file mode 100644 index 0000000..0587e2f --- /dev/null +++ b/test/test_download_file_response.py @@ -0,0 +1,55 @@ +# coding: utf-8 + +""" + mcode-sdk-api + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.2.3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from monday_code.models.download_file_response import DownloadFileResponse + +class TestDownloadFileResponse(unittest.TestCase): + """DownloadFileResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> DownloadFileResponse: + """Test DownloadFileResponse + include_optional 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 `DownloadFileResponse` + """ + model = DownloadFileResponse() + if include_optional: + return DownloadFileResponse( + success = True, + error = '', + content = 'YQ==', + content_type = '' + ) + else: + return DownloadFileResponse( + success = True, + ) + """ + + def testDownloadFileResponse(self): + """Test DownloadFileResponse""" + # 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_file_info.py b/test/test_file_info.py new file mode 100644 index 0000000..89f082e --- /dev/null +++ b/test/test_file_info.py @@ -0,0 +1,66 @@ +# coding: utf-8 + +""" + mcode-sdk-api + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.2.3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from monday_code.models.file_info import FileInfo + +class TestFileInfo(unittest.TestCase): + """FileInfo unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> FileInfo: + """Test FileInfo + include_optional 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 `FileInfo` + """ + model = FileInfo() + if include_optional: + return FileInfo( + metadata = { + 'key' : '' + }, + etag = '', + last_modified = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + content_type = '', + size = 1.337, + name = '' + ) + else: + return FileInfo( + metadata = { + 'key' : '' + }, + etag = '', + last_modified = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + content_type = '', + size = 1.337, + name = '', + ) + """ + + def testFileInfo(self): + """Test FileInfo""" + # 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_get_file_info_response.py b/test/test_get_file_info_response.py new file mode 100644 index 0000000..220ee66 --- /dev/null +++ b/test/test_get_file_info_response.py @@ -0,0 +1,62 @@ +# coding: utf-8 + +""" + mcode-sdk-api + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.2.3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from monday_code.models.get_file_info_response import GetFileInfoResponse + +class TestGetFileInfoResponse(unittest.TestCase): + """GetFileInfoResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> GetFileInfoResponse: + """Test GetFileInfoResponse + include_optional 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 `GetFileInfoResponse` + """ + model = GetFileInfoResponse() + if include_optional: + return GetFileInfoResponse( + success = True, + error = '', + file_info = monday_code.models.file_info.FileInfo( + metadata = { + 'key' : '' + }, + etag = '', + last_modified = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + content_type = '', + size = 1.337, + name = '', ) + ) + else: + return GetFileInfoResponse( + success = True, + ) + """ + + def testGetFileInfoResponse(self): + """Test GetFileInfoResponse""" + # 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_list_files_response.py b/test/test_list_files_response.py new file mode 100644 index 0000000..251bab1 --- /dev/null +++ b/test/test_list_files_response.py @@ -0,0 +1,65 @@ +# coding: utf-8 + +""" + mcode-sdk-api + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.2.3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from monday_code.models.list_files_response import ListFilesResponse + +class TestListFilesResponse(unittest.TestCase): + """ListFilesResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ListFilesResponse: + """Test ListFilesResponse + include_optional 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 `ListFilesResponse` + """ + model = ListFilesResponse() + if include_optional: + return ListFilesResponse( + success = True, + error = '', + files = [ + monday_code.models.file_info.FileInfo( + metadata = { + 'key' : '' + }, + etag = '', + last_modified = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + content_type = '', + size = 1.337, + name = '', ) + ], + next_page_token = '' + ) + else: + return ListFilesResponse( + success = True, + ) + """ + + def testListFilesResponse(self): + """Test ListFilesResponse""" + # 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_object_storage_api.py b/test/test_object_storage_api.py new file mode 100644 index 0000000..1920f53 --- /dev/null +++ b/test/test_object_storage_api.py @@ -0,0 +1,61 @@ +# coding: utf-8 + +""" + mcode-sdk-api + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.2.3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from monday_code.api.object_storage_api import ObjectStorageApi + + +class TestObjectStorageApi(unittest.TestCase): + """ObjectStorageApi unit test stubs""" + + def setUp(self) -> None: + self.api = ObjectStorageApi() + + def tearDown(self) -> None: + pass + + def test_delete_file(self) -> None: + """Test case for delete_file + + """ + pass + + def test_download_file(self) -> None: + """Test case for download_file + + """ + pass + + def test_get_file_info(self) -> None: + """Test case for get_file_info + + """ + pass + + def test_list_files(self) -> None: + """Test case for list_files + + """ + pass + + def test_upload_file(self) -> None: + """Test case for upload_file + + """ + pass + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_upload_file_response.py b/test/test_upload_file_response.py new file mode 100644 index 0000000..73e3180 --- /dev/null +++ b/test/test_upload_file_response.py @@ -0,0 +1,55 @@ +# coding: utf-8 + +""" + mcode-sdk-api + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: 0.2.3 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from monday_code.models.upload_file_response import UploadFileResponse + +class TestUploadFileResponse(unittest.TestCase): + """UploadFileResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> UploadFileResponse: + """Test UploadFileResponse + include_optional 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 `UploadFileResponse` + """ + model = UploadFileResponse() + if include_optional: + return UploadFileResponse( + success = True, + error = '', + file_name = '', + file_url = '' + ) + else: + return UploadFileResponse( + success = True, + ) + """ + + def testUploadFileResponse(self): + """Test UploadFileResponse""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() From 622560dca7f278ce4ac729e5a7e338227d651d9a Mon Sep 17 00:00:00 2001 From: Shahar Shaki Date: Sun, 8 Feb 2026 12:20:23 +0200 Subject: [PATCH 2/6] Update ObjectStorage API to use async methods - Regenerate with --library asyncio flag to preserve async API style - All ObjectStorage methods now use async/await syntax - Maintains consistency with existing async APIs Co-authored-by: Cursor --- docs/ObjectStorageApi.md | 20 +++---- monday_code/api/object_storage_api.py | 80 +++++++++++++-------------- test/test_object_storage_api.py | 18 +++--- 3 files changed, 59 insertions(+), 59 deletions(-) diff --git a/docs/ObjectStorageApi.md b/docs/ObjectStorageApi.md index 67d6b5b..a0b6880 100644 --- a/docs/ObjectStorageApi.md +++ b/docs/ObjectStorageApi.md @@ -31,13 +31,13 @@ configuration = monday_code.Configuration( # Enter a context with an instance of the API client -with monday_code.ApiClient(configuration) as api_client: +async with monday_code.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = monday_code.ObjectStorageApi(api_client) filename = 'filename_example' # str | try: - api_response = api_instance.delete_file(filename) + api_response = await api_instance.delete_file(filename) print("The response of ObjectStorageApi->delete_file:\n") pprint(api_response) except Exception as e: @@ -95,13 +95,13 @@ configuration = monday_code.Configuration( # Enter a context with an instance of the API client -with monday_code.ApiClient(configuration) as api_client: +async with monday_code.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = monday_code.ObjectStorageApi(api_client) filename = 'filename_example' # str | try: - api_response = api_instance.download_file(filename) + api_response = await api_instance.download_file(filename) print("The response of ObjectStorageApi->download_file:\n") pprint(api_response) except Exception as e: @@ -159,13 +159,13 @@ configuration = monday_code.Configuration( # Enter a context with an instance of the API client -with monday_code.ApiClient(configuration) as api_client: +async with monday_code.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = monday_code.ObjectStorageApi(api_client) filename = 'filename_example' # str | try: - api_response = api_instance.get_file_info(filename) + api_response = await api_instance.get_file_info(filename) print("The response of ObjectStorageApi->get_file_info:\n") pprint(api_response) except Exception as e: @@ -223,7 +223,7 @@ configuration = monday_code.Configuration( # Enter a context with an instance of the API client -with monday_code.ApiClient(configuration) as api_client: +async with monday_code.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = monday_code.ObjectStorageApi(api_client) prefix = 'prefix_example' # str | (optional) @@ -231,7 +231,7 @@ with monday_code.ApiClient(configuration) as api_client: page_token = 'page_token_example' # str | (optional) try: - api_response = api_instance.list_files(prefix=prefix, max_results=max_results, page_token=page_token) + api_response = await api_instance.list_files(prefix=prefix, max_results=max_results, page_token=page_token) print("The response of ObjectStorageApi->list_files:\n") pprint(api_response) except Exception as e: @@ -295,7 +295,7 @@ configuration = monday_code.Configuration( # Enter a context with an instance of the API client -with monday_code.ApiClient(configuration) as api_client: +async with monday_code.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = monday_code.ObjectStorageApi(api_client) content = None # bytearray | (optional) @@ -304,7 +304,7 @@ with monday_code.ApiClient(configuration) as api_client: metadata = 'metadata_example' # str | (optional) try: - api_response = api_instance.upload_file(content=content, filename=filename, content_type=content_type, metadata=metadata) + api_response = await api_instance.upload_file(content=content, filename=filename, content_type=content_type, metadata=metadata) print("The response of ObjectStorageApi->upload_file:\n") pprint(api_response) except Exception as e: diff --git a/monday_code/api/object_storage_api.py b/monday_code/api/object_storage_api.py index 061305c..df2315b 100644 --- a/monday_code/api/object_storage_api.py +++ b/monday_code/api/object_storage_api.py @@ -43,7 +43,7 @@ def __init__(self, api_client=None) -> None: @validate_call - def delete_file( + async def delete_file( self, filename: StrictStr, _request_timeout: Union[ @@ -98,11 +98,11 @@ def delete_file( '200': "DeleteFileResponse", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -110,7 +110,7 @@ def delete_file( @validate_call - def delete_file_with_http_info( + async def delete_file_with_http_info( self, filename: StrictStr, _request_timeout: Union[ @@ -165,11 +165,11 @@ def delete_file_with_http_info( '200': "DeleteFileResponse", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -177,7 +177,7 @@ def delete_file_with_http_info( @validate_call - def delete_file_without_preload_content( + async def delete_file_without_preload_content( self, filename: StrictStr, _request_timeout: Union[ @@ -232,7 +232,7 @@ def delete_file_without_preload_content( '200': "DeleteFileResponse", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -303,7 +303,7 @@ def _delete_file_serialize( @validate_call - def download_file( + async def download_file( self, filename: StrictStr, _request_timeout: Union[ @@ -358,11 +358,11 @@ def download_file( '200': "DownloadFileResponse", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -370,7 +370,7 @@ def download_file( @validate_call - def download_file_with_http_info( + async def download_file_with_http_info( self, filename: StrictStr, _request_timeout: Union[ @@ -425,11 +425,11 @@ def download_file_with_http_info( '200': "DownloadFileResponse", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -437,7 +437,7 @@ def download_file_with_http_info( @validate_call - def download_file_without_preload_content( + async def download_file_without_preload_content( self, filename: StrictStr, _request_timeout: Union[ @@ -492,7 +492,7 @@ def download_file_without_preload_content( '200': "DownloadFileResponse", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -563,7 +563,7 @@ def _download_file_serialize( @validate_call - def get_file_info( + async def get_file_info( self, filename: StrictStr, _request_timeout: Union[ @@ -618,11 +618,11 @@ def get_file_info( '200': "GetFileInfoResponse", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -630,7 +630,7 @@ def get_file_info( @validate_call - def get_file_info_with_http_info( + async def get_file_info_with_http_info( self, filename: StrictStr, _request_timeout: Union[ @@ -685,11 +685,11 @@ def get_file_info_with_http_info( '200': "GetFileInfoResponse", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -697,7 +697,7 @@ def get_file_info_with_http_info( @validate_call - def get_file_info_without_preload_content( + async def get_file_info_without_preload_content( self, filename: StrictStr, _request_timeout: Union[ @@ -752,7 +752,7 @@ def get_file_info_without_preload_content( '200': "GetFileInfoResponse", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -823,7 +823,7 @@ def _get_file_info_serialize( @validate_call - def list_files( + async def list_files( self, prefix: Optional[StrictStr] = None, max_results: Optional[Union[StrictFloat, StrictInt]] = None, @@ -886,11 +886,11 @@ def list_files( '200': "ListFilesResponse", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -898,7 +898,7 @@ def list_files( @validate_call - def list_files_with_http_info( + async def list_files_with_http_info( self, prefix: Optional[StrictStr] = None, max_results: Optional[Union[StrictFloat, StrictInt]] = None, @@ -961,11 +961,11 @@ def list_files_with_http_info( '200': "ListFilesResponse", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -973,7 +973,7 @@ def list_files_with_http_info( @validate_call - def list_files_without_preload_content( + async def list_files_without_preload_content( self, prefix: Optional[StrictStr] = None, max_results: Optional[Union[StrictFloat, StrictInt]] = None, @@ -1036,7 +1036,7 @@ def list_files_without_preload_content( '200': "ListFilesResponse", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -1119,7 +1119,7 @@ def _list_files_serialize( @validate_call - def upload_file( + async def upload_file( self, content: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None, filename: Optional[StrictStr] = None, @@ -1188,11 +1188,11 @@ def upload_file( '400': "GetByKeyFromStorage404Response", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1200,7 +1200,7 @@ def upload_file( @validate_call - def upload_file_with_http_info( + async def upload_file_with_http_info( self, content: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None, filename: Optional[StrictStr] = None, @@ -1269,11 +1269,11 @@ def upload_file_with_http_info( '400': "GetByKeyFromStorage404Response", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1281,7 +1281,7 @@ def upload_file_with_http_info( @validate_call - def upload_file_without_preload_content( + async def upload_file_without_preload_content( self, content: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None, filename: Optional[StrictStr] = None, @@ -1350,7 +1350,7 @@ def upload_file_without_preload_content( '400': "GetByKeyFromStorage404Response", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) diff --git a/test/test_object_storage_api.py b/test/test_object_storage_api.py index 1920f53..02059f5 100644 --- a/test/test_object_storage_api.py +++ b/test/test_object_storage_api.py @@ -17,40 +17,40 @@ from monday_code.api.object_storage_api import ObjectStorageApi -class TestObjectStorageApi(unittest.TestCase): +class TestObjectStorageApi(unittest.IsolatedAsyncioTestCase): """ObjectStorageApi unit test stubs""" - def setUp(self) -> None: + async def asyncSetUp(self) -> None: self.api = ObjectStorageApi() - def tearDown(self) -> None: - pass + async def asyncTearDown(self) -> None: + await self.api.api_client.close() - def test_delete_file(self) -> None: + async def test_delete_file(self) -> None: """Test case for delete_file """ pass - def test_download_file(self) -> None: + async def test_download_file(self) -> None: """Test case for download_file """ pass - def test_get_file_info(self) -> None: + async def test_get_file_info(self) -> None: """Test case for get_file_info """ pass - def test_list_files(self) -> None: + async def test_list_files(self) -> None: """Test case for list_files """ pass - def test_upload_file(self) -> None: + async def test_upload_file(self) -> None: """Test case for upload_file """ From 63f91ea164a1541746b206a119a48ee73d83a52e Mon Sep 17 00:00:00 2001 From: Shahar Shaki Date: Sun, 8 Feb 2026 12:23:34 +0200 Subject: [PATCH 3/6] Fix: Convert ObjectStorage API to synchronous methods - Remove async/await from ObjectStorage API methods - Align with existing synchronous API style used in the SDK - Fixes compatibility with existing codebase Co-authored-by: Cursor --- docs/ObjectStorageApi.md | 20 +++---- monday_code/api/object_storage_api.py | 80 +++++++++++++-------------- test/test_object_storage_api.py | 18 +++--- 3 files changed, 59 insertions(+), 59 deletions(-) diff --git a/docs/ObjectStorageApi.md b/docs/ObjectStorageApi.md index a0b6880..67d6b5b 100644 --- a/docs/ObjectStorageApi.md +++ b/docs/ObjectStorageApi.md @@ -31,13 +31,13 @@ configuration = monday_code.Configuration( # Enter a context with an instance of the API client -async with monday_code.ApiClient(configuration) as api_client: +with monday_code.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = monday_code.ObjectStorageApi(api_client) filename = 'filename_example' # str | try: - api_response = await api_instance.delete_file(filename) + api_response = api_instance.delete_file(filename) print("The response of ObjectStorageApi->delete_file:\n") pprint(api_response) except Exception as e: @@ -95,13 +95,13 @@ configuration = monday_code.Configuration( # Enter a context with an instance of the API client -async with monday_code.ApiClient(configuration) as api_client: +with monday_code.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = monday_code.ObjectStorageApi(api_client) filename = 'filename_example' # str | try: - api_response = await api_instance.download_file(filename) + api_response = api_instance.download_file(filename) print("The response of ObjectStorageApi->download_file:\n") pprint(api_response) except Exception as e: @@ -159,13 +159,13 @@ configuration = monday_code.Configuration( # Enter a context with an instance of the API client -async with monday_code.ApiClient(configuration) as api_client: +with monday_code.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = monday_code.ObjectStorageApi(api_client) filename = 'filename_example' # str | try: - api_response = await api_instance.get_file_info(filename) + api_response = api_instance.get_file_info(filename) print("The response of ObjectStorageApi->get_file_info:\n") pprint(api_response) except Exception as e: @@ -223,7 +223,7 @@ configuration = monday_code.Configuration( # Enter a context with an instance of the API client -async with monday_code.ApiClient(configuration) as api_client: +with monday_code.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = monday_code.ObjectStorageApi(api_client) prefix = 'prefix_example' # str | (optional) @@ -231,7 +231,7 @@ async with monday_code.ApiClient(configuration) as api_client: page_token = 'page_token_example' # str | (optional) try: - api_response = await api_instance.list_files(prefix=prefix, max_results=max_results, page_token=page_token) + api_response = api_instance.list_files(prefix=prefix, max_results=max_results, page_token=page_token) print("The response of ObjectStorageApi->list_files:\n") pprint(api_response) except Exception as e: @@ -295,7 +295,7 @@ configuration = monday_code.Configuration( # Enter a context with an instance of the API client -async with monday_code.ApiClient(configuration) as api_client: +with monday_code.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = monday_code.ObjectStorageApi(api_client) content = None # bytearray | (optional) @@ -304,7 +304,7 @@ async with monday_code.ApiClient(configuration) as api_client: metadata = 'metadata_example' # str | (optional) try: - api_response = await api_instance.upload_file(content=content, filename=filename, content_type=content_type, metadata=metadata) + api_response = api_instance.upload_file(content=content, filename=filename, content_type=content_type, metadata=metadata) print("The response of ObjectStorageApi->upload_file:\n") pprint(api_response) except Exception as e: diff --git a/monday_code/api/object_storage_api.py b/monday_code/api/object_storage_api.py index df2315b..061305c 100644 --- a/monday_code/api/object_storage_api.py +++ b/monday_code/api/object_storage_api.py @@ -43,7 +43,7 @@ def __init__(self, api_client=None) -> None: @validate_call - async def delete_file( + def delete_file( self, filename: StrictStr, _request_timeout: Union[ @@ -98,11 +98,11 @@ async def delete_file( '200': "DeleteFileResponse", '500': "GetByKeyFromStorage500Response", } - response_data = await self.api_client.call_api( + response_data = self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - await response_data.read() + response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -110,7 +110,7 @@ async def delete_file( @validate_call - async def delete_file_with_http_info( + def delete_file_with_http_info( self, filename: StrictStr, _request_timeout: Union[ @@ -165,11 +165,11 @@ async def delete_file_with_http_info( '200': "DeleteFileResponse", '500': "GetByKeyFromStorage500Response", } - response_data = await self.api_client.call_api( + response_data = self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - await response_data.read() + response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -177,7 +177,7 @@ async def delete_file_with_http_info( @validate_call - async def delete_file_without_preload_content( + def delete_file_without_preload_content( self, filename: StrictStr, _request_timeout: Union[ @@ -232,7 +232,7 @@ async def delete_file_without_preload_content( '200': "DeleteFileResponse", '500': "GetByKeyFromStorage500Response", } - response_data = await self.api_client.call_api( + response_data = self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -303,7 +303,7 @@ def _delete_file_serialize( @validate_call - async def download_file( + def download_file( self, filename: StrictStr, _request_timeout: Union[ @@ -358,11 +358,11 @@ async def download_file( '200': "DownloadFileResponse", '500': "GetByKeyFromStorage500Response", } - response_data = await self.api_client.call_api( + response_data = self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - await response_data.read() + response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -370,7 +370,7 @@ async def download_file( @validate_call - async def download_file_with_http_info( + def download_file_with_http_info( self, filename: StrictStr, _request_timeout: Union[ @@ -425,11 +425,11 @@ async def download_file_with_http_info( '200': "DownloadFileResponse", '500': "GetByKeyFromStorage500Response", } - response_data = await self.api_client.call_api( + response_data = self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - await response_data.read() + response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -437,7 +437,7 @@ async def download_file_with_http_info( @validate_call - async def download_file_without_preload_content( + def download_file_without_preload_content( self, filename: StrictStr, _request_timeout: Union[ @@ -492,7 +492,7 @@ async def download_file_without_preload_content( '200': "DownloadFileResponse", '500': "GetByKeyFromStorage500Response", } - response_data = await self.api_client.call_api( + response_data = self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -563,7 +563,7 @@ def _download_file_serialize( @validate_call - async def get_file_info( + def get_file_info( self, filename: StrictStr, _request_timeout: Union[ @@ -618,11 +618,11 @@ async def get_file_info( '200': "GetFileInfoResponse", '500': "GetByKeyFromStorage500Response", } - response_data = await self.api_client.call_api( + response_data = self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - await response_data.read() + response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -630,7 +630,7 @@ async def get_file_info( @validate_call - async def get_file_info_with_http_info( + def get_file_info_with_http_info( self, filename: StrictStr, _request_timeout: Union[ @@ -685,11 +685,11 @@ async def get_file_info_with_http_info( '200': "GetFileInfoResponse", '500': "GetByKeyFromStorage500Response", } - response_data = await self.api_client.call_api( + response_data = self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - await response_data.read() + response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -697,7 +697,7 @@ async def get_file_info_with_http_info( @validate_call - async def get_file_info_without_preload_content( + def get_file_info_without_preload_content( self, filename: StrictStr, _request_timeout: Union[ @@ -752,7 +752,7 @@ async def get_file_info_without_preload_content( '200': "GetFileInfoResponse", '500': "GetByKeyFromStorage500Response", } - response_data = await self.api_client.call_api( + response_data = self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -823,7 +823,7 @@ def _get_file_info_serialize( @validate_call - async def list_files( + def list_files( self, prefix: Optional[StrictStr] = None, max_results: Optional[Union[StrictFloat, StrictInt]] = None, @@ -886,11 +886,11 @@ async def list_files( '200': "ListFilesResponse", '500': "GetByKeyFromStorage500Response", } - response_data = await self.api_client.call_api( + response_data = self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - await response_data.read() + response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -898,7 +898,7 @@ async def list_files( @validate_call - async def list_files_with_http_info( + def list_files_with_http_info( self, prefix: Optional[StrictStr] = None, max_results: Optional[Union[StrictFloat, StrictInt]] = None, @@ -961,11 +961,11 @@ async def list_files_with_http_info( '200': "ListFilesResponse", '500': "GetByKeyFromStorage500Response", } - response_data = await self.api_client.call_api( + response_data = self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - await response_data.read() + response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -973,7 +973,7 @@ async def list_files_with_http_info( @validate_call - async def list_files_without_preload_content( + def list_files_without_preload_content( self, prefix: Optional[StrictStr] = None, max_results: Optional[Union[StrictFloat, StrictInt]] = None, @@ -1036,7 +1036,7 @@ async def list_files_without_preload_content( '200': "ListFilesResponse", '500': "GetByKeyFromStorage500Response", } - response_data = await self.api_client.call_api( + response_data = self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -1119,7 +1119,7 @@ def _list_files_serialize( @validate_call - async def upload_file( + def upload_file( self, content: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None, filename: Optional[StrictStr] = None, @@ -1188,11 +1188,11 @@ async def upload_file( '400': "GetByKeyFromStorage404Response", '500': "GetByKeyFromStorage500Response", } - response_data = await self.api_client.call_api( + response_data = self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - await response_data.read() + response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1200,7 +1200,7 @@ async def upload_file( @validate_call - async def upload_file_with_http_info( + def upload_file_with_http_info( self, content: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None, filename: Optional[StrictStr] = None, @@ -1269,11 +1269,11 @@ async def upload_file_with_http_info( '400': "GetByKeyFromStorage404Response", '500': "GetByKeyFromStorage500Response", } - response_data = await self.api_client.call_api( + response_data = self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - await response_data.read() + response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1281,7 +1281,7 @@ async def upload_file_with_http_info( @validate_call - async def upload_file_without_preload_content( + def upload_file_without_preload_content( self, content: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None, filename: Optional[StrictStr] = None, @@ -1350,7 +1350,7 @@ async def upload_file_without_preload_content( '400': "GetByKeyFromStorage404Response", '500': "GetByKeyFromStorage500Response", } - response_data = await self.api_client.call_api( + response_data = self.api_client.call_api( *_param, _request_timeout=_request_timeout ) diff --git a/test/test_object_storage_api.py b/test/test_object_storage_api.py index 02059f5..1920f53 100644 --- a/test/test_object_storage_api.py +++ b/test/test_object_storage_api.py @@ -17,40 +17,40 @@ from monday_code.api.object_storage_api import ObjectStorageApi -class TestObjectStorageApi(unittest.IsolatedAsyncioTestCase): +class TestObjectStorageApi(unittest.TestCase): """ObjectStorageApi unit test stubs""" - async def asyncSetUp(self) -> None: + def setUp(self) -> None: self.api = ObjectStorageApi() - async def asyncTearDown(self) -> None: - await self.api.api_client.close() + def tearDown(self) -> None: + pass - async def test_delete_file(self) -> None: + def test_delete_file(self) -> None: """Test case for delete_file """ pass - async def test_download_file(self) -> None: + def test_download_file(self) -> None: """Test case for download_file """ pass - async def test_get_file_info(self) -> None: + def test_get_file_info(self) -> None: """Test case for get_file_info """ pass - async def test_list_files(self) -> None: + def test_list_files(self) -> None: """Test case for list_files """ pass - async def test_upload_file(self) -> None: + def test_upload_file(self) -> None: """Test case for upload_file """ From 1c092de5979537d2279f601b219ba6c7fb4584b6 Mon Sep 17 00:00:00 2001 From: Shahar Shaki Date: Sun, 8 Feb 2026 13:50:07 +0200 Subject: [PATCH 4/6] bump to version 2.1.0 Co-authored-by: Cursor --- monday_code/__init__.py | 2 +- pyproject.toml | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/monday_code/__init__.py b/monday_code/__init__.py index 10fe1bd..d1b3fa3 100644 --- a/monday_code/__init__.py +++ b/monday_code/__init__.py @@ -14,7 +14,7 @@ """ # noqa: E501 -__version__ = "1.0.0" +__version__ = "2.1.0" # import apis into sdk package from monday_code.api.environment_variables_api import EnvironmentVariablesApi diff --git a/pyproject.toml b/pyproject.toml index c847d6e..4a402f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "monday_code" -version = "1.0.0" +version = "2.1.0" description = "mcode-sdk-api" authors = ["OpenAPI Generator Community "] license = "MIT" diff --git a/setup.py b/setup.py index 2b39cfc..3aab326 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools NAME = "monday-code" -VERSION = "1.0.0" +VERSION = "2.1.0" PYTHON_REQUIRES = ">= 3.9" REQUIRES = [ "urllib3 >= 2.1.0, < 3.0.0", From a3f64cd5e47d53f06ecc6f5ad59aaa748eaf6cda Mon Sep 17 00:00:00 2001 From: Shahar Shaki Date: Sun, 8 Feb 2026 14:02:23 +0200 Subject: [PATCH 5/6] Update ObjectStorage API to use async methods - Add async/await to ObjectStorage methods to match other APIs - Align with async refactor from master (#13) - Update documentation and tests for async usage Co-authored-by: Cursor --- docs/ObjectStorageApi.md | 20 +++---- monday_code/api/object_storage_api.py | 80 +++++++++++++-------------- test/test_object_storage_api.py | 18 +++--- 3 files changed, 59 insertions(+), 59 deletions(-) diff --git a/docs/ObjectStorageApi.md b/docs/ObjectStorageApi.md index 67d6b5b..a0b6880 100644 --- a/docs/ObjectStorageApi.md +++ b/docs/ObjectStorageApi.md @@ -31,13 +31,13 @@ configuration = monday_code.Configuration( # Enter a context with an instance of the API client -with monday_code.ApiClient(configuration) as api_client: +async with monday_code.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = monday_code.ObjectStorageApi(api_client) filename = 'filename_example' # str | try: - api_response = api_instance.delete_file(filename) + api_response = await api_instance.delete_file(filename) print("The response of ObjectStorageApi->delete_file:\n") pprint(api_response) except Exception as e: @@ -95,13 +95,13 @@ configuration = monday_code.Configuration( # Enter a context with an instance of the API client -with monday_code.ApiClient(configuration) as api_client: +async with monday_code.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = monday_code.ObjectStorageApi(api_client) filename = 'filename_example' # str | try: - api_response = api_instance.download_file(filename) + api_response = await api_instance.download_file(filename) print("The response of ObjectStorageApi->download_file:\n") pprint(api_response) except Exception as e: @@ -159,13 +159,13 @@ configuration = monday_code.Configuration( # Enter a context with an instance of the API client -with monday_code.ApiClient(configuration) as api_client: +async with monday_code.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = monday_code.ObjectStorageApi(api_client) filename = 'filename_example' # str | try: - api_response = api_instance.get_file_info(filename) + api_response = await api_instance.get_file_info(filename) print("The response of ObjectStorageApi->get_file_info:\n") pprint(api_response) except Exception as e: @@ -223,7 +223,7 @@ configuration = monday_code.Configuration( # Enter a context with an instance of the API client -with monday_code.ApiClient(configuration) as api_client: +async with monday_code.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = monday_code.ObjectStorageApi(api_client) prefix = 'prefix_example' # str | (optional) @@ -231,7 +231,7 @@ with monday_code.ApiClient(configuration) as api_client: page_token = 'page_token_example' # str | (optional) try: - api_response = api_instance.list_files(prefix=prefix, max_results=max_results, page_token=page_token) + api_response = await api_instance.list_files(prefix=prefix, max_results=max_results, page_token=page_token) print("The response of ObjectStorageApi->list_files:\n") pprint(api_response) except Exception as e: @@ -295,7 +295,7 @@ configuration = monday_code.Configuration( # Enter a context with an instance of the API client -with monday_code.ApiClient(configuration) as api_client: +async with monday_code.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = monday_code.ObjectStorageApi(api_client) content = None # bytearray | (optional) @@ -304,7 +304,7 @@ with monday_code.ApiClient(configuration) as api_client: metadata = 'metadata_example' # str | (optional) try: - api_response = api_instance.upload_file(content=content, filename=filename, content_type=content_type, metadata=metadata) + api_response = await api_instance.upload_file(content=content, filename=filename, content_type=content_type, metadata=metadata) print("The response of ObjectStorageApi->upload_file:\n") pprint(api_response) except Exception as e: diff --git a/monday_code/api/object_storage_api.py b/monday_code/api/object_storage_api.py index 061305c..df2315b 100644 --- a/monday_code/api/object_storage_api.py +++ b/monday_code/api/object_storage_api.py @@ -43,7 +43,7 @@ def __init__(self, api_client=None) -> None: @validate_call - def delete_file( + async def delete_file( self, filename: StrictStr, _request_timeout: Union[ @@ -98,11 +98,11 @@ def delete_file( '200': "DeleteFileResponse", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -110,7 +110,7 @@ def delete_file( @validate_call - def delete_file_with_http_info( + async def delete_file_with_http_info( self, filename: StrictStr, _request_timeout: Union[ @@ -165,11 +165,11 @@ def delete_file_with_http_info( '200': "DeleteFileResponse", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -177,7 +177,7 @@ def delete_file_with_http_info( @validate_call - def delete_file_without_preload_content( + async def delete_file_without_preload_content( self, filename: StrictStr, _request_timeout: Union[ @@ -232,7 +232,7 @@ def delete_file_without_preload_content( '200': "DeleteFileResponse", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -303,7 +303,7 @@ def _delete_file_serialize( @validate_call - def download_file( + async def download_file( self, filename: StrictStr, _request_timeout: Union[ @@ -358,11 +358,11 @@ def download_file( '200': "DownloadFileResponse", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -370,7 +370,7 @@ def download_file( @validate_call - def download_file_with_http_info( + async def download_file_with_http_info( self, filename: StrictStr, _request_timeout: Union[ @@ -425,11 +425,11 @@ def download_file_with_http_info( '200': "DownloadFileResponse", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -437,7 +437,7 @@ def download_file_with_http_info( @validate_call - def download_file_without_preload_content( + async def download_file_without_preload_content( self, filename: StrictStr, _request_timeout: Union[ @@ -492,7 +492,7 @@ def download_file_without_preload_content( '200': "DownloadFileResponse", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -563,7 +563,7 @@ def _download_file_serialize( @validate_call - def get_file_info( + async def get_file_info( self, filename: StrictStr, _request_timeout: Union[ @@ -618,11 +618,11 @@ def get_file_info( '200': "GetFileInfoResponse", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -630,7 +630,7 @@ def get_file_info( @validate_call - def get_file_info_with_http_info( + async def get_file_info_with_http_info( self, filename: StrictStr, _request_timeout: Union[ @@ -685,11 +685,11 @@ def get_file_info_with_http_info( '200': "GetFileInfoResponse", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -697,7 +697,7 @@ def get_file_info_with_http_info( @validate_call - def get_file_info_without_preload_content( + async def get_file_info_without_preload_content( self, filename: StrictStr, _request_timeout: Union[ @@ -752,7 +752,7 @@ def get_file_info_without_preload_content( '200': "GetFileInfoResponse", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -823,7 +823,7 @@ def _get_file_info_serialize( @validate_call - def list_files( + async def list_files( self, prefix: Optional[StrictStr] = None, max_results: Optional[Union[StrictFloat, StrictInt]] = None, @@ -886,11 +886,11 @@ def list_files( '200': "ListFilesResponse", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -898,7 +898,7 @@ def list_files( @validate_call - def list_files_with_http_info( + async def list_files_with_http_info( self, prefix: Optional[StrictStr] = None, max_results: Optional[Union[StrictFloat, StrictInt]] = None, @@ -961,11 +961,11 @@ def list_files_with_http_info( '200': "ListFilesResponse", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -973,7 +973,7 @@ def list_files_with_http_info( @validate_call - def list_files_without_preload_content( + async def list_files_without_preload_content( self, prefix: Optional[StrictStr] = None, max_results: Optional[Union[StrictFloat, StrictInt]] = None, @@ -1036,7 +1036,7 @@ def list_files_without_preload_content( '200': "ListFilesResponse", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) @@ -1119,7 +1119,7 @@ def _list_files_serialize( @validate_call - def upload_file( + async def upload_file( self, content: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None, filename: Optional[StrictStr] = None, @@ -1188,11 +1188,11 @@ def upload_file( '400': "GetByKeyFromStorage404Response", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1200,7 +1200,7 @@ def upload_file( @validate_call - def upload_file_with_http_info( + async def upload_file_with_http_info( self, content: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None, filename: Optional[StrictStr] = None, @@ -1269,11 +1269,11 @@ def upload_file_with_http_info( '400': "GetByKeyFromStorage404Response", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) - response_data.read() + await response_data.read() return self.api_client.response_deserialize( response_data=response_data, response_types_map=_response_types_map, @@ -1281,7 +1281,7 @@ def upload_file_with_http_info( @validate_call - def upload_file_without_preload_content( + async def upload_file_without_preload_content( self, content: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]] = None, filename: Optional[StrictStr] = None, @@ -1350,7 +1350,7 @@ def upload_file_without_preload_content( '400': "GetByKeyFromStorage404Response", '500': "GetByKeyFromStorage500Response", } - response_data = self.api_client.call_api( + response_data = await self.api_client.call_api( *_param, _request_timeout=_request_timeout ) diff --git a/test/test_object_storage_api.py b/test/test_object_storage_api.py index 1920f53..02059f5 100644 --- a/test/test_object_storage_api.py +++ b/test/test_object_storage_api.py @@ -17,40 +17,40 @@ from monday_code.api.object_storage_api import ObjectStorageApi -class TestObjectStorageApi(unittest.TestCase): +class TestObjectStorageApi(unittest.IsolatedAsyncioTestCase): """ObjectStorageApi unit test stubs""" - def setUp(self) -> None: + async def asyncSetUp(self) -> None: self.api = ObjectStorageApi() - def tearDown(self) -> None: - pass + async def asyncTearDown(self) -> None: + await self.api.api_client.close() - def test_delete_file(self) -> None: + async def test_delete_file(self) -> None: """Test case for delete_file """ pass - def test_download_file(self) -> None: + async def test_download_file(self) -> None: """Test case for download_file """ pass - def test_get_file_info(self) -> None: + async def test_get_file_info(self) -> None: """Test case for get_file_info """ pass - def test_list_files(self) -> None: + async def test_list_files(self) -> None: """Test case for list_files """ pass - def test_upload_file(self) -> None: + async def test_upload_file(self) -> None: """Test case for upload_file """ From 296a76d7bbcc0edf2ffd332ed10e6112b268cce0 Mon Sep 17 00:00:00 2001 From: Shahar Shaki Date: Sun, 8 Feb 2026 14:11:48 +0200 Subject: [PATCH 6/6] run the script again and fix issues --- README.md | 12 ++- docs/EnvironmentVariablesApi.md | 4 - docs/LogsApi.md | 2 - docs/QueueApi.md | 4 - docs/SecretsApi.md | 4 - docs/SecureStorageApi.md | 6 -- docs/StorageApi.md | 10 -- monday_code/__init__.py | 128 +++++++++++++++++-------- monday_code/api_client.py | 25 +++-- monday_code/configuration.py | 30 ++++-- monday_code/exceptions.py | 26 ++++- monday_code/models/__init__.py | 2 +- monday_code/rest.py | 77 ++++++++------- pyproject.toml | 33 ++++--- requirements.txt | 1 - setup.py | 4 +- test/test_environment_variables_api.py | 2 +- test/test_logs_api.py | 2 +- test/test_queue_api.py | 2 +- test/test_secrets_api.py | 2 +- test/test_secure_storage_api.py | 2 +- test/test_storage_api.py | 2 +- 22 files changed, 226 insertions(+), 154 deletions(-) diff --git a/README.md b/README.md index b39ca66..ef0ef65 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,11 @@ Class | Method | HTTP request | Description *EnvironmentVariablesApi* | [**get_environment_variable**](docs/EnvironmentVariablesApi.md#get_environment_variable) | **GET** /environment-variables/{name} | *EnvironmentVariablesApi* | [**get_environment_variable_keys**](docs/EnvironmentVariablesApi.md#get_environment_variable_keys) | **GET** /environment-variables | *LogsApi* | [**write_log**](docs/LogsApi.md#write_log) | **POST** /logs | +*ObjectStorageApi* | [**delete_file**](docs/ObjectStorageApi.md#delete_file) | **DELETE** /object-storage/files/{filename} | +*ObjectStorageApi* | [**download_file**](docs/ObjectStorageApi.md#download_file) | **GET** /object-storage/files/{filename} | +*ObjectStorageApi* | [**get_file_info**](docs/ObjectStorageApi.md#get_file_info) | **GET** /object-storage/files/{filename}/info | +*ObjectStorageApi* | [**list_files**](docs/ObjectStorageApi.md#list_files) | **GET** /object-storage/files | +*ObjectStorageApi* | [**upload_file**](docs/ObjectStorageApi.md#upload_file) | **POST** /object-storage/files | *QueueApi* | [**publish_message**](docs/QueueApi.md#publish_message) | **POST** /queue | *QueueApi* | [**validate_secret**](docs/QueueApi.md#validate_secret) | **POST** /queue/validate-secret | *SecretsApi* | [**get_secret**](docs/SecretsApi.md#get_secret) | **GET** /secrets/{name} | @@ -63,18 +68,24 @@ Class | Method | HTTP request | Description ## Documentation For Models + - [DeleteFileResponse](docs/DeleteFileResponse.md) + - [DownloadFileResponse](docs/DownloadFileResponse.md) + - [FileInfo](docs/FileInfo.md) - [GetByKeyFromStorage404Response](docs/GetByKeyFromStorage404Response.md) - [GetByKeyFromStorage500Response](docs/GetByKeyFromStorage500Response.md) + - [GetFileInfoResponse](docs/GetFileInfoResponse.md) - [IncrementCounter200Response](docs/IncrementCounter200Response.md) - [IncrementCounter200ResponseAnyOf](docs/IncrementCounter200ResponseAnyOf.md) - [IncrementCounter200ResponseAnyOf1](docs/IncrementCounter200ResponseAnyOf1.md) - [IncrementCounterParams](docs/IncrementCounterParams.md) - [JsonDataContract](docs/JsonDataContract.md) + - [ListFilesResponse](docs/ListFilesResponse.md) - [LogMethods](docs/LogMethods.md) - [Period](docs/Period.md) - [PublishMessageParams](docs/PublishMessageParams.md) - [PublishMessageResponse](docs/PublishMessageResponse.md) - [StorageDataContract](docs/StorageDataContract.md) + - [UploadFileResponse](docs/UploadFileResponse.md) - [UpsertByKeyFromStorage200Response](docs/UpsertByKeyFromStorage200Response.md) - [UpsertByKeyFromStorage200ResponseAnyOf](docs/UpsertByKeyFromStorage200ResponseAnyOf.md) - [UpsertByKeyFromStorage200ResponseAnyOf1](docs/UpsertByKeyFromStorage200ResponseAnyOf1.md) @@ -82,4 +93,3 @@ Class | Method | HTTP request | Description - [ValidateSecretResponse](docs/ValidateSecretResponse.md) - [WriteLogRequestBody](docs/WriteLogRequestBody.md) - [WriteLogRequestBodyError](docs/WriteLogRequestBodyError.md) - diff --git a/docs/EnvironmentVariablesApi.md b/docs/EnvironmentVariablesApi.md index cb84489..12e1db5 100644 --- a/docs/EnvironmentVariablesApi.md +++ b/docs/EnvironmentVariablesApi.md @@ -11,8 +11,6 @@ Method | HTTP request | Description # **get_environment_variable** > object get_environment_variable(name) - - ### Example @@ -76,8 +74,6 @@ No authorization required # **get_environment_variable_keys** > List[str] get_environment_variable_keys() - - ### Example diff --git a/docs/LogsApi.md b/docs/LogsApi.md index ddce9b6..1783f66 100644 --- a/docs/LogsApi.md +++ b/docs/LogsApi.md @@ -10,8 +10,6 @@ Method | HTTP request | Description # **write_log** > write_log(write_log_request_body) - - ### Example diff --git a/docs/QueueApi.md b/docs/QueueApi.md index 37842d7..74f81eb 100644 --- a/docs/QueueApi.md +++ b/docs/QueueApi.md @@ -11,8 +11,6 @@ Method | HTTP request | Description # **publish_message** > PublishMessageResponse publish_message(publish_message_params) - - ### Example @@ -77,8 +75,6 @@ No authorization required # **validate_secret** > ValidateSecretResponse validate_secret(validate_secret_params) - - ### Example diff --git a/docs/SecretsApi.md b/docs/SecretsApi.md index b3211df..312c063 100644 --- a/docs/SecretsApi.md +++ b/docs/SecretsApi.md @@ -11,8 +11,6 @@ Method | HTTP request | Description # **get_secret** > str get_secret(name) - - ### Example @@ -76,8 +74,6 @@ No authorization required # **get_secret_keys** > List[str] get_secret_keys() - - ### Example diff --git a/docs/SecureStorageApi.md b/docs/SecureStorageApi.md index e8389a0..e689401 100644 --- a/docs/SecureStorageApi.md +++ b/docs/SecureStorageApi.md @@ -12,8 +12,6 @@ Method | HTTP request | Description # **delete_secure_storage** > delete_secure_storage(key) - - ### Example @@ -74,8 +72,6 @@ No authorization required # **get_secure_storage** > JsonDataContract get_secure_storage(key) - - ### Example @@ -140,8 +136,6 @@ No authorization required # **put_secure_storage** > bool put_secure_storage(key, json_data_contract) - - ### Example diff --git a/docs/StorageApi.md b/docs/StorageApi.md index 85dbd33..10b9edf 100644 --- a/docs/StorageApi.md +++ b/docs/StorageApi.md @@ -14,8 +14,6 @@ Method | HTTP request | Description # **delete_by_key_from_storage** > delete_by_key_from_storage(key, x_monday_access_token) - - ### Example @@ -78,8 +76,6 @@ No authorization required # **get_by_key_from_storage** > StorageDataContract get_by_key_from_storage(key, shared, x_monday_access_token) - - ### Example @@ -149,8 +145,6 @@ No authorization required # **increment_counter** > IncrementCounter200Response increment_counter(x_monday_access_token, increment_counter_params) - - ### Example @@ -217,8 +211,6 @@ No authorization required # **search_record** > object search_record(term, x_monday_access_token, cursor=cursor) - - ### Example @@ -287,8 +279,6 @@ No authorization required # **upsert_by_key_from_storage** > UpsertByKeyFromStorage200Response upsert_by_key_from_storage(key, x_monday_access_token, json_data_contract, shared=shared, previous_version=previous_version, ttl=ttl) - - ### Example diff --git a/monday_code/__init__.py b/monday_code/__init__.py index d1b3fa3..bb623c9 100644 --- a/monday_code/__init__.py +++ b/monday_code/__init__.py @@ -16,49 +16,95 @@ __version__ = "2.1.0" +# Define package exports +__all__ = [ + "EnvironmentVariablesApi", + "LogsApi", + "ObjectStorageApi", + "QueueApi", + "SecretsApi", + "SecureStorageApi", + "StorageApi", + "ApiResponse", + "ApiClient", + "Configuration", + "OpenApiException", + "ApiTypeError", + "ApiValueError", + "ApiKeyError", + "ApiAttributeError", + "ApiException", + "DeleteFileResponse", + "DownloadFileResponse", + "FileInfo", + "GetByKeyFromStorage404Response", + "GetByKeyFromStorage500Response", + "GetFileInfoResponse", + "IncrementCounter200Response", + "IncrementCounter200ResponseAnyOf", + "IncrementCounter200ResponseAnyOf1", + "IncrementCounterParams", + "JsonDataContract", + "ListFilesResponse", + "LogMethods", + "Period", + "PublishMessageParams", + "PublishMessageResponse", + "StorageDataContract", + "UploadFileResponse", + "UpsertByKeyFromStorage200Response", + "UpsertByKeyFromStorage200ResponseAnyOf", + "UpsertByKeyFromStorage200ResponseAnyOf1", + "ValidateSecretParams", + "ValidateSecretResponse", + "WriteLogRequestBody", + "WriteLogRequestBodyError", +] + # import apis into sdk package -from monday_code.api.environment_variables_api import EnvironmentVariablesApi -from monday_code.api.logs_api import LogsApi -from monday_code.api.object_storage_api import ObjectStorageApi -from monday_code.api.queue_api import QueueApi -from monday_code.api.secrets_api import SecretsApi -from monday_code.api.secure_storage_api import SecureStorageApi -from monday_code.api.storage_api import StorageApi +from monday_code.api.environment_variables_api import EnvironmentVariablesApi as EnvironmentVariablesApi +from monday_code.api.logs_api import LogsApi as LogsApi +from monday_code.api.object_storage_api import ObjectStorageApi as ObjectStorageApi +from monday_code.api.queue_api import QueueApi as QueueApi +from monday_code.api.secrets_api import SecretsApi as SecretsApi +from monday_code.api.secure_storage_api import SecureStorageApi as SecureStorageApi +from monday_code.api.storage_api import StorageApi as StorageApi # import ApiClient -from monday_code.api_response import ApiResponse -from monday_code.api_client import ApiClient -from monday_code.configuration import Configuration -from monday_code.exceptions import OpenApiException -from monday_code.exceptions import ApiTypeError -from monday_code.exceptions import ApiValueError -from monday_code.exceptions import ApiKeyError -from monday_code.exceptions import ApiAttributeError -from monday_code.exceptions import ApiException +from monday_code.api_response import ApiResponse as ApiResponse +from monday_code.api_client import ApiClient as ApiClient +from monday_code.configuration import Configuration as Configuration +from monday_code.exceptions import OpenApiException as OpenApiException +from monday_code.exceptions import ApiTypeError as ApiTypeError +from monday_code.exceptions import ApiValueError as ApiValueError +from monday_code.exceptions import ApiKeyError as ApiKeyError +from monday_code.exceptions import ApiAttributeError as ApiAttributeError +from monday_code.exceptions import ApiException as ApiException # import models into sdk package -from monday_code.models.delete_file_response import DeleteFileResponse -from monday_code.models.download_file_response import DownloadFileResponse -from monday_code.models.file_info import FileInfo -from monday_code.models.get_by_key_from_storage404_response import GetByKeyFromStorage404Response -from monday_code.models.get_by_key_from_storage500_response import GetByKeyFromStorage500Response -from monday_code.models.get_file_info_response import GetFileInfoResponse -from monday_code.models.increment_counter200_response import IncrementCounter200Response -from monday_code.models.increment_counter200_response_any_of import IncrementCounter200ResponseAnyOf -from monday_code.models.increment_counter200_response_any_of1 import IncrementCounter200ResponseAnyOf1 -from monday_code.models.increment_counter_params import IncrementCounterParams -from monday_code.models.json_data_contract import JsonDataContract -from monday_code.models.list_files_response import ListFilesResponse -from monday_code.models.log_methods import LogMethods -from monday_code.models.period import Period -from monday_code.models.publish_message_params import PublishMessageParams -from monday_code.models.publish_message_response import PublishMessageResponse -from monday_code.models.storage_data_contract import StorageDataContract -from monday_code.models.upload_file_response import UploadFileResponse -from monday_code.models.upsert_by_key_from_storage200_response import UpsertByKeyFromStorage200Response -from monday_code.models.upsert_by_key_from_storage200_response_any_of import UpsertByKeyFromStorage200ResponseAnyOf -from monday_code.models.upsert_by_key_from_storage200_response_any_of1 import UpsertByKeyFromStorage200ResponseAnyOf1 -from monday_code.models.validate_secret_params import ValidateSecretParams -from monday_code.models.validate_secret_response import ValidateSecretResponse -from monday_code.models.write_log_request_body import WriteLogRequestBody -from monday_code.models.write_log_request_body_error import WriteLogRequestBodyError +from monday_code.models.delete_file_response import DeleteFileResponse as DeleteFileResponse +from monday_code.models.download_file_response import DownloadFileResponse as DownloadFileResponse +from monday_code.models.file_info import FileInfo as FileInfo +from monday_code.models.get_by_key_from_storage404_response import GetByKeyFromStorage404Response as GetByKeyFromStorage404Response +from monday_code.models.get_by_key_from_storage500_response import GetByKeyFromStorage500Response as GetByKeyFromStorage500Response +from monday_code.models.get_file_info_response import GetFileInfoResponse as GetFileInfoResponse +from monday_code.models.increment_counter200_response import IncrementCounter200Response as IncrementCounter200Response +from monday_code.models.increment_counter200_response_any_of import IncrementCounter200ResponseAnyOf as IncrementCounter200ResponseAnyOf +from monday_code.models.increment_counter200_response_any_of1 import IncrementCounter200ResponseAnyOf1 as IncrementCounter200ResponseAnyOf1 +from monday_code.models.increment_counter_params import IncrementCounterParams as IncrementCounterParams +from monday_code.models.json_data_contract import JsonDataContract as JsonDataContract +from monday_code.models.list_files_response import ListFilesResponse as ListFilesResponse +from monday_code.models.log_methods import LogMethods as LogMethods +from monday_code.models.period import Period as Period +from monday_code.models.publish_message_params import PublishMessageParams as PublishMessageParams +from monday_code.models.publish_message_response import PublishMessageResponse as PublishMessageResponse +from monday_code.models.storage_data_contract import StorageDataContract as StorageDataContract +from monday_code.models.upload_file_response import UploadFileResponse as UploadFileResponse +from monday_code.models.upsert_by_key_from_storage200_response import UpsertByKeyFromStorage200Response as UpsertByKeyFromStorage200Response +from monday_code.models.upsert_by_key_from_storage200_response_any_of import UpsertByKeyFromStorage200ResponseAnyOf as UpsertByKeyFromStorage200ResponseAnyOf +from monday_code.models.upsert_by_key_from_storage200_response_any_of1 import UpsertByKeyFromStorage200ResponseAnyOf1 as UpsertByKeyFromStorage200ResponseAnyOf1 +from monday_code.models.validate_secret_params import ValidateSecretParams as ValidateSecretParams +from monday_code.models.validate_secret_response import ValidateSecretResponse as ValidateSecretResponse +from monday_code.models.write_log_request_body import WriteLogRequestBody as WriteLogRequestBody +from monday_code.models.write_log_request_body_error import WriteLogRequestBodyError as WriteLogRequestBodyError + diff --git a/monday_code/api_client.py b/monday_code/api_client.py index 3d2f07f..bdfe771 100644 --- a/monday_code/api_client.py +++ b/monday_code/api_client.py @@ -21,6 +21,7 @@ import os import re import tempfile +import uuid from urllib.parse import quote from typing import Tuple, Optional, List, Dict, Union @@ -314,7 +315,7 @@ def response_deserialize( return_data = self.__deserialize_file(response_data) elif response_type is not None: match = None - content_type = response_data.getheader('content-type') + content_type = response_data.headers.get('content-type') if content_type is not None: match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) encoding = match.group(1) if match else "utf-8" @@ -331,7 +332,7 @@ def response_deserialize( return ApiResponse( status_code = response_data.status, data = return_data, - headers = response_data.getheaders(), + headers = response_data.headers, raw_data = response_data.data ) @@ -359,6 +360,8 @@ def sanitize_for_serialization(self, obj): return obj.get_secret_value() elif isinstance(obj, self.PRIMITIVE_TYPES): return obj + elif isinstance(obj, uuid.UUID): + return str(obj) elif isinstance(obj, list): return [ self.sanitize_for_serialization(sub_obj) for sub_obj in obj @@ -385,6 +388,10 @@ def sanitize_for_serialization(self, obj): else: obj_dict = obj.__dict__ + if isinstance(obj_dict, list): + # here we handle instances that can either be a list or something else, and only became a real list by calling to_dict() + return self.sanitize_for_serialization(obj_dict) + return { key: self.sanitize_for_serialization(val) for key, val in obj_dict.items() @@ -407,7 +414,7 @@ def deserialize(self, response_text: str, response_type: str, content_type: Opti data = json.loads(response_text) except ValueError: data = response_text - elif re.match(r'^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE): + elif re.match(r'^application/(json|[\w!#$&.+\-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE): if response_text == "": data = "" else: @@ -456,13 +463,13 @@ def __deserialize(self, data, klass): if klass in self.PRIMITIVE_TYPES: return self.__deserialize_primitive(data, klass) - elif klass == object: + elif klass is object: return self.__deserialize_object(data) - elif klass == datetime.date: + elif klass is datetime.date: return self.__deserialize_date(data) - elif klass == datetime.datetime: + elif klass is datetime.datetime: return self.__deserialize_datetime(data) - elif klass == decimal.Decimal: + elif klass is decimal.Decimal: return decimal.Decimal(data) elif issubclass(klass, Enum): return self.__deserialize_enum(data, klass) @@ -520,7 +527,7 @@ def parameters_to_url_query(self, params, collection_formats): if k in collection_formats: collection_format = collection_formats[k] if collection_format == 'multi': - new_params.extend((k, str(value)) for value in v) + new_params.extend((k, quote(str(value))) for value in v) else: if collection_format == 'ssv': delimiter = ' ' @@ -697,7 +704,7 @@ def __deserialize_file(self, response): os.close(fd) os.remove(path) - content_disposition = response.getheader("Content-Disposition") + content_disposition = response.headers.get("Content-Disposition") if content_disposition: m = re.search( r'filename=[\'"]?([^\'"\s]+)[\'"]?', diff --git a/monday_code/configuration.py b/monday_code/configuration.py index 633d8e1..ad6ccbf 100644 --- a/monday_code/configuration.py +++ b/monday_code/configuration.py @@ -12,15 +12,15 @@ """ # noqa: E501 +import base64 import copy import http.client as httplib import logging from logging import FileHandler import sys -from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict +from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union from typing_extensions import NotRequired, Self -import urllib3 JSON_SCHEMA_VALIDATION_KEYWORDS = { @@ -159,6 +159,10 @@ class Configuration: :param ssl_ca_cert: str - the path to a file of concatenated CA certificates in PEM format. :param retries: Number of retries for API requests. + :param ca_cert_data: verify the peer using concatenated CA certificate data + in PEM (str) or DER (bytes) format. + :param cert_file: the path to a client certificate file, for mTLS. + :param key_file: the path to a client key file, for mTLS. """ @@ -172,13 +176,16 @@ def __init__( username: Optional[str]=None, password: Optional[str]=None, access_token: Optional[str]=None, - server_index: Optional[int]=None, + server_index: Optional[int]=None, server_variables: Optional[ServerVariablesT]=None, server_operation_index: Optional[Dict[int, int]]=None, server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None, ignore_operation_servers: bool=False, ssl_ca_cert: Optional[str]=None, retries: Optional[int] = None, + ca_cert_data: Optional[Union[str, bytes]] = None, + cert_file: Optional[str]=None, + key_file: Optional[str]=None, *, debug: Optional[bool] = None, ) -> None: @@ -228,7 +235,6 @@ def __init__( """Logging Settings """ self.logger["package_logger"] = logging.getLogger("monday_code") - self.logger["urllib3_logger"] = logging.getLogger("urllib3") self.logger_format = '%(asctime)s %(levelname)s %(message)s' """Log format """ @@ -256,10 +262,14 @@ def __init__( self.ssl_ca_cert = ssl_ca_cert """Set this to customize the certificate file to verify the peer. """ - self.cert_file = None + self.ca_cert_data = ca_cert_data + """Set this to verify the peer using PEM (str) or DER (bytes) + certificate data. + """ + self.cert_file = cert_file """client certificate file """ - self.key_file = None + self.key_file = key_file """client key file """ self.assert_hostname = None @@ -469,9 +479,10 @@ def get_basic_auth_token(self) -> Optional[str]: password = "" if self.password is not None: password = self.password - return urllib3.util.make_headers( - basic_auth=username + ':' + password - ).get('authorization') + + return "Basic " + base64.b64encode( + (username + ":" + password).encode('utf-8') + ).decode('utf-8') def auth_settings(self)-> AuthSettings: """Gets Auth Settings dict for api client. @@ -538,6 +549,7 @@ def get_host_from_settings( variable_name, variable['default_value']) if 'enum_values' in variable \ + and variable['enum_values'] \ and used_value not in variable['enum_values']: raise ValueError( "The variable `{0}` in the host URL has invalid value " diff --git a/monday_code/exceptions.py b/monday_code/exceptions.py index 01e8aec..3e21285 100644 --- a/monday_code/exceptions.py +++ b/monday_code/exceptions.py @@ -128,7 +128,7 @@ def __init__( self.body = http_resp.data.decode('utf-8') except Exception: pass - self.headers = http_resp.getheaders() + self.headers = http_resp.headers @classmethod def from_response( @@ -150,6 +150,13 @@ def from_response( if http_resp.status == 404: raise NotFoundException(http_resp=http_resp, body=body, data=data) + # Added new conditions for 409 and 422 + if http_resp.status == 409: + raise ConflictException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 422: + raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data) + if 500 <= http_resp.status <= 599: raise ServiceException(http_resp=http_resp, body=body, data=data) raise ApiException(http_resp=http_resp, body=body, data=data) @@ -162,8 +169,11 @@ def __str__(self): error_message += "HTTP response headers: {0}\n".format( self.headers) - if self.data or self.body: - error_message += "HTTP response body: {0}\n".format(self.data or self.body) + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + if self.data: + error_message += "HTTP response data: {0}\n".format(self.data) return error_message @@ -188,6 +198,16 @@ class ServiceException(ApiException): pass +class ConflictException(ApiException): + """Exception for HTTP 409 Conflict.""" + pass + + +class UnprocessableEntityException(ApiException): + """Exception for HTTP 422 Unprocessable Entity.""" + pass + + def render_path(path_to_item): """Returns a string representation of a path""" result = "" diff --git a/monday_code/models/__init__.py b/monday_code/models/__init__.py index 76b36d7..232ece1 100644 --- a/monday_code/models/__init__.py +++ b/monday_code/models/__init__.py @@ -12,7 +12,6 @@ Do not edit the class manually. """ # noqa: E501 - # import models into model package from monday_code.models.delete_file_response import DeleteFileResponse from monday_code.models.download_file_response import DownloadFileResponse @@ -39,3 +38,4 @@ from monday_code.models.validate_secret_response import ValidateSecretResponse from monday_code.models.write_log_request_body import WriteLogRequestBody from monday_code.models.write_log_request_body_error import WriteLogRequestBodyError + diff --git a/monday_code/rest.py b/monday_code/rest.py index 0f73067..0dc7edf 100644 --- a/monday_code/rest.py +++ b/monday_code/rest.py @@ -40,12 +40,17 @@ async def read(self): self.data = await self.response.read() return self.data + @property + def headers(self): + """Returns a CIMultiDictProxy of response headers.""" + return self.response.headers + def getheaders(self): - """Returns a CIMultiDictProxy of the response headers.""" + """Returns a CIMultiDictProxy of the response headers; use ``headers`` instead.""" return self.response.headers def getheader(self, name, default=None): - """Returns a given response header.""" + """Returns a given response header; use ``headers.get()`` instead.""" return self.response.headers.get(name, default) @@ -54,51 +59,32 @@ class RESTClientObject: def __init__(self, configuration) -> None: # maxsize is number of requests to host that are allowed in parallel - maxsize = configuration.connection_pool_maxsize + self.maxsize = configuration.connection_pool_maxsize - ssl_context = ssl.create_default_context( - cafile=configuration.ssl_ca_cert + self.ssl_context = ssl.create_default_context( + cafile=configuration.ssl_ca_cert, + cadata=configuration.ca_cert_data, ) if configuration.cert_file: - ssl_context.load_cert_chain( + self.ssl_context.load_cert_chain( configuration.cert_file, keyfile=configuration.key_file ) if not configuration.verify_ssl: - ssl_context.check_hostname = False - ssl_context.verify_mode = ssl.CERT_NONE - - connector = aiohttp.TCPConnector( - limit=maxsize, - ssl=ssl_context - ) + self.ssl_context.check_hostname = False + self.ssl_context.verify_mode = ssl.CERT_NONE self.proxy = configuration.proxy self.proxy_headers = configuration.proxy_headers - # https pool manager - self.pool_manager = aiohttp.ClientSession( - connector=connector, - trust_env=True - ) + self.retries = configuration.retries - retries = configuration.retries - self.retry_client: Optional[aiohttp_retry.RetryClient] - if retries is not None: - self.retry_client = aiohttp_retry.RetryClient( - client_session=self.pool_manager, - retry_options=aiohttp_retry.ExponentialRetry( - attempts=retries, - factor=2.0, - start_timeout=0.1, - max_timeout=120.0 - ) - ) - else: - self.retry_client = None + self.pool_manager: Optional[aiohttp.ClientSession] = None + self.retry_client: Optional[aiohttp_retry.RetryClient] = None - async def close(self): - await self.pool_manager.close() + async def close(self) -> None: + if self.pool_manager: + await self.pool_manager.close() if self.retry_client is not None: await self.retry_client.close() @@ -205,10 +191,27 @@ async def request( raise ApiException(status=0, reason=msg) pool_manager: Union[aiohttp.ClientSession, aiohttp_retry.RetryClient] - if self.retry_client is not None and method in ALLOW_RETRY_METHODS: + + # https pool manager + if self.pool_manager is None: + self.pool_manager = aiohttp.ClientSession( + connector=aiohttp.TCPConnector(limit=self.maxsize, ssl=self.ssl_context), + trust_env=True, + ) + pool_manager = self.pool_manager + + if self.retries is not None and method in ALLOW_RETRY_METHODS: + if self.retry_client is None: + self.retry_client = aiohttp_retry.RetryClient( + client_session=self.pool_manager, + retry_options=aiohttp_retry.ExponentialRetry( + attempts=self.retries, + factor=2.0, + start_timeout=0.1, + max_timeout=120.0 + ) + ) pool_manager = self.retry_client - else: - pool_manager = self.pool_manager r = await pool_manager.request(**args) diff --git a/pyproject.toml b/pyproject.toml index 164a3ad..190d1da 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,25 +1,30 @@ -[tool.poetry] +[project] name = "monday_code" version = "2.1.0" description = "mcode-sdk-api" -authors = ["OpenAPI Generator Community "] -license = "MIT" +authors = [ + {name = "OpenAPI Generator Community",email = "team@openapitools.org"}, +] +license = { text = "MIT" } readme = "README.md" -repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID" keywords = ["OpenAPI", "OpenAPI-Generator", "mcode-sdk-api"] -include = ["monday_code/py.typed"] +requires-python = ">=3.9" -[tool.poetry.dependencies] -python = "^3.8" +dependencies = [ + "python-dateutil (>=2.8.2)", + "aiohttp (>=3.8.4)", + "aiohttp-retry (>=2.8.3)", + "pydantic (>=2)", + "typing-extensions (>=4.7.1)", +] -urllib3 = ">= 1.25.3 < 3.0.0" -python-dateutil = ">= 2.8.2" -aiohttp = ">= 3.8.4" -aiohttp-retry = ">= 2.8.3" -pydantic = ">= 2" -typing-extensions = ">= 4.7.1" +[project.urls] +Repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID" + +[tool.poetry] +requires-poetry = ">=2.0" -[tool.poetry.dev-dependencies] +[tool.poetry.group.dev.dependencies] pytest = ">= 7.2.1" pytest-cov = ">= 2.8.1" tox = ">= 3.9.0" diff --git a/requirements.txt b/requirements.txt index e5c12b1..8c5c440 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ -urllib3 >= 1.25.3, < 3.0.0 python_dateutil >= 2.8.2 aiohttp >= 3.8.4 aiohttp-retry >= 2.8.3 diff --git a/setup.py b/setup.py index a35e768..d40450e 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,5 @@ from pathlib import Path + # coding: utf-8 """ @@ -23,9 +24,8 @@ # http://pypi.python.org/pypi/setuptools NAME = "monday-code" VERSION = "2.1.0" -PYTHON_REQUIRES = ">= 3.8" +PYTHON_REQUIRES = ">= 3.9" REQUIRES = [ - "urllib3 >= 1.25.3, < 3.0.0", "python-dateutil >= 2.8.2", "aiohttp >= 3.8.4", "aiohttp-retry >= 2.8.3", diff --git a/test/test_environment_variables_api.py b/test/test_environment_variables_api.py index 2dfa5cd..91182cd 100644 --- a/test/test_environment_variables_api.py +++ b/test/test_environment_variables_api.py @@ -24,7 +24,7 @@ async def asyncSetUp(self) -> None: self.api = EnvironmentVariablesApi() async def asyncTearDown(self) -> None: - pass + await self.api.api_client.close() async def test_get_environment_variable(self) -> None: """Test case for get_environment_variable diff --git a/test/test_logs_api.py b/test/test_logs_api.py index fce6bb5..303978a 100644 --- a/test/test_logs_api.py +++ b/test/test_logs_api.py @@ -24,7 +24,7 @@ async def asyncSetUp(self) -> None: self.api = LogsApi() async def asyncTearDown(self) -> None: - pass + await self.api.api_client.close() async def test_write_log(self) -> None: """Test case for write_log diff --git a/test/test_queue_api.py b/test/test_queue_api.py index 8c43b74..5b860d3 100644 --- a/test/test_queue_api.py +++ b/test/test_queue_api.py @@ -24,7 +24,7 @@ async def asyncSetUp(self) -> None: self.api = QueueApi() async def asyncTearDown(self) -> None: - pass + await self.api.api_client.close() async def test_publish_message(self) -> None: """Test case for publish_message diff --git a/test/test_secrets_api.py b/test/test_secrets_api.py index 12b5a3e..5768adb 100644 --- a/test/test_secrets_api.py +++ b/test/test_secrets_api.py @@ -24,7 +24,7 @@ async def asyncSetUp(self) -> None: self.api = SecretsApi() async def asyncTearDown(self) -> None: - pass + await self.api.api_client.close() async def test_get_secret(self) -> None: """Test case for get_secret diff --git a/test/test_secure_storage_api.py b/test/test_secure_storage_api.py index fb50b96..7a99422 100644 --- a/test/test_secure_storage_api.py +++ b/test/test_secure_storage_api.py @@ -24,7 +24,7 @@ async def asyncSetUp(self) -> None: self.api = SecureStorageApi() async def asyncTearDown(self) -> None: - pass + await self.api.api_client.close() async def test_delete_secure_storage(self) -> None: """Test case for delete_secure_storage diff --git a/test/test_storage_api.py b/test/test_storage_api.py index 939c3a3..aca5e5e 100644 --- a/test/test_storage_api.py +++ b/test/test_storage_api.py @@ -24,7 +24,7 @@ async def asyncSetUp(self) -> None: self.api = StorageApi() async def asyncTearDown(self) -> None: - pass + await self.api.api_client.close() async def test_delete_by_key_from_storage(self) -> None: """Test case for delete_by_key_from_storage