diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml new file mode 100644 index 0000000..3f63d9e --- /dev/null +++ b/.github/workflows/python.yml @@ -0,0 +1,31 @@ +# NOTE: This file is auto generated by OpenAPI Generator. +# URL: https://openapi-generator.tech +# +# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: monday_code Python package + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install -r test-requirements.txt + - name: Test with pytest + run: | + pytest --cov={{packageName}} diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES new file mode 100644 index 0000000..2a932e0 --- /dev/null +++ b/.openapi-generator/FILES @@ -0,0 +1,98 @@ +.github/workflows/python.yml +.gitignore +.gitlab-ci.yml +.openapi-generator-ignore +.travis.yml +README.md +docs/EnvironmentVariablesApi.md +docs/GetByKeyFromStorage404Response.md +docs/GetByKeyFromStorage500Response.md +docs/IncrementCounter200Response.md +docs/IncrementCounter200ResponseAnyOf.md +docs/IncrementCounter200ResponseAnyOf1.md +docs/IncrementCounterParams.md +docs/JsonDataContract.md +docs/LogMethods.md +docs/LogsApi.md +docs/Period.md +docs/PublishMessageParams.md +docs/PublishMessageResponse.md +docs/QueueApi.md +docs/SecretsApi.md +docs/SecureStorageApi.md +docs/StorageApi.md +docs/StorageDataContract.md +docs/UpsertByKeyFromStorage200Response.md +docs/UpsertByKeyFromStorage200ResponseAnyOf.md +docs/UpsertByKeyFromStorage200ResponseAnyOf1.md +docs/ValidateSecretParams.md +docs/ValidateSecretResponse.md +docs/WriteLogRequestBody.md +docs/WriteLogRequestBodyError.md +git_push.sh +monday_code/__init__.py +monday_code/api/__init__.py +monday_code/api/environment_variables_api.py +monday_code/api/logs_api.py +monday_code/api/queue_api.py +monday_code/api/secrets_api.py +monday_code/api/secure_storage_api.py +monday_code/api/storage_api.py +monday_code/api_client.py +monday_code/api_response.py +monday_code/configuration.py +monday_code/exceptions.py +monday_code/models/__init__.py +monday_code/models/get_by_key_from_storage404_response.py +monday_code/models/get_by_key_from_storage500_response.py +monday_code/models/increment_counter200_response.py +monday_code/models/increment_counter200_response_any_of.py +monday_code/models/increment_counter200_response_any_of1.py +monday_code/models/increment_counter_params.py +monday_code/models/json_data_contract.py +monday_code/models/log_methods.py +monday_code/models/period.py +monday_code/models/publish_message_params.py +monday_code/models/publish_message_response.py +monday_code/models/storage_data_contract.py +monday_code/models/upsert_by_key_from_storage200_response.py +monday_code/models/upsert_by_key_from_storage200_response_any_of.py +monday_code/models/upsert_by_key_from_storage200_response_any_of1.py +monday_code/models/validate_secret_params.py +monday_code/models/validate_secret_response.py +monday_code/models/write_log_request_body.py +monday_code/models/write_log_request_body_error.py +monday_code/py.typed +monday_code/rest.py +pyproject.toml +requirements.txt +setup.cfg +setup.py +test-requirements.txt +test/__init__.py +test/test_environment_variables_api.py +test/test_get_by_key_from_storage404_response.py +test/test_get_by_key_from_storage500_response.py +test/test_increment_counter200_response.py +test/test_increment_counter200_response_any_of.py +test/test_increment_counter200_response_any_of1.py +test/test_increment_counter_params.py +test/test_json_data_contract.py +test/test_log_methods.py +test/test_logs_api.py +test/test_period.py +test/test_publish_message_params.py +test/test_publish_message_response.py +test/test_queue_api.py +test/test_secrets_api.py +test/test_secure_storage_api.py +test/test_storage_api.py +test/test_storage_data_contract.py +test/test_upsert_by_key_from_storage200_response.py +test/test_upsert_by_key_from_storage200_response_any_of.py +test/test_upsert_by_key_from_storage200_response_any_of1.py +test/test_validate_secret_params.py +test/test_validate_secret_response.py +test/test_write_log_request_body.py +test/test_write_log_request_body_error.py +tox.ini diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 0000000..8841191 --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.11.0-SNAPSHOT diff --git a/README.md b/README.md index 1a1dc5f..080e869 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ Class | Method | HTTP request | Description *StorageApi* | [**delete_by_key_from_storage**](docs/StorageApi.md#delete_by_key_from_storage) | **DELETE** /storage/{key} | *StorageApi* | [**get_by_key_from_storage**](docs/StorageApi.md#get_by_key_from_storage) | **GET** /storage/{key} | *StorageApi* | [**increment_counter**](docs/StorageApi.md#increment_counter) | **PUT** /storage/counter/increment | +*StorageApi* | [**search_record**](docs/StorageApi.md#search_record) | **GET** /storage/search/{term} | *StorageApi* | [**upsert_by_key_from_storage**](docs/StorageApi.md#upsert_by_key_from_storage) | **PUT** /storage/{key} | diff --git a/docs/StorageApi.md b/docs/StorageApi.md index 8cb6b94..69cfa3c 100644 --- a/docs/StorageApi.md +++ b/docs/StorageApi.md @@ -7,6 +7,7 @@ Method | HTTP request | Description [**delete_by_key_from_storage**](StorageApi.md#delete_by_key_from_storage) | **DELETE** /storage/{key} | [**get_by_key_from_storage**](StorageApi.md#get_by_key_from_storage) | **GET** /storage/{key} | [**increment_counter**](StorageApi.md#increment_counter) | **PUT** /storage/counter/increment | +[**search_record**](StorageApi.md#search_record) | **GET** /storage/search/{term} | [**upsert_by_key_from_storage**](StorageApi.md#upsert_by_key_from_storage) | **PUT** /storage/{key} | @@ -213,6 +214,76 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **search_record** +> object search_record(term, x_monday_access_token, cursor=cursor) + + + +### Example + + +```python +import monday_code +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.StorageApi(api_client) + term = 'term_example' # str | + x_monday_access_token = 'x_monday_access_token_example' # str | + cursor = 'cursor_example' # str | (optional) + + try: + api_response = api_instance.search_record(term, x_monday_access_token, cursor=cursor) + print("The response of StorageApi->search_record:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling StorageApi->search_record: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **term** | **str**| | + **x_monday_access_token** | **str**| | + **cursor** | **str**| | [optional] + +### Return type + +**object** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | OK | - | +**404** | | - | +**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) + # **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) diff --git a/monday_code/api/storage_api.py b/monday_code/api/storage_api.py index 5d743ef..c079b28 100644 --- a/monday_code/api/storage_api.py +++ b/monday_code/api/storage_api.py @@ -17,7 +17,7 @@ from typing_extensions import Annotated from pydantic import StrictBool, StrictStr -from typing import Optional +from typing import Any, Optional from monday_code.models.increment_counter200_response import IncrementCounter200Response from monday_code.models.increment_counter_params import IncrementCounterParams from monday_code.models.json_data_contract import JsonDataContract @@ -887,6 +887,301 @@ def _increment_counter_serialize( + @validate_call + def search_record( + self, + term: StrictStr, + x_monday_access_token: StrictStr, + cursor: 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, + ) -> object: + """search_record + + + :param term: (required) + :type term: str + :param x_monday_access_token: (required) + :type x_monday_access_token: str + :param cursor: + :type cursor: 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._search_record_serialize( + term=term, + x_monday_access_token=x_monday_access_token, + cursor=cursor, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "object", + '404': "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 search_record_with_http_info( + self, + term: StrictStr, + x_monday_access_token: StrictStr, + cursor: 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[object]: + """search_record + + + :param term: (required) + :type term: str + :param x_monday_access_token: (required) + :type x_monday_access_token: str + :param cursor: + :type cursor: 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._search_record_serialize( + term=term, + x_monday_access_token=x_monday_access_token, + cursor=cursor, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "object", + '404': "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 search_record_without_preload_content( + self, + term: StrictStr, + x_monday_access_token: StrictStr, + cursor: 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: + """search_record + + + :param term: (required) + :type term: str + :param x_monday_access_token: (required) + :type x_monday_access_token: str + :param cursor: + :type cursor: 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._search_record_serialize( + term=term, + x_monday_access_token=x_monday_access_token, + cursor=cursor, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "object", + '404': "GetByKeyFromStorage404Response", + '500': "GetByKeyFromStorage500Response", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _search_record_serialize( + self, + term, + x_monday_access_token, + cursor, + _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 term is not None: + _path_params['term'] = term + # process the query parameters + if cursor is not None: + + _query_params.append(('cursor', cursor)) + + # process the header parameters + if x_monday_access_token is not None: + _header_params['x-monday-access-token'] = x_monday_access_token + # 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='/storage/search/{term}', + 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 upsert_by_key_from_storage( self, diff --git a/monday_code/api_client.py b/monday_code/api_client.py index eb66df6..6837007 100644 --- a/monday_code/api_client.py +++ b/monday_code/api_client.py @@ -517,7 +517,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 = ' ' diff --git a/pyproject.toml b/pyproject.toml index 9e87e05..a3c1835 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,7 +49,7 @@ warn_unused_ignores = true ## Getting these passing should be easy strict_equality = true -strict_concatenate = true +extra_checks = true ## Strongly recommend enabling this one as soon as you can check_untyped_defs = true @@ -70,3 +70,20 @@ disallow_any_generics = true # ### This one can be tricky to get passing if you use a lot of untyped libraries #warn_return_any = true + +[[tool.mypy.overrides]] +module = [ + "monday_code.configuration", +] +warn_unused_ignores = true +strict_equality = true +extra_checks = true +check_untyped_defs = true +disallow_subclassing_any = true +disallow_untyped_decorators = true +disallow_any_generics = true +disallow_untyped_calls = true +disallow_incomplete_defs = true +disallow_untyped_defs = true +no_implicit_reexport = true +warn_return_any = true diff --git a/setup.py b/setup.py index 3ce6ac2..8d32d72 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools NAME = "monday-code" -VERSION = "0.2.2" +VERSION = "0.2.3" PYTHON_REQUIRES = ">= 3.8" REQUIRES = [ "urllib3 >= 1.25.3, < 3.0.0", @@ -29,6 +29,7 @@ "pydantic >= 2", "typing-extensions >= 4.7.1", ] + # read the contents of your README file from pathlib import Path diff --git a/test/test_storage_api.py b/test/test_storage_api.py index 73abd26..fa15b6e 100644 --- a/test/test_storage_api.py +++ b/test/test_storage_api.py @@ -44,6 +44,12 @@ def test_increment_counter(self) -> None: """ pass + def test_search_record(self) -> None: + """Test case for search_record + + """ + pass + def test_upsert_by_key_from_storage(self) -> None: """Test case for upsert_by_key_from_storage