Improve docs
This commit is contained in:
parent
1e921a9fd5
commit
168d13d6e6
|
@ -1098,7 +1098,9 @@ docs:
|
|||
properties: "プロパティ"
|
||||
endpoints:
|
||||
params: "パラメータ"
|
||||
no-params: "パラメータはありません"
|
||||
res: "レスポンス"
|
||||
require-credential: "このエンドポイントは認証情報が必須です。"
|
||||
props:
|
||||
name: "名前"
|
||||
type: "型"
|
||||
|
|
|
@ -5,7 +5,7 @@ block meta
|
|||
link(rel="stylesheet" href="/docs/assets/api/endpoints/style.css")
|
||||
|
||||
block main
|
||||
h1= endpoint
|
||||
h1= title
|
||||
|
||||
p#url
|
||||
span.method POST
|
||||
|
@ -14,10 +14,13 @@ block main
|
|||
| /
|
||||
span.path= url.path
|
||||
|
||||
if desc
|
||||
p#desc= desc[lang] || desc['ja']
|
||||
if endpoint.desc
|
||||
p#desc= endpoint.desc[lang] || endpoint.desc['ja']
|
||||
|
||||
if params
|
||||
if endpoint.requireCredential
|
||||
div.ui.info: p= i18n('docs.api.endpoints.require-credential')
|
||||
|
||||
if params && Object.keys(params).length > 0
|
||||
section
|
||||
h2= i18n('docs.api.endpoints.params')
|
||||
+propTable(params)
|
||||
|
@ -27,6 +30,10 @@ block main
|
|||
section(id= paramDef.name)
|
||||
h3= paramDef.name
|
||||
+propTable(paramDef.params)
|
||||
if params && Object.keys(params).length == 0
|
||||
section
|
||||
h2= i18n('docs.api.endpoints.params')
|
||||
p= i18n('docs.api.endpoints.no-params')
|
||||
|
||||
if res
|
||||
section
|
||||
|
|
|
@ -7,7 +7,7 @@ body
|
|||
word-break break-word
|
||||
|
||||
main
|
||||
margin 0 0 0 300px
|
||||
margin 0 0 0 330px
|
||||
padding 64px
|
||||
width 100%
|
||||
max-width 800px
|
||||
|
@ -53,7 +53,7 @@ nav
|
|||
z-index 10000
|
||||
top 0
|
||||
left 0
|
||||
width 300px
|
||||
width 330px
|
||||
height 100%
|
||||
overflow auto
|
||||
padding 32px
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
import User, { pack, ILocalUser } from '../../../models/user';
|
||||
import { IApp } from '../../../models/app';
|
||||
|
||||
/**
|
||||
* Show myself
|
||||
*/
|
||||
export const meta = {
|
||||
desc: {
|
||||
ja: '自分のアカウント情報を取得します。'
|
||||
},
|
||||
|
||||
requireCredential: true,
|
||||
|
||||
params: {}
|
||||
};
|
||||
|
||||
export default (params: any, user: ILocalUser, app: IApp) => new Promise(async (res, rej) => {
|
||||
const isSecure = user != null && app == null;
|
||||
|
||||
|
|
|
@ -173,12 +173,11 @@ router.get('/*/api/endpoints/*', async ctx => {
|
|||
|
||||
const vars = {
|
||||
title: name,
|
||||
endpoint: name,
|
||||
endpoint: ep.meta,
|
||||
url: {
|
||||
host: config.api_url,
|
||||
path: name
|
||||
},
|
||||
desc: ep.meta.desc,
|
||||
// @ts-ignore
|
||||
params: ep.meta.params ? sortParams(Object.entries(ep.meta.params).map(([k, v]) => parseParamDefinition(k, v))) : null,
|
||||
paramDefs: ep.meta.params ? extractParamDefRef(Object.entries(ep.meta.params).map(([k, v]) => v)) : null,
|
||||
|
|
Loading…
Reference in New Issue