Skip to content
Snippets Groups Projects

Draft:Generic api v1

5 files
+ 42
2
Compare changes
  • Side-by-side
  • Inline

Files

from flask_restful import Resource
from flask_restful import Resource
 
from flask_restful_swagger import swagger
 
from apispec import APISpec
 
from marshmallow import Schema, fields
 
from apispec.ext.marshmallow import MarshmallowPlugin
 
from flask_apispec.extension import FlaskApiSpec
 
from flask_apispec.views import MethodResource
 
from flask_apispec import marshal_with, doc, use_kwargs
class MiradorResource(Resource):
class MRResponseSchema(Schema):
 
message = fields.Str(default='Success')
 
 
 
class MRRequestSchema(Schema):
 
class Meta:
 
fields = ('name', 'description') # TODO just an example
 
 
 
class MiradorResource(MethodResource,Resource):
 
@doc(description='Mirador resource i e, manifest and collection of IIIF resource', tags=['Mirador resource'])
 
@marshal_with(MRResponseSchema) # marshalling
def get(self, id=None):
def get(self, id=None):
return {'method': 'get', 'id': id}
return {'method': 'get', 'id': id}
 
@doc(description='Create Mirador resource i e, manifest and collection of IIIF resource', tags=['Mirador resource'])
 
@use_kwargs(MRRequestSchema, location=('json'))
def post(self):
def post(self):
return {'method': 'post'}
return {'method': 'post'}
Loading