diff --git a/imagemonk/resources/__init__.py b/imagemonk/resources/__init__.py new file mode 100644 index 0000000..5a66702 --- /dev/null +++ b/imagemonk/resources/__init__.py @@ -0,0 +1,7 @@ +from imagemonk.resources.image import Image +from imagemonk.resources.image import ImageUpload +from imagemonk.resources.thumbnail import ThumbnailResize +from imagemonk.resources.thumbnail import ThumbnailScale + + +RESOURCES = (ImageUpload, Image, ThumbnailScale, ThumbnailResize) diff --git a/imagemonk/resources/image.py b/imagemonk/resources/image.py new file mode 100644 index 0000000..a27844f --- /dev/null +++ b/imagemonk/resources/image.py @@ -0,0 +1,26 @@ +import flask_restful + + +class ImageUpload(flask_restful.Resource): + + route = "/image/" + + def put(self): + raise NotImplementedError + + def options(self): + raise NotImplementedError + + +class Image(flask_restful.Resource): + + route = "/image/.jpg" + + def get(self, image_id: str): + raise NotImplementedError + + def delete(self, image_id: str): + raise NotImplementedError + + def options(self, image_id: str): + raise NotImplementedError diff --git a/imagemonk/resources/openapi.py b/imagemonk/resources/openapi.py new file mode 100644 index 0000000..b5bd942 --- /dev/null +++ b/imagemonk/resources/openapi.py @@ -0,0 +1,15 @@ +from pathlib import Path + +import flask_restful +from ruamel.yaml import YAML + +yaml = YAML(typ="safe") + + +class OpenAPI(flask_restful.Resource): + def get(self): + + with (Path(__file__).parent, "openapi.yaml").open() as infile: + data = yaml.load(infile) + + return data, 200 diff --git a/imagemonk/resources/thumbnail.py b/imagemonk/resources/thumbnail.py new file mode 100644 index 0000000..2b5eca9 --- /dev/null +++ b/imagemonk/resources/thumbnail.py @@ -0,0 +1,17 @@ +import flask_restful + + +class ThumbnailScale(flask_restful.Resource): + + route = "/thumb//scale/.jpg" + + def get(self, image_id: str, scale_width: int): + raise NotImplementedError + + +class ThumbnailResize(flask_restful.Resource): + + route = "/thumb//size/x.jpg" + + def get(self, image_id: str, width: int, height: int): + raise NotImplementedError