Merge pull request #33 from Tosuke/swagger

Swagger
This commit is contained in:
syuilo⭐️
2017-01-12 06:11:15 +09:00
committed by GitHub
10 changed files with 500 additions and 0 deletions

View File

@ -7,6 +7,59 @@ import rndstr from 'rndstr';
import App from '../../models/app';
import serialize from '../../serializers/app';
/**
* @swagger
* /app/create:
* post:
* summary: Create an application
* parameters:
* - $ref: "#/parameters/AccessToken"
* -
* name: name_id
* description: Application unique name
* in: formData
* required: true
* type: string
* -
* name: name
* description: Application name
* in: formData
* required: true
* type: string
* -
* name: description
* description: Application description
* in: formData
* required: true
* type: string
* -
* name: permission
* description: Permissions that application has
* in: formData
* required: true
* type: array
* items:
* type: string
* collectionFormat: csv
* -
* name: callback_url
* description: URL called back after authentication
* in: formData
* required: false
* type: string
*
* responses:
* 200:
* description: Created application's information
* schema:
* $ref: "#/definitions/Application"
*
* default:
* description: Failed
* schema:
* $ref: "#/definitions/Error"
*/
/**
* Create an app
*

View File

@ -5,6 +5,35 @@
*/
import App from '../../../models/app';
/**
* @swagger
* /app/name_id/available:
* post:
* summary: Check available name_id on creation an application
* parameters:
* -
* name: name_id
* description: Application unique name
* in: formData
* required: true
* type: string
*
* responses:
* 200:
* description: Success
* schema:
* type: object
* properties:
* available:
* description: Whether name_id is available
* type: boolean
*
* default:
* description: Failed
* schema:
* $ref: "#/definitions/Error"
*/
/**
* Check available name_id of app
*

View File

@ -7,6 +7,36 @@ import * as mongo from 'mongodb';
import App from '../../models/app';
import serialize from '../../serializers/app';
/**
* @swagger
* /app/show:
* post:
* summary: Show an application's information
* description: Require app_id or name_id
* parameters:
* -
* name: app_id
* description: Application ID
* in: formData
* type: string
* -
* name: name_id
* description: Application unique name
* in: formData
* type: string
*
* responses:
* 200:
* description: Success
* schema:
* $ref: "#/definitions/Application"
*
* default:
* description: Failed
* schema:
* $ref: "#/definitions/Error"
*/
/**
* Show an app
*

View File

@ -9,6 +9,29 @@ import App from '../../models/app';
import AuthSess from '../../models/auth-session';
import AccessToken from '../../models/access-token';
/**
* @swagger
* /auth/accept:
* post:
* summary: Accept a session
* parameters:
* - $ref: "#/parameters/NativeToken"
* -
* name: token
* description: Session Token
* in: formData
* required: true
* type: string
* responses:
* 204:
* description: OK
*
* default:
* description: Failed
* schema:
* $ref: "#/definitions/Error"
*/
/**
* Accept
*

View File

@ -7,6 +7,37 @@ import * as uuid from 'uuid';
import App from '../../../models/app';
import AuthSess from '../../../models/auth-session';
/**
* @swagger
* /auth/session/generate:
* post:
* summary: Generate a session
* parameters:
* -
* name: app_secret
* description: App Secret
* in: formData
* required: true
* type: string
*
* responses:
* 200:
* description: OK
* schema:
* type: object
* properties:
* token:
* type: string
* description: Session Token
* url:
* type: string
* description: Authentication form's URL
* default:
* description: Failed
* schema:
* $ref: "#/definitions/Error"
*/
/**
* Generate a session
*

View File

@ -6,6 +6,46 @@
import AuthSess from '../../../models/auth-session';
import serialize from '../../../serializers/auth-session';
/**
* @swagger
* /auth/session/show:
* post:
* summary: Show a session information
* parameters:
* -
* name: token
* description: Session Token
* in: formData
* required: true
* type: string
*
* responses:
* 200:
* description: OK
* schema:
* type: object
* properties:
* created_at:
* type: string
* format: date-time
* description: Date and time of the session creation
* app_id:
* type: string
* description: Application ID
* token:
* type: string
* description: Session Token
* user_id:
* type: string
* description: ID of user who create the session
* app:
* $ref: "#/definitions/Application"
* default:
* description: Failed
* schema:
* $ref: "#/definitions/Error"
*/
/**
* Show a session
*

View File

@ -8,6 +8,42 @@ import AuthSess from '../../../models/auth-session';
import AccessToken from '../../../models/access-token';
import serialize from '../../../serializers/user';
/**
* @swagger
* /auth/session/userkey:
* post:
* summary: Get a access token(userkey)
* parameters:
* -
* name: app_secret
* description: App Secret
* in: formData
* required: true
* type: string
* -
* name: token
* description: Session Token
* in: formData
* required: true
* type: string
*
* responses:
* 200:
* description: OK
* schema:
* type: object
* properties:
* userkey:
* type: string
* description: Access Token
* user:
* $ref: "#/definitions/User"
* default:
* description: Failed
* schema:
* $ref: "#/definitions/Error"
*/
/**
* Generate a session
*

View File

@ -6,6 +6,33 @@
import prominence from 'prominence';
import git from 'git-last-commit';
/**
* @swagger
* /meta:
* post:
* summary: Show the misskey's information
* responses:
* 200:
* description: Success
* schema:
* type: object
* properties:
* maintainer:
* description: maintainer's name
* type: string
* commit:
* description: latest commit's hash
* type: string
* secure:
* description: whether the server supports secure protcols
* type: boolean
*
* default:
* description: Failed
* schema:
* $ref: "#/definitions/Error"
*/
/**
* Show core info
*