-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
162 additions
and
442 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
from flask import Flask, Blueprint | ||
|
||
from flexmeasures.api.common.utils.deprecation_utils import ( | ||
deprecate_blueprint, | ||
sunset_blueprint, | ||
) | ||
|
||
|
||
# The sunset API blueprints. They are registered with the Flask app (see register_at) | ||
flexmeasures_api_v1 = Blueprint("flexmeasures_api_v1", __name__) | ||
flexmeasures_api_v1_1 = Blueprint("flexmeasures_api_v1_1", __name__) | ||
flexmeasures_api_v1_2 = Blueprint("flexmeasures_api_v1_2", __name__) | ||
flexmeasures_api_v1_3 = Blueprint("flexmeasures_api_v1_3", __name__) | ||
flexmeasures_api_v2_0 = Blueprint("flexmeasures_api_v2_0", __name__) | ||
|
||
SUNSET_INFO = [ | ||
dict( | ||
blueprint=flexmeasures_api_v1, | ||
api_version_sunset="1.0", | ||
sunset_link="https://flexmeasures.readthedocs.io/en/v0.13.0/api/v1.html", | ||
), | ||
dict( | ||
blueprint=flexmeasures_api_v1_1, | ||
api_version_sunset="1.1", | ||
sunset_link="https://flexmeasures.readthedocs.io/en/v0.13.0/api/v1_1.html", | ||
), | ||
dict( | ||
blueprint=flexmeasures_api_v1_2, | ||
api_version_sunset="1.2", | ||
sunset_link="https://flexmeasures.readthedocs.io/en/v0.13.0/api/v1_2.html", | ||
), | ||
dict( | ||
blueprint=flexmeasures_api_v1_3, | ||
api_version_sunset="1.3", | ||
sunset_link="https://flexmeasures.readthedocs.io/en/v0.13.0/api/v1_3.html", | ||
), | ||
dict( | ||
blueprint=flexmeasures_api_v2_0, | ||
api_version_sunset="2.0", | ||
sunset_link="https://flexmeasures.readthedocs.io/en/v0.13.0/api/v2_0.html", | ||
), | ||
] | ||
|
||
for info in SUNSET_INFO: | ||
deprecate_blueprint( | ||
blueprint=info["blueprint"], | ||
deprecation_date="2022-12-14", | ||
deprecation_link="https://flexmeasures.readthedocs.io/en/latest/api/introduction.html#deprecation-and-sunset", | ||
sunset_date="2023-05-01", | ||
sunset_link=info["sunset_link"], | ||
) | ||
sunset_blueprint( | ||
blueprint=info["blueprint"], | ||
api_version_sunset=info["api_version_sunset"], | ||
sunset_link=info["sunset_link"], | ||
rollback_possible=False, | ||
) | ||
|
||
|
||
def register_at(app: Flask): | ||
"""This can be used to register this blueprint together with other api-related things""" | ||
|
||
import flexmeasures.api.sunset.routes # noqa: F401 this is necessary to load the endpoints | ||
|
||
app.register_blueprint(flexmeasures_api_v1, url_prefix="/api/v1") | ||
app.register_blueprint(flexmeasures_api_v1_1, url_prefix="/api/v1_1") | ||
app.register_blueprint(flexmeasures_api_v1_2, url_prefix="/api/v1_2") | ||
app.register_blueprint(flexmeasures_api_v1_3, url_prefix="/api/v1_3") | ||
app.register_blueprint(flexmeasures_api_v2_0, url_prefix="/api/v2_0") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
from flexmeasures.api.sunset import ( | ||
flexmeasures_api_v1, | ||
flexmeasures_api_v1_1, | ||
flexmeasures_api_v1_2, | ||
flexmeasures_api_v1_3, | ||
flexmeasures_api_v2_0, | ||
) | ||
|
||
|
||
@flexmeasures_api_v1.route("/getMeterData", methods=["GET", "POST"]) | ||
@flexmeasures_api_v1.route("/postMeterData", methods=["POST"]) | ||
@flexmeasures_api_v1.route("/getService", methods=["GET"]) | ||
@flexmeasures_api_v1_1.route("/getConnection", methods=["GET"]) | ||
@flexmeasures_api_v1_1.route("/postPriceData", methods=["POST"]) | ||
@flexmeasures_api_v1_1.route("/postWeatherData", methods=["POST"]) | ||
@flexmeasures_api_v1_1.route("/getPrognosis", methods=["GET"]) | ||
@flexmeasures_api_v1_1.route("/postPrognosis", methods=["POST"]) | ||
@flexmeasures_api_v1_1.route("/getMeterData", methods=["GET"]) | ||
@flexmeasures_api_v1_1.route("/postMeterData", methods=["POST"]) | ||
@flexmeasures_api_v1_1.route("/getService", methods=["GET"]) | ||
@flexmeasures_api_v1_2.route("/getDeviceMessage", methods=["GET"]) | ||
@flexmeasures_api_v1_2.route("/postUdiEvent", methods=["POST"]) | ||
@flexmeasures_api_v1_2.route("/getConnection", methods=["GET"]) | ||
@flexmeasures_api_v1_2.route("/postPriceData", methods=["POST"]) | ||
@flexmeasures_api_v1_2.route("/postWeatherData", methods=["POST"]) | ||
@flexmeasures_api_v1_2.route("/getPrognosis", methods=["GET"]) | ||
@flexmeasures_api_v1_2.route("/getMeterData", methods=["GET"]) | ||
@flexmeasures_api_v1_2.route("/postMeterData", methods=["POST"]) | ||
@flexmeasures_api_v1_2.route("/postPrognosis", methods=["POST"]) | ||
@flexmeasures_api_v1_2.route("/getService", methods=["GET"]) | ||
@flexmeasures_api_v1_3.route("/getDeviceMessage", methods=["GET"]) | ||
@flexmeasures_api_v1_3.route("/postUdiEvent", methods=["POST"]) | ||
@flexmeasures_api_v1_3.route("/getConnection", methods=["GET"]) | ||
@flexmeasures_api_v1_3.route("/postPriceData", methods=["POST"]) | ||
@flexmeasures_api_v1_3.route("/postWeatherData", methods=["POST"]) | ||
@flexmeasures_api_v1_3.route("/getPrognosis", methods=["GET"]) | ||
@flexmeasures_api_v1_3.route("/getMeterData", methods=["GET"]) | ||
@flexmeasures_api_v1_3.route("/postMeterData", methods=["POST"]) | ||
@flexmeasures_api_v1_3.route("/postPrognosis", methods=["POST"]) | ||
@flexmeasures_api_v1_3.route("/getService", methods=["GET"]) | ||
@flexmeasures_api_v2_0.route("/assets", methods=["GET"]) | ||
@flexmeasures_api_v2_0.route("/assets", methods=["POST"]) | ||
@flexmeasures_api_v2_0.route("/asset/<id>", methods=["GET"]) | ||
@flexmeasures_api_v2_0.route("/asset/<id>", methods=["PATCH"]) | ||
@flexmeasures_api_v2_0.route("/asset/<id>", methods=["DELETE"]) | ||
@flexmeasures_api_v2_0.route("/users", methods=["GET"]) | ||
@flexmeasures_api_v2_0.route("/user/<id>", methods=["GET"]) | ||
@flexmeasures_api_v2_0.route("/user/<id>", methods=["PATCH"]) | ||
@flexmeasures_api_v2_0.route("/user/<id>/password-reset", methods=["PATCH"]) | ||
@flexmeasures_api_v2_0.route("/getConnection", methods=["GET"]) | ||
@flexmeasures_api_v2_0.route("/postPriceData", methods=["POST"]) | ||
@flexmeasures_api_v2_0.route("/postWeatherData", methods=["POST"]) | ||
@flexmeasures_api_v2_0.route("/getPrognosis", methods=["GET"]) | ||
@flexmeasures_api_v2_0.route("/getMeterData", methods=["GET"]) | ||
@flexmeasures_api_v2_0.route("/postMeterData", methods=["POST"]) | ||
@flexmeasures_api_v2_0.route("/postPrognosis", methods=["POST"]) | ||
@flexmeasures_api_v2_0.route("/getService", methods=["GET"]) | ||
@flexmeasures_api_v2_0.route("/getDeviceMessage", methods=["GET"]) | ||
@flexmeasures_api_v2_0.route("/postUdiEvent", methods=["POST"]) | ||
def implementation_gone(): | ||
pass |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.