from flask_restplus import fields
from rest_api_demo.api.restplus import api

blog_post = api.model(
    'Blog post', {
        'id':
        fields.Integer(readOnly=True,
                       description='The unique identifier of a blog post'),
        'title':
        fields.String(required=True, description='Article title'),
        'body':
        fields.String(required=True, description='Article content'),
        'pub_date':
        fields.DateTime,
        'category_id':
        fields.Integer(attribute='category.id'),
        'category':
        fields.String(attribute='category.id'),
    })

pagination = api.model(
    'A page of results', {
        'page':
        fields.Integer(description='Number of this page of results'),
        'pages':
        fields.Integer(description='Total number of pages of results'),
        'per_page':
        fields.Integer(description='Number of items per page of results'),
        'total':
        fields.Integer(description='Total number of results'),
    })
Exemple #2
0
from flask_restplus import fields
from rest_api_demo.api.restplus import api

blog_post = api.model(
    'Blog post', {
        'id':
        fields.Integer(readOnly=True,
                       description='The unique identifier of a blog post'),
        'title':
        fields.String(required=True, description='Article title'),
        'body':
        fields.String(required=True, description='Article content'),
        'pub_date':
        fields.DateTime,
        'category_id':
        fields.Integer(attribute='category.id'),
        'category':
        fields.String(attribute='category.name'),
    })

pagination = api.model(
    'A page of results', {
        'page':
        fields.Integer(description='Number of this page of results'),
        'pages':
        fields.Integer(description='Total number of pages of results'),
        'per_page':
        fields.Integer(description='Number of items per page of results'),
        'total':
        fields.Integer(description='Total number of results'),
    })
Exemple #3
0
from flask_restplus import fields
from rest_api_demo.api.restplus import api

pet = api.model('petstore pet', {
    'pet_name': fields.String(attribute='pet.pet_name'),
})
bid = api.inherit(
    'petstore bid', pet, {
        'bid_amount': fields.Integer(required=True, description='bid amount'),
        'user_name': fields.String(attribute='user.name'),
    })

create_bid_with_user = api.model(
    'petstore bid', {
        'bid_amount': fields.Integer(required=True, description='bid amount'),
        'user_id': fields.Integer(required=True, description='user id'),
        'pet_name': fields.String(required=True, description='pet name'),
    })

user_with_bids = api.inherit('bids category with user', pet, bid, {})
Exemple #4
0
from flask_restplus import fields
from rest_api_demo.api.restplus import api

auction_bid = api.model(
    'Auction bid', {
        'id':
        fields.Integer(readOnly=True,
                       description='The unique identifier of an auction bid'),
        'title':
        fields.String(required=True, description='Article title'),
        'body':
        fields.String(required=True, description='Article content'),
        'pub_date':
        fields.DateTime,
        'vehicle_id':
        fields.Integer(attribute='vehicle.id'),
        'vehicle':
        fields.String(attribute='vehicle.id'),
    })

pagination = api.model(
    'A page of results', {
        'page':
        fields.Integer(description='Number of this page of results'),
        'pages':
        fields.Integer(description='Total number of pages of results'),
        'per_page':
        fields.Integer(description='Number of items per page of results'),
        'total':
        fields.Integer(description='Total number of results'),
    })
Exemple #5
0
from flask_restplus import fields
from rest_api_demo.api.restplus import api

blog_user = api.model(
    'Blog user', {
        'username': fields.String(required=True, description='User username'),
        'email': fields.String(required=True,
                               description='User email address'),
    })
Exemple #6
0
from flask_restplus import fields
from rest_api_demo.api.restplus import api

client_user = api.model(
    'Client user', {
        'id':
        fields.Integer(readOnly=True,
                       description='The unique identifier of a client user'),
        'name':
        fields.String(required=True, description='Client name'),
    })

pagination = api.model(
    'A page of results', {
        'page':
        fields.Integer(description='Number of this page of results'),
        'pages':
        fields.Integer(description='Total number of pages of results'),
        'per_page':
        fields.Integer(description='Number of items per page of results'),
        'total':
        fields.Integer(description='Total number of results'),
    })

page_of_client_users = api.inherit(
    'Page of client users', pagination,
    {'items': fields.List(fields.Nested(client_user))})
import logging

from flask import request
from flask_restplus import Resource, fields
# from rest_api_demo.api.blog.business import create_category, delete_category, update_category
# from rest_api_demo.api.neural_nets_ocr.serializers import category, category_with_posts
from rest_api_demo.api.restplus import api
# from rest_api_demo.database.models import Category

log = logging.getLogger(__name__)

ns = api.namespace('omr/scanning',
                   description='Operations related to blog categories')

resource_fields = api.model('Resource', {
    'url': fields.String,
})


@ns.route('/')
class CategoryCollection(Resource):
    def get(self):
        return "Hello"

    @api.response(201, 'Excel successfully created.')
    @api.expect(resource_fields)
    def post(self):
        """
        Generate excel file for student.
        """
        data = request.json['url']
Exemple #8
0
from flask_restplus import fields
from rest_api_demo.api.restplus import api

authz_feature_request = api.model(
    'Feature', {
        'id':
        fields.Integer(readOnly=True,
                       description='The unique identifier of a feature.'),
        'feature_name':
        fields.String(required=True, description='Name of the feature'),
    })

authz_account_request = api.model(
    'Feature', {
        'id':
        fields.Integer(readOnly=True,
                       description='The unique identifier of a feature.'),
        'feature_name':
        fields.String(required=True, description='Name of the feature'),
    })

authz_role = api.model(
    'Authenticated Role', {
        'id':
        fields.Integer(required=True, description='The id of the user'),
        'role_name':
        fields.String(required=True, description='The name of the role')
    })

blog_post = api.model(
    'Blog post', {
Exemple #9
0
from flask_restplus import fields
from rest_api_demo.api.restplus import api

authn_role = api.model(
    'AuthnRole', {
        'id':
        fields.Integer(required=True, description='The id of the user'),
        'role_name':
        fields.String(required=True, description='The name of the role')
    })

authn_account_request = api.model(
    'Account', {
        'id':
        fields.Integer(readonly=True,
                       description='The unique identifier of an account'),
        'account_name':
        fields.String(required=True, description='Account title'),
    })

authn_orgunit_request = api.model(
    'Organizational Unit', {
        'id':
        fields.Integer(readonly=True,
                       description='The unique identifier of an orgunit'),
        'account_id':
        fields.Integer(required=True,
                       description='Account associated with org unit'),
        'orgunit_name':
        fields.String(required=True, description='Organizational Unit title'),
    })