-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(specs): add runSource endpoint (generated)
algolia/api-clients-automation#3453 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
- Loading branch information
1 parent
74a1600
commit 036cb1c
Showing
4 changed files
with
259 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# 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 enum import Enum | ||
from json import loads | ||
from typing import Self | ||
|
||
|
||
class EntityType(str, Enum): | ||
""" | ||
Type of entity to update. | ||
""" | ||
|
||
""" | ||
allowed enum values | ||
""" | ||
PRODUCT = "product" | ||
COLLECTION = "collection" | ||
|
||
@classmethod | ||
def from_json(cls, json_str: str) -> Self: | ||
"""Create an instance of EntityType from a JSON string""" | ||
return cls(loads(json_str)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# 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, Field, StrictStr | ||
|
||
from algoliasearch.ingestion.models.entity_type import EntityType | ||
|
||
|
||
class RunSourcePayload(BaseModel): | ||
""" | ||
RunSourcePayload | ||
""" | ||
|
||
index_to_include: Optional[List[StrictStr]] = Field( | ||
default=None, | ||
description="List of index names to include in reidexing/update.", | ||
alias="indexToInclude", | ||
) | ||
index_to_exclude: Optional[List[StrictStr]] = Field( | ||
default=None, | ||
description="List of index names to exclude in reidexing/update.", | ||
alias="indexToExclude", | ||
) | ||
entity_ids: Optional[List[StrictStr]] = Field( | ||
default=None, description="List of entityID to update.", alias="entityIDs" | ||
) | ||
entity_type: Optional[EntityType] = Field(default=None, alias="entityType") | ||
|
||
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 RunSourcePayload 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 RunSourcePayload from a dict""" | ||
if obj is None: | ||
return None | ||
|
||
if not isinstance(obj, dict): | ||
return cls.model_validate(obj) | ||
|
||
_obj = cls.model_validate( | ||
{ | ||
"indexToInclude": obj.get("indexToInclude"), | ||
"indexToExclude": obj.get("indexToExclude"), | ||
"entityIDs": obj.get("entityIDs"), | ||
"entityType": obj.get("entityType"), | ||
} | ||
) | ||
return _obj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# 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, Field, StrictStr | ||
|
||
|
||
class RunSourceResponse(BaseModel): | ||
""" | ||
RunSourceResponse | ||
""" | ||
|
||
task_with_run_id: Dict[str, StrictStr] = Field( | ||
description="Map of taskID sent for reindex with the corresponding runID.", | ||
alias="taskWithRunID", | ||
) | ||
created_at: StrictStr = Field( | ||
description="Date of creation in RFC 3339 format.", alias="createdAt" | ||
) | ||
|
||
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 RunSourceResponse 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 RunSourceResponse from a dict""" | ||
if obj is None: | ||
return None | ||
|
||
if not isinstance(obj, dict): | ||
return cls.model_validate(obj) | ||
|
||
_obj = cls.model_validate( | ||
{ | ||
"taskWithRunID": obj.get("taskWithRunID"), | ||
"createdAt": obj.get("createdAt"), | ||
} | ||
) | ||
return _obj |