flexmeasures.api.v3_0

Modules

flexmeasures.api.v3_0.accounts

flexmeasures.api.v3_0.assets

flexmeasures.api.v3_0.deprecated

flexmeasures.api.v3_0.health

flexmeasures.api.v3_0.jobs

flexmeasures.api.v3_0.public

flexmeasures.api.v3_0.sensors

flexmeasures.api.v3_0.sources

flexmeasures.api.v3_0.users

FlexMeasures API v3

Functions

flexmeasures.api.v3_0.collapse_schema_to_field(spec: APISpec, schema_cls: Type[Schema], field_name: str) dict[str, Any]

Replace the OpenAPI component named after schema_cls with the OpenAPI schema generated for field_name inside that schema.

flexmeasures.api.v3_0.create_openapi_specs(app: Flask)

Create OpenAPI specs for the API and save them to a JSON file in the static folder. This function should be called when generating docs (and needs extra dependencies).

flexmeasures.api.v3_0.document_rate_limits(spec_dict: dict, trigger_limited_operations: set[tuple])

Document the 429 response on every endpoint the rate limiter guards.

Rate limiting is applied by the limiter rather than by the views themselves (see flexmeasures.api.common.rate_limiting), so no view docstring declares this response. We add it here, so that the published contract keeps matching what the limiter does, without every docstring having to remember to say so.

flexmeasures.api.v3_0.flask_rule_to_openapi_path(rule: str) str

Turn a Flask rule like “/api/v3_0/assets/<id>/data” into its OpenAPI path.

flexmeasures.api.v3_0.register_at(app: Flask)

This can be used to register this blueprint together with other api-related things

flexmeasures.api.v3_0.register_path_id_field(spec: APISpec, param_name: str, field: Field, location: str = 'path', required: bool = True)

Register the field as an OpenAPI parameter

flexmeasures.api.v3_0.register_swagger_ui(app: Flask)

Register the Swagger UI blueprint to view the OpenAPI specs.

flexmeasures.api.v3_0.trigger_limited_operations_of(rule, view) set[tuple]

The (OpenAPI path, method) pairs of this rule, if its view is under the trigger limit.