-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* api document, fixes #14 * add member api * delete cat api * fix typo * add photo api
- Loading branch information
Showing
7 changed files
with
82 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from flask_restplus import Api | ||
from .photo import api as photo | ||
from .member import api as member | ||
|
||
api = Api( | ||
title='Yori API', | ||
version='1.0', | ||
description='API Documentation', | ||
# All API metadatas | ||
) | ||
|
||
api.add_namespace(photo) | ||
api.add_namespace(member) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from flask import jsonify | ||
from flask_restplus import Namespace, Resource, fields | ||
|
||
api = Namespace('member', description='Members related operations') | ||
|
||
member = api.model('member', { | ||
'member_name_en': fields.String(required=True, description='英語'), | ||
'member_name': fields.String(required=True, description='名前'), | ||
'member_name_gana': fields.String(required=True, description='ひらがな'), | ||
'member_gen': fields.Integer(required=True, description='期'), | ||
'member_graduated': fields.Boolean(required=True, description='卒業'), | ||
'group_id': fields.String(required=True, description='group id') | ||
}) | ||
|
||
MEMBERS = [ | ||
{ | ||
'member_name_en': 'imaizumi_yui', | ||
'member_name': '今泉佑唯', | ||
'member_name_gana': 'いまいずみ_ゆい', | ||
'member_gen': 1, | ||
'member_graduated': True, | ||
'group_id': 'keyakizaka' | ||
} | ||
] | ||
|
||
@api.route('/') | ||
class MemberList(Resource): | ||
@api.doc('get_members') | ||
@api.marshal_list_with(member) | ||
def get(self): | ||
return MEMBERS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from flask import jsonify | ||
from flask_restplus import Namespace, Resource, fields | ||
|
||
api = Namespace('photo', description='Photos related operations') | ||
|
||
photo = api.model('photo', { | ||
'photo_group': fields.String(required=True, description='グループ'), | ||
'photo_member': fields.String(required=True, description='名前'), | ||
'photo_costume': fields.String(required=True, description='服'), | ||
'photo_type': fields.String(required=True, description='距離'), | ||
'photo_number': fields.Integer(required=True, description='数'), | ||
'photo_folder': fields.String(required=True, description='フォルダ') | ||
}) | ||
|
||
PHOTOS = [ | ||
{ | ||
"photo_group": "乃木坂46", | ||
"photo_member": "樋口日奈", | ||
"photo_costume": "2019 summer concert 1", | ||
"photo_type": "ヨリ", | ||
"photo_number": 1, | ||
"photo_folder": "all" | ||
} | ||
] | ||
|
||
@api.route('/') | ||
class MemberList(Resource): | ||
@api.doc('get_photos') | ||
@api.marshal_list_with(photo) | ||
def get(self): | ||
return PHOTOS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters