mirror of
https://github.com/enpaul/kodak.git
synced 2024-12-29 03:03:31 +00:00
Add initial resource skeleton to match openapi spec
This commit is contained in:
parent
efd328ad5f
commit
feae618ed5
7
imagemonk/resources/__init__.py
Normal file
7
imagemonk/resources/__init__.py
Normal file
@ -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)
|
26
imagemonk/resources/image.py
Normal file
26
imagemonk/resources/image.py
Normal file
@ -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/<string:image_id>.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
|
15
imagemonk/resources/openapi.py
Normal file
15
imagemonk/resources/openapi.py
Normal file
@ -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
|
17
imagemonk/resources/thumbnail.py
Normal file
17
imagemonk/resources/thumbnail.py
Normal file
@ -0,0 +1,17 @@
|
||||
import flask_restful
|
||||
|
||||
|
||||
class ThumbnailScale(flask_restful.Resource):
|
||||
|
||||
route = "/thumb/<string:image_id>/scale/<integer:scale_width>.jpg"
|
||||
|
||||
def get(self, image_id: str, scale_width: int):
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
class ThumbnailResize(flask_restful.Resource):
|
||||
|
||||
route = "/thumb/<string:image_id>/size/<integer:width>x<integer:height>.jpg"
|
||||
|
||||
def get(self, image_id: str, width: int, height: int):
|
||||
raise NotImplementedError
|
Loading…
Reference in New Issue
Block a user