[WIP][Swagger]Add swagger definition
- /auth/session/userkey - User entity
This commit is contained in:
parent
0321c3239a
commit
b20aeb76da
4 changed files with 116 additions and 1 deletions
|
@ -15,6 +15,7 @@ import AuthSess from '../../../models/auth-session';
|
|||
* parameters:
|
||||
* -
|
||||
* name: app_secret
|
||||
* description: App Secret
|
||||
* in: formData
|
||||
* required: true
|
||||
* type: string
|
||||
|
|
|
@ -8,6 +8,42 @@ import AuthSess from '../../../models/auth-session';
|
|||
import Userkey from '../../../models/userkey';
|
||||
import serialize from '../../../serializers/user';
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /auth/session/userkey:
|
||||
* post:
|
||||
* summary: Get a userkey
|
||||
* parameters:
|
||||
* -
|
||||
* name: app_secret
|
||||
* description: App Secret
|
||||
* in: formData
|
||||
* required: true
|
||||
* type: string
|
||||
* -
|
||||
* name: token
|
||||
* description: API Token
|
||||
* in: formData
|
||||
* required: true
|
||||
* type: string
|
||||
*
|
||||
* responses:
|
||||
* 200:
|
||||
* description: OK
|
||||
* schema:
|
||||
* type: object
|
||||
* properties:
|
||||
* userkey:
|
||||
* type: string
|
||||
* description: User Key
|
||||
* user:
|
||||
* $ref: "#/definitions/User"
|
||||
* 400:
|
||||
* description: Failed
|
||||
* schema:
|
||||
* $ref: "#/definitions/Error"
|
||||
*/
|
||||
|
||||
/**
|
||||
* Generate a session
|
||||
*
|
||||
|
|
|
@ -6,6 +6,82 @@
|
|||
import User from '../models/user';
|
||||
import serialize from '../serializers/user';
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* definitions:
|
||||
* User:
|
||||
* type: object
|
||||
* required:
|
||||
* - created_at
|
||||
* - followers_count
|
||||
* - following_count
|
||||
* - id
|
||||
* - liked_count
|
||||
* - likes_count
|
||||
* - name
|
||||
* - posts_count
|
||||
* - username
|
||||
* properties:
|
||||
* avatar_id:
|
||||
* type: string
|
||||
* description: アバターに設定しているドライブのファイルのID
|
||||
* avatar_url:
|
||||
* type: string
|
||||
* description: アバターURL
|
||||
* banner_id:
|
||||
* type: string
|
||||
* description: バナーに設定しているドライブのファイルのID
|
||||
* banner_url:
|
||||
* type: string
|
||||
* description: バナーURL
|
||||
* bio:
|
||||
* type: string
|
||||
* description: プロフィール
|
||||
* birthday:
|
||||
* type: string
|
||||
* description: 誕生日
|
||||
* created_at:
|
||||
* type: string
|
||||
* format: date
|
||||
* description: アカウント作成日時
|
||||
* drive_capacity:
|
||||
* type: integer
|
||||
* description: ドライブの最大容量
|
||||
* followers_count:
|
||||
* type: integer
|
||||
* description: フォロワー数
|
||||
* following_count:
|
||||
* type: integer
|
||||
* description: フォロー数
|
||||
* id:
|
||||
* type: string
|
||||
* description: ユーザーID
|
||||
* is_followed:
|
||||
* type: boolean
|
||||
* description: フォローされているか
|
||||
* is_following:
|
||||
* type: boolean
|
||||
* description: フォローしているか
|
||||
* liked_count:
|
||||
* type: integer
|
||||
* description: 投稿にいいねされた数
|
||||
* likes_count:
|
||||
* type: integer
|
||||
* description: 投稿にいいねした数
|
||||
* location:
|
||||
* type: string
|
||||
* description: 場所
|
||||
* name:
|
||||
* type: string
|
||||
* description: ニックネーム
|
||||
* posts_count:
|
||||
* type: integer
|
||||
* description: 投稿数
|
||||
* username:
|
||||
* type: string
|
||||
* description: ユーザー名
|
||||
*/
|
||||
|
||||
/**
|
||||
* Lists all users
|
||||
*
|
||||
|
|
|
@ -6,7 +6,9 @@ const yaml = require('js-yaml');
|
|||
|
||||
const apiRoot = './src/api/endpoints';
|
||||
const files = [
|
||||
'auth/session/generate.js'
|
||||
'users.js',
|
||||
'auth/session/generate.js',
|
||||
'auth/session/userkey.js',
|
||||
];
|
||||
|
||||
const errorDefinition = {
|
||||
|
|
Loading…
Reference in a new issue