|
| 1 | +# Copyright 2024 Palantir Technologies, Inc. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | + |
| 16 | +from __future__ import annotations |
| 17 | + |
| 18 | +from typing import List |
| 19 | +from typing import Literal |
| 20 | +from typing import cast |
| 21 | + |
| 22 | +from pydantic import BaseModel |
| 23 | + |
| 24 | +from foundry.v2.ontologies.models._in_query_dict import InQueryDict |
| 25 | +from foundry.v2.ontologies.models._property_api_name import PropertyApiName |
| 26 | +from foundry.v2.ontologies.models._property_value import PropertyValue |
| 27 | + |
| 28 | + |
| 29 | +class InQuery(BaseModel): |
| 30 | + """Returns objects where the specified field equals any of the provided values.""" |
| 31 | + |
| 32 | + field: PropertyApiName |
| 33 | + |
| 34 | + value: List[PropertyValue] |
| 35 | + |
| 36 | + type: Literal["in"] |
| 37 | + |
| 38 | + model_config = {"extra": "allow"} |
| 39 | + |
| 40 | + def to_dict(self) -> InQueryDict: |
| 41 | + """Return the dictionary representation of the model using the field aliases.""" |
| 42 | + return cast(InQueryDict, self.model_dump(by_alias=True, exclude_unset=True)) |
0 commit comments