|
| 1 | +# Copyright 2026 Google LLC |
| 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 | +# pyformat: disable |
| 16 | + |
| 17 | +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" |
| 18 | + |
| 19 | +from __future__ import annotations |
| 20 | +from .. import ( |
| 21 | + Base64EncodedString, |
| 22 | + Base64FileInput, |
| 23 | + BaseModel, |
| 24 | + UNSET_SENTINEL, |
| 25 | +) |
| 26 | +from ...utils import validate_const |
| 27 | +import pydantic |
| 28 | +from pydantic import model_serializer |
| 29 | +from pydantic.functional_validators import AfterValidator |
| 30 | +from typing import Literal, Optional, Union |
| 31 | +from typing_extensions import Annotated, NotRequired, TypedDict |
| 32 | + |
| 33 | + |
| 34 | +class ProcessingResultStepParam(TypedDict): |
| 35 | + r"""The result of a server-initiated media processing step.""" |
| 36 | + |
| 37 | + call_id: str |
| 38 | + r"""Required. ID to match the ID from the function call block.""" |
| 39 | + signature: NotRequired[Union[str, Base64FileInput]] |
| 40 | + r"""A signature hash for backend validation.""" |
| 41 | + type: Literal["processing_result"] |
| 42 | + |
| 43 | + |
| 44 | +class ProcessingResultStep(BaseModel): |
| 45 | + r"""The result of a server-initiated media processing step.""" |
| 46 | + |
| 47 | + call_id: str |
| 48 | + r"""Required. ID to match the ID from the function call block.""" |
| 49 | + |
| 50 | + signature: Optional[Base64EncodedString] = None |
| 51 | + r"""A signature hash for backend validation.""" |
| 52 | + |
| 53 | + type: Annotated[ |
| 54 | + Annotated[ |
| 55 | + Literal["processing_result"], |
| 56 | + AfterValidator(validate_const("processing_result")), |
| 57 | + ], |
| 58 | + pydantic.Field(alias="type"), |
| 59 | + ] = "processing_result" |
| 60 | + |
| 61 | + @model_serializer(mode="wrap") |
| 62 | + def serialize_model(self, handler): |
| 63 | + optional_fields = set(["signature"]) |
| 64 | + serialized = handler(self) |
| 65 | + m = {} |
| 66 | + |
| 67 | + for n, f in type(self).model_fields.items(): |
| 68 | + k = f.alias or n |
| 69 | + val = serialized.get(k, serialized.get(n)) |
| 70 | + |
| 71 | + if val != UNSET_SENTINEL: |
| 72 | + if val is not None or k not in optional_fields: |
| 73 | + m[k] = val |
| 74 | + |
| 75 | + return m |
| 76 | + |
| 77 | + |
| 78 | +try: |
| 79 | + ProcessingResultStep.model_rebuild() |
| 80 | +except NameError: |
| 81 | + pass |
0 commit comments