1
0
mirror of https://github.com/enpaul/kodak.git synced 2024-11-23 15:07:13 +00:00

Add initial resource skeleton to match openapi spec

This commit is contained in:
Ethan Paul 2020-09-17 22:22:24 -04:00
parent efd328ad5f
commit feae618ed5
No known key found for this signature in database
GPG Key ID: C5F5542B54A4D9C6
4 changed files with 65 additions and 0 deletions

View 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)

View 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

View 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

View 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