From 13dcd44dc8950ed6773558a7963bb5c1b851d7cd Mon Sep 17 00:00:00 2001 From: algolia-bot Date: Tue, 30 Jul 2024 08:41:12 +0000 Subject: [PATCH] fix(specs): proper title with linter (generated) https://github.com/algolia/api-clients-automation/pull/3444 Co-authored-by: algolia-bot Co-authored-by: Pierre Millot --- ...empty_search.py => empty_search_filter.py} | 6 +- .../abtesting/models/filter_effects.py | 16 ++-- ...effects_outliers.py => outliers_filter.py} | 6 +- ...k_positions_inner.py => click_position.py} | 6 +- .../models/get_click_positions_response.py | 15 ++-- .../models/top_search_with_analytics.py | 6 +- .../top_search_with_revenue_analytics.py | 6 +- .../ingestion/models/docker_streams_input.py | 2 +- ...ponse_error.py => transformation_error.py} | 6 +- .../models/transformation_try_response.py | 8 +- ..._servers403_response.py => bad_request.py} | 8 +- algoliasearch/monitoring/models/forbidden.py | 61 ++++++++++++++ .../{incidents_inner.py => incident_entry.py} | 8 +- .../monitoring/models/incidents_response.py | 6 +- ...response_metrics.py => indexing_metric.py} | 14 ++-- .../models/indexing_time_response.py | 8 +- .../models/infrastructure_response.py | 8 +- ..._response_metrics.py => latency_metric.py} | 14 ++-- .../monitoring/models/latency_response.py | 8 +- ...ructure_response_metrics.py => metrics.py} | 8 +- .../models/{time_inner.py => time_entry.py} | 8 +- .../monitoring/models/unauthorized.py | 61 ++++++++++++++ algoliasearch/query_suggestions/client.py | 20 ++--- ...status200_response.py => config_status.py} | 8 +- ...et_log_file200_response.py => log_file.py} | 8 +- .../recommend/models/around_precision.py | 14 ++-- ...precision_from_value_inner.py => range.py} | 6 +- .../recommend/models/recommend_rule.py | 6 +- .../models/redirect_rule_index_data.py} | 6 +- .../models/redirect_rule_index_metadata.py | 8 +- ...mend_rule_metadata.py => rule_metadata.py} | 6 +- .../search/models/around_precision.py | 14 ++-- ...precision_from_value_inner.py => range.py} | 6 +- .../models/redirect_rule_index_data.py} | 6 +- .../models/redirect_rule_index_metadata.py | 8 +- .../search/models/search_params_string.py | 2 +- algoliasearch/usage/client.py | 14 ++-- ...se_error_errors_inner.py => error_item.py} | 8 +- ...{get_usage400_response.py => forbidden.py} | 16 ++-- ...0_response_error.py => forbidden_error.py} | 19 ++--- ...et_usage200_response.py => index_usage.py} | 19 ++--- algoliasearch/usage/models/invalid_request.py | 73 +++++++++++++++++ .../usage/models/invalid_request_error.py | 81 +++++++++++++++++++ ...statistics_inner.py => statistic_entry.py} | 8 +- 44 files changed, 440 insertions(+), 205 deletions(-) rename algoliasearch/abtesting/models/{filter_effects_empty_search.py => empty_search_filter.py} (91%) rename algoliasearch/abtesting/models/{filter_effects_outliers.py => outliers_filter.py} (91%) rename algoliasearch/analytics/models/{click_positions_inner.py => click_position.py} (92%) rename algoliasearch/ingestion/models/{transformation_try_response_error.py => transformation_error.py} (89%) rename algoliasearch/monitoring/models/{get_servers403_response.py => bad_request.py} (88%) create mode 100644 algoliasearch/monitoring/models/forbidden.py rename algoliasearch/monitoring/models/{incidents_inner.py => incident_entry.py} (91%) rename algoliasearch/monitoring/models/{indexing_time_response_metrics.py => indexing_metric.py} (83%) rename algoliasearch/monitoring/models/{latency_response_metrics.py => latency_metric.py} (84%) rename algoliasearch/monitoring/models/{infrastructure_response_metrics.py => metrics.py} (96%) rename algoliasearch/monitoring/models/{time_inner.py => time_entry.py} (91%) create mode 100644 algoliasearch/monitoring/models/unauthorized.py rename algoliasearch/query_suggestions/models/{get_config_status200_response.py => config_status.py} (92%) rename algoliasearch/query_suggestions/models/{get_log_file200_response.py => log_file.py} (92%) rename algoliasearch/recommend/models/{around_precision_from_value_inner.py => range.py} (90%) rename algoliasearch/{search/models/redirect_rule_index_metadata_data.py => recommend/models/redirect_rule_index_data.py} (88%) rename algoliasearch/recommend/models/{recommend_rule_metadata.py => rule_metadata.py} (90%) rename algoliasearch/search/models/{around_precision_from_value_inner.py => range.py} (90%) rename algoliasearch/{recommend/models/redirect_rule_index_metadata_data.py => search/models/redirect_rule_index_data.py} (88%) rename algoliasearch/usage/models/{get_usage400_response_error_errors_inner.py => error_item.py} (87%) rename algoliasearch/usage/models/{get_usage400_response.py => forbidden.py} (80%) rename algoliasearch/usage/models/{get_usage400_response_error.py => forbidden_error.py} (77%) rename algoliasearch/usage/models/{get_usage200_response.py => index_usage.py} (76%) create mode 100644 algoliasearch/usage/models/invalid_request.py create mode 100644 algoliasearch/usage/models/invalid_request_error.py rename algoliasearch/usage/models/{get_usage200_response_statistics_inner.py => statistic_entry.py} (88%) diff --git a/algoliasearch/abtesting/models/filter_effects_empty_search.py b/algoliasearch/abtesting/models/empty_search_filter.py similarity index 91% rename from algoliasearch/abtesting/models/filter_effects_empty_search.py rename to algoliasearch/abtesting/models/empty_search_filter.py index 1707ca0f5..c8293b865 100644 --- a/algoliasearch/abtesting/models/filter_effects_empty_search.py +++ b/algoliasearch/abtesting/models/empty_search_filter.py @@ -12,7 +12,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictInt -class FilterEffectsEmptySearch(BaseModel): +class EmptySearchFilter(BaseModel): """ Empty searches removed from the A/B test as a result of configuration settings. """ @@ -37,7 +37,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Self: - """Create an instance of FilterEffectsEmptySearch from a JSON string""" + """Create an instance of EmptySearchFilter from a JSON string""" return cls.from_dict(loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -59,7 +59,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Dict) -> Self: - """Create an instance of FilterEffectsEmptySearch from a dict""" + """Create an instance of EmptySearchFilter from a dict""" if obj is None: return None diff --git a/algoliasearch/abtesting/models/filter_effects.py b/algoliasearch/abtesting/models/filter_effects.py index 77240ce4b..1465b61c6 100644 --- a/algoliasearch/abtesting/models/filter_effects.py +++ b/algoliasearch/abtesting/models/filter_effects.py @@ -11,10 +11,8 @@ from pydantic import BaseModel, ConfigDict, Field -from algoliasearch.abtesting.models.filter_effects_empty_search import ( - FilterEffectsEmptySearch, -) -from algoliasearch.abtesting.models.filter_effects_outliers import FilterEffectsOutliers +from algoliasearch.abtesting.models.empty_search_filter import EmptySearchFilter +from algoliasearch.abtesting.models.outliers_filter import OutliersFilter class FilterEffects(BaseModel): @@ -22,10 +20,8 @@ class FilterEffects(BaseModel): A/B test filter effects resulting from configuration settings. """ - outliers: Optional[FilterEffectsOutliers] = None - empty_search: Optional[FilterEffectsEmptySearch] = Field( - default=None, alias="emptySearch" - ) + outliers: Optional[OutliersFilter] = None + empty_search: Optional[EmptySearchFilter] = Field(default=None, alias="emptySearch") model_config = ConfigDict( use_enum_values=True, populate_by_name=True, validate_assignment=True @@ -72,12 +68,12 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate( { "outliers": ( - FilterEffectsOutliers.from_dict(obj.get("outliers")) + OutliersFilter.from_dict(obj.get("outliers")) if obj.get("outliers") is not None else None ), "emptySearch": ( - FilterEffectsEmptySearch.from_dict(obj.get("emptySearch")) + EmptySearchFilter.from_dict(obj.get("emptySearch")) if obj.get("emptySearch") is not None else None ), diff --git a/algoliasearch/abtesting/models/filter_effects_outliers.py b/algoliasearch/abtesting/models/outliers_filter.py similarity index 91% rename from algoliasearch/abtesting/models/filter_effects_outliers.py rename to algoliasearch/abtesting/models/outliers_filter.py index 88c22324f..ebc094f31 100644 --- a/algoliasearch/abtesting/models/filter_effects_outliers.py +++ b/algoliasearch/abtesting/models/outliers_filter.py @@ -12,7 +12,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictInt -class FilterEffectsOutliers(BaseModel): +class OutliersFilter(BaseModel): """ Outliers removed from the A/B test as a result of configuration settings. """ @@ -37,7 +37,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Self: - """Create an instance of FilterEffectsOutliers from a JSON string""" + """Create an instance of OutliersFilter from a JSON string""" return cls.from_dict(loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -59,7 +59,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Dict) -> Self: - """Create an instance of FilterEffectsOutliers from a dict""" + """Create an instance of OutliersFilter from a dict""" if obj is None: return None diff --git a/algoliasearch/analytics/models/click_positions_inner.py b/algoliasearch/analytics/models/click_position.py similarity index 92% rename from algoliasearch/analytics/models/click_positions_inner.py rename to algoliasearch/analytics/models/click_position.py index 896695d15..e1a2e7d9e 100644 --- a/algoliasearch/analytics/models/click_positions_inner.py +++ b/algoliasearch/analytics/models/click_position.py @@ -12,7 +12,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictInt -class ClickPositionsInner(BaseModel): +class ClickPosition(BaseModel): """ Click position. """ @@ -38,7 +38,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Self: - """Create an instance of ClickPositionsInner from a JSON string""" + """Create an instance of ClickPosition from a JSON string""" return cls.from_dict(loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -60,7 +60,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Dict) -> Self: - """Create an instance of ClickPositionsInner from a dict""" + """Create an instance of ClickPosition from a dict""" if obj is None: return None diff --git a/algoliasearch/analytics/models/get_click_positions_response.py b/algoliasearch/analytics/models/get_click_positions_response.py index 3ae097e30..10cba6b83 100644 --- a/algoliasearch/analytics/models/get_click_positions_response.py +++ b/algoliasearch/analytics/models/get_click_positions_response.py @@ -11,7 +11,7 @@ from pydantic import BaseModel, ConfigDict, Field -from algoliasearch.analytics.models.click_positions_inner import ClickPositionsInner +from algoliasearch.analytics.models.click_position import ClickPosition class GetClickPositionsResponse(BaseModel): @@ -19,10 +19,10 @@ class GetClickPositionsResponse(BaseModel): GetClickPositionsResponse """ - positions: Annotated[ - List[ClickPositionsInner], Field(min_length=12, max_length=12) - ] = Field( - description="List of positions in the search results and clicks associated with this search." + positions: Annotated[List[ClickPosition], Field(min_length=12, max_length=12)] = ( + Field( + description="List of positions in the search results and clicks associated with this search." + ) ) model_config = ConfigDict( @@ -72,10 +72,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate( { "positions": ( - [ - ClickPositionsInner.from_dict(_item) - for _item in obj.get("positions") - ] + [ClickPosition.from_dict(_item) for _item in obj.get("positions")] if obj.get("positions") is not None else None ) diff --git a/algoliasearch/analytics/models/top_search_with_analytics.py b/algoliasearch/analytics/models/top_search_with_analytics.py index a943bc61b..c0c9c01c7 100644 --- a/algoliasearch/analytics/models/top_search_with_analytics.py +++ b/algoliasearch/analytics/models/top_search_with_analytics.py @@ -11,7 +11,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr -from algoliasearch.analytics.models.click_positions_inner import ClickPositionsInner +from algoliasearch.analytics.models.click_position import ClickPosition class TopSearchWithAnalytics(BaseModel): @@ -40,7 +40,7 @@ class TopSearchWithAnalytics(BaseModel): alias="averageClickPosition", ) click_positions: Annotated[ - List[ClickPositionsInner], Field(min_length=12, max_length=12) + List[ClickPosition], Field(min_length=12, max_length=12) ] = Field( description="List of positions in the search results and clicks associated with this search.", alias="clickPositions", @@ -118,7 +118,7 @@ def from_dict(cls, obj: Dict) -> Self: "averageClickPosition": obj.get("averageClickPosition"), "clickPositions": ( [ - ClickPositionsInner.from_dict(_item) + ClickPosition.from_dict(_item) for _item in obj.get("clickPositions") ] if obj.get("clickPositions") is not None diff --git a/algoliasearch/analytics/models/top_search_with_revenue_analytics.py b/algoliasearch/analytics/models/top_search_with_revenue_analytics.py index 3d1c39547..e3b7fd15a 100644 --- a/algoliasearch/analytics/models/top_search_with_revenue_analytics.py +++ b/algoliasearch/analytics/models/top_search_with_revenue_analytics.py @@ -11,7 +11,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr -from algoliasearch.analytics.models.click_positions_inner import ClickPositionsInner +from algoliasearch.analytics.models.click_position import ClickPosition from algoliasearch.analytics.models.currencies_value import CurrenciesValue @@ -41,7 +41,7 @@ class TopSearchWithRevenueAnalytics(BaseModel): alias="averageClickPosition", ) click_positions: Annotated[ - List[ClickPositionsInner], Field(min_length=12, max_length=12) + List[ClickPosition], Field(min_length=12, max_length=12) ] = Field( description="List of positions in the search results and clicks associated with this search.", alias="clickPositions", @@ -153,7 +153,7 @@ def from_dict(cls, obj: Dict) -> Self: "averageClickPosition": obj.get("averageClickPosition"), "clickPositions": ( [ - ClickPositionsInner.from_dict(_item) + ClickPosition.from_dict(_item) for _item in obj.get("clickPositions") ] if obj.get("clickPositions") is not None diff --git a/algoliasearch/ingestion/models/docker_streams_input.py b/algoliasearch/ingestion/models/docker_streams_input.py index 99b5f14d5..872367bb3 100644 --- a/algoliasearch/ingestion/models/docker_streams_input.py +++ b/algoliasearch/ingestion/models/docker_streams_input.py @@ -14,7 +14,7 @@ class DockerStreamsInput(BaseModel): """ - DockerStreamsInput + The selected streams of a singer or airbyte connector. """ streams: Dict[str, Any] diff --git a/algoliasearch/ingestion/models/transformation_try_response_error.py b/algoliasearch/ingestion/models/transformation_error.py similarity index 89% rename from algoliasearch/ingestion/models/transformation_try_response_error.py rename to algoliasearch/ingestion/models/transformation_error.py index 20dbb4232..f888ea396 100644 --- a/algoliasearch/ingestion/models/transformation_try_response_error.py +++ b/algoliasearch/ingestion/models/transformation_error.py @@ -12,7 +12,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr -class TransformationTryResponseError(BaseModel): +class TransformationError(BaseModel): """ The error if the transformation failed. """ @@ -33,7 +33,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Self: - """Create an instance of TransformationTryResponseError from a JSON string""" + """Create an instance of TransformationError from a JSON string""" return cls.from_dict(loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -55,7 +55,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Dict) -> Self: - """Create an instance of TransformationTryResponseError from a dict""" + """Create an instance of TransformationError from a dict""" if obj is None: return None diff --git a/algoliasearch/ingestion/models/transformation_try_response.py b/algoliasearch/ingestion/models/transformation_try_response.py index 19cfbe55c..3d02ffb6b 100644 --- a/algoliasearch/ingestion/models/transformation_try_response.py +++ b/algoliasearch/ingestion/models/transformation_try_response.py @@ -11,9 +11,7 @@ from pydantic import BaseModel, ConfigDict, Field -from algoliasearch.ingestion.models.transformation_try_response_error import ( - TransformationTryResponseError, -) +from algoliasearch.ingestion.models.transformation_error import TransformationError class TransformationTryResponse(BaseModel): @@ -24,7 +22,7 @@ class TransformationTryResponse(BaseModel): payloads: List[Dict[str, Any]] = Field( description="The array of records returned by the transformation service." ) - error: Optional[TransformationTryResponseError] = None + error: Optional[TransformationError] = None model_config = ConfigDict( use_enum_values=True, populate_by_name=True, validate_assignment=True @@ -70,7 +68,7 @@ def from_dict(cls, obj: Dict) -> Self: { "payloads": obj.get("payloads"), "error": ( - TransformationTryResponseError.from_dict(obj.get("error")) + TransformationError.from_dict(obj.get("error")) if obj.get("error") is not None else None ), diff --git a/algoliasearch/monitoring/models/get_servers403_response.py b/algoliasearch/monitoring/models/bad_request.py similarity index 88% rename from algoliasearch/monitoring/models/get_servers403_response.py rename to algoliasearch/monitoring/models/bad_request.py index 0c47b480f..ec92a5064 100644 --- a/algoliasearch/monitoring/models/get_servers403_response.py +++ b/algoliasearch/monitoring/models/bad_request.py @@ -12,9 +12,9 @@ from pydantic import BaseModel, ConfigDict, StrictStr -class GetServers403Response(BaseModel): +class BadRequest(BaseModel): """ - GetServers403Response + BadRequest """ reason: Optional[StrictStr] = None @@ -28,7 +28,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Self: - """Create an instance of GetServers403Response from a JSON string""" + """Create an instance of BadRequest from a JSON string""" return cls.from_dict(loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -50,7 +50,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Dict) -> Self: - """Create an instance of GetServers403Response from a dict""" + """Create an instance of BadRequest from a dict""" if obj is None: return None diff --git a/algoliasearch/monitoring/models/forbidden.py b/algoliasearch/monitoring/models/forbidden.py new file mode 100644 index 000000000..3a6c8c94e --- /dev/null +++ b/algoliasearch/monitoring/models/forbidden.py @@ -0,0 +1,61 @@ +# coding: utf-8 + +""" +Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +""" + +from __future__ import annotations + +from json import loads +from typing import Any, Dict, Optional, Self + +from pydantic import BaseModel, ConfigDict, StrictStr + + +class Forbidden(BaseModel): + """ + Forbidden + """ + + reason: Optional[StrictStr] = None + + model_config = ConfigDict( + use_enum_values=True, populate_by_name=True, validate_assignment=True + ) + + def to_json(self) -> str: + return self.model_dump_json(by_alias=True, exclude_unset=True) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of Forbidden from a JSON string""" + return cls.from_dict(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. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Dict) -> Self: + """Create an instance of Forbidden from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"reason": obj.get("reason")}) + return _obj diff --git a/algoliasearch/monitoring/models/incidents_inner.py b/algoliasearch/monitoring/models/incident_entry.py similarity index 91% rename from algoliasearch/monitoring/models/incidents_inner.py rename to algoliasearch/monitoring/models/incident_entry.py index aca55e597..1afd5e10b 100644 --- a/algoliasearch/monitoring/models/incidents_inner.py +++ b/algoliasearch/monitoring/models/incident_entry.py @@ -14,9 +14,9 @@ from algoliasearch.monitoring.models.incident import Incident -class IncidentsInner(BaseModel): +class IncidentEntry(BaseModel): """ - IncidentsInner + IncidentEntry """ t: Optional[StrictInt] = Field( @@ -34,7 +34,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Self: - """Create an instance of IncidentsInner from a JSON string""" + """Create an instance of IncidentEntry from a JSON string""" return cls.from_dict(loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -58,7 +58,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Dict) -> Self: - """Create an instance of IncidentsInner from a dict""" + """Create an instance of IncidentEntry from a dict""" if obj is None: return None diff --git a/algoliasearch/monitoring/models/incidents_response.py b/algoliasearch/monitoring/models/incidents_response.py index 5a5ba655a..2359facef 100644 --- a/algoliasearch/monitoring/models/incidents_response.py +++ b/algoliasearch/monitoring/models/incidents_response.py @@ -11,7 +11,7 @@ from pydantic import BaseModel, ConfigDict -from algoliasearch.monitoring.models.incidents_inner import IncidentsInner +from algoliasearch.monitoring.models.incident_entry import IncidentEntry class IncidentsResponse(BaseModel): @@ -19,7 +19,7 @@ class IncidentsResponse(BaseModel): IncidentsResponse """ - incidents: Optional[Dict[str, List[IncidentsInner]]] = None + incidents: Optional[Dict[str, List[IncidentEntry]]] = None model_config = ConfigDict( use_enum_values=True, populate_by_name=True, validate_assignment=True @@ -72,7 +72,7 @@ def from_dict(cls, obj: Dict) -> Self: "incidents": dict( ( _k, - [IncidentsInner.from_dict(_item) for _item in _v] + [IncidentEntry.from_dict(_item) for _item in _v] if _v is not None else None, ) diff --git a/algoliasearch/monitoring/models/indexing_time_response_metrics.py b/algoliasearch/monitoring/models/indexing_metric.py similarity index 83% rename from algoliasearch/monitoring/models/indexing_time_response_metrics.py rename to algoliasearch/monitoring/models/indexing_metric.py index 8c58e8b7e..2dd7f123c 100644 --- a/algoliasearch/monitoring/models/indexing_time_response_metrics.py +++ b/algoliasearch/monitoring/models/indexing_metric.py @@ -11,15 +11,15 @@ from pydantic import BaseModel, ConfigDict -from algoliasearch.monitoring.models.time_inner import TimeInner +from algoliasearch.monitoring.models.time_entry import TimeEntry -class IndexingTimeResponseMetrics(BaseModel): +class IndexingMetric(BaseModel): """ - IndexingTimeResponseMetrics + IndexingMetric """ - indexing: Optional[Dict[str, List[TimeInner]]] = None + indexing: Optional[Dict[str, List[TimeEntry]]] = None model_config = ConfigDict( use_enum_values=True, populate_by_name=True, validate_assignment=True @@ -30,7 +30,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Self: - """Create an instance of IndexingTimeResponseMetrics from a JSON string""" + """Create an instance of IndexingMetric from a JSON string""" return cls.from_dict(loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -60,7 +60,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Dict) -> Self: - """Create an instance of IndexingTimeResponseMetrics from a dict""" + """Create an instance of IndexingMetric from a dict""" if obj is None: return None @@ -72,7 +72,7 @@ def from_dict(cls, obj: Dict) -> Self: "indexing": dict( ( _k, - [TimeInner.from_dict(_item) for _item in _v] + [TimeEntry.from_dict(_item) for _item in _v] if _v is not None else None, ) diff --git a/algoliasearch/monitoring/models/indexing_time_response.py b/algoliasearch/monitoring/models/indexing_time_response.py index 7c22cbe20..2978f1d0d 100644 --- a/algoliasearch/monitoring/models/indexing_time_response.py +++ b/algoliasearch/monitoring/models/indexing_time_response.py @@ -11,9 +11,7 @@ from pydantic import BaseModel, ConfigDict -from algoliasearch.monitoring.models.indexing_time_response_metrics import ( - IndexingTimeResponseMetrics, -) +from algoliasearch.monitoring.models.indexing_metric import IndexingMetric class IndexingTimeResponse(BaseModel): @@ -21,7 +19,7 @@ class IndexingTimeResponse(BaseModel): IndexingTimeResponse """ - metrics: Optional[IndexingTimeResponseMetrics] = None + metrics: Optional[IndexingMetric] = None model_config = ConfigDict( use_enum_values=True, populate_by_name=True, validate_assignment=True @@ -66,7 +64,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate( { "metrics": ( - IndexingTimeResponseMetrics.from_dict(obj.get("metrics")) + IndexingMetric.from_dict(obj.get("metrics")) if obj.get("metrics") is not None else None ) diff --git a/algoliasearch/monitoring/models/infrastructure_response.py b/algoliasearch/monitoring/models/infrastructure_response.py index 80dd7843e..16458fd4e 100644 --- a/algoliasearch/monitoring/models/infrastructure_response.py +++ b/algoliasearch/monitoring/models/infrastructure_response.py @@ -11,9 +11,7 @@ from pydantic import BaseModel, ConfigDict -from algoliasearch.monitoring.models.infrastructure_response_metrics import ( - InfrastructureResponseMetrics, -) +from algoliasearch.monitoring.models.metrics import Metrics class InfrastructureResponse(BaseModel): @@ -21,7 +19,7 @@ class InfrastructureResponse(BaseModel): InfrastructureResponse """ - metrics: Optional[InfrastructureResponseMetrics] = None + metrics: Optional[Metrics] = None model_config = ConfigDict( use_enum_values=True, populate_by_name=True, validate_assignment=True @@ -66,7 +64,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate( { "metrics": ( - InfrastructureResponseMetrics.from_dict(obj.get("metrics")) + Metrics.from_dict(obj.get("metrics")) if obj.get("metrics") is not None else None ) diff --git a/algoliasearch/monitoring/models/latency_response_metrics.py b/algoliasearch/monitoring/models/latency_metric.py similarity index 84% rename from algoliasearch/monitoring/models/latency_response_metrics.py rename to algoliasearch/monitoring/models/latency_metric.py index f925a2570..ccccdb501 100644 --- a/algoliasearch/monitoring/models/latency_response_metrics.py +++ b/algoliasearch/monitoring/models/latency_metric.py @@ -11,15 +11,15 @@ from pydantic import BaseModel, ConfigDict -from algoliasearch.monitoring.models.time_inner import TimeInner +from algoliasearch.monitoring.models.time_entry import TimeEntry -class LatencyResponseMetrics(BaseModel): +class LatencyMetric(BaseModel): """ - LatencyResponseMetrics + LatencyMetric """ - latency: Optional[Dict[str, List[TimeInner]]] = None + latency: Optional[Dict[str, List[TimeEntry]]] = None model_config = ConfigDict( use_enum_values=True, populate_by_name=True, validate_assignment=True @@ -30,7 +30,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Self: - """Create an instance of LatencyResponseMetrics from a JSON string""" + """Create an instance of LatencyMetric from a JSON string""" return cls.from_dict(loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -60,7 +60,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Dict) -> Self: - """Create an instance of LatencyResponseMetrics from a dict""" + """Create an instance of LatencyMetric from a dict""" if obj is None: return None @@ -72,7 +72,7 @@ def from_dict(cls, obj: Dict) -> Self: "latency": dict( ( _k, - [TimeInner.from_dict(_item) for _item in _v] + [TimeEntry.from_dict(_item) for _item in _v] if _v is not None else None, ) diff --git a/algoliasearch/monitoring/models/latency_response.py b/algoliasearch/monitoring/models/latency_response.py index e718a3dce..858eac069 100644 --- a/algoliasearch/monitoring/models/latency_response.py +++ b/algoliasearch/monitoring/models/latency_response.py @@ -11,9 +11,7 @@ from pydantic import BaseModel, ConfigDict -from algoliasearch.monitoring.models.latency_response_metrics import ( - LatencyResponseMetrics, -) +from algoliasearch.monitoring.models.latency_metric import LatencyMetric class LatencyResponse(BaseModel): @@ -21,7 +19,7 @@ class LatencyResponse(BaseModel): LatencyResponse """ - metrics: Optional[LatencyResponseMetrics] = None + metrics: Optional[LatencyMetric] = None model_config = ConfigDict( use_enum_values=True, populate_by_name=True, validate_assignment=True @@ -66,7 +64,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate( { "metrics": ( - LatencyResponseMetrics.from_dict(obj.get("metrics")) + LatencyMetric.from_dict(obj.get("metrics")) if obj.get("metrics") is not None else None ) diff --git a/algoliasearch/monitoring/models/infrastructure_response_metrics.py b/algoliasearch/monitoring/models/metrics.py similarity index 96% rename from algoliasearch/monitoring/models/infrastructure_response_metrics.py rename to algoliasearch/monitoring/models/metrics.py index 05ea4ce5f..dd80c779c 100644 --- a/algoliasearch/monitoring/models/infrastructure_response_metrics.py +++ b/algoliasearch/monitoring/models/metrics.py @@ -14,9 +14,9 @@ from algoliasearch.monitoring.models.probes_metric import ProbesMetric -class InfrastructureResponseMetrics(BaseModel): +class Metrics(BaseModel): """ - InfrastructureResponseMetrics + Metrics """ cpu_usage: Optional[Dict[str, List[ProbesMetric]]] = Field( @@ -45,7 +45,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Self: - """Create an instance of InfrastructureResponseMetrics from a JSON string""" + """Create an instance of Metrics from a JSON string""" return cls.from_dict(loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -107,7 +107,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Dict) -> Self: - """Create an instance of InfrastructureResponseMetrics from a dict""" + """Create an instance of Metrics from a dict""" if obj is None: return None diff --git a/algoliasearch/monitoring/models/time_inner.py b/algoliasearch/monitoring/models/time_entry.py similarity index 91% rename from algoliasearch/monitoring/models/time_inner.py rename to algoliasearch/monitoring/models/time_entry.py index e7d58d5ca..eb5089429 100644 --- a/algoliasearch/monitoring/models/time_inner.py +++ b/algoliasearch/monitoring/models/time_entry.py @@ -12,9 +12,9 @@ from pydantic import BaseModel, ConfigDict, Field, StrictInt -class TimeInner(BaseModel): +class TimeEntry(BaseModel): """ - TimeInner + TimeEntry """ t: Optional[StrictInt] = Field( @@ -32,7 +32,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Self: - """Create an instance of TimeInner from a JSON string""" + """Create an instance of TimeEntry from a JSON string""" return cls.from_dict(loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -54,7 +54,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Dict) -> Self: - """Create an instance of TimeInner from a dict""" + """Create an instance of TimeEntry from a dict""" if obj is None: return None diff --git a/algoliasearch/monitoring/models/unauthorized.py b/algoliasearch/monitoring/models/unauthorized.py new file mode 100644 index 000000000..fadef00eb --- /dev/null +++ b/algoliasearch/monitoring/models/unauthorized.py @@ -0,0 +1,61 @@ +# coding: utf-8 + +""" +Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +""" + +from __future__ import annotations + +from json import loads +from typing import Any, Dict, Optional, Self + +from pydantic import BaseModel, ConfigDict, StrictStr + + +class Unauthorized(BaseModel): + """ + Unauthorized + """ + + reason: Optional[StrictStr] = None + + model_config = ConfigDict( + use_enum_values=True, populate_by_name=True, validate_assignment=True + ) + + def to_json(self) -> str: + return self.model_dump_json(by_alias=True, exclude_unset=True) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of Unauthorized from a JSON string""" + return cls.from_dict(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. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Dict) -> Self: + """Create an instance of Unauthorized from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"reason": obj.get("reason")}) + return _obj diff --git a/algoliasearch/query_suggestions/client.py b/algoliasearch/query_suggestions/client.py index c3db54e61..a15418452 100644 --- a/algoliasearch/query_suggestions/client.py +++ b/algoliasearch/query_suggestions/client.py @@ -19,6 +19,7 @@ from algoliasearch.http.verb import Verb from algoliasearch.query_suggestions.config import QuerySuggestionsConfig from algoliasearch.query_suggestions.models.base_response import BaseResponse +from algoliasearch.query_suggestions.models.config_status import ConfigStatus from algoliasearch.query_suggestions.models.configuration import Configuration from algoliasearch.query_suggestions.models.configuration_response import ( ConfigurationResponse, @@ -26,12 +27,7 @@ from algoliasearch.query_suggestions.models.configuration_with_index import ( ConfigurationWithIndex, ) -from algoliasearch.query_suggestions.models.get_config_status200_response import ( - GetConfigStatus200Response, -) -from algoliasearch.query_suggestions.models.get_log_file200_response import ( - GetLogFile200Response, -) +from algoliasearch.query_suggestions.models.log_file import LogFile class QuerySuggestionsClient: @@ -701,7 +697,7 @@ async def get_config_status( StrictStr, Field(description="Query Suggestions index name.") ], request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> GetConfigStatus200Response: + ) -> ConfigStatus: """ Reports the status of a Query Suggestions index. @@ -711,11 +707,11 @@ async def get_config_status( :param index_name: Query Suggestions index name. (required) :type index_name: str :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the deserialized response in a 'GetConfigStatus200Response' result object. + :return: Returns the deserialized response in a 'ConfigStatus' result object. """ return ( await self.get_config_status_with_http_info(index_name, request_options) - ).deserialize(GetConfigStatus200Response) + ).deserialize(ConfigStatus) async def get_log_file_with_http_info( self, @@ -758,7 +754,7 @@ async def get_log_file( StrictStr, Field(description="Query Suggestions index name.") ], request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> GetLogFile200Response: + ) -> LogFile: """ Retrieves the logs for a single Query Suggestions index. @@ -768,11 +764,11 @@ async def get_log_file( :param index_name: Query Suggestions index name. (required) :type index_name: str :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the deserialized response in a 'GetLogFile200Response' result object. + :return: Returns the deserialized response in a 'LogFile' result object. """ return ( await self.get_log_file_with_http_info(index_name, request_options) - ).deserialize(GetLogFile200Response) + ).deserialize(LogFile) async def update_config_with_http_info( self, diff --git a/algoliasearch/query_suggestions/models/get_config_status200_response.py b/algoliasearch/query_suggestions/models/config_status.py similarity index 92% rename from algoliasearch/query_suggestions/models/get_config_status200_response.py rename to algoliasearch/query_suggestions/models/config_status.py index cb61ce7d5..f6d3aee62 100644 --- a/algoliasearch/query_suggestions/models/get_config_status200_response.py +++ b/algoliasearch/query_suggestions/models/config_status.py @@ -12,9 +12,9 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr -class GetConfigStatus200Response(BaseModel): +class ConfigStatus(BaseModel): """ - GetConfigStatus200Response + ConfigStatus """ index_name: Optional[StrictStr] = Field( @@ -52,7 +52,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Self: - """Create an instance of GetConfigStatus200Response from a JSON string""" + """Create an instance of ConfigStatus from a JSON string""" return cls.from_dict(loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -74,7 +74,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Dict) -> Self: - """Create an instance of GetConfigStatus200Response from a dict""" + """Create an instance of ConfigStatus from a dict""" if obj is None: return None diff --git a/algoliasearch/query_suggestions/models/get_log_file200_response.py b/algoliasearch/query_suggestions/models/log_file.py similarity index 92% rename from algoliasearch/query_suggestions/models/get_log_file200_response.py rename to algoliasearch/query_suggestions/models/log_file.py index 6a72146c1..acff455db 100644 --- a/algoliasearch/query_suggestions/models/get_log_file200_response.py +++ b/algoliasearch/query_suggestions/models/log_file.py @@ -14,9 +14,9 @@ from algoliasearch.query_suggestions.models.log_level import LogLevel -class GetLogFile200Response(BaseModel): +class LogFile(BaseModel): """ - GetLogFile200Response + LogFile """ timestamp: Optional[StrictStr] = Field( @@ -41,7 +41,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Self: - """Create an instance of GetLogFile200Response from a JSON string""" + """Create an instance of LogFile from a JSON string""" return cls.from_dict(loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -63,7 +63,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Dict) -> Self: - """Create an instance of GetLogFile200Response from a dict""" + """Create an instance of LogFile from a dict""" if obj is None: return None diff --git a/algoliasearch/recommend/models/around_precision.py b/algoliasearch/recommend/models/around_precision.py index 5d43c4b37..5ff34b3be 100644 --- a/algoliasearch/recommend/models/around_precision.py +++ b/algoliasearch/recommend/models/around_precision.py @@ -11,9 +11,7 @@ from pydantic import BaseModel, Field, StrictInt, ValidationError, model_serializer -from algoliasearch.recommend.models.around_precision_from_value_inner import ( - AroundPrecisionFromValueInner, -) +from algoliasearch.recommend.models.range import Range class AroundPrecision(BaseModel): @@ -25,8 +23,8 @@ class AroundPrecision(BaseModel): default=10, description="Distance in meters to group results by similar distances. For example, if you set `aroundPrecision` to 100, records wihin 100 meters to the central coordinate are considered to have the same distance, as are records between 100 and 199 meters. ", ) - oneof_schema_2_validator: Optional[List[AroundPrecisionFromValueInner]] = None - actual_instance: Optional[Union[List[AroundPrecisionFromValueInner], int]] = None + oneof_schema_2_validator: Optional[List[Range]] = None + actual_instance: Optional[Union[List[Range], int]] = None def __init__(self, *args, **kwargs) -> None: if args: @@ -43,9 +41,7 @@ def __init__(self, *args, **kwargs) -> None: super().__init__(**kwargs) @model_serializer - def unwrap_actual_instance( - self, - ) -> Optional[Union[List[AroundPrecisionFromValueInner], int]]: + def unwrap_actual_instance(self) -> Optional[Union[List[Range], int]]: """ Unwraps the `actual_instance` when calling the `to_json` method. """ @@ -77,7 +73,7 @@ def from_json(cls, json_str: str) -> Self: error_messages.append(str(e)) raise ValueError( - "No match found when deserializing the JSON string into AroundPrecision with oneOf schemas: List[AroundPrecisionFromValueInner], int. Details: " + "No match found when deserializing the JSON string into AroundPrecision with oneOf schemas: List[Range], int. Details: " + ", ".join(error_messages) ) diff --git a/algoliasearch/recommend/models/around_precision_from_value_inner.py b/algoliasearch/recommend/models/range.py similarity index 90% rename from algoliasearch/recommend/models/around_precision_from_value_inner.py rename to algoliasearch/recommend/models/range.py index 97fe6d28d..9c8bc91a5 100644 --- a/algoliasearch/recommend/models/around_precision_from_value_inner.py +++ b/algoliasearch/recommend/models/range.py @@ -12,7 +12,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictInt -class AroundPrecisionFromValueInner(BaseModel): +class Range(BaseModel): """ Range object with lower and upper values in meters to define custom ranges. """ @@ -36,7 +36,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Self: - """Create an instance of AroundPrecisionFromValueInner from a JSON string""" + """Create an instance of Range from a JSON string""" return cls.from_dict(loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -58,7 +58,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Dict) -> Self: - """Create an instance of AroundPrecisionFromValueInner from a dict""" + """Create an instance of Range from a dict""" if obj is None: return None diff --git a/algoliasearch/recommend/models/recommend_rule.py b/algoliasearch/recommend/models/recommend_rule.py index d96bde9e1..334e51be3 100644 --- a/algoliasearch/recommend/models/recommend_rule.py +++ b/algoliasearch/recommend/models/recommend_rule.py @@ -13,7 +13,7 @@ from algoliasearch.recommend.models.condition import Condition from algoliasearch.recommend.models.consequence import Consequence -from algoliasearch.recommend.models.recommend_rule_metadata import RecommendRuleMetadata +from algoliasearch.recommend.models.rule_metadata import RuleMetadata class RecommendRule(BaseModel): @@ -21,7 +21,7 @@ class RecommendRule(BaseModel): Recommend rule. """ - metadata: Optional[RecommendRuleMetadata] = Field(default=None, alias="_metadata") + metadata: Optional[RuleMetadata] = Field(default=None, alias="_metadata") object_id: Optional[StrictStr] = Field( default=None, description="Unique identifier of a rule object.", @@ -85,7 +85,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate( { "_metadata": ( - RecommendRuleMetadata.from_dict(obj.get("_metadata")) + RuleMetadata.from_dict(obj.get("_metadata")) if obj.get("_metadata") is not None else None ), diff --git a/algoliasearch/search/models/redirect_rule_index_metadata_data.py b/algoliasearch/recommend/models/redirect_rule_index_data.py similarity index 88% rename from algoliasearch/search/models/redirect_rule_index_metadata_data.py rename to algoliasearch/recommend/models/redirect_rule_index_data.py index 28b3d5b65..48a692e88 100644 --- a/algoliasearch/search/models/redirect_rule_index_metadata_data.py +++ b/algoliasearch/recommend/models/redirect_rule_index_data.py @@ -12,7 +12,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr -class RedirectRuleIndexMetadataData(BaseModel): +class RedirectRuleIndexData(BaseModel): """ Redirect rule data. """ @@ -28,7 +28,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Self: - """Create an instance of RedirectRuleIndexMetadataData from a JSON string""" + """Create an instance of RedirectRuleIndexData from a JSON string""" return cls.from_dict(loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -50,7 +50,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Dict) -> Self: - """Create an instance of RedirectRuleIndexMetadataData from a dict""" + """Create an instance of RedirectRuleIndexData from a dict""" if obj is None: return None diff --git a/algoliasearch/recommend/models/redirect_rule_index_metadata.py b/algoliasearch/recommend/models/redirect_rule_index_metadata.py index c8cb3ed4c..8cc873e2e 100644 --- a/algoliasearch/recommend/models/redirect_rule_index_metadata.py +++ b/algoliasearch/recommend/models/redirect_rule_index_metadata.py @@ -11,8 +11,8 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr -from algoliasearch.recommend.models.redirect_rule_index_metadata_data import ( - RedirectRuleIndexMetadataData, +from algoliasearch.recommend.models.redirect_rule_index_data import ( + RedirectRuleIndexData, ) @@ -25,7 +25,7 @@ class RedirectRuleIndexMetadata(BaseModel): dest: StrictStr = Field(description="Destination index for the redirect rule.") reason: StrictStr = Field(description="Reason for the redirect rule.") succeed: StrictBool = Field(description="Redirect rule status.") - data: RedirectRuleIndexMetadataData + data: RedirectRuleIndexData model_config = ConfigDict( use_enum_values=True, populate_by_name=True, validate_assignment=True @@ -74,7 +74,7 @@ def from_dict(cls, obj: Dict) -> Self: "reason": obj.get("reason"), "succeed": obj.get("succeed"), "data": ( - RedirectRuleIndexMetadataData.from_dict(obj.get("data")) + RedirectRuleIndexData.from_dict(obj.get("data")) if obj.get("data") is not None else None ), diff --git a/algoliasearch/recommend/models/recommend_rule_metadata.py b/algoliasearch/recommend/models/rule_metadata.py similarity index 90% rename from algoliasearch/recommend/models/recommend_rule_metadata.py rename to algoliasearch/recommend/models/rule_metadata.py index 8704e7668..2b07f1148 100644 --- a/algoliasearch/recommend/models/recommend_rule_metadata.py +++ b/algoliasearch/recommend/models/rule_metadata.py @@ -12,7 +12,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr -class RecommendRuleMetadata(BaseModel): +class RuleMetadata(BaseModel): """ Rule metadata. """ @@ -32,7 +32,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Self: - """Create an instance of RecommendRuleMetadata from a JSON string""" + """Create an instance of RuleMetadata from a JSON string""" return cls.from_dict(loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -54,7 +54,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Dict) -> Self: - """Create an instance of RecommendRuleMetadata from a dict""" + """Create an instance of RuleMetadata from a dict""" if obj is None: return None diff --git a/algoliasearch/search/models/around_precision.py b/algoliasearch/search/models/around_precision.py index 896986f41..6560b1dcd 100644 --- a/algoliasearch/search/models/around_precision.py +++ b/algoliasearch/search/models/around_precision.py @@ -11,9 +11,7 @@ from pydantic import BaseModel, Field, StrictInt, ValidationError, model_serializer -from algoliasearch.search.models.around_precision_from_value_inner import ( - AroundPrecisionFromValueInner, -) +from algoliasearch.search.models.range import Range class AroundPrecision(BaseModel): @@ -25,8 +23,8 @@ class AroundPrecision(BaseModel): default=10, description="Distance in meters to group results by similar distances. For example, if you set `aroundPrecision` to 100, records wihin 100 meters to the central coordinate are considered to have the same distance, as are records between 100 and 199 meters. ", ) - oneof_schema_2_validator: Optional[List[AroundPrecisionFromValueInner]] = None - actual_instance: Optional[Union[List[AroundPrecisionFromValueInner], int]] = None + oneof_schema_2_validator: Optional[List[Range]] = None + actual_instance: Optional[Union[List[Range], int]] = None def __init__(self, *args, **kwargs) -> None: if args: @@ -43,9 +41,7 @@ def __init__(self, *args, **kwargs) -> None: super().__init__(**kwargs) @model_serializer - def unwrap_actual_instance( - self, - ) -> Optional[Union[List[AroundPrecisionFromValueInner], int]]: + def unwrap_actual_instance(self) -> Optional[Union[List[Range], int]]: """ Unwraps the `actual_instance` when calling the `to_json` method. """ @@ -77,7 +73,7 @@ def from_json(cls, json_str: str) -> Self: error_messages.append(str(e)) raise ValueError( - "No match found when deserializing the JSON string into AroundPrecision with oneOf schemas: List[AroundPrecisionFromValueInner], int. Details: " + "No match found when deserializing the JSON string into AroundPrecision with oneOf schemas: List[Range], int. Details: " + ", ".join(error_messages) ) diff --git a/algoliasearch/search/models/around_precision_from_value_inner.py b/algoliasearch/search/models/range.py similarity index 90% rename from algoliasearch/search/models/around_precision_from_value_inner.py rename to algoliasearch/search/models/range.py index 97fe6d28d..9c8bc91a5 100644 --- a/algoliasearch/search/models/around_precision_from_value_inner.py +++ b/algoliasearch/search/models/range.py @@ -12,7 +12,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictInt -class AroundPrecisionFromValueInner(BaseModel): +class Range(BaseModel): """ Range object with lower and upper values in meters to define custom ranges. """ @@ -36,7 +36,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Self: - """Create an instance of AroundPrecisionFromValueInner from a JSON string""" + """Create an instance of Range from a JSON string""" return cls.from_dict(loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -58,7 +58,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Dict) -> Self: - """Create an instance of AroundPrecisionFromValueInner from a dict""" + """Create an instance of Range from a dict""" if obj is None: return None diff --git a/algoliasearch/recommend/models/redirect_rule_index_metadata_data.py b/algoliasearch/search/models/redirect_rule_index_data.py similarity index 88% rename from algoliasearch/recommend/models/redirect_rule_index_metadata_data.py rename to algoliasearch/search/models/redirect_rule_index_data.py index 28b3d5b65..48a692e88 100644 --- a/algoliasearch/recommend/models/redirect_rule_index_metadata_data.py +++ b/algoliasearch/search/models/redirect_rule_index_data.py @@ -12,7 +12,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr -class RedirectRuleIndexMetadataData(BaseModel): +class RedirectRuleIndexData(BaseModel): """ Redirect rule data. """ @@ -28,7 +28,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Self: - """Create an instance of RedirectRuleIndexMetadataData from a JSON string""" + """Create an instance of RedirectRuleIndexData from a JSON string""" return cls.from_dict(loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -50,7 +50,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Dict) -> Self: - """Create an instance of RedirectRuleIndexMetadataData from a dict""" + """Create an instance of RedirectRuleIndexData from a dict""" if obj is None: return None diff --git a/algoliasearch/search/models/redirect_rule_index_metadata.py b/algoliasearch/search/models/redirect_rule_index_metadata.py index 2cda53f3e..363cea82f 100644 --- a/algoliasearch/search/models/redirect_rule_index_metadata.py +++ b/algoliasearch/search/models/redirect_rule_index_metadata.py @@ -11,9 +11,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr -from algoliasearch.search.models.redirect_rule_index_metadata_data import ( - RedirectRuleIndexMetadataData, -) +from algoliasearch.search.models.redirect_rule_index_data import RedirectRuleIndexData class RedirectRuleIndexMetadata(BaseModel): @@ -25,7 +23,7 @@ class RedirectRuleIndexMetadata(BaseModel): dest: StrictStr = Field(description="Destination index for the redirect rule.") reason: StrictStr = Field(description="Reason for the redirect rule.") succeed: StrictBool = Field(description="Redirect rule status.") - data: RedirectRuleIndexMetadataData + data: RedirectRuleIndexData model_config = ConfigDict( use_enum_values=True, populate_by_name=True, validate_assignment=True @@ -74,7 +72,7 @@ def from_dict(cls, obj: Dict) -> Self: "reason": obj.get("reason"), "succeed": obj.get("succeed"), "data": ( - RedirectRuleIndexMetadataData.from_dict(obj.get("data")) + RedirectRuleIndexData.from_dict(obj.get("data")) if obj.get("data") is not None else None ), diff --git a/algoliasearch/search/models/search_params_string.py b/algoliasearch/search/models/search_params_string.py index af1eb7473..3320cb12d 100644 --- a/algoliasearch/search/models/search_params_string.py +++ b/algoliasearch/search/models/search_params_string.py @@ -14,7 +14,7 @@ class SearchParamsString(BaseModel): """ - SearchParamsString + Search parameters as query string. """ params: Optional[StrictStr] = Field( diff --git a/algoliasearch/usage/client.py b/algoliasearch/usage/client.py index a9b89524f..ec3adf5f0 100644 --- a/algoliasearch/usage/client.py +++ b/algoliasearch/usage/client.py @@ -18,8 +18,8 @@ from algoliasearch.http.transporter import Transporter from algoliasearch.http.verb import Verb from algoliasearch.usage.config import UsageConfig -from algoliasearch.usage.models.get_usage200_response import GetUsage200Response from algoliasearch.usage.models.granularity import Granularity +from algoliasearch.usage.models.index_usage import IndexUsage from algoliasearch.usage.models.statistic import Statistic @@ -559,7 +559,7 @@ async def get_index_usage( ), ] = None, request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> GetUsage200Response: + ) -> IndexUsage: """ Retrieves the selected usage statistics for one index. @@ -575,7 +575,7 @@ async def get_index_usage( :param granularity: Granularity of the aggregated metrics. - `hourly`: the maximum time range for hourly metrics is 7 days. - `daily`: the maximum time range for daily metrics is 365 days. :type granularity: Granularity :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the deserialized response in a 'GetUsage200Response' result object. + :return: Returns the deserialized response in a 'IndexUsage' result object. """ return ( await self.get_index_usage_with_http_info( @@ -586,7 +586,7 @@ async def get_index_usage( granularity, request_options, ) - ).deserialize(GetUsage200Response) + ).deserialize(IndexUsage) async def get_usage_with_http_info( self, @@ -695,7 +695,7 @@ async def get_usage( ), ] = None, request_options: Optional[Union[dict, RequestOptions]] = None, - ) -> GetUsage200Response: + ) -> IndexUsage: """ Retrieves usage statistics evaluated over a specified period. @@ -709,10 +709,10 @@ async def get_usage( :param granularity: Granularity of the aggregated metrics. - `hourly`: the maximum time range for hourly metrics is 7 days. - `daily`: the maximum time range for daily metrics is 365 days. :type granularity: Granularity :param request_options: The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional) - :return: Returns the deserialized response in a 'GetUsage200Response' result object. + :return: Returns the deserialized response in a 'IndexUsage' result object. """ return ( await self.get_usage_with_http_info( statistic, start_date, end_date, granularity, request_options ) - ).deserialize(GetUsage200Response) + ).deserialize(IndexUsage) diff --git a/algoliasearch/usage/models/get_usage400_response_error_errors_inner.py b/algoliasearch/usage/models/error_item.py similarity index 87% rename from algoliasearch/usage/models/get_usage400_response_error_errors_inner.py rename to algoliasearch/usage/models/error_item.py index c4e7ca555..de45822e7 100644 --- a/algoliasearch/usage/models/get_usage400_response_error_errors_inner.py +++ b/algoliasearch/usage/models/error_item.py @@ -12,9 +12,9 @@ from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr -class GetUsage400ResponseErrorErrorsInner(BaseModel): +class ErrorItem(BaseModel): """ - GetUsage400ResponseErrorErrorsInner + ErrorItem """ code: Optional[StrictStr] = None @@ -31,7 +31,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Self: - """Create an instance of GetUsage400ResponseErrorErrorsInner from a JSON string""" + """Create an instance of ErrorItem from a JSON string""" return cls.from_dict(loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -53,7 +53,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Dict) -> Self: - """Create an instance of GetUsage400ResponseErrorErrorsInner from a dict""" + """Create an instance of ErrorItem from a dict""" if obj is None: return None diff --git a/algoliasearch/usage/models/get_usage400_response.py b/algoliasearch/usage/models/forbidden.py similarity index 80% rename from algoliasearch/usage/models/get_usage400_response.py rename to algoliasearch/usage/models/forbidden.py index 9b3ce5b48..e88ae5058 100644 --- a/algoliasearch/usage/models/get_usage400_response.py +++ b/algoliasearch/usage/models/forbidden.py @@ -11,17 +11,15 @@ from pydantic import BaseModel, ConfigDict -from algoliasearch.usage.models.get_usage400_response_error import ( - GetUsage400ResponseError, -) +from algoliasearch.usage.models.forbidden_error import ForbiddenError -class GetUsage400Response(BaseModel): +class Forbidden(BaseModel): """ - GetUsage400Response + Forbidden """ - error: GetUsage400ResponseError + error: ForbiddenError model_config = ConfigDict( use_enum_values=True, populate_by_name=True, validate_assignment=True @@ -32,7 +30,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Self: - """Create an instance of GetUsage400Response from a JSON string""" + """Create an instance of Forbidden from a JSON string""" return cls.from_dict(loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -56,7 +54,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Dict) -> Self: - """Create an instance of GetUsage400Response from a dict""" + """Create an instance of Forbidden from a dict""" if obj is None: return None @@ -66,7 +64,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate( { "error": ( - GetUsage400ResponseError.from_dict(obj.get("error")) + ForbiddenError.from_dict(obj.get("error")) if obj.get("error") is not None else None ) diff --git a/algoliasearch/usage/models/get_usage400_response_error.py b/algoliasearch/usage/models/forbidden_error.py similarity index 77% rename from algoliasearch/usage/models/get_usage400_response_error.py rename to algoliasearch/usage/models/forbidden_error.py index 5af5271d0..045962aa9 100644 --- a/algoliasearch/usage/models/get_usage400_response_error.py +++ b/algoliasearch/usage/models/forbidden_error.py @@ -11,19 +11,17 @@ from pydantic import BaseModel, ConfigDict, StrictStr -from algoliasearch.usage.models.get_usage400_response_error_errors_inner import ( - GetUsage400ResponseErrorErrorsInner, -) +from algoliasearch.usage.models.error_item import ErrorItem -class GetUsage400ResponseError(BaseModel): +class ForbiddenError(BaseModel): """ - GetUsage400ResponseError + ForbiddenError """ code: Optional[StrictStr] = None message: Optional[StrictStr] = None - errors: Optional[List[GetUsage400ResponseErrorErrorsInner]] = None + errors: Optional[List[ErrorItem]] = None model_config = ConfigDict( use_enum_values=True, populate_by_name=True, validate_assignment=True @@ -34,7 +32,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Self: - """Create an instance of GetUsage400ResponseError from a JSON string""" + """Create an instance of ForbiddenError from a JSON string""" return cls.from_dict(loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -62,7 +60,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Dict) -> Self: - """Create an instance of GetUsage400ResponseError from a dict""" + """Create an instance of ForbiddenError from a dict""" if obj is None: return None @@ -74,10 +72,7 @@ def from_dict(cls, obj: Dict) -> Self: "code": obj.get("code"), "message": obj.get("message"), "errors": ( - [ - GetUsage400ResponseErrorErrorsInner.from_dict(_item) - for _item in obj.get("errors") - ] + [ErrorItem.from_dict(_item) for _item in obj.get("errors")] if obj.get("errors") is not None else None ), diff --git a/algoliasearch/usage/models/get_usage200_response.py b/algoliasearch/usage/models/index_usage.py similarity index 76% rename from algoliasearch/usage/models/get_usage200_response.py rename to algoliasearch/usage/models/index_usage.py index 878751f08..c322e1961 100644 --- a/algoliasearch/usage/models/get_usage200_response.py +++ b/algoliasearch/usage/models/index_usage.py @@ -11,17 +11,15 @@ from pydantic import BaseModel, ConfigDict -from algoliasearch.usage.models.get_usage200_response_statistics_inner import ( - GetUsage200ResponseStatisticsInner, -) +from algoliasearch.usage.models.statistic_entry import StatisticEntry -class GetUsage200Response(BaseModel): +class IndexUsage(BaseModel): """ - GetUsage200Response + IndexUsage """ - statistics: Optional[List[GetUsage200ResponseStatisticsInner]] = None + statistics: Optional[List[StatisticEntry]] = None model_config = ConfigDict( use_enum_values=True, populate_by_name=True, validate_assignment=True @@ -32,7 +30,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Self: - """Create an instance of GetUsage200Response from a JSON string""" + """Create an instance of IndexUsage from a JSON string""" return cls.from_dict(loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -60,7 +58,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Dict) -> Self: - """Create an instance of GetUsage200Response from a dict""" + """Create an instance of IndexUsage from a dict""" if obj is None: return None @@ -70,10 +68,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate( { "statistics": ( - [ - GetUsage200ResponseStatisticsInner.from_dict(_item) - for _item in obj.get("statistics") - ] + [StatisticEntry.from_dict(_item) for _item in obj.get("statistics")] if obj.get("statistics") is not None else None ) diff --git a/algoliasearch/usage/models/invalid_request.py b/algoliasearch/usage/models/invalid_request.py new file mode 100644 index 000000000..1737c6187 --- /dev/null +++ b/algoliasearch/usage/models/invalid_request.py @@ -0,0 +1,73 @@ +# coding: utf-8 + +""" +Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +""" + +from __future__ import annotations + +from json import loads +from typing import Any, Dict, Self + +from pydantic import BaseModel, ConfigDict + +from algoliasearch.usage.models.invalid_request_error import InvalidRequestError + + +class InvalidRequest(BaseModel): + """ + InvalidRequest + """ + + error: InvalidRequestError + + model_config = ConfigDict( + use_enum_values=True, populate_by_name=True, validate_assignment=True + ) + + def to_json(self) -> str: + return self.model_dump_json(by_alias=True, exclude_unset=True) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of InvalidRequest from a JSON string""" + return cls.from_dict(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. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) + if self.error: + _dict["error"] = self.error.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Dict) -> Self: + """Create an instance of InvalidRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "error": ( + InvalidRequestError.from_dict(obj.get("error")) + if obj.get("error") is not None + else None + ) + } + ) + return _obj diff --git a/algoliasearch/usage/models/invalid_request_error.py b/algoliasearch/usage/models/invalid_request_error.py new file mode 100644 index 000000000..309fef7c9 --- /dev/null +++ b/algoliasearch/usage/models/invalid_request_error.py @@ -0,0 +1,81 @@ +# coding: utf-8 + +""" +Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. +""" + +from __future__ import annotations + +from json import loads +from typing import Any, Dict, List, Optional, Self + +from pydantic import BaseModel, ConfigDict, StrictStr + +from algoliasearch.usage.models.error_item import ErrorItem + + +class InvalidRequestError(BaseModel): + """ + InvalidRequestError + """ + + code: Optional[StrictStr] = None + message: Optional[StrictStr] = None + errors: Optional[List[ErrorItem]] = None + + model_config = ConfigDict( + use_enum_values=True, populate_by_name=True, validate_assignment=True + ) + + def to_json(self) -> str: + return self.model_dump_json(by_alias=True, exclude_unset=True) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of InvalidRequestError from a JSON string""" + return cls.from_dict(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. + """ + _dict = self.model_dump( + by_alias=True, + exclude={}, + exclude_none=True, + ) + _items = [] + if self.errors: + for _item in self.errors: + if _item: + _items.append(_item.to_dict()) + _dict["errors"] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Dict) -> Self: + """Create an instance of InvalidRequestError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "code": obj.get("code"), + "message": obj.get("message"), + "errors": ( + [ErrorItem.from_dict(_item) for _item in obj.get("errors")] + if obj.get("errors") is not None + else None + ), + } + ) + return _obj diff --git a/algoliasearch/usage/models/get_usage200_response_statistics_inner.py b/algoliasearch/usage/models/statistic_entry.py similarity index 88% rename from algoliasearch/usage/models/get_usage200_response_statistics_inner.py rename to algoliasearch/usage/models/statistic_entry.py index 3210d1439..b1b0ee088 100644 --- a/algoliasearch/usage/models/get_usage200_response_statistics_inner.py +++ b/algoliasearch/usage/models/statistic_entry.py @@ -14,9 +14,9 @@ from algoliasearch.usage.models.statistic_value import StatisticValue -class GetUsage200ResponseStatisticsInner(BaseModel): +class StatisticEntry(BaseModel): """ - GetUsage200ResponseStatisticsInner + StatisticEntry """ t: Optional[StrictInt] = Field( @@ -34,7 +34,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Self: - """Create an instance of GetUsage200ResponseStatisticsInner from a JSON string""" + """Create an instance of StatisticEntry from a JSON string""" return cls.from_dict(loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -58,7 +58,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Dict) -> Self: - """Create an instance of GetUsage200ResponseStatisticsInner from a dict""" + """Create an instance of StatisticEntry from a dict""" if obj is None: return None