diff --git a/.github/workflows/python-generator.yml b/.github/workflows/python-generator.yml index bf1ccfc090e..72ea96f52e7 100644 --- a/.github/workflows/python-generator.yml +++ b/.github/workflows/python-generator.yml @@ -61,11 +61,13 @@ jobs: poetry install - name: Unit Test - Pydantic V1 working-directory: ./generators/python - run: poetry run pytest -sv + # We have to ignore these tests as they pull in the custom config which uses a model validator, + # the syntax of which is not valid in Pydantic V1, now that we've moved to V2. + run: poetry run pytest -sv --ignore ./tests/utils/casing --ignore ./tests/sdk - name: Install Dependencies - Pydantic V2 working-directory: ./generators/python - run: | + run: | poetry add pydantic=^2.8.2 poetry lock poetry install diff --git a/generators/python/fastapi/CHANGELOG.md b/generators/python/fastapi/CHANGELOG.md index 58e41d39781..8010367ae78 100644 --- a/generators/python/fastapi/CHANGELOG.md +++ b/generators/python/fastapi/CHANGELOG.md @@ -5,11 +5,23 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.4.0] - 2024-08-05 + +- Improvement: The generated server code now respects the pydantic version flag, generating V1 only code and V2 only code if specified. If not, the server is generated as it is today, with compatibility for BOTH Pydantic versions. This cleans up the generated code, and brings back features liked wrapped aliases and custom root validators for V1-only servers. + ```yaml + generators: + - name: fernapi/fern-fastapi-server + config: + pydantic_config: + version: "v1" # Other valid options include: "v2" and "both" + ``` +- Fix: Partial classes created for validation now appropriately ignore the universal root model and only create partials off true extended classes. + ## [1.3.0] - 2024-08-04 -- Internal: The generator has now been upgraded to use Pydantic V2 internally. Note that +- Internal: The generator has now been upgraded to use Pydantic V2 internally. Note that there is no change to the generated code, however by leveraging Pydantic V2 you should notice - an improvement in `fern generate` times. + an improvement in `fern generate` times. ## [1.2.0] - 2024-07-31 diff --git a/generators/python/fastapi/VERSION b/generators/python/fastapi/VERSION index 589268e6fed..e21e727f96f 100644 --- a/generators/python/fastapi/VERSION +++ b/generators/python/fastapi/VERSION @@ -1 +1 @@ -1.3.0 \ No newline at end of file +1.4.0 \ No newline at end of file diff --git a/generators/python/pydantic/CHANGELOG.md b/generators/python/pydantic/CHANGELOG.md index e184a3d3f12..7eb13826087 100644 --- a/generators/python/pydantic/CHANGELOG.md +++ b/generators/python/pydantic/CHANGELOG.md @@ -5,11 +5,23 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.3.0] - 2024-08-05 + +- Improvement: The generated models now respects the pydantic version flag, generating V1 only code and V2 only code if specified. If not, the models is generated as it is today, with compatibility for BOTH Pydantic versions. This cleans up the generated code, and brings back features liked wrapped aliases and custom root validators for V1-only models. + + ```yaml + generators: + - name: fernapi/fern-pydantic-model + config: + pydantic_config: + version: "v1" # Other valid options include: "v2" and "both" + ``` + ## [1.2.0] - 2024-08-04 -- Internal: The generator has now been upgraded to use Pydantic V2 internally. Note that +- Internal: The generator has now been upgraded to use Pydantic V2 internally. Note that there is no change to the generated code, however by leveraging Pydantic V2 you should notice - an improvement in `fern generate` times. + an improvement in `fern generate` times. ## [1.1.0-rc0] - 2024-07-31 diff --git a/generators/python/pydantic/VERSION b/generators/python/pydantic/VERSION index 867e52437ab..589268e6fed 100644 --- a/generators/python/pydantic/VERSION +++ b/generators/python/pydantic/VERSION @@ -1 +1 @@ -1.2.0 \ No newline at end of file +1.3.0 \ No newline at end of file diff --git a/generators/python/sdk/CHANGELOG.md b/generators/python/sdk/CHANGELOG.md index 19925eaf1a9..a23eaa9befd 100644 --- a/generators/python/sdk/CHANGELOG.md +++ b/generators/python/sdk/CHANGELOG.md @@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.5.0] - 2024-08-05 + +- Improvement: The generated SDK now respects the pydantic version flag, generating V1 only code and V2 only code if specified. If not, the SDK is generated as it is today, with compatibility for BOTH Pydantic versions. This cleans up the generated code, and brings back features liked wrapped aliases for V1-only SDKs. + + Pydantic compatibility can be specified through the config below: + + ```yaml + generators: + - name: fernapi/fern-python-sdk + config: + pydantic_config: + version: "v1" # Other valid options include: "v2" and "both" + ``` + ## [3.4.2] - 2024-08-05 - Fix: The Python generator now instantiates `Any` types as `Optional[Any]` to be able to meet some breaks in Pydantic V2. diff --git a/generators/python/sdk/VERSION b/generators/python/sdk/VERSION index 4d9d11cf505..1545d966571 100644 --- a/generators/python/sdk/VERSION +++ b/generators/python/sdk/VERSION @@ -1 +1 @@ -3.4.2 +3.5.0 diff --git a/generators/python/src/fern_python/generators/pydantic_model/custom_config.py b/generators/python/src/fern_python/generators/pydantic_model/custom_config.py index 4ae00c8538f..402e550139d 100644 --- a/generators/python/src/fern_python/generators/pydantic_model/custom_config.py +++ b/generators/python/src/fern_python/generators/pydantic_model/custom_config.py @@ -1,5 +1,7 @@ from typing import Literal, Optional +from typing_extensions import Self + import pydantic from ...external_dependencies.pydantic import PydanticVersionCompatibility @@ -13,6 +15,20 @@ class BasePydanticModelCustomConfig(pydantic.BaseModel): require_optional_fields: bool = False use_str_enums: bool = True + wrapped_aliases: bool = False + + @pydantic.model_validator(mode="after") + def check_wrapped_aliases_v1_only(self) -> Self: + version_compat = self.version + use_wrapped_aliases = self.wrapped_aliases + + if use_wrapped_aliases and version_compat != PydanticVersionCompatibility.V1: + raise ValueError( + "Wrapped aliases are only supported in Pydantic V1, please update your `version` field to be 'v1' to continue using wrapped aliases." + ) + + return self + class PydanticModelCustomConfig(BasePydanticModelCustomConfig): include_validators: bool = False diff --git a/generators/python/src/fern_python/generators/pydantic_model/fern_aware_pydantic_model.py b/generators/python/src/fern_python/generators/pydantic_model/fern_aware_pydantic_model.py index 708716d3303..269898845a2 100644 --- a/generators/python/src/fern_python/generators/pydantic_model/fern_aware_pydantic_model.py +++ b/generators/python/src/fern_python/generators/pydantic_model/fern_aware_pydantic_model.py @@ -6,11 +6,16 @@ import fern.ir.resources as ir_types from fern_python.codegen import AST, LocalClassReference, SourceFile +from fern_python.external_dependencies.pydantic import PydanticVersionCompatibility from fern_python.pydantic_codegen import PydanticField, PydanticModel from ..context import PydanticGeneratorContext from .custom_config import PydanticModelCustomConfig -from .validators import PydanticValidatorsGenerator, ValidatorsGenerator +from .validators import ( + PydanticV1CustomRootTypeValidatorsGenerator, + PydanticValidatorsGenerator, + ValidatorsGenerator, +) class FernAwarePydanticModel: @@ -43,6 +48,11 @@ def __init__( snippet: Optional[str] = None, include_model_config: Optional[bool] = True, force_update_forward_refs: bool = False, + # Allow overriding the base model from the unchecked base model, or the typical + # pydantic base model to the universal root model if needed. This is used instead + # of `base_models` since that field is used for true `extends` declared within + # the IR, and used as such when constructing partial classes for validators within FastAPI. + pydantic_base_model_override: Optional[AST.ClassReference] = None, ): self._class_name = class_name self._type_name = type_name @@ -71,7 +81,8 @@ def __init__( frozen=custom_config.frozen, orm_mode=custom_config.orm_mode, smart_union=custom_config.smart_union, - pydantic_base_model=self._context.core_utilities.get_unchecked_pydantic_base_model(), + pydantic_base_model=pydantic_base_model_override + or self._context.core_utilities.get_unchecked_pydantic_base_model(), require_optional_fields=custom_config.require_optional_fields, is_pydantic_v2=self._context.core_utilities.get_is_pydantic_v2(), universal_field_validator=self._context.core_utilities.universal_field_validator, @@ -189,6 +200,23 @@ def add_method_unsafe( ) -> AST.FunctionDeclaration: return self._pydantic_model.add_method(declaration=declaration, decorator=decorator) + def set_root_type_v1_only( + self, + root_type: ir_types.TypeReference, + annotation: Optional[AST.Expression] = None, + is_forward_ref: bool = False, + ) -> None: + self.set_root_type_unsafe_v1_only( + root_type=self.get_type_hint_for_type_reference(root_type), + annotation=annotation, + is_forward_ref=is_forward_ref, + ) + + def set_root_type_unsafe_v1_only( + self, root_type: AST.TypeHint, annotation: Optional[AST.Expression] = None, is_forward_ref: bool = False + ) -> None: + self._pydantic_model.set_root_type_unsafe_v1_only(root_type=root_type, annotation=annotation) + def add_ghost_reference(self, type_id: ir_types.TypeId) -> None: self._pydantic_model.add_ghost_reference( self.get_class_reference_for_type_id(type_id), @@ -203,15 +231,22 @@ def finish(self) -> None: self._pydantic_model.finish() def _get_validators_generator(self) -> ValidatorsGenerator: - unique_name = [] - if self._type_name is not None: - unique_name = [path.snake_case.unsafe_name for path in self._type_name.fern_filepath.package_path] - unique_name.append(self._type_name.name.snake_case.unsafe_name) - return PydanticValidatorsGenerator( - model=self._pydantic_model, - extended_pydantic_fields=self._get_extended_pydantic_fields(self._extends or []), - unique_name=unique_name, - ) + v1_root_type = self._pydantic_model.get_root_type_unsafe_v1_only() + if v1_root_type is not None and self._custom_config.version == PydanticVersionCompatibility.V1: + return PydanticV1CustomRootTypeValidatorsGenerator( + model=self._pydantic_model, + root_type=v1_root_type, + ) + else: + unique_name = [] + if self._type_name is not None: + unique_name = [path.snake_case.unsafe_name for path in self._type_name.fern_filepath.package_path] + unique_name.append(self._type_name.name.snake_case.unsafe_name) + return PydanticValidatorsGenerator( + model=self._pydantic_model, + extended_pydantic_fields=self._get_extended_pydantic_fields(self._extends or []), + unique_name=unique_name, + ) def _get_extended_pydantic_fields(self, extends: Sequence[ir_types.DeclaredTypeName]) -> List[PydanticField]: extended_fields: List[PydanticField] = [] diff --git a/generators/python/src/fern_python/generators/pydantic_model/type_declaration_handler/discriminated_union/discriminated_union_with_utils_generator.py b/generators/python/src/fern_python/generators/pydantic_model/type_declaration_handler/discriminated_union/discriminated_union_with_utils_generator.py index 5fb5814ac1b..8d93ab728c3 100644 --- a/generators/python/src/fern_python/generators/pydantic_model/type_declaration_handler/discriminated_union/discriminated_union_with_utils_generator.py +++ b/generators/python/src/fern_python/generators/pydantic_model/type_declaration_handler/discriminated_union/discriminated_union_with_utils_generator.py @@ -8,6 +8,9 @@ ClassDeclaration, ) from fern_python.external_dependencies import Pydantic +from fern_python.generators.pydantic_model.type_declaration_handler.type_utilities import ( + declared_type_name_to_named_type, +) from fern_python.pydantic_codegen import PydanticField, PydanticModel from ....context import PydanticGeneratorContext @@ -155,7 +158,7 @@ def generate(self) -> None: source_file=self._source_file, docstring=self._docs, snippet=self._snippet, - base_models=[self._context.core_utilities.get_universal_root_model()], + pydantic_base_model_override=self._context.core_utilities.get_universal_root_model(), # No reason to have model config overrides on the base model, but # also Pydantic V2's RootModel doesn't allow for a lot of the configuration. include_model_config=False, @@ -230,7 +233,9 @@ def generate(self) -> None: name=BUILDER_ARGUMENT_NAME, type_hint=self._context.get_type_hint_for_type_reference( ir_types.TypeReference.factory.named( - self._to_named_type(declared_type_name=declared_type_name) + declared_type_name_to_named_type( + declared_type_name=declared_type_name + ) ) ), ) @@ -244,7 +249,7 @@ def generate(self) -> None: no_properties=lambda: None, ), return_type=self._context.get_type_hint_for_type_reference( - ir_types.TypeReference.factory.named(self._to_named_type(self._name)) + ir_types.TypeReference.factory.named(declared_type_name_to_named_type(self._name)) ), ), body=AST.CodeWriter( @@ -320,7 +325,7 @@ def generate(self) -> None: ), type=external_pydantic_model.get_type_hint_for_type_reference( ir_types.TypeReference.factory.named( - self._to_named_type(declared_type_name=declared_type_name) + declared_type_name_to_named_type(declared_type_name=declared_type_name) ) ), ), @@ -342,13 +347,6 @@ def generate(self) -> None: ) ) - def _to_named_type(self, declared_type_name: ir_types.DeclaredTypeName) -> ir_types.NamedType: - return ir_types.NamedType( - type_id=declared_type_name.type_id, - fern_filepath=declared_type_name.fern_filepath, - name=declared_type_name.name, - ) - def _create_body_writer( self, single_union_type: ir_types.SingleUnionType, diff --git a/generators/python/src/fern_python/generators/pydantic_model/type_declaration_handler/pydantic_models/pydantic_model_alias_generator.py b/generators/python/src/fern_python/generators/pydantic_model/type_declaration_handler/pydantic_models/pydantic_model_alias_generator.py index df484f80d4b..9210a3ae72f 100644 --- a/generators/python/src/fern_python/generators/pydantic_model/type_declaration_handler/pydantic_models/pydantic_model_alias_generator.py +++ b/generators/python/src/fern_python/generators/pydantic_model/type_declaration_handler/pydantic_models/pydantic_model_alias_generator.py @@ -3,6 +3,12 @@ import fern.ir.resources as ir_types from fern_python.codegen import AST, SourceFile +from fern_python.generators.pydantic_model.fern_aware_pydantic_model import ( + FernAwarePydanticModel, +) +from fern_python.generators.pydantic_model.type_declaration_handler.type_utilities import ( + declared_type_name_to_named_type, +) from fern_python.snippet import SnippetWriter from ....context import PydanticGeneratorContext @@ -34,13 +40,97 @@ def __init__( def generate( self, ) -> None: - self._source_file.add_declaration( - declaration=AST.TypeAliasDeclaration( - name=self._context.get_class_name_for_type_id(self._name.type_id, as_request=False), - type_hint=self._type_hint, + if not self._custom_config.wrapped_aliases: + self._source_file.add_declaration( + declaration=AST.TypeAliasDeclaration( + name=self._context.get_class_name_for_type_id(self._name.type_id, as_request=False), + type_hint=self._type_hint, + snippet=self._snippet, + ), + should_export=True, + ) + else: + # NOTE: We validate the config to ensure wrapped aliases are only available for Pydantic V1 users. + # As such, we force the root field to be __root__ as opposed to conditional based on the Pydantic version. + BUILDER_PARAMETER_NAME = "value" + with FernAwarePydanticModel( + class_name=self._context.get_class_name_for_type_id(self._name.type_id, as_request=False), + type_name=self._name, + context=self._context, + custom_config=self._custom_config, + source_file=self._source_file, + docstring=self._docs, snippet=self._snippet, + ) as pydantic_model: + pydantic_model.set_root_type_v1_only(self._alias.alias_of) + pydantic_model.add_method( + name=self._get_getter_name(self._alias.alias_of), + parameters=[], + return_type=self._alias.alias_of, + body=AST.CodeWriter("return self.__root__"), + ) + pydantic_model.add_method( + name=self._get_builder_name(self._alias.alias_of), + parameters=[(BUILDER_PARAMETER_NAME, self._alias.alias_of)], + return_type=ir_types.TypeReference.factory.named(declared_type_name_to_named_type(self._name)), + body=AST.CodeWriter(f"return {pydantic_model.get_class_name()}(__root__={BUILDER_PARAMETER_NAME})"), + decorator=AST.ClassMethodDecorator.STATIC, + ) + + def _get_builder_name(self, alias_of: ir_types.TypeReference) -> str: + return alias_of.visit( + container=lambda container: container.visit( + list_=lambda _: "from_list", + map_=lambda _: "from_map", + set_=lambda _: "from_set", + optional=self._get_builder_name, + literal=lambda _: "from_string", + ), + named=lambda type_name: "from_" + type_name.name.snake_case.unsafe_name, + primitive=lambda primitive: primitive.v_1.visit( + integer=lambda: "from_int", + double=lambda: "from_float", + string=lambda: "from_str", + boolean=lambda: "from_bool", + long_=lambda: "from_int", + date_time=lambda: "from_datetime", + date=lambda: "from_date", + uuid_=lambda: "from_uuid", + base_64=lambda: "from_str", + big_integer=lambda: "from_str", + uint=lambda: "from_int", + uint_64=lambda: "from_int", + float_=lambda: "from_float", + ), + unknown=lambda: "from_", + ) + + def _get_getter_name(self, alias_of: ir_types.TypeReference) -> str: + return alias_of.visit( + container=lambda container: container.visit( + list_=lambda _: "get_as_list", + map_=lambda _: "get_as_map", + set_=lambda _: "get_as_set", + optional=self._get_getter_name, + literal=lambda _: "get_as_string", + ), + named=lambda type_name: "get_as_" + type_name.name.snake_case.unsafe_name, + primitive=lambda primitive: primitive.v_1.visit( + integer=lambda: "get_as_int", + double=lambda: "get_as_float", + string=lambda: "get_as_str", + boolean=lambda: "get_as_bool", + long_=lambda: "get_as_int", + date_time=lambda: "get_as_datetime", + date=lambda: "get_as_date", + uuid_=lambda: "get_as_uuid", + base_64=lambda: "get_as_str", + big_integer=lambda: "get_as_str", + uint=lambda: "get_as_int", + uint_64=lambda: "get_as_int", + float_=lambda: "get_as_float", ), - should_export=True, + unknown=lambda: "get_value", ) diff --git a/generators/python/src/fern_python/generators/pydantic_model/type_declaration_handler/type_utilities.py b/generators/python/src/fern_python/generators/pydantic_model/type_declaration_handler/type_utilities.py new file mode 100644 index 00000000000..2897f44ecb6 --- /dev/null +++ b/generators/python/src/fern_python/generators/pydantic_model/type_declaration_handler/type_utilities.py @@ -0,0 +1,9 @@ +import fern.ir.resources as ir_types + + +def declared_type_name_to_named_type(declared_type_name: ir_types.DeclaredTypeName) -> ir_types.NamedType: + return ir_types.NamedType( + type_id=declared_type_name.type_id, + fern_filepath=declared_type_name.fern_filepath, + name=declared_type_name.name, + ) diff --git a/generators/python/src/fern_python/generators/pydantic_model/validators/__init__.py b/generators/python/src/fern_python/generators/pydantic_model/validators/__init__.py index 074d3436e4d..f231cc244b0 100644 --- a/generators/python/src/fern_python/generators/pydantic_model/validators/__init__.py +++ b/generators/python/src/fern_python/generators/pydantic_model/validators/__init__.py @@ -1,4 +1,7 @@ +from .pydantic_v1_custom_root_type_validators_generator import ( + PydanticV1CustomRootTypeValidatorsGenerator, +) from .pydantic_validators_generator import PydanticValidatorsGenerator from .validators_generator import ValidatorsGenerator -__all__ = ["ValidatorsGenerator", "PydanticValidatorsGenerator"] +__all__ = ["ValidatorsGenerator", "PydanticValidatorsGenerator", "PydanticV1CustomRootTypeValidatorsGenerator"] diff --git a/generators/python/src/fern_python/generators/pydantic_model/validators/pydantic_v1_custom_root_type_validators_generator.py b/generators/python/src/fern_python/generators/pydantic_model/validators/pydantic_v1_custom_root_type_validators_generator.py new file mode 100644 index 00000000000..53e6e775ada --- /dev/null +++ b/generators/python/src/fern_python/generators/pydantic_model/validators/pydantic_v1_custom_root_type_validators_generator.py @@ -0,0 +1,31 @@ +from typing import Sequence + +from fern_python.codegen import AST +from fern_python.pydantic_codegen import PydanticModel + +from .validator_generators import ( + PydanticV1CustomRootTypeValidatorGenerator, + ValidatorGenerator, +) +from .validators_generator import ValidatorsGenerator + + +class PydanticV1CustomRootTypeValidatorsGenerator(ValidatorsGenerator): + def __init__(self, root_type: AST.TypeHint, model: PydanticModel): + super().__init__(model=model) + self._root_type = root_type + self._root_type_generator = PydanticV1CustomRootTypeValidatorGenerator( + root_type=root_type, + model=model, + reference_to_validators_class=self._get_reference_to_validators_class(), + ) + + def _populate_validators_class(self, validators_class: AST.ClassDeclaration) -> None: + self._root_type_generator.add_to_validators_class(validators_class) + + def _get_validator_generators(self) -> Sequence[ValidatorGenerator]: + return [self._root_type_generator] + + def _write_examples_for_docstring(self, writer: AST.NodeWriter) -> None: + writer.write_line() + self._root_type_generator.write_example_for_docstring(writer=writer) diff --git a/generators/python/src/fern_python/generators/pydantic_model/validators/validator_generators/__init__.py b/generators/python/src/fern_python/generators/pydantic_model/validators/validator_generators/__init__.py index 6e7557ac793..fca17e94347 100644 --- a/generators/python/src/fern_python/generators/pydantic_model/validators/validator_generators/__init__.py +++ b/generators/python/src/fern_python/generators/pydantic_model/validators/validator_generators/__init__.py @@ -1,4 +1,7 @@ from .field_validator_generator import FieldValidatorGenerator +from .pydantic_v1_custom_root_type_validator_generator import ( + PydanticV1CustomRootTypeValidatorGenerator, +) from .root_validator_generator import RootValidatorGenerator from .validator_generator import ValidatorGenerator @@ -6,4 +9,5 @@ "ValidatorGenerator", "FieldValidatorGenerator", "RootValidatorGenerator", + "PydanticV1CustomRootTypeValidatorGenerator", ] diff --git a/generators/python/src/fern_python/generators/pydantic_model/validators/validator_generators/pydantic_v1_custom_root_type_validator_generator.py b/generators/python/src/fern_python/generators/pydantic_model/validators/validator_generators/pydantic_v1_custom_root_type_validator_generator.py new file mode 100644 index 00000000000..5a088216ae5 --- /dev/null +++ b/generators/python/src/fern_python/generators/pydantic_model/validators/validator_generators/pydantic_v1_custom_root_type_validator_generator.py @@ -0,0 +1,111 @@ +from typing import Tuple + +from fern_python.codegen import AST +from fern_python.pydantic_codegen import PydanticModel + +from .validator_generator import ValidatorGenerator + + +class PydanticV1CustomRootTypeValidatorGenerator(ValidatorGenerator): + _DECORATOR_FUNCTION_NAME = "validate" + _VALIDATOR_CLASS_VALIDATORS_CLASS_VAR = "_validators" + + def __init__(self, root_type: AST.TypeHint, model: PydanticModel, reference_to_validators_class: Tuple[str, ...]): + super().__init__(model=model, reference_to_validators_class=reference_to_validators_class) + self._root_type = root_type + + def add_validator_to_model(self) -> None: + self._model.add_root_validator( + validator_name="_validate", + body=AST.CodeWriter(self._write_validator_body), + ) + + def _write_validator_body(self, writer: AST.NodeWriter) -> None: + ROOT_VARIABLE_NAME = "value" + INDIVIDUAL_VALIDATOR_NAME = "validator" + + writer.write(f"{ROOT_VARIABLE_NAME} = ") + writer.write_node( + AST.FunctionInvocation( + function_definition=AST.Reference( + qualified_name_excluding_import=("cast",), + import_=AST.ReferenceImport(module=AST.Module.built_in(("typing",))), + ), + args=[ + AST.Expression(self._root_type), + AST.Expression(f'{PydanticModel.VALIDATOR_VALUES_PARAMETER_NAME}.get("__root__")'), + ], + ), + ) + writer.write_line() + + writer.write(f"for {INDIVIDUAL_VALIDATOR_NAME} in ") + writer.write_line( + ".".join( + ( + *self._reference_to_validators_class, + PydanticV1CustomRootTypeValidatorGenerator._VALIDATOR_CLASS_VALIDATORS_CLASS_VAR, + ) + ) + + ":" + ) + + with writer.indent(): + writer.write(f"{ROOT_VARIABLE_NAME} = ") + writer.write_node( + AST.FunctionInvocation( + function_definition=AST.Reference( + qualified_name_excluding_import=(INDIVIDUAL_VALIDATOR_NAME,), + ), + args=[AST.Expression(ROOT_VARIABLE_NAME)], + ) + ) + writer.write_line() + writer.write_line( + "return " + f'{{ **{PydanticModel.VALIDATOR_VALUES_PARAMETER_NAME}, "__root__": {ROOT_VARIABLE_NAME} }}' + ) + + def add_to_validators_class(self, validators_class: AST.ClassDeclaration) -> None: + VALIDATOR_PARAMETER = "validator" + + validator_type = AST.TypeHint.callable([self._root_type], self._root_type) + validators_class.add_class_var( + AST.VariableDeclaration( + name=PydanticV1CustomRootTypeValidatorGenerator._VALIDATOR_CLASS_VALIDATORS_CLASS_VAR, + type_hint=AST.TypeHint.class_var(AST.TypeHint.list(validator_type)), + initializer=AST.Expression("[]"), + ) + ) + validators_class.add_method( + declaration=AST.FunctionDeclaration( + name=PydanticV1CustomRootTypeValidatorGenerator._DECORATOR_FUNCTION_NAME, + signature=AST.FunctionSignature( + parameters=[AST.FunctionParameter(name=VALIDATOR_PARAMETER, type_hint=validator_type)], + return_type=AST.TypeHint.none(), + ), + body=AST.CodeWriter( + f"cls.{PydanticV1CustomRootTypeValidatorGenerator._VALIDATOR_CLASS_VALIDATORS_CLASS_VAR}" + + f".append({VALIDATOR_PARAMETER})" + ), + ), + decorator=AST.ClassMethodDecorator.CLASS_METHOD, + ) + + def write_example_for_docstring(self, writer: AST.NodeWriter) -> None: + + reference_to_decorator = ".".join( + (*self._reference_to_validators_class, PydanticV1CustomRootTypeValidatorGenerator._DECORATOR_FUNCTION_NAME) + ) + + with writer.indent(): + writer.write("@") + writer.write_line(reference_to_decorator) + + writer.write("def validate(value: ") + writer.write_node(self._root_type) + writer.write(") -> ") + writer.write_node(self._root_type) + writer.write_line(":") + + with writer.indent(): + writer.write_line("...") diff --git a/generators/python/src/fern_python/pydantic_codegen/pydantic_model.py b/generators/python/src/fern_python/pydantic_codegen/pydantic_model.py index b5f3fb93d77..28c6dd2b8b6 100644 --- a/generators/python/src/fern_python/pydantic_codegen/pydantic_model.py +++ b/generators/python/src/fern_python/pydantic_codegen/pydantic_model.py @@ -68,6 +68,7 @@ def __init__( ) self._has_aliases = False self._version = version + self._v1_root_type: Optional[AST.TypeHint] = None self._fields: List[PydanticField] = [] self._extra_fields = extra_fields self._frozen = frozen @@ -239,6 +240,32 @@ def add_root_validator( ), ) + def set_root_type_unsafe_v1_only( + self, root_type: AST.TypeHint, annotation: Optional[AST.Expression] = None + ) -> None: + if self._version != PydanticVersionCompatibility.V1: + raise RuntimeError("Overriding root types is only available in Pydantic v1") + + if self._v1_root_type is not None: + raise RuntimeError("__root__ was already added") + self._v1_root_type = root_type + + root_type_with_annotation = ( + AST.TypeHint.annotated( + type=root_type, + annotation=AST.Expression(annotation), + ) + if annotation is not None + else root_type + ) + + self._class_declaration.add_statement( + AST.VariableDeclaration(name="__root__", type_hint=root_type_with_annotation) + ) + + def get_root_type_unsafe_v1_only(self) -> Optional[AST.TypeHint]: + return self._v1_root_type + def add_inner_class(self, inner_class: AST.ClassDeclaration) -> None: self._class_declaration.add_class(declaration=inner_class) diff --git a/generators/python/tests/sdk/test_custom_config.py b/generators/python/tests/sdk/test_custom_config.py index cf876a3e546..73b74866ad4 100644 --- a/generators/python/tests/sdk/test_custom_config.py +++ b/generators/python/tests/sdk/test_custom_config.py @@ -1,17 +1,19 @@ from fern_python.generators.sdk.custom_config import SDKCustomConfig +import pydantic +import pytest -top_level_payload = { - "use_typeddict_requests": True, -} - -pydantic_config_level_payload = { - "pydantic_config": { +def test_parse_obj_override() -> None: + top_level_payload = { "use_typeddict_requests": True, - }, -} + } + + pydantic_config_level_payload = { + "pydantic_config": { + "use_typeddict_requests": True, + }, + } -def test_parse_obj_override() -> None: top_level_custom_config = SDKCustomConfig.parse_obj(top_level_payload) pydantic_config_custom_config = SDKCustomConfig.parse_obj(pydantic_config_level_payload) @@ -25,3 +27,31 @@ def test_parse_obj_override() -> None: assert top_level_custom_config.use_typeddict_requests == pydantic_config_custom_config.use_typeddict_requests assert top_level_custom_config.pydantic_config.use_typeddict_requests == pydantic_config_custom_config.pydantic_config.use_typeddict_requests + +def test_parse_wrapped_aliases() -> None: + v1 = { + "pydantic_config": { + "version": "v1", + "wrapped_aliases": True, + }, + } + sdk_custom_config = SDKCustomConfig.parse_obj(v1) + assert sdk_custom_config.pydantic_config.version == "v1" and sdk_custom_config.pydantic_config.wrapped_aliases is True + + v2 = { + "pydantic_config": { + "version": "v2", + "wrapped_aliases": True, + }, + } + with pytest.raises(pydantic.ValidationError, match="Wrapped aliases are only supported in Pydantic V1, please update your `version` field to be 'v1' to continue using wrapped aliases."): + SDKCustomConfig.parse_obj(v2) + + both = { + "pydantic_config": { + "version": "both", + "wrapped_aliases": True, + }, + } + with pytest.raises(pydantic.ValidationError, match="Wrapped aliases are only supported in Pydantic V1, please update your `version` field to be 'v1' to continue using wrapped aliases."): + SDKCustomConfig.parse_obj(both) diff --git a/seed/fastapi/exhaustive/include-validators/.mock/definition/api.yml b/seed/fastapi/exhaustive/include-validators/.mock/definition/api.yml new file mode 100644 index 00000000000..dd65915538f --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/.mock/definition/api.yml @@ -0,0 +1,4 @@ +name: exhaustive +auth: bearer +error-discrimination: + strategy: status-code diff --git a/seed/fastapi/exhaustive/include-validators/.mock/definition/endpoints/container.yml b/seed/fastapi/exhaustive/include-validators/.mock/definition/endpoints/container.yml new file mode 100644 index 00000000000..165a039dc65 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/.mock/definition/endpoints/container.yml @@ -0,0 +1,48 @@ +imports: + objects: ../types/object.yml + +service: + auth: true + base-path: /container + endpoints: + getAndReturnListOfPrimitives: + path: /list-of-primitives + method: POST + request: list + response: list + + getAndReturnListOfObjects: + path: /list-of-objects + method: POST + request: list + response: list + + getAndReturnSetOfPrimitives: + path: /set-of-primitives + method: POST + request: set + response: set + + getAndReturnSetOfObjects: + path: /set-of-objects + method: POST + request: set + response: set + + getAndReturnMapPrimToPrim: + path: /map-prim-to-prim + method: POST + request: map + response: map + + getAndReturnMapOfPrimToObject: + path: /map-prim-to-object + method: POST + request: map + response: map + + getAndReturnOptional: + path: /opt-objects + method: POST + request: optional + response: optional diff --git a/seed/fastapi/exhaustive/include-validators/.mock/definition/endpoints/enum.yml b/seed/fastapi/exhaustive/include-validators/.mock/definition/endpoints/enum.yml new file mode 100644 index 00000000000..335a0889cc7 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/.mock/definition/endpoints/enum.yml @@ -0,0 +1,12 @@ +imports: + enums: ../types/enum.yml + +service: + auth: true + base-path: /enum + endpoints: + getAndReturnEnum: + method: POST + path: "" + request: enums.WeatherReport + response: enums.WeatherReport diff --git a/seed/fastapi/exhaustive/include-validators/.mock/definition/endpoints/http-methods.yml b/seed/fastapi/exhaustive/include-validators/.mock/definition/endpoints/http-methods.yml new file mode 100644 index 00000000000..51a54c0802c --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/.mock/definition/endpoints/http-methods.yml @@ -0,0 +1,43 @@ +imports: + objects: ../types/object.yml + +service: + auth: true + base-path: /http-methods + + endpoints: + testGet: + method: GET + path: /{id} + path-parameters: + id: string + response: string + + testPost: + method: POST + path: "" + request: objects.ObjectWithRequiredField + response: objects.ObjectWithOptionalField + + testPut: + method: PUT + path: /{id} + path-parameters: + id: string + request: objects.ObjectWithRequiredField + response: objects.ObjectWithOptionalField + + testPatch: + method: PATCH + path: /{id} + path-parameters: + id: string + request: objects.ObjectWithOptionalField + response: objects.ObjectWithOptionalField + + testDelete: + method: DELETE + path: /{id} + path-parameters: + id: string + response: boolean diff --git a/seed/fastapi/exhaustive/include-validators/.mock/definition/endpoints/object.yml b/seed/fastapi/exhaustive/include-validators/.mock/definition/endpoints/object.yml new file mode 100644 index 00000000000..9fad6aa2776 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/.mock/definition/endpoints/object.yml @@ -0,0 +1,44 @@ +imports: + objects: ../types/object.yml + +service: + auth: true + base-path: /object + endpoints: + getAndReturnWithOptionalField: + path: /get-and-return-with-optional-field + method: POST + request: objects.ObjectWithOptionalField + response: objects.ObjectWithOptionalField + + getAndReturnWithRequiredField: + path: /get-and-return-with-required-field + method: POST + request: objects.ObjectWithRequiredField + response: objects.ObjectWithRequiredField + + getAndReturnWithMapOfMap: + path: /get-and-return-with-map-of-map + method: POST + request: objects.ObjectWithMapOfMap + response: objects.ObjectWithMapOfMap + + getAndReturnNestedWithOptionalField: + path: /get-and-return-nested-with-optional-field + method: POST + request: objects.NestedObjectWithOptionalField + response: objects.NestedObjectWithOptionalField + + getAndReturnNestedWithRequiredField: + path: /get-and-return-nested-with-required-field/{string} + method: POST + path-parameters: + string: string + request: objects.NestedObjectWithRequiredField + response: objects.NestedObjectWithRequiredField + + getAndReturnNestedWithRequiredFieldAsList: + path: /get-and-return-nested-with-required-field-list + method: POST + request: list + response: objects.NestedObjectWithRequiredField diff --git a/seed/fastapi/exhaustive/include-validators/.mock/definition/endpoints/params.yml b/seed/fastapi/exhaustive/include-validators/.mock/definition/endpoints/params.yml new file mode 100644 index 00000000000..7766547ad79 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/.mock/definition/endpoints/params.yml @@ -0,0 +1,57 @@ +service: + auth: true + base-path: /params + endpoints: + getWithPath: + docs: GET with path param + path: /path/{param} + path-parameters: + param: string + method: GET + response: string + + getWithQuery: + docs: GET with query param + path: "" + method: GET + request: + name: GetWithQuery + query-parameters: + query: string #mandatory for test + number: integer + + getWithAllowMultipleQuery: + docs: GET with multiple of same query param + path: "" + method: GET + request: + name: GetWithMultipleQuery + query-parameters: + query: + type: string + allow-multiple: true + numer: + type: integer + allow-multiple: true + + getWithPathAndQuery: + docs: GET with path and query params + path: /path-query/{param} + path-parameters: + param: string + method: GET + request: + name: GetWithPathAndQuery + query-parameters: + query: string #mandatory for test + + modifyWithPath: + docs: PUT to update with path param + path: /path/{param} + path-parameters: + param: string + method: PUT + request: + name: ModifyResourceAtPath + body: string + response: string diff --git a/seed/fastapi/exhaustive/include-validators/.mock/definition/endpoints/primitive.yml b/seed/fastapi/exhaustive/include-validators/.mock/definition/endpoints/primitive.yml new file mode 100644 index 00000000000..8dd7674164c --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/.mock/definition/endpoints/primitive.yml @@ -0,0 +1,60 @@ +imports: + objects: ../types/object.yml + +service: + auth: true + base-path: /primitive + endpoints: + getAndReturnString: + path: /string + method: POST + request: string + response: string + + getAndReturnInt: + path: /integer + method: POST + request: integer + response: integer + + getAndReturnLong: + path: /long + method: POST + request: long + response: long + + getAndReturnDouble: + path: /double + method: POST + request: double + response: double + + getAndReturnBool: + path: /boolean + method: POST + request: boolean + response: boolean + + getAndReturnDatetime: + path: /datetime + method: POST + request: datetime + response: datetime + + getAndReturnDate: + path: /date + method: POST + request: date + response: date + + getAndReturnUUID: + path: /uuid + method: POST + request: uuid + response: uuid + + getAndReturnBase64: + path: /base64 + method: POST + request: base64 + response: base64 diff --git a/seed/fastapi/exhaustive/include-validators/.mock/definition/endpoints/union.yml b/seed/fastapi/exhaustive/include-validators/.mock/definition/endpoints/union.yml new file mode 100644 index 00000000000..ce9021160d7 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/.mock/definition/endpoints/union.yml @@ -0,0 +1,12 @@ +imports: + unions: ../types/union.yml + +service: + auth: true + base-path: /union + endpoints: + getAndReturnUnion: + method: POST + path: "" + request: unions.Animal + response: unions.Animal diff --git a/seed/fastapi/exhaustive/include-validators/.mock/definition/general-errors.yml b/seed/fastapi/exhaustive/include-validators/.mock/definition/general-errors.yml new file mode 100644 index 00000000000..5fbf9cfc417 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/.mock/definition/general-errors.yml @@ -0,0 +1,9 @@ +errors: + BadRequestBody: + status-code: 400 + type: BadObjectRequestInfo + +types: + BadObjectRequestInfo: + properties: + message: string diff --git a/seed/fastapi/exhaustive/include-validators/.mock/definition/inlined-requests.yml b/seed/fastapi/exhaustive/include-validators/.mock/definition/inlined-requests.yml new file mode 100644 index 00000000000..9347fe7e335 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/.mock/definition/inlined-requests.yml @@ -0,0 +1,25 @@ +imports: + objects: ./types/object.yml + errors: ./general-errors.yml + +# test req bodies, path params, query params, multiple query params, etc. +# test union and enum as well + +service: + auth: false + base-path: /req-bodies + endpoints: + postWithObjectBodyandResponse: + docs: POST with custom object in request body, response is an object + path: /object + method: POST + request: + name: PostWithObjectBody + body: + properties: + string: string + integer: integer + NestedObject: objects.ObjectWithOptionalField + response: objects.ObjectWithOptionalField + errors: + - errors.BadRequestBody diff --git a/seed/fastapi/exhaustive/include-validators/.mock/definition/no-auth.yml b/seed/fastapi/exhaustive/include-validators/.mock/definition/no-auth.yml new file mode 100644 index 00000000000..e3c33ed7fab --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/.mock/definition/no-auth.yml @@ -0,0 +1,20 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +imports: + general-errors: ./general-errors.yml + +service: + auth: false + base-path: /no-auth + endpoints: + postWithNoAuth: + auth: false + docs: POST request with no auth + path: "" + method: POST + request: + name: PostWithNoAuth + body: unknown + response: boolean + errors: + - general-errors.BadRequestBody diff --git a/seed/fastapi/exhaustive/include-validators/.mock/definition/no-req-body.yml b/seed/fastapi/exhaustive/include-validators/.mock/definition/no-req-body.yml new file mode 100644 index 00000000000..daffd9a495c --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/.mock/definition/no-req-body.yml @@ -0,0 +1,16 @@ +imports: + objects: ./types/object.yml + +service: + auth: true + base-path: /no-req-body + endpoints: + getWithNoRequestBody: + path: "" + method: GET + response: objects.ObjectWithOptionalField + + postWithNoRequestBody: + path: "" + method: POST + response: string diff --git a/seed/fastapi/exhaustive/include-validators/.mock/definition/req-with-headers.yml b/seed/fastapi/exhaustive/include-validators/.mock/definition/req-with-headers.yml new file mode 100644 index 00000000000..9e49725782f --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/.mock/definition/req-with-headers.yml @@ -0,0 +1,14 @@ +service: + base-path: /test-headers + auth: true + headers: + X-TEST-SERVICE-HEADER: string + endpoints: + getWithCustomHeader: + path: /custom-header + method: POST + request: + name: ReqWithHeaders + headers: + X-TEST-ENDPOINT-HEADER: string + body: string diff --git a/seed/fastapi/exhaustive/include-validators/.mock/definition/types/enum.yml b/seed/fastapi/exhaustive/include-validators/.mock/definition/types/enum.yml new file mode 100644 index 00000000000..a90686092e9 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/.mock/definition/types/enum.yml @@ -0,0 +1,12 @@ +types: + WeatherReport: + enum: + - SUNNY + - CLOUDY + - RAINING + - SNOWING + +errors: + ErrorWithEnumBody: + status-code: 400 + type: WeatherReport #does this even make sense? the type of the error body would be enum, and it could only be one of the 4 values? diff --git a/seed/fastapi/exhaustive/include-validators/.mock/definition/types/object.yml b/seed/fastapi/exhaustive/include-validators/.mock/definition/types/object.yml new file mode 100644 index 00000000000..a165ed94cfe --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/.mock/definition/types/object.yml @@ -0,0 +1,59 @@ +types: + ObjectWithOptionalField: #generic object that supports any type, makes it easier to use when testing + properties: + string: + type: optional + docs: This is a rather long descriptor of this single field in a more complex type. If you ask me I think this is a pretty good description for this field all things considered. + integer: optional + long: optional + double: optional + bool: optional + datetime: optional + date: optional + uuid: optional + base64: optional + list: optional> + set: optional> + map: optional> + bigint: optional + + ObjectWithRequiredField: + properties: + string: string + + ObjectWithMapOfMap: + properties: + map: map> + + NestedObjectWithOptionalField: + properties: + string: optional + NestedObject: optional + + NestedObjectWithRequiredField: + properties: + string: string + NestedObject: ObjectWithOptionalField + + DoubleOptional: + properties: + optionalAlias: optional + + OptionalAlias: optional + +errors: + ObjectWithOptionalFieldError: + status-code: 400 + type: ObjectWithOptionalField + + ObjectWithRequiredFieldError: + status-code: 400 + type: ObjectWithRequiredField + + NestedObjectWithOptionalFieldError: + status-code: 400 + type: NestedObjectWithOptionalField + + NestedObjectWithRequiredFieldError: + status-code: 400 + type: NestedObjectWithRequiredField diff --git a/seed/fastapi/exhaustive/include-validators/.mock/definition/types/union.yml b/seed/fastapi/exhaustive/include-validators/.mock/definition/types/union.yml new file mode 100644 index 00000000000..99ce8c75ed0 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/.mock/definition/types/union.yml @@ -0,0 +1,21 @@ +types: + Animal: + discriminant: animal + union: + dog: Dog + cat: Cat + + Dog: + properties: + name: string + likesToWoof: boolean + + Cat: + properties: + name: string + likesToMeow: boolean + +errors: + ErrorWithUnionBody: + status-code: 400 + type: Animal #has to send either dog or cat object in error body diff --git a/seed/fastapi/exhaustive/include-validators/.mock/fern.config.json b/seed/fastapi/exhaustive/include-validators/.mock/fern.config.json new file mode 100644 index 00000000000..4c8e54ac313 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "*"} \ No newline at end of file diff --git a/seed/fastapi/exhaustive/include-validators/.mock/generators.yml b/seed/fastapi/exhaustive/include-validators/.mock/generators.yml new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/.mock/generators.yml @@ -0,0 +1 @@ +{} diff --git a/seed/fastapi/exhaustive/include-validators/__init__.py b/seed/fastapi/exhaustive/include-validators/__init__.py new file mode 100644 index 00000000000..2679cde4830 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/__init__.py @@ -0,0 +1,14 @@ +# This file was auto-generated by Fern from our API Definition. + +from .resources import BadObjectRequestInfo, BadRequestBody, PostWithObjectBody, general_errors, inlined_requests, types +from .security import ApiAuth + +__all__ = [ + "ApiAuth", + "BadObjectRequestInfo", + "BadRequestBody", + "PostWithObjectBody", + "general_errors", + "inlined_requests", + "types", +] diff --git a/seed/fastapi/exhaustive/include-validators/core/__init__.py b/seed/fastapi/exhaustive/include-validators/core/__init__.py new file mode 100644 index 00000000000..f375cd27ae8 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/core/__init__.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +from .datetime_utils import serialize_datetime +from .exceptions import ( + FernHTTPException, + UnauthorizedException, + default_exception_handler, + fern_http_exception_handler, + http_exception_handler, +) +from .pydantic_utilities import ( + IS_PYDANTIC_V2, + UniversalBaseModel, + UniversalRootModel, + deep_union_pydantic_dicts, + parse_obj_as, + universal_field_validator, + universal_root_validator, + update_forward_refs, +) +from .route_args import route_args +from .security import BearerToken + +__all__ = [ + "BearerToken", + "FernHTTPException", + "IS_PYDANTIC_V2", + "UnauthorizedException", + "UniversalBaseModel", + "UniversalRootModel", + "deep_union_pydantic_dicts", + "default_exception_handler", + "fern_http_exception_handler", + "http_exception_handler", + "parse_obj_as", + "route_args", + "serialize_datetime", + "universal_field_validator", + "universal_root_validator", + "update_forward_refs", +] diff --git a/seed/fastapi/exhaustive/include-validators/core/abstract_fern_service.py b/seed/fastapi/exhaustive/include-validators/core/abstract_fern_service.py new file mode 100644 index 00000000000..da7c8dc49c4 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/core/abstract_fern_service.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import abc + +import fastapi + + +class AbstractFernService(abc.ABC): + @classmethod + def _init_fern(cls, router: fastapi.APIRouter) -> None: + ... diff --git a/seed/fastapi/exhaustive/include-validators/core/datetime_utils.py b/seed/fastapi/exhaustive/include-validators/core/datetime_utils.py new file mode 100644 index 00000000000..7c9864a944c --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/core/datetime_utils.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt + + +def serialize_datetime(v: dt.datetime) -> str: + """ + Serialize a datetime including timezone info. + + Uses the timezone info provided if present, otherwise uses the current runtime's timezone info. + + UTC datetimes end in "Z" while all other timezones are represented as offset from UTC, e.g. +05:00. + """ + + def _serialize_zoned_datetime(v: dt.datetime) -> str: + if v.tzinfo is not None and v.tzinfo.tzname(None) == dt.timezone.utc.tzname(None): + # UTC is a special case where we use "Z" at the end instead of "+00:00" + return v.isoformat().replace("+00:00", "Z") + else: + # Delegate to the typical +/- offset format + return v.isoformat() + + if v.tzinfo is not None: + return _serialize_zoned_datetime(v) + else: + local_tz = dt.datetime.now().astimezone().tzinfo + localized_dt = v.replace(tzinfo=local_tz) + return _serialize_zoned_datetime(localized_dt) diff --git a/seed/fastapi/exhaustive/include-validators/core/exceptions/__init__.py b/seed/fastapi/exhaustive/include-validators/core/exceptions/__init__.py new file mode 100644 index 00000000000..297d6e06f5f --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/core/exceptions/__init__.py @@ -0,0 +1,13 @@ +# This file was auto-generated by Fern from our API Definition. + +from .fern_http_exception import FernHTTPException +from .handlers import default_exception_handler, fern_http_exception_handler, http_exception_handler +from .unauthorized import UnauthorizedException + +__all__ = [ + "FernHTTPException", + "UnauthorizedException", + "default_exception_handler", + "fern_http_exception_handler", + "http_exception_handler", +] diff --git a/seed/fastapi/exhaustive/include-validators/core/exceptions/fern_http_exception.py b/seed/fastapi/exhaustive/include-validators/core/exceptions/fern_http_exception.py new file mode 100644 index 00000000000..bdf03862487 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/core/exceptions/fern_http_exception.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import abc +import typing + +import fastapi + + +class FernHTTPException(abc.ABC, fastapi.HTTPException): + def __init__( + self, status_code: int, name: typing.Optional[str] = None, content: typing.Optional[typing.Any] = None + ): + super().__init__(status_code=status_code) + self.name = name + self.status_code = status_code + self.content = content + + def to_json_response(self) -> fastapi.responses.JSONResponse: + content = fastapi.encoders.jsonable_encoder(self.content, exclude_none=True) + return fastapi.responses.JSONResponse(content=content, status_code=self.status_code) diff --git a/seed/fastapi/exhaustive/include-validators/core/exceptions/handlers.py b/seed/fastapi/exhaustive/include-validators/core/exceptions/handlers.py new file mode 100644 index 00000000000..6d8c4155c5a --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/core/exceptions/handlers.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import logging + +import fastapi +import starlette +import starlette.exceptions + +from .fern_http_exception import FernHTTPException + + +def fern_http_exception_handler( + request: fastapi.requests.Request, exc: FernHTTPException, skip_log: bool = False +) -> fastapi.responses.JSONResponse: + if not skip_log: + logging.getLogger(__name__).error(f"{exc.__class__.__name__} in {request.url.path}", exc_info=exc) + return exc.to_json_response() + + +def http_exception_handler( + request: fastapi.requests.Request, exc: starlette.exceptions.HTTPException, skip_log: bool = False +) -> fastapi.responses.JSONResponse: + if not skip_log: + logging.getLogger(__name__).error(f"{exc.__class__.__name__} in {request.url.path}", exc_info=exc) + return FernHTTPException(status_code=exc.status_code, content=exc.detail).to_json_response() + + +def default_exception_handler( + request: fastapi.requests.Request, exc: Exception, skip_log: bool = False +) -> fastapi.responses.JSONResponse: + if not skip_log: + logging.getLogger(__name__).error(f"{exc.__class__.__name__} in {request.url.path}", exc_info=exc) + return FernHTTPException(status_code=500, content="Internal Server Error").to_json_response() diff --git a/seed/fastapi/exhaustive/include-validators/core/exceptions/unauthorized.py b/seed/fastapi/exhaustive/include-validators/core/exceptions/unauthorized.py new file mode 100644 index 00000000000..32d532e5ef2 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/core/exceptions/unauthorized.py @@ -0,0 +1,15 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .fern_http_exception import FernHTTPException + + +class UnauthorizedException(FernHTTPException): + """ + This is the exception that is thrown by Fern when auth is not present on a + request. + """ + + def __init__(self, content: typing.Optional[str] = None) -> None: + super().__init__(status_code=401, content=content) diff --git a/seed/fastapi/exhaustive/include-validators/core/pydantic_utilities.py b/seed/fastapi/exhaustive/include-validators/core/pydantic_utilities.py new file mode 100644 index 00000000000..7c5418b5cf7 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/core/pydantic_utilities.py @@ -0,0 +1,179 @@ +# This file was auto-generated by Fern from our API Definition. + +# nopycln: file +import datetime as dt +import typing +from collections import defaultdict +from functools import wraps + +import pydantic + +from .datetime_utils import serialize_datetime + +IS_PYDANTIC_V2 = pydantic.VERSION.startswith("2.") + +if IS_PYDANTIC_V2: + # isort will try to reformat the comments on these imports, which breaks mypy + # isort: off + from pydantic.v1.datetime_parse import ( # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2 + parse_date as parse_date, + ) + from pydantic.v1.datetime_parse import ( # pyright: ignore[reportMissingImports] # Pydantic v2 + parse_datetime as parse_datetime, + ) + from pydantic.v1.json import ( # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2 + ENCODERS_BY_TYPE as encoders_by_type, + ) + from pydantic.v1.typing import ( # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2 + get_args as get_args, + ) + from pydantic.v1.typing import get_origin as get_origin # pyright: ignore[reportMissingImports] # Pydantic v2 + from pydantic.v1.typing import ( # pyright: ignore[reportMissingImports] # Pydantic v2 + is_literal_type as is_literal_type, + ) + from pydantic.v1.typing import is_union as is_union # pyright: ignore[reportMissingImports] # Pydantic v2 + from pydantic.v1.fields import ModelField as ModelField # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2 +else: + from pydantic.datetime_parse import parse_date as parse_date # type: ignore # Pydantic v1 + from pydantic.datetime_parse import parse_datetime as parse_datetime # type: ignore # Pydantic v1 + from pydantic.fields import ModelField as ModelField # type: ignore # Pydantic v1 + from pydantic.json import ENCODERS_BY_TYPE as encoders_by_type # type: ignore # Pydantic v1 + from pydantic.typing import get_args as get_args # type: ignore # Pydantic v1 + from pydantic.typing import get_origin as get_origin # type: ignore # Pydantic v1 + from pydantic.typing import is_literal_type as is_literal_type # type: ignore # Pydantic v1 + from pydantic.typing import is_union as is_union # type: ignore # Pydantic v1 + + # isort: on + + +T = typing.TypeVar("T") +Model = typing.TypeVar("Model", bound=pydantic.BaseModel) + + +def deep_union_pydantic_dicts( + source: typing.Dict[str, typing.Any], destination: typing.Dict[str, typing.Any] +) -> typing.Dict[str, typing.Any]: + for key, value in source.items(): + if isinstance(value, dict): + node = destination.setdefault(key, {}) + deep_union_pydantic_dicts(value, node) + else: + destination[key] = value + + return destination + + +def parse_obj_as(type_: typing.Type[T], object_: typing.Any) -> T: + if IS_PYDANTIC_V2: + adapter = pydantic.TypeAdapter(type_) # type: ignore # Pydantic v2 + return adapter.validate_python(object_) + else: + return pydantic.parse_obj_as(type_, object_) + + +def to_jsonable_with_fallback( + obj: typing.Any, fallback_serializer: typing.Callable[[typing.Any], typing.Any] +) -> typing.Any: + if IS_PYDANTIC_V2: + from pydantic_core import to_jsonable_python + + return to_jsonable_python(obj, fallback=fallback_serializer) + else: + return fallback_serializer(obj) + + +class UniversalBaseModel(pydantic.BaseModel): + class Config: + populate_by_name = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + if IS_PYDANTIC_V2: + return super().model_dump_json(**kwargs_with_defaults) # type: ignore # Pydantic v2 + else: + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} + + if IS_PYDANTIC_V2: + return deep_union_pydantic_dicts( + super().model_dump(**kwargs_with_defaults_exclude_unset), # type: ignore # Pydantic v2 + super().model_dump(**kwargs_with_defaults_exclude_none), # type: ignore # Pydantic v2 + ) + else: + return deep_union_pydantic_dicts( + super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) + ) + + +UniversalRootModel: typing.Type[typing.Any] +if IS_PYDANTIC_V2: + + class V2RootModel(UniversalBaseModel, pydantic.RootModel): # type: ignore # Pydantic v2 + pass + + UniversalRootModel = V2RootModel +else: + UniversalRootModel = UniversalBaseModel + + +def encode_by_type(o: typing.Any) -> typing.Any: + encoders_by_class_tuples: typing.Dict[ + typing.Callable[[typing.Any], typing.Any], typing.Tuple[typing.Any, ...] + ] = defaultdict(tuple) + for type_, encoder in encoders_by_type.items(): + encoders_by_class_tuples[encoder] += (type_,) + + if type(o) in encoders_by_type: + return encoders_by_type[type(o)](o) + for encoder, classes_tuple in encoders_by_class_tuples.items(): + if isinstance(o, classes_tuple): + return encoder(o) + + +def update_forward_refs(model: typing.Type["Model"], **localns: typing.Any) -> None: + if IS_PYDANTIC_V2: + model.model_rebuild(force=True, raise_errors=False) # type: ignore # Pydantic v2 + else: + model.update_forward_refs(**localns) + + +# Mirrors Pydantic's internal typing +AnyCallable = typing.Callable[..., typing.Any] + + +def universal_root_validator(pre: bool = False) -> typing.Callable[[AnyCallable], AnyCallable]: + def decorator(func: AnyCallable) -> AnyCallable: + @wraps(func) + def validate(*args: typing.Any, **kwargs: typing.Any) -> AnyCallable: + if IS_PYDANTIC_V2: + wrapped_func = pydantic.model_validator("before" if pre else "after")(func) # type: ignore # Pydantic v2 + else: + wrapped_func = pydantic.root_validator(pre=pre)(func) # type: ignore # Pydantic v1 + + return wrapped_func(*args, **kwargs) + + return validate + + return decorator + + +def universal_field_validator(field_name: str, pre: bool = False) -> typing.Callable[[AnyCallable], AnyCallable]: + def decorator(func: AnyCallable) -> AnyCallable: + @wraps(func) + def validate(*args: typing.Any, **kwargs: typing.Any) -> AnyCallable: + if IS_PYDANTIC_V2: + wrapped_func = pydantic.field_validator(field_name, mode="before" if pre else "after")(func) # type: ignore # Pydantic v2 + else: + wrapped_func = pydantic.validator(field_name, pre=pre)(func) + + return wrapped_func(*args, **kwargs) + + return validate + + return decorator diff --git a/seed/fastapi/exhaustive/include-validators/core/route_args.py b/seed/fastapi/exhaustive/include-validators/core/route_args.py new file mode 100644 index 00000000000..4228e2fe05d --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/core/route_args.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import inspect +import typing + +import typing_extensions + +T = typing.TypeVar("T", bound=typing.Callable[..., typing.Any]) + +FERN_CONFIG_KEY = "__fern" + + +class RouteArgs(typing_extensions.TypedDict): + openapi_extra: typing.Optional[typing.Dict[str, typing.Any]] + tags: typing.Optional[typing.List[typing.Union[str, enum.Enum]]] + include_in_schema: bool + + +DEFAULT_ROUTE_ARGS = RouteArgs(openapi_extra=None, tags=None, include_in_schema=True) + + +def get_route_args(endpoint_function: typing.Callable[..., typing.Any], *, default_tag: str) -> RouteArgs: + unwrapped = inspect.unwrap(endpoint_function, stop=(lambda f: hasattr(f, FERN_CONFIG_KEY))) + route_args = typing.cast(RouteArgs, getattr(unwrapped, FERN_CONFIG_KEY, DEFAULT_ROUTE_ARGS)) + if route_args["tags"] is None: + return RouteArgs( + openapi_extra=route_args["openapi_extra"], + tags=[default_tag], + include_in_schema=route_args["include_in_schema"], + ) + return route_args + + +def route_args( + openapi_extra: typing.Optional[typing.Dict[str, typing.Any]] = None, + tags: typing.Optional[typing.List[typing.Union[str, enum.Enum]]] = None, + include_in_schema: bool = True, +) -> typing.Callable[[T], T]: + """ + this decorator allows you to forward certain args to the FastAPI route decorator. + + usage: + @route_args(openapi_extra=...) + def your_endpoint_method(... + + currently supported args: + - openapi_extra + - tags + + if there's another FastAPI route arg you need to pass through, please + contact the Fern team! + """ + + def decorator(endpoint_function: T) -> T: + setattr( + endpoint_function, + FERN_CONFIG_KEY, + RouteArgs(openapi_extra=openapi_extra, tags=tags, include_in_schema=include_in_schema), + ) + return endpoint_function + + return decorator diff --git a/seed/fastapi/exhaustive/include-validators/core/security/__init__.py b/seed/fastapi/exhaustive/include-validators/core/security/__init__.py new file mode 100644 index 00000000000..e69ee6d9c5a --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/core/security/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .bearer import BearerToken + +__all__ = ["BearerToken"] diff --git a/seed/fastapi/exhaustive/include-validators/core/security/bearer.py b/seed/fastapi/exhaustive/include-validators/core/security/bearer.py new file mode 100644 index 00000000000..023342b668d --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/core/security/bearer.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import fastapi + +from ..exceptions import UnauthorizedException + + +class BearerToken: + def __init__(self, token: str): + self.token = token + + +def HTTPBearer(request: fastapi.requests.Request) -> BearerToken: + authorization_header_value = request.headers.get("Authorization") + if not authorization_header_value: + raise UnauthorizedException("Missing Authorization header") + scheme, _, token = authorization_header_value.partition(" ") + if scheme.lower() != "bearer": + raise UnauthorizedException("Authorization header scheme is not bearer") + if not token: + raise UnauthorizedException("Authorization header is missing a token") + return BearerToken(token) diff --git a/seed/fastapi/exhaustive/include-validators/register.py b/seed/fastapi/exhaustive/include-validators/register.py new file mode 100644 index 00000000000..be0c42bf3f9 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/register.py @@ -0,0 +1,74 @@ +# This file was auto-generated by Fern from our API Definition. + +import glob +import importlib +import os +import types +import typing + +import fastapi +import starlette.exceptions +from fastapi import params + +from .core.abstract_fern_service import AbstractFernService +from .core.exceptions import default_exception_handler, fern_http_exception_handler, http_exception_handler +from .core.exceptions.fern_http_exception import FernHTTPException +from .resources.endpoints.resources.container.service.service import AbstractEndpointsContainerService +from .resources.endpoints.resources.enum.service.service import AbstractEndpointsEnumService +from .resources.endpoints.resources.http_methods.service.service import AbstractEndpointsHttpMethodsService +from .resources.endpoints.resources.object.service.service import AbstractEndpointsObjectService +from .resources.endpoints.resources.params.service.service import AbstractEndpointsParamsService +from .resources.endpoints.resources.primitive.service.service import AbstractEndpointsPrimitiveService +from .resources.endpoints.resources.union.service.service import AbstractEndpointsUnionService +from .resources.inlined_requests.service.service import AbstractInlinedRequestsService +from .resources.no_auth.service.service import AbstractNoAuthService +from .resources.no_req_body.service.service import AbstractNoReqBodyService +from .resources.req_with_headers.service.service import AbstractReqWithHeadersService + + +def register( + _app: fastapi.FastAPI, + *, + endpoints_container: AbstractEndpointsContainerService, + endpoints_enum: AbstractEndpointsEnumService, + endpoints_http_methods: AbstractEndpointsHttpMethodsService, + endpoints_object: AbstractEndpointsObjectService, + endpoints_params: AbstractEndpointsParamsService, + endpoints_primitive: AbstractEndpointsPrimitiveService, + endpoints_union: AbstractEndpointsUnionService, + inlined_requests: AbstractInlinedRequestsService, + no_auth: AbstractNoAuthService, + no_req_body: AbstractNoReqBodyService, + req_with_headers: AbstractReqWithHeadersService, + dependencies: typing.Optional[typing.Sequence[params.Depends]] = None +) -> None: + _app.include_router(__register_service(endpoints_container), dependencies=dependencies) + _app.include_router(__register_service(endpoints_enum), dependencies=dependencies) + _app.include_router(__register_service(endpoints_http_methods), dependencies=dependencies) + _app.include_router(__register_service(endpoints_object), dependencies=dependencies) + _app.include_router(__register_service(endpoints_params), dependencies=dependencies) + _app.include_router(__register_service(endpoints_primitive), dependencies=dependencies) + _app.include_router(__register_service(endpoints_union), dependencies=dependencies) + _app.include_router(__register_service(inlined_requests), dependencies=dependencies) + _app.include_router(__register_service(no_auth), dependencies=dependencies) + _app.include_router(__register_service(no_req_body), dependencies=dependencies) + _app.include_router(__register_service(req_with_headers), dependencies=dependencies) + + _app.add_exception_handler(FernHTTPException, fern_http_exception_handler) # type: ignore + _app.add_exception_handler(starlette.exceptions.HTTPException, http_exception_handler) # type: ignore + _app.add_exception_handler(Exception, default_exception_handler) # type: ignore + + +def __register_service(service: AbstractFernService) -> fastapi.APIRouter: + router = fastapi.APIRouter() + type(service)._init_fern(router) + return router + + +def register_validators(module: types.ModuleType) -> None: + validators_directory: str = os.path.dirname(module.__file__) # type: ignore + for path in glob.glob(os.path.join(validators_directory, "**/*.py"), recursive=True): + if os.path.isfile(path): + relative_path = os.path.relpath(path, start=validators_directory) + module_path = ".".join([module.__name__] + relative_path[:-3].split("/")) + importlib.import_module(module_path) diff --git a/seed/fastapi/exhaustive/include-validators/resources/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/__init__.py new file mode 100644 index 00000000000..29cd2856565 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/__init__.py @@ -0,0 +1,14 @@ +# This file was auto-generated by Fern from our API Definition. + +from . import general_errors, inlined_requests, types +from .general_errors import BadObjectRequestInfo, BadRequestBody +from .inlined_requests import PostWithObjectBody + +__all__ = [ + "BadObjectRequestInfo", + "BadRequestBody", + "PostWithObjectBody", + "general_errors", + "inlined_requests", + "types", +] diff --git a/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/container/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/container/__init__.py new file mode 100644 index 00000000000..f3ea2659bb1 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/container/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/container/service/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/container/service/__init__.py new file mode 100644 index 00000000000..21bb0c47d17 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/container/service/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .service import AbstractEndpointsContainerService + +__all__ = ["AbstractEndpointsContainerService"] diff --git a/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/container/service/service.py b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/container/service/service.py new file mode 100644 index 00000000000..af2cbf4be28 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/container/service/service.py @@ -0,0 +1,356 @@ +# This file was auto-generated by Fern from our API Definition. + +import abc +import functools +import inspect +import logging +import typing + +import fastapi + +from ......core.abstract_fern_service import AbstractFernService +from ......core.exceptions.fern_http_exception import FernHTTPException +from ......core.route_args import get_route_args +from ......security import ApiAuth, FernAuth +from .....types.resources.object.types.object_with_required_field import ObjectWithRequiredField + + +class AbstractEndpointsContainerService(AbstractFernService): + """ + AbstractEndpointsContainerService is an abstract class containing the methods that you should implement. + + Each method is associated with an API route, which will be registered + with FastAPI when you register your implementation using Fern's register() + function. + """ + + @abc.abstractmethod + def get_and_return_list_of_primitives(self, *, body: typing.List[str], auth: ApiAuth) -> typing.Sequence[str]: + ... + + @abc.abstractmethod + def get_and_return_list_of_objects( + self, *, body: typing.List[ObjectWithRequiredField], auth: ApiAuth + ) -> typing.Sequence[ObjectWithRequiredField]: + ... + + @abc.abstractmethod + def get_and_return_set_of_primitives(self, *, body: typing.Set[str], auth: ApiAuth) -> typing.Set[str]: + ... + + @abc.abstractmethod + def get_and_return_set_of_objects( + self, *, body: typing.List[ObjectWithRequiredField], auth: ApiAuth + ) -> typing.Sequence[ObjectWithRequiredField]: + ... + + @abc.abstractmethod + def get_and_return_map_prim_to_prim(self, *, body: typing.Dict[str, str], auth: ApiAuth) -> typing.Dict[str, str]: + ... + + @abc.abstractmethod + def get_and_return_map_of_prim_to_object( + self, *, body: typing.Dict[str, ObjectWithRequiredField], auth: ApiAuth + ) -> typing.Dict[str, ObjectWithRequiredField]: + ... + + @abc.abstractmethod + def get_and_return_optional( + self, *, body: typing.Optional[ObjectWithRequiredField] = None, auth: ApiAuth + ) -> typing.Optional[ObjectWithRequiredField]: + ... + + """ + Below are internal methods used by Fern to register your implementation. + You can ignore them. + """ + + @classmethod + def _init_fern(cls, router: fastapi.APIRouter) -> None: + cls.__init_get_and_return_list_of_primitives(router=router) + cls.__init_get_and_return_list_of_objects(router=router) + cls.__init_get_and_return_set_of_primitives(router=router) + cls.__init_get_and_return_set_of_objects(router=router) + cls.__init_get_and_return_map_prim_to_prim(router=router) + cls.__init_get_and_return_map_of_prim_to_object(router=router) + cls.__init_get_and_return_optional(router=router) + + @classmethod + def __init_get_and_return_list_of_primitives(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_and_return_list_of_primitives) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr( + cls.get_and_return_list_of_primitives, "__signature__", endpoint_function.replace(parameters=new_parameters) + ) + + @functools.wraps(cls.get_and_return_list_of_primitives) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> typing.Sequence[str]: + try: + return cls.get_and_return_list_of_primitives(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_and_return_list_of_primitives' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_and_return_list_of_primitives.__globals__) + + router.post( + path="/container/list-of-primitives", + response_model=typing.Sequence[str], + description=AbstractEndpointsContainerService.get_and_return_list_of_primitives.__doc__, + **get_route_args(cls.get_and_return_list_of_primitives, default_tag="endpoints.container"), + )(wrapper) + + @classmethod + def __init_get_and_return_list_of_objects(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_and_return_list_of_objects) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr( + cls.get_and_return_list_of_objects, "__signature__", endpoint_function.replace(parameters=new_parameters) + ) + + @functools.wraps(cls.get_and_return_list_of_objects) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> typing.Sequence[ObjectWithRequiredField]: + try: + return cls.get_and_return_list_of_objects(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_and_return_list_of_objects' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_and_return_list_of_objects.__globals__) + + router.post( + path="/container/list-of-objects", + response_model=typing.Sequence[ObjectWithRequiredField], + description=AbstractEndpointsContainerService.get_and_return_list_of_objects.__doc__, + **get_route_args(cls.get_and_return_list_of_objects, default_tag="endpoints.container"), + )(wrapper) + + @classmethod + def __init_get_and_return_set_of_primitives(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_and_return_set_of_primitives) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr( + cls.get_and_return_set_of_primitives, "__signature__", endpoint_function.replace(parameters=new_parameters) + ) + + @functools.wraps(cls.get_and_return_set_of_primitives) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> typing.Set[str]: + try: + return cls.get_and_return_set_of_primitives(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_and_return_set_of_primitives' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_and_return_set_of_primitives.__globals__) + + router.post( + path="/container/set-of-primitives", + response_model=typing.Set[str], + description=AbstractEndpointsContainerService.get_and_return_set_of_primitives.__doc__, + **get_route_args(cls.get_and_return_set_of_primitives, default_tag="endpoints.container"), + )(wrapper) + + @classmethod + def __init_get_and_return_set_of_objects(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_and_return_set_of_objects) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr( + cls.get_and_return_set_of_objects, "__signature__", endpoint_function.replace(parameters=new_parameters) + ) + + @functools.wraps(cls.get_and_return_set_of_objects) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> typing.Sequence[ObjectWithRequiredField]: + try: + return cls.get_and_return_set_of_objects(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_and_return_set_of_objects' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_and_return_set_of_objects.__globals__) + + router.post( + path="/container/set-of-objects", + response_model=typing.Sequence[ObjectWithRequiredField], + description=AbstractEndpointsContainerService.get_and_return_set_of_objects.__doc__, + **get_route_args(cls.get_and_return_set_of_objects, default_tag="endpoints.container"), + )(wrapper) + + @classmethod + def __init_get_and_return_map_prim_to_prim(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_and_return_map_prim_to_prim) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr( + cls.get_and_return_map_prim_to_prim, "__signature__", endpoint_function.replace(parameters=new_parameters) + ) + + @functools.wraps(cls.get_and_return_map_prim_to_prim) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> typing.Dict[str, str]: + try: + return cls.get_and_return_map_prim_to_prim(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_and_return_map_prim_to_prim' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_and_return_map_prim_to_prim.__globals__) + + router.post( + path="/container/map-prim-to-prim", + response_model=typing.Dict[str, str], + description=AbstractEndpointsContainerService.get_and_return_map_prim_to_prim.__doc__, + **get_route_args(cls.get_and_return_map_prim_to_prim, default_tag="endpoints.container"), + )(wrapper) + + @classmethod + def __init_get_and_return_map_of_prim_to_object(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_and_return_map_of_prim_to_object) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr( + cls.get_and_return_map_of_prim_to_object, + "__signature__", + endpoint_function.replace(parameters=new_parameters), + ) + + @functools.wraps(cls.get_and_return_map_of_prim_to_object) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> typing.Dict[str, ObjectWithRequiredField]: + try: + return cls.get_and_return_map_of_prim_to_object(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_and_return_map_of_prim_to_object' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_and_return_map_of_prim_to_object.__globals__) + + router.post( + path="/container/map-prim-to-object", + response_model=typing.Dict[str, ObjectWithRequiredField], + description=AbstractEndpointsContainerService.get_and_return_map_of_prim_to_object.__doc__, + **get_route_args(cls.get_and_return_map_of_prim_to_object, default_tag="endpoints.container"), + )(wrapper) + + @classmethod + def __init_get_and_return_optional(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_and_return_optional) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr(cls.get_and_return_optional, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.get_and_return_optional) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> typing.Optional[ObjectWithRequiredField]: + try: + return cls.get_and_return_optional(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_and_return_optional' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_and_return_optional.__globals__) + + router.post( + path="/container/opt-objects", + response_model=typing.Optional[ObjectWithRequiredField], + description=AbstractEndpointsContainerService.get_and_return_optional.__doc__, + **get_route_args(cls.get_and_return_optional, default_tag="endpoints.container"), + )(wrapper) diff --git a/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/enum/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/enum/__init__.py new file mode 100644 index 00000000000..f3ea2659bb1 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/enum/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/enum/service/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/enum/service/__init__.py new file mode 100644 index 00000000000..6415e959895 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/enum/service/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .service import AbstractEndpointsEnumService + +__all__ = ["AbstractEndpointsEnumService"] diff --git a/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/enum/service/service.py b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/enum/service/service.py new file mode 100644 index 00000000000..a279991058b --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/enum/service/service.py @@ -0,0 +1,76 @@ +# This file was auto-generated by Fern from our API Definition. + +import abc +import functools +import inspect +import logging +import typing + +import fastapi + +from ......core.abstract_fern_service import AbstractFernService +from ......core.exceptions.fern_http_exception import FernHTTPException +from ......core.route_args import get_route_args +from ......security import ApiAuth, FernAuth +from .....types.resources.enum.types.weather_report import WeatherReport + + +class AbstractEndpointsEnumService(AbstractFernService): + """ + AbstractEndpointsEnumService is an abstract class containing the methods that you should implement. + + Each method is associated with an API route, which will be registered + with FastAPI when you register your implementation using Fern's register() + function. + """ + + @abc.abstractmethod + def get_and_return_enum(self, *, body: WeatherReport, auth: ApiAuth) -> WeatherReport: + ... + + """ + Below are internal methods used by Fern to register your implementation. + You can ignore them. + """ + + @classmethod + def _init_fern(cls, router: fastapi.APIRouter) -> None: + cls.__init_get_and_return_enum(router=router) + + @classmethod + def __init_get_and_return_enum(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_and_return_enum) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr(cls.get_and_return_enum, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.get_and_return_enum) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> WeatherReport: + try: + return cls.get_and_return_enum(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_and_return_enum' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_and_return_enum.__globals__) + + router.post( + path="/enum", + response_model=WeatherReport, + description=AbstractEndpointsEnumService.get_and_return_enum.__doc__, + **get_route_args(cls.get_and_return_enum, default_tag="endpoints.enum"), + )(wrapper) diff --git a/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/http_methods/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/http_methods/__init__.py new file mode 100644 index 00000000000..f3ea2659bb1 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/http_methods/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/http_methods/service/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/http_methods/service/__init__.py new file mode 100644 index 00000000000..22ea254d225 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/http_methods/service/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .service import AbstractEndpointsHttpMethodsService + +__all__ = ["AbstractEndpointsHttpMethodsService"] diff --git a/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/http_methods/service/service.py b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/http_methods/service/service.py new file mode 100644 index 00000000000..4ec18085f84 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/http_methods/service/service.py @@ -0,0 +1,253 @@ +# This file was auto-generated by Fern from our API Definition. + +import abc +import functools +import inspect +import logging +import typing + +import fastapi + +from ......core.abstract_fern_service import AbstractFernService +from ......core.exceptions.fern_http_exception import FernHTTPException +from ......core.route_args import get_route_args +from ......security import ApiAuth, FernAuth +from .....types.resources.object.types.object_with_optional_field import ObjectWithOptionalField +from .....types.resources.object.types.object_with_required_field import ObjectWithRequiredField + + +class AbstractEndpointsHttpMethodsService(AbstractFernService): + """ + AbstractEndpointsHttpMethodsService is an abstract class containing the methods that you should implement. + + Each method is associated with an API route, which will be registered + with FastAPI when you register your implementation using Fern's register() + function. + """ + + @abc.abstractmethod + def test_get(self, *, id: str, auth: ApiAuth) -> str: + ... + + @abc.abstractmethod + def test_post(self, *, body: ObjectWithRequiredField, auth: ApiAuth) -> ObjectWithOptionalField: + ... + + @abc.abstractmethod + def test_put(self, *, body: ObjectWithRequiredField, id: str, auth: ApiAuth) -> ObjectWithOptionalField: + ... + + @abc.abstractmethod + def test_patch(self, *, body: ObjectWithOptionalField, id: str, auth: ApiAuth) -> ObjectWithOptionalField: + ... + + @abc.abstractmethod + def test_delete(self, *, id: str, auth: ApiAuth) -> bool: + ... + + """ + Below are internal methods used by Fern to register your implementation. + You can ignore them. + """ + + @classmethod + def _init_fern(cls, router: fastapi.APIRouter) -> None: + cls.__init_test_get(router=router) + cls.__init_test_post(router=router) + cls.__init_test_put(router=router) + cls.__init_test_patch(router=router) + cls.__init_test_delete(router=router) + + @classmethod + def __init_test_get(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.test_get) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "id": + new_parameters.append(parameter.replace(default=fastapi.Path(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr(cls.test_get, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.test_get) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> str: + try: + return cls.test_get(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'test_get' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.test_get.__globals__) + + router.get( + path="/http-methods/{id}", + response_model=str, + description=AbstractEndpointsHttpMethodsService.test_get.__doc__, + **get_route_args(cls.test_get, default_tag="endpoints.http_methods"), + )(wrapper) + + @classmethod + def __init_test_post(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.test_post) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr(cls.test_post, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.test_post) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> ObjectWithOptionalField: + try: + return cls.test_post(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'test_post' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.test_post.__globals__) + + router.post( + path="/http-methods", + response_model=ObjectWithOptionalField, + description=AbstractEndpointsHttpMethodsService.test_post.__doc__, + **get_route_args(cls.test_post, default_tag="endpoints.http_methods"), + )(wrapper) + + @classmethod + def __init_test_put(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.test_put) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "id": + new_parameters.append(parameter.replace(default=fastapi.Path(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr(cls.test_put, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.test_put) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> ObjectWithOptionalField: + try: + return cls.test_put(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'test_put' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.test_put.__globals__) + + router.put( + path="/http-methods/{id}", + response_model=ObjectWithOptionalField, + description=AbstractEndpointsHttpMethodsService.test_put.__doc__, + **get_route_args(cls.test_put, default_tag="endpoints.http_methods"), + )(wrapper) + + @classmethod + def __init_test_patch(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.test_patch) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "id": + new_parameters.append(parameter.replace(default=fastapi.Path(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr(cls.test_patch, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.test_patch) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> ObjectWithOptionalField: + try: + return cls.test_patch(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'test_patch' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.test_patch.__globals__) + + router.patch( + path="/http-methods/{id}", + response_model=ObjectWithOptionalField, + description=AbstractEndpointsHttpMethodsService.test_patch.__doc__, + **get_route_args(cls.test_patch, default_tag="endpoints.http_methods"), + )(wrapper) + + @classmethod + def __init_test_delete(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.test_delete) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "id": + new_parameters.append(parameter.replace(default=fastapi.Path(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr(cls.test_delete, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.test_delete) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> bool: + try: + return cls.test_delete(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'test_delete' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.test_delete.__globals__) + + router.delete( + path="/http-methods/{id}", + response_model=bool, + description=AbstractEndpointsHttpMethodsService.test_delete.__doc__, + **get_route_args(cls.test_delete, default_tag="endpoints.http_methods"), + )(wrapper) diff --git a/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/object/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/object/__init__.py new file mode 100644 index 00000000000..f3ea2659bb1 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/object/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/object/service/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/object/service/__init__.py new file mode 100644 index 00000000000..9b7c53dfae2 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/object/service/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .service import AbstractEndpointsObjectService + +__all__ = ["AbstractEndpointsObjectService"] diff --git a/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/object/service/service.py b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/object/service/service.py new file mode 100644 index 00000000000..b3f2bc65b51 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/object/service/service.py @@ -0,0 +1,329 @@ +# This file was auto-generated by Fern from our API Definition. + +import abc +import functools +import inspect +import logging +import typing + +import fastapi + +from ......core.abstract_fern_service import AbstractFernService +from ......core.exceptions.fern_http_exception import FernHTTPException +from ......core.route_args import get_route_args +from ......security import ApiAuth, FernAuth +from .....types.resources.object.types.nested_object_with_optional_field import NestedObjectWithOptionalField +from .....types.resources.object.types.nested_object_with_required_field import NestedObjectWithRequiredField +from .....types.resources.object.types.object_with_map_of_map import ObjectWithMapOfMap +from .....types.resources.object.types.object_with_optional_field import ObjectWithOptionalField +from .....types.resources.object.types.object_with_required_field import ObjectWithRequiredField + + +class AbstractEndpointsObjectService(AbstractFernService): + """ + AbstractEndpointsObjectService is an abstract class containing the methods that you should implement. + + Each method is associated with an API route, which will be registered + with FastAPI when you register your implementation using Fern's register() + function. + """ + + @abc.abstractmethod + def get_and_return_with_optional_field( + self, *, body: ObjectWithOptionalField, auth: ApiAuth + ) -> ObjectWithOptionalField: + ... + + @abc.abstractmethod + def get_and_return_with_required_field( + self, *, body: ObjectWithRequiredField, auth: ApiAuth + ) -> ObjectWithRequiredField: + ... + + @abc.abstractmethod + def get_and_return_with_map_of_map(self, *, body: ObjectWithMapOfMap, auth: ApiAuth) -> ObjectWithMapOfMap: + ... + + @abc.abstractmethod + def get_and_return_nested_with_optional_field( + self, *, body: NestedObjectWithOptionalField, auth: ApiAuth + ) -> NestedObjectWithOptionalField: + ... + + @abc.abstractmethod + def get_and_return_nested_with_required_field( + self, *, body: NestedObjectWithRequiredField, string: str, auth: ApiAuth + ) -> NestedObjectWithRequiredField: + ... + + @abc.abstractmethod + def get_and_return_nested_with_required_field_as_list( + self, *, body: typing.List[NestedObjectWithRequiredField], auth: ApiAuth + ) -> NestedObjectWithRequiredField: + ... + + """ + Below are internal methods used by Fern to register your implementation. + You can ignore them. + """ + + @classmethod + def _init_fern(cls, router: fastapi.APIRouter) -> None: + cls.__init_get_and_return_with_optional_field(router=router) + cls.__init_get_and_return_with_required_field(router=router) + cls.__init_get_and_return_with_map_of_map(router=router) + cls.__init_get_and_return_nested_with_optional_field(router=router) + cls.__init_get_and_return_nested_with_required_field(router=router) + cls.__init_get_and_return_nested_with_required_field_as_list(router=router) + + @classmethod + def __init_get_and_return_with_optional_field(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_and_return_with_optional_field) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr( + cls.get_and_return_with_optional_field, + "__signature__", + endpoint_function.replace(parameters=new_parameters), + ) + + @functools.wraps(cls.get_and_return_with_optional_field) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> ObjectWithOptionalField: + try: + return cls.get_and_return_with_optional_field(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_and_return_with_optional_field' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_and_return_with_optional_field.__globals__) + + router.post( + path="/object/get-and-return-with-optional-field", + response_model=ObjectWithOptionalField, + description=AbstractEndpointsObjectService.get_and_return_with_optional_field.__doc__, + **get_route_args(cls.get_and_return_with_optional_field, default_tag="endpoints.object"), + )(wrapper) + + @classmethod + def __init_get_and_return_with_required_field(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_and_return_with_required_field) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr( + cls.get_and_return_with_required_field, + "__signature__", + endpoint_function.replace(parameters=new_parameters), + ) + + @functools.wraps(cls.get_and_return_with_required_field) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> ObjectWithRequiredField: + try: + return cls.get_and_return_with_required_field(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_and_return_with_required_field' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_and_return_with_required_field.__globals__) + + router.post( + path="/object/get-and-return-with-required-field", + response_model=ObjectWithRequiredField, + description=AbstractEndpointsObjectService.get_and_return_with_required_field.__doc__, + **get_route_args(cls.get_and_return_with_required_field, default_tag="endpoints.object"), + )(wrapper) + + @classmethod + def __init_get_and_return_with_map_of_map(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_and_return_with_map_of_map) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr( + cls.get_and_return_with_map_of_map, "__signature__", endpoint_function.replace(parameters=new_parameters) + ) + + @functools.wraps(cls.get_and_return_with_map_of_map) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> ObjectWithMapOfMap: + try: + return cls.get_and_return_with_map_of_map(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_and_return_with_map_of_map' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_and_return_with_map_of_map.__globals__) + + router.post( + path="/object/get-and-return-with-map-of-map", + response_model=ObjectWithMapOfMap, + description=AbstractEndpointsObjectService.get_and_return_with_map_of_map.__doc__, + **get_route_args(cls.get_and_return_with_map_of_map, default_tag="endpoints.object"), + )(wrapper) + + @classmethod + def __init_get_and_return_nested_with_optional_field(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_and_return_nested_with_optional_field) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr( + cls.get_and_return_nested_with_optional_field, + "__signature__", + endpoint_function.replace(parameters=new_parameters), + ) + + @functools.wraps(cls.get_and_return_nested_with_optional_field) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> NestedObjectWithOptionalField: + try: + return cls.get_and_return_nested_with_optional_field(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_and_return_nested_with_optional_field' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_and_return_nested_with_optional_field.__globals__) + + router.post( + path="/object/get-and-return-nested-with-optional-field", + response_model=NestedObjectWithOptionalField, + description=AbstractEndpointsObjectService.get_and_return_nested_with_optional_field.__doc__, + **get_route_args(cls.get_and_return_nested_with_optional_field, default_tag="endpoints.object"), + )(wrapper) + + @classmethod + def __init_get_and_return_nested_with_required_field(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_and_return_nested_with_required_field) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "string": + new_parameters.append(parameter.replace(default=fastapi.Path(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr( + cls.get_and_return_nested_with_required_field, + "__signature__", + endpoint_function.replace(parameters=new_parameters), + ) + + @functools.wraps(cls.get_and_return_nested_with_required_field) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> NestedObjectWithRequiredField: + try: + return cls.get_and_return_nested_with_required_field(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_and_return_nested_with_required_field' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_and_return_nested_with_required_field.__globals__) + + router.post( + path="/object/get-and-return-nested-with-required-field/{string}", + response_model=NestedObjectWithRequiredField, + description=AbstractEndpointsObjectService.get_and_return_nested_with_required_field.__doc__, + **get_route_args(cls.get_and_return_nested_with_required_field, default_tag="endpoints.object"), + )(wrapper) + + @classmethod + def __init_get_and_return_nested_with_required_field_as_list(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_and_return_nested_with_required_field_as_list) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr( + cls.get_and_return_nested_with_required_field_as_list, + "__signature__", + endpoint_function.replace(parameters=new_parameters), + ) + + @functools.wraps(cls.get_and_return_nested_with_required_field_as_list) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> NestedObjectWithRequiredField: + try: + return cls.get_and_return_nested_with_required_field_as_list(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_and_return_nested_with_required_field_as_list' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_and_return_nested_with_required_field_as_list.__globals__) + + router.post( + path="/object/get-and-return-nested-with-required-field-list", + response_model=NestedObjectWithRequiredField, + description=AbstractEndpointsObjectService.get_and_return_nested_with_required_field_as_list.__doc__, + **get_route_args(cls.get_and_return_nested_with_required_field_as_list, default_tag="endpoints.object"), + )(wrapper) diff --git a/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/params/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/params/__init__.py new file mode 100644 index 00000000000..f3ea2659bb1 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/params/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/params/service/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/params/service/__init__.py new file mode 100644 index 00000000000..f7278fe82be --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/params/service/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .service import AbstractEndpointsParamsService + +__all__ = ["AbstractEndpointsParamsService"] diff --git a/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/params/service/service.py b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/params/service/service.py new file mode 100644 index 00000000000..a7ae7b277b2 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/params/service/service.py @@ -0,0 +1,276 @@ +# This file was auto-generated by Fern from our API Definition. + +import abc +import functools +import inspect +import logging +import typing + +import fastapi +import starlette + +from ......core.abstract_fern_service import AbstractFernService +from ......core.exceptions.fern_http_exception import FernHTTPException +from ......core.route_args import get_route_args +from ......security import ApiAuth, FernAuth + + +class AbstractEndpointsParamsService(AbstractFernService): + """ + AbstractEndpointsParamsService is an abstract class containing the methods that you should implement. + + Each method is associated with an API route, which will be registered + with FastAPI when you register your implementation using Fern's register() + function. + """ + + @abc.abstractmethod + def get_with_path(self, *, param: str, auth: ApiAuth) -> str: + """ + GET with path param + """ + ... + + @abc.abstractmethod + def get_with_query(self, *, query: str, number: int, auth: ApiAuth) -> None: + """ + GET with query param + """ + ... + + @abc.abstractmethod + def get_with_allow_multiple_query(self, *, query: typing.List[str], numer: typing.List[int], auth: ApiAuth) -> None: + """ + GET with multiple of same query param + """ + ... + + @abc.abstractmethod + def get_with_path_and_query(self, *, param: str, query: str, auth: ApiAuth) -> None: + """ + GET with path and query params + """ + ... + + @abc.abstractmethod + def modify_with_path(self, *, body: str, param: str, auth: ApiAuth) -> str: + """ + PUT to update with path param + """ + ... + + """ + Below are internal methods used by Fern to register your implementation. + You can ignore them. + """ + + @classmethod + def _init_fern(cls, router: fastapi.APIRouter) -> None: + cls.__init_get_with_path(router=router) + cls.__init_get_with_query(router=router) + cls.__init_get_with_allow_multiple_query(router=router) + cls.__init_get_with_path_and_query(router=router) + cls.__init_modify_with_path(router=router) + + @classmethod + def __init_get_with_path(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_with_path) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "param": + new_parameters.append(parameter.replace(default=fastapi.Path(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr(cls.get_with_path, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.get_with_path) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> str: + try: + return cls.get_with_path(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_with_path' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_with_path.__globals__) + + router.get( + path="/params/path/{param}", + response_model=str, + description=AbstractEndpointsParamsService.get_with_path.__doc__, + **get_route_args(cls.get_with_path, default_tag="endpoints.params"), + )(wrapper) + + @classmethod + def __init_get_with_query(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_with_query) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "query": + new_parameters.append(parameter.replace(default=fastapi.Query(default=...))) + elif parameter_name == "number": + new_parameters.append(parameter.replace(default=fastapi.Query(default=...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr(cls.get_with_query, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.get_with_query) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> None: + try: + return cls.get_with_query(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_with_query' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_with_query.__globals__) + + router.get( + path="/params", + response_model=None, + status_code=starlette.status.HTTP_204_NO_CONTENT, + description=AbstractEndpointsParamsService.get_with_query.__doc__, + **get_route_args(cls.get_with_query, default_tag="endpoints.params"), + )(wrapper) + + @classmethod + def __init_get_with_allow_multiple_query(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_with_allow_multiple_query) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "query": + new_parameters.append(parameter.replace(default=fastapi.Query(default=[]))) + elif parameter_name == "numer": + new_parameters.append(parameter.replace(default=fastapi.Query(default=[]))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr( + cls.get_with_allow_multiple_query, "__signature__", endpoint_function.replace(parameters=new_parameters) + ) + + @functools.wraps(cls.get_with_allow_multiple_query) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> None: + try: + return cls.get_with_allow_multiple_query(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_with_allow_multiple_query' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_with_allow_multiple_query.__globals__) + + router.get( + path="/params", + response_model=None, + status_code=starlette.status.HTTP_204_NO_CONTENT, + description=AbstractEndpointsParamsService.get_with_allow_multiple_query.__doc__, + **get_route_args(cls.get_with_allow_multiple_query, default_tag="endpoints.params"), + )(wrapper) + + @classmethod + def __init_get_with_path_and_query(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_with_path_and_query) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "param": + new_parameters.append(parameter.replace(default=fastapi.Path(...))) + elif parameter_name == "query": + new_parameters.append(parameter.replace(default=fastapi.Query(default=...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr(cls.get_with_path_and_query, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.get_with_path_and_query) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> None: + try: + return cls.get_with_path_and_query(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_with_path_and_query' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_with_path_and_query.__globals__) + + router.get( + path="/params/path-query/{param}", + response_model=None, + status_code=starlette.status.HTTP_204_NO_CONTENT, + description=AbstractEndpointsParamsService.get_with_path_and_query.__doc__, + **get_route_args(cls.get_with_path_and_query, default_tag="endpoints.params"), + )(wrapper) + + @classmethod + def __init_modify_with_path(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.modify_with_path) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "param": + new_parameters.append(parameter.replace(default=fastapi.Path(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr(cls.modify_with_path, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.modify_with_path) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> str: + try: + return cls.modify_with_path(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'modify_with_path' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.modify_with_path.__globals__) + + router.put( + path="/params/path/{param}", + response_model=str, + description=AbstractEndpointsParamsService.modify_with_path.__doc__, + **get_route_args(cls.modify_with_path, default_tag="endpoints.params"), + )(wrapper) diff --git a/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/primitive/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/primitive/__init__.py new file mode 100644 index 00000000000..f3ea2659bb1 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/primitive/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/primitive/service/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/primitive/service/__init__.py new file mode 100644 index 00000000000..cbdabe15630 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/primitive/service/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .service import AbstractEndpointsPrimitiveService + +__all__ = ["AbstractEndpointsPrimitiveService"] diff --git a/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/primitive/service/service.py b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/primitive/service/service.py new file mode 100644 index 00000000000..db7ef44676c --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/primitive/service/service.py @@ -0,0 +1,421 @@ +# This file was auto-generated by Fern from our API Definition. + +import abc +import datetime as dt +import functools +import inspect +import logging +import typing +import uuid + +import fastapi + +from ......core.abstract_fern_service import AbstractFernService +from ......core.exceptions.fern_http_exception import FernHTTPException +from ......core.route_args import get_route_args +from ......security import ApiAuth, FernAuth + + +class AbstractEndpointsPrimitiveService(AbstractFernService): + """ + AbstractEndpointsPrimitiveService is an abstract class containing the methods that you should implement. + + Each method is associated with an API route, which will be registered + with FastAPI when you register your implementation using Fern's register() + function. + """ + + @abc.abstractmethod + def get_and_return_string(self, *, body: str, auth: ApiAuth) -> str: + ... + + @abc.abstractmethod + def get_and_return_int(self, *, body: int, auth: ApiAuth) -> int: + ... + + @abc.abstractmethod + def get_and_return_long(self, *, body: int, auth: ApiAuth) -> int: + ... + + @abc.abstractmethod + def get_and_return_double(self, *, body: float, auth: ApiAuth) -> float: + ... + + @abc.abstractmethod + def get_and_return_bool(self, *, body: bool, auth: ApiAuth) -> bool: + ... + + @abc.abstractmethod + def get_and_return_datetime(self, *, body: dt.datetime, auth: ApiAuth) -> dt.datetime: + ... + + @abc.abstractmethod + def get_and_return_date(self, *, body: dt.date, auth: ApiAuth) -> dt.date: + ... + + @abc.abstractmethod + def get_and_return_uuid(self, *, body: uuid.UUID, auth: ApiAuth) -> uuid.UUID: + ... + + @abc.abstractmethod + def get_and_return_base_64(self, *, body: str, auth: ApiAuth) -> str: + ... + + """ + Below are internal methods used by Fern to register your implementation. + You can ignore them. + """ + + @classmethod + def _init_fern(cls, router: fastapi.APIRouter) -> None: + cls.__init_get_and_return_string(router=router) + cls.__init_get_and_return_int(router=router) + cls.__init_get_and_return_long(router=router) + cls.__init_get_and_return_double(router=router) + cls.__init_get_and_return_bool(router=router) + cls.__init_get_and_return_datetime(router=router) + cls.__init_get_and_return_date(router=router) + cls.__init_get_and_return_uuid(router=router) + cls.__init_get_and_return_base_64(router=router) + + @classmethod + def __init_get_and_return_string(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_and_return_string) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr(cls.get_and_return_string, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.get_and_return_string) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> str: + try: + return cls.get_and_return_string(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_and_return_string' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_and_return_string.__globals__) + + router.post( + path="/primitive/string", + response_model=str, + description=AbstractEndpointsPrimitiveService.get_and_return_string.__doc__, + **get_route_args(cls.get_and_return_string, default_tag="endpoints.primitive"), + )(wrapper) + + @classmethod + def __init_get_and_return_int(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_and_return_int) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr(cls.get_and_return_int, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.get_and_return_int) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> int: + try: + return cls.get_and_return_int(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_and_return_int' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_and_return_int.__globals__) + + router.post( + path="/primitive/integer", + response_model=int, + description=AbstractEndpointsPrimitiveService.get_and_return_int.__doc__, + **get_route_args(cls.get_and_return_int, default_tag="endpoints.primitive"), + )(wrapper) + + @classmethod + def __init_get_and_return_long(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_and_return_long) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr(cls.get_and_return_long, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.get_and_return_long) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> int: + try: + return cls.get_and_return_long(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_and_return_long' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_and_return_long.__globals__) + + router.post( + path="/primitive/long", + response_model=int, + description=AbstractEndpointsPrimitiveService.get_and_return_long.__doc__, + **get_route_args(cls.get_and_return_long, default_tag="endpoints.primitive"), + )(wrapper) + + @classmethod + def __init_get_and_return_double(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_and_return_double) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr(cls.get_and_return_double, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.get_and_return_double) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> float: + try: + return cls.get_and_return_double(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_and_return_double' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_and_return_double.__globals__) + + router.post( + path="/primitive/double", + response_model=float, + description=AbstractEndpointsPrimitiveService.get_and_return_double.__doc__, + **get_route_args(cls.get_and_return_double, default_tag="endpoints.primitive"), + )(wrapper) + + @classmethod + def __init_get_and_return_bool(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_and_return_bool) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr(cls.get_and_return_bool, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.get_and_return_bool) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> bool: + try: + return cls.get_and_return_bool(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_and_return_bool' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_and_return_bool.__globals__) + + router.post( + path="/primitive/boolean", + response_model=bool, + description=AbstractEndpointsPrimitiveService.get_and_return_bool.__doc__, + **get_route_args(cls.get_and_return_bool, default_tag="endpoints.primitive"), + )(wrapper) + + @classmethod + def __init_get_and_return_datetime(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_and_return_datetime) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr(cls.get_and_return_datetime, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.get_and_return_datetime) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> dt.datetime: + try: + return cls.get_and_return_datetime(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_and_return_datetime' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_and_return_datetime.__globals__) + + router.post( + path="/primitive/datetime", + response_model=dt.datetime, + description=AbstractEndpointsPrimitiveService.get_and_return_datetime.__doc__, + **get_route_args(cls.get_and_return_datetime, default_tag="endpoints.primitive"), + )(wrapper) + + @classmethod + def __init_get_and_return_date(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_and_return_date) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr(cls.get_and_return_date, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.get_and_return_date) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> dt.date: + try: + return cls.get_and_return_date(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_and_return_date' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_and_return_date.__globals__) + + router.post( + path="/primitive/date", + response_model=dt.date, + description=AbstractEndpointsPrimitiveService.get_and_return_date.__doc__, + **get_route_args(cls.get_and_return_date, default_tag="endpoints.primitive"), + )(wrapper) + + @classmethod + def __init_get_and_return_uuid(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_and_return_uuid) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr(cls.get_and_return_uuid, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.get_and_return_uuid) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> uuid.UUID: + try: + return cls.get_and_return_uuid(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_and_return_uuid' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_and_return_uuid.__globals__) + + router.post( + path="/primitive/uuid", + response_model=uuid.UUID, + description=AbstractEndpointsPrimitiveService.get_and_return_uuid.__doc__, + **get_route_args(cls.get_and_return_uuid, default_tag="endpoints.primitive"), + )(wrapper) + + @classmethod + def __init_get_and_return_base_64(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_and_return_base_64) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr(cls.get_and_return_base_64, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.get_and_return_base_64) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> str: + try: + return cls.get_and_return_base_64(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_and_return_base_64' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_and_return_base_64.__globals__) + + router.post( + path="/primitive/base64", + response_model=str, + description=AbstractEndpointsPrimitiveService.get_and_return_base_64.__doc__, + **get_route_args(cls.get_and_return_base_64, default_tag="endpoints.primitive"), + )(wrapper) diff --git a/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/union/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/union/__init__.py new file mode 100644 index 00000000000..f3ea2659bb1 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/union/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/union/service/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/union/service/__init__.py new file mode 100644 index 00000000000..37bb942b185 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/union/service/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .service import AbstractEndpointsUnionService + +__all__ = ["AbstractEndpointsUnionService"] diff --git a/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/union/service/service.py b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/union/service/service.py new file mode 100644 index 00000000000..5c026188aca --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/endpoints/resources/union/service/service.py @@ -0,0 +1,76 @@ +# This file was auto-generated by Fern from our API Definition. + +import abc +import functools +import inspect +import logging +import typing + +import fastapi + +from ......core.abstract_fern_service import AbstractFernService +from ......core.exceptions.fern_http_exception import FernHTTPException +from ......core.route_args import get_route_args +from ......security import ApiAuth, FernAuth +from .....types.resources.union.types.animal import Animal + + +class AbstractEndpointsUnionService(AbstractFernService): + """ + AbstractEndpointsUnionService is an abstract class containing the methods that you should implement. + + Each method is associated with an API route, which will be registered + with FastAPI when you register your implementation using Fern's register() + function. + """ + + @abc.abstractmethod + def get_and_return_union(self, *, body: Animal, auth: ApiAuth) -> Animal: + ... + + """ + Below are internal methods used by Fern to register your implementation. + You can ignore them. + """ + + @classmethod + def _init_fern(cls, router: fastapi.APIRouter) -> None: + cls.__init_get_and_return_union(router=router) + + @classmethod + def __init_get_and_return_union(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_and_return_union) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr(cls.get_and_return_union, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.get_and_return_union) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> Animal: + try: + return cls.get_and_return_union(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_and_return_union' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_and_return_union.__globals__) + + router.post( + path="/union", + response_model=Animal, + description=AbstractEndpointsUnionService.get_and_return_union.__doc__, + **get_route_args(cls.get_and_return_union, default_tag="endpoints.union"), + )(wrapper) diff --git a/seed/fastapi/exhaustive/include-validators/resources/general_errors/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/general_errors/__init__.py new file mode 100644 index 00000000000..115c26555f3 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/general_errors/__init__.py @@ -0,0 +1,6 @@ +# This file was auto-generated by Fern from our API Definition. + +from .errors import BadRequestBody +from .types import BadObjectRequestInfo + +__all__ = ["BadObjectRequestInfo", "BadRequestBody"] diff --git a/seed/fastapi/exhaustive/include-validators/resources/general_errors/errors/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/general_errors/errors/__init__.py new file mode 100644 index 00000000000..04eaf8e383b --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/general_errors/errors/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .bad_request_body import BadRequestBody + +__all__ = ["BadRequestBody"] diff --git a/seed/fastapi/exhaustive/include-validators/resources/general_errors/errors/bad_request_body.py b/seed/fastapi/exhaustive/include-validators/resources/general_errors/errors/bad_request_body.py new file mode 100644 index 00000000000..9c75b4bcf0c --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/general_errors/errors/bad_request_body.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +from ....core.exceptions.fern_http_exception import FernHTTPException +from ..types.bad_object_request_info import BadObjectRequestInfo + + +class BadRequestBody(FernHTTPException): + def __init__(self, error: BadObjectRequestInfo): + super().__init__(status_code=400, name="BadRequestBody", content=error) diff --git a/seed/fastapi/exhaustive/include-validators/resources/general_errors/types/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/general_errors/types/__init__.py new file mode 100644 index 00000000000..b6788a57056 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/general_errors/types/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .bad_object_request_info import BadObjectRequestInfo + +__all__ = ["BadObjectRequestInfo"] diff --git a/seed/fastapi/exhaustive/include-validators/resources/general_errors/types/bad_object_request_info.py b/seed/fastapi/exhaustive/include-validators/resources/general_errors/types/bad_object_request_info.py new file mode 100644 index 00000000000..89c9917b887 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/general_errors/types/bad_object_request_info.py @@ -0,0 +1,150 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions + +from ....core.pydantic_utilities import ( + IS_PYDANTIC_V2, + UniversalBaseModel, + universal_field_validator, + universal_root_validator, +) + + +class BadObjectRequestInfo(UniversalBaseModel): + message: str + + class Partial(typing.TypedDict): + message: typing_extensions.NotRequired[str] + + class Validators: + """ + Use this class to add validators to the Pydantic model. + + @BadObjectRequestInfo.Validators.root() + def validate(values: BadObjectRequestInfo.Partial) -> BadObjectRequestInfo.Partial: + ... + + @BadObjectRequestInfo.Validators.field("message") + def validate_message(message: str, values: BadObjectRequestInfo.Partial) -> str: + ... + """ + + _pre_validators: typing.ClassVar[typing.List[BadObjectRequestInfo.Validators._PreRootValidator]] = [] + _post_validators: typing.ClassVar[typing.List[BadObjectRequestInfo.Validators._RootValidator]] = [] + _message_pre_validators: typing.ClassVar[typing.List[BadObjectRequestInfo.Validators.PreMessageValidator]] = [] + _message_post_validators: typing.ClassVar[typing.List[BadObjectRequestInfo.Validators.MessageValidator]] = [] + + @typing.overload + @classmethod + def root( + cls, *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [BadObjectRequestInfo.Validators._RootValidator], BadObjectRequestInfo.Validators._RootValidator + ]: + ... + + @typing.overload + @classmethod + def root( + cls, *, pre: typing.Literal[True] + ) -> typing.Callable[ + [BadObjectRequestInfo.Validators._PreRootValidator], BadObjectRequestInfo.Validators._PreRootValidator + ]: + ... + + @classmethod + def root(cls, *, pre: bool = False) -> typing.Any: + def decorator(validator: typing.Any) -> typing.Any: + if pre: + cls._pre_validators.append(validator) + else: + cls._post_validators.append(validator) + return validator + + return decorator + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["message"], *, pre: typing.Literal[True] + ) -> typing.Callable[ + [BadObjectRequestInfo.Validators.PreMessageValidator], BadObjectRequestInfo.Validators.PreMessageValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["message"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [BadObjectRequestInfo.Validators.MessageValidator], BadObjectRequestInfo.Validators.MessageValidator + ]: + ... + + @classmethod + def field(cls, field_name: str, *, pre: bool = False) -> typing.Any: + def decorator(validator: typing.Any) -> typing.Any: + if field_name == "message": + if pre: + cls._message_pre_validators.append(validator) + else: + cls._message_post_validators.append(validator) + return validator + + return decorator + + class PreMessageValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: BadObjectRequestInfo.Partial) -> typing.Any: + ... + + class MessageValidator(typing.Protocol): + def __call__(self, __v: str, __values: BadObjectRequestInfo.Partial) -> str: + ... + + class _PreRootValidator(typing.Protocol): + def __call__(self, __values: typing.Any) -> typing.Any: + ... + + class _RootValidator(typing.Protocol): + def __call__(self, __values: BadObjectRequestInfo.Partial) -> BadObjectRequestInfo.Partial: + ... + + @universal_root_validator(pre=True) + def _pre_validate_bad_object_request_info( + cls, values: BadObjectRequestInfo.Partial + ) -> BadObjectRequestInfo.Partial: + for validator in BadObjectRequestInfo.Validators._pre_validators: + values = validator(values) + return values + + @universal_root_validator(pre=False) + def _post_validate_bad_object_request_info( + cls, values: BadObjectRequestInfo.Partial + ) -> BadObjectRequestInfo.Partial: + for validator in BadObjectRequestInfo.Validators._post_validators: + values = validator(values) + return values + + @universal_field_validator("message", pre=True) + def _pre_validate_message(cls, v: str, values: BadObjectRequestInfo.Partial) -> str: + for validator in BadObjectRequestInfo.Validators._message_pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("message", pre=False) + def _post_validate_message(cls, v: str, values: BadObjectRequestInfo.Partial) -> str: + for validator in BadObjectRequestInfo.Validators._message_post_validators: + v = validator(v, values) + return v + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="forbid") # type: ignore # Pydantic v2 + else: + + class Config: + extra = pydantic.Extra.forbid diff --git a/seed/fastapi/exhaustive/include-validators/resources/inlined_requests/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/inlined_requests/__init__.py new file mode 100644 index 00000000000..e49491cc185 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/inlined_requests/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .service import PostWithObjectBody + +__all__ = ["PostWithObjectBody"] diff --git a/seed/fastapi/exhaustive/include-validators/resources/inlined_requests/service/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/inlined_requests/service/__init__.py new file mode 100644 index 00000000000..c1d5bec72c8 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/inlined_requests/service/__init__.py @@ -0,0 +1,6 @@ +# This file was auto-generated by Fern from our API Definition. + +from .post_with_object_body import PostWithObjectBody +from .service import AbstractInlinedRequestsService + +__all__ = ["AbstractInlinedRequestsService", "PostWithObjectBody"] diff --git a/seed/fastapi/exhaustive/include-validators/resources/inlined_requests/service/post_with_object_body.py b/seed/fastapi/exhaustive/include-validators/resources/inlined_requests/service/post_with_object_body.py new file mode 100644 index 00000000000..e05ca3e26f9 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/inlined_requests/service/post_with_object_body.py @@ -0,0 +1,260 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions + +from ....core.pydantic_utilities import ( + IS_PYDANTIC_V2, + UniversalBaseModel, + universal_field_validator, + universal_root_validator, +) +from ...types.resources.object.types.object_with_optional_field import ObjectWithOptionalField + + +class PostWithObjectBody(UniversalBaseModel): + string: str + integer: int + nested_object: ObjectWithOptionalField = pydantic.Field(alias="NestedObject") + + class Partial(typing.TypedDict): + string: typing_extensions.NotRequired[str] + integer: typing_extensions.NotRequired[int] + nested_object: typing_extensions.NotRequired[ObjectWithOptionalField] + + class Validators: + """ + Use this class to add validators to the Pydantic model. + + @PostWithObjectBody.Validators.root() + def validate(values: PostWithObjectBody.Partial) -> PostWithObjectBody.Partial: + ... + + @PostWithObjectBody.Validators.field("string") + def validate_string(string: str, values: PostWithObjectBody.Partial) -> str: + ... + + @PostWithObjectBody.Validators.field("integer") + def validate_integer(integer: int, values: PostWithObjectBody.Partial) -> int: + ... + + @PostWithObjectBody.Validators.field("nested_object") + def validate_nested_object(nested_object: ObjectWithOptionalField, values: PostWithObjectBody.Partial) -> ObjectWithOptionalField: + ... + """ + + _pre_validators: typing.ClassVar[typing.List[PostWithObjectBody.Validators._PreRootValidator]] = [] + _post_validators: typing.ClassVar[typing.List[PostWithObjectBody.Validators._RootValidator]] = [] + _string_pre_validators: typing.ClassVar[typing.List[PostWithObjectBody.Validators.PreStringValidator]] = [] + _string_post_validators: typing.ClassVar[typing.List[PostWithObjectBody.Validators.StringValidator]] = [] + _integer_pre_validators: typing.ClassVar[typing.List[PostWithObjectBody.Validators.PreIntegerValidator]] = [] + _integer_post_validators: typing.ClassVar[typing.List[PostWithObjectBody.Validators.IntegerValidator]] = [] + _nested_object_pre_validators: typing.ClassVar[ + typing.List[PostWithObjectBody.Validators.PreNestedObjectValidator] + ] = [] + _nested_object_post_validators: typing.ClassVar[ + typing.List[PostWithObjectBody.Validators.NestedObjectValidator] + ] = [] + + @typing.overload + @classmethod + def root( + cls, *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [PostWithObjectBody.Validators._RootValidator], PostWithObjectBody.Validators._RootValidator + ]: + ... + + @typing.overload + @classmethod + def root( + cls, *, pre: typing.Literal[True] + ) -> typing.Callable[ + [PostWithObjectBody.Validators._PreRootValidator], PostWithObjectBody.Validators._PreRootValidator + ]: + ... + + @classmethod + def root(cls, *, pre: bool = False) -> typing.Any: + def decorator(validator: typing.Any) -> typing.Any: + if pre: + cls._pre_validators.append(validator) + else: + cls._post_validators.append(validator) + return validator + + return decorator + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["string"], *, pre: typing.Literal[True] + ) -> typing.Callable[ + [PostWithObjectBody.Validators.PreStringValidator], PostWithObjectBody.Validators.PreStringValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["string"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [PostWithObjectBody.Validators.StringValidator], PostWithObjectBody.Validators.StringValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["integer"], *, pre: typing.Literal[True] + ) -> typing.Callable[ + [PostWithObjectBody.Validators.PreIntegerValidator], PostWithObjectBody.Validators.PreIntegerValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["integer"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [PostWithObjectBody.Validators.IntegerValidator], PostWithObjectBody.Validators.IntegerValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["nested_object"], *, pre: typing.Literal[True] + ) -> typing.Callable[ + [PostWithObjectBody.Validators.PreNestedObjectValidator], + PostWithObjectBody.Validators.PreNestedObjectValidator, + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["nested_object"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [PostWithObjectBody.Validators.NestedObjectValidator], PostWithObjectBody.Validators.NestedObjectValidator + ]: + ... + + @classmethod + def field(cls, field_name: str, *, pre: bool = False) -> typing.Any: + def decorator(validator: typing.Any) -> typing.Any: + if field_name == "string": + if pre: + cls._string_pre_validators.append(validator) + else: + cls._string_post_validators.append(validator) + if field_name == "integer": + if pre: + cls._integer_pre_validators.append(validator) + else: + cls._integer_post_validators.append(validator) + if field_name == "nested_object": + if pre: + cls._nested_object_pre_validators.append(validator) + else: + cls._nested_object_post_validators.append(validator) + return validator + + return decorator + + class PreStringValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: PostWithObjectBody.Partial) -> typing.Any: + ... + + class StringValidator(typing.Protocol): + def __call__(self, __v: str, __values: PostWithObjectBody.Partial) -> str: + ... + + class PreIntegerValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: PostWithObjectBody.Partial) -> typing.Any: + ... + + class IntegerValidator(typing.Protocol): + def __call__(self, __v: int, __values: PostWithObjectBody.Partial) -> int: + ... + + class PreNestedObjectValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: PostWithObjectBody.Partial) -> typing.Any: + ... + + class NestedObjectValidator(typing.Protocol): + def __call__( + self, __v: ObjectWithOptionalField, __values: PostWithObjectBody.Partial + ) -> ObjectWithOptionalField: + ... + + class _PreRootValidator(typing.Protocol): + def __call__(self, __values: typing.Any) -> typing.Any: + ... + + class _RootValidator(typing.Protocol): + def __call__(self, __values: PostWithObjectBody.Partial) -> PostWithObjectBody.Partial: + ... + + @universal_root_validator(pre=True) + def _pre_validate(cls, values: PostWithObjectBody.Partial) -> PostWithObjectBody.Partial: + for validator in PostWithObjectBody.Validators._pre_validators: + values = validator(values) + return values + + @universal_root_validator(pre=False) + def _post_validate(cls, values: PostWithObjectBody.Partial) -> PostWithObjectBody.Partial: + for validator in PostWithObjectBody.Validators._post_validators: + values = validator(values) + return values + + @universal_field_validator("string", pre=True) + def _pre_validate_string(cls, v: str, values: PostWithObjectBody.Partial) -> str: + for validator in PostWithObjectBody.Validators._string_pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("string", pre=False) + def _post_validate_string(cls, v: str, values: PostWithObjectBody.Partial) -> str: + for validator in PostWithObjectBody.Validators._string_post_validators: + v = validator(v, values) + return v + + @universal_field_validator("integer", pre=True) + def _pre_validate_integer(cls, v: int, values: PostWithObjectBody.Partial) -> int: + for validator in PostWithObjectBody.Validators._integer_pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("integer", pre=False) + def _post_validate_integer(cls, v: int, values: PostWithObjectBody.Partial) -> int: + for validator in PostWithObjectBody.Validators._integer_post_validators: + v = validator(v, values) + return v + + @universal_field_validator("nested_object", pre=True) + def _pre_validate_nested_object( + cls, v: ObjectWithOptionalField, values: PostWithObjectBody.Partial + ) -> ObjectWithOptionalField: + for validator in PostWithObjectBody.Validators._nested_object_pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("nested_object", pre=False) + def _post_validate_nested_object( + cls, v: ObjectWithOptionalField, values: PostWithObjectBody.Partial + ) -> ObjectWithOptionalField: + for validator in PostWithObjectBody.Validators._nested_object_post_validators: + v = validator(v, values) + return v + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="forbid") # type: ignore # Pydantic v2 + else: + + class Config: + extra = pydantic.Extra.forbid diff --git a/seed/fastapi/exhaustive/include-validators/resources/inlined_requests/service/service.py b/seed/fastapi/exhaustive/include-validators/resources/inlined_requests/service/service.py new file mode 100644 index 00000000000..24b6ac5ff85 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/inlined_requests/service/service.py @@ -0,0 +1,82 @@ +# This file was auto-generated by Fern from our API Definition. + +import abc +import functools +import inspect +import logging +import typing + +import fastapi + +from ....core.abstract_fern_service import AbstractFernService +from ....core.exceptions.fern_http_exception import FernHTTPException +from ....core.route_args import get_route_args +from ...general_errors.errors.bad_request_body import BadRequestBody +from ...types.resources.object.types.object_with_optional_field import ObjectWithOptionalField +from .post_with_object_body import PostWithObjectBody + + +class AbstractInlinedRequestsService(AbstractFernService): + """ + AbstractInlinedRequestsService is an abstract class containing the methods that you should implement. + + Each method is associated with an API route, which will be registered + with FastAPI when you register your implementation using Fern's register() + function. + """ + + @abc.abstractmethod + def post_with_object_bodyand_response(self, *, body: PostWithObjectBody) -> ObjectWithOptionalField: + """ + POST with custom object in request body, response is an object + """ + ... + + """ + Below are internal methods used by Fern to register your implementation. + You can ignore them. + """ + + @classmethod + def _init_fern(cls, router: fastapi.APIRouter) -> None: + cls.__init_post_with_object_bodyand_response(router=router) + + @classmethod + def __init_post_with_object_bodyand_response(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.post_with_object_bodyand_response) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + else: + new_parameters.append(parameter) + setattr( + cls.post_with_object_bodyand_response, "__signature__", endpoint_function.replace(parameters=new_parameters) + ) + + @functools.wraps(cls.post_with_object_bodyand_response) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> ObjectWithOptionalField: + try: + return cls.post_with_object_bodyand_response(*args, **kwargs) + except BadRequestBody as e: + raise e + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'post_with_object_bodyand_response' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.post_with_object_bodyand_response.__globals__) + + router.post( + path="/req-bodies/object", + response_model=ObjectWithOptionalField, + description=AbstractInlinedRequestsService.post_with_object_bodyand_response.__doc__, + **get_route_args(cls.post_with_object_bodyand_response, default_tag="inlined_requests"), + )(wrapper) diff --git a/seed/fastapi/exhaustive/include-validators/resources/no_auth/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/no_auth/__init__.py new file mode 100644 index 00000000000..f3ea2659bb1 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/no_auth/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/seed/fastapi/exhaustive/include-validators/resources/no_auth/service/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/no_auth/service/__init__.py new file mode 100644 index 00000000000..1c29f9f2a06 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/no_auth/service/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .service import AbstractNoAuthService + +__all__ = ["AbstractNoAuthService"] diff --git a/seed/fastapi/exhaustive/include-validators/resources/no_auth/service/service.py b/seed/fastapi/exhaustive/include-validators/resources/no_auth/service/service.py new file mode 100644 index 00000000000..49567824464 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/no_auth/service/service.py @@ -0,0 +1,78 @@ +# This file was auto-generated by Fern from our API Definition. + +import abc +import functools +import inspect +import logging +import typing + +import fastapi + +from ....core.abstract_fern_service import AbstractFernService +from ....core.exceptions.fern_http_exception import FernHTTPException +from ....core.route_args import get_route_args +from ...general_errors.errors.bad_request_body import BadRequestBody + + +class AbstractNoAuthService(AbstractFernService): + """ + AbstractNoAuthService is an abstract class containing the methods that you should implement. + + Each method is associated with an API route, which will be registered + with FastAPI when you register your implementation using Fern's register() + function. + """ + + @abc.abstractmethod + def post_with_no_auth(self, *, body: typing.Optional[typing.Any] = None) -> bool: + """ + POST request with no auth + """ + ... + + """ + Below are internal methods used by Fern to register your implementation. + You can ignore them. + """ + + @classmethod + def _init_fern(cls, router: fastapi.APIRouter) -> None: + cls.__init_post_with_no_auth(router=router) + + @classmethod + def __init_post_with_no_auth(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.post_with_no_auth) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + else: + new_parameters.append(parameter) + setattr(cls.post_with_no_auth, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.post_with_no_auth) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> bool: + try: + return cls.post_with_no_auth(*args, **kwargs) + except BadRequestBody as e: + raise e + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'post_with_no_auth' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.post_with_no_auth.__globals__) + + router.post( + path="/no-auth", + response_model=bool, + description=AbstractNoAuthService.post_with_no_auth.__doc__, + **get_route_args(cls.post_with_no_auth, default_tag="no_auth"), + )(wrapper) diff --git a/seed/fastapi/exhaustive/include-validators/resources/no_req_body/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/no_req_body/__init__.py new file mode 100644 index 00000000000..f3ea2659bb1 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/no_req_body/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/seed/fastapi/exhaustive/include-validators/resources/no_req_body/service/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/no_req_body/service/__init__.py new file mode 100644 index 00000000000..a0ad1b0152f --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/no_req_body/service/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .service import AbstractNoReqBodyService + +__all__ = ["AbstractNoReqBodyService"] diff --git a/seed/fastapi/exhaustive/include-validators/resources/no_req_body/service/service.py b/seed/fastapi/exhaustive/include-validators/resources/no_req_body/service/service.py new file mode 100644 index 00000000000..09c805cc1c7 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/no_req_body/service/service.py @@ -0,0 +1,115 @@ +# This file was auto-generated by Fern from our API Definition. + +import abc +import functools +import inspect +import logging +import typing + +import fastapi + +from ....core.abstract_fern_service import AbstractFernService +from ....core.exceptions.fern_http_exception import FernHTTPException +from ....core.route_args import get_route_args +from ....security import ApiAuth, FernAuth +from ...types.resources.object.types.object_with_optional_field import ObjectWithOptionalField + + +class AbstractNoReqBodyService(AbstractFernService): + """ + AbstractNoReqBodyService is an abstract class containing the methods that you should implement. + + Each method is associated with an API route, which will be registered + with FastAPI when you register your implementation using Fern's register() + function. + """ + + @abc.abstractmethod + def get_with_no_request_body(self, *, auth: ApiAuth) -> ObjectWithOptionalField: + ... + + @abc.abstractmethod + def post_with_no_request_body(self, *, auth: ApiAuth) -> str: + ... + + """ + Below are internal methods used by Fern to register your implementation. + You can ignore them. + """ + + @classmethod + def _init_fern(cls, router: fastapi.APIRouter) -> None: + cls.__init_get_with_no_request_body(router=router) + cls.__init_post_with_no_request_body(router=router) + + @classmethod + def __init_get_with_no_request_body(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_with_no_request_body) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr(cls.get_with_no_request_body, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.get_with_no_request_body) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> ObjectWithOptionalField: + try: + return cls.get_with_no_request_body(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_with_no_request_body' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_with_no_request_body.__globals__) + + router.get( + path="/no-req-body", + response_model=ObjectWithOptionalField, + description=AbstractNoReqBodyService.get_with_no_request_body.__doc__, + **get_route_args(cls.get_with_no_request_body, default_tag="no_req_body"), + )(wrapper) + + @classmethod + def __init_post_with_no_request_body(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.post_with_no_request_body) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr(cls.post_with_no_request_body, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.post_with_no_request_body) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> str: + try: + return cls.post_with_no_request_body(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'post_with_no_request_body' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.post_with_no_request_body.__globals__) + + router.post( + path="/no-req-body", + response_model=str, + description=AbstractNoReqBodyService.post_with_no_request_body.__doc__, + **get_route_args(cls.post_with_no_request_body, default_tag="no_req_body"), + )(wrapper) diff --git a/seed/fastapi/exhaustive/include-validators/resources/req_with_headers/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/req_with_headers/__init__.py new file mode 100644 index 00000000000..f3ea2659bb1 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/req_with_headers/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/seed/fastapi/exhaustive/include-validators/resources/req_with_headers/service/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/req_with_headers/service/__init__.py new file mode 100644 index 00000000000..c5f17c39b40 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/req_with_headers/service/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .service import AbstractReqWithHeadersService + +__all__ = ["AbstractReqWithHeadersService"] diff --git a/seed/fastapi/exhaustive/include-validators/resources/req_with_headers/service/service.py b/seed/fastapi/exhaustive/include-validators/resources/req_with_headers/service/service.py new file mode 100644 index 00000000000..7b31e8311b8 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/req_with_headers/service/service.py @@ -0,0 +1,79 @@ +# This file was auto-generated by Fern from our API Definition. + +import abc +import functools +import inspect +import logging +import typing + +import fastapi +import starlette + +from ....core.abstract_fern_service import AbstractFernService +from ....core.exceptions.fern_http_exception import FernHTTPException +from ....core.route_args import get_route_args +from ....security import ApiAuth, FernAuth + + +class AbstractReqWithHeadersService(AbstractFernService): + """ + AbstractReqWithHeadersService is an abstract class containing the methods that you should implement. + + Each method is associated with an API route, which will be registered + with FastAPI when you register your implementation using Fern's register() + function. + """ + + @abc.abstractmethod + def get_with_custom_header(self, *, body: str, x_test_endpoint_header: str, auth: ApiAuth) -> None: + ... + + """ + Below are internal methods used by Fern to register your implementation. + You can ignore them. + """ + + @classmethod + def _init_fern(cls, router: fastapi.APIRouter) -> None: + cls.__init_get_with_custom_header(router=router) + + @classmethod + def __init_get_with_custom_header(cls, router: fastapi.APIRouter) -> None: + endpoint_function = inspect.signature(cls.get_with_custom_header) + new_parameters: typing.List[inspect.Parameter] = [] + for index, (parameter_name, parameter) in enumerate(endpoint_function.parameters.items()): + if index == 0: + new_parameters.append(parameter.replace(default=fastapi.Depends(cls))) + elif parameter_name == "body": + new_parameters.append(parameter.replace(default=fastapi.Body(...))) + elif parameter_name == "x_test_endpoint_header": + new_parameters.append(parameter.replace(default=fastapi.Header(alias="X-TEST-ENDPOINT-HEADER"))) + elif parameter_name == "auth": + new_parameters.append(parameter.replace(default=fastapi.Depends(FernAuth))) + else: + new_parameters.append(parameter) + setattr(cls.get_with_custom_header, "__signature__", endpoint_function.replace(parameters=new_parameters)) + + @functools.wraps(cls.get_with_custom_header) + def wrapper(*args: typing.Any, **kwargs: typing.Any) -> None: + try: + return cls.get_with_custom_header(*args, **kwargs) + except FernHTTPException as e: + logging.getLogger(f"{cls.__module__}.{cls.__name__}").warn( + f"Endpoint 'get_with_custom_header' unexpectedly threw {e.__class__.__name__}. " + + f"If this was intentional, please add {e.__class__.__name__} to " + + "the endpoint's errors list in your Fern Definition." + ) + raise e + + # this is necessary for FastAPI to find forward-ref'ed type hints. + # https://github.com/tiangolo/fastapi/pull/5077 + wrapper.__globals__.update(cls.get_with_custom_header.__globals__) + + router.post( + path="/test-headers/custom-header", + response_model=None, + status_code=starlette.status.HTTP_204_NO_CONTENT, + description=AbstractReqWithHeadersService.get_with_custom_header.__doc__, + **get_route_args(cls.get_with_custom_header, default_tag="req_with_headers"), + )(wrapper) diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/types/__init__.py new file mode 100644 index 00000000000..a3867a6ebb1 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/__init__.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +from .resources import ( + Animal, + Cat, + Dog, + DoubleOptional, + ErrorWithEnumBody, + ErrorWithUnionBody, + NestedObjectWithOptionalField, + NestedObjectWithOptionalFieldError, + NestedObjectWithRequiredField, + NestedObjectWithRequiredFieldError, + ObjectWithMapOfMap, + ObjectWithOptionalField, + ObjectWithOptionalFieldError, + ObjectWithRequiredField, + ObjectWithRequiredFieldError, + OptionalAlias, + WeatherReport, + enum, + object, + union, +) + +__all__ = [ + "Animal", + "Cat", + "Dog", + "DoubleOptional", + "ErrorWithEnumBody", + "ErrorWithUnionBody", + "NestedObjectWithOptionalField", + "NestedObjectWithOptionalFieldError", + "NestedObjectWithRequiredField", + "NestedObjectWithRequiredFieldError", + "ObjectWithMapOfMap", + "ObjectWithOptionalField", + "ObjectWithOptionalFieldError", + "ObjectWithRequiredField", + "ObjectWithRequiredFieldError", + "OptionalAlias", + "WeatherReport", + "enum", + "object", + "union", +] diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/__init__.py new file mode 100644 index 00000000000..8d48c2cf24e --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/__init__.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +from . import enum, object, union +from .enum import ErrorWithEnumBody, WeatherReport +from .object import ( + DoubleOptional, + NestedObjectWithOptionalField, + NestedObjectWithOptionalFieldError, + NestedObjectWithRequiredField, + NestedObjectWithRequiredFieldError, + ObjectWithMapOfMap, + ObjectWithOptionalField, + ObjectWithOptionalFieldError, + ObjectWithRequiredField, + ObjectWithRequiredFieldError, + OptionalAlias, +) +from .union import Animal, Cat, Dog, ErrorWithUnionBody + +__all__ = [ + "Animal", + "Cat", + "Dog", + "DoubleOptional", + "ErrorWithEnumBody", + "ErrorWithUnionBody", + "NestedObjectWithOptionalField", + "NestedObjectWithOptionalFieldError", + "NestedObjectWithRequiredField", + "NestedObjectWithRequiredFieldError", + "ObjectWithMapOfMap", + "ObjectWithOptionalField", + "ObjectWithOptionalFieldError", + "ObjectWithRequiredField", + "ObjectWithRequiredFieldError", + "OptionalAlias", + "WeatherReport", + "enum", + "object", + "union", +] diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/enum/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/enum/__init__.py new file mode 100644 index 00000000000..3983fd06a84 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/enum/__init__.py @@ -0,0 +1,6 @@ +# This file was auto-generated by Fern from our API Definition. + +from .errors import ErrorWithEnumBody +from .types import WeatherReport + +__all__ = ["ErrorWithEnumBody", "WeatherReport"] diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/enum/errors/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/enum/errors/__init__.py new file mode 100644 index 00000000000..f5945e36d9d --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/enum/errors/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .error_with_enum_body import ErrorWithEnumBody + +__all__ = ["ErrorWithEnumBody"] diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/enum/errors/error_with_enum_body.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/enum/errors/error_with_enum_body.py new file mode 100644 index 00000000000..8b8a0d981c3 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/enum/errors/error_with_enum_body.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +from ......core.exceptions.fern_http_exception import FernHTTPException +from ..types.weather_report import WeatherReport + + +class ErrorWithEnumBody(FernHTTPException): + def __init__(self, error: WeatherReport): + super().__init__(status_code=400, name="ErrorWithEnumBody", content=error) diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/enum/types/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/enum/types/__init__.py new file mode 100644 index 00000000000..7a47d1fefc6 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/enum/types/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .weather_report import WeatherReport + +__all__ = ["WeatherReport"] diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/enum/types/weather_report.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/enum/types/weather_report.py new file mode 100644 index 00000000000..0f2fc3aee2a --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/enum/types/weather_report.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class WeatherReport(str, enum.Enum): + SUNNY = "SUNNY" + CLOUDY = "CLOUDY" + RAINING = "RAINING" + SNOWING = "SNOWING" + + def visit( + self, + sunny: typing.Callable[[], T_Result], + cloudy: typing.Callable[[], T_Result], + raining: typing.Callable[[], T_Result], + snowing: typing.Callable[[], T_Result], + ) -> T_Result: + if self is WeatherReport.SUNNY: + return sunny() + if self is WeatherReport.CLOUDY: + return cloudy() + if self is WeatherReport.RAINING: + return raining() + if self is WeatherReport.SNOWING: + return snowing() diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/__init__.py new file mode 100644 index 00000000000..6be602ca8ef --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/__init__.py @@ -0,0 +1,31 @@ +# This file was auto-generated by Fern from our API Definition. + +from .errors import ( + NestedObjectWithOptionalFieldError, + NestedObjectWithRequiredFieldError, + ObjectWithOptionalFieldError, + ObjectWithRequiredFieldError, +) +from .types import ( + DoubleOptional, + NestedObjectWithOptionalField, + NestedObjectWithRequiredField, + ObjectWithMapOfMap, + ObjectWithOptionalField, + ObjectWithRequiredField, + OptionalAlias, +) + +__all__ = [ + "DoubleOptional", + "NestedObjectWithOptionalField", + "NestedObjectWithOptionalFieldError", + "NestedObjectWithRequiredField", + "NestedObjectWithRequiredFieldError", + "ObjectWithMapOfMap", + "ObjectWithOptionalField", + "ObjectWithOptionalFieldError", + "ObjectWithRequiredField", + "ObjectWithRequiredFieldError", + "OptionalAlias", +] diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/errors/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/errors/__init__.py new file mode 100644 index 00000000000..7e7e4c63aa8 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/errors/__init__.py @@ -0,0 +1,13 @@ +# This file was auto-generated by Fern from our API Definition. + +from .nested_object_with_optional_field_error import NestedObjectWithOptionalFieldError +from .nested_object_with_required_field_error import NestedObjectWithRequiredFieldError +from .object_with_optional_field_error import ObjectWithOptionalFieldError +from .object_with_required_field_error import ObjectWithRequiredFieldError + +__all__ = [ + "NestedObjectWithOptionalFieldError", + "NestedObjectWithRequiredFieldError", + "ObjectWithOptionalFieldError", + "ObjectWithRequiredFieldError", +] diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/errors/nested_object_with_optional_field_error.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/errors/nested_object_with_optional_field_error.py new file mode 100644 index 00000000000..3ba440b272a --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/errors/nested_object_with_optional_field_error.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +from ......core.exceptions.fern_http_exception import FernHTTPException +from ..types.nested_object_with_optional_field import NestedObjectWithOptionalField + + +class NestedObjectWithOptionalFieldError(FernHTTPException): + def __init__(self, error: NestedObjectWithOptionalField): + super().__init__(status_code=400, name="NestedObjectWithOptionalFieldError", content=error) diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/errors/nested_object_with_required_field_error.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/errors/nested_object_with_required_field_error.py new file mode 100644 index 00000000000..10b5e850066 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/errors/nested_object_with_required_field_error.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +from ......core.exceptions.fern_http_exception import FernHTTPException +from ..types.nested_object_with_required_field import NestedObjectWithRequiredField + + +class NestedObjectWithRequiredFieldError(FernHTTPException): + def __init__(self, error: NestedObjectWithRequiredField): + super().__init__(status_code=400, name="NestedObjectWithRequiredFieldError", content=error) diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/errors/object_with_optional_field_error.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/errors/object_with_optional_field_error.py new file mode 100644 index 00000000000..09a92f4c466 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/errors/object_with_optional_field_error.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +from ......core.exceptions.fern_http_exception import FernHTTPException +from ..types.object_with_optional_field import ObjectWithOptionalField + + +class ObjectWithOptionalFieldError(FernHTTPException): + def __init__(self, error: ObjectWithOptionalField): + super().__init__(status_code=400, name="ObjectWithOptionalFieldError", content=error) diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/errors/object_with_required_field_error.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/errors/object_with_required_field_error.py new file mode 100644 index 00000000000..c0c5cc11812 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/errors/object_with_required_field_error.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +from ......core.exceptions.fern_http_exception import FernHTTPException +from ..types.object_with_required_field import ObjectWithRequiredField + + +class ObjectWithRequiredFieldError(FernHTTPException): + def __init__(self, error: ObjectWithRequiredField): + super().__init__(status_code=400, name="ObjectWithRequiredFieldError", content=error) diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/types/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/types/__init__.py new file mode 100644 index 00000000000..2620e6eea12 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/types/__init__.py @@ -0,0 +1,19 @@ +# This file was auto-generated by Fern from our API Definition. + +from .double_optional import DoubleOptional +from .nested_object_with_optional_field import NestedObjectWithOptionalField +from .nested_object_with_required_field import NestedObjectWithRequiredField +from .object_with_map_of_map import ObjectWithMapOfMap +from .object_with_optional_field import ObjectWithOptionalField +from .object_with_required_field import ObjectWithRequiredField +from .optional_alias import OptionalAlias + +__all__ = [ + "DoubleOptional", + "NestedObjectWithOptionalField", + "NestedObjectWithRequiredField", + "ObjectWithMapOfMap", + "ObjectWithOptionalField", + "ObjectWithRequiredField", + "OptionalAlias", +] diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/types/double_optional.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/types/double_optional.py new file mode 100644 index 00000000000..72f94c8b4b4 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/types/double_optional.py @@ -0,0 +1,155 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions + +from ......core.pydantic_utilities import ( + IS_PYDANTIC_V2, + UniversalBaseModel, + universal_field_validator, + universal_root_validator, +) +from .optional_alias import OptionalAlias + + +class DoubleOptional(UniversalBaseModel): + optional_alias: typing.Optional[OptionalAlias] = pydantic.Field(alias="optionalAlias", default=None) + + class Partial(typing.TypedDict): + optional_alias: typing_extensions.NotRequired[typing.Optional[OptionalAlias]] + + class Validators: + """ + Use this class to add validators to the Pydantic model. + + @DoubleOptional.Validators.root() + def validate(values: DoubleOptional.Partial) -> DoubleOptional.Partial: + ... + + @DoubleOptional.Validators.field("optional_alias") + def validate_optional_alias(optional_alias: typing.Optional[OptionalAlias], values: DoubleOptional.Partial) -> typing.Optional[OptionalAlias]: + ... + """ + + _pre_validators: typing.ClassVar[typing.List[DoubleOptional.Validators._PreRootValidator]] = [] + _post_validators: typing.ClassVar[typing.List[DoubleOptional.Validators._RootValidator]] = [] + _optional_alias_pre_validators: typing.ClassVar[ + typing.List[DoubleOptional.Validators.PreOptionalAliasValidator] + ] = [] + _optional_alias_post_validators: typing.ClassVar[ + typing.List[DoubleOptional.Validators.OptionalAliasValidator] + ] = [] + + @typing.overload + @classmethod + def root( + cls, *, pre: typing.Literal[False] = False + ) -> typing.Callable[[DoubleOptional.Validators._RootValidator], DoubleOptional.Validators._RootValidator]: + ... + + @typing.overload + @classmethod + def root( + cls, *, pre: typing.Literal[True] + ) -> typing.Callable[ + [DoubleOptional.Validators._PreRootValidator], DoubleOptional.Validators._PreRootValidator + ]: + ... + + @classmethod + def root(cls, *, pre: bool = False) -> typing.Any: + def decorator(validator: typing.Any) -> typing.Any: + if pre: + cls._pre_validators.append(validator) + else: + cls._post_validators.append(validator) + return validator + + return decorator + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["optional_alias"], *, pre: typing.Literal[True] + ) -> typing.Callable[ + [DoubleOptional.Validators.PreOptionalAliasValidator], DoubleOptional.Validators.PreOptionalAliasValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["optional_alias"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [DoubleOptional.Validators.OptionalAliasValidator], DoubleOptional.Validators.OptionalAliasValidator + ]: + ... + + @classmethod + def field(cls, field_name: str, *, pre: bool = False) -> typing.Any: + def decorator(validator: typing.Any) -> typing.Any: + if field_name == "optional_alias": + if pre: + cls._optional_alias_pre_validators.append(validator) + else: + cls._optional_alias_post_validators.append(validator) + return validator + + return decorator + + class PreOptionalAliasValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: DoubleOptional.Partial) -> typing.Any: + ... + + class OptionalAliasValidator(typing.Protocol): + def __call__( + self, __v: typing.Optional[OptionalAlias], __values: DoubleOptional.Partial + ) -> typing.Optional[OptionalAlias]: + ... + + class _PreRootValidator(typing.Protocol): + def __call__(self, __values: typing.Any) -> typing.Any: + ... + + class _RootValidator(typing.Protocol): + def __call__(self, __values: DoubleOptional.Partial) -> DoubleOptional.Partial: + ... + + @universal_root_validator(pre=True) + def _pre_validate_types_double_optional(cls, values: DoubleOptional.Partial) -> DoubleOptional.Partial: + for validator in DoubleOptional.Validators._pre_validators: + values = validator(values) + return values + + @universal_root_validator(pre=False) + def _post_validate_types_double_optional(cls, values: DoubleOptional.Partial) -> DoubleOptional.Partial: + for validator in DoubleOptional.Validators._post_validators: + values = validator(values) + return values + + @universal_field_validator("optional_alias", pre=True) + def _pre_validate_optional_alias( + cls, v: typing.Optional[OptionalAlias], values: DoubleOptional.Partial + ) -> typing.Optional[OptionalAlias]: + for validator in DoubleOptional.Validators._optional_alias_pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("optional_alias", pre=False) + def _post_validate_optional_alias( + cls, v: typing.Optional[OptionalAlias], values: DoubleOptional.Partial + ) -> typing.Optional[OptionalAlias]: + for validator in DoubleOptional.Validators._optional_alias_post_validators: + v = validator(v, values) + return v + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="forbid") # type: ignore # Pydantic v2 + else: + + class Config: + extra = pydantic.Extra.forbid diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/types/nested_object_with_optional_field.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/types/nested_object_with_optional_field.py new file mode 100644 index 00000000000..b07b44c6b18 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/types/nested_object_with_optional_field.py @@ -0,0 +1,230 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions + +from ......core.pydantic_utilities import ( + IS_PYDANTIC_V2, + UniversalBaseModel, + universal_field_validator, + universal_root_validator, +) +from .object_with_optional_field import ObjectWithOptionalField + + +class NestedObjectWithOptionalField(UniversalBaseModel): + string: typing.Optional[str] = None + nested_object: typing.Optional[ObjectWithOptionalField] = pydantic.Field(alias="NestedObject", default=None) + + class Partial(typing.TypedDict): + string: typing_extensions.NotRequired[typing.Optional[str]] + nested_object: typing_extensions.NotRequired[typing.Optional[ObjectWithOptionalField]] + + class Validators: + """ + Use this class to add validators to the Pydantic model. + + @NestedObjectWithOptionalField.Validators.root() + def validate(values: NestedObjectWithOptionalField.Partial) -> NestedObjectWithOptionalField.Partial: + ... + + @NestedObjectWithOptionalField.Validators.field("string") + def validate_string(string: typing.Optional[str], values: NestedObjectWithOptionalField.Partial) -> typing.Optional[str]: + ... + + @NestedObjectWithOptionalField.Validators.field("nested_object") + def validate_nested_object(nested_object: typing.Optional[ObjectWithOptionalField], values: NestedObjectWithOptionalField.Partial) -> typing.Optional[ObjectWithOptionalField]: + ... + """ + + _pre_validators: typing.ClassVar[typing.List[NestedObjectWithOptionalField.Validators._PreRootValidator]] = [] + _post_validators: typing.ClassVar[typing.List[NestedObjectWithOptionalField.Validators._RootValidator]] = [] + _string_pre_validators: typing.ClassVar[ + typing.List[NestedObjectWithOptionalField.Validators.PreStringValidator] + ] = [] + _string_post_validators: typing.ClassVar[ + typing.List[NestedObjectWithOptionalField.Validators.StringValidator] + ] = [] + _nested_object_pre_validators: typing.ClassVar[ + typing.List[NestedObjectWithOptionalField.Validators.PreNestedObjectValidator] + ] = [] + _nested_object_post_validators: typing.ClassVar[ + typing.List[NestedObjectWithOptionalField.Validators.NestedObjectValidator] + ] = [] + + @typing.overload + @classmethod + def root( + cls, *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [NestedObjectWithOptionalField.Validators._RootValidator], + NestedObjectWithOptionalField.Validators._RootValidator, + ]: + ... + + @typing.overload + @classmethod + def root( + cls, *, pre: typing.Literal[True] + ) -> typing.Callable[ + [NestedObjectWithOptionalField.Validators._PreRootValidator], + NestedObjectWithOptionalField.Validators._PreRootValidator, + ]: + ... + + @classmethod + def root(cls, *, pre: bool = False) -> typing.Any: + def decorator(validator: typing.Any) -> typing.Any: + if pre: + cls._pre_validators.append(validator) + else: + cls._post_validators.append(validator) + return validator + + return decorator + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["string"], *, pre: typing.Literal[True] + ) -> typing.Callable[ + [NestedObjectWithOptionalField.Validators.PreStringValidator], + NestedObjectWithOptionalField.Validators.PreStringValidator, + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["string"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [NestedObjectWithOptionalField.Validators.StringValidator], + NestedObjectWithOptionalField.Validators.StringValidator, + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["nested_object"], *, pre: typing.Literal[True] + ) -> typing.Callable[ + [NestedObjectWithOptionalField.Validators.PreNestedObjectValidator], + NestedObjectWithOptionalField.Validators.PreNestedObjectValidator, + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["nested_object"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [NestedObjectWithOptionalField.Validators.NestedObjectValidator], + NestedObjectWithOptionalField.Validators.NestedObjectValidator, + ]: + ... + + @classmethod + def field(cls, field_name: str, *, pre: bool = False) -> typing.Any: + def decorator(validator: typing.Any) -> typing.Any: + if field_name == "string": + if pre: + cls._string_pre_validators.append(validator) + else: + cls._string_post_validators.append(validator) + if field_name == "nested_object": + if pre: + cls._nested_object_pre_validators.append(validator) + else: + cls._nested_object_post_validators.append(validator) + return validator + + return decorator + + class PreStringValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: NestedObjectWithOptionalField.Partial) -> typing.Any: + ... + + class StringValidator(typing.Protocol): + def __call__( + self, __v: typing.Optional[str], __values: NestedObjectWithOptionalField.Partial + ) -> typing.Optional[str]: + ... + + class PreNestedObjectValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: NestedObjectWithOptionalField.Partial) -> typing.Any: + ... + + class NestedObjectValidator(typing.Protocol): + def __call__( + self, __v: typing.Optional[ObjectWithOptionalField], __values: NestedObjectWithOptionalField.Partial + ) -> typing.Optional[ObjectWithOptionalField]: + ... + + class _PreRootValidator(typing.Protocol): + def __call__(self, __values: typing.Any) -> typing.Any: + ... + + class _RootValidator(typing.Protocol): + def __call__( + self, __values: NestedObjectWithOptionalField.Partial + ) -> NestedObjectWithOptionalField.Partial: + ... + + @universal_root_validator(pre=True) + def _pre_validate_types_nested_object_with_optional_field( + cls, values: NestedObjectWithOptionalField.Partial + ) -> NestedObjectWithOptionalField.Partial: + for validator in NestedObjectWithOptionalField.Validators._pre_validators: + values = validator(values) + return values + + @universal_root_validator(pre=False) + def _post_validate_types_nested_object_with_optional_field( + cls, values: NestedObjectWithOptionalField.Partial + ) -> NestedObjectWithOptionalField.Partial: + for validator in NestedObjectWithOptionalField.Validators._post_validators: + values = validator(values) + return values + + @universal_field_validator("string", pre=True) + def _pre_validate_string( + cls, v: typing.Optional[str], values: NestedObjectWithOptionalField.Partial + ) -> typing.Optional[str]: + for validator in NestedObjectWithOptionalField.Validators._string_pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("string", pre=False) + def _post_validate_string( + cls, v: typing.Optional[str], values: NestedObjectWithOptionalField.Partial + ) -> typing.Optional[str]: + for validator in NestedObjectWithOptionalField.Validators._string_post_validators: + v = validator(v, values) + return v + + @universal_field_validator("nested_object", pre=True) + def _pre_validate_nested_object( + cls, v: typing.Optional[ObjectWithOptionalField], values: NestedObjectWithOptionalField.Partial + ) -> typing.Optional[ObjectWithOptionalField]: + for validator in NestedObjectWithOptionalField.Validators._nested_object_pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("nested_object", pre=False) + def _post_validate_nested_object( + cls, v: typing.Optional[ObjectWithOptionalField], values: NestedObjectWithOptionalField.Partial + ) -> typing.Optional[ObjectWithOptionalField]: + for validator in NestedObjectWithOptionalField.Validators._nested_object_post_validators: + v = validator(v, values) + return v + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="forbid") # type: ignore # Pydantic v2 + else: + + class Config: + extra = pydantic.Extra.forbid diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/types/nested_object_with_required_field.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/types/nested_object_with_required_field.py new file mode 100644 index 00000000000..328dc059200 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/types/nested_object_with_required_field.py @@ -0,0 +1,224 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions + +from ......core.pydantic_utilities import ( + IS_PYDANTIC_V2, + UniversalBaseModel, + universal_field_validator, + universal_root_validator, +) +from .object_with_optional_field import ObjectWithOptionalField + + +class NestedObjectWithRequiredField(UniversalBaseModel): + string: str + nested_object: ObjectWithOptionalField = pydantic.Field(alias="NestedObject") + + class Partial(typing.TypedDict): + string: typing_extensions.NotRequired[str] + nested_object: typing_extensions.NotRequired[ObjectWithOptionalField] + + class Validators: + """ + Use this class to add validators to the Pydantic model. + + @NestedObjectWithRequiredField.Validators.root() + def validate(values: NestedObjectWithRequiredField.Partial) -> NestedObjectWithRequiredField.Partial: + ... + + @NestedObjectWithRequiredField.Validators.field("string") + def validate_string(string: str, values: NestedObjectWithRequiredField.Partial) -> str: + ... + + @NestedObjectWithRequiredField.Validators.field("nested_object") + def validate_nested_object(nested_object: ObjectWithOptionalField, values: NestedObjectWithRequiredField.Partial) -> ObjectWithOptionalField: + ... + """ + + _pre_validators: typing.ClassVar[typing.List[NestedObjectWithRequiredField.Validators._PreRootValidator]] = [] + _post_validators: typing.ClassVar[typing.List[NestedObjectWithRequiredField.Validators._RootValidator]] = [] + _string_pre_validators: typing.ClassVar[ + typing.List[NestedObjectWithRequiredField.Validators.PreStringValidator] + ] = [] + _string_post_validators: typing.ClassVar[ + typing.List[NestedObjectWithRequiredField.Validators.StringValidator] + ] = [] + _nested_object_pre_validators: typing.ClassVar[ + typing.List[NestedObjectWithRequiredField.Validators.PreNestedObjectValidator] + ] = [] + _nested_object_post_validators: typing.ClassVar[ + typing.List[NestedObjectWithRequiredField.Validators.NestedObjectValidator] + ] = [] + + @typing.overload + @classmethod + def root( + cls, *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [NestedObjectWithRequiredField.Validators._RootValidator], + NestedObjectWithRequiredField.Validators._RootValidator, + ]: + ... + + @typing.overload + @classmethod + def root( + cls, *, pre: typing.Literal[True] + ) -> typing.Callable[ + [NestedObjectWithRequiredField.Validators._PreRootValidator], + NestedObjectWithRequiredField.Validators._PreRootValidator, + ]: + ... + + @classmethod + def root(cls, *, pre: bool = False) -> typing.Any: + def decorator(validator: typing.Any) -> typing.Any: + if pre: + cls._pre_validators.append(validator) + else: + cls._post_validators.append(validator) + return validator + + return decorator + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["string"], *, pre: typing.Literal[True] + ) -> typing.Callable[ + [NestedObjectWithRequiredField.Validators.PreStringValidator], + NestedObjectWithRequiredField.Validators.PreStringValidator, + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["string"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [NestedObjectWithRequiredField.Validators.StringValidator], + NestedObjectWithRequiredField.Validators.StringValidator, + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["nested_object"], *, pre: typing.Literal[True] + ) -> typing.Callable[ + [NestedObjectWithRequiredField.Validators.PreNestedObjectValidator], + NestedObjectWithRequiredField.Validators.PreNestedObjectValidator, + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["nested_object"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [NestedObjectWithRequiredField.Validators.NestedObjectValidator], + NestedObjectWithRequiredField.Validators.NestedObjectValidator, + ]: + ... + + @classmethod + def field(cls, field_name: str, *, pre: bool = False) -> typing.Any: + def decorator(validator: typing.Any) -> typing.Any: + if field_name == "string": + if pre: + cls._string_pre_validators.append(validator) + else: + cls._string_post_validators.append(validator) + if field_name == "nested_object": + if pre: + cls._nested_object_pre_validators.append(validator) + else: + cls._nested_object_post_validators.append(validator) + return validator + + return decorator + + class PreStringValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: NestedObjectWithRequiredField.Partial) -> typing.Any: + ... + + class StringValidator(typing.Protocol): + def __call__(self, __v: str, __values: NestedObjectWithRequiredField.Partial) -> str: + ... + + class PreNestedObjectValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: NestedObjectWithRequiredField.Partial) -> typing.Any: + ... + + class NestedObjectValidator(typing.Protocol): + def __call__( + self, __v: ObjectWithOptionalField, __values: NestedObjectWithRequiredField.Partial + ) -> ObjectWithOptionalField: + ... + + class _PreRootValidator(typing.Protocol): + def __call__(self, __values: typing.Any) -> typing.Any: + ... + + class _RootValidator(typing.Protocol): + def __call__( + self, __values: NestedObjectWithRequiredField.Partial + ) -> NestedObjectWithRequiredField.Partial: + ... + + @universal_root_validator(pre=True) + def _pre_validate_types_nested_object_with_required_field( + cls, values: NestedObjectWithRequiredField.Partial + ) -> NestedObjectWithRequiredField.Partial: + for validator in NestedObjectWithRequiredField.Validators._pre_validators: + values = validator(values) + return values + + @universal_root_validator(pre=False) + def _post_validate_types_nested_object_with_required_field( + cls, values: NestedObjectWithRequiredField.Partial + ) -> NestedObjectWithRequiredField.Partial: + for validator in NestedObjectWithRequiredField.Validators._post_validators: + values = validator(values) + return values + + @universal_field_validator("string", pre=True) + def _pre_validate_string(cls, v: str, values: NestedObjectWithRequiredField.Partial) -> str: + for validator in NestedObjectWithRequiredField.Validators._string_pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("string", pre=False) + def _post_validate_string(cls, v: str, values: NestedObjectWithRequiredField.Partial) -> str: + for validator in NestedObjectWithRequiredField.Validators._string_post_validators: + v = validator(v, values) + return v + + @universal_field_validator("nested_object", pre=True) + def _pre_validate_nested_object( + cls, v: ObjectWithOptionalField, values: NestedObjectWithRequiredField.Partial + ) -> ObjectWithOptionalField: + for validator in NestedObjectWithRequiredField.Validators._nested_object_pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("nested_object", pre=False) + def _post_validate_nested_object( + cls, v: ObjectWithOptionalField, values: NestedObjectWithRequiredField.Partial + ) -> ObjectWithOptionalField: + for validator in NestedObjectWithRequiredField.Validators._nested_object_post_validators: + v = validator(v, values) + return v + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="forbid") # type: ignore # Pydantic v2 + else: + + class Config: + extra = pydantic.Extra.forbid diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/types/object_with_map_of_map.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/types/object_with_map_of_map.py new file mode 100644 index 00000000000..2b0fddac2dc --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/types/object_with_map_of_map.py @@ -0,0 +1,154 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions + +from ......core.pydantic_utilities import ( + IS_PYDANTIC_V2, + UniversalBaseModel, + universal_field_validator, + universal_root_validator, +) + + +class ObjectWithMapOfMap(UniversalBaseModel): + map_: typing.Dict[str, typing.Dict[str, str]] = pydantic.Field(alias="map") + + class Partial(typing.TypedDict): + map_: typing_extensions.NotRequired[typing.Dict[str, typing.Dict[str, str]]] + + class Validators: + """ + Use this class to add validators to the Pydantic model. + + @ObjectWithMapOfMap.Validators.root() + def validate(values: ObjectWithMapOfMap.Partial) -> ObjectWithMapOfMap.Partial: + ... + + @ObjectWithMapOfMap.Validators.field("map_") + def validate_map_(map_: typing.Dict[str, typing.Dict[str, str]], values: ObjectWithMapOfMap.Partial) -> typing.Dict[str, typing.Dict[str, str]]: + ... + """ + + _pre_validators: typing.ClassVar[typing.List[ObjectWithMapOfMap.Validators._PreRootValidator]] = [] + _post_validators: typing.ClassVar[typing.List[ObjectWithMapOfMap.Validators._RootValidator]] = [] + _map__pre_validators: typing.ClassVar[typing.List[ObjectWithMapOfMap.Validators.PreMapValidator]] = [] + _map__post_validators: typing.ClassVar[typing.List[ObjectWithMapOfMap.Validators.MapValidator]] = [] + + @typing.overload + @classmethod + def root( + cls, *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [ObjectWithMapOfMap.Validators._RootValidator], ObjectWithMapOfMap.Validators._RootValidator + ]: + ... + + @typing.overload + @classmethod + def root( + cls, *, pre: typing.Literal[True] + ) -> typing.Callable[ + [ObjectWithMapOfMap.Validators._PreRootValidator], ObjectWithMapOfMap.Validators._PreRootValidator + ]: + ... + + @classmethod + def root(cls, *, pre: bool = False) -> typing.Any: + def decorator(validator: typing.Any) -> typing.Any: + if pre: + cls._pre_validators.append(validator) + else: + cls._post_validators.append(validator) + return validator + + return decorator + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["map_"], *, pre: typing.Literal[True] + ) -> typing.Callable[ + [ObjectWithMapOfMap.Validators.PreMapValidator], ObjectWithMapOfMap.Validators.PreMapValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["map_"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[[ObjectWithMapOfMap.Validators.MapValidator], ObjectWithMapOfMap.Validators.MapValidator]: + ... + + @classmethod + def field(cls, field_name: str, *, pre: bool = False) -> typing.Any: + def decorator(validator: typing.Any) -> typing.Any: + if field_name == "map_": + if pre: + cls._map__pre_validators.append(validator) + else: + cls._map__post_validators.append(validator) + return validator + + return decorator + + class PreMapValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: ObjectWithMapOfMap.Partial) -> typing.Any: + ... + + class MapValidator(typing.Protocol): + def __call__( + self, __v: typing.Dict[str, typing.Dict[str, str]], __values: ObjectWithMapOfMap.Partial + ) -> typing.Dict[str, typing.Dict[str, str]]: + ... + + class _PreRootValidator(typing.Protocol): + def __call__(self, __values: typing.Any) -> typing.Any: + ... + + class _RootValidator(typing.Protocol): + def __call__(self, __values: ObjectWithMapOfMap.Partial) -> ObjectWithMapOfMap.Partial: + ... + + @universal_root_validator(pre=True) + def _pre_validate_types_object_with_map_of_map( + cls, values: ObjectWithMapOfMap.Partial + ) -> ObjectWithMapOfMap.Partial: + for validator in ObjectWithMapOfMap.Validators._pre_validators: + values = validator(values) + return values + + @universal_root_validator(pre=False) + def _post_validate_types_object_with_map_of_map( + cls, values: ObjectWithMapOfMap.Partial + ) -> ObjectWithMapOfMap.Partial: + for validator in ObjectWithMapOfMap.Validators._post_validators: + values = validator(values) + return values + + @universal_field_validator("map_", pre=True) + def _pre_validate_map_( + cls, v: typing.Dict[str, typing.Dict[str, str]], values: ObjectWithMapOfMap.Partial + ) -> typing.Dict[str, typing.Dict[str, str]]: + for validator in ObjectWithMapOfMap.Validators._map__pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("map_", pre=False) + def _post_validate_map_( + cls, v: typing.Dict[str, typing.Dict[str, str]], values: ObjectWithMapOfMap.Partial + ) -> typing.Dict[str, typing.Dict[str, str]]: + for validator in ObjectWithMapOfMap.Validators._map__post_validators: + v = validator(v, values) + return v + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="forbid") # type: ignore # Pydantic v2 + else: + + class Config: + extra = pydantic.Extra.forbid diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/types/object_with_optional_field.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/types/object_with_optional_field.py new file mode 100644 index 00000000000..32bd755f463 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/types/object_with_optional_field.py @@ -0,0 +1,860 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing +import uuid + +import pydantic +import typing_extensions + +from ......core.pydantic_utilities import ( + IS_PYDANTIC_V2, + UniversalBaseModel, + universal_field_validator, + universal_root_validator, +) + + +class ObjectWithOptionalField(UniversalBaseModel): + string: typing.Optional[str] = pydantic.Field(default=None) + """ + This is a rather long descriptor of this single field in a more complex type. If you ask me I think this is a pretty good description for this field all things considered. + """ + + integer: typing.Optional[int] = None + long_: typing.Optional[int] = pydantic.Field(alias="long", default=None) + double: typing.Optional[float] = None + bool_: typing.Optional[bool] = pydantic.Field(alias="bool", default=None) + datetime: typing.Optional[dt.datetime] = None + date: typing.Optional[dt.date] = None + uuid_: typing.Optional[uuid.UUID] = pydantic.Field(alias="uuid", default=None) + base_64: typing.Optional[str] = pydantic.Field(alias="base64", default=None) + list_: typing.Optional[typing.List[str]] = pydantic.Field(alias="list", default=None) + set_: typing.Optional[typing.Set[str]] = pydantic.Field(alias="set", default=None) + map_: typing.Optional[typing.Dict[int, str]] = pydantic.Field(alias="map", default=None) + bigint: typing.Optional[str] = None + + class Partial(typing.TypedDict): + string: typing_extensions.NotRequired[typing.Optional[str]] + integer: typing_extensions.NotRequired[typing.Optional[int]] + long_: typing_extensions.NotRequired[typing.Optional[int]] + double: typing_extensions.NotRequired[typing.Optional[float]] + bool_: typing_extensions.NotRequired[typing.Optional[bool]] + datetime: typing_extensions.NotRequired[typing.Optional[dt.datetime]] + date: typing_extensions.NotRequired[typing.Optional[dt.date]] + uuid_: typing_extensions.NotRequired[typing.Optional[uuid.UUID]] + base_64: typing_extensions.NotRequired[typing.Optional[str]] + list_: typing_extensions.NotRequired[typing.Optional[typing.List[str]]] + set_: typing_extensions.NotRequired[typing.Optional[typing.Set[str]]] + map_: typing_extensions.NotRequired[typing.Optional[typing.Dict[int, str]]] + bigint: typing_extensions.NotRequired[typing.Optional[str]] + + class Validators: + """ + Use this class to add validators to the Pydantic model. + + @ObjectWithOptionalField.Validators.root() + def validate(values: ObjectWithOptionalField.Partial) -> ObjectWithOptionalField.Partial: + ... + + @ObjectWithOptionalField.Validators.field("string") + def validate_string(string: typing.Optional[str], values: ObjectWithOptionalField.Partial) -> typing.Optional[str]: + ... + + @ObjectWithOptionalField.Validators.field("integer") + def validate_integer(integer: typing.Optional[int], values: ObjectWithOptionalField.Partial) -> typing.Optional[int]: + ... + + @ObjectWithOptionalField.Validators.field("long_") + def validate_long_(long_: typing.Optional[int], values: ObjectWithOptionalField.Partial) -> typing.Optional[int]: + ... + + @ObjectWithOptionalField.Validators.field("double") + def validate_double(double: typing.Optional[float], values: ObjectWithOptionalField.Partial) -> typing.Optional[float]: + ... + + @ObjectWithOptionalField.Validators.field("bool_") + def validate_bool_(bool_: typing.Optional[bool], values: ObjectWithOptionalField.Partial) -> typing.Optional[bool]: + ... + + @ObjectWithOptionalField.Validators.field("datetime") + def validate_datetime(datetime: typing.Optional[dt.datetime], values: ObjectWithOptionalField.Partial) -> typing.Optional[dt.datetime]: + ... + + @ObjectWithOptionalField.Validators.field("date") + def validate_date(date: typing.Optional[dt.date], values: ObjectWithOptionalField.Partial) -> typing.Optional[dt.date]: + ... + + @ObjectWithOptionalField.Validators.field("uuid_") + def validate_uuid_(uuid_: typing.Optional[uuid.UUID], values: ObjectWithOptionalField.Partial) -> typing.Optional[uuid.UUID]: + ... + + @ObjectWithOptionalField.Validators.field("base_64") + def validate_base_64(base_64: typing.Optional[str], values: ObjectWithOptionalField.Partial) -> typing.Optional[str]: + ... + + @ObjectWithOptionalField.Validators.field("list_") + def validate_list_(list_: typing.Optional[typing.List[str]], values: ObjectWithOptionalField.Partial) -> typing.Optional[typing.List[str]]: + ... + + @ObjectWithOptionalField.Validators.field("set_") + def validate_set_(set_: typing.Optional[typing.Set[str]], values: ObjectWithOptionalField.Partial) -> typing.Optional[typing.Set[str]]: + ... + + @ObjectWithOptionalField.Validators.field("map_") + def validate_map_(map_: typing.Optional[typing.Dict[int, str]], values: ObjectWithOptionalField.Partial) -> typing.Optional[typing.Dict[int, str]]: + ... + + @ObjectWithOptionalField.Validators.field("bigint") + def validate_bigint(bigint: typing.Optional[str], values: ObjectWithOptionalField.Partial) -> typing.Optional[str]: + ... + """ + + _pre_validators: typing.ClassVar[typing.List[ObjectWithOptionalField.Validators._PreRootValidator]] = [] + _post_validators: typing.ClassVar[typing.List[ObjectWithOptionalField.Validators._RootValidator]] = [] + _string_pre_validators: typing.ClassVar[typing.List[ObjectWithOptionalField.Validators.PreStringValidator]] = [] + _string_post_validators: typing.ClassVar[typing.List[ObjectWithOptionalField.Validators.StringValidator]] = [] + _integer_pre_validators: typing.ClassVar[ + typing.List[ObjectWithOptionalField.Validators.PreIntegerValidator] + ] = [] + _integer_post_validators: typing.ClassVar[typing.List[ObjectWithOptionalField.Validators.IntegerValidator]] = [] + _long__pre_validators: typing.ClassVar[typing.List[ObjectWithOptionalField.Validators.PreLongValidator]] = [] + _long__post_validators: typing.ClassVar[typing.List[ObjectWithOptionalField.Validators.LongValidator]] = [] + _double_pre_validators: typing.ClassVar[typing.List[ObjectWithOptionalField.Validators.PreDoubleValidator]] = [] + _double_post_validators: typing.ClassVar[typing.List[ObjectWithOptionalField.Validators.DoubleValidator]] = [] + _bool__pre_validators: typing.ClassVar[typing.List[ObjectWithOptionalField.Validators.PreBoolValidator]] = [] + _bool__post_validators: typing.ClassVar[typing.List[ObjectWithOptionalField.Validators.BoolValidator]] = [] + _datetime_pre_validators: typing.ClassVar[ + typing.List[ObjectWithOptionalField.Validators.PreDatetimeValidator] + ] = [] + _datetime_post_validators: typing.ClassVar[ + typing.List[ObjectWithOptionalField.Validators.DatetimeValidator] + ] = [] + _date_pre_validators: typing.ClassVar[typing.List[ObjectWithOptionalField.Validators.PreDateValidator]] = [] + _date_post_validators: typing.ClassVar[typing.List[ObjectWithOptionalField.Validators.DateValidator]] = [] + _uuid__pre_validators: typing.ClassVar[typing.List[ObjectWithOptionalField.Validators.PreUuidValidator]] = [] + _uuid__post_validators: typing.ClassVar[typing.List[ObjectWithOptionalField.Validators.UuidValidator]] = [] + _base_64_pre_validators: typing.ClassVar[ + typing.List[ObjectWithOptionalField.Validators.PreBase64Validator] + ] = [] + _base_64_post_validators: typing.ClassVar[typing.List[ObjectWithOptionalField.Validators.Base64Validator]] = [] + _list__pre_validators: typing.ClassVar[typing.List[ObjectWithOptionalField.Validators.PreListValidator]] = [] + _list__post_validators: typing.ClassVar[typing.List[ObjectWithOptionalField.Validators.ListValidator]] = [] + _set__pre_validators: typing.ClassVar[typing.List[ObjectWithOptionalField.Validators.PreSetValidator]] = [] + _set__post_validators: typing.ClassVar[typing.List[ObjectWithOptionalField.Validators.SetValidator]] = [] + _map__pre_validators: typing.ClassVar[typing.List[ObjectWithOptionalField.Validators.PreMapValidator]] = [] + _map__post_validators: typing.ClassVar[typing.List[ObjectWithOptionalField.Validators.MapValidator]] = [] + _bigint_pre_validators: typing.ClassVar[typing.List[ObjectWithOptionalField.Validators.PreBigintValidator]] = [] + _bigint_post_validators: typing.ClassVar[typing.List[ObjectWithOptionalField.Validators.BigintValidator]] = [] + + @typing.overload + @classmethod + def root( + cls, *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators._RootValidator], ObjectWithOptionalField.Validators._RootValidator + ]: + ... + + @typing.overload + @classmethod + def root( + cls, *, pre: typing.Literal[True] + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators._PreRootValidator], ObjectWithOptionalField.Validators._PreRootValidator + ]: + ... + + @classmethod + def root(cls, *, pre: bool = False) -> typing.Any: + def decorator(validator: typing.Any) -> typing.Any: + if pre: + cls._pre_validators.append(validator) + else: + cls._post_validators.append(validator) + return validator + + return decorator + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["string"], *, pre: typing.Literal[True] + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.PreStringValidator], + ObjectWithOptionalField.Validators.PreStringValidator, + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["string"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.StringValidator], ObjectWithOptionalField.Validators.StringValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["integer"], *, pre: typing.Literal[True] + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.PreIntegerValidator], + ObjectWithOptionalField.Validators.PreIntegerValidator, + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["integer"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.IntegerValidator], ObjectWithOptionalField.Validators.IntegerValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["long_"], *, pre: typing.Literal[True] + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.PreLongValidator], ObjectWithOptionalField.Validators.PreLongValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["long_"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.LongValidator], ObjectWithOptionalField.Validators.LongValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["double"], *, pre: typing.Literal[True] + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.PreDoubleValidator], + ObjectWithOptionalField.Validators.PreDoubleValidator, + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["double"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.DoubleValidator], ObjectWithOptionalField.Validators.DoubleValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["bool_"], *, pre: typing.Literal[True] + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.PreBoolValidator], ObjectWithOptionalField.Validators.PreBoolValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["bool_"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.BoolValidator], ObjectWithOptionalField.Validators.BoolValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["datetime"], *, pre: typing.Literal[True] + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.PreDatetimeValidator], + ObjectWithOptionalField.Validators.PreDatetimeValidator, + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["datetime"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.DatetimeValidator], ObjectWithOptionalField.Validators.DatetimeValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["date"], *, pre: typing.Literal[True] + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.PreDateValidator], ObjectWithOptionalField.Validators.PreDateValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["date"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.DateValidator], ObjectWithOptionalField.Validators.DateValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["uuid_"], *, pre: typing.Literal[True] + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.PreUuidValidator], ObjectWithOptionalField.Validators.PreUuidValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["uuid_"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.UuidValidator], ObjectWithOptionalField.Validators.UuidValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["base_64"], *, pre: typing.Literal[True] + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.PreBase64Validator], + ObjectWithOptionalField.Validators.PreBase64Validator, + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["base_64"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.Base64Validator], ObjectWithOptionalField.Validators.Base64Validator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["list_"], *, pre: typing.Literal[True] + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.PreListValidator], ObjectWithOptionalField.Validators.PreListValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["list_"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.ListValidator], ObjectWithOptionalField.Validators.ListValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["set_"], *, pre: typing.Literal[True] + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.PreSetValidator], ObjectWithOptionalField.Validators.PreSetValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["set_"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.SetValidator], ObjectWithOptionalField.Validators.SetValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["map_"], *, pre: typing.Literal[True] + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.PreMapValidator], ObjectWithOptionalField.Validators.PreMapValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["map_"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.MapValidator], ObjectWithOptionalField.Validators.MapValidator + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["bigint"], *, pre: typing.Literal[True] + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.PreBigintValidator], + ObjectWithOptionalField.Validators.PreBigintValidator, + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["bigint"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [ObjectWithOptionalField.Validators.BigintValidator], ObjectWithOptionalField.Validators.BigintValidator + ]: + ... + + @classmethod + def field(cls, field_name: str, *, pre: bool = False) -> typing.Any: + def decorator(validator: typing.Any) -> typing.Any: + if field_name == "string": + if pre: + cls._string_pre_validators.append(validator) + else: + cls._string_post_validators.append(validator) + if field_name == "integer": + if pre: + cls._integer_pre_validators.append(validator) + else: + cls._integer_post_validators.append(validator) + if field_name == "long_": + if pre: + cls._long__pre_validators.append(validator) + else: + cls._long__post_validators.append(validator) + if field_name == "double": + if pre: + cls._double_pre_validators.append(validator) + else: + cls._double_post_validators.append(validator) + if field_name == "bool_": + if pre: + cls._bool__pre_validators.append(validator) + else: + cls._bool__post_validators.append(validator) + if field_name == "datetime": + if pre: + cls._datetime_pre_validators.append(validator) + else: + cls._datetime_post_validators.append(validator) + if field_name == "date": + if pre: + cls._date_pre_validators.append(validator) + else: + cls._date_post_validators.append(validator) + if field_name == "uuid_": + if pre: + cls._uuid__pre_validators.append(validator) + else: + cls._uuid__post_validators.append(validator) + if field_name == "base_64": + if pre: + cls._base_64_pre_validators.append(validator) + else: + cls._base_64_post_validators.append(validator) + if field_name == "list_": + if pre: + cls._list__pre_validators.append(validator) + else: + cls._list__post_validators.append(validator) + if field_name == "set_": + if pre: + cls._set__pre_validators.append(validator) + else: + cls._set__post_validators.append(validator) + if field_name == "map_": + if pre: + cls._map__pre_validators.append(validator) + else: + cls._map__post_validators.append(validator) + if field_name == "bigint": + if pre: + cls._bigint_pre_validators.append(validator) + else: + cls._bigint_post_validators.append(validator) + return validator + + return decorator + + class PreStringValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: ObjectWithOptionalField.Partial) -> typing.Any: + ... + + class StringValidator(typing.Protocol): + def __call__( + self, __v: typing.Optional[str], __values: ObjectWithOptionalField.Partial + ) -> typing.Optional[str]: + ... + + class PreIntegerValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: ObjectWithOptionalField.Partial) -> typing.Any: + ... + + class IntegerValidator(typing.Protocol): + def __call__( + self, __v: typing.Optional[int], __values: ObjectWithOptionalField.Partial + ) -> typing.Optional[int]: + ... + + class PreLongValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: ObjectWithOptionalField.Partial) -> typing.Any: + ... + + class LongValidator(typing.Protocol): + def __call__( + self, __v: typing.Optional[int], __values: ObjectWithOptionalField.Partial + ) -> typing.Optional[int]: + ... + + class PreDoubleValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: ObjectWithOptionalField.Partial) -> typing.Any: + ... + + class DoubleValidator(typing.Protocol): + def __call__( + self, __v: typing.Optional[float], __values: ObjectWithOptionalField.Partial + ) -> typing.Optional[float]: + ... + + class PreBoolValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: ObjectWithOptionalField.Partial) -> typing.Any: + ... + + class BoolValidator(typing.Protocol): + def __call__( + self, __v: typing.Optional[bool], __values: ObjectWithOptionalField.Partial + ) -> typing.Optional[bool]: + ... + + class PreDatetimeValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: ObjectWithOptionalField.Partial) -> typing.Any: + ... + + class DatetimeValidator(typing.Protocol): + def __call__( + self, __v: typing.Optional[dt.datetime], __values: ObjectWithOptionalField.Partial + ) -> typing.Optional[dt.datetime]: + ... + + class PreDateValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: ObjectWithOptionalField.Partial) -> typing.Any: + ... + + class DateValidator(typing.Protocol): + def __call__( + self, __v: typing.Optional[dt.date], __values: ObjectWithOptionalField.Partial + ) -> typing.Optional[dt.date]: + ... + + class PreUuidValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: ObjectWithOptionalField.Partial) -> typing.Any: + ... + + class UuidValidator(typing.Protocol): + def __call__( + self, __v: typing.Optional[uuid.UUID], __values: ObjectWithOptionalField.Partial + ) -> typing.Optional[uuid.UUID]: + ... + + class PreBase64Validator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: ObjectWithOptionalField.Partial) -> typing.Any: + ... + + class Base64Validator(typing.Protocol): + def __call__( + self, __v: typing.Optional[str], __values: ObjectWithOptionalField.Partial + ) -> typing.Optional[str]: + ... + + class PreListValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: ObjectWithOptionalField.Partial) -> typing.Any: + ... + + class ListValidator(typing.Protocol): + def __call__( + self, __v: typing.Optional[typing.List[str]], __values: ObjectWithOptionalField.Partial + ) -> typing.Optional[typing.List[str]]: + ... + + class PreSetValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: ObjectWithOptionalField.Partial) -> typing.Any: + ... + + class SetValidator(typing.Protocol): + def __call__( + self, __v: typing.Optional[typing.Set[str]], __values: ObjectWithOptionalField.Partial + ) -> typing.Optional[typing.Set[str]]: + ... + + class PreMapValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: ObjectWithOptionalField.Partial) -> typing.Any: + ... + + class MapValidator(typing.Protocol): + def __call__( + self, __v: typing.Optional[typing.Dict[int, str]], __values: ObjectWithOptionalField.Partial + ) -> typing.Optional[typing.Dict[int, str]]: + ... + + class PreBigintValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: ObjectWithOptionalField.Partial) -> typing.Any: + ... + + class BigintValidator(typing.Protocol): + def __call__( + self, __v: typing.Optional[str], __values: ObjectWithOptionalField.Partial + ) -> typing.Optional[str]: + ... + + class _PreRootValidator(typing.Protocol): + def __call__(self, __values: typing.Any) -> typing.Any: + ... + + class _RootValidator(typing.Protocol): + def __call__(self, __values: ObjectWithOptionalField.Partial) -> ObjectWithOptionalField.Partial: + ... + + @universal_root_validator(pre=True) + def _pre_validate_types_object_with_optional_field( + cls, values: ObjectWithOptionalField.Partial + ) -> ObjectWithOptionalField.Partial: + for validator in ObjectWithOptionalField.Validators._pre_validators: + values = validator(values) + return values + + @universal_root_validator(pre=False) + def _post_validate_types_object_with_optional_field( + cls, values: ObjectWithOptionalField.Partial + ) -> ObjectWithOptionalField.Partial: + for validator in ObjectWithOptionalField.Validators._post_validators: + values = validator(values) + return values + + @universal_field_validator("string", pre=True) + def _pre_validate_string( + cls, v: typing.Optional[str], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[str]: + for validator in ObjectWithOptionalField.Validators._string_pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("string", pre=False) + def _post_validate_string( + cls, v: typing.Optional[str], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[str]: + for validator in ObjectWithOptionalField.Validators._string_post_validators: + v = validator(v, values) + return v + + @universal_field_validator("integer", pre=True) + def _pre_validate_integer( + cls, v: typing.Optional[int], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[int]: + for validator in ObjectWithOptionalField.Validators._integer_pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("integer", pre=False) + def _post_validate_integer( + cls, v: typing.Optional[int], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[int]: + for validator in ObjectWithOptionalField.Validators._integer_post_validators: + v = validator(v, values) + return v + + @universal_field_validator("long_", pre=True) + def _pre_validate_long_( + cls, v: typing.Optional[int], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[int]: + for validator in ObjectWithOptionalField.Validators._long__pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("long_", pre=False) + def _post_validate_long_( + cls, v: typing.Optional[int], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[int]: + for validator in ObjectWithOptionalField.Validators._long__post_validators: + v = validator(v, values) + return v + + @universal_field_validator("double", pre=True) + def _pre_validate_double( + cls, v: typing.Optional[float], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[float]: + for validator in ObjectWithOptionalField.Validators._double_pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("double", pre=False) + def _post_validate_double( + cls, v: typing.Optional[float], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[float]: + for validator in ObjectWithOptionalField.Validators._double_post_validators: + v = validator(v, values) + return v + + @universal_field_validator("bool_", pre=True) + def _pre_validate_bool_( + cls, v: typing.Optional[bool], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[bool]: + for validator in ObjectWithOptionalField.Validators._bool__pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("bool_", pre=False) + def _post_validate_bool_( + cls, v: typing.Optional[bool], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[bool]: + for validator in ObjectWithOptionalField.Validators._bool__post_validators: + v = validator(v, values) + return v + + @universal_field_validator("datetime", pre=True) + def _pre_validate_datetime( + cls, v: typing.Optional[dt.datetime], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[dt.datetime]: + for validator in ObjectWithOptionalField.Validators._datetime_pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("datetime", pre=False) + def _post_validate_datetime( + cls, v: typing.Optional[dt.datetime], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[dt.datetime]: + for validator in ObjectWithOptionalField.Validators._datetime_post_validators: + v = validator(v, values) + return v + + @universal_field_validator("date", pre=True) + def _pre_validate_date( + cls, v: typing.Optional[dt.date], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[dt.date]: + for validator in ObjectWithOptionalField.Validators._date_pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("date", pre=False) + def _post_validate_date( + cls, v: typing.Optional[dt.date], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[dt.date]: + for validator in ObjectWithOptionalField.Validators._date_post_validators: + v = validator(v, values) + return v + + @universal_field_validator("uuid_", pre=True) + def _pre_validate_uuid_( + cls, v: typing.Optional[uuid.UUID], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[uuid.UUID]: + for validator in ObjectWithOptionalField.Validators._uuid__pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("uuid_", pre=False) + def _post_validate_uuid_( + cls, v: typing.Optional[uuid.UUID], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[uuid.UUID]: + for validator in ObjectWithOptionalField.Validators._uuid__post_validators: + v = validator(v, values) + return v + + @universal_field_validator("base_64", pre=True) + def _pre_validate_base_64( + cls, v: typing.Optional[str], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[str]: + for validator in ObjectWithOptionalField.Validators._base_64_pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("base_64", pre=False) + def _post_validate_base_64( + cls, v: typing.Optional[str], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[str]: + for validator in ObjectWithOptionalField.Validators._base_64_post_validators: + v = validator(v, values) + return v + + @universal_field_validator("list_", pre=True) + def _pre_validate_list_( + cls, v: typing.Optional[typing.List[str]], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[typing.List[str]]: + for validator in ObjectWithOptionalField.Validators._list__pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("list_", pre=False) + def _post_validate_list_( + cls, v: typing.Optional[typing.List[str]], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[typing.List[str]]: + for validator in ObjectWithOptionalField.Validators._list__post_validators: + v = validator(v, values) + return v + + @universal_field_validator("set_", pre=True) + def _pre_validate_set_( + cls, v: typing.Optional[typing.Set[str]], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[typing.Set[str]]: + for validator in ObjectWithOptionalField.Validators._set__pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("set_", pre=False) + def _post_validate_set_( + cls, v: typing.Optional[typing.Set[str]], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[typing.Set[str]]: + for validator in ObjectWithOptionalField.Validators._set__post_validators: + v = validator(v, values) + return v + + @universal_field_validator("map_", pre=True) + def _pre_validate_map_( + cls, v: typing.Optional[typing.Dict[int, str]], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[typing.Dict[int, str]]: + for validator in ObjectWithOptionalField.Validators._map__pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("map_", pre=False) + def _post_validate_map_( + cls, v: typing.Optional[typing.Dict[int, str]], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[typing.Dict[int, str]]: + for validator in ObjectWithOptionalField.Validators._map__post_validators: + v = validator(v, values) + return v + + @universal_field_validator("bigint", pre=True) + def _pre_validate_bigint( + cls, v: typing.Optional[str], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[str]: + for validator in ObjectWithOptionalField.Validators._bigint_pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("bigint", pre=False) + def _post_validate_bigint( + cls, v: typing.Optional[str], values: ObjectWithOptionalField.Partial + ) -> typing.Optional[str]: + for validator in ObjectWithOptionalField.Validators._bigint_post_validators: + v = validator(v, values) + return v + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="forbid") # type: ignore # Pydantic v2 + else: + + class Config: + extra = pydantic.Extra.forbid diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/types/object_with_required_field.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/types/object_with_required_field.py new file mode 100644 index 00000000000..dfbb08f7974 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/types/object_with_required_field.py @@ -0,0 +1,151 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions + +from ......core.pydantic_utilities import ( + IS_PYDANTIC_V2, + UniversalBaseModel, + universal_field_validator, + universal_root_validator, +) + + +class ObjectWithRequiredField(UniversalBaseModel): + string: str + + class Partial(typing.TypedDict): + string: typing_extensions.NotRequired[str] + + class Validators: + """ + Use this class to add validators to the Pydantic model. + + @ObjectWithRequiredField.Validators.root() + def validate(values: ObjectWithRequiredField.Partial) -> ObjectWithRequiredField.Partial: + ... + + @ObjectWithRequiredField.Validators.field("string") + def validate_string(string: str, values: ObjectWithRequiredField.Partial) -> str: + ... + """ + + _pre_validators: typing.ClassVar[typing.List[ObjectWithRequiredField.Validators._PreRootValidator]] = [] + _post_validators: typing.ClassVar[typing.List[ObjectWithRequiredField.Validators._RootValidator]] = [] + _string_pre_validators: typing.ClassVar[typing.List[ObjectWithRequiredField.Validators.PreStringValidator]] = [] + _string_post_validators: typing.ClassVar[typing.List[ObjectWithRequiredField.Validators.StringValidator]] = [] + + @typing.overload + @classmethod + def root( + cls, *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [ObjectWithRequiredField.Validators._RootValidator], ObjectWithRequiredField.Validators._RootValidator + ]: + ... + + @typing.overload + @classmethod + def root( + cls, *, pre: typing.Literal[True] + ) -> typing.Callable[ + [ObjectWithRequiredField.Validators._PreRootValidator], ObjectWithRequiredField.Validators._PreRootValidator + ]: + ... + + @classmethod + def root(cls, *, pre: bool = False) -> typing.Any: + def decorator(validator: typing.Any) -> typing.Any: + if pre: + cls._pre_validators.append(validator) + else: + cls._post_validators.append(validator) + return validator + + return decorator + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["string"], *, pre: typing.Literal[True] + ) -> typing.Callable[ + [ObjectWithRequiredField.Validators.PreStringValidator], + ObjectWithRequiredField.Validators.PreStringValidator, + ]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["string"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[ + [ObjectWithRequiredField.Validators.StringValidator], ObjectWithRequiredField.Validators.StringValidator + ]: + ... + + @classmethod + def field(cls, field_name: str, *, pre: bool = False) -> typing.Any: + def decorator(validator: typing.Any) -> typing.Any: + if field_name == "string": + if pre: + cls._string_pre_validators.append(validator) + else: + cls._string_post_validators.append(validator) + return validator + + return decorator + + class PreStringValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: ObjectWithRequiredField.Partial) -> typing.Any: + ... + + class StringValidator(typing.Protocol): + def __call__(self, __v: str, __values: ObjectWithRequiredField.Partial) -> str: + ... + + class _PreRootValidator(typing.Protocol): + def __call__(self, __values: typing.Any) -> typing.Any: + ... + + class _RootValidator(typing.Protocol): + def __call__(self, __values: ObjectWithRequiredField.Partial) -> ObjectWithRequiredField.Partial: + ... + + @universal_root_validator(pre=True) + def _pre_validate_types_object_with_required_field( + cls, values: ObjectWithRequiredField.Partial + ) -> ObjectWithRequiredField.Partial: + for validator in ObjectWithRequiredField.Validators._pre_validators: + values = validator(values) + return values + + @universal_root_validator(pre=False) + def _post_validate_types_object_with_required_field( + cls, values: ObjectWithRequiredField.Partial + ) -> ObjectWithRequiredField.Partial: + for validator in ObjectWithRequiredField.Validators._post_validators: + values = validator(values) + return values + + @universal_field_validator("string", pre=True) + def _pre_validate_string(cls, v: str, values: ObjectWithRequiredField.Partial) -> str: + for validator in ObjectWithRequiredField.Validators._string_pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("string", pre=False) + def _post_validate_string(cls, v: str, values: ObjectWithRequiredField.Partial) -> str: + for validator in ObjectWithRequiredField.Validators._string_post_validators: + v = validator(v, values) + return v + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="forbid") # type: ignore # Pydantic v2 + else: + + class Config: + extra = pydantic.Extra.forbid diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/types/optional_alias.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/types/optional_alias.py new file mode 100644 index 00000000000..fa09e3be001 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/object/types/optional_alias.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +OptionalAlias = typing.Optional[str] diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/union/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/union/__init__.py new file mode 100644 index 00000000000..8033ac545f0 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/union/__init__.py @@ -0,0 +1,6 @@ +# This file was auto-generated by Fern from our API Definition. + +from .errors import ErrorWithUnionBody +from .types import Animal, Cat, Dog + +__all__ = ["Animal", "Cat", "Dog", "ErrorWithUnionBody"] diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/union/errors/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/union/errors/__init__.py new file mode 100644 index 00000000000..568a71fa3c4 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/union/errors/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .error_with_union_body import ErrorWithUnionBody + +__all__ = ["ErrorWithUnionBody"] diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/union/errors/error_with_union_body.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/union/errors/error_with_union_body.py new file mode 100644 index 00000000000..d4343a0aea5 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/union/errors/error_with_union_body.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +from ......core.exceptions.fern_http_exception import FernHTTPException +from ..types.animal import Animal + + +class ErrorWithUnionBody(FernHTTPException): + def __init__(self, error: Animal): + super().__init__(status_code=400, name="ErrorWithUnionBody", content=error) diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/union/types/__init__.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/union/types/__init__.py new file mode 100644 index 00000000000..e8c68486eda --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/union/types/__init__.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +from .animal import Animal +from .cat import Cat +from .dog import Dog + +__all__ = ["Animal", "Cat", "Dog"] diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/union/types/animal.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/union/types/animal.py new file mode 100644 index 00000000000..36f3b33e669 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/union/types/animal.py @@ -0,0 +1,143 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions + +from ......core.pydantic_utilities import ( + IS_PYDANTIC_V2, + UniversalRootModel, + universal_root_validator, + update_forward_refs, +) +from .cat import Cat as resources_types_resources_union_types_cat_Cat +from .dog import Dog as resources_types_resources_union_types_dog_Dog + +T_Result = typing.TypeVar("T_Result") + + +class _Factory: + def dog(self, value: resources_types_resources_union_types_dog_Dog) -> Animal: + if IS_PYDANTIC_V2: + return Animal(root=_Animal.Dog(**value.dict(exclude_unset=True), animal="dog")) + else: + return Animal(__root__=_Animal.Dog(**value.dict(exclude_unset=True), animal="dog")) + + def cat(self, value: resources_types_resources_union_types_cat_Cat) -> Animal: + if IS_PYDANTIC_V2: + return Animal(root=_Animal.Cat(**value.dict(exclude_unset=True), animal="cat")) + else: + return Animal(__root__=_Animal.Cat(**value.dict(exclude_unset=True), animal="cat")) + + +class Animal(UniversalRootModel): + factory: typing.ClassVar[_Factory] = _Factory() + + if IS_PYDANTIC_V2: + root: typing_extensions.Annotated[ + typing.Union[_Animal.Dog, _Animal.Cat], pydantic.Field(discriminator="animal") + ] + + def get_as_union(self) -> typing.Union[_Animal.Dog, _Animal.Cat]: + return self.root + + else: + __root__: typing_extensions.Annotated[ + typing.Union[_Animal.Dog, _Animal.Cat], pydantic.Field(discriminator="animal") + ] + + def get_as_union(self) -> typing.Union[_Animal.Dog, _Animal.Cat]: + return self.__root__ + + def visit( + self, + dog: typing.Callable[[resources_types_resources_union_types_dog_Dog], T_Result], + cat: typing.Callable[[resources_types_resources_union_types_cat_Cat], T_Result], + ) -> T_Result: + unioned_value = self.get_as_union() + if unioned_value.animal == "dog": + return dog( + resources_types_resources_union_types_dog_Dog( + **unioned_value.dict(exclude_unset=True, exclude={"animal"}) + ) + ) + if unioned_value.animal == "cat": + return cat( + resources_types_resources_union_types_cat_Cat( + **unioned_value.dict(exclude_unset=True, exclude={"animal"}) + ) + ) + + class Partial(typing.TypedDict): + pass + + class Validators: + """ + Use this class to add validators to the Pydantic model. + + @Animal.Validators.root() + def validate(values: Animal.Partial) -> Animal.Partial: + ... + """ + + _pre_validators: typing.ClassVar[typing.List[Animal.Validators._PreRootValidator]] = [] + _post_validators: typing.ClassVar[typing.List[Animal.Validators._RootValidator]] = [] + + @typing.overload + @classmethod + def root( + cls, *, pre: typing.Literal[False] = False + ) -> typing.Callable[[Animal.Validators._RootValidator], Animal.Validators._RootValidator]: + ... + + @typing.overload + @classmethod + def root( + cls, *, pre: typing.Literal[True] + ) -> typing.Callable[[Animal.Validators._PreRootValidator], Animal.Validators._PreRootValidator]: + ... + + @classmethod + def root(cls, *, pre: bool = False) -> typing.Any: + def decorator(validator: typing.Any) -> typing.Any: + if pre: + cls._pre_validators.append(validator) + else: + cls._post_validators.append(validator) + return validator + + return decorator + + class _PreRootValidator(typing.Protocol): + def __call__(self, __values: typing.Any) -> typing.Any: + ... + + class _RootValidator(typing.Protocol): + def __call__(self, __values: Animal.Partial) -> Animal.Partial: + ... + + @universal_root_validator(pre=True) + def _pre_validate_types_animal(cls, values: Animal.Partial) -> Animal.Partial: + for validator in Animal.Validators._pre_validators: + values = validator(values) + return values + + @universal_root_validator(pre=False) + def _post_validate_types_animal(cls, values: Animal.Partial) -> Animal.Partial: + for validator in Animal.Validators._post_validators: + values = validator(values) + return values + + +class _Animal: + class Dog(resources_types_resources_union_types_dog_Dog): + animal: typing.Literal["dog"] = "dog" + + class Cat(resources_types_resources_union_types_cat_Cat): + animal: typing.Literal["cat"] = "cat" + + +update_forward_refs(Animal) diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/union/types/cat.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/union/types/cat.py new file mode 100644 index 00000000000..761cd2a2192 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/union/types/cat.py @@ -0,0 +1,185 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions + +from ......core.pydantic_utilities import ( + IS_PYDANTIC_V2, + UniversalBaseModel, + universal_field_validator, + universal_root_validator, +) + + +class Cat(UniversalBaseModel): + name: str + likes_to_meow: bool = pydantic.Field(alias="likesToMeow") + + class Partial(typing.TypedDict): + name: typing_extensions.NotRequired[str] + likes_to_meow: typing_extensions.NotRequired[bool] + + class Validators: + """ + Use this class to add validators to the Pydantic model. + + @Cat.Validators.root() + def validate(values: Cat.Partial) -> Cat.Partial: + ... + + @Cat.Validators.field("name") + def validate_name(name: str, values: Cat.Partial) -> str: + ... + + @Cat.Validators.field("likes_to_meow") + def validate_likes_to_meow(likes_to_meow: bool, values: Cat.Partial) -> bool: + ... + """ + + _pre_validators: typing.ClassVar[typing.List[Cat.Validators._PreRootValidator]] = [] + _post_validators: typing.ClassVar[typing.List[Cat.Validators._RootValidator]] = [] + _name_pre_validators: typing.ClassVar[typing.List[Cat.Validators.PreNameValidator]] = [] + _name_post_validators: typing.ClassVar[typing.List[Cat.Validators.NameValidator]] = [] + _likes_to_meow_pre_validators: typing.ClassVar[typing.List[Cat.Validators.PreLikesToMeowValidator]] = [] + _likes_to_meow_post_validators: typing.ClassVar[typing.List[Cat.Validators.LikesToMeowValidator]] = [] + + @typing.overload + @classmethod + def root( + cls, *, pre: typing.Literal[False] = False + ) -> typing.Callable[[Cat.Validators._RootValidator], Cat.Validators._RootValidator]: + ... + + @typing.overload + @classmethod + def root( + cls, *, pre: typing.Literal[True] + ) -> typing.Callable[[Cat.Validators._PreRootValidator], Cat.Validators._PreRootValidator]: + ... + + @classmethod + def root(cls, *, pre: bool = False) -> typing.Any: + def decorator(validator: typing.Any) -> typing.Any: + if pre: + cls._pre_validators.append(validator) + else: + cls._post_validators.append(validator) + return validator + + return decorator + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["name"], *, pre: typing.Literal[True] + ) -> typing.Callable[[Cat.Validators.PreNameValidator], Cat.Validators.PreNameValidator]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["name"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[[Cat.Validators.NameValidator], Cat.Validators.NameValidator]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["likes_to_meow"], *, pre: typing.Literal[True] + ) -> typing.Callable[[Cat.Validators.PreLikesToMeowValidator], Cat.Validators.PreLikesToMeowValidator]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["likes_to_meow"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[[Cat.Validators.LikesToMeowValidator], Cat.Validators.LikesToMeowValidator]: + ... + + @classmethod + def field(cls, field_name: str, *, pre: bool = False) -> typing.Any: + def decorator(validator: typing.Any) -> typing.Any: + if field_name == "name": + if pre: + cls._name_pre_validators.append(validator) + else: + cls._name_post_validators.append(validator) + if field_name == "likes_to_meow": + if pre: + cls._likes_to_meow_pre_validators.append(validator) + else: + cls._likes_to_meow_post_validators.append(validator) + return validator + + return decorator + + class PreNameValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: Cat.Partial) -> typing.Any: + ... + + class NameValidator(typing.Protocol): + def __call__(self, __v: str, __values: Cat.Partial) -> str: + ... + + class PreLikesToMeowValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: Cat.Partial) -> typing.Any: + ... + + class LikesToMeowValidator(typing.Protocol): + def __call__(self, __v: bool, __values: Cat.Partial) -> bool: + ... + + class _PreRootValidator(typing.Protocol): + def __call__(self, __values: typing.Any) -> typing.Any: + ... + + class _RootValidator(typing.Protocol): + def __call__(self, __values: Cat.Partial) -> Cat.Partial: + ... + + @universal_root_validator(pre=True) + def _pre_validate_types_cat(cls, values: Cat.Partial) -> Cat.Partial: + for validator in Cat.Validators._pre_validators: + values = validator(values) + return values + + @universal_root_validator(pre=False) + def _post_validate_types_cat(cls, values: Cat.Partial) -> Cat.Partial: + for validator in Cat.Validators._post_validators: + values = validator(values) + return values + + @universal_field_validator("name", pre=True) + def _pre_validate_name(cls, v: str, values: Cat.Partial) -> str: + for validator in Cat.Validators._name_pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("name", pre=False) + def _post_validate_name(cls, v: str, values: Cat.Partial) -> str: + for validator in Cat.Validators._name_post_validators: + v = validator(v, values) + return v + + @universal_field_validator("likes_to_meow", pre=True) + def _pre_validate_likes_to_meow(cls, v: bool, values: Cat.Partial) -> bool: + for validator in Cat.Validators._likes_to_meow_pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("likes_to_meow", pre=False) + def _post_validate_likes_to_meow(cls, v: bool, values: Cat.Partial) -> bool: + for validator in Cat.Validators._likes_to_meow_post_validators: + v = validator(v, values) + return v + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="forbid") # type: ignore # Pydantic v2 + else: + + class Config: + extra = pydantic.Extra.forbid diff --git a/seed/fastapi/exhaustive/include-validators/resources/types/resources/union/types/dog.py b/seed/fastapi/exhaustive/include-validators/resources/types/resources/union/types/dog.py new file mode 100644 index 00000000000..4527ee3e8d5 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/resources/types/resources/union/types/dog.py @@ -0,0 +1,185 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic +import typing_extensions + +from ......core.pydantic_utilities import ( + IS_PYDANTIC_V2, + UniversalBaseModel, + universal_field_validator, + universal_root_validator, +) + + +class Dog(UniversalBaseModel): + name: str + likes_to_woof: bool = pydantic.Field(alias="likesToWoof") + + class Partial(typing.TypedDict): + name: typing_extensions.NotRequired[str] + likes_to_woof: typing_extensions.NotRequired[bool] + + class Validators: + """ + Use this class to add validators to the Pydantic model. + + @Dog.Validators.root() + def validate(values: Dog.Partial) -> Dog.Partial: + ... + + @Dog.Validators.field("name") + def validate_name(name: str, values: Dog.Partial) -> str: + ... + + @Dog.Validators.field("likes_to_woof") + def validate_likes_to_woof(likes_to_woof: bool, values: Dog.Partial) -> bool: + ... + """ + + _pre_validators: typing.ClassVar[typing.List[Dog.Validators._PreRootValidator]] = [] + _post_validators: typing.ClassVar[typing.List[Dog.Validators._RootValidator]] = [] + _name_pre_validators: typing.ClassVar[typing.List[Dog.Validators.PreNameValidator]] = [] + _name_post_validators: typing.ClassVar[typing.List[Dog.Validators.NameValidator]] = [] + _likes_to_woof_pre_validators: typing.ClassVar[typing.List[Dog.Validators.PreLikesToWoofValidator]] = [] + _likes_to_woof_post_validators: typing.ClassVar[typing.List[Dog.Validators.LikesToWoofValidator]] = [] + + @typing.overload + @classmethod + def root( + cls, *, pre: typing.Literal[False] = False + ) -> typing.Callable[[Dog.Validators._RootValidator], Dog.Validators._RootValidator]: + ... + + @typing.overload + @classmethod + def root( + cls, *, pre: typing.Literal[True] + ) -> typing.Callable[[Dog.Validators._PreRootValidator], Dog.Validators._PreRootValidator]: + ... + + @classmethod + def root(cls, *, pre: bool = False) -> typing.Any: + def decorator(validator: typing.Any) -> typing.Any: + if pre: + cls._pre_validators.append(validator) + else: + cls._post_validators.append(validator) + return validator + + return decorator + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["name"], *, pre: typing.Literal[True] + ) -> typing.Callable[[Dog.Validators.PreNameValidator], Dog.Validators.PreNameValidator]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["name"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[[Dog.Validators.NameValidator], Dog.Validators.NameValidator]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["likes_to_woof"], *, pre: typing.Literal[True] + ) -> typing.Callable[[Dog.Validators.PreLikesToWoofValidator], Dog.Validators.PreLikesToWoofValidator]: + ... + + @typing.overload + @classmethod + def field( + cls, field_name: typing.Literal["likes_to_woof"], *, pre: typing.Literal[False] = False + ) -> typing.Callable[[Dog.Validators.LikesToWoofValidator], Dog.Validators.LikesToWoofValidator]: + ... + + @classmethod + def field(cls, field_name: str, *, pre: bool = False) -> typing.Any: + def decorator(validator: typing.Any) -> typing.Any: + if field_name == "name": + if pre: + cls._name_pre_validators.append(validator) + else: + cls._name_post_validators.append(validator) + if field_name == "likes_to_woof": + if pre: + cls._likes_to_woof_pre_validators.append(validator) + else: + cls._likes_to_woof_post_validators.append(validator) + return validator + + return decorator + + class PreNameValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: Dog.Partial) -> typing.Any: + ... + + class NameValidator(typing.Protocol): + def __call__(self, __v: str, __values: Dog.Partial) -> str: + ... + + class PreLikesToWoofValidator(typing.Protocol): + def __call__(self, __v: typing.Any, __values: Dog.Partial) -> typing.Any: + ... + + class LikesToWoofValidator(typing.Protocol): + def __call__(self, __v: bool, __values: Dog.Partial) -> bool: + ... + + class _PreRootValidator(typing.Protocol): + def __call__(self, __values: typing.Any) -> typing.Any: + ... + + class _RootValidator(typing.Protocol): + def __call__(self, __values: Dog.Partial) -> Dog.Partial: + ... + + @universal_root_validator(pre=True) + def _pre_validate_types_dog(cls, values: Dog.Partial) -> Dog.Partial: + for validator in Dog.Validators._pre_validators: + values = validator(values) + return values + + @universal_root_validator(pre=False) + def _post_validate_types_dog(cls, values: Dog.Partial) -> Dog.Partial: + for validator in Dog.Validators._post_validators: + values = validator(values) + return values + + @universal_field_validator("name", pre=True) + def _pre_validate_name(cls, v: str, values: Dog.Partial) -> str: + for validator in Dog.Validators._name_pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("name", pre=False) + def _post_validate_name(cls, v: str, values: Dog.Partial) -> str: + for validator in Dog.Validators._name_post_validators: + v = validator(v, values) + return v + + @universal_field_validator("likes_to_woof", pre=True) + def _pre_validate_likes_to_woof(cls, v: bool, values: Dog.Partial) -> bool: + for validator in Dog.Validators._likes_to_woof_pre_validators: + v = validator(v, values) + return v + + @universal_field_validator("likes_to_woof", pre=False) + def _post_validate_likes_to_woof(cls, v: bool, values: Dog.Partial) -> bool: + for validator in Dog.Validators._likes_to_woof_post_validators: + v = validator(v, values) + return v + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="forbid") # type: ignore # Pydantic v2 + else: + + class Config: + extra = pydantic.Extra.forbid diff --git a/seed/fastapi/exhaustive/include-validators/security.py b/seed/fastapi/exhaustive/include-validators/security.py new file mode 100644 index 00000000000..bab014441e1 --- /dev/null +++ b/seed/fastapi/exhaustive/include-validators/security.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +import fastapi + +from .core.security.bearer import BearerToken, HTTPBearer + +ApiAuth = BearerToken + + +def FernAuth(auth: BearerToken = fastapi.Depends(HTTPBearer)) -> BearerToken: + return auth diff --git a/seed/fastapi/exhaustive/include-validators/snippet-templates.json b/seed/fastapi/exhaustive/include-validators/snippet-templates.json new file mode 100644 index 00000000000..e69de29bb2d diff --git a/seed/fastapi/exhaustive/include-validators/snippet.json b/seed/fastapi/exhaustive/include-validators/snippet.json new file mode 100644 index 00000000000..e69de29bb2d diff --git a/seed/fastapi/seed.yml b/seed/fastapi/seed.yml index 7a0750311e9..a2743021769 100644 --- a/seed/fastapi/seed.yml +++ b/seed/fastapi/seed.yml @@ -19,6 +19,11 @@ fixtures: pydantic_config: version: v2 outputFolder: pydantic-v2 + - customConfig: + include_validators: True + pydantic_config: + include_union_utils: true + outputFolder: include-validators imdb: - customConfig: null outputFolder: no-custom-config diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.github/workflows/ci.yml b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.github/workflows/ci.yml new file mode 100644 index 00000000000..b7316b8cab7 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.github/workflows/ci.yml @@ -0,0 +1,63 @@ +name: ci + +on: [push] +jobs: + compile: + runs-on: ubuntu-20.04 + steps: + - name: Checkout repo + uses: actions/checkout@v3 + - name: Set up python + uses: actions/setup-python@v4 + with: + python-version: 3.8 + - name: Bootstrap poetry + run: | + curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1 + - name: Install dependencies + run: poetry install + - name: Compile + run: poetry run mypy . + test: + runs-on: ubuntu-20.04 + steps: + - name: Checkout repo + uses: actions/checkout@v3 + - name: Set up python + uses: actions/setup-python@v4 + with: + python-version: 3.8 + - name: Bootstrap poetry + run: | + curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1 + - name: Install dependencies + run: poetry install + + - name: Install Fern + run: npm install -g fern-api + - name: Test + run: fern test --command "poetry run pytest -rP ." + + publish: + needs: [compile, test] + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + runs-on: ubuntu-20.04 + steps: + - name: Checkout repo + uses: actions/checkout@v3 + - name: Set up python + uses: actions/setup-python@v4 + with: + python-version: 3.8 + - name: Bootstrap poetry + run: | + curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1 + - name: Install dependencies + run: poetry install + - name: Publish to pypi + run: | + poetry config repositories.remote + poetry --no-interaction -v publish --build --repository remote --username "$" --password "$" + env: + : ${{ secrets. }} + : ${{ secrets. }} diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.gitignore b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.gitignore new file mode 100644 index 00000000000..42cb863501e --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.gitignore @@ -0,0 +1,4 @@ +dist/ +.mypy_cache/ +__pycache__/ +poetry.toml diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/api.yml b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/api.yml new file mode 100644 index 00000000000..dd65915538f --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/api.yml @@ -0,0 +1,4 @@ +name: exhaustive +auth: bearer +error-discrimination: + strategy: status-code diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/endpoints/container.yml b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/endpoints/container.yml new file mode 100644 index 00000000000..165a039dc65 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/endpoints/container.yml @@ -0,0 +1,48 @@ +imports: + objects: ../types/object.yml + +service: + auth: true + base-path: /container + endpoints: + getAndReturnListOfPrimitives: + path: /list-of-primitives + method: POST + request: list + response: list + + getAndReturnListOfObjects: + path: /list-of-objects + method: POST + request: list + response: list + + getAndReturnSetOfPrimitives: + path: /set-of-primitives + method: POST + request: set + response: set + + getAndReturnSetOfObjects: + path: /set-of-objects + method: POST + request: set + response: set + + getAndReturnMapPrimToPrim: + path: /map-prim-to-prim + method: POST + request: map + response: map + + getAndReturnMapOfPrimToObject: + path: /map-prim-to-object + method: POST + request: map + response: map + + getAndReturnOptional: + path: /opt-objects + method: POST + request: optional + response: optional diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/endpoints/enum.yml b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/endpoints/enum.yml new file mode 100644 index 00000000000..335a0889cc7 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/endpoints/enum.yml @@ -0,0 +1,12 @@ +imports: + enums: ../types/enum.yml + +service: + auth: true + base-path: /enum + endpoints: + getAndReturnEnum: + method: POST + path: "" + request: enums.WeatherReport + response: enums.WeatherReport diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/endpoints/http-methods.yml b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/endpoints/http-methods.yml new file mode 100644 index 00000000000..51a54c0802c --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/endpoints/http-methods.yml @@ -0,0 +1,43 @@ +imports: + objects: ../types/object.yml + +service: + auth: true + base-path: /http-methods + + endpoints: + testGet: + method: GET + path: /{id} + path-parameters: + id: string + response: string + + testPost: + method: POST + path: "" + request: objects.ObjectWithRequiredField + response: objects.ObjectWithOptionalField + + testPut: + method: PUT + path: /{id} + path-parameters: + id: string + request: objects.ObjectWithRequiredField + response: objects.ObjectWithOptionalField + + testPatch: + method: PATCH + path: /{id} + path-parameters: + id: string + request: objects.ObjectWithOptionalField + response: objects.ObjectWithOptionalField + + testDelete: + method: DELETE + path: /{id} + path-parameters: + id: string + response: boolean diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/endpoints/object.yml b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/endpoints/object.yml new file mode 100644 index 00000000000..9fad6aa2776 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/endpoints/object.yml @@ -0,0 +1,44 @@ +imports: + objects: ../types/object.yml + +service: + auth: true + base-path: /object + endpoints: + getAndReturnWithOptionalField: + path: /get-and-return-with-optional-field + method: POST + request: objects.ObjectWithOptionalField + response: objects.ObjectWithOptionalField + + getAndReturnWithRequiredField: + path: /get-and-return-with-required-field + method: POST + request: objects.ObjectWithRequiredField + response: objects.ObjectWithRequiredField + + getAndReturnWithMapOfMap: + path: /get-and-return-with-map-of-map + method: POST + request: objects.ObjectWithMapOfMap + response: objects.ObjectWithMapOfMap + + getAndReturnNestedWithOptionalField: + path: /get-and-return-nested-with-optional-field + method: POST + request: objects.NestedObjectWithOptionalField + response: objects.NestedObjectWithOptionalField + + getAndReturnNestedWithRequiredField: + path: /get-and-return-nested-with-required-field/{string} + method: POST + path-parameters: + string: string + request: objects.NestedObjectWithRequiredField + response: objects.NestedObjectWithRequiredField + + getAndReturnNestedWithRequiredFieldAsList: + path: /get-and-return-nested-with-required-field-list + method: POST + request: list + response: objects.NestedObjectWithRequiredField diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/endpoints/params.yml b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/endpoints/params.yml new file mode 100644 index 00000000000..7766547ad79 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/endpoints/params.yml @@ -0,0 +1,57 @@ +service: + auth: true + base-path: /params + endpoints: + getWithPath: + docs: GET with path param + path: /path/{param} + path-parameters: + param: string + method: GET + response: string + + getWithQuery: + docs: GET with query param + path: "" + method: GET + request: + name: GetWithQuery + query-parameters: + query: string #mandatory for test + number: integer + + getWithAllowMultipleQuery: + docs: GET with multiple of same query param + path: "" + method: GET + request: + name: GetWithMultipleQuery + query-parameters: + query: + type: string + allow-multiple: true + numer: + type: integer + allow-multiple: true + + getWithPathAndQuery: + docs: GET with path and query params + path: /path-query/{param} + path-parameters: + param: string + method: GET + request: + name: GetWithPathAndQuery + query-parameters: + query: string #mandatory for test + + modifyWithPath: + docs: PUT to update with path param + path: /path/{param} + path-parameters: + param: string + method: PUT + request: + name: ModifyResourceAtPath + body: string + response: string diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/endpoints/primitive.yml b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/endpoints/primitive.yml new file mode 100644 index 00000000000..8dd7674164c --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/endpoints/primitive.yml @@ -0,0 +1,60 @@ +imports: + objects: ../types/object.yml + +service: + auth: true + base-path: /primitive + endpoints: + getAndReturnString: + path: /string + method: POST + request: string + response: string + + getAndReturnInt: + path: /integer + method: POST + request: integer + response: integer + + getAndReturnLong: + path: /long + method: POST + request: long + response: long + + getAndReturnDouble: + path: /double + method: POST + request: double + response: double + + getAndReturnBool: + path: /boolean + method: POST + request: boolean + response: boolean + + getAndReturnDatetime: + path: /datetime + method: POST + request: datetime + response: datetime + + getAndReturnDate: + path: /date + method: POST + request: date + response: date + + getAndReturnUUID: + path: /uuid + method: POST + request: uuid + response: uuid + + getAndReturnBase64: + path: /base64 + method: POST + request: base64 + response: base64 diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/endpoints/union.yml b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/endpoints/union.yml new file mode 100644 index 00000000000..ce9021160d7 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/endpoints/union.yml @@ -0,0 +1,12 @@ +imports: + unions: ../types/union.yml + +service: + auth: true + base-path: /union + endpoints: + getAndReturnUnion: + method: POST + path: "" + request: unions.Animal + response: unions.Animal diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/general-errors.yml b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/general-errors.yml new file mode 100644 index 00000000000..5fbf9cfc417 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/general-errors.yml @@ -0,0 +1,9 @@ +errors: + BadRequestBody: + status-code: 400 + type: BadObjectRequestInfo + +types: + BadObjectRequestInfo: + properties: + message: string diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/inlined-requests.yml b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/inlined-requests.yml new file mode 100644 index 00000000000..9347fe7e335 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/inlined-requests.yml @@ -0,0 +1,25 @@ +imports: + objects: ./types/object.yml + errors: ./general-errors.yml + +# test req bodies, path params, query params, multiple query params, etc. +# test union and enum as well + +service: + auth: false + base-path: /req-bodies + endpoints: + postWithObjectBodyandResponse: + docs: POST with custom object in request body, response is an object + path: /object + method: POST + request: + name: PostWithObjectBody + body: + properties: + string: string + integer: integer + NestedObject: objects.ObjectWithOptionalField + response: objects.ObjectWithOptionalField + errors: + - errors.BadRequestBody diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/no-auth.yml b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/no-auth.yml new file mode 100644 index 00000000000..e3c33ed7fab --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/no-auth.yml @@ -0,0 +1,20 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json + +imports: + general-errors: ./general-errors.yml + +service: + auth: false + base-path: /no-auth + endpoints: + postWithNoAuth: + auth: false + docs: POST request with no auth + path: "" + method: POST + request: + name: PostWithNoAuth + body: unknown + response: boolean + errors: + - general-errors.BadRequestBody diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/no-req-body.yml b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/no-req-body.yml new file mode 100644 index 00000000000..daffd9a495c --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/no-req-body.yml @@ -0,0 +1,16 @@ +imports: + objects: ./types/object.yml + +service: + auth: true + base-path: /no-req-body + endpoints: + getWithNoRequestBody: + path: "" + method: GET + response: objects.ObjectWithOptionalField + + postWithNoRequestBody: + path: "" + method: POST + response: string diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/req-with-headers.yml b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/req-with-headers.yml new file mode 100644 index 00000000000..9e49725782f --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/req-with-headers.yml @@ -0,0 +1,14 @@ +service: + base-path: /test-headers + auth: true + headers: + X-TEST-SERVICE-HEADER: string + endpoints: + getWithCustomHeader: + path: /custom-header + method: POST + request: + name: ReqWithHeaders + headers: + X-TEST-ENDPOINT-HEADER: string + body: string diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/types/enum.yml b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/types/enum.yml new file mode 100644 index 00000000000..a90686092e9 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/types/enum.yml @@ -0,0 +1,12 @@ +types: + WeatherReport: + enum: + - SUNNY + - CLOUDY + - RAINING + - SNOWING + +errors: + ErrorWithEnumBody: + status-code: 400 + type: WeatherReport #does this even make sense? the type of the error body would be enum, and it could only be one of the 4 values? diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/types/object.yml b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/types/object.yml new file mode 100644 index 00000000000..a165ed94cfe --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/types/object.yml @@ -0,0 +1,59 @@ +types: + ObjectWithOptionalField: #generic object that supports any type, makes it easier to use when testing + properties: + string: + type: optional + docs: This is a rather long descriptor of this single field in a more complex type. If you ask me I think this is a pretty good description for this field all things considered. + integer: optional + long: optional + double: optional + bool: optional + datetime: optional + date: optional + uuid: optional + base64: optional + list: optional> + set: optional> + map: optional> + bigint: optional + + ObjectWithRequiredField: + properties: + string: string + + ObjectWithMapOfMap: + properties: + map: map> + + NestedObjectWithOptionalField: + properties: + string: optional + NestedObject: optional + + NestedObjectWithRequiredField: + properties: + string: string + NestedObject: ObjectWithOptionalField + + DoubleOptional: + properties: + optionalAlias: optional + + OptionalAlias: optional + +errors: + ObjectWithOptionalFieldError: + status-code: 400 + type: ObjectWithOptionalField + + ObjectWithRequiredFieldError: + status-code: 400 + type: ObjectWithRequiredField + + NestedObjectWithOptionalFieldError: + status-code: 400 + type: NestedObjectWithOptionalField + + NestedObjectWithRequiredFieldError: + status-code: 400 + type: NestedObjectWithRequiredField diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/types/union.yml b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/types/union.yml new file mode 100644 index 00000000000..99ce8c75ed0 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/definition/types/union.yml @@ -0,0 +1,21 @@ +types: + Animal: + discriminant: animal + union: + dog: Dog + cat: Cat + + Dog: + properties: + name: string + likesToWoof: boolean + + Cat: + properties: + name: string + likesToMeow: boolean + +errors: + ErrorWithUnionBody: + status-code: 400 + type: Animal #has to send either dog or cat object in error body diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/fern.config.json b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/fern.config.json new file mode 100644 index 00000000000..4c8e54ac313 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/fern.config.json @@ -0,0 +1 @@ +{"organization": "fern-test", "version": "*"} \ No newline at end of file diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/generators.yml b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/generators.yml new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/.mock/generators.yml @@ -0,0 +1 @@ +{} diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/README.md b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/README.md new file mode 100644 index 00000000000..b4963779236 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/README.md @@ -0,0 +1,136 @@ +# Seed Python Library + +[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://github.com/fern-api/fern) +[![pypi](https://img.shields.io/pypi/v/fern_exhaustive)](https://pypi.python.org/pypi/fern_exhaustive) + +The Seed Python library provides convenient access to the Seed API from Python. + +## Installation + +```sh +pip install fern_exhaustive +``` + +## Usage + +Instantiate and use the client with the following: + +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.container.get_and_return_list_of_primitives( + request=["string"], +) +``` + +## Async Client + +The SDK also exports an `async` client so that you can make non-blocking calls to our API. + +```python +import asyncio + +from seed import AsyncSeedExhaustive + +client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) + + +async def main() -> None: + await client.endpoints.container.get_and_return_list_of_primitives( + request=["string"], + ) + + +asyncio.run(main()) +``` + +## Exception Handling + +When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error +will be thrown. + +```python +from seed.core.api_error import ApiError + +try: + client.endpoints.container.get_and_return_list_of_primitives(...) +except ApiError as e: + print(e.status_code) + print(e.body) +``` + +## Advanced + +### Retries + +The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long +as the request is deemed retriable and the number of retry attempts has not grown larger than the configured +retry limit (default: 2). + +A request is deemed retriable when any of the following HTTP status codes is returned: + +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) + +Use the `max_retries` request option to configure this behavior. + +```python +client.endpoints.container.get_and_return_list_of_primitives(..., { + "max_retries": 1 +}) +``` + +### Timeouts + +The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level. + +```python + +from seed import SeedExhaustive + +client = SeedExhaustive( + ..., + timeout=20.0, +) + + +# Override timeout for a specific method +client.endpoints.container.get_and_return_list_of_primitives(..., { + "timeout_in_seconds": 1 +}) +``` + +### Custom Client + +You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies +and transports. +```python +import httpx +from seed import SeedExhaustive + +client = SeedExhaustive( + ..., + httpx_client=httpx.Client( + proxies="http://my.test.proxy.example.com", + transport=httpx.HTTPTransport(local_address="0.0.0.0"), + ), +) +``` + +## Contributing + +While we value open-source contributions to this SDK, this library is generated programmatically. +Additions made directly to this library would have to be moved over to our generation code, +otherwise they would be overwritten upon the next generated release. Feel free to open a PR as +a proof of concept, but know that we will not be able to merge it as-is. We suggest opening +an issue first to discuss with us! + +On the other hand, contributions to the README are always very welcome! diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/pyproject.toml b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/pyproject.toml new file mode 100644 index 00000000000..d2b8e3aa278 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/pyproject.toml @@ -0,0 +1,57 @@ +[tool.poetry] +name = "fern_exhaustive" +version = "0.0.1" +description = "" +readme = "README.md" +authors = [] +keywords = [] + +classifiers = [ + "Intended Audience :: Developers", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Operating System :: OS Independent", + "Operating System :: POSIX", + "Operating System :: MacOS", + "Operating System :: POSIX :: Linux", + "Operating System :: Microsoft :: Windows", + "Topic :: Software Development :: Libraries :: Python Modules", + "Typing :: Typed" +] +packages = [ + { include = "seed", from = "src"} +] + +[project.urls] +Repository = 'https://github.com/exhaustive/fern' + +[tool.poetry.dependencies] +python = "^3.8" +httpx = ">=0.21.2" +pydantic = ">= 1.9.2,<= 1.10.14" +pydantic-core = "^2.18.2" +typing_extensions = ">= 4.0.0" + +[tool.poetry.dev-dependencies] +mypy = "1.0.1" +pytest = "^7.4.0" +pytest-asyncio = "^0.23.5" +python-dateutil = "^2.9.0" +types-python-dateutil = "^2.9.0.20240316" + +[tool.pytest.ini_options] +testpaths = [ "tests" ] +asyncio_mode = "auto" + +[tool.mypy] +plugins = ["pydantic.mypy"] + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/reference.md b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/reference.md new file mode 100644 index 00000000000..dc6a813672a --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/reference.md @@ -0,0 +1,2802 @@ +# Reference +## Endpoints Container +
client.endpoints.container.get_and_return_list_of_primitives(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.container.get_and_return_list_of_primitives( + request=["string"], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `typing.Sequence[str]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.container.get_and_return_list_of_objects(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive +from seed.types.object import ObjectWithRequiredField + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.container.get_and_return_list_of_objects( + request=[ + ObjectWithRequiredField( + string="string", + ) + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `typing.Sequence[ObjectWithRequiredField]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.container.get_and_return_set_of_primitives(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.container.get_and_return_set_of_primitives( + request={"string"}, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `typing.Set[str]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.container.get_and_return_set_of_objects(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive +from seed.types.object import ObjectWithRequiredField + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.container.get_and_return_set_of_objects( + request=[ + ObjectWithRequiredField( + string="string", + ) + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `typing.Sequence[ObjectWithRequiredField]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.container.get_and_return_map_prim_to_prim(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.container.get_and_return_map_prim_to_prim( + request={"string": "string"}, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `typing.Dict[str, str]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.container.get_and_return_map_of_prim_to_object(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive +from seed.types.object import ObjectWithRequiredField + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.container.get_and_return_map_of_prim_to_object( + request={ + "string": ObjectWithRequiredField( + string="string", + ) + }, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `typing.Dict[str, ObjectWithRequiredField]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.container.get_and_return_optional(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive +from seed.types.object import ObjectWithRequiredField + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.container.get_and_return_optional( + request=ObjectWithRequiredField( + string="string", + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `typing.Optional[ObjectWithRequiredField]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Endpoints Enum +
client.endpoints.enum.get_and_return_enum(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.enum.get_and_return_enum( + request="SUNNY", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `WeatherReport` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Endpoints HttpMethods +
client.endpoints.http_methods.test_get(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.http_methods.test_get( + id="string", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.http_methods.test_post(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.http_methods.test_post( + string="string", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**string:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.http_methods.test_put(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.http_methods.test_put( + id="string", + string="string", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**string:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.http_methods.test_patch(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +import datetime +import uuid + +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.http_methods.test_patch( + id="string", + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + date=datetime.date.fromisoformat( + "2023-01-15", + ), + uuid_=uuid.UUID( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**string:** `typing.Optional[str]` — This is a rather long descriptor of this single field in a more complex type. If you ask me I think this is a pretty good description for this field all things considered. + +
+
+ +
+
+ +**integer:** `typing.Optional[int]` + +
+
+ +
+
+ +**long_:** `typing.Optional[int]` + +
+
+ +
+
+ +**double:** `typing.Optional[float]` + +
+
+ +
+
+ +**bool_:** `typing.Optional[bool]` + +
+
+ +
+
+ +**datetime:** `typing.Optional[dt.datetime]` + +
+
+ +
+
+ +**date:** `typing.Optional[dt.date]` + +
+
+ +
+
+ +**uuid_:** `typing.Optional[uuid.UUID]` + +
+
+ +
+
+ +**base_64:** `typing.Optional[str]` + +
+
+ +
+
+ +**list_:** `typing.Optional[typing.Sequence[str]]` + +
+
+ +
+
+ +**set_:** `typing.Optional[typing.Set[str]]` + +
+
+ +
+
+ +**map_:** `typing.Optional[typing.Dict[int, str]]` + +
+
+ +
+
+ +**bigint:** `typing.Optional[str]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.http_methods.test_delete(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.http_methods.test_delete( + id="string", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**id:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Endpoints Object +
client.endpoints.object.get_and_return_with_optional_field(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +import datetime +import uuid + +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.object.get_and_return_with_optional_field( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + date=datetime.date.fromisoformat( + "2023-01-15", + ), + uuid_=uuid.UUID( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**string:** `typing.Optional[str]` — This is a rather long descriptor of this single field in a more complex type. If you ask me I think this is a pretty good description for this field all things considered. + +
+
+ +
+
+ +**integer:** `typing.Optional[int]` + +
+
+ +
+
+ +**long_:** `typing.Optional[int]` + +
+
+ +
+
+ +**double:** `typing.Optional[float]` + +
+
+ +
+
+ +**bool_:** `typing.Optional[bool]` + +
+
+ +
+
+ +**datetime:** `typing.Optional[dt.datetime]` + +
+
+ +
+
+ +**date:** `typing.Optional[dt.date]` + +
+
+ +
+
+ +**uuid_:** `typing.Optional[uuid.UUID]` + +
+
+ +
+
+ +**base_64:** `typing.Optional[str]` + +
+
+ +
+
+ +**list_:** `typing.Optional[typing.Sequence[str]]` + +
+
+ +
+
+ +**set_:** `typing.Optional[typing.Set[str]]` + +
+
+ +
+
+ +**map_:** `typing.Optional[typing.Dict[int, str]]` + +
+
+ +
+
+ +**bigint:** `typing.Optional[str]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.object.get_and_return_with_required_field(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.object.get_and_return_with_required_field( + string="string", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**string:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.object.get_and_return_with_map_of_map(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.object.get_and_return_with_map_of_map( + map_={"string": {"string": "string"}}, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**map_:** `typing.Dict[str, typing.Dict[str, str]]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.object.get_and_return_nested_with_optional_field(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +import datetime +import uuid + +from seed import SeedExhaustive +from seed.types.object import ObjectWithOptionalField + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.object.get_and_return_nested_with_optional_field( + string="string", + nested_object=ObjectWithOptionalField( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + date=datetime.date.fromisoformat( + "2023-01-15", + ), + uuid_=uuid.UUID( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**string:** `typing.Optional[str]` + +
+
+ +
+
+ +**nested_object:** `typing.Optional[ObjectWithOptionalField]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.object.get_and_return_nested_with_required_field(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +import datetime +import uuid + +from seed import SeedExhaustive +from seed.types.object import ObjectWithOptionalField + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.object.get_and_return_nested_with_required_field( + string_="string", + string="string", + nested_object=ObjectWithOptionalField( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + date=datetime.date.fromisoformat( + "2023-01-15", + ), + uuid_=uuid.UUID( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**string_:** `str` + +
+
+ +
+
+ +**string:** `str` + +
+
+ +
+
+ +**nested_object:** `ObjectWithOptionalField` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.object.get_and_return_nested_with_required_field_as_list(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +import datetime +import uuid + +from seed import SeedExhaustive +from seed.types.object import ( + NestedObjectWithRequiredField, + ObjectWithOptionalField, +) + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.object.get_and_return_nested_with_required_field_as_list( + request=[ + NestedObjectWithRequiredField( + string="string", + nested_object=ObjectWithOptionalField( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + date=datetime.date.fromisoformat( + "2023-01-15", + ), + uuid_=uuid.UUID( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ), + ) + ], +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `typing.Sequence[NestedObjectWithRequiredField]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Endpoints Params +
client.endpoints.params.get_with_path(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +GET with path param +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.params.get_with_path( + param="string", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**param:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.params.get_with_query(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +GET with query param +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.params.get_with_query( + query="string", + number=1, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**query:** `str` + +
+
+ +
+
+ +**number:** `int` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.params.get_with_allow_multiple_query(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +GET with multiple of same query param +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.params.get_with_allow_multiple_query( + query="string", + numer=1, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**query:** `typing.Union[str, typing.Sequence[str]]` + +
+
+ +
+
+ +**numer:** `typing.Union[int, typing.Sequence[int]]` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.params.get_with_path_and_query(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +GET with path and query params +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.params.get_with_path_and_query( + param="string", + query="string", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**param:** `str` + +
+
+ +
+
+ +**query:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.params.modify_with_path(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +PUT to update with path param +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.params.modify_with_path( + param="string", + request="string", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**param:** `str` + +
+
+ +
+
+ +**request:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Endpoints Primitive +
client.endpoints.primitive.get_and_return_string(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.primitive.get_and_return_string( + request="string", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.primitive.get_and_return_int(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.primitive.get_and_return_int( + request=1, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `int` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.primitive.get_and_return_long(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.primitive.get_and_return_long( + request=1000000, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `int` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.primitive.get_and_return_double(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.primitive.get_and_return_double( + request=1.1, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `float` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.primitive.get_and_return_bool(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.primitive.get_and_return_bool( + request=True, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `bool` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.primitive.get_and_return_datetime(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +import datetime + +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.primitive.get_and_return_datetime( + request=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `dt.datetime` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.primitive.get_and_return_date(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +import datetime + +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.primitive.get_and_return_date( + request=datetime.date.fromisoformat( + "2023-01-15", + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `dt.date` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.primitive.get_and_return_uuid(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +import uuid + +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.primitive.get_and_return_uuid( + request=uuid.UUID( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `uuid.UUID` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.endpoints.primitive.get_and_return_base_64(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.primitive.get_and_return_base_64( + request="SGVsbG8gd29ybGQh", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## Endpoints Union +
client.endpoints.union.get_and_return_union(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive +from seed.types.union import Animal_Dog + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.endpoints.union.get_and_return_union( + request=Animal_Dog( + name="string", + likes_to_woof=True, + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Animal` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## InlinedRequests +
client.inlined_requests.post_with_object_bodyand_response(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +POST with custom object in request body, response is an object +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +import datetime +import uuid + +from seed import SeedExhaustive +from seed.types.object import ObjectWithOptionalField + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.inlined_requests.post_with_object_bodyand_response( + string="string", + integer=1, + nested_object=ObjectWithOptionalField( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + date=datetime.date.fromisoformat( + "2023-01-15", + ), + uuid_=uuid.UUID( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ), +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**string:** `str` + +
+
+ +
+
+ +**integer:** `int` + +
+
+ +
+
+ +**nested_object:** `ObjectWithOptionalField` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## NoAuth +
client.no_auth.post_with_no_auth(...) +
+
+ +#### 📝 Description + +
+
+ +
+
+ +POST request with no auth +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.no_auth.post_with_no_auth( + request={"key": "value"}, +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `typing.Any` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## NoReqBody +
client.no_req_body.get_with_no_request_body() +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.no_req_body.get_with_no_request_body() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +
client.no_req_body.post_with_no_request_body() +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.no_req_body.post_with_no_request_body() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ +## ReqWithHeaders +
client.req_with_headers.get_with_custom_header(...) +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from seed import SeedExhaustive + +client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", +) +client.req_with_headers.get_with_custom_header( + x_test_service_header="string", + x_test_endpoint_header="string", + request="string", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**x_test_service_header:** `str` + +
+
+ +
+
+ +**x_test_endpoint_header:** `str` + +
+
+ +
+
+ +**request:** `str` + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ + +
+
+
+ diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/snippet-templates.json b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/snippet-templates.json new file mode 100644 index 00000000000..65dfae3aba5 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/snippet-templates.json @@ -0,0 +1,8324 @@ +[ + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/container/list-of-primitives", + "method": "POST", + "identifierOverride": "endpoint_endpoints/container.getAndReturnListOfPrimitives" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.container.get_and_return_list_of_primitives(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "request=[\n\t\t$FERN_INPUT\n\t]", + "delimiter": ",\n\t\t", + "innerTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "templateInput": { + "location": "BODY", + "path": null + }, + "type": "iterable" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.container.get_and_return_list_of_primitives(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "request=[\n\t\t$FERN_INPUT\n\t]", + "delimiter": ",\n\t\t", + "innerTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "templateInput": { + "location": "BODY", + "path": null + }, + "type": "iterable" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/container/list-of-objects", + "method": "POST", + "identifierOverride": "endpoint_endpoints/container.getAndReturnListOfObjects" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.container.get_and_return_list_of_objects(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "request=[\n\t\t$FERN_INPUT\n\t]", + "delimiter": ",\n\t\t", + "innerTemplate": { + "imports": [ + "from seed.types.object import ObjectWithRequiredField" + ], + "isOptional": true, + "templateString": "ObjectWithRequiredField(\n\t\t\t$FERN_INPUT\n\t\t)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t\t\t", + "type": "generic" + }, + "templateInput": { + "location": "BODY", + "path": null + }, + "type": "iterable" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.container.get_and_return_list_of_objects(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "request=[\n\t\t$FERN_INPUT\n\t]", + "delimiter": ",\n\t\t", + "innerTemplate": { + "imports": [ + "from seed.types.object import ObjectWithRequiredField" + ], + "isOptional": true, + "templateString": "ObjectWithRequiredField(\n\t\t\t$FERN_INPUT\n\t\t)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t\t\t", + "type": "generic" + }, + "templateInput": { + "location": "BODY", + "path": null + }, + "type": "iterable" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/container/set-of-primitives", + "method": "POST", + "identifierOverride": "endpoint_endpoints/container.getAndReturnSetOfPrimitives" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.container.get_and_return_set_of_primitives(\n\t$FERN_INPUT\n)", + "templateInputs": [], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.container.get_and_return_set_of_primitives(\n\t$FERN_INPUT\n)", + "templateInputs": [], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/container/set-of-objects", + "method": "POST", + "identifierOverride": "endpoint_endpoints/container.getAndReturnSetOfObjects" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.container.get_and_return_set_of_objects(\n\t$FERN_INPUT\n)", + "templateInputs": [], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.container.get_and_return_set_of_objects(\n\t$FERN_INPUT\n)", + "templateInputs": [], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/container/map-prim-to-prim", + "method": "POST", + "identifierOverride": "endpoint_endpoints/container.getAndReturnMapPrimToPrim" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.container.get_and_return_map_prim_to_prim(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "request={\n\t\t$FERN_INPUT\n\t}", + "delimiter": ",\n\t\t", + "keyTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "valueTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "keyValueSeparator": ": ", + "templateInput": { + "location": "BODY", + "path": null + }, + "type": "dict" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.container.get_and_return_map_prim_to_prim(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "request={\n\t\t$FERN_INPUT\n\t}", + "delimiter": ",\n\t\t", + "keyTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "valueTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "keyValueSeparator": ": ", + "templateInput": { + "location": "BODY", + "path": null + }, + "type": "dict" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/container/map-prim-to-object", + "method": "POST", + "identifierOverride": "endpoint_endpoints/container.getAndReturnMapOfPrimToObject" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.container.get_and_return_map_of_prim_to_object(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "request={\n\t\t$FERN_INPUT\n\t}", + "delimiter": ",\n\t\t", + "keyTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "valueTemplate": { + "imports": [ + "from seed.types.object import ObjectWithRequiredField" + ], + "isOptional": true, + "templateString": "ObjectWithRequiredField(\n\t\t\t$FERN_INPUT\n\t\t)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t\t\t", + "type": "generic" + }, + "keyValueSeparator": ": ", + "templateInput": { + "location": "BODY", + "path": null + }, + "type": "dict" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.container.get_and_return_map_of_prim_to_object(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "request={\n\t\t$FERN_INPUT\n\t}", + "delimiter": ",\n\t\t", + "keyTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "valueTemplate": { + "imports": [ + "from seed.types.object import ObjectWithRequiredField" + ], + "isOptional": true, + "templateString": "ObjectWithRequiredField(\n\t\t\t$FERN_INPUT\n\t\t)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t\t\t", + "type": "generic" + }, + "keyValueSeparator": ": ", + "templateInput": { + "location": "BODY", + "path": null + }, + "type": "dict" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/container/opt-objects", + "method": "POST", + "identifierOverride": "endpoint_endpoints/container.getAndReturnOptional" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.container.get_and_return_optional(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [ + "from seed.types.object import ObjectWithRequiredField" + ], + "isOptional": true, + "templateString": "request=ObjectWithRequiredField(\n\t\t$FERN_INPUT\n\t)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t\t", + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.container.get_and_return_optional(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [ + "from seed.types.object import ObjectWithRequiredField" + ], + "isOptional": true, + "templateString": "request=ObjectWithRequiredField(\n\t\t$FERN_INPUT\n\t)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t\t", + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/enum", + "method": "POST", + "identifierOverride": "endpoint_endpoints/enum.getAndReturnEnum" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.enum.get_and_return_enum(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "values": { + "SUNNY": "\"SUNNY\"", + "CLOUDY": "\"CLOUDY\"", + "RAINING": "\"RAINING\"", + "SNOWING": "\"SNOWING\"" + }, + "templateInput": { + "location": "BODY", + "path": null + }, + "type": "enum" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.enum.get_and_return_enum(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "values": { + "SUNNY": "\"SUNNY\"", + "CLOUDY": "\"CLOUDY\"", + "RAINING": "\"RAINING\"", + "SNOWING": "\"SNOWING\"" + }, + "templateInput": { + "location": "BODY", + "path": null + }, + "type": "enum" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/http-methods/{id}", + "method": "GET", + "identifierOverride": "endpoint_endpoints/http-methods.testGet" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.http_methods.test_get(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "id=$FERN_INPUT", + "templateInputs": [ + { + "location": "PATH", + "path": "id", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.http_methods.test_get(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "id=$FERN_INPUT", + "templateInputs": [ + { + "location": "PATH", + "path": "id", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/http-methods", + "method": "POST", + "identifierOverride": "endpoint_endpoints/http-methods.testPost" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.http_methods.test_post(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.http_methods.test_post(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/http-methods/{id}", + "method": "PUT", + "identifierOverride": "endpoint_endpoints/http-methods.testPut" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.http_methods.test_put(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "id=$FERN_INPUT", + "templateInputs": [ + { + "location": "PATH", + "path": "id", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.http_methods.test_put(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "id=$FERN_INPUT", + "templateInputs": [ + { + "location": "PATH", + "path": "id", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/http-methods/{id}", + "method": "PATCH", + "identifierOverride": "endpoint_endpoints/http-methods.testPatch" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.http_methods.test_patch(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "id=$FERN_INPUT", + "templateInputs": [ + { + "location": "PATH", + "path": "id", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "integer=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "integer", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "long_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "long", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "double=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "double", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "bool_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "bool", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "datetime=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "datetime", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "date=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "date", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "uuid_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "uuid", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "base_64=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "base64", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "list_=[\n\t\t$FERN_INPUT\n\t]", + "delimiter": ",\n\t\t", + "innerTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "templateInput": { + "location": "BODY", + "path": "list" + }, + "type": "iterable" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "map_={\n\t\t$FERN_INPUT\n\t}", + "delimiter": ",\n\t\t", + "keyTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "valueTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "keyValueSeparator": ": ", + "templateInput": { + "location": "BODY", + "path": "map" + }, + "type": "dict" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "bigint=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "bigint", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.http_methods.test_patch(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "id=$FERN_INPUT", + "templateInputs": [ + { + "location": "PATH", + "path": "id", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "integer=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "integer", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "long_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "long", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "double=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "double", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "bool_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "bool", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "datetime=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "datetime", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "date=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "date", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "uuid_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "uuid", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "base_64=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "base64", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "list_=[\n\t\t$FERN_INPUT\n\t]", + "delimiter": ",\n\t\t", + "innerTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "templateInput": { + "location": "BODY", + "path": "list" + }, + "type": "iterable" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "map_={\n\t\t$FERN_INPUT\n\t}", + "delimiter": ",\n\t\t", + "keyTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "valueTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "keyValueSeparator": ": ", + "templateInput": { + "location": "BODY", + "path": "map" + }, + "type": "dict" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "bigint=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "bigint", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/http-methods/{id}", + "method": "DELETE", + "identifierOverride": "endpoint_endpoints/http-methods.testDelete" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.http_methods.test_delete(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "id=$FERN_INPUT", + "templateInputs": [ + { + "location": "PATH", + "path": "id", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.http_methods.test_delete(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "id=$FERN_INPUT", + "templateInputs": [ + { + "location": "PATH", + "path": "id", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/object/get-and-return-with-optional-field", + "method": "POST", + "identifierOverride": "endpoint_endpoints/object.getAndReturnWithOptionalField" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.object.get_and_return_with_optional_field(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "integer=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "integer", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "long_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "long", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "double=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "double", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "bool_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "bool", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "datetime=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "datetime", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "date=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "date", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "uuid_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "uuid", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "base_64=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "base64", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "list_=[\n\t\t$FERN_INPUT\n\t]", + "delimiter": ",\n\t\t", + "innerTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "templateInput": { + "location": "BODY", + "path": "list" + }, + "type": "iterable" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "map_={\n\t\t$FERN_INPUT\n\t}", + "delimiter": ",\n\t\t", + "keyTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "valueTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "keyValueSeparator": ": ", + "templateInput": { + "location": "BODY", + "path": "map" + }, + "type": "dict" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "bigint=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "bigint", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.object.get_and_return_with_optional_field(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "integer=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "integer", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "long_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "long", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "double=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "double", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "bool_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "bool", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "datetime=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "datetime", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "date=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "date", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "uuid_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "uuid", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "base_64=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "base64", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "list_=[\n\t\t$FERN_INPUT\n\t]", + "delimiter": ",\n\t\t", + "innerTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "templateInput": { + "location": "BODY", + "path": "list" + }, + "type": "iterable" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "map_={\n\t\t$FERN_INPUT\n\t}", + "delimiter": ",\n\t\t", + "keyTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "valueTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "keyValueSeparator": ": ", + "templateInput": { + "location": "BODY", + "path": "map" + }, + "type": "dict" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "bigint=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "bigint", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/object/get-and-return-with-required-field", + "method": "POST", + "identifierOverride": "endpoint_endpoints/object.getAndReturnWithRequiredField" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.object.get_and_return_with_required_field(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.object.get_and_return_with_required_field(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/object/get-and-return-with-map-of-map", + "method": "POST", + "identifierOverride": "endpoint_endpoints/object.getAndReturnWithMapOfMap" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.object.get_and_return_with_map_of_map(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "map_={\n\t\t$FERN_INPUT\n\t}", + "delimiter": ",\n\t\t", + "keyTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "valueTemplate": { + "imports": [], + "isOptional": true, + "containerTemplateString": "{\n\t\t\t$FERN_INPUT\n\t\t}", + "delimiter": ",\n\t\t\t", + "keyTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "valueTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "keyValueSeparator": ": ", + "templateInput": { + "location": "RELATIVE", + "path": null + }, + "type": "dict" + }, + "keyValueSeparator": ": ", + "templateInput": { + "location": "BODY", + "path": "map" + }, + "type": "dict" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.object.get_and_return_with_map_of_map(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "map_={\n\t\t$FERN_INPUT\n\t}", + "delimiter": ",\n\t\t", + "keyTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "valueTemplate": { + "imports": [], + "isOptional": true, + "containerTemplateString": "{\n\t\t\t$FERN_INPUT\n\t\t}", + "delimiter": ",\n\t\t\t", + "keyTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "valueTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "keyValueSeparator": ": ", + "templateInput": { + "location": "RELATIVE", + "path": null + }, + "type": "dict" + }, + "keyValueSeparator": ": ", + "templateInput": { + "location": "BODY", + "path": "map" + }, + "type": "dict" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/object/get-and-return-nested-with-optional-field", + "method": "POST", + "identifierOverride": "endpoint_endpoints/object.getAndReturnNestedWithOptionalField" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.object.get_and_return_nested_with_optional_field(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [ + "from seed.types.object import ObjectWithOptionalField" + ], + "isOptional": true, + "templateString": "nested_object=ObjectWithOptionalField(\n\t\t$FERN_INPUT\n\t)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.string", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "integer=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.integer", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "long_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.long", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "double=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.double", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "bool_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.bool", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "datetime=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.datetime", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "date=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.date", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "uuid_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.uuid", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "base_64=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.base64", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "list_=[\n\t\t\t$FERN_INPUT\n\t\t]", + "delimiter": ",\n\t\t\t", + "innerTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "templateInput": { + "location": "BODY", + "path": "NestedObject.list" + }, + "type": "iterable" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "map_={\n\t\t\t$FERN_INPUT\n\t\t}", + "delimiter": ",\n\t\t\t", + "keyTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "valueTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "keyValueSeparator": ": ", + "templateInput": { + "location": "BODY", + "path": "NestedObject.map" + }, + "type": "dict" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "bigint=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.bigint", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t\t", + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.object.get_and_return_nested_with_optional_field(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [ + "from seed.types.object import ObjectWithOptionalField" + ], + "isOptional": true, + "templateString": "nested_object=ObjectWithOptionalField(\n\t\t$FERN_INPUT\n\t)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.string", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "integer=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.integer", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "long_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.long", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "double=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.double", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "bool_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.bool", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "datetime=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.datetime", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "date=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.date", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "uuid_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.uuid", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "base_64=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.base64", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "list_=[\n\t\t\t$FERN_INPUT\n\t\t]", + "delimiter": ",\n\t\t\t", + "innerTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "templateInput": { + "location": "BODY", + "path": "NestedObject.list" + }, + "type": "iterable" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "map_={\n\t\t\t$FERN_INPUT\n\t\t}", + "delimiter": ",\n\t\t\t", + "keyTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "valueTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "keyValueSeparator": ": ", + "templateInput": { + "location": "BODY", + "path": "NestedObject.map" + }, + "type": "dict" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "bigint=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.bigint", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t\t", + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/object/get-and-return-nested-with-required-field/{string}", + "method": "POST", + "identifierOverride": "endpoint_endpoints/object.getAndReturnNestedWithRequiredField" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.object.get_and_return_nested_with_required_field(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "PATH", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [ + "from seed.types.object import ObjectWithOptionalField" + ], + "isOptional": true, + "templateString": "nested_object=ObjectWithOptionalField(\n\t\t$FERN_INPUT\n\t)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.string", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "integer=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.integer", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "long_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.long", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "double=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.double", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "bool_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.bool", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "datetime=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.datetime", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "date=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.date", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "uuid_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.uuid", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "base_64=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.base64", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "list_=[\n\t\t\t$FERN_INPUT\n\t\t]", + "delimiter": ",\n\t\t\t", + "innerTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "templateInput": { + "location": "BODY", + "path": "NestedObject.list" + }, + "type": "iterable" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "map_={\n\t\t\t$FERN_INPUT\n\t\t}", + "delimiter": ",\n\t\t\t", + "keyTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "valueTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "keyValueSeparator": ": ", + "templateInput": { + "location": "BODY", + "path": "NestedObject.map" + }, + "type": "dict" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "bigint=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.bigint", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t\t", + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.object.get_and_return_nested_with_required_field(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "PATH", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [ + "from seed.types.object import ObjectWithOptionalField" + ], + "isOptional": true, + "templateString": "nested_object=ObjectWithOptionalField(\n\t\t$FERN_INPUT\n\t)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.string", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "integer=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.integer", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "long_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.long", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "double=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.double", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "bool_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.bool", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "datetime=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.datetime", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "date=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.date", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "uuid_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.uuid", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "base_64=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.base64", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "list_=[\n\t\t\t$FERN_INPUT\n\t\t]", + "delimiter": ",\n\t\t\t", + "innerTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "templateInput": { + "location": "BODY", + "path": "NestedObject.list" + }, + "type": "iterable" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "map_={\n\t\t\t$FERN_INPUT\n\t\t}", + "delimiter": ",\n\t\t\t", + "keyTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "valueTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "keyValueSeparator": ": ", + "templateInput": { + "location": "BODY", + "path": "NestedObject.map" + }, + "type": "dict" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "bigint=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.bigint", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t\t", + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/object/get-and-return-nested-with-required-field-list", + "method": "POST", + "identifierOverride": "endpoint_endpoints/object.getAndReturnNestedWithRequiredFieldAsList" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.object.get_and_return_nested_with_required_field_as_list(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "request=[\n\t\t$FERN_INPUT\n\t]", + "delimiter": ",\n\t\t", + "innerTemplate": { + "imports": [ + "from seed.types.object import NestedObjectWithRequiredField" + ], + "isOptional": true, + "templateString": "NestedObjectWithRequiredField(\n\t\t\t$FERN_INPUT\n\t\t)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [ + "from seed.types.object import ObjectWithOptionalField" + ], + "isOptional": true, + "templateString": "nested_object=ObjectWithOptionalField(\n\t\t\t\t$FERN_INPUT\n\t\t\t)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "NestedObject.string", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "integer=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "NestedObject.integer", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "long_=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "NestedObject.long", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "double=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "NestedObject.double", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "bool_=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "NestedObject.bool", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "datetime=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "NestedObject.datetime", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "date=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "NestedObject.date", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "uuid_=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "NestedObject.uuid", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "base_64=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "NestedObject.base64", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "list_=[\n\t\t\t\t\t$FERN_INPUT\n\t\t\t\t]", + "delimiter": ",\n\t\t\t\t\t", + "innerTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "templateInput": { + "location": "RELATIVE", + "path": "NestedObject.list" + }, + "type": "iterable" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "map_={\n\t\t\t\t\t$FERN_INPUT\n\t\t\t\t}", + "delimiter": ",\n\t\t\t\t\t", + "keyTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "valueTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "keyValueSeparator": ": ", + "templateInput": { + "location": "RELATIVE", + "path": "NestedObject.map" + }, + "type": "dict" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "bigint=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "NestedObject.bigint", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t\t\t\t", + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t\t\t", + "type": "generic" + }, + "templateInput": { + "location": "BODY", + "path": null + }, + "type": "iterable" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.object.get_and_return_nested_with_required_field_as_list(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "request=[\n\t\t$FERN_INPUT\n\t]", + "delimiter": ",\n\t\t", + "innerTemplate": { + "imports": [ + "from seed.types.object import NestedObjectWithRequiredField" + ], + "isOptional": true, + "templateString": "NestedObjectWithRequiredField(\n\t\t\t$FERN_INPUT\n\t\t)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [ + "from seed.types.object import ObjectWithOptionalField" + ], + "isOptional": true, + "templateString": "nested_object=ObjectWithOptionalField(\n\t\t\t\t$FERN_INPUT\n\t\t\t)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "NestedObject.string", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "integer=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "NestedObject.integer", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "long_=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "NestedObject.long", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "double=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "NestedObject.double", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "bool_=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "NestedObject.bool", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "datetime=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "NestedObject.datetime", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "date=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "NestedObject.date", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "uuid_=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "NestedObject.uuid", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "base_64=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "NestedObject.base64", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "list_=[\n\t\t\t\t\t$FERN_INPUT\n\t\t\t\t]", + "delimiter": ",\n\t\t\t\t\t", + "innerTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "templateInput": { + "location": "RELATIVE", + "path": "NestedObject.list" + }, + "type": "iterable" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "map_={\n\t\t\t\t\t$FERN_INPUT\n\t\t\t\t}", + "delimiter": ",\n\t\t\t\t\t", + "keyTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "valueTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "keyValueSeparator": ": ", + "templateInput": { + "location": "RELATIVE", + "path": "NestedObject.map" + }, + "type": "dict" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "bigint=$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": "NestedObject.bigint", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t\t\t\t", + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t\t\t", + "type": "generic" + }, + "templateInput": { + "location": "BODY", + "path": null + }, + "type": "iterable" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/params/path/{param}", + "method": "GET", + "identifierOverride": "endpoint_endpoints/params.getWithPath" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.params.get_with_path(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "param=$FERN_INPUT", + "templateInputs": [ + { + "location": "PATH", + "path": "param", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.params.get_with_path(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "param=$FERN_INPUT", + "templateInputs": [ + { + "location": "PATH", + "path": "param", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/params", + "method": "GET", + "identifierOverride": "endpoint_endpoints/params.getWithQuery" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.params.get_with_query(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "query=$FERN_INPUT", + "templateInputs": [ + { + "location": "QUERY", + "path": "query", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "number=$FERN_INPUT", + "templateInputs": [ + { + "location": "QUERY", + "path": "number", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.params.get_with_query(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "query=$FERN_INPUT", + "templateInputs": [ + { + "location": "QUERY", + "path": "query", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "number=$FERN_INPUT", + "templateInputs": [ + { + "location": "QUERY", + "path": "number", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/params", + "method": "GET", + "identifierOverride": "endpoint_endpoints/params.getWithAllowMultipleQuery" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.params.get_with_allow_multiple_query(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "query=$FERN_INPUT", + "templateInputs": [ + { + "location": "QUERY", + "path": "query", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "numer=$FERN_INPUT", + "templateInputs": [ + { + "location": "QUERY", + "path": "numer", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.params.get_with_allow_multiple_query(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "query=$FERN_INPUT", + "templateInputs": [ + { + "location": "QUERY", + "path": "query", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "numer=$FERN_INPUT", + "templateInputs": [ + { + "location": "QUERY", + "path": "numer", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/params/path-query/{param}", + "method": "GET", + "identifierOverride": "endpoint_endpoints/params.getWithPathAndQuery" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.params.get_with_path_and_query(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "param=$FERN_INPUT", + "templateInputs": [ + { + "location": "PATH", + "path": "param", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "query=$FERN_INPUT", + "templateInputs": [ + { + "location": "QUERY", + "path": "query", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.params.get_with_path_and_query(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "param=$FERN_INPUT", + "templateInputs": [ + { + "location": "PATH", + "path": "param", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "query=$FERN_INPUT", + "templateInputs": [ + { + "location": "QUERY", + "path": "query", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/params/path/{param}", + "method": "PUT", + "identifierOverride": "endpoint_endpoints/params.modifyWithPath" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.params.modify_with_path(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "param=$FERN_INPUT", + "templateInputs": [ + { + "location": "PATH", + "path": "param", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": null, + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.params.modify_with_path(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "param=$FERN_INPUT", + "templateInputs": [ + { + "location": "PATH", + "path": "param", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": null, + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/primitive/string", + "method": "POST", + "identifierOverride": "endpoint_endpoints/primitive.getAndReturnString" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.primitive.get_and_return_string(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": null, + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.primitive.get_and_return_string(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": null, + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/primitive/integer", + "method": "POST", + "identifierOverride": "endpoint_endpoints/primitive.getAndReturnInt" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.primitive.get_and_return_int(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": null, + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.primitive.get_and_return_int(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": null, + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/primitive/long", + "method": "POST", + "identifierOverride": "endpoint_endpoints/primitive.getAndReturnLong" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.primitive.get_and_return_long(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": null, + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.primitive.get_and_return_long(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": null, + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/primitive/double", + "method": "POST", + "identifierOverride": "endpoint_endpoints/primitive.getAndReturnDouble" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.primitive.get_and_return_double(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": null, + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.primitive.get_and_return_double(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": null, + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/primitive/boolean", + "method": "POST", + "identifierOverride": "endpoint_endpoints/primitive.getAndReturnBool" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.primitive.get_and_return_bool(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": null, + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.primitive.get_and_return_bool(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": null, + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/primitive/datetime", + "method": "POST", + "identifierOverride": "endpoint_endpoints/primitive.getAndReturnDatetime" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.primitive.get_and_return_datetime(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": null, + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.primitive.get_and_return_datetime(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": null, + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/primitive/date", + "method": "POST", + "identifierOverride": "endpoint_endpoints/primitive.getAndReturnDate" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.primitive.get_and_return_date(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": null, + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.primitive.get_and_return_date(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": null, + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/primitive/uuid", + "method": "POST", + "identifierOverride": "endpoint_endpoints/primitive.getAndReturnUUID" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.primitive.get_and_return_uuid(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": null, + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.primitive.get_and_return_uuid(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": null, + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/primitive/base64", + "method": "POST", + "identifierOverride": "endpoint_endpoints/primitive.getAndReturnBase64" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.primitive.get_and_return_base_64(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": null, + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.primitive.get_and_return_base_64(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": null, + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/union", + "method": "POST", + "identifierOverride": "endpoint_endpoints/union.getAndReturnUnion" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.endpoints.union.get_and_return_union(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "discriminantField": "animal", + "members": { + "dog": { + "imports": [ + "from seed.types.union import Animal_Dog" + ], + "isOptional": true, + "templateString": "request=Animal_Dog($FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "name=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "name", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "likes_to_woof=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "likesToWoof", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "type": "generic" + }, + "cat": { + "imports": [ + "from seed.types.union import Animal_Cat" + ], + "isOptional": true, + "templateString": "request=Animal_Cat($FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "name=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "name", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "likes_to_meow=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "likesToMeow", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "type": "generic" + } + }, + "templateInput": { + "location": "RELATIVE" + }, + "type": "discriminatedUnion" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.endpoints.union.get_and_return_union(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "discriminantField": "animal", + "members": { + "dog": { + "imports": [ + "from seed.types.union import Animal_Dog" + ], + "isOptional": true, + "templateString": "request=Animal_Dog($FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "name=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "name", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "likes_to_woof=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "likesToWoof", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "type": "generic" + }, + "cat": { + "imports": [ + "from seed.types.union import Animal_Cat" + ], + "isOptional": true, + "templateString": "request=Animal_Cat($FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "name=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "name", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "likes_to_meow=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "likesToMeow", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "type": "generic" + } + }, + "templateInput": { + "location": "RELATIVE" + }, + "type": "discriminatedUnion" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/req-bodies/object", + "method": "POST", + "identifierOverride": "endpoint_inlined-requests.postWithObjectBodyandResponse" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.inlined_requests.post_with_object_bodyand_response(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "integer=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "integer", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [ + "from seed.types.object import ObjectWithOptionalField" + ], + "isOptional": true, + "templateString": "nested_object=ObjectWithOptionalField(\n\t\t$FERN_INPUT\n\t)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.string", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "integer=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.integer", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "long_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.long", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "double=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.double", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "bool_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.bool", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "datetime=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.datetime", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "date=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.date", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "uuid_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.uuid", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "base_64=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.base64", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "list_=[\n\t\t\t$FERN_INPUT\n\t\t]", + "delimiter": ",\n\t\t\t", + "innerTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "templateInput": { + "location": "BODY", + "path": "NestedObject.list" + }, + "type": "iterable" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "map_={\n\t\t\t$FERN_INPUT\n\t\t}", + "delimiter": ",\n\t\t\t", + "keyTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "valueTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "keyValueSeparator": ": ", + "templateInput": { + "location": "BODY", + "path": "NestedObject.map" + }, + "type": "dict" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "bigint=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.bigint", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t\t", + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.inlined_requests.post_with_object_bodyand_response(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "string", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "integer=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "integer", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [ + "from seed.types.object import ObjectWithOptionalField" + ], + "isOptional": true, + "templateString": "nested_object=ObjectWithOptionalField(\n\t\t$FERN_INPUT\n\t)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "string=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.string", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "integer=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.integer", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "long_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.long", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "double=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.double", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "bool_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.bool", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "datetime=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.datetime", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "date=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.date", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "uuid_=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.uuid", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "base_64=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.base64", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "list_=[\n\t\t\t$FERN_INPUT\n\t\t]", + "delimiter": ",\n\t\t\t", + "innerTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "templateInput": { + "location": "BODY", + "path": "NestedObject.list" + }, + "type": "iterable" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "containerTemplateString": "map_={\n\t\t\t$FERN_INPUT\n\t\t}", + "delimiter": ",\n\t\t\t", + "keyTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "valueTemplate": { + "imports": [], + "isOptional": true, + "templateString": "$FERN_INPUT", + "templateInputs": [ + { + "location": "RELATIVE", + "path": null, + "type": "payload" + } + ], + "type": "generic" + }, + "keyValueSeparator": ": ", + "templateInput": { + "location": "BODY", + "path": "NestedObject.map" + }, + "type": "dict" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "bigint=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": "NestedObject.bigint", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t\t", + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/no-auth", + "method": "POST", + "identifierOverride": "endpoint_no-auth.postWithNoAuth" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.no_auth.post_with_no_auth(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": null, + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.no_auth.post_with_no_auth(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": null, + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/no-req-body", + "method": "GET", + "identifierOverride": "endpoint_no-req-body.getWithNoRequestBody" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.no_req_body.get_with_no_request_body(\n\t$FERN_INPUT\n)", + "templateInputs": [], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.no_req_body.get_with_no_request_body(\n\t$FERN_INPUT\n)", + "templateInputs": [], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/no-req-body", + "method": "POST", + "identifierOverride": "endpoint_no-req-body.postWithNoRequestBody" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.no_req_body.post_with_no_request_body(\n\t$FERN_INPUT\n)", + "templateInputs": [], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.no_req_body.post_with_no_request_body(\n\t$FERN_INPUT\n)", + "templateInputs": [], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + }, + { + "sdk": { + "package": "fern_exhaustive", + "version": "0.0.1", + "type": "python" + }, + "endpointId": { + "path": "/test-headers/custom-header", + "method": "POST", + "identifierOverride": "endpoint_req-with-headers.getWithCustomHeader" + }, + "snippetTemplate": { + "clientInstantiation": { + "imports": [ + "from seed import SeedExhaustive" + ], + "isOptional": true, + "templateString": "client = SeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "client.req_with_headers.get_with_custom_header(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "x_test_endpoint_header=$FERN_INPUT", + "templateInputs": [ + { + "location": "HEADERS", + "path": "X-TEST-ENDPOINT-HEADER", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": null, + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + }, + "additionalTemplates": { + "async": { + "clientInstantiation": { + "imports": [ + "from seed import AsyncSeedExhaustive" + ], + "isOptional": true, + "templateString": "client = AsyncSeedExhaustive(base_url=\"https://yourhost.com/path/to/api\", $FERN_INPUT, )", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": false, + "templateString": "token=$FERN_INPUT", + "templateInputs": [ + { + "location": "AUTH", + "path": "token", + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",", + "type": "generic" + }, + "functionInvocation": { + "imports": [], + "isOptional": true, + "templateString": "await client.req_with_headers.get_with_custom_header(\n\t$FERN_INPUT\n)", + "templateInputs": [ + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "x_test_endpoint_header=$FERN_INPUT", + "templateInputs": [ + { + "location": "HEADERS", + "path": "X-TEST-ENDPOINT-HEADER", + "type": "payload" + } + ], + "type": "generic" + } + }, + { + "type": "template", + "value": { + "imports": [], + "isOptional": true, + "templateString": "request=$FERN_INPUT", + "templateInputs": [ + { + "location": "BODY", + "path": null, + "type": "payload" + } + ], + "type": "generic" + } + } + ], + "inputDelimiter": ",\n\t", + "type": "generic" + }, + "type": "v1" + } + } + } +] \ No newline at end of file diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/snippet.json b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/snippet.json new file mode 100644 index 00000000000..a5180cd2085 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/snippet.json @@ -0,0 +1,512 @@ +{ + "types": {}, + "endpoints": [ + { + "example_identifier": "default", + "id": { + "path": "/container/list-of-primitives", + "method": "POST", + "identifier_override": "endpoint_endpoints/container.getAndReturnListOfPrimitives" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.container.get_and_return_list_of_primitives(\n request=[\"string\"],\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.container.get_and_return_list_of_primitives(\n request=[\"string\"],\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/container/list-of-objects", + "method": "POST", + "identifier_override": "endpoint_endpoints/container.getAndReturnListOfObjects" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\nfrom seed.types.object import ObjectWithRequiredField\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.container.get_and_return_list_of_objects(\n request=[\n ObjectWithRequiredField(\n string=\"string\",\n )\n ],\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\nfrom seed.types.object import ObjectWithRequiredField\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.container.get_and_return_list_of_objects(\n request=[\n ObjectWithRequiredField(\n string=\"string\",\n )\n ],\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/container/set-of-primitives", + "method": "POST", + "identifier_override": "endpoint_endpoints/container.getAndReturnSetOfPrimitives" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.container.get_and_return_set_of_primitives(\n request={\"string\"},\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.container.get_and_return_set_of_primitives(\n request={\"string\"},\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/container/set-of-objects", + "method": "POST", + "identifier_override": "endpoint_endpoints/container.getAndReturnSetOfObjects" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\nfrom seed.types.object import ObjectWithRequiredField\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.container.get_and_return_set_of_objects(\n request=[\n ObjectWithRequiredField(\n string=\"string\",\n )\n ],\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\nfrom seed.types.object import ObjectWithRequiredField\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.container.get_and_return_set_of_objects(\n request=[\n ObjectWithRequiredField(\n string=\"string\",\n )\n ],\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/container/map-prim-to-prim", + "method": "POST", + "identifier_override": "endpoint_endpoints/container.getAndReturnMapPrimToPrim" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.container.get_and_return_map_prim_to_prim(\n request={\"string\": \"string\"},\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.container.get_and_return_map_prim_to_prim(\n request={\"string\": \"string\"},\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/container/map-prim-to-object", + "method": "POST", + "identifier_override": "endpoint_endpoints/container.getAndReturnMapOfPrimToObject" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\nfrom seed.types.object import ObjectWithRequiredField\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.container.get_and_return_map_of_prim_to_object(\n request={\n \"string\": ObjectWithRequiredField(\n string=\"string\",\n )\n },\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\nfrom seed.types.object import ObjectWithRequiredField\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.container.get_and_return_map_of_prim_to_object(\n request={\n \"string\": ObjectWithRequiredField(\n string=\"string\",\n )\n },\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/container/opt-objects", + "method": "POST", + "identifier_override": "endpoint_endpoints/container.getAndReturnOptional" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\nfrom seed.types.object import ObjectWithRequiredField\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.container.get_and_return_optional(\n request=ObjectWithRequiredField(\n string=\"string\",\n ),\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\nfrom seed.types.object import ObjectWithRequiredField\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.container.get_and_return_optional(\n request=ObjectWithRequiredField(\n string=\"string\",\n ),\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/enum", + "method": "POST", + "identifier_override": "endpoint_endpoints/enum.getAndReturnEnum" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.enum.get_and_return_enum(\n request=\"SUNNY\",\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.enum.get_and_return_enum(\n request=\"SUNNY\",\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/http-methods/{id}", + "method": "GET", + "identifier_override": "endpoint_endpoints/http-methods.testGet" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.http_methods.test_get(\n id=\"string\",\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.http_methods.test_get(\n id=\"string\",\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/http-methods", + "method": "POST", + "identifier_override": "endpoint_endpoints/http-methods.testPost" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.http_methods.test_post(\n string=\"string\",\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.http_methods.test_post(\n string=\"string\",\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/http-methods/{id}", + "method": "PUT", + "identifier_override": "endpoint_endpoints/http-methods.testPut" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.http_methods.test_put(\n id=\"string\",\n string=\"string\",\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.http_methods.test_put(\n id=\"string\",\n string=\"string\",\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/http-methods/{id}", + "method": "PATCH", + "identifier_override": "endpoint_endpoints/http-methods.testPatch" + }, + "snippet": { + "sync_client": "import datetime\nimport uuid\n\nfrom seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.http_methods.test_patch(\n id=\"string\",\n string=\"string\",\n integer=1,\n long_=1000000,\n double=1.1,\n bool_=True,\n datetime=datetime.datetime.fromisoformat(\n \"2024-01-15 09:30:00+00:00\",\n ),\n date=datetime.date.fromisoformat(\n \"2023-01-15\",\n ),\n uuid_=uuid.UUID(\n \"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n ),\n base_64=\"SGVsbG8gd29ybGQh\",\n list_=[\"string\"],\n set_={\"string\"},\n map_={1: \"string\"},\n bigint=\"123456789123456789\",\n)\n", + "async_client": "import asyncio\nimport datetime\nimport uuid\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.http_methods.test_patch(\n id=\"string\",\n string=\"string\",\n integer=1,\n long_=1000000,\n double=1.1,\n bool_=True,\n datetime=datetime.datetime.fromisoformat(\n \"2024-01-15 09:30:00+00:00\",\n ),\n date=datetime.date.fromisoformat(\n \"2023-01-15\",\n ),\n uuid_=uuid.UUID(\n \"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n ),\n base_64=\"SGVsbG8gd29ybGQh\",\n list_=[\"string\"],\n set_={\"string\"},\n map_={1: \"string\"},\n bigint=\"123456789123456789\",\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/http-methods/{id}", + "method": "DELETE", + "identifier_override": "endpoint_endpoints/http-methods.testDelete" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.http_methods.test_delete(\n id=\"string\",\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.http_methods.test_delete(\n id=\"string\",\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/object/get-and-return-with-optional-field", + "method": "POST", + "identifier_override": "endpoint_endpoints/object.getAndReturnWithOptionalField" + }, + "snippet": { + "sync_client": "import datetime\nimport uuid\n\nfrom seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.object.get_and_return_with_optional_field(\n string=\"string\",\n integer=1,\n long_=1000000,\n double=1.1,\n bool_=True,\n datetime=datetime.datetime.fromisoformat(\n \"2024-01-15 09:30:00+00:00\",\n ),\n date=datetime.date.fromisoformat(\n \"2023-01-15\",\n ),\n uuid_=uuid.UUID(\n \"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n ),\n base_64=\"SGVsbG8gd29ybGQh\",\n list_=[\"string\"],\n set_={\"string\"},\n map_={1: \"string\"},\n bigint=\"123456789123456789\",\n)\n", + "async_client": "import asyncio\nimport datetime\nimport uuid\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.object.get_and_return_with_optional_field(\n string=\"string\",\n integer=1,\n long_=1000000,\n double=1.1,\n bool_=True,\n datetime=datetime.datetime.fromisoformat(\n \"2024-01-15 09:30:00+00:00\",\n ),\n date=datetime.date.fromisoformat(\n \"2023-01-15\",\n ),\n uuid_=uuid.UUID(\n \"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n ),\n base_64=\"SGVsbG8gd29ybGQh\",\n list_=[\"string\"],\n set_={\"string\"},\n map_={1: \"string\"},\n bigint=\"123456789123456789\",\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/object/get-and-return-with-required-field", + "method": "POST", + "identifier_override": "endpoint_endpoints/object.getAndReturnWithRequiredField" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.object.get_and_return_with_required_field(\n string=\"string\",\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.object.get_and_return_with_required_field(\n string=\"string\",\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/object/get-and-return-with-map-of-map", + "method": "POST", + "identifier_override": "endpoint_endpoints/object.getAndReturnWithMapOfMap" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.object.get_and_return_with_map_of_map(\n map_={\"string\": {\"string\": \"string\"}},\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.object.get_and_return_with_map_of_map(\n map_={\"string\": {\"string\": \"string\"}},\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/object/get-and-return-nested-with-optional-field", + "method": "POST", + "identifier_override": "endpoint_endpoints/object.getAndReturnNestedWithOptionalField" + }, + "snippet": { + "sync_client": "import datetime\nimport uuid\n\nfrom seed import SeedExhaustive\nfrom seed.types.object import ObjectWithOptionalField\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.object.get_and_return_nested_with_optional_field(\n string=\"string\",\n nested_object=ObjectWithOptionalField(\n string=\"string\",\n integer=1,\n long_=1000000,\n double=1.1,\n bool_=True,\n datetime=datetime.datetime.fromisoformat(\n \"2024-01-15 09:30:00+00:00\",\n ),\n date=datetime.date.fromisoformat(\n \"2023-01-15\",\n ),\n uuid_=uuid.UUID(\n \"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n ),\n base_64=\"SGVsbG8gd29ybGQh\",\n list_=[\"string\"],\n set_={\"string\"},\n map_={1: \"string\"},\n bigint=\"123456789123456789\",\n ),\n)\n", + "async_client": "import asyncio\nimport datetime\nimport uuid\n\nfrom seed import AsyncSeedExhaustive\nfrom seed.types.object import ObjectWithOptionalField\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.object.get_and_return_nested_with_optional_field(\n string=\"string\",\n nested_object=ObjectWithOptionalField(\n string=\"string\",\n integer=1,\n long_=1000000,\n double=1.1,\n bool_=True,\n datetime=datetime.datetime.fromisoformat(\n \"2024-01-15 09:30:00+00:00\",\n ),\n date=datetime.date.fromisoformat(\n \"2023-01-15\",\n ),\n uuid_=uuid.UUID(\n \"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n ),\n base_64=\"SGVsbG8gd29ybGQh\",\n list_=[\"string\"],\n set_={\"string\"},\n map_={1: \"string\"},\n bigint=\"123456789123456789\",\n ),\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/object/get-and-return-nested-with-required-field/{string}", + "method": "POST", + "identifier_override": "endpoint_endpoints/object.getAndReturnNestedWithRequiredField" + }, + "snippet": { + "sync_client": "import datetime\nimport uuid\n\nfrom seed import SeedExhaustive\nfrom seed.types.object import ObjectWithOptionalField\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.object.get_and_return_nested_with_required_field(\n string_=\"string\",\n string=\"string\",\n nested_object=ObjectWithOptionalField(\n string=\"string\",\n integer=1,\n long_=1000000,\n double=1.1,\n bool_=True,\n datetime=datetime.datetime.fromisoformat(\n \"2024-01-15 09:30:00+00:00\",\n ),\n date=datetime.date.fromisoformat(\n \"2023-01-15\",\n ),\n uuid_=uuid.UUID(\n \"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n ),\n base_64=\"SGVsbG8gd29ybGQh\",\n list_=[\"string\"],\n set_={\"string\"},\n map_={1: \"string\"},\n bigint=\"123456789123456789\",\n ),\n)\n", + "async_client": "import asyncio\nimport datetime\nimport uuid\n\nfrom seed import AsyncSeedExhaustive\nfrom seed.types.object import ObjectWithOptionalField\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.object.get_and_return_nested_with_required_field(\n string_=\"string\",\n string=\"string\",\n nested_object=ObjectWithOptionalField(\n string=\"string\",\n integer=1,\n long_=1000000,\n double=1.1,\n bool_=True,\n datetime=datetime.datetime.fromisoformat(\n \"2024-01-15 09:30:00+00:00\",\n ),\n date=datetime.date.fromisoformat(\n \"2023-01-15\",\n ),\n uuid_=uuid.UUID(\n \"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n ),\n base_64=\"SGVsbG8gd29ybGQh\",\n list_=[\"string\"],\n set_={\"string\"},\n map_={1: \"string\"},\n bigint=\"123456789123456789\",\n ),\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/object/get-and-return-nested-with-required-field-list", + "method": "POST", + "identifier_override": "endpoint_endpoints/object.getAndReturnNestedWithRequiredFieldAsList" + }, + "snippet": { + "sync_client": "import datetime\nimport uuid\n\nfrom seed import SeedExhaustive\nfrom seed.types.object import (\n NestedObjectWithRequiredField,\n ObjectWithOptionalField,\n)\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.object.get_and_return_nested_with_required_field_as_list(\n request=[\n NestedObjectWithRequiredField(\n string=\"string\",\n nested_object=ObjectWithOptionalField(\n string=\"string\",\n integer=1,\n long_=1000000,\n double=1.1,\n bool_=True,\n datetime=datetime.datetime.fromisoformat(\n \"2024-01-15 09:30:00+00:00\",\n ),\n date=datetime.date.fromisoformat(\n \"2023-01-15\",\n ),\n uuid_=uuid.UUID(\n \"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n ),\n base_64=\"SGVsbG8gd29ybGQh\",\n list_=[\"string\"],\n set_={\"string\"},\n map_={1: \"string\"},\n bigint=\"123456789123456789\",\n ),\n )\n ],\n)\n", + "async_client": "import asyncio\nimport datetime\nimport uuid\n\nfrom seed import AsyncSeedExhaustive\nfrom seed.types.object import (\n NestedObjectWithRequiredField,\n ObjectWithOptionalField,\n)\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.object.get_and_return_nested_with_required_field_as_list(\n request=[\n NestedObjectWithRequiredField(\n string=\"string\",\n nested_object=ObjectWithOptionalField(\n string=\"string\",\n integer=1,\n long_=1000000,\n double=1.1,\n bool_=True,\n datetime=datetime.datetime.fromisoformat(\n \"2024-01-15 09:30:00+00:00\",\n ),\n date=datetime.date.fromisoformat(\n \"2023-01-15\",\n ),\n uuid_=uuid.UUID(\n \"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n ),\n base_64=\"SGVsbG8gd29ybGQh\",\n list_=[\"string\"],\n set_={\"string\"},\n map_={1: \"string\"},\n bigint=\"123456789123456789\",\n ),\n )\n ],\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/params/path/{param}", + "method": "GET", + "identifier_override": "endpoint_endpoints/params.getWithPath" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.params.get_with_path(\n param=\"string\",\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.params.get_with_path(\n param=\"string\",\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/params", + "method": "GET", + "identifier_override": "endpoint_endpoints/params.getWithQuery" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.params.get_with_query(\n query=\"string\",\n number=1,\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.params.get_with_query(\n query=\"string\",\n number=1,\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/params", + "method": "GET", + "identifier_override": "endpoint_endpoints/params.getWithAllowMultipleQuery" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.params.get_with_allow_multiple_query(\n query=\"string\",\n numer=1,\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.params.get_with_allow_multiple_query(\n query=\"string\",\n numer=1,\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/params/path-query/{param}", + "method": "GET", + "identifier_override": "endpoint_endpoints/params.getWithPathAndQuery" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.params.get_with_path_and_query(\n param=\"string\",\n query=\"string\",\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.params.get_with_path_and_query(\n param=\"string\",\n query=\"string\",\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/params/path/{param}", + "method": "PUT", + "identifier_override": "endpoint_endpoints/params.modifyWithPath" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.params.modify_with_path(\n param=\"string\",\n request=\"string\",\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.params.modify_with_path(\n param=\"string\",\n request=\"string\",\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/primitive/string", + "method": "POST", + "identifier_override": "endpoint_endpoints/primitive.getAndReturnString" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.primitive.get_and_return_string(\n request=\"string\",\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.primitive.get_and_return_string(\n request=\"string\",\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/primitive/integer", + "method": "POST", + "identifier_override": "endpoint_endpoints/primitive.getAndReturnInt" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.primitive.get_and_return_int(\n request=1,\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.primitive.get_and_return_int(\n request=1,\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/primitive/long", + "method": "POST", + "identifier_override": "endpoint_endpoints/primitive.getAndReturnLong" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.primitive.get_and_return_long(\n request=1000000,\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.primitive.get_and_return_long(\n request=1000000,\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/primitive/double", + "method": "POST", + "identifier_override": "endpoint_endpoints/primitive.getAndReturnDouble" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.primitive.get_and_return_double(\n request=1.1,\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.primitive.get_and_return_double(\n request=1.1,\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/primitive/boolean", + "method": "POST", + "identifier_override": "endpoint_endpoints/primitive.getAndReturnBool" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.primitive.get_and_return_bool(\n request=True,\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.primitive.get_and_return_bool(\n request=True,\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/primitive/datetime", + "method": "POST", + "identifier_override": "endpoint_endpoints/primitive.getAndReturnDatetime" + }, + "snippet": { + "sync_client": "import datetime\n\nfrom seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.primitive.get_and_return_datetime(\n request=datetime.datetime.fromisoformat(\n \"2024-01-15 09:30:00+00:00\",\n ),\n)\n", + "async_client": "import asyncio\nimport datetime\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.primitive.get_and_return_datetime(\n request=datetime.datetime.fromisoformat(\n \"2024-01-15 09:30:00+00:00\",\n ),\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/primitive/date", + "method": "POST", + "identifier_override": "endpoint_endpoints/primitive.getAndReturnDate" + }, + "snippet": { + "sync_client": "import datetime\n\nfrom seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.primitive.get_and_return_date(\n request=datetime.date.fromisoformat(\n \"2023-01-15\",\n ),\n)\n", + "async_client": "import asyncio\nimport datetime\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.primitive.get_and_return_date(\n request=datetime.date.fromisoformat(\n \"2023-01-15\",\n ),\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/primitive/uuid", + "method": "POST", + "identifier_override": "endpoint_endpoints/primitive.getAndReturnUUID" + }, + "snippet": { + "sync_client": "import uuid\n\nfrom seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.primitive.get_and_return_uuid(\n request=uuid.UUID(\n \"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n ),\n)\n", + "async_client": "import asyncio\nimport uuid\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.primitive.get_and_return_uuid(\n request=uuid.UUID(\n \"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n ),\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/primitive/base64", + "method": "POST", + "identifier_override": "endpoint_endpoints/primitive.getAndReturnBase64" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.primitive.get_and_return_base_64(\n request=\"SGVsbG8gd29ybGQh\",\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.primitive.get_and_return_base_64(\n request=\"SGVsbG8gd29ybGQh\",\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/union", + "method": "POST", + "identifier_override": "endpoint_endpoints/union.getAndReturnUnion" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\nfrom seed.types.union import Animal_Dog\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.endpoints.union.get_and_return_union(\n request=Animal_Dog(\n name=\"string\",\n likes_to_woof=True,\n ),\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\nfrom seed.types.union import Animal_Dog\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.endpoints.union.get_and_return_union(\n request=Animal_Dog(\n name=\"string\",\n likes_to_woof=True,\n ),\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/req-bodies/object", + "method": "POST", + "identifier_override": "endpoint_inlined-requests.postWithObjectBodyandResponse" + }, + "snippet": { + "sync_client": "import datetime\nimport uuid\n\nfrom seed import SeedExhaustive\nfrom seed.types.object import ObjectWithOptionalField\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.inlined_requests.post_with_object_bodyand_response(\n string=\"string\",\n integer=1,\n nested_object=ObjectWithOptionalField(\n string=\"string\",\n integer=1,\n long_=1000000,\n double=1.1,\n bool_=True,\n datetime=datetime.datetime.fromisoformat(\n \"2024-01-15 09:30:00+00:00\",\n ),\n date=datetime.date.fromisoformat(\n \"2023-01-15\",\n ),\n uuid_=uuid.UUID(\n \"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n ),\n base_64=\"SGVsbG8gd29ybGQh\",\n list_=[\"string\"],\n set_={\"string\"},\n map_={1: \"string\"},\n bigint=\"123456789123456789\",\n ),\n)\n", + "async_client": "import asyncio\nimport datetime\nimport uuid\n\nfrom seed import AsyncSeedExhaustive\nfrom seed.types.object import ObjectWithOptionalField\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.inlined_requests.post_with_object_bodyand_response(\n string=\"string\",\n integer=1,\n nested_object=ObjectWithOptionalField(\n string=\"string\",\n integer=1,\n long_=1000000,\n double=1.1,\n bool_=True,\n datetime=datetime.datetime.fromisoformat(\n \"2024-01-15 09:30:00+00:00\",\n ),\n date=datetime.date.fromisoformat(\n \"2023-01-15\",\n ),\n uuid_=uuid.UUID(\n \"d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32\",\n ),\n base_64=\"SGVsbG8gd29ybGQh\",\n list_=[\"string\"],\n set_={\"string\"},\n map_={1: \"string\"},\n bigint=\"123456789123456789\",\n ),\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/no-auth", + "method": "POST", + "identifier_override": "endpoint_no-auth.postWithNoAuth" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.no_auth.post_with_no_auth(\n request={\"key\": \"value\"},\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.no_auth.post_with_no_auth(\n request={\"key\": \"value\"},\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/no-req-body", + "method": "GET", + "identifier_override": "endpoint_no-req-body.getWithNoRequestBody" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.no_req_body.get_with_no_request_body()\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.no_req_body.get_with_no_request_body()\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/no-req-body", + "method": "POST", + "identifier_override": "endpoint_no-req-body.postWithNoRequestBody" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.no_req_body.post_with_no_request_body()\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.no_req_body.post_with_no_request_body()\n\n\nasyncio.run(main())\n", + "type": "python" + } + }, + { + "example_identifier": "default", + "id": { + "path": "/test-headers/custom-header", + "method": "POST", + "identifier_override": "endpoint_req-with-headers.getWithCustomHeader" + }, + "snippet": { + "sync_client": "from seed import SeedExhaustive\n\nclient = SeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\nclient.req_with_headers.get_with_custom_header(\n x_test_service_header=\"string\",\n x_test_endpoint_header=\"string\",\n request=\"string\",\n)\n", + "async_client": "import asyncio\n\nfrom seed import AsyncSeedExhaustive\n\nclient = AsyncSeedExhaustive(\n token=\"YOUR_TOKEN\",\n base_url=\"https://yourhost.com/path/to/api\",\n)\n\n\nasync def main() -> None:\n await client.req_with_headers.get_with_custom_header(\n x_test_service_header=\"string\",\n x_test_endpoint_header=\"string\",\n request=\"string\",\n )\n\n\nasyncio.run(main())\n", + "type": "python" + } + } + ] +} \ No newline at end of file diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/__init__.py new file mode 100644 index 00000000000..eb56b0ce275 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/__init__.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +from . import endpoints, general_errors, inlined_requests, no_auth, no_req_body, req_with_headers, types +from .client import AsyncSeedExhaustive, SeedExhaustive +from .general_errors import BadObjectRequestInfo, BadRequestBody +from .version import __version__ + +__all__ = [ + "AsyncSeedExhaustive", + "BadObjectRequestInfo", + "BadRequestBody", + "SeedExhaustive", + "__version__", + "endpoints", + "general_errors", + "inlined_requests", + "no_auth", + "no_req_body", + "req_with_headers", + "types", +] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/client.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/client.py new file mode 100644 index 00000000000..b1b9764c7a7 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/client.py @@ -0,0 +1,124 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import httpx + +from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .endpoints.client import AsyncEndpointsClient, EndpointsClient +from .inlined_requests.client import AsyncInlinedRequestsClient, InlinedRequestsClient +from .no_auth.client import AsyncNoAuthClient, NoAuthClient +from .no_req_body.client import AsyncNoReqBodyClient, NoReqBodyClient +from .req_with_headers.client import AsyncReqWithHeadersClient, ReqWithHeadersClient + + +class SeedExhaustive: + """ + Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions. + + Parameters + ---------- + base_url : str + The base url to use for requests from the client. + + token : typing.Optional[typing.Union[str, typing.Callable[[], str]]] + timeout : typing.Optional[float] + The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced. + + follow_redirects : typing.Optional[bool] + Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in. + + httpx_client : typing.Optional[httpx.Client] + The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration. + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + """ + + def __init__( + self, + *, + base_url: str, + token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, + timeout: typing.Optional[float] = None, + follow_redirects: typing.Optional[bool] = True, + httpx_client: typing.Optional[httpx.Client] = None + ): + _defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None + self._client_wrapper = SyncClientWrapper( + base_url=base_url, + token=token, + httpx_client=httpx_client + if httpx_client is not None + else httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects) + if follow_redirects is not None + else httpx.Client(timeout=_defaulted_timeout), + timeout=_defaulted_timeout, + ) + self.endpoints = EndpointsClient(client_wrapper=self._client_wrapper) + self.inlined_requests = InlinedRequestsClient(client_wrapper=self._client_wrapper) + self.no_auth = NoAuthClient(client_wrapper=self._client_wrapper) + self.no_req_body = NoReqBodyClient(client_wrapper=self._client_wrapper) + self.req_with_headers = ReqWithHeadersClient(client_wrapper=self._client_wrapper) + + +class AsyncSeedExhaustive: + """ + Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions. + + Parameters + ---------- + base_url : str + The base url to use for requests from the client. + + token : typing.Optional[typing.Union[str, typing.Callable[[], str]]] + timeout : typing.Optional[float] + The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced. + + follow_redirects : typing.Optional[bool] + Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in. + + httpx_client : typing.Optional[httpx.AsyncClient] + The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration. + + Examples + -------- + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + """ + + def __init__( + self, + *, + base_url: str, + token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, + timeout: typing.Optional[float] = None, + follow_redirects: typing.Optional[bool] = True, + httpx_client: typing.Optional[httpx.AsyncClient] = None + ): + _defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None + self._client_wrapper = AsyncClientWrapper( + base_url=base_url, + token=token, + httpx_client=httpx_client + if httpx_client is not None + else httpx.AsyncClient(timeout=_defaulted_timeout, follow_redirects=follow_redirects) + if follow_redirects is not None + else httpx.AsyncClient(timeout=_defaulted_timeout), + timeout=_defaulted_timeout, + ) + self.endpoints = AsyncEndpointsClient(client_wrapper=self._client_wrapper) + self.inlined_requests = AsyncInlinedRequestsClient(client_wrapper=self._client_wrapper) + self.no_auth = AsyncNoAuthClient(client_wrapper=self._client_wrapper) + self.no_req_body = AsyncNoReqBodyClient(client_wrapper=self._client_wrapper) + self.req_with_headers = AsyncReqWithHeadersClient(client_wrapper=self._client_wrapper) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/__init__.py new file mode 100644 index 00000000000..5a0bee343d0 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/__init__.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +from .api_error import ApiError +from .client_wrapper import AsyncClientWrapper, BaseClientWrapper, SyncClientWrapper +from .datetime_utils import serialize_datetime +from .file import File, convert_file_dict_to_httpx_tuples +from .http_client import AsyncHttpClient, HttpClient +from .jsonable_encoder import jsonable_encoder +from .pydantic_utilities import ( + IS_PYDANTIC_V2, + UniversalBaseModel, + UniversalRootModel, + deep_union_pydantic_dicts, + parse_obj_as, + universal_field_validator, + universal_root_validator, + update_forward_refs, +) +from .query_encoder import encode_query +from .remove_none_from_dict import remove_none_from_dict +from .request_options import RequestOptions +from .serialization import FieldMetadata, convert_and_respect_annotation_metadata + +__all__ = [ + "ApiError", + "AsyncClientWrapper", + "AsyncHttpClient", + "BaseClientWrapper", + "FieldMetadata", + "File", + "HttpClient", + "IS_PYDANTIC_V2", + "RequestOptions", + "SyncClientWrapper", + "UniversalBaseModel", + "UniversalRootModel", + "convert_and_respect_annotation_metadata", + "convert_file_dict_to_httpx_tuples", + "deep_union_pydantic_dicts", + "encode_query", + "jsonable_encoder", + "parse_obj_as", + "remove_none_from_dict", + "serialize_datetime", + "universal_field_validator", + "universal_root_validator", + "update_forward_refs", +] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/api_error.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/api_error.py new file mode 100644 index 00000000000..2e9fc5431cd --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/api_error.py @@ -0,0 +1,15 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + + +class ApiError(Exception): + status_code: typing.Optional[int] + body: typing.Any + + def __init__(self, *, status_code: typing.Optional[int] = None, body: typing.Any = None): + self.status_code = status_code + self.body = body + + def __str__(self) -> str: + return f"status_code: {self.status_code}, body: {self.body}" diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/client_wrapper.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/client_wrapper.py new file mode 100644 index 00000000000..8d01b584b82 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/client_wrapper.py @@ -0,0 +1,79 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import httpx + +from .http_client import AsyncHttpClient, HttpClient + + +class BaseClientWrapper: + def __init__( + self, + *, + token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, + base_url: str, + timeout: typing.Optional[float] = None, + ): + self._token = token + self._base_url = base_url + self._timeout = timeout + + def get_headers(self) -> typing.Dict[str, str]: + headers: typing.Dict[str, str] = { + "X-Fern-Language": "Python", + "X-Fern-SDK-Name": "fern_exhaustive", + "X-Fern-SDK-Version": "0.0.1", + } + token = self._get_token() + if token is not None: + headers["Authorization"] = f"Bearer {token}" + return headers + + def _get_token(self) -> typing.Optional[str]: + if isinstance(self._token, str) or self._token is None: + return self._token + else: + return self._token() + + def get_base_url(self) -> str: + return self._base_url + + def get_timeout(self) -> typing.Optional[float]: + return self._timeout + + +class SyncClientWrapper(BaseClientWrapper): + def __init__( + self, + *, + token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, + base_url: str, + timeout: typing.Optional[float] = None, + httpx_client: httpx.Client, + ): + super().__init__(token=token, base_url=base_url, timeout=timeout) + self.httpx_client = HttpClient( + httpx_client=httpx_client, + base_headers=self.get_headers(), + base_timeout=self.get_timeout(), + base_url=self.get_base_url(), + ) + + +class AsyncClientWrapper(BaseClientWrapper): + def __init__( + self, + *, + token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None, + base_url: str, + timeout: typing.Optional[float] = None, + httpx_client: httpx.AsyncClient, + ): + super().__init__(token=token, base_url=base_url, timeout=timeout) + self.httpx_client = AsyncHttpClient( + httpx_client=httpx_client, + base_headers=self.get_headers(), + base_timeout=self.get_timeout(), + base_url=self.get_base_url(), + ) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/datetime_utils.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/datetime_utils.py new file mode 100644 index 00000000000..7c9864a944c --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/datetime_utils.py @@ -0,0 +1,28 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt + + +def serialize_datetime(v: dt.datetime) -> str: + """ + Serialize a datetime including timezone info. + + Uses the timezone info provided if present, otherwise uses the current runtime's timezone info. + + UTC datetimes end in "Z" while all other timezones are represented as offset from UTC, e.g. +05:00. + """ + + def _serialize_zoned_datetime(v: dt.datetime) -> str: + if v.tzinfo is not None and v.tzinfo.tzname(None) == dt.timezone.utc.tzname(None): + # UTC is a special case where we use "Z" at the end instead of "+00:00" + return v.isoformat().replace("+00:00", "Z") + else: + # Delegate to the typical +/- offset format + return v.isoformat() + + if v.tzinfo is not None: + return _serialize_zoned_datetime(v) + else: + local_tz = dt.datetime.now().astimezone().tzinfo + localized_dt = v.replace(tzinfo=local_tz) + return _serialize_zoned_datetime(localized_dt) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/file.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/file.py new file mode 100644 index 00000000000..cb0d40bbbf3 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/file.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +# File typing inspired by the flexibility of types within the httpx library +# https://github.com/encode/httpx/blob/master/httpx/_types.py +FileContent = typing.Union[typing.IO[bytes], bytes, str] +File = typing.Union[ + # file (or bytes) + FileContent, + # (filename, file (or bytes)) + typing.Tuple[typing.Optional[str], FileContent], + # (filename, file (or bytes), content_type) + typing.Tuple[typing.Optional[str], FileContent, typing.Optional[str]], + # (filename, file (or bytes), content_type, headers) + typing.Tuple[typing.Optional[str], FileContent, typing.Optional[str], typing.Mapping[str, str]], +] + + +def convert_file_dict_to_httpx_tuples( + d: typing.Dict[str, typing.Union[File, typing.List[File]]] +) -> typing.List[typing.Tuple[str, File]]: + """ + The format we use is a list of tuples, where the first element is the + name of the file and the second is the file object. Typically HTTPX wants + a dict, but to be able to send lists of files, you have to use the list + approach (which also works for non-lists) + https://github.com/encode/httpx/pull/1032 + """ + + httpx_tuples = [] + for key, file_like in d.items(): + if isinstance(file_like, list): + for file_like_item in file_like: + httpx_tuples.append((key, file_like_item)) + else: + httpx_tuples.append((key, file_like)) + return httpx_tuples diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/http_client.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/http_client.py new file mode 100644 index 00000000000..9333d8a7f15 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/http_client.py @@ -0,0 +1,475 @@ +# This file was auto-generated by Fern from our API Definition. + +import asyncio +import email.utils +import json +import re +import time +import typing +import urllib.parse +from contextlib import asynccontextmanager, contextmanager +from random import random + +import httpx + +from .file import File, convert_file_dict_to_httpx_tuples +from .jsonable_encoder import jsonable_encoder +from .query_encoder import encode_query +from .remove_none_from_dict import remove_none_from_dict +from .request_options import RequestOptions + +INITIAL_RETRY_DELAY_SECONDS = 0.5 +MAX_RETRY_DELAY_SECONDS = 10 +MAX_RETRY_DELAY_SECONDS_FROM_HEADER = 30 + + +def _parse_retry_after(response_headers: httpx.Headers) -> typing.Optional[float]: + """ + This function parses the `Retry-After` header in a HTTP response and returns the number of seconds to wait. + + Inspired by the urllib3 retry implementation. + """ + retry_after_ms = response_headers.get("retry-after-ms") + if retry_after_ms is not None: + try: + return int(retry_after_ms) / 1000 if retry_after_ms > 0 else 0 + except Exception: + pass + + retry_after = response_headers.get("retry-after") + if retry_after is None: + return None + + # Attempt to parse the header as an int. + if re.match(r"^\s*[0-9]+\s*$", retry_after): + seconds = float(retry_after) + # Fallback to parsing it as a date. + else: + retry_date_tuple = email.utils.parsedate_tz(retry_after) + if retry_date_tuple is None: + return None + if retry_date_tuple[9] is None: # Python 2 + # Assume UTC if no timezone was specified + # On Python2.7, parsedate_tz returns None for a timezone offset + # instead of 0 if no timezone is given, where mktime_tz treats + # a None timezone offset as local time. + retry_date_tuple = retry_date_tuple[:9] + (0,) + retry_date_tuple[10:] + + retry_date = email.utils.mktime_tz(retry_date_tuple) + seconds = retry_date - time.time() + + if seconds < 0: + seconds = 0 + + return seconds + + +def _retry_timeout(response: httpx.Response, retries: int) -> float: + """ + Determine the amount of time to wait before retrying a request. + This function begins by trying to parse a retry-after header from the response, and then proceeds to use exponential backoff + with a jitter to determine the number of seconds to wait. + """ + + # If the API asks us to wait a certain amount of time (and it's a reasonable amount), just do what it says. + retry_after = _parse_retry_after(response.headers) + if retry_after is not None and retry_after <= MAX_RETRY_DELAY_SECONDS_FROM_HEADER: + return retry_after + + # Apply exponential backoff, capped at MAX_RETRY_DELAY_SECONDS. + retry_delay = min(INITIAL_RETRY_DELAY_SECONDS * pow(2.0, retries), MAX_RETRY_DELAY_SECONDS) + + # Add a randomness / jitter to the retry delay to avoid overwhelming the server with retries. + timeout = retry_delay * (1 - 0.25 * random()) + return timeout if timeout >= 0 else 0 + + +def _should_retry(response: httpx.Response) -> bool: + retriable_400s = [429, 408, 409] + return response.status_code >= 500 or response.status_code in retriable_400s + + +def remove_omit_from_dict( + original: typing.Dict[str, typing.Optional[typing.Any]], omit: typing.Optional[typing.Any] +) -> typing.Dict[str, typing.Any]: + if omit is None: + return original + new: typing.Dict[str, typing.Any] = {} + for key, value in original.items(): + if value is not omit: + new[key] = value + return new + + +def maybe_filter_request_body( + data: typing.Optional[typing.Any], + request_options: typing.Optional[RequestOptions], + omit: typing.Optional[typing.Any], +) -> typing.Optional[typing.Any]: + if data is None: + return ( + jsonable_encoder(request_options.get("additional_body_parameters", {})) or {} + if request_options is not None + else None + ) + elif not isinstance(data, typing.Mapping): + data_content = jsonable_encoder(data) + else: + data_content = { + **(jsonable_encoder(remove_omit_from_dict(data, omit))), # type: ignore + **( + jsonable_encoder(request_options.get("additional_body_parameters", {})) or {} + if request_options is not None + else {} + ), + } + return data_content + + +# Abstracted out for testing purposes +def get_request_body( + *, + json: typing.Optional[typing.Any], + data: typing.Optional[typing.Any], + request_options: typing.Optional[RequestOptions], + omit: typing.Optional[typing.Any], +) -> typing.Tuple[typing.Optional[typing.Any], typing.Optional[typing.Any]]: + json_body = None + data_body = None + if data is not None: + data_body = maybe_filter_request_body(data, request_options, omit) + else: + # If both data and json are None, we send json data in the event extra properties are specified + json_body = maybe_filter_request_body(json, request_options, omit) + + return json_body, data_body + + +class HttpClient: + def __init__( + self, + *, + httpx_client: httpx.Client, + base_timeout: typing.Optional[float], + base_headers: typing.Dict[str, str], + base_url: typing.Optional[str] = None, + ): + self.base_url = base_url + self.base_timeout = base_timeout + self.base_headers = base_headers + self.httpx_client = httpx_client + + def get_base_url(self, maybe_base_url: typing.Optional[str]) -> str: + base_url = self.base_url if maybe_base_url is None else maybe_base_url + if base_url is None: + raise ValueError("A base_url is required to make this request, please provide one and try again.") + return base_url + + def request( + self, + path: typing.Optional[str] = None, + *, + method: str, + base_url: typing.Optional[str] = None, + params: typing.Optional[typing.Dict[str, typing.Any]] = None, + json: typing.Optional[typing.Any] = None, + data: typing.Optional[typing.Any] = None, + content: typing.Optional[typing.Union[bytes, typing.Iterator[bytes], typing.AsyncIterator[bytes]]] = None, + files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None, + headers: typing.Optional[typing.Dict[str, typing.Any]] = None, + request_options: typing.Optional[RequestOptions] = None, + retries: int = 0, + omit: typing.Optional[typing.Any] = None, + ) -> httpx.Response: + base_url = self.get_base_url(base_url) + timeout = ( + request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else self.base_timeout + ) + + json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit) + + response = self.httpx_client.request( + method=method, + url=urllib.parse.urljoin(f"{base_url}/", path), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self.base_headers, + **(headers if headers is not None else {}), + **(request_options.get("additional_headers", {}) or {} if request_options is not None else {}), + } + ) + ), + params=encode_query( + jsonable_encoder( + remove_none_from_dict( + remove_omit_from_dict( + { + **(params if params is not None else {}), + **( + request_options.get("additional_query_parameters", {}) or {} + if request_options is not None + else {} + ), + }, + omit, + ) + ) + ) + ), + json=json_body, + data=data_body, + content=content, + files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files)) if files is not None else None, + timeout=timeout, + ) + + max_retries: int = request_options.get("max_retries", 0) if request_options is not None else 0 + if _should_retry(response=response): + if max_retries > retries: + time.sleep(_retry_timeout(response=response, retries=retries)) + return self.request( + path=path, + method=method, + base_url=base_url, + params=params, + json=json, + content=content, + files=files, + headers=headers, + request_options=request_options, + retries=retries + 1, + omit=omit, + ) + + return response + + @contextmanager + def stream( + self, + path: typing.Optional[str] = None, + *, + method: str, + base_url: typing.Optional[str] = None, + params: typing.Optional[typing.Dict[str, typing.Any]] = None, + json: typing.Optional[typing.Any] = None, + data: typing.Optional[typing.Any] = None, + content: typing.Optional[typing.Union[bytes, typing.Iterator[bytes], typing.AsyncIterator[bytes]]] = None, + files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None, + headers: typing.Optional[typing.Dict[str, typing.Any]] = None, + request_options: typing.Optional[RequestOptions] = None, + retries: int = 0, + omit: typing.Optional[typing.Any] = None, + ) -> typing.Iterator[httpx.Response]: + base_url = self.get_base_url(base_url) + timeout = ( + request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else self.base_timeout + ) + + json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit) + + with self.httpx_client.stream( + method=method, + url=urllib.parse.urljoin(f"{base_url}/", path), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self.base_headers, + **(headers if headers is not None else {}), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + params=encode_query( + jsonable_encoder( + remove_none_from_dict( + remove_omit_from_dict( + { + **(params if params is not None else {}), + **( + request_options.get("additional_query_parameters", {}) + if request_options is not None + else {} + ), + }, + omit, + ) + ) + ) + ), + json=json_body, + data=data_body, + content=content, + files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files)) if files is not None else None, + timeout=timeout, + ) as stream: + yield stream + + +class AsyncHttpClient: + def __init__( + self, + *, + httpx_client: httpx.AsyncClient, + base_timeout: typing.Optional[float], + base_headers: typing.Dict[str, str], + base_url: typing.Optional[str] = None, + ): + self.base_url = base_url + self.base_timeout = base_timeout + self.base_headers = base_headers + self.httpx_client = httpx_client + + def get_base_url(self, maybe_base_url: typing.Optional[str]) -> str: + base_url = self.base_url if maybe_base_url is None else maybe_base_url + if base_url is None: + raise ValueError("A base_url is required to make this request, please provide one and try again.") + return base_url + + async def request( + self, + path: typing.Optional[str] = None, + *, + method: str, + base_url: typing.Optional[str] = None, + params: typing.Optional[typing.Dict[str, typing.Any]] = None, + json: typing.Optional[typing.Any] = None, + data: typing.Optional[typing.Any] = None, + content: typing.Optional[typing.Union[bytes, typing.Iterator[bytes], typing.AsyncIterator[bytes]]] = None, + files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None, + headers: typing.Optional[typing.Dict[str, typing.Any]] = None, + request_options: typing.Optional[RequestOptions] = None, + retries: int = 0, + omit: typing.Optional[typing.Any] = None, + ) -> httpx.Response: + base_url = self.get_base_url(base_url) + timeout = ( + request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else self.base_timeout + ) + + json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit) + + # Add the input to each of these and do None-safety checks + response = await self.httpx_client.request( + method=method, + url=urllib.parse.urljoin(f"{base_url}/", path), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self.base_headers, + **(headers if headers is not None else {}), + **(request_options.get("additional_headers", {}) or {} if request_options is not None else {}), + } + ) + ), + params=encode_query( + jsonable_encoder( + remove_none_from_dict( + remove_omit_from_dict( + { + **(params if params is not None else {}), + **( + request_options.get("additional_query_parameters", {}) or {} + if request_options is not None + else {} + ), + }, + omit, + ) + ) + ) + ), + json=json_body, + data=data_body, + content=content, + files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files)) if files is not None else None, + timeout=timeout, + ) + + max_retries: int = request_options.get("max_retries", 0) if request_options is not None else 0 + if _should_retry(response=response): + if max_retries > retries: + await asyncio.sleep(_retry_timeout(response=response, retries=retries)) + return await self.request( + path=path, + method=method, + base_url=base_url, + params=params, + json=json, + content=content, + files=files, + headers=headers, + request_options=request_options, + retries=retries + 1, + omit=omit, + ) + return response + + @asynccontextmanager + async def stream( + self, + path: typing.Optional[str] = None, + *, + method: str, + base_url: typing.Optional[str] = None, + params: typing.Optional[typing.Dict[str, typing.Any]] = None, + json: typing.Optional[typing.Any] = None, + data: typing.Optional[typing.Any] = None, + content: typing.Optional[typing.Union[bytes, typing.Iterator[bytes], typing.AsyncIterator[bytes]]] = None, + files: typing.Optional[typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]]] = None, + headers: typing.Optional[typing.Dict[str, typing.Any]] = None, + request_options: typing.Optional[RequestOptions] = None, + retries: int = 0, + omit: typing.Optional[typing.Any] = None, + ) -> typing.AsyncIterator[httpx.Response]: + base_url = self.get_base_url(base_url) + timeout = ( + request_options.get("timeout_in_seconds") + if request_options is not None and request_options.get("timeout_in_seconds") is not None + else self.base_timeout + ) + + json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit) + + async with self.httpx_client.stream( + method=method, + url=urllib.parse.urljoin(f"{base_url}/", path), + headers=jsonable_encoder( + remove_none_from_dict( + { + **self.base_headers, + **(headers if headers is not None else {}), + **(request_options.get("additional_headers", {}) if request_options is not None else {}), + } + ) + ), + params=encode_query( + jsonable_encoder( + remove_none_from_dict( + remove_omit_from_dict( + { + **(params if params is not None else {}), + **( + request_options.get("additional_query_parameters", {}) + if request_options is not None + else {} + ), + }, + omit=omit, + ) + ) + ) + ), + json=json_body, + data=data_body, + content=content, + files=convert_file_dict_to_httpx_tuples(remove_none_from_dict(files)) if files is not None else None, + timeout=timeout, + ) as stream: + yield stream diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/jsonable_encoder.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/jsonable_encoder.py new file mode 100644 index 00000000000..d3fd328fd41 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/jsonable_encoder.py @@ -0,0 +1,97 @@ +# This file was auto-generated by Fern from our API Definition. + +""" +jsonable_encoder converts a Python object to a JSON-friendly dict +(e.g. datetimes to strings, Pydantic models to dicts). + +Taken from FastAPI, and made a bit simpler +https://github.com/tiangolo/fastapi/blob/master/fastapi/encoders.py +""" + +import base64 +import dataclasses +import datetime as dt +from enum import Enum +from pathlib import PurePath +from types import GeneratorType +from typing import Any, Callable, Dict, List, Optional, Set, Union + +import pydantic + +from .datetime_utils import serialize_datetime +from .pydantic_utilities import IS_PYDANTIC_V2, encode_by_type, to_jsonable_with_fallback + +SetIntStr = Set[Union[int, str]] +DictIntStrAny = Dict[Union[int, str], Any] + + +def jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any], Any]]] = None) -> Any: + custom_encoder = custom_encoder or {} + if custom_encoder: + if type(obj) in custom_encoder: + return custom_encoder[type(obj)](obj) + else: + for encoder_type, encoder_instance in custom_encoder.items(): + if isinstance(obj, encoder_type): + return encoder_instance(obj) + if isinstance(obj, pydantic.BaseModel): + if IS_PYDANTIC_V2: + encoder = getattr(obj.model_config, "json_encoders", {}) # type: ignore # Pydantic v2 + else: + encoder = getattr(obj.__config__, "json_encoders", {}) # type: ignore # Pydantic v1 + if custom_encoder: + encoder.update(custom_encoder) + obj_dict = obj.dict(by_alias=True) + if "__root__" in obj_dict: + obj_dict = obj_dict["__root__"] + if "root" in obj_dict: + obj_dict = obj_dict["root"] + return jsonable_encoder(obj_dict, custom_encoder=encoder) + if dataclasses.is_dataclass(obj): + obj_dict = dataclasses.asdict(obj) # type: ignore + return jsonable_encoder(obj_dict, custom_encoder=custom_encoder) + if isinstance(obj, bytes): + return base64.b64encode(obj).decode("utf-8") + if isinstance(obj, Enum): + return obj.value + if isinstance(obj, PurePath): + return str(obj) + if isinstance(obj, (str, int, float, type(None))): + return obj + if isinstance(obj, dt.datetime): + return serialize_datetime(obj) + if isinstance(obj, dt.date): + return str(obj) + if isinstance(obj, dict): + encoded_dict = {} + allowed_keys = set(obj.keys()) + for key, value in obj.items(): + if key in allowed_keys: + encoded_key = jsonable_encoder(key, custom_encoder=custom_encoder) + encoded_value = jsonable_encoder(value, custom_encoder=custom_encoder) + encoded_dict[encoded_key] = encoded_value + return encoded_dict + if isinstance(obj, (list, set, frozenset, GeneratorType, tuple)): + encoded_list = [] + for item in obj: + encoded_list.append(jsonable_encoder(item, custom_encoder=custom_encoder)) + return encoded_list + + def fallback_serializer(o: Any) -> Any: + attempt_encode = encode_by_type(o) + if attempt_encode is not None: + return attempt_encode + + try: + data = dict(o) + except Exception as e: + errors: List[Exception] = [] + errors.append(e) + try: + data = vars(o) + except Exception as e: + errors.append(e) + raise ValueError(errors) from e + return jsonable_encoder(data, custom_encoder=custom_encoder) + + return to_jsonable_with_fallback(obj, fallback_serializer) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/pydantic_utilities.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/pydantic_utilities.py new file mode 100644 index 00000000000..170a563d6eb --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/pydantic_utilities.py @@ -0,0 +1,179 @@ +# This file was auto-generated by Fern from our API Definition. + +# nopycln: file +import datetime as dt +import typing +from collections import defaultdict +from functools import wraps + +import pydantic + +from .datetime_utils import serialize_datetime + +IS_PYDANTIC_V2 = pydantic.VERSION.startswith("2.") + +if IS_PYDANTIC_V2: + # isort will try to reformat the comments on these imports, which breaks mypy + # isort: off + from pydantic.v1.datetime_parse import ( # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2 + parse_date as parse_date, + ) + from pydantic.v1.datetime_parse import ( # pyright: ignore[reportMissingImports] # Pydantic v2 + parse_datetime as parse_datetime, + ) + from pydantic.v1.json import ( # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2 + ENCODERS_BY_TYPE as encoders_by_type, + ) + from pydantic.v1.typing import ( # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2 + get_args as get_args, + ) + from pydantic.v1.typing import get_origin as get_origin # pyright: ignore[reportMissingImports] # Pydantic v2 + from pydantic.v1.typing import ( # pyright: ignore[reportMissingImports] # Pydantic v2 + is_literal_type as is_literal_type, + ) + from pydantic.v1.typing import is_union as is_union # pyright: ignore[reportMissingImports] # Pydantic v2 + from pydantic.v1.fields import ModelField as ModelField # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2 +else: + from pydantic.datetime_parse import parse_date as parse_date # type: ignore # Pydantic v1 + from pydantic.datetime_parse import parse_datetime as parse_datetime # type: ignore # Pydantic v1 + from pydantic.fields import ModelField as ModelField # type: ignore # Pydantic v1 + from pydantic.json import ENCODERS_BY_TYPE as encoders_by_type # type: ignore # Pydantic v1 + from pydantic.typing import get_args as get_args # type: ignore # Pydantic v1 + from pydantic.typing import get_origin as get_origin # type: ignore # Pydantic v1 + from pydantic.typing import is_literal_type as is_literal_type # type: ignore # Pydantic v1 + from pydantic.typing import is_union as is_union # type: ignore # Pydantic v1 + + # isort: on + + +T = typing.TypeVar("T") +Model = typing.TypeVar("Model", bound=pydantic.BaseModel) + + +def deep_union_pydantic_dicts( + source: typing.Dict[str, typing.Any], destination: typing.Dict[str, typing.Any] +) -> typing.Dict[str, typing.Any]: + for key, value in source.items(): + if isinstance(value, dict): + node = destination.setdefault(key, {}) + deep_union_pydantic_dicts(value, node) + else: + destination[key] = value + + return destination + + +def parse_obj_as(type_: typing.Type[T], object_: typing.Any) -> T: + if IS_PYDANTIC_V2: + adapter = pydantic.TypeAdapter(type_) # type: ignore # Pydantic v2 + return adapter.validate_python(object_) + else: + return pydantic.parse_obj_as(type_, object_) + + +def to_jsonable_with_fallback( + obj: typing.Any, fallback_serializer: typing.Callable[[typing.Any], typing.Any] +) -> typing.Any: + if IS_PYDANTIC_V2: + from pydantic_core import to_jsonable_python + + return to_jsonable_python(obj, fallback=fallback_serializer) + else: + return fallback_serializer(obj) + + +class UniversalBaseModel(pydantic.BaseModel): + class Config: + populate_by_name = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + if IS_PYDANTIC_V2: + return super().model_dump_json(**kwargs_with_defaults) # type: ignore # Pydantic v2 + else: + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs} + + if IS_PYDANTIC_V2: + return deep_union_pydantic_dicts( + super().model_dump(**kwargs_with_defaults_exclude_unset), # type: ignore # Pydantic v2 + super().model_dump(**kwargs_with_defaults_exclude_none), # type: ignore # Pydantic v2 + ) + else: + return deep_union_pydantic_dicts( + super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none) + ) + + +UniversalRootModel: typing.Type[typing.Any] +if IS_PYDANTIC_V2: + + class V2RootModel(UniversalBaseModel, pydantic.RootModel): # type: ignore # Pydantic v2 + pass + + UniversalRootModel = V2RootModel +else: + UniversalRootModel = UniversalBaseModel + + +def encode_by_type(o: typing.Any) -> typing.Any: + encoders_by_class_tuples: typing.Dict[ + typing.Callable[[typing.Any], typing.Any], typing.Tuple[typing.Any, ...] + ] = defaultdict(tuple) + for type_, encoder in encoders_by_type.items(): + encoders_by_class_tuples[encoder] += (type_,) + + if type(o) in encoders_by_type: + return encoders_by_type[type(o)](o) + for encoder, classes_tuple in encoders_by_class_tuples.items(): + if isinstance(o, classes_tuple): + return encoder(o) + + +def update_forward_refs(model: typing.Type["Model"], **localns: typing.Any) -> None: + if IS_PYDANTIC_V2: + model.model_rebuild(force=True, raise_errors=False) # type: ignore # Pydantic v2 + else: + model.update_forward_refs(**localns) + + +# Mirrors Pydantic's internal typing +AnyCallable = typing.Callable[..., typing.Any] + + +def universal_root_validator(pre: bool = False) -> typing.Callable[[AnyCallable], AnyCallable]: + def decorator(func: AnyCallable) -> AnyCallable: + @wraps(func) + def validate(*args: typing.Any, **kwargs: typing.Any) -> AnyCallable: + if IS_PYDANTIC_V2: + wrapped_func = pydantic.model_validator("before" if pre else "after")(func) # type: ignore # Pydantic v2 + else: + wrapped_func = pydantic.root_validator(pre=pre)(func) # type: ignore # Pydantic v1 + + return wrapped_func(*args, **kwargs) # type: ignore # Pydantic v2 + + return validate + + return decorator + + +def universal_field_validator(field_name: str, pre: bool = False) -> typing.Callable[[AnyCallable], AnyCallable]: + def decorator(func: AnyCallable) -> AnyCallable: + @wraps(func) + def validate(*args: typing.Any, **kwargs: typing.Any) -> AnyCallable: + if IS_PYDANTIC_V2: + wrapped_func = pydantic.field_validator(field_name, mode="before" if pre else "after")(func) # type: ignore # Pydantic v2 + else: + wrapped_func = pydantic.validator(field_name, pre=pre)(func) # type: ignore # Pydantic v1 + + return wrapped_func(*args, **kwargs) + + return validate + + return decorator diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/query_encoder.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/query_encoder.py new file mode 100644 index 00000000000..24076d72ee9 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/query_encoder.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +from collections import ChainMap +from typing import Any, Dict, Optional + +import pydantic + + +# Flattens dicts to be of the form {"key[subkey][subkey2]": value} where value is not a dict +def traverse_query_dict(dict_flat: Dict[str, Any], key_prefix: Optional[str] = None) -> Dict[str, Any]: + result = {} + for k, v in dict_flat.items(): + key = f"{key_prefix}[{k}]" if key_prefix is not None else k + if isinstance(v, dict): + result.update(traverse_query_dict(v, key)) + else: + result[key] = v + return result + + +def single_query_encoder(query_key: str, query_value: Any) -> Dict[str, Any]: + if isinstance(query_value, pydantic.BaseModel) or isinstance(query_value, dict): + if isinstance(query_value, pydantic.BaseModel): + obj_dict = query_value.dict(by_alias=True) + else: + obj_dict = query_value + return traverse_query_dict(obj_dict, query_key) + + return {query_key: query_value} + + +def encode_query(query: Optional[Dict[str, Any]]) -> Optional[Dict[str, Any]]: + return dict(ChainMap(*[single_query_encoder(k, v) for k, v in query.items()])) if query is not None else None diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/remove_none_from_dict.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/remove_none_from_dict.py new file mode 100644 index 00000000000..c2298143f14 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/remove_none_from_dict.py @@ -0,0 +1,11 @@ +# This file was auto-generated by Fern from our API Definition. + +from typing import Any, Dict, Mapping, Optional + + +def remove_none_from_dict(original: Mapping[str, Optional[Any]]) -> Dict[str, Any]: + new: Dict[str, Any] = {} + for key, value in original.items(): + if value is not None: + new[key] = value + return new diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/request_options.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/request_options.py new file mode 100644 index 00000000000..d0bf0dbcecd --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/request_options.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +try: + from typing import NotRequired # type: ignore +except ImportError: + from typing_extensions import NotRequired + + +class RequestOptions(typing.TypedDict, total=False): + """ + Additional options for request-specific configuration when calling APIs via the SDK. + This is used primarily as an optional final parameter for service functions. + + Attributes: + - timeout_in_seconds: int. The number of seconds to await an API call before timing out. + + - max_retries: int. The max number of retries to attempt if the API call fails. + + - additional_headers: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's header dict + + - additional_query_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's query parameters dict + + - additional_body_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's body parameters dict + """ + + timeout_in_seconds: NotRequired[int] + max_retries: NotRequired[int] + additional_headers: NotRequired[typing.Dict[str, typing.Any]] + additional_query_parameters: NotRequired[typing.Dict[str, typing.Any]] + additional_body_parameters: NotRequired[typing.Dict[str, typing.Any]] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/serialization.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/serialization.py new file mode 100644 index 00000000000..8ad5cf8125f --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/core/serialization.py @@ -0,0 +1,167 @@ +# This file was auto-generated by Fern from our API Definition. + +import collections +import typing + +import typing_extensions + + +class FieldMetadata: + """ + Metadata class used to annotate fields to provide additional information. + + Example: + class MyDict(TypedDict): + field: typing.Annotated[str, FieldMetadata(alias="field_name")] + + Will serialize: `{"field": "value"}` + To: `{"field_name": "value"}` + """ + + alias: str + + def __init__(self, *, alias: str) -> None: + self.alias = alias + + +def convert_and_respect_annotation_metadata( + *, object_: typing.Any, annotation: typing.Any, inner_type: typing.Optional[typing.Any] = None +) -> typing.Any: + """ + Respect the metadata annotations on a field, such as aliasing. This function effectively + manipulates the dict-form of an object to respect the metadata annotations. This is primarily used for + TypedDicts, which cannot support aliasing out of the box, and can be extended for additional + utilities, such as defaults. + + Parameters + ---------- + object_ : typing.Any + + annotation : type + The type we're looking to apply typing annotations from + + inner_type : typing.Optional[type] + + Returns + ------- + typing.Any + """ + + if object_ is None: + return None + if inner_type is None: + inner_type = annotation + + clean_type = _remove_annotations(inner_type) + if typing_extensions.is_typeddict(clean_type) and isinstance(object_, typing.Mapping): + return _convert_typeddict(object_, clean_type) + + if ( + # If you're iterating on a string, do not bother to coerce it to a sequence. + (not isinstance(object_, str)) + and ( + ( + ( + typing_extensions.get_origin(clean_type) == typing.List + or typing_extensions.get_origin(clean_type) == list + or clean_type == typing.List + ) + and isinstance(object_, typing.List) + ) + or ( + ( + typing_extensions.get_origin(clean_type) == typing.Set + or typing_extensions.get_origin(clean_type) == set + or clean_type == typing.Set + ) + and isinstance(object_, typing.Set) + ) + or ( + ( + typing_extensions.get_origin(clean_type) == typing.Sequence + or typing_extensions.get_origin(clean_type) == collections.abc.Sequence + or clean_type == typing.Sequence + ) + and isinstance(object_, typing.Sequence) + ) + ) + ): + inner_type = typing_extensions.get_args(clean_type)[0] + return [ + convert_and_respect_annotation_metadata(object_=item, annotation=annotation, inner_type=inner_type) + for item in object_ + ] + + if typing_extensions.get_origin(clean_type) == typing.Union: + # We should be able to ~relatively~ safely try to convert keys against all + # member types in the union, the edge case here is if one member aliases a field + # of the same name to a different name from another member + # Or if another member aliases a field of the same name that another member does not. + for member in typing_extensions.get_args(clean_type): + object_ = convert_and_respect_annotation_metadata(object_=object_, annotation=annotation, inner_type=member) + return object_ + + annotated_type = _get_annotation(annotation) + if annotated_type is None: + return object_ + + # If the object is not a TypedDict, a Union, or other container (list, set, sequence, etc.) + # Then we can safely call it on the recursive conversion. + return object_ + + +def _convert_typeddict(object_: typing.Mapping[str, object], expected_type: typing.Any) -> typing.Mapping[str, object]: + converted_object: typing.Dict[str, object] = {} + annotations = typing_extensions.get_type_hints(expected_type, include_extras=True) + for key, value in object_.items(): + type_ = annotations.get(key) + if type_ is None: + converted_object[key] = value + else: + converted_object[_alias_key(key, type_)] = convert_and_respect_annotation_metadata( + object_=value, annotation=type_ + ) + return converted_object + + +def _get_annotation(type_: typing.Any) -> typing.Optional[typing.Any]: + maybe_annotated_type = typing_extensions.get_origin(type_) + if maybe_annotated_type is None: + return None + + if maybe_annotated_type == typing_extensions.NotRequired: + type_ = typing_extensions.get_args(type_)[0] + maybe_annotated_type = typing_extensions.get_origin(type_) + + if maybe_annotated_type == typing_extensions.Annotated: + return type_ + + return None + + +def _remove_annotations(type_: typing.Any) -> typing.Any: + maybe_annotated_type = typing_extensions.get_origin(type_) + if maybe_annotated_type is None: + return type_ + + if maybe_annotated_type == typing_extensions.NotRequired: + return _remove_annotations(typing_extensions.get_args(type_)[0]) + + if maybe_annotated_type == typing_extensions.Annotated: + return _remove_annotations(typing_extensions.get_args(type_)[0]) + + return type_ + + +def _alias_key(key: str, type_: typing.Any) -> str: + maybe_annotated_type = _get_annotation(type_) + + if maybe_annotated_type is not None: + # The actual annotations are 1 onward, the first is the annotated type + annotations = typing_extensions.get_args(maybe_annotated_type)[1:] + + for annotation in annotations: + if isinstance(annotation, FieldMetadata) and annotation.alias is not None: + return annotation.alias + + return key diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/__init__.py new file mode 100644 index 00000000000..92307cab7fe --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from . import container, enum, http_methods, object, params, primitive, union + +__all__ = ["container", "enum", "http_methods", "object", "params", "primitive", "union"] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/client.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/client.py new file mode 100644 index 00000000000..18dc397fdf1 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/client.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .container.client import AsyncContainerClient, ContainerClient +from .enum.client import AsyncEnumClient, EnumClient +from .http_methods.client import AsyncHttpMethodsClient, HttpMethodsClient +from .object.client import AsyncObjectClient, ObjectClient +from .params.client import AsyncParamsClient, ParamsClient +from .primitive.client import AsyncPrimitiveClient, PrimitiveClient +from .union.client import AsyncUnionClient, UnionClient + + +class EndpointsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + self.container = ContainerClient(client_wrapper=self._client_wrapper) + self.enum = EnumClient(client_wrapper=self._client_wrapper) + self.http_methods = HttpMethodsClient(client_wrapper=self._client_wrapper) + self.object = ObjectClient(client_wrapper=self._client_wrapper) + self.params = ParamsClient(client_wrapper=self._client_wrapper) + self.primitive = PrimitiveClient(client_wrapper=self._client_wrapper) + self.union = UnionClient(client_wrapper=self._client_wrapper) + + +class AsyncEndpointsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + self.container = AsyncContainerClient(client_wrapper=self._client_wrapper) + self.enum = AsyncEnumClient(client_wrapper=self._client_wrapper) + self.http_methods = AsyncHttpMethodsClient(client_wrapper=self._client_wrapper) + self.object = AsyncObjectClient(client_wrapper=self._client_wrapper) + self.params = AsyncParamsClient(client_wrapper=self._client_wrapper) + self.primitive = AsyncPrimitiveClient(client_wrapper=self._client_wrapper) + self.union = AsyncUnionClient(client_wrapper=self._client_wrapper) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/container/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/container/__init__.py new file mode 100644 index 00000000000..f3ea2659bb1 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/container/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/container/client.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/container/client.py new file mode 100644 index 00000000000..c6cf14f63ac --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/container/client.py @@ -0,0 +1,671 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.pydantic_utilities import parse_obj_as +from ...core.request_options import RequestOptions +from ...types.object.types.object_with_required_field import ObjectWithRequiredField + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ContainerClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_and_return_list_of_primitives( + self, *, request: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None + ) -> typing.List[str]: + """ + Parameters + ---------- + request : typing.Sequence[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.List[str] + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.container.get_and_return_list_of_primitives( + request=["string"], + ) + """ + _response = self._client_wrapper.httpx_client.request( + "container/list-of-primitives", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(typing.List[str], parse_obj_as(type_=typing.List[str], object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_and_return_list_of_objects( + self, + *, + request: typing.Sequence[ObjectWithRequiredField], + request_options: typing.Optional[RequestOptions] = None + ) -> typing.List[ObjectWithRequiredField]: + """ + Parameters + ---------- + request : typing.Sequence[ObjectWithRequiredField] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.List[ObjectWithRequiredField] + + Examples + -------- + from seed import SeedExhaustive + from seed.types.object import ObjectWithRequiredField + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.container.get_and_return_list_of_objects( + request=[ + ObjectWithRequiredField( + string="string", + ) + ], + ) + """ + _response = self._client_wrapper.httpx_client.request( + "container/list-of-objects", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(typing.List[ObjectWithRequiredField], parse_obj_as(type_=typing.List[ObjectWithRequiredField], object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_and_return_set_of_primitives( + self, *, request: typing.Set[str], request_options: typing.Optional[RequestOptions] = None + ) -> typing.Set[str]: + """ + Parameters + ---------- + request : typing.Set[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Set[str] + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.container.get_and_return_set_of_primitives( + request={"string"}, + ) + """ + _response = self._client_wrapper.httpx_client.request( + "container/set-of-primitives", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(typing.Set[str], parse_obj_as(type_=typing.Set[str], object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_and_return_set_of_objects( + self, + *, + request: typing.Sequence[ObjectWithRequiredField], + request_options: typing.Optional[RequestOptions] = None + ) -> typing.List[ObjectWithRequiredField]: + """ + Parameters + ---------- + request : typing.Sequence[ObjectWithRequiredField] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.List[ObjectWithRequiredField] + + Examples + -------- + from seed import SeedExhaustive + from seed.types.object import ObjectWithRequiredField + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.container.get_and_return_set_of_objects( + request=[ + ObjectWithRequiredField( + string="string", + ) + ], + ) + """ + _response = self._client_wrapper.httpx_client.request( + "container/set-of-objects", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(typing.List[ObjectWithRequiredField], parse_obj_as(type_=typing.List[ObjectWithRequiredField], object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_and_return_map_prim_to_prim( + self, *, request: typing.Dict[str, str], request_options: typing.Optional[RequestOptions] = None + ) -> typing.Dict[str, str]: + """ + Parameters + ---------- + request : typing.Dict[str, str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Dict[str, str] + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.container.get_and_return_map_prim_to_prim( + request={"string": "string"}, + ) + """ + _response = self._client_wrapper.httpx_client.request( + "container/map-prim-to-prim", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(typing.Dict[str, str], parse_obj_as(type_=typing.Dict[str, str], object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_and_return_map_of_prim_to_object( + self, + *, + request: typing.Dict[str, ObjectWithRequiredField], + request_options: typing.Optional[RequestOptions] = None + ) -> typing.Dict[str, ObjectWithRequiredField]: + """ + Parameters + ---------- + request : typing.Dict[str, ObjectWithRequiredField] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Dict[str, ObjectWithRequiredField] + + Examples + -------- + from seed import SeedExhaustive + from seed.types.object import ObjectWithRequiredField + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.container.get_and_return_map_of_prim_to_object( + request={ + "string": ObjectWithRequiredField( + string="string", + ) + }, + ) + """ + _response = self._client_wrapper.httpx_client.request( + "container/map-prim-to-object", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(typing.Dict[str, ObjectWithRequiredField], parse_obj_as(type_=typing.Dict[str, ObjectWithRequiredField], object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_and_return_optional( + self, + *, + request: typing.Optional[ObjectWithRequiredField] = None, + request_options: typing.Optional[RequestOptions] = None + ) -> typing.Optional[ObjectWithRequiredField]: + """ + Parameters + ---------- + request : typing.Optional[ObjectWithRequiredField] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[ObjectWithRequiredField] + + Examples + -------- + from seed import SeedExhaustive + from seed.types.object import ObjectWithRequiredField + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.container.get_and_return_optional( + request=ObjectWithRequiredField( + string="string", + ), + ) + """ + _response = self._client_wrapper.httpx_client.request( + "container/opt-objects", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(typing.Optional[ObjectWithRequiredField], parse_obj_as(type_=typing.Optional[ObjectWithRequiredField], object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncContainerClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_and_return_list_of_primitives( + self, *, request: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None + ) -> typing.List[str]: + """ + Parameters + ---------- + request : typing.Sequence[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.List[str] + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.container.get_and_return_list_of_primitives( + request=["string"], + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "container/list-of-primitives", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(typing.List[str], parse_obj_as(type_=typing.List[str], object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_and_return_list_of_objects( + self, + *, + request: typing.Sequence[ObjectWithRequiredField], + request_options: typing.Optional[RequestOptions] = None + ) -> typing.List[ObjectWithRequiredField]: + """ + Parameters + ---------- + request : typing.Sequence[ObjectWithRequiredField] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.List[ObjectWithRequiredField] + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + from seed.types.object import ObjectWithRequiredField + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.container.get_and_return_list_of_objects( + request=[ + ObjectWithRequiredField( + string="string", + ) + ], + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "container/list-of-objects", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(typing.List[ObjectWithRequiredField], parse_obj_as(type_=typing.List[ObjectWithRequiredField], object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_and_return_set_of_primitives( + self, *, request: typing.Set[str], request_options: typing.Optional[RequestOptions] = None + ) -> typing.Set[str]: + """ + Parameters + ---------- + request : typing.Set[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Set[str] + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.container.get_and_return_set_of_primitives( + request={"string"}, + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "container/set-of-primitives", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(typing.Set[str], parse_obj_as(type_=typing.Set[str], object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_and_return_set_of_objects( + self, + *, + request: typing.Sequence[ObjectWithRequiredField], + request_options: typing.Optional[RequestOptions] = None + ) -> typing.List[ObjectWithRequiredField]: + """ + Parameters + ---------- + request : typing.Sequence[ObjectWithRequiredField] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.List[ObjectWithRequiredField] + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + from seed.types.object import ObjectWithRequiredField + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.container.get_and_return_set_of_objects( + request=[ + ObjectWithRequiredField( + string="string", + ) + ], + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "container/set-of-objects", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(typing.List[ObjectWithRequiredField], parse_obj_as(type_=typing.List[ObjectWithRequiredField], object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_and_return_map_prim_to_prim( + self, *, request: typing.Dict[str, str], request_options: typing.Optional[RequestOptions] = None + ) -> typing.Dict[str, str]: + """ + Parameters + ---------- + request : typing.Dict[str, str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Dict[str, str] + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.container.get_and_return_map_prim_to_prim( + request={"string": "string"}, + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "container/map-prim-to-prim", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(typing.Dict[str, str], parse_obj_as(type_=typing.Dict[str, str], object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_and_return_map_of_prim_to_object( + self, + *, + request: typing.Dict[str, ObjectWithRequiredField], + request_options: typing.Optional[RequestOptions] = None + ) -> typing.Dict[str, ObjectWithRequiredField]: + """ + Parameters + ---------- + request : typing.Dict[str, ObjectWithRequiredField] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Dict[str, ObjectWithRequiredField] + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + from seed.types.object import ObjectWithRequiredField + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.container.get_and_return_map_of_prim_to_object( + request={ + "string": ObjectWithRequiredField( + string="string", + ) + }, + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "container/map-prim-to-object", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(typing.Dict[str, ObjectWithRequiredField], parse_obj_as(type_=typing.Dict[str, ObjectWithRequiredField], object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_and_return_optional( + self, + *, + request: typing.Optional[ObjectWithRequiredField] = None, + request_options: typing.Optional[RequestOptions] = None + ) -> typing.Optional[ObjectWithRequiredField]: + """ + Parameters + ---------- + request : typing.Optional[ObjectWithRequiredField] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + typing.Optional[ObjectWithRequiredField] + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + from seed.types.object import ObjectWithRequiredField + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.container.get_and_return_optional( + request=ObjectWithRequiredField( + string="string", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "container/opt-objects", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(typing.Optional[ObjectWithRequiredField], parse_obj_as(type_=typing.Optional[ObjectWithRequiredField], object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/enum/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/enum/__init__.py new file mode 100644 index 00000000000..f3ea2659bb1 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/enum/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/enum/client.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/enum/client.py new file mode 100644 index 00000000000..44e2690ff6c --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/enum/client.py @@ -0,0 +1,107 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.pydantic_utilities import parse_obj_as +from ...core.request_options import RequestOptions +from ...types.enum.types.weather_report import WeatherReport + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class EnumClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_and_return_enum( + self, *, request: WeatherReport, request_options: typing.Optional[RequestOptions] = None + ) -> WeatherReport: + """ + Parameters + ---------- + request : WeatherReport + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WeatherReport + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.enum.get_and_return_enum( + request="SUNNY", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "enum", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(WeatherReport, parse_obj_as(type_=WeatherReport, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncEnumClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_and_return_enum( + self, *, request: WeatherReport, request_options: typing.Optional[RequestOptions] = None + ) -> WeatherReport: + """ + Parameters + ---------- + request : WeatherReport + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + WeatherReport + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.enum.get_and_return_enum( + request="SUNNY", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "enum", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(WeatherReport, parse_obj_as(type_=WeatherReport, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/http_methods/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/http_methods/__init__.py new file mode 100644 index 00000000000..f3ea2659bb1 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/http_methods/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/http_methods/client.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/http_methods/client.py new file mode 100644 index 00000000000..a2549280a1b --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/http_methods/client.py @@ -0,0 +1,617 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing +import uuid +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.jsonable_encoder import jsonable_encoder +from ...core.pydantic_utilities import parse_obj_as +from ...core.request_options import RequestOptions +from ...types.object.types.object_with_optional_field import ObjectWithOptionalField + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class HttpMethodsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def test_get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> str: + """ + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + str + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.http_methods.test_get( + id="string", + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"http-methods/{jsonable_encoder(id)}", method="GET", request_options=request_options + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(str, parse_obj_as(type_=str, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def test_post( + self, *, string: str, request_options: typing.Optional[RequestOptions] = None + ) -> ObjectWithOptionalField: + """ + Parameters + ---------- + string : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ObjectWithOptionalField + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.http_methods.test_post( + string="string", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "http-methods", method="POST", json={"string": string}, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(ObjectWithOptionalField, parse_obj_as(type_=ObjectWithOptionalField, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def test_put( + self, id: str, *, string: str, request_options: typing.Optional[RequestOptions] = None + ) -> ObjectWithOptionalField: + """ + Parameters + ---------- + id : str + + string : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ObjectWithOptionalField + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.http_methods.test_put( + id="string", + string="string", + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"http-methods/{jsonable_encoder(id)}", + method="PUT", + json={"string": string}, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(ObjectWithOptionalField, parse_obj_as(type_=ObjectWithOptionalField, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def test_patch( + self, + id: str, + *, + string: typing.Optional[str] = OMIT, + integer: typing.Optional[int] = OMIT, + long_: typing.Optional[int] = OMIT, + double: typing.Optional[float] = OMIT, + bool_: typing.Optional[bool] = OMIT, + datetime: typing.Optional[dt.datetime] = OMIT, + date: typing.Optional[dt.date] = OMIT, + uuid_: typing.Optional[uuid.UUID] = OMIT, + base_64: typing.Optional[str] = OMIT, + list_: typing.Optional[typing.Sequence[str]] = OMIT, + set_: typing.Optional[typing.Set[str]] = OMIT, + map_: typing.Optional[typing.Dict[int, str]] = OMIT, + bigint: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ObjectWithOptionalField: + """ + Parameters + ---------- + id : str + + string : typing.Optional[str] + This is a rather long descriptor of this single field in a more complex type. If you ask me I think this is a pretty good description for this field all things considered. + + integer : typing.Optional[int] + + long_ : typing.Optional[int] + + double : typing.Optional[float] + + bool_ : typing.Optional[bool] + + datetime : typing.Optional[dt.datetime] + + date : typing.Optional[dt.date] + + uuid_ : typing.Optional[uuid.UUID] + + base_64 : typing.Optional[str] + + list_ : typing.Optional[typing.Sequence[str]] + + set_ : typing.Optional[typing.Set[str]] + + map_ : typing.Optional[typing.Dict[int, str]] + + bigint : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ObjectWithOptionalField + + Examples + -------- + import datetime + import uuid + + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.http_methods.test_patch( + id="string", + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + date=datetime.date.fromisoformat( + "2023-01-15", + ), + uuid_=uuid.UUID( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"http-methods/{jsonable_encoder(id)}", + method="PATCH", + json={ + "string": string, + "integer": integer, + "long": long_, + "double": double, + "bool": bool_, + "datetime": datetime, + "date": date, + "uuid": uuid_, + "base64": base_64, + "list": list_, + "set": set_, + "map": map_, + "bigint": bigint, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(ObjectWithOptionalField, parse_obj_as(type_=ObjectWithOptionalField, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def test_delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> bool: + """ + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + bool + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.http_methods.test_delete( + id="string", + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"http-methods/{jsonable_encoder(id)}", method="DELETE", request_options=request_options + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(bool, parse_obj_as(type_=bool, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncHttpMethodsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def test_get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> str: + """ + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + str + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.http_methods.test_get( + id="string", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"http-methods/{jsonable_encoder(id)}", method="GET", request_options=request_options + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(str, parse_obj_as(type_=str, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def test_post( + self, *, string: str, request_options: typing.Optional[RequestOptions] = None + ) -> ObjectWithOptionalField: + """ + Parameters + ---------- + string : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ObjectWithOptionalField + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.http_methods.test_post( + string="string", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "http-methods", method="POST", json={"string": string}, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(ObjectWithOptionalField, parse_obj_as(type_=ObjectWithOptionalField, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def test_put( + self, id: str, *, string: str, request_options: typing.Optional[RequestOptions] = None + ) -> ObjectWithOptionalField: + """ + Parameters + ---------- + id : str + + string : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ObjectWithOptionalField + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.http_methods.test_put( + id="string", + string="string", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"http-methods/{jsonable_encoder(id)}", + method="PUT", + json={"string": string}, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(ObjectWithOptionalField, parse_obj_as(type_=ObjectWithOptionalField, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def test_patch( + self, + id: str, + *, + string: typing.Optional[str] = OMIT, + integer: typing.Optional[int] = OMIT, + long_: typing.Optional[int] = OMIT, + double: typing.Optional[float] = OMIT, + bool_: typing.Optional[bool] = OMIT, + datetime: typing.Optional[dt.datetime] = OMIT, + date: typing.Optional[dt.date] = OMIT, + uuid_: typing.Optional[uuid.UUID] = OMIT, + base_64: typing.Optional[str] = OMIT, + list_: typing.Optional[typing.Sequence[str]] = OMIT, + set_: typing.Optional[typing.Set[str]] = OMIT, + map_: typing.Optional[typing.Dict[int, str]] = OMIT, + bigint: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ObjectWithOptionalField: + """ + Parameters + ---------- + id : str + + string : typing.Optional[str] + This is a rather long descriptor of this single field in a more complex type. If you ask me I think this is a pretty good description for this field all things considered. + + integer : typing.Optional[int] + + long_ : typing.Optional[int] + + double : typing.Optional[float] + + bool_ : typing.Optional[bool] + + datetime : typing.Optional[dt.datetime] + + date : typing.Optional[dt.date] + + uuid_ : typing.Optional[uuid.UUID] + + base_64 : typing.Optional[str] + + list_ : typing.Optional[typing.Sequence[str]] + + set_ : typing.Optional[typing.Set[str]] + + map_ : typing.Optional[typing.Dict[int, str]] + + bigint : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ObjectWithOptionalField + + Examples + -------- + import asyncio + import datetime + import uuid + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.http_methods.test_patch( + id="string", + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + date=datetime.date.fromisoformat( + "2023-01-15", + ), + uuid_=uuid.UUID( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"http-methods/{jsonable_encoder(id)}", + method="PATCH", + json={ + "string": string, + "integer": integer, + "long": long_, + "double": double, + "bool": bool_, + "datetime": datetime, + "date": date, + "uuid": uuid_, + "base64": base_64, + "list": list_, + "set": set_, + "map": map_, + "bigint": bigint, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(ObjectWithOptionalField, parse_obj_as(type_=ObjectWithOptionalField, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def test_delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> bool: + """ + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + bool + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.http_methods.test_delete( + id="string", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"http-methods/{jsonable_encoder(id)}", method="DELETE", request_options=request_options + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(bool, parse_obj_as(type_=bool, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/object/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/object/__init__.py new file mode 100644 index 00000000000..f3ea2659bb1 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/object/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/object/client.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/object/client.py new file mode 100644 index 00000000000..a724f959193 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/object/client.py @@ -0,0 +1,930 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing +import uuid +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.jsonable_encoder import jsonable_encoder +from ...core.pydantic_utilities import parse_obj_as +from ...core.request_options import RequestOptions +from ...types.object.types.nested_object_with_optional_field import NestedObjectWithOptionalField +from ...types.object.types.nested_object_with_required_field import NestedObjectWithRequiredField +from ...types.object.types.object_with_map_of_map import ObjectWithMapOfMap +from ...types.object.types.object_with_optional_field import ObjectWithOptionalField +from ...types.object.types.object_with_required_field import ObjectWithRequiredField + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ObjectClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_and_return_with_optional_field( + self, + *, + string: typing.Optional[str] = OMIT, + integer: typing.Optional[int] = OMIT, + long_: typing.Optional[int] = OMIT, + double: typing.Optional[float] = OMIT, + bool_: typing.Optional[bool] = OMIT, + datetime: typing.Optional[dt.datetime] = OMIT, + date: typing.Optional[dt.date] = OMIT, + uuid_: typing.Optional[uuid.UUID] = OMIT, + base_64: typing.Optional[str] = OMIT, + list_: typing.Optional[typing.Sequence[str]] = OMIT, + set_: typing.Optional[typing.Set[str]] = OMIT, + map_: typing.Optional[typing.Dict[int, str]] = OMIT, + bigint: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ObjectWithOptionalField: + """ + Parameters + ---------- + string : typing.Optional[str] + This is a rather long descriptor of this single field in a more complex type. If you ask me I think this is a pretty good description for this field all things considered. + + integer : typing.Optional[int] + + long_ : typing.Optional[int] + + double : typing.Optional[float] + + bool_ : typing.Optional[bool] + + datetime : typing.Optional[dt.datetime] + + date : typing.Optional[dt.date] + + uuid_ : typing.Optional[uuid.UUID] + + base_64 : typing.Optional[str] + + list_ : typing.Optional[typing.Sequence[str]] + + set_ : typing.Optional[typing.Set[str]] + + map_ : typing.Optional[typing.Dict[int, str]] + + bigint : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ObjectWithOptionalField + + Examples + -------- + import datetime + import uuid + + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.object.get_and_return_with_optional_field( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + date=datetime.date.fromisoformat( + "2023-01-15", + ), + uuid_=uuid.UUID( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "object/get-and-return-with-optional-field", + method="POST", + json={ + "string": string, + "integer": integer, + "long": long_, + "double": double, + "bool": bool_, + "datetime": datetime, + "date": date, + "uuid": uuid_, + "base64": base_64, + "list": list_, + "set": set_, + "map": map_, + "bigint": bigint, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(ObjectWithOptionalField, parse_obj_as(type_=ObjectWithOptionalField, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_and_return_with_required_field( + self, *, string: str, request_options: typing.Optional[RequestOptions] = None + ) -> ObjectWithRequiredField: + """ + Parameters + ---------- + string : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ObjectWithRequiredField + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.object.get_and_return_with_required_field( + string="string", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "object/get-and-return-with-required-field", + method="POST", + json={"string": string}, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(ObjectWithRequiredField, parse_obj_as(type_=ObjectWithRequiredField, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_and_return_with_map_of_map( + self, *, map_: typing.Dict[str, typing.Dict[str, str]], request_options: typing.Optional[RequestOptions] = None + ) -> ObjectWithMapOfMap: + """ + Parameters + ---------- + map_ : typing.Dict[str, typing.Dict[str, str]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ObjectWithMapOfMap + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.object.get_and_return_with_map_of_map( + map_={"string": {"string": "string"}}, + ) + """ + _response = self._client_wrapper.httpx_client.request( + "object/get-and-return-with-map-of-map", + method="POST", + json={"map": map_}, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(ObjectWithMapOfMap, parse_obj_as(type_=ObjectWithMapOfMap, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_and_return_nested_with_optional_field( + self, + *, + string: typing.Optional[str] = OMIT, + nested_object: typing.Optional[ObjectWithOptionalField] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> NestedObjectWithOptionalField: + """ + Parameters + ---------- + string : typing.Optional[str] + + nested_object : typing.Optional[ObjectWithOptionalField] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + NestedObjectWithOptionalField + + Examples + -------- + import datetime + import uuid + + from seed import SeedExhaustive + from seed.types.object import ObjectWithOptionalField + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.object.get_and_return_nested_with_optional_field( + string="string", + nested_object=ObjectWithOptionalField( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + date=datetime.date.fromisoformat( + "2023-01-15", + ), + uuid_=uuid.UUID( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ), + ) + """ + _response = self._client_wrapper.httpx_client.request( + "object/get-and-return-nested-with-optional-field", + method="POST", + json={"string": string, "NestedObject": nested_object}, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(NestedObjectWithOptionalField, parse_obj_as(type_=NestedObjectWithOptionalField, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_and_return_nested_with_required_field( + self, + string_: str, + *, + string: str, + nested_object: ObjectWithOptionalField, + request_options: typing.Optional[RequestOptions] = None, + ) -> NestedObjectWithRequiredField: + """ + Parameters + ---------- + string_ : str + + string : str + + nested_object : ObjectWithOptionalField + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + NestedObjectWithRequiredField + + Examples + -------- + import datetime + import uuid + + from seed import SeedExhaustive + from seed.types.object import ObjectWithOptionalField + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.object.get_and_return_nested_with_required_field( + string_="string", + string="string", + nested_object=ObjectWithOptionalField( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + date=datetime.date.fromisoformat( + "2023-01-15", + ), + uuid_=uuid.UUID( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ), + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"object/get-and-return-nested-with-required-field/{jsonable_encoder(string_)}", + method="POST", + json={"string": string, "NestedObject": nested_object}, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(NestedObjectWithRequiredField, parse_obj_as(type_=NestedObjectWithRequiredField, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_and_return_nested_with_required_field_as_list( + self, + *, + request: typing.Sequence[NestedObjectWithRequiredField], + request_options: typing.Optional[RequestOptions] = None, + ) -> NestedObjectWithRequiredField: + """ + Parameters + ---------- + request : typing.Sequence[NestedObjectWithRequiredField] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + NestedObjectWithRequiredField + + Examples + -------- + import datetime + import uuid + + from seed import SeedExhaustive + from seed.types.object import ( + NestedObjectWithRequiredField, + ObjectWithOptionalField, + ) + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.object.get_and_return_nested_with_required_field_as_list( + request=[ + NestedObjectWithRequiredField( + string="string", + nested_object=ObjectWithOptionalField( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + date=datetime.date.fromisoformat( + "2023-01-15", + ), + uuid_=uuid.UUID( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ), + ) + ], + ) + """ + _response = self._client_wrapper.httpx_client.request( + "object/get-and-return-nested-with-required-field-list", + method="POST", + json=request, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(NestedObjectWithRequiredField, parse_obj_as(type_=NestedObjectWithRequiredField, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncObjectClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_and_return_with_optional_field( + self, + *, + string: typing.Optional[str] = OMIT, + integer: typing.Optional[int] = OMIT, + long_: typing.Optional[int] = OMIT, + double: typing.Optional[float] = OMIT, + bool_: typing.Optional[bool] = OMIT, + datetime: typing.Optional[dt.datetime] = OMIT, + date: typing.Optional[dt.date] = OMIT, + uuid_: typing.Optional[uuid.UUID] = OMIT, + base_64: typing.Optional[str] = OMIT, + list_: typing.Optional[typing.Sequence[str]] = OMIT, + set_: typing.Optional[typing.Set[str]] = OMIT, + map_: typing.Optional[typing.Dict[int, str]] = OMIT, + bigint: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> ObjectWithOptionalField: + """ + Parameters + ---------- + string : typing.Optional[str] + This is a rather long descriptor of this single field in a more complex type. If you ask me I think this is a pretty good description for this field all things considered. + + integer : typing.Optional[int] + + long_ : typing.Optional[int] + + double : typing.Optional[float] + + bool_ : typing.Optional[bool] + + datetime : typing.Optional[dt.datetime] + + date : typing.Optional[dt.date] + + uuid_ : typing.Optional[uuid.UUID] + + base_64 : typing.Optional[str] + + list_ : typing.Optional[typing.Sequence[str]] + + set_ : typing.Optional[typing.Set[str]] + + map_ : typing.Optional[typing.Dict[int, str]] + + bigint : typing.Optional[str] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ObjectWithOptionalField + + Examples + -------- + import asyncio + import datetime + import uuid + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.object.get_and_return_with_optional_field( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + date=datetime.date.fromisoformat( + "2023-01-15", + ), + uuid_=uuid.UUID( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "object/get-and-return-with-optional-field", + method="POST", + json={ + "string": string, + "integer": integer, + "long": long_, + "double": double, + "bool": bool_, + "datetime": datetime, + "date": date, + "uuid": uuid_, + "base64": base_64, + "list": list_, + "set": set_, + "map": map_, + "bigint": bigint, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(ObjectWithOptionalField, parse_obj_as(type_=ObjectWithOptionalField, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_and_return_with_required_field( + self, *, string: str, request_options: typing.Optional[RequestOptions] = None + ) -> ObjectWithRequiredField: + """ + Parameters + ---------- + string : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ObjectWithRequiredField + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.object.get_and_return_with_required_field( + string="string", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "object/get-and-return-with-required-field", + method="POST", + json={"string": string}, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(ObjectWithRequiredField, parse_obj_as(type_=ObjectWithRequiredField, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_and_return_with_map_of_map( + self, *, map_: typing.Dict[str, typing.Dict[str, str]], request_options: typing.Optional[RequestOptions] = None + ) -> ObjectWithMapOfMap: + """ + Parameters + ---------- + map_ : typing.Dict[str, typing.Dict[str, str]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ObjectWithMapOfMap + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.object.get_and_return_with_map_of_map( + map_={"string": {"string": "string"}}, + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "object/get-and-return-with-map-of-map", + method="POST", + json={"map": map_}, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(ObjectWithMapOfMap, parse_obj_as(type_=ObjectWithMapOfMap, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_and_return_nested_with_optional_field( + self, + *, + string: typing.Optional[str] = OMIT, + nested_object: typing.Optional[ObjectWithOptionalField] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> NestedObjectWithOptionalField: + """ + Parameters + ---------- + string : typing.Optional[str] + + nested_object : typing.Optional[ObjectWithOptionalField] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + NestedObjectWithOptionalField + + Examples + -------- + import asyncio + import datetime + import uuid + + from seed import AsyncSeedExhaustive + from seed.types.object import ObjectWithOptionalField + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.object.get_and_return_nested_with_optional_field( + string="string", + nested_object=ObjectWithOptionalField( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + date=datetime.date.fromisoformat( + "2023-01-15", + ), + uuid_=uuid.UUID( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "object/get-and-return-nested-with-optional-field", + method="POST", + json={"string": string, "NestedObject": nested_object}, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(NestedObjectWithOptionalField, parse_obj_as(type_=NestedObjectWithOptionalField, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_and_return_nested_with_required_field( + self, + string_: str, + *, + string: str, + nested_object: ObjectWithOptionalField, + request_options: typing.Optional[RequestOptions] = None, + ) -> NestedObjectWithRequiredField: + """ + Parameters + ---------- + string_ : str + + string : str + + nested_object : ObjectWithOptionalField + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + NestedObjectWithRequiredField + + Examples + -------- + import asyncio + import datetime + import uuid + + from seed import AsyncSeedExhaustive + from seed.types.object import ObjectWithOptionalField + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.object.get_and_return_nested_with_required_field( + string_="string", + string="string", + nested_object=ObjectWithOptionalField( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + date=datetime.date.fromisoformat( + "2023-01-15", + ), + uuid_=uuid.UUID( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"object/get-and-return-nested-with-required-field/{jsonable_encoder(string_)}", + method="POST", + json={"string": string, "NestedObject": nested_object}, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(NestedObjectWithRequiredField, parse_obj_as(type_=NestedObjectWithRequiredField, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_and_return_nested_with_required_field_as_list( + self, + *, + request: typing.Sequence[NestedObjectWithRequiredField], + request_options: typing.Optional[RequestOptions] = None, + ) -> NestedObjectWithRequiredField: + """ + Parameters + ---------- + request : typing.Sequence[NestedObjectWithRequiredField] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + NestedObjectWithRequiredField + + Examples + -------- + import asyncio + import datetime + import uuid + + from seed import AsyncSeedExhaustive + from seed.types.object import ( + NestedObjectWithRequiredField, + ObjectWithOptionalField, + ) + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.object.get_and_return_nested_with_required_field_as_list( + request=[ + NestedObjectWithRequiredField( + string="string", + nested_object=ObjectWithOptionalField( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + date=datetime.date.fromisoformat( + "2023-01-15", + ), + uuid_=uuid.UUID( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ), + ) + ], + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "object/get-and-return-nested-with-required-field-list", + method="POST", + json=request, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(NestedObjectWithRequiredField, parse_obj_as(type_=NestedObjectWithRequiredField, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/params/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/params/__init__.py new file mode 100644 index 00000000000..f3ea2659bb1 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/params/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/params/client.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/params/client.py new file mode 100644 index 00000000000..5cd7ceef42a --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/params/client.py @@ -0,0 +1,505 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.jsonable_encoder import jsonable_encoder +from ...core.pydantic_utilities import parse_obj_as +from ...core.request_options import RequestOptions + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ParamsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_with_path(self, param: str, *, request_options: typing.Optional[RequestOptions] = None) -> str: + """ + GET with path param + + Parameters + ---------- + param : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + str + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.params.get_with_path( + param="string", + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"params/path/{jsonable_encoder(param)}", method="GET", request_options=request_options + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(str, parse_obj_as(type_=str, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_with_query( + self, *, query: str, number: int, request_options: typing.Optional[RequestOptions] = None + ) -> None: + """ + GET with query param + + Parameters + ---------- + query : str + + number : int + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.params.get_with_query( + query="string", + number=1, + ) + """ + _response = self._client_wrapper.httpx_client.request( + "params", method="GET", params={"query": query, "number": number}, request_options=request_options + ) + try: + if 200 <= _response.status_code < 300: + return + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_with_allow_multiple_query( + self, + *, + query: typing.Union[str, typing.Sequence[str]], + numer: typing.Union[int, typing.Sequence[int]], + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + GET with multiple of same query param + + Parameters + ---------- + query : typing.Union[str, typing.Sequence[str]] + + numer : typing.Union[int, typing.Sequence[int]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.params.get_with_allow_multiple_query( + query="string", + numer=1, + ) + """ + _response = self._client_wrapper.httpx_client.request( + "params", method="GET", params={"query": query, "numer": numer}, request_options=request_options + ) + try: + if 200 <= _response.status_code < 300: + return + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_with_path_and_query( + self, param: str, *, query: str, request_options: typing.Optional[RequestOptions] = None + ) -> None: + """ + GET with path and query params + + Parameters + ---------- + param : str + + query : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.params.get_with_path_and_query( + param="string", + query="string", + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"params/path-query/{jsonable_encoder(param)}", + method="GET", + params={"query": query}, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def modify_with_path( + self, param: str, *, request: str, request_options: typing.Optional[RequestOptions] = None + ) -> str: + """ + PUT to update with path param + + Parameters + ---------- + param : str + + request : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + str + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.params.modify_with_path( + param="string", + request="string", + ) + """ + _response = self._client_wrapper.httpx_client.request( + f"params/path/{jsonable_encoder(param)}", + method="PUT", + json=request, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(str, parse_obj_as(type_=str, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncParamsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_with_path(self, param: str, *, request_options: typing.Optional[RequestOptions] = None) -> str: + """ + GET with path param + + Parameters + ---------- + param : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + str + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.params.get_with_path( + param="string", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"params/path/{jsonable_encoder(param)}", method="GET", request_options=request_options + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(str, parse_obj_as(type_=str, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_with_query( + self, *, query: str, number: int, request_options: typing.Optional[RequestOptions] = None + ) -> None: + """ + GET with query param + + Parameters + ---------- + query : str + + number : int + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.params.get_with_query( + query="string", + number=1, + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "params", method="GET", params={"query": query, "number": number}, request_options=request_options + ) + try: + if 200 <= _response.status_code < 300: + return + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_with_allow_multiple_query( + self, + *, + query: typing.Union[str, typing.Sequence[str]], + numer: typing.Union[int, typing.Sequence[int]], + request_options: typing.Optional[RequestOptions] = None, + ) -> None: + """ + GET with multiple of same query param + + Parameters + ---------- + query : typing.Union[str, typing.Sequence[str]] + + numer : typing.Union[int, typing.Sequence[int]] + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.params.get_with_allow_multiple_query( + query="string", + numer=1, + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "params", method="GET", params={"query": query, "numer": numer}, request_options=request_options + ) + try: + if 200 <= _response.status_code < 300: + return + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_with_path_and_query( + self, param: str, *, query: str, request_options: typing.Optional[RequestOptions] = None + ) -> None: + """ + GET with path and query params + + Parameters + ---------- + param : str + + query : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.params.get_with_path_and_query( + param="string", + query="string", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"params/path-query/{jsonable_encoder(param)}", + method="GET", + params={"query": query}, + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + return + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def modify_with_path( + self, param: str, *, request: str, request_options: typing.Optional[RequestOptions] = None + ) -> str: + """ + PUT to update with path param + + Parameters + ---------- + param : str + + request : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + str + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.params.modify_with_path( + param="string", + request="string", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + f"params/path/{jsonable_encoder(param)}", + method="PUT", + json=request, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(str, parse_obj_as(type_=str, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/primitive/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/primitive/__init__.py new file mode 100644 index 00000000000..f3ea2659bb1 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/primitive/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/primitive/client.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/primitive/client.py new file mode 100644 index 00000000000..844b6a782f0 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/primitive/client.py @@ -0,0 +1,789 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing +import uuid +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.pydantic_utilities import parse_obj_as +from ...core.request_options import RequestOptions + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class PrimitiveClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_and_return_string(self, *, request: str, request_options: typing.Optional[RequestOptions] = None) -> str: + """ + Parameters + ---------- + request : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + str + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.primitive.get_and_return_string( + request="string", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "primitive/string", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(str, parse_obj_as(type_=str, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_and_return_int(self, *, request: int, request_options: typing.Optional[RequestOptions] = None) -> int: + """ + Parameters + ---------- + request : int + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + int + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.primitive.get_and_return_int( + request=1, + ) + """ + _response = self._client_wrapper.httpx_client.request( + "primitive/integer", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(int, parse_obj_as(type_=int, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_and_return_long(self, *, request: int, request_options: typing.Optional[RequestOptions] = None) -> int: + """ + Parameters + ---------- + request : int + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + int + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.primitive.get_and_return_long( + request=1000000, + ) + """ + _response = self._client_wrapper.httpx_client.request( + "primitive/long", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(int, parse_obj_as(type_=int, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_and_return_double( + self, *, request: float, request_options: typing.Optional[RequestOptions] = None + ) -> float: + """ + Parameters + ---------- + request : float + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + float + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.primitive.get_and_return_double( + request=1.1, + ) + """ + _response = self._client_wrapper.httpx_client.request( + "primitive/double", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(float, parse_obj_as(type_=float, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_and_return_bool(self, *, request: bool, request_options: typing.Optional[RequestOptions] = None) -> bool: + """ + Parameters + ---------- + request : bool + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + bool + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.primitive.get_and_return_bool( + request=True, + ) + """ + _response = self._client_wrapper.httpx_client.request( + "primitive/boolean", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(bool, parse_obj_as(type_=bool, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_and_return_datetime( + self, *, request: dt.datetime, request_options: typing.Optional[RequestOptions] = None + ) -> dt.datetime: + """ + Parameters + ---------- + request : dt.datetime + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + dt.datetime + + Examples + -------- + import datetime + + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.primitive.get_and_return_datetime( + request=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + ) + """ + _response = self._client_wrapper.httpx_client.request( + "primitive/datetime", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(dt.datetime, parse_obj_as(type_=dt.datetime, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_and_return_date( + self, *, request: dt.date, request_options: typing.Optional[RequestOptions] = None + ) -> dt.date: + """ + Parameters + ---------- + request : dt.date + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + dt.date + + Examples + -------- + import datetime + + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.primitive.get_and_return_date( + request=datetime.date.fromisoformat( + "2023-01-15", + ), + ) + """ + _response = self._client_wrapper.httpx_client.request( + "primitive/date", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(dt.date, parse_obj_as(type_=dt.date, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_and_return_uuid( + self, *, request: uuid.UUID, request_options: typing.Optional[RequestOptions] = None + ) -> uuid.UUID: + """ + Parameters + ---------- + request : uuid.UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + uuid.UUID + + Examples + -------- + import uuid + + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.primitive.get_and_return_uuid( + request=uuid.UUID( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + ) + """ + _response = self._client_wrapper.httpx_client.request( + "primitive/uuid", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(uuid.UUID, parse_obj_as(type_=uuid.UUID, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_and_return_base_64(self, *, request: str, request_options: typing.Optional[RequestOptions] = None) -> str: + """ + Parameters + ---------- + request : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + str + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.primitive.get_and_return_base_64( + request="SGVsbG8gd29ybGQh", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "primitive/base64", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(str, parse_obj_as(type_=str, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncPrimitiveClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_and_return_string( + self, *, request: str, request_options: typing.Optional[RequestOptions] = None + ) -> str: + """ + Parameters + ---------- + request : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + str + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.primitive.get_and_return_string( + request="string", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "primitive/string", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(str, parse_obj_as(type_=str, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_and_return_int(self, *, request: int, request_options: typing.Optional[RequestOptions] = None) -> int: + """ + Parameters + ---------- + request : int + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + int + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.primitive.get_and_return_int( + request=1, + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "primitive/integer", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(int, parse_obj_as(type_=int, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_and_return_long( + self, *, request: int, request_options: typing.Optional[RequestOptions] = None + ) -> int: + """ + Parameters + ---------- + request : int + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + int + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.primitive.get_and_return_long( + request=1000000, + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "primitive/long", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(int, parse_obj_as(type_=int, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_and_return_double( + self, *, request: float, request_options: typing.Optional[RequestOptions] = None + ) -> float: + """ + Parameters + ---------- + request : float + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + float + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.primitive.get_and_return_double( + request=1.1, + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "primitive/double", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(float, parse_obj_as(type_=float, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_and_return_bool( + self, *, request: bool, request_options: typing.Optional[RequestOptions] = None + ) -> bool: + """ + Parameters + ---------- + request : bool + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + bool + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.primitive.get_and_return_bool( + request=True, + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "primitive/boolean", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(bool, parse_obj_as(type_=bool, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_and_return_datetime( + self, *, request: dt.datetime, request_options: typing.Optional[RequestOptions] = None + ) -> dt.datetime: + """ + Parameters + ---------- + request : dt.datetime + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + dt.datetime + + Examples + -------- + import asyncio + import datetime + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.primitive.get_and_return_datetime( + request=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "primitive/datetime", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(dt.datetime, parse_obj_as(type_=dt.datetime, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_and_return_date( + self, *, request: dt.date, request_options: typing.Optional[RequestOptions] = None + ) -> dt.date: + """ + Parameters + ---------- + request : dt.date + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + dt.date + + Examples + -------- + import asyncio + import datetime + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.primitive.get_and_return_date( + request=datetime.date.fromisoformat( + "2023-01-15", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "primitive/date", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(dt.date, parse_obj_as(type_=dt.date, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_and_return_uuid( + self, *, request: uuid.UUID, request_options: typing.Optional[RequestOptions] = None + ) -> uuid.UUID: + """ + Parameters + ---------- + request : uuid.UUID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + uuid.UUID + + Examples + -------- + import asyncio + import uuid + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.primitive.get_and_return_uuid( + request=uuid.UUID( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "primitive/uuid", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(uuid.UUID, parse_obj_as(type_=uuid.UUID, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_and_return_base_64( + self, *, request: str, request_options: typing.Optional[RequestOptions] = None + ) -> str: + """ + Parameters + ---------- + request : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + str + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.primitive.get_and_return_base_64( + request="SGVsbG8gd29ybGQh", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "primitive/base64", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(str, parse_obj_as(type_=str, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/union/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/union/__init__.py new file mode 100644 index 00000000000..f3ea2659bb1 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/union/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/union/client.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/union/client.py new file mode 100644 index 00000000000..77153587a27 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/endpoints/union/client.py @@ -0,0 +1,115 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ...core.api_error import ApiError +from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ...core.pydantic_utilities import parse_obj_as +from ...core.request_options import RequestOptions +from ...types.union.types.animal import Animal + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class UnionClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_and_return_union( + self, *, request: Animal, request_options: typing.Optional[RequestOptions] = None + ) -> Animal: + """ + Parameters + ---------- + request : Animal + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Animal + + Examples + -------- + from seed import SeedExhaustive + from seed.types.union import Animal_Dog + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.endpoints.union.get_and_return_union( + request=Animal_Dog( + name="string", + likes_to_woof=True, + ), + ) + """ + _response = self._client_wrapper.httpx_client.request( + "union", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(Animal, parse_obj_as(type_=Animal, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncUnionClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_and_return_union( + self, *, request: Animal, request_options: typing.Optional[RequestOptions] = None + ) -> Animal: + """ + Parameters + ---------- + request : Animal + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Animal + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + from seed.types.union import Animal_Dog + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.endpoints.union.get_and_return_union( + request=Animal_Dog( + name="string", + likes_to_woof=True, + ), + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "union", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(Animal, parse_obj_as(type_=Animal, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/general_errors/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/general_errors/__init__.py new file mode 100644 index 00000000000..57de0a862e9 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/general_errors/__init__.py @@ -0,0 +1,6 @@ +# This file was auto-generated by Fern from our API Definition. + +from .types import BadObjectRequestInfo +from .errors import BadRequestBody + +__all__ = ["BadObjectRequestInfo", "BadRequestBody"] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/general_errors/errors/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/general_errors/errors/__init__.py new file mode 100644 index 00000000000..04eaf8e383b --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/general_errors/errors/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .bad_request_body import BadRequestBody + +__all__ = ["BadRequestBody"] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/general_errors/errors/bad_request_body.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/general_errors/errors/bad_request_body.py new file mode 100644 index 00000000000..f8518e355d0 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/general_errors/errors/bad_request_body.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +from ...core.api_error import ApiError +from ..types.bad_object_request_info import BadObjectRequestInfo + + +class BadRequestBody(ApiError): + def __init__(self, body: BadObjectRequestInfo): + super().__init__(status_code=400, body=body) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/general_errors/types/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/general_errors/types/__init__.py new file mode 100644 index 00000000000..b6788a57056 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/general_errors/types/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .bad_object_request_info import BadObjectRequestInfo + +__all__ = ["BadObjectRequestInfo"] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/general_errors/types/bad_object_request_info.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/general_errors/types/bad_object_request_info.py new file mode 100644 index 00000000000..7f03429e922 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/general_errors/types/bad_object_request_info.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic + +from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel + + +class BadObjectRequestInfo(UniversalBaseModel): + message: str + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/inlined_requests/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/inlined_requests/__init__.py new file mode 100644 index 00000000000..f3ea2659bb1 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/inlined_requests/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/inlined_requests/client.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/inlined_requests/client.py new file mode 100644 index 00000000000..f7c46698eb9 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/inlined_requests/client.py @@ -0,0 +1,198 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.pydantic_utilities import parse_obj_as +from ..core.request_options import RequestOptions +from ..general_errors.errors.bad_request_body import BadRequestBody +from ..general_errors.types.bad_object_request_info import BadObjectRequestInfo +from ..types.object.types.object_with_optional_field import ObjectWithOptionalField + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class InlinedRequestsClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def post_with_object_bodyand_response( + self, + *, + string: str, + integer: int, + nested_object: ObjectWithOptionalField, + request_options: typing.Optional[RequestOptions] = None + ) -> ObjectWithOptionalField: + """ + POST with custom object in request body, response is an object + + Parameters + ---------- + string : str + + integer : int + + nested_object : ObjectWithOptionalField + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ObjectWithOptionalField + + Examples + -------- + import datetime + import uuid + + from seed import SeedExhaustive + from seed.types.object import ObjectWithOptionalField + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.inlined_requests.post_with_object_bodyand_response( + string="string", + integer=1, + nested_object=ObjectWithOptionalField( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + date=datetime.date.fromisoformat( + "2023-01-15", + ), + uuid_=uuid.UUID( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ), + ) + """ + _response = self._client_wrapper.httpx_client.request( + "req-bodies/object", + method="POST", + json={"string": string, "integer": integer, "NestedObject": nested_object}, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(ObjectWithOptionalField, parse_obj_as(type_=ObjectWithOptionalField, object_=_response.json())) # type: ignore + if _response.status_code == 400: + raise BadRequestBody( + typing.cast(BadObjectRequestInfo, parse_obj_as(type_=BadObjectRequestInfo, object_=_response.json())) # type: ignore + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncInlinedRequestsClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def post_with_object_bodyand_response( + self, + *, + string: str, + integer: int, + nested_object: ObjectWithOptionalField, + request_options: typing.Optional[RequestOptions] = None + ) -> ObjectWithOptionalField: + """ + POST with custom object in request body, response is an object + + Parameters + ---------- + string : str + + integer : int + + nested_object : ObjectWithOptionalField + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ObjectWithOptionalField + + Examples + -------- + import asyncio + import datetime + import uuid + + from seed import AsyncSeedExhaustive + from seed.types.object import ObjectWithOptionalField + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.inlined_requests.post_with_object_bodyand_response( + string="string", + integer=1, + nested_object=ObjectWithOptionalField( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat( + "2024-01-15 09:30:00+00:00", + ), + date=datetime.date.fromisoformat( + "2023-01-15", + ), + uuid_=uuid.UUID( + "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + ), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ), + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "req-bodies/object", + method="POST", + json={"string": string, "integer": integer, "NestedObject": nested_object}, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(ObjectWithOptionalField, parse_obj_as(type_=ObjectWithOptionalField, object_=_response.json())) # type: ignore + if _response.status_code == 400: + raise BadRequestBody( + typing.cast(BadObjectRequestInfo, parse_obj_as(type_=BadObjectRequestInfo, object_=_response.json())) # type: ignore + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/no_auth/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/no_auth/__init__.py new file mode 100644 index 00000000000..f3ea2659bb1 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/no_auth/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/no_auth/client.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/no_auth/client.py new file mode 100644 index 00000000000..3d203bcea34 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/no_auth/client.py @@ -0,0 +1,120 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.pydantic_utilities import parse_obj_as +from ..core.request_options import RequestOptions +from ..general_errors.errors.bad_request_body import BadRequestBody +from ..general_errors.types.bad_object_request_info import BadObjectRequestInfo + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class NoAuthClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def post_with_no_auth( + self, *, request: typing.Any, request_options: typing.Optional[RequestOptions] = None + ) -> bool: + """ + POST request with no auth + + Parameters + ---------- + request : typing.Any + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + bool + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.no_auth.post_with_no_auth( + request={"key": "value"}, + ) + """ + _response = self._client_wrapper.httpx_client.request( + "no-auth", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(bool, parse_obj_as(type_=bool, object_=_response.json())) # type: ignore + if _response.status_code == 400: + raise BadRequestBody( + typing.cast(BadObjectRequestInfo, parse_obj_as(type_=BadObjectRequestInfo, object_=_response.json())) # type: ignore + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncNoAuthClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def post_with_no_auth( + self, *, request: typing.Any, request_options: typing.Optional[RequestOptions] = None + ) -> bool: + """ + POST request with no auth + + Parameters + ---------- + request : typing.Any + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + bool + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.no_auth.post_with_no_auth( + request={"key": "value"}, + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "no-auth", method="POST", json=request, request_options=request_options, omit=OMIT + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(bool, parse_obj_as(type_=bool, object_=_response.json())) # type: ignore + if _response.status_code == 400: + raise BadRequestBody( + typing.cast(BadObjectRequestInfo, parse_obj_as(type_=BadObjectRequestInfo, object_=_response.json())) # type: ignore + ) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/no_req_body/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/no_req_body/__init__.py new file mode 100644 index 00000000000..f3ea2659bb1 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/no_req_body/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/no_req_body/client.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/no_req_body/client.py new file mode 100644 index 00000000000..33fa0c77d27 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/no_req_body/client.py @@ -0,0 +1,168 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.pydantic_utilities import parse_obj_as +from ..core.request_options import RequestOptions +from ..types.object.types.object_with_optional_field import ObjectWithOptionalField + + +class NoReqBodyClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_with_no_request_body( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> ObjectWithOptionalField: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ObjectWithOptionalField + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.no_req_body.get_with_no_request_body() + """ + _response = self._client_wrapper.httpx_client.request( + "no-req-body", method="GET", request_options=request_options + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(ObjectWithOptionalField, parse_obj_as(type_=ObjectWithOptionalField, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def post_with_no_request_body(self, *, request_options: typing.Optional[RequestOptions] = None) -> str: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + str + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.no_req_body.post_with_no_request_body() + """ + _response = self._client_wrapper.httpx_client.request( + "no-req-body", method="POST", request_options=request_options + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(str, parse_obj_as(type_=str, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncNoReqBodyClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_with_no_request_body( + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> ObjectWithOptionalField: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ObjectWithOptionalField + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.no_req_body.get_with_no_request_body() + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "no-req-body", method="GET", request_options=request_options + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(ObjectWithOptionalField, parse_obj_as(type_=ObjectWithOptionalField, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def post_with_no_request_body(self, *, request_options: typing.Optional[RequestOptions] = None) -> str: + """ + Parameters + ---------- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + str + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.no_req_body.post_with_no_request_body() + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "no-req-body", method="POST", request_options=request_options + ) + try: + if 200 <= _response.status_code < 300: + return typing.cast(str, parse_obj_as(type_=str, object_=_response.json())) # type: ignore + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/py.typed b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/py.typed new file mode 100644 index 00000000000..e69de29bb2d diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/req_with_headers/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/req_with_headers/__init__.py new file mode 100644 index 00000000000..f3ea2659bb1 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/req_with_headers/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/req_with_headers/client.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/req_with_headers/client.py new file mode 100644 index 00000000000..655402249e9 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/req_with_headers/client.py @@ -0,0 +1,143 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +from json.decoder import JSONDecodeError + +from ..core.api_error import ApiError +from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from ..core.request_options import RequestOptions + +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + + +class ReqWithHeadersClient: + def __init__(self, *, client_wrapper: SyncClientWrapper): + self._client_wrapper = client_wrapper + + def get_with_custom_header( + self, + *, + x_test_service_header: str, + x_test_endpoint_header: str, + request: str, + request_options: typing.Optional[RequestOptions] = None + ) -> None: + """ + Parameters + ---------- + x_test_service_header : str + + x_test_endpoint_header : str + + request : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + from seed import SeedExhaustive + + client = SeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + client.req_with_headers.get_with_custom_header( + x_test_service_header="string", + x_test_endpoint_header="string", + request="string", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "test-headers/custom-header", + method="POST", + json=request, + headers={ + "X-TEST-SERVICE-HEADER": str(x_test_service_header) if x_test_service_header is not None else None, + "X-TEST-ENDPOINT-HEADER": str(x_test_endpoint_header) if x_test_endpoint_header is not None else None, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + +class AsyncReqWithHeadersClient: + def __init__(self, *, client_wrapper: AsyncClientWrapper): + self._client_wrapper = client_wrapper + + async def get_with_custom_header( + self, + *, + x_test_service_header: str, + x_test_endpoint_header: str, + request: str, + request_options: typing.Optional[RequestOptions] = None + ) -> None: + """ + Parameters + ---------- + x_test_service_header : str + + x_test_endpoint_header : str + + request : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- + import asyncio + + from seed import AsyncSeedExhaustive + + client = AsyncSeedExhaustive( + token="YOUR_TOKEN", + base_url="https://yourhost.com/path/to/api", + ) + + + async def main() -> None: + await client.req_with_headers.get_with_custom_header( + x_test_service_header="string", + x_test_endpoint_header="string", + request="string", + ) + + + asyncio.run(main()) + """ + _response = await self._client_wrapper.httpx_client.request( + "test-headers/custom-header", + method="POST", + json=request, + headers={ + "X-TEST-SERVICE-HEADER": str(x_test_service_header) if x_test_service_header is not None else None, + "X-TEST-ENDPOINT-HEADER": str(x_test_endpoint_header) if x_test_endpoint_header is not None else None, + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + return + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/__init__.py new file mode 100644 index 00000000000..e7a49db5142 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/__init__.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +from . import enum, object, union +from .enum import ErrorWithEnumBody, WeatherReport +from .object import ( + DoubleOptional, + NestedObjectWithOptionalField, + NestedObjectWithOptionalFieldError, + NestedObjectWithRequiredField, + NestedObjectWithRequiredFieldError, + ObjectWithMapOfMap, + ObjectWithOptionalField, + ObjectWithOptionalFieldError, + ObjectWithRequiredField, + ObjectWithRequiredFieldError, + OptionalAlias, +) +from .union import Animal, Animal_Cat, Animal_Dog, Cat, Dog, ErrorWithUnionBody + +__all__ = [ + "Animal", + "Animal_Cat", + "Animal_Dog", + "Cat", + "Dog", + "DoubleOptional", + "ErrorWithEnumBody", + "ErrorWithUnionBody", + "NestedObjectWithOptionalField", + "NestedObjectWithOptionalFieldError", + "NestedObjectWithRequiredField", + "NestedObjectWithRequiredFieldError", + "ObjectWithMapOfMap", + "ObjectWithOptionalField", + "ObjectWithOptionalFieldError", + "ObjectWithRequiredField", + "ObjectWithRequiredFieldError", + "OptionalAlias", + "WeatherReport", + "enum", + "object", + "union", +] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/enum/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/enum/__init__.py new file mode 100644 index 00000000000..b1c48999a72 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/enum/__init__.py @@ -0,0 +1,6 @@ +# This file was auto-generated by Fern from our API Definition. + +from .types import WeatherReport +from .errors import ErrorWithEnumBody + +__all__ = ["ErrorWithEnumBody", "WeatherReport"] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/enum/errors/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/enum/errors/__init__.py new file mode 100644 index 00000000000..f5945e36d9d --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/enum/errors/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .error_with_enum_body import ErrorWithEnumBody + +__all__ = ["ErrorWithEnumBody"] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/enum/errors/error_with_enum_body.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/enum/errors/error_with_enum_body.py new file mode 100644 index 00000000000..dfdc65ac0a2 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/enum/errors/error_with_enum_body.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +from ....core.api_error import ApiError +from ..types.weather_report import WeatherReport + + +class ErrorWithEnumBody(ApiError): + def __init__(self, body: WeatherReport): + super().__init__(status_code=400, body=body) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/enum/types/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/enum/types/__init__.py new file mode 100644 index 00000000000..7a47d1fefc6 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/enum/types/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .weather_report import WeatherReport + +__all__ = ["WeatherReport"] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/enum/types/weather_report.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/enum/types/weather_report.py new file mode 100644 index 00000000000..2d54965dc22 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/enum/types/weather_report.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +WeatherReport = typing.Union[typing.Literal["SUNNY", "CLOUDY", "RAINING", "SNOWING"], typing.Any] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/__init__.py new file mode 100644 index 00000000000..e3a774b5a05 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/__init__.py @@ -0,0 +1,31 @@ +# This file was auto-generated by Fern from our API Definition. + +from .types import ( + DoubleOptional, + NestedObjectWithOptionalField, + NestedObjectWithRequiredField, + ObjectWithMapOfMap, + ObjectWithOptionalField, + ObjectWithRequiredField, + OptionalAlias, +) +from .errors import ( + NestedObjectWithOptionalFieldError, + NestedObjectWithRequiredFieldError, + ObjectWithOptionalFieldError, + ObjectWithRequiredFieldError, +) + +__all__ = [ + "DoubleOptional", + "NestedObjectWithOptionalField", + "NestedObjectWithOptionalFieldError", + "NestedObjectWithRequiredField", + "NestedObjectWithRequiredFieldError", + "ObjectWithMapOfMap", + "ObjectWithOptionalField", + "ObjectWithOptionalFieldError", + "ObjectWithRequiredField", + "ObjectWithRequiredFieldError", + "OptionalAlias", +] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/errors/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/errors/__init__.py new file mode 100644 index 00000000000..7e7e4c63aa8 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/errors/__init__.py @@ -0,0 +1,13 @@ +# This file was auto-generated by Fern from our API Definition. + +from .nested_object_with_optional_field_error import NestedObjectWithOptionalFieldError +from .nested_object_with_required_field_error import NestedObjectWithRequiredFieldError +from .object_with_optional_field_error import ObjectWithOptionalFieldError +from .object_with_required_field_error import ObjectWithRequiredFieldError + +__all__ = [ + "NestedObjectWithOptionalFieldError", + "NestedObjectWithRequiredFieldError", + "ObjectWithOptionalFieldError", + "ObjectWithRequiredFieldError", +] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/errors/nested_object_with_optional_field_error.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/errors/nested_object_with_optional_field_error.py new file mode 100644 index 00000000000..a3886c45b34 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/errors/nested_object_with_optional_field_error.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +from ....core.api_error import ApiError +from ..types.nested_object_with_optional_field import NestedObjectWithOptionalField + + +class NestedObjectWithOptionalFieldError(ApiError): + def __init__(self, body: NestedObjectWithOptionalField): + super().__init__(status_code=400, body=body) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/errors/nested_object_with_required_field_error.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/errors/nested_object_with_required_field_error.py new file mode 100644 index 00000000000..3b6b788d492 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/errors/nested_object_with_required_field_error.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +from ....core.api_error import ApiError +from ..types.nested_object_with_required_field import NestedObjectWithRequiredField + + +class NestedObjectWithRequiredFieldError(ApiError): + def __init__(self, body: NestedObjectWithRequiredField): + super().__init__(status_code=400, body=body) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/errors/object_with_optional_field_error.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/errors/object_with_optional_field_error.py new file mode 100644 index 00000000000..3652a448b6e --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/errors/object_with_optional_field_error.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +from ....core.api_error import ApiError +from ..types.object_with_optional_field import ObjectWithOptionalField + + +class ObjectWithOptionalFieldError(ApiError): + def __init__(self, body: ObjectWithOptionalField): + super().__init__(status_code=400, body=body) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/errors/object_with_required_field_error.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/errors/object_with_required_field_error.py new file mode 100644 index 00000000000..ee17778fd26 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/errors/object_with_required_field_error.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +from ....core.api_error import ApiError +from ..types.object_with_required_field import ObjectWithRequiredField + + +class ObjectWithRequiredFieldError(ApiError): + def __init__(self, body: ObjectWithRequiredField): + super().__init__(status_code=400, body=body) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/types/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/types/__init__.py new file mode 100644 index 00000000000..2620e6eea12 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/types/__init__.py @@ -0,0 +1,19 @@ +# This file was auto-generated by Fern from our API Definition. + +from .double_optional import DoubleOptional +from .nested_object_with_optional_field import NestedObjectWithOptionalField +from .nested_object_with_required_field import NestedObjectWithRequiredField +from .object_with_map_of_map import ObjectWithMapOfMap +from .object_with_optional_field import ObjectWithOptionalField +from .object_with_required_field import ObjectWithRequiredField +from .optional_alias import OptionalAlias + +__all__ = [ + "DoubleOptional", + "NestedObjectWithOptionalField", + "NestedObjectWithRequiredField", + "ObjectWithMapOfMap", + "ObjectWithOptionalField", + "ObjectWithRequiredField", + "OptionalAlias", +] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/types/double_optional.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/types/double_optional.py new file mode 100644 index 00000000000..ddf165b13bd --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/types/double_optional.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic + +from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .optional_alias import OptionalAlias + + +class DoubleOptional(UniversalBaseModel): + optional_alias: typing.Optional[OptionalAlias] = pydantic.Field(alias="optionalAlias", default=None) + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/types/nested_object_with_optional_field.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/types/nested_object_with_optional_field.py new file mode 100644 index 00000000000..81669c0dd39 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/types/nested_object_with_optional_field.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic + +from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .object_with_optional_field import ObjectWithOptionalField + + +class NestedObjectWithOptionalField(UniversalBaseModel): + string: typing.Optional[str] = None + nested_object: typing.Optional[ObjectWithOptionalField] = pydantic.Field(alias="NestedObject", default=None) + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/types/nested_object_with_required_field.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/types/nested_object_with_required_field.py new file mode 100644 index 00000000000..1a621942c6c --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/types/nested_object_with_required_field.py @@ -0,0 +1,22 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic + +from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel +from .object_with_optional_field import ObjectWithOptionalField + + +class NestedObjectWithRequiredField(UniversalBaseModel): + string: str + nested_object: ObjectWithOptionalField = pydantic.Field(alias="NestedObject") + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/types/object_with_map_of_map.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/types/object_with_map_of_map.py new file mode 100644 index 00000000000..8883cc1d498 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/types/object_with_map_of_map.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic + +from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel + + +class ObjectWithMapOfMap(UniversalBaseModel): + map_: typing.Dict[str, typing.Dict[str, str]] = pydantic.Field(alias="map") + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/types/object_with_optional_field.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/types/object_with_optional_field.py new file mode 100644 index 00000000000..6aab170be0c --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/types/object_with_optional_field.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing +import uuid + +import pydantic + +from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel + + +class ObjectWithOptionalField(UniversalBaseModel): + string: typing.Optional[str] = pydantic.Field(default=None) + """ + This is a rather long descriptor of this single field in a more complex type. If you ask me I think this is a pretty good description for this field all things considered. + """ + + integer: typing.Optional[int] = None + long_: typing.Optional[int] = pydantic.Field(alias="long", default=None) + double: typing.Optional[float] = None + bool_: typing.Optional[bool] = pydantic.Field(alias="bool", default=None) + datetime: typing.Optional[dt.datetime] = None + date: typing.Optional[dt.date] = None + uuid_: typing.Optional[uuid.UUID] = pydantic.Field(alias="uuid", default=None) + base_64: typing.Optional[str] = pydantic.Field(alias="base64", default=None) + list_: typing.Optional[typing.List[str]] = pydantic.Field(alias="list", default=None) + set_: typing.Optional[typing.Set[str]] = pydantic.Field(alias="set", default=None) + map_: typing.Optional[typing.Dict[int, str]] = pydantic.Field(alias="map", default=None) + bigint: typing.Optional[str] = None + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/types/object_with_required_field.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/types/object_with_required_field.py new file mode 100644 index 00000000000..61b98867984 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/types/object_with_required_field.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic + +from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel + + +class ObjectWithRequiredField(UniversalBaseModel): + string: str + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/types/optional_alias.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/types/optional_alias.py new file mode 100644 index 00000000000..26a78ff7a5d --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/object/types/optional_alias.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic + +from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel + + +class OptionalAlias(UniversalBaseModel): + __root__: typing.Optional[str] + + def get_as_str(self) -> typing.Optional[str]: + return self.__root__ + + @staticmethod + def from_str(value: typing.Optional[str]) -> OptionalAlias: + return OptionalAlias(__root__=value) + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/union/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/union/__init__.py new file mode 100644 index 00000000000..30187ae029e --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/union/__init__.py @@ -0,0 +1,6 @@ +# This file was auto-generated by Fern from our API Definition. + +from .types import Animal, Animal_Cat, Animal_Dog, Cat, Dog +from .errors import ErrorWithUnionBody + +__all__ = ["Animal", "Animal_Cat", "Animal_Dog", "Cat", "Dog", "ErrorWithUnionBody"] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/union/errors/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/union/errors/__init__.py new file mode 100644 index 00000000000..568a71fa3c4 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/union/errors/__init__.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +from .error_with_union_body import ErrorWithUnionBody + +__all__ = ["ErrorWithUnionBody"] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/union/errors/error_with_union_body.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/union/errors/error_with_union_body.py new file mode 100644 index 00000000000..3ead0383351 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/union/errors/error_with_union_body.py @@ -0,0 +1,9 @@ +# This file was auto-generated by Fern from our API Definition. + +from ....core.api_error import ApiError +from ..types.animal import Animal + + +class ErrorWithUnionBody(ApiError): + def __init__(self, body: Animal): + super().__init__(status_code=400, body=body) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/union/types/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/union/types/__init__.py new file mode 100644 index 00000000000..44ff66be5d9 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/union/types/__init__.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +from .animal import Animal, Animal_Cat, Animal_Dog +from .cat import Cat +from .dog import Dog + +__all__ = ["Animal", "Animal_Cat", "Animal_Dog", "Cat", "Dog"] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/union/types/animal.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/union/types/animal.py new file mode 100644 index 00000000000..1ae43d1663e --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/union/types/animal.py @@ -0,0 +1,42 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import pydantic + +from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel + + +class Animal_Dog(UniversalBaseModel): + animal: typing.Literal["dog"] = "dog" + name: str + likes_to_woof: bool = pydantic.Field(alias="likesToWoof") + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +class Animal_Cat(UniversalBaseModel): + animal: typing.Literal["cat"] = "cat" + name: str + likes_to_meow: bool = pydantic.Field(alias="likesToMeow") + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow + + +Animal = typing.Union[Animal_Dog, Animal_Cat] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/union/types/cat.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/union/types/cat.py new file mode 100644 index 00000000000..61fc5527b1f --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/union/types/cat.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic + +from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel + + +class Cat(UniversalBaseModel): + name: str + likes_to_meow: bool = pydantic.Field(alias="likesToMeow") + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/union/types/dog.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/union/types/dog.py new file mode 100644 index 00000000000..c1ff5339dfe --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/types/union/types/dog.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic + +from ....core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel + + +class Dog(UniversalBaseModel): + name: str + likes_to_woof: bool = pydantic.Field(alias="likesToWoof") + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/version.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/version.py new file mode 100644 index 00000000000..63ba170685a --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/src/seed/version.py @@ -0,0 +1,4 @@ + +from importlib import metadata + +__version__ = metadata.version("fern_exhaustive") diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/__init__.py new file mode 100644 index 00000000000..f3ea2659bb1 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/conftest.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/conftest.py new file mode 100644 index 00000000000..b5b50383b94 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/conftest.py @@ -0,0 +1,16 @@ +# This file was auto-generated by Fern from our API Definition. + +import os + +import pytest +from seed import AsyncSeedExhaustive, SeedExhaustive + + +@pytest.fixture +def client() -> SeedExhaustive: + return SeedExhaustive(token=os.getenv("ENV_TOKEN", "token"), base_url=os.getenv("TESTS_BASE_URL", "base_url")) + + +@pytest.fixture +def async_client() -> AsyncSeedExhaustive: + return AsyncSeedExhaustive(token=os.getenv("ENV_TOKEN", "token"), base_url=os.getenv("TESTS_BASE_URL", "base_url")) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/custom/test_client.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/custom/test_client.py new file mode 100644 index 00000000000..60a58e64c27 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/custom/test_client.py @@ -0,0 +1,6 @@ +import pytest + +# Get started with writing tests with pytest at https://docs.pytest.org +@pytest.mark.skip(reason="Unimplemented") +def test_client() -> None: + assert True == True diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/endpoints/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/endpoints/__init__.py new file mode 100644 index 00000000000..f3ea2659bb1 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/endpoints/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/endpoints/test_container.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/endpoints/test_container.py new file mode 100644 index 00000000000..17d9d75240d --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/endpoints/test_container.py @@ -0,0 +1,94 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from seed import AsyncSeedExhaustive, SeedExhaustive +from seed.types.object import ObjectWithRequiredField + +from ..utilities import validate_response + + +async def test_get_and_return_list_of_primitives(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = ["string"] + expected_types: typing.Tuple[typing.Any, typing.Any] = ("list", {0: None}) + response = client.endpoints.container.get_and_return_list_of_primitives(request=["string"]) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.container.get_and_return_list_of_primitives(request=["string"]) + validate_response(async_response, expected_response, expected_types) + + +async def test_get_and_return_list_of_objects(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = [{"string": "string"}] + expected_types: typing.Tuple[typing.Any, typing.Any] = ("list", {0: {"string": None}}) + response = client.endpoints.container.get_and_return_list_of_objects( + request=[ObjectWithRequiredField(string="string")] + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.container.get_and_return_list_of_objects( + request=[ObjectWithRequiredField(string="string")] + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_get_and_return_set_of_primitives(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = ["string"] + expected_types: typing.Tuple[typing.Any, typing.Any] = ("set", {0: None}) + response = client.endpoints.container.get_and_return_set_of_primitives(request={"string"}) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.container.get_and_return_set_of_primitives(request={"string"}) + validate_response(async_response, expected_response, expected_types) + + +async def test_get_and_return_set_of_objects(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = [{"string": "string"}] + expected_types: typing.Tuple[typing.Any, typing.Any] = ("set", {0: {"string": None}}) + response = client.endpoints.container.get_and_return_set_of_objects( + request=[ObjectWithRequiredField(string="string")] + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.container.get_and_return_set_of_objects( + request=[ObjectWithRequiredField(string="string")] + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_get_and_return_map_prim_to_prim(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = {"string": "string"} + expected_types: typing.Tuple[typing.Any, typing.Any] = ("dict", {0: (None, None)}) + response = client.endpoints.container.get_and_return_map_prim_to_prim(request={"string": "string"}) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.container.get_and_return_map_prim_to_prim( + request={"string": "string"} + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_get_and_return_map_of_prim_to_object(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = {"string": {"string": "string"}} + expected_types: typing.Tuple[typing.Any, typing.Any] = ("dict", {0: (None, {"string": None})}) + response = client.endpoints.container.get_and_return_map_of_prim_to_object( + request={"string": ObjectWithRequiredField(string="string")} + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.container.get_and_return_map_of_prim_to_object( + request={"string": ObjectWithRequiredField(string="string")} + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_get_and_return_optional(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = {"string": "string"} + expected_types: typing.Any = {"string": None} + response = client.endpoints.container.get_and_return_optional(request=ObjectWithRequiredField(string="string")) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.container.get_and_return_optional( + request=ObjectWithRequiredField(string="string") + ) + validate_response(async_response, expected_response, expected_types) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/endpoints/test_enum.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/endpoints/test_enum.py new file mode 100644 index 00000000000..890aada5ce4 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/endpoints/test_enum.py @@ -0,0 +1,17 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from seed import AsyncSeedExhaustive, SeedExhaustive + +from ..utilities import validate_response + + +async def test_get_and_return_enum(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = "SUNNY" + expected_types: typing.Any = None + response = client.endpoints.enum.get_and_return_enum(request="SUNNY") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.enum.get_and_return_enum(request="SUNNY") + validate_response(async_response, expected_response, expected_types) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/endpoints/test_http_methods.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/endpoints/test_http_methods.py new file mode 100644 index 00000000000..dc01bafcf6f --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/endpoints/test_http_methods.py @@ -0,0 +1,173 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime +import typing +import uuid + +from seed import AsyncSeedExhaustive, SeedExhaustive + +from ..utilities import validate_response + + +async def test_test_get(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = "string" + expected_types: typing.Any = None + response = client.endpoints.http_methods.test_get(id="string") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.http_methods.test_get(id="string") + validate_response(async_response, expected_response, expected_types) + + +async def test_test_post(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = { + "string": "string", + "integer": 1, + "long": 1000000, + "double": 1.1, + "bool": True, + "datetime": "2024-01-15T09:30:00Z", + "date": "2023-01-15", + "uuid": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + "base64": "SGVsbG8gd29ybGQh", + "list": ["string"], + "set": ["string"], + "map": {"1": "string"}, + "bigint": "123456789123456789", + } + expected_types: typing.Any = { + "string": None, + "integer": "integer", + "long": None, + "double": None, + "bool": None, + "datetime": "datetime", + "date": "date", + "uuid": "uuid", + "base64": None, + "list": ("list", {0: None}), + "set": ("set", {0: None}), + "map": ("dict", {0: ("integer", None)}), + "bigint": None, + } + response = client.endpoints.http_methods.test_post(string="string") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.http_methods.test_post(string="string") + validate_response(async_response, expected_response, expected_types) + + +async def test_test_put(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = { + "string": "string", + "integer": 1, + "long": 1000000, + "double": 1.1, + "bool": True, + "datetime": "2024-01-15T09:30:00Z", + "date": "2023-01-15", + "uuid": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + "base64": "SGVsbG8gd29ybGQh", + "list": ["string"], + "set": ["string"], + "map": {"1": "string"}, + "bigint": "123456789123456789", + } + expected_types: typing.Any = { + "string": None, + "integer": "integer", + "long": None, + "double": None, + "bool": None, + "datetime": "datetime", + "date": "date", + "uuid": "uuid", + "base64": None, + "list": ("list", {0: None}), + "set": ("set", {0: None}), + "map": ("dict", {0: ("integer", None)}), + "bigint": None, + } + response = client.endpoints.http_methods.test_put(id="string", string="string") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.http_methods.test_put(id="string", string="string") + validate_response(async_response, expected_response, expected_types) + + +async def test_test_patch(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = { + "string": "string", + "integer": 1, + "long": 1000000, + "double": 1.1, + "bool": True, + "datetime": "2024-01-15T09:30:00Z", + "date": "2023-01-15", + "uuid": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + "base64": "SGVsbG8gd29ybGQh", + "list": ["string"], + "set": ["string"], + "map": {"1": "string"}, + "bigint": "123456789123456789", + } + expected_types: typing.Any = { + "string": None, + "integer": "integer", + "long": None, + "double": None, + "bool": None, + "datetime": "datetime", + "date": "date", + "uuid": "uuid", + "base64": None, + "list": ("list", {0: None}), + "set": ("set", {0: None}), + "map": ("dict", {0: ("integer", None)}), + "bigint": None, + } + response = client.endpoints.http_methods.test_patch( + id="string", + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00"), + date=datetime.date.fromisoformat("2023-01-15"), + uuid_=uuid.UUID("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.http_methods.test_patch( + id="string", + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00"), + date=datetime.date.fromisoformat("2023-01-15"), + uuid_=uuid.UUID("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_test_delete(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = True + expected_types: typing.Any = None + response = client.endpoints.http_methods.test_delete(id="string") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.http_methods.test_delete(id="string") + validate_response(async_response, expected_response, expected_types) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/endpoints/test_object.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/endpoints/test_object.py new file mode 100644 index 00000000000..a9098b6e9ef --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/endpoints/test_object.py @@ -0,0 +1,348 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime +import typing +import uuid + +from seed import AsyncSeedExhaustive, SeedExhaustive +from seed.types.object import NestedObjectWithRequiredField, ObjectWithOptionalField + +from ..utilities import validate_response + + +async def test_get_and_return_with_optional_field(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = { + "string": "string", + "integer": 1, + "long": 1000000, + "double": 1.1, + "bool": True, + "datetime": "2024-01-15T09:30:00Z", + "date": "2023-01-15", + "uuid": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + "base64": "SGVsbG8gd29ybGQh", + "list": ["string"], + "set": ["string"], + "map": {"1": "string"}, + "bigint": "123456789123456789", + } + expected_types: typing.Any = { + "string": None, + "integer": "integer", + "long": None, + "double": None, + "bool": None, + "datetime": "datetime", + "date": "date", + "uuid": "uuid", + "base64": None, + "list": ("list", {0: None}), + "set": ("set", {0: None}), + "map": ("dict", {0: ("integer", None)}), + "bigint": None, + } + response = client.endpoints.object.get_and_return_with_optional_field( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00"), + date=datetime.date.fromisoformat("2023-01-15"), + uuid_=uuid.UUID("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.object.get_and_return_with_optional_field( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00"), + date=datetime.date.fromisoformat("2023-01-15"), + uuid_=uuid.UUID("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_get_and_return_with_required_field(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = {"string": "string"} + expected_types: typing.Any = {"string": None} + response = client.endpoints.object.get_and_return_with_required_field(string="string") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.object.get_and_return_with_required_field(string="string") + validate_response(async_response, expected_response, expected_types) + + +async def test_get_and_return_with_map_of_map(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = {"map": {"string": {"string": "string"}}} + expected_types: typing.Any = {"map": ("dict", {0: (None, ("dict", {0: (None, None)}))})} + response = client.endpoints.object.get_and_return_with_map_of_map(map_={"string": {"string": "string"}}) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.object.get_and_return_with_map_of_map( + map_={"string": {"string": "string"}} + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_get_and_return_nested_with_optional_field( + client: SeedExhaustive, async_client: AsyncSeedExhaustive +) -> None: + expected_response: typing.Any = { + "string": "string", + "NestedObject": { + "string": "string", + "integer": 1, + "long": 1000000, + "double": 1.1, + "bool": True, + "datetime": "2024-01-15T09:30:00Z", + "date": "2023-01-15", + "uuid": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + "base64": "SGVsbG8gd29ybGQh", + "list": ["string"], + "set": ["string"], + "map": {"1": "string"}, + "bigint": "123456789123456789", + }, + } + expected_types: typing.Any = { + "string": None, + "NestedObject": { + "string": None, + "integer": "integer", + "long": None, + "double": None, + "bool": None, + "datetime": "datetime", + "date": "date", + "uuid": "uuid", + "base64": None, + "list": ("list", {0: None}), + "set": ("set", {0: None}), + "map": ("dict", {0: ("integer", None)}), + "bigint": None, + }, + } + response = client.endpoints.object.get_and_return_nested_with_optional_field( + string="string", + nested_object=ObjectWithOptionalField( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00"), + date=datetime.date.fromisoformat("2023-01-15"), + uuid_=uuid.UUID("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ), + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.object.get_and_return_nested_with_optional_field( + string="string", + nested_object=ObjectWithOptionalField( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00"), + date=datetime.date.fromisoformat("2023-01-15"), + uuid_=uuid.UUID("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ), + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_get_and_return_nested_with_required_field( + client: SeedExhaustive, async_client: AsyncSeedExhaustive +) -> None: + expected_response: typing.Any = { + "string": "string", + "NestedObject": { + "string": "string", + "integer": 1, + "long": 1000000, + "double": 1.1, + "bool": True, + "datetime": "2024-01-15T09:30:00Z", + "date": "2023-01-15", + "uuid": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + "base64": "SGVsbG8gd29ybGQh", + "list": ["string"], + "set": ["string"], + "map": {"1": "string"}, + "bigint": "123456789123456789", + }, + } + expected_types: typing.Any = { + "string": None, + "NestedObject": { + "string": None, + "integer": "integer", + "long": None, + "double": None, + "bool": None, + "datetime": "datetime", + "date": "date", + "uuid": "uuid", + "base64": None, + "list": ("list", {0: None}), + "set": ("set", {0: None}), + "map": ("dict", {0: ("integer", None)}), + "bigint": None, + }, + } + response = client.endpoints.object.get_and_return_nested_with_required_field( + string_="string", + string="string", + nested_object=ObjectWithOptionalField( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00"), + date=datetime.date.fromisoformat("2023-01-15"), + uuid_=uuid.UUID("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ), + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.object.get_and_return_nested_with_required_field( + string_="string", + string="string", + nested_object=ObjectWithOptionalField( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00"), + date=datetime.date.fromisoformat("2023-01-15"), + uuid_=uuid.UUID("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ), + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_get_and_return_nested_with_required_field_as_list( + client: SeedExhaustive, async_client: AsyncSeedExhaustive +) -> None: + expected_response: typing.Any = { + "string": "string", + "NestedObject": { + "string": "string", + "integer": 1, + "long": 1000000, + "double": 1.1, + "bool": True, + "datetime": "2024-01-15T09:30:00Z", + "date": "2023-01-15", + "uuid": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + "base64": "SGVsbG8gd29ybGQh", + "list": ["string"], + "set": ["string"], + "map": {"1": "string"}, + "bigint": "123456789123456789", + }, + } + expected_types: typing.Any = { + "string": None, + "NestedObject": { + "string": None, + "integer": "integer", + "long": None, + "double": None, + "bool": None, + "datetime": "datetime", + "date": "date", + "uuid": "uuid", + "base64": None, + "list": ("list", {0: None}), + "set": ("set", {0: None}), + "map": ("dict", {0: ("integer", None)}), + "bigint": None, + }, + } + response = client.endpoints.object.get_and_return_nested_with_required_field_as_list( + request=[ + NestedObjectWithRequiredField( + string="string", + nested_object=ObjectWithOptionalField( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00"), + date=datetime.date.fromisoformat("2023-01-15"), + uuid_=uuid.UUID("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ), + ) + ] + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.object.get_and_return_nested_with_required_field_as_list( + request=[ + NestedObjectWithRequiredField( + string="string", + nested_object=ObjectWithOptionalField( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00"), + date=datetime.date.fromisoformat("2023-01-15"), + uuid_=uuid.UUID("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ), + ) + ] + ) + validate_response(async_response, expected_response, expected_types) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/endpoints/test_params.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/endpoints/test_params.py new file mode 100644 index 00000000000..163d7b9161d --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/endpoints/test_params.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from seed import AsyncSeedExhaustive, SeedExhaustive + +from ..utilities import validate_response + + +async def test_get_with_path(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = "string" + expected_types: typing.Any = None + response = client.endpoints.params.get_with_path(param="string") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.params.get_with_path(param="string") + validate_response(async_response, expected_response, expected_types) + + +async def test_get_with_query(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + # Type ignore to avoid mypy complaining about the function not being meant to return a value + assert client.endpoints.params.get_with_query(query="string", number=1) is None # type: ignore[func-returns-value] + + assert await async_client.endpoints.params.get_with_query(query="string", number=1) is None # type: ignore[func-returns-value] + + +async def test_get_with_allow_multiple_query(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + # Type ignore to avoid mypy complaining about the function not being meant to return a value + assert client.endpoints.params.get_with_allow_multiple_query(query="string", numer=1) is None # type: ignore[func-returns-value] + + assert await async_client.endpoints.params.get_with_allow_multiple_query(query="string", numer=1) is None # type: ignore[func-returns-value] + + +async def test_get_with_path_and_query(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + # Type ignore to avoid mypy complaining about the function not being meant to return a value + assert client.endpoints.params.get_with_path_and_query(param="string", query="string") is None # type: ignore[func-returns-value] + + assert await async_client.endpoints.params.get_with_path_and_query(param="string", query="string") is None # type: ignore[func-returns-value] + + +async def test_modify_with_path(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = "string" + expected_types: typing.Any = None + response = client.endpoints.params.modify_with_path(param="string", request="string") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.params.modify_with_path(param="string", request="string") + validate_response(async_response, expected_response, expected_types) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/endpoints/test_primitive.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/endpoints/test_primitive.py new file mode 100644 index 00000000000..ba3bc7e29e5 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/endpoints/test_primitive.py @@ -0,0 +1,107 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime +import typing +import uuid + +from seed import AsyncSeedExhaustive, SeedExhaustive + +from ..utilities import validate_response + + +async def test_get_and_return_string(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = "string" + expected_types: typing.Any = None + response = client.endpoints.primitive.get_and_return_string(request="string") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.primitive.get_and_return_string(request="string") + validate_response(async_response, expected_response, expected_types) + + +async def test_get_and_return_int(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = 1 + expected_types: typing.Any = "integer" + response = client.endpoints.primitive.get_and_return_int(request=1) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.primitive.get_and_return_int(request=1) + validate_response(async_response, expected_response, expected_types) + + +async def test_get_and_return_long(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = 1000000 + expected_types: typing.Any = None + response = client.endpoints.primitive.get_and_return_long(request=1000000) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.primitive.get_and_return_long(request=1000000) + validate_response(async_response, expected_response, expected_types) + + +async def test_get_and_return_double(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = 1.1 + expected_types: typing.Any = None + response = client.endpoints.primitive.get_and_return_double(request=1.1) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.primitive.get_and_return_double(request=1.1) + validate_response(async_response, expected_response, expected_types) + + +async def test_get_and_return_bool(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = True + expected_types: typing.Any = None + response = client.endpoints.primitive.get_and_return_bool(request=True) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.primitive.get_and_return_bool(request=True) + validate_response(async_response, expected_response, expected_types) + + +async def test_get_and_return_datetime(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = "2024-01-15T09:30:00Z" + expected_types: typing.Any = "datetime" + response = client.endpoints.primitive.get_and_return_datetime( + request=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00") + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.primitive.get_and_return_datetime( + request=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00") + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_get_and_return_date(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = "2023-01-15" + expected_types: typing.Any = "date" + response = client.endpoints.primitive.get_and_return_date(request=datetime.date.fromisoformat("2023-01-15")) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.primitive.get_and_return_date( + request=datetime.date.fromisoformat("2023-01-15") + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_get_and_return_uuid(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32" + expected_types: typing.Any = "uuid" + response = client.endpoints.primitive.get_and_return_uuid(request=uuid.UUID("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32")) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.primitive.get_and_return_uuid( + request=uuid.UUID("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32") + ) + validate_response(async_response, expected_response, expected_types) + + +async def test_get_and_return_base_64(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = "SGVsbG8gd29ybGQh" + expected_types: typing.Any = None + response = client.endpoints.primitive.get_and_return_base_64(request="SGVsbG8gd29ybGQh") + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.primitive.get_and_return_base_64(request="SGVsbG8gd29ybGQh") + validate_response(async_response, expected_response, expected_types) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/endpoints/test_union.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/endpoints/test_union.py new file mode 100644 index 00000000000..14e34c2a6df --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/endpoints/test_union.py @@ -0,0 +1,20 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from seed import AsyncSeedExhaustive, SeedExhaustive +from seed.types.union import Animal_Dog + +from ..utilities import validate_response + + +async def test_get_and_return_union(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = {"animal": "dog", "name": "string", "likesToWoof": True} + expected_types: typing.Any = "no_validate" + response = client.endpoints.union.get_and_return_union(request=Animal_Dog(name="string", likes_to_woof=True)) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.endpoints.union.get_and_return_union( + request=Animal_Dog(name="string", likes_to_woof=True) + ) + validate_response(async_response, expected_response, expected_types) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/test_inlined_requests.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/test_inlined_requests.py new file mode 100644 index 00000000000..bb9390d3845 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/test_inlined_requests.py @@ -0,0 +1,84 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime +import typing +import uuid + +from seed import AsyncSeedExhaustive, SeedExhaustive +from seed.types.object import ObjectWithOptionalField + +from .utilities import validate_response + + +async def test_post_with_object_bodyand_response(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = { + "string": "string", + "integer": 1, + "long": 1000000, + "double": 1.1, + "bool": True, + "datetime": "2024-01-15T09:30:00Z", + "date": "2023-01-15", + "uuid": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + "base64": "SGVsbG8gd29ybGQh", + "list": ["string"], + "set": ["string"], + "map": {"1": "string"}, + "bigint": "123456789123456789", + } + expected_types: typing.Any = { + "string": None, + "integer": "integer", + "long": None, + "double": None, + "bool": None, + "datetime": "datetime", + "date": "date", + "uuid": "uuid", + "base64": None, + "list": ("list", {0: None}), + "set": ("set", {0: None}), + "map": ("dict", {0: ("integer", None)}), + "bigint": None, + } + response = client.inlined_requests.post_with_object_bodyand_response( + string="string", + integer=1, + nested_object=ObjectWithOptionalField( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00"), + date=datetime.date.fromisoformat("2023-01-15"), + uuid_=uuid.UUID("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ), + ) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.inlined_requests.post_with_object_bodyand_response( + string="string", + integer=1, + nested_object=ObjectWithOptionalField( + string="string", + integer=1, + long_=1000000, + double=1.1, + bool_=True, + datetime=datetime.datetime.fromisoformat("2024-01-15 09:30:00+00:00"), + date=datetime.date.fromisoformat("2023-01-15"), + uuid_=uuid.UUID("d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32"), + base_64="SGVsbG8gd29ybGQh", + list_=["string"], + set_={"string"}, + map_={1: "string"}, + bigint="123456789123456789", + ), + ) + validate_response(async_response, expected_response, expected_types) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/test_no_auth.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/test_no_auth.py new file mode 100644 index 00000000000..3328661bb48 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/test_no_auth.py @@ -0,0 +1,17 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from seed import AsyncSeedExhaustive, SeedExhaustive + +from .utilities import validate_response + + +async def test_post_with_no_auth(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = True + expected_types: typing.Any = None + response = client.no_auth.post_with_no_auth(request={"key": "value"}) + validate_response(response, expected_response, expected_types) + + async_response = await async_client.no_auth.post_with_no_auth(request={"key": "value"}) + validate_response(async_response, expected_response, expected_types) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/test_no_req_body.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/test_no_req_body.py new file mode 100644 index 00000000000..73abac9d2d8 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/test_no_req_body.py @@ -0,0 +1,55 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +from seed import AsyncSeedExhaustive, SeedExhaustive + +from .utilities import validate_response + + +async def test_get_with_no_request_body(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = { + "string": "string", + "integer": 1, + "long": 1000000, + "double": 1.1, + "bool": True, + "datetime": "2024-01-15T09:30:00Z", + "date": "2023-01-15", + "uuid": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + "base64": "SGVsbG8gd29ybGQh", + "list": ["string"], + "set": ["string"], + "map": {"1": "string"}, + "bigint": "123456789123456789", + } + expected_types: typing.Any = { + "string": None, + "integer": "integer", + "long": None, + "double": None, + "bool": None, + "datetime": "datetime", + "date": "date", + "uuid": "uuid", + "base64": None, + "list": ("list", {0: None}), + "set": ("set", {0: None}), + "map": ("dict", {0: ("integer", None)}), + "bigint": None, + } + response = client.no_req_body.get_with_no_request_body() + validate_response(response, expected_response, expected_types) + + async_response = await async_client.no_req_body.get_with_no_request_body() + validate_response(async_response, expected_response, expected_types) + + +async def test_post_with_no_request_body(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + expected_response: typing.Any = "string" + expected_types: typing.Any = None + response = client.no_req_body.post_with_no_request_body() + validate_response(response, expected_response, expected_types) + + async_response = await async_client.no_req_body.post_with_no_request_body() + validate_response(async_response, expected_response, expected_types) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/test_req_with_headers.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/test_req_with_headers.py new file mode 100644 index 00000000000..bba3b5b5507 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/test_req_with_headers.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +from seed import AsyncSeedExhaustive, SeedExhaustive + + +async def test_get_with_custom_header(client: SeedExhaustive, async_client: AsyncSeedExhaustive) -> None: + # Type ignore to avoid mypy complaining about the function not being meant to return a value + assert client.req_with_headers.get_with_custom_header(x_test_service_header="string", x_test_endpoint_header="string", request="string") is None # type: ignore[func-returns-value] + + assert await async_client.req_with_headers.get_with_custom_header(x_test_service_header="string", x_test_endpoint_header="string", request="string") is None # type: ignore[func-returns-value] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utilities.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utilities.py new file mode 100644 index 00000000000..13da208eb3a --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utilities.py @@ -0,0 +1,138 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing +import uuid + +import pydantic +from dateutil import parser + + +def cast_field(json_expectation: typing.Any, type_expectation: typing.Any) -> typing.Any: + # Cast these specific types which come through as string and expect our + # models to cast to the correct type. + if type_expectation == "uuid": + return uuid.UUID(json_expectation) + elif type_expectation == "date": + return parser.parse(json_expectation).date() + elif type_expectation == "datetime": + return parser.parse(json_expectation) + elif type_expectation == "set": + return set(json_expectation) + elif type_expectation == "integer": + # Necessary as we allow numeric keys, but JSON makes them strings + return int(json_expectation) + + return json_expectation + + +def validate_field(response: typing.Any, json_expectation: typing.Any, type_expectation: typing.Any) -> None: + # Allow for an escape hatch if the object cannot be validated + if type_expectation == "no_validate": + return + + is_container_of_complex_type = False + # Parse types in containers, note that dicts are handled within `validate_response` + if isinstance(json_expectation, list): + if isinstance(type_expectation, tuple): + container_expectation = type_expectation[0] + contents_expectation = type_expectation[1] + + cast_json_expectation = [] + for idx, ex in enumerate(json_expectation): + if isinstance(contents_expectation, dict): + entry_expectation = contents_expectation.get(idx) + if isinstance(entry_expectation, dict): + is_container_of_complex_type = True + validate_response( + response=response[idx], json_expectation=ex, type_expectations=entry_expectation + ) + else: + cast_json_expectation.append(cast_field(ex, entry_expectation)) + else: + cast_json_expectation.append(ex) + json_expectation = cast_json_expectation + + # Note that we explicitly do not allow for sets of pydantic models as they are not hashable, so + # if any of the values of the set have a type_expectation of a dict, we're assuming it's a pydantic + # model and keeping it a list. + if container_expectation != "set" or not any( + map(lambda value: isinstance(value, dict), list(contents_expectation.values())) + ): + json_expectation = cast_field(json_expectation, container_expectation) + elif isinstance(type_expectation, tuple): + container_expectation = type_expectation[0] + contents_expectation = type_expectation[1] + if isinstance(contents_expectation, dict): + json_expectation = { + cast_field( + key, contents_expectation.get(idx)[0] if contents_expectation.get(idx) is not None else None # type: ignore + ): cast_field( + value, contents_expectation.get(idx)[1] if contents_expectation.get(idx) is not None else None # type: ignore + ) + for idx, (key, value) in enumerate(json_expectation.items()) + } + else: + json_expectation = cast_field(json_expectation, container_expectation) + elif type_expectation is not None: + json_expectation = cast_field(json_expectation, type_expectation) + + # When dealing with containers of models, etc. we're validating them implicitly, so no need to check the resultant list + if not is_container_of_complex_type: + assert ( + json_expectation == response + ), "Primitives found, expected: {0} (type: {1}), Actual: {2} (type: {3})".format( + json_expectation, type(json_expectation), response, type(response) + ) + + +# Arg type_expectations is a deeply nested structure that matches the response, but with the values replaced with the expected types +def validate_response(response: typing.Any, json_expectation: typing.Any, type_expectations: typing.Any) -> None: + # Allow for an escape hatch if the object cannot be validated + if type_expectations == "no_validate": + return + + if ( + not isinstance(response, list) + and not isinstance(response, dict) + and not issubclass(type(response), pydantic.BaseModel) + ): + validate_field(response=response, json_expectation=json_expectation, type_expectation=type_expectations) + return + + if isinstance(response, list): + assert len(response) == len(json_expectation), "Length mismatch, expected: {0}, Actual: {1}".format( + len(response), len(json_expectation) + ) + content_expectation = type_expectations + if isinstance(type_expectations, tuple): + content_expectation = type_expectations[1] + for idx, item in enumerate(response): + validate_response( + response=item, json_expectation=json_expectation[idx], type_expectations=content_expectation[idx] + ) + else: + response_json = response + if issubclass(type(response), pydantic.BaseModel): + response_json = response.dict(by_alias=True) + + for key, value in json_expectation.items(): + assert key in response_json, "Field {0} not found within the response object: {1}".format( + key, response_json + ) + + type_expectation = None + if type_expectations is not None and isinstance(type_expectations, dict): + type_expectation = type_expectations.get(key) + + # If your type_expectation is a tuple then you have a container field, process it as such + # Otherwise, we're just validating a single field that's a pydantic model. + if isinstance(value, dict) and not isinstance(type_expectation, tuple): + validate_response( + response=response_json[key], json_expectation=value, type_expectations=type_expectation + ) + else: + validate_field(response=response_json[key], json_expectation=value, type_expectation=type_expectation) + + # Ensure there are no additional fields here either + del response_json[key] + assert len(response_json) == 0, "Additional fields found, expected None: {0}".format(response_json) diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/__init__.py new file mode 100644 index 00000000000..f3ea2659bb1 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/__init__.py @@ -0,0 +1,2 @@ +# This file was auto-generated by Fern from our API Definition. + diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/assets/models/__init__.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/assets/models/__init__.py new file mode 100644 index 00000000000..2cf01263529 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/assets/models/__init__.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +# This file was auto-generated by Fern from our API Definition. + +from .circle import CircleParams +from .object_with_defaults import ObjectWithDefaultsParams +from .object_with_optional_field import ObjectWithOptionalFieldParams +from .shape import Shape_CircleParams, Shape_SquareParams, ShapeParams +from .square import SquareParams +from .undiscriminated_shape import UndiscriminatedShapeParams + +__all__ = [ + "CircleParams", + "ObjectWithDefaultsParams", + "ObjectWithOptionalFieldParams", + "ShapeParams", + "Shape_CircleParams", + "Shape_SquareParams", + "SquareParams", + "UndiscriminatedShapeParams", +] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/assets/models/circle.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/assets/models/circle.py new file mode 100644 index 00000000000..af7a1bf8a8e --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/assets/models/circle.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +# This file was auto-generated by Fern from our API Definition. + +import typing_extensions +from seed.core.serialization import FieldMetadata + + +class CircleParams(typing_extensions.TypedDict): + radius_measurement: typing_extensions.Annotated[float, FieldMetadata(alias="radiusMeasurement")] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/assets/models/color.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/assets/models/color.py new file mode 100644 index 00000000000..2aa2c4c52f0 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/assets/models/color.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +# This file was auto-generated by Fern from our API Definition. + +import typing + +Color = typing.Union[typing.Literal["red", "blue"], typing.Any] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/assets/models/object_with_defaults.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/assets/models/object_with_defaults.py new file mode 100644 index 00000000000..a977b1d2aa1 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/assets/models/object_with_defaults.py @@ -0,0 +1,15 @@ +# This file was auto-generated by Fern from our API Definition. + +# This file was auto-generated by Fern from our API Definition. + +import typing_extensions + + +class ObjectWithDefaultsParams(typing_extensions.TypedDict): + """ + Defines properties with default values and validation rules. + """ + + decimal: typing_extensions.NotRequired[float] + string: typing_extensions.NotRequired[str] + required_string: str diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/assets/models/object_with_optional_field.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/assets/models/object_with_optional_field.py new file mode 100644 index 00000000000..3ad93d5f305 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/assets/models/object_with_optional_field.py @@ -0,0 +1,35 @@ +# This file was auto-generated by Fern from our API Definition. + +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing +import uuid + +import typing_extensions +from seed.core.serialization import FieldMetadata + +from .color import Color +from .shape import ShapeParams +from .undiscriminated_shape import UndiscriminatedShapeParams + + +class ObjectWithOptionalFieldParams(typing_extensions.TypedDict): + literal: typing.Literal["lit_one"] + string: typing_extensions.NotRequired[str] + integer: typing_extensions.NotRequired[int] + long_: typing_extensions.NotRequired[typing_extensions.Annotated[int, FieldMetadata(alias="long")]] + double: typing_extensions.NotRequired[float] + bool_: typing_extensions.NotRequired[typing_extensions.Annotated[bool, FieldMetadata(alias="bool")]] + datetime: typing_extensions.NotRequired[dt.datetime] + date: typing_extensions.NotRequired[dt.date] + uuid_: typing_extensions.NotRequired[typing_extensions.Annotated[uuid.UUID, FieldMetadata(alias="uuid")]] + base_64: typing_extensions.NotRequired[typing_extensions.Annotated[str, FieldMetadata(alias="base64")]] + list_: typing_extensions.NotRequired[typing_extensions.Annotated[typing.Sequence[str], FieldMetadata(alias="list")]] + set_: typing_extensions.NotRequired[typing_extensions.Annotated[typing.Set[str], FieldMetadata(alias="set")]] + map_: typing_extensions.NotRequired[typing_extensions.Annotated[typing.Dict[int, str], FieldMetadata(alias="map")]] + enum: typing_extensions.NotRequired[Color] + union: typing_extensions.NotRequired[ShapeParams] + second_union: typing_extensions.NotRequired[ShapeParams] + undiscriminated_union: typing_extensions.NotRequired[UndiscriminatedShapeParams] + any: typing.Any diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/assets/models/shape.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/assets/models/shape.py new file mode 100644 index 00000000000..2c33c877951 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/assets/models/shape.py @@ -0,0 +1,27 @@ +# This file was auto-generated by Fern from our API Definition. + +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import typing + +import typing_extensions +from seed.core.serialization import FieldMetadata + + +class Base(typing_extensions.TypedDict): + id: str + + +class Shape_CircleParams(Base): + shape_type: typing_extensions.Annotated[typing.Literal["circle"], FieldMetadata(alias="shapeType")] + radius_measurement: typing_extensions.Annotated[float, FieldMetadata(alias="radiusMeasurement")] + + +class Shape_SquareParams(Base): + shape_type: typing_extensions.Annotated[typing.Literal["square"], FieldMetadata(alias="shapeType")] + length_measurement: typing_extensions.Annotated[float, FieldMetadata(alias="lengthMeasurement")] + + +ShapeParams = typing.Union[Shape_CircleParams, Shape_SquareParams] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/assets/models/square.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/assets/models/square.py new file mode 100644 index 00000000000..b9b7dd319bc --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/assets/models/square.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +# This file was auto-generated by Fern from our API Definition. + +import typing_extensions +from seed.core.serialization import FieldMetadata + + +class SquareParams(typing_extensions.TypedDict): + length_measurement: typing_extensions.Annotated[float, FieldMetadata(alias="lengthMeasurement")] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/assets/models/undiscriminated_shape.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/assets/models/undiscriminated_shape.py new file mode 100644 index 00000000000..99f12b300d1 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/assets/models/undiscriminated_shape.py @@ -0,0 +1,10 @@ +# This file was auto-generated by Fern from our API Definition. + +# This file was auto-generated by Fern from our API Definition. + +import typing + +from .circle import CircleParams +from .square import SquareParams + +UndiscriminatedShapeParams = typing.Union[CircleParams, SquareParams] diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/test_http_client.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/test_http_client.py new file mode 100644 index 00000000000..edd11ca7afb --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/test_http_client.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +from seed.core.http_client import get_request_body +from seed.core.request_options import RequestOptions + + +def get_request_options() -> RequestOptions: + return {"additional_body_parameters": {"see you": "later"}} + + +def test_get_json_request_body() -> None: + json_body, data_body = get_request_body(json={"hello": "world"}, data=None, request_options=None, omit=None) + assert json_body == {"hello": "world"} + assert data_body is None + + json_body_extras, data_body_extras = get_request_body( + json={"goodbye": "world"}, data=None, request_options=get_request_options(), omit=None + ) + + assert json_body_extras == {"goodbye": "world", "see you": "later"} + assert data_body_extras is None + + +def test_get_files_request_body() -> None: + json_body, data_body = get_request_body(json=None, data={"hello": "world"}, request_options=None, omit=None) + assert data_body == {"hello": "world"} + assert json_body is None + + json_body_extras, data_body_extras = get_request_body( + json=None, data={"goodbye": "world"}, request_options=get_request_options(), omit=None + ) + + assert data_body_extras == {"goodbye": "world", "see you": "later"} + assert json_body_extras is None + + +def test_get_none_request_body() -> None: + json_body, data_body = get_request_body(json=None, data=None, request_options=None, omit=None) + assert data_body is None + assert json_body is None + + json_body_extras, data_body_extras = get_request_body( + json=None, data=None, request_options=get_request_options(), omit=None + ) + + assert json_body_extras == {"see you": "later"} + assert data_body_extras is None diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/test_query_encoding.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/test_query_encoding.py new file mode 100644 index 00000000000..247e1551b46 --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/test_query_encoding.py @@ -0,0 +1,18 @@ +# This file was auto-generated by Fern from our API Definition. + +from seed.core.query_encoder import encode_query + + +def test_query_encoding() -> None: + assert encode_query({"hello world": "hello world"}) == {"hello world": "hello world"} + assert encode_query({"hello_world": {"hello": "world"}}) == {"hello_world[hello]": "world"} + assert encode_query({"hello_world": {"hello": {"world": "today"}, "test": "this"}, "hi": "there"}) == { + "hello_world[hello][world]": "today", + "hello_world[test]": "this", + "hi": "there", + } + + +def test_encode_query_with_none() -> None: + encoded = encode_query(None) + assert encoded == None diff --git a/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/test_serialization.py b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/test_serialization.py new file mode 100644 index 00000000000..58b1ed66e6d --- /dev/null +++ b/seed/python-sdk/exhaustive/pydantic-v1-wrapped/tests/utils/test_serialization.py @@ -0,0 +1,66 @@ +# This file was auto-generated by Fern from our API Definition. + +from typing import Any, List + +from seed.core.serialization import convert_and_respect_annotation_metadata + +from .assets.models import ObjectWithOptionalFieldParams, ShapeParams + +UNION_TEST: ShapeParams = {"radius_measurement": 1.0, "shape_type": "circle", "id": "1"} +UNION_TEST_CONVERTED = {"shapeType": "circle", "radiusMeasurement": 1.0, "id": "1"} + + +def test_convert_and_respect_annotation_metadata() -> None: + data: ObjectWithOptionalFieldParams = { + "string": "string", + "long_": 12345, + "bool_": True, + "literal": "lit_one", + "any": "any", + } + converted = convert_and_respect_annotation_metadata(object_=data, annotation=ObjectWithOptionalFieldParams) + assert converted == {"string": "string", "long": 12345, "bool": True, "literal": "lit_one", "any": "any"} + + +def test_convert_and_respect_annotation_metadata_in_list() -> None: + data: List[ObjectWithOptionalFieldParams] = [ + {"string": "string", "long_": 12345, "bool_": True, "literal": "lit_one", "any": "any"}, + {"string": "another string", "long_": 67890, "list_": [], "literal": "lit_one", "any": "any"}, + ] + converted = convert_and_respect_annotation_metadata(object_=data, annotation=List[ObjectWithOptionalFieldParams]) + + assert converted == [ + {"string": "string", "long": 12345, "bool": True, "literal": "lit_one", "any": "any"}, + {"string": "another string", "long": 67890, "list": [], "literal": "lit_one", "any": "any"}, + ] + + +def test_convert_and_respect_annotation_metadata_in_nested_object() -> None: + data: ObjectWithOptionalFieldParams = { + "string": "string", + "long_": 12345, + "union": UNION_TEST, + "literal": "lit_one", + "any": "any", + } + converted = convert_and_respect_annotation_metadata(object_=data, annotation=ObjectWithOptionalFieldParams) + + assert converted == { + "string": "string", + "long": 12345, + "union": UNION_TEST_CONVERTED, + "literal": "lit_one", + "any": "any", + } + + +def test_convert_and_respect_annotation_metadata_in_union() -> None: + converted = convert_and_respect_annotation_metadata(object_=UNION_TEST, annotation=ShapeParams) + + assert converted == UNION_TEST_CONVERTED + + +def test_convert_and_respect_annotation_metadata_with_empty_object() -> None: + data: Any = {} + converted = convert_and_respect_annotation_metadata(object_=data, annotation=ShapeParams) + assert converted == data diff --git a/seed/python-sdk/seed.yml b/seed/python-sdk/seed.yml index a42abdf7b76..18c7eac3c43 100644 --- a/seed/python-sdk/seed.yml +++ b/seed/python-sdk/seed.yml @@ -64,6 +64,11 @@ fixtures: pydantic_config: version: v1 outputFolder: pydantic-v1 + - customConfig: + pydantic_config: + version: v1 + wrapped_aliases: True + outputFolder: pydantic-v1-wrapped - customConfig: pydantic_config: extra_fields: "allow" @@ -168,6 +173,9 @@ scripts: allowedFailures: # This is the only one that should always fail - exhaustive:additional_init_exports + # This should only succeed in Pydantic V1 tests + - exhaustive:pydantic-v1-wrapped + # TODO(FER-1837): Address this list - response-property - websocket