MethodConfigFamily#
- pydantic model fitrequest.method_config_family.MethodConfigFamily[source]#
Bases:
BaseModelDefines the configuration for a family of methods. Each method in the family is derived from a base name and specific configuration options, such as verbs, asynchronous behavior, and save functionality. The generated method names follow a consistent naming pattern based on these options:
{verb}_{base_name}{verb}_and_save_{base_name}(if add_save_method is True)async_{verb}_{base_name}(if add_async_method is True)async_{verb}_and_save_{base_name}(if both add_async_method and add_save_method are True)
- Fields:
- field add_async_method: bool = False#
Boolean indicating if an asynchronous is created.
- field add_save_method: bool = False#
Boolean indicating if a ‘save’ method is created.
- field add_verbs: list[RequestVerb] [Optional]#
List of HTTP verbs, one method is created per verb.
- field base_name: str [Required]#
Base name of the methods that will be created.
- field base_url: Annotated[FitVar | dict | str | None, FieldInfo(annotation=NoneType, required=True, validate_default=True), BeforeValidator(func=validate_init_value, json_schema_input_type=PydanticUndefined)] = None#
Base URL for the generated method (overrides default).
- field decorators: list[~types.Annotated[~collections.abc.Callable | str, ~pydantic.functional_validators.BeforeValidator(func=~fitrequest.method_decorator.validate_init_value, json_schema_input_type=PydanticUndefined), ~pydantic.functional_serializers.PlainSerializer(func=~fitrequest.method_decorator.<lambda>, return_type=str, when_used=always)]] [Optional]#
Decorators applied to the generated method.
- field docstring: str = ''#
Jinja template for the generated method (overrides default). The default variable declaration
{{my_var}}is replaced by{my_var}. See: https://jinja.palletsprojects.com/en/stable/
- field docstring_vars: dict[Any, Any] [Optional]#
Values of the docstring variables.
- field endpoint: str [Required]#
Endpoint of the request.
- field json_path: str | None = None#
JSON path string used to extract data from the received JSON response. See: https://pypi.org/project/jsonpath-ng/
- field name_templates: FamilyTemplates [Optional]#
These name templates are used to generate family names. Be cautious when overriding these default values with custom templates, as doing so - especially if the custom templates do not utilize all the requested variables for naming - could lead to unexpected errors.
Override these templates with care.
- field params_model: <lambda>, return_type=str, when_used=always)] = None#
Use a Pydantic model or list of fields to define allowed parameters for the request URL. If a Pydantic model is used, parameters will be type-checked and validated. The URL’s parameters appear as arguments in the generated method. Note that custom params can still be provided, but those passed directly to the method have higher priority.
- field raise_for_status: bool = True#
Whether to raise an exception for response status codes between 400 and 599.
- field response_model: <lambda>, return_type=str, when_used=always)] = None#
Pydantic model used to format the request’s response.