LingrではREST APIの形式が雑なので、扱いやすいようにするためのAPI整形用Proxyを置いたほうが良い。 かつ、Lingrは不安定なことでも有名なので、中間にProxyを置き、Lingrとの直接通信をなくすことでクライアント側の実装が簡易となる。
Lingrは以下のAPIを提供している。
POST /session/create POST /session/verify POST /session/destroy POST /user/get_rooms POST /room/show POST /room/get_archive POST /room/subscribe POST /room/unsubscribe POST /room/say POST /favorite/add POST /favorite/remove GET /event/observe
整形するとこんな感じか?
---
swagger: "2.0"
info:
host: lingr.com
basePath: /api/
schemes:
- http
consumers:
- application/json
produces:
- application/json
paths:
/session:
post:
description: ログインを行い、アクティブなセッションを構築する
parameters:
- name: user_id
description: ユーザID
in: body
required: true
schema:
type: string
- name: password
description: パスワード
in: formData
required: true
schema:
type: string
- name: api_key
description: API Key
in: formData
required: false
schema:
type: string
responses:
200:
- description: session object created by this request.
schema:
type: object
properties:
nickname:
type: string
public_id:
type: string
session:
type: string
status:
type: string
user:
type: object
properties:
name:
type: string
username:
type: string