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