summaryrefslogtreecommitdiff
path: root/src/web/docs/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/web/docs/api')
-rw-r--r--src/web/docs/api/endpoints/style.styl15
-rw-r--r--src/web/docs/api/endpoints/view.pug11
-rw-r--r--src/web/docs/api/entities/view.pug2
-rw-r--r--src/web/docs/api/gulpfile.ts9
-rw-r--r--src/web/docs/api/mixins.pug14
5 files changed, 39 insertions, 12 deletions
diff --git a/src/web/docs/api/endpoints/style.styl b/src/web/docs/api/endpoints/style.styl
index 07fb7ec2a3..2af9fe9a77 100644
--- a/src/web/docs/api/endpoints/style.styl
+++ b/src/web/docs/api/endpoints/style.styl
@@ -1,8 +1,21 @@
@import "../style"
#url
- padding 8px 12px
+ padding 8px 12px 8px 8px
font-family Consolas, 'Courier New', Courier, Monaco, monospace
color #fff
background #222e40
border-radius 4px
+
+ > .method
+ display inline-block
+ margin 0 8px 0 0
+ padding 0 6px
+ color #f4fcff
+ background #17afc7
+ border-radius 4px
+ user-select none
+ pointer-events none
+
+ > .host
+ opacity 0.7
diff --git a/src/web/docs/api/endpoints/view.pug b/src/web/docs/api/endpoints/view.pug
index 9ba1c4e852..90084ab276 100644
--- a/src/web/docs/api/endpoints/view.pug
+++ b/src/web/docs/api/endpoints/view.pug
@@ -7,12 +7,17 @@ block meta
block main
h1= endpoint
- p#url= url
+ p#url
+ span.method POST
+ span.host
+ = url.host
+ | /
+ span.path= url.path
p#desc= desc[lang] || desc['ja']
section
- h2 Params
+ h2= common.i18n[lang]['docs']['api']['endpoints']['params']
+propTable(params)
if paramDefs
@@ -23,5 +28,5 @@ block main
if res
section
- h2 Response
+ h2= common.i18n[lang]['docs']['api']['endpoints']['res']
+propTable(res)
diff --git a/src/web/docs/api/entities/view.pug b/src/web/docs/api/entities/view.pug
index 6fc05bd555..99e786c694 100644
--- a/src/web/docs/api/entities/view.pug
+++ b/src/web/docs/api/entities/view.pug
@@ -10,7 +10,7 @@ block main
p#desc= desc[lang] || desc['ja']
section
- h2 Properties
+ h2= common.i18n[lang]['docs']['api']['entities']['properties']
+propTable(props)
if propDefs
diff --git a/src/web/docs/api/gulpfile.ts b/src/web/docs/api/gulpfile.ts
index 908280453c..2e8409c595 100644
--- a/src/web/docs/api/gulpfile.ts
+++ b/src/web/docs/api/gulpfile.ts
@@ -16,7 +16,7 @@ import generateVars from '../vars';
const commonVars = generateVars();
-const langs = ['ja', 'en'];
+const langs = Object.keys(commonVars.i18n);
const kebab = string => string.replace(/([a-z])([A-Z])/g, '$1-$2').replace(/\s+/g, '-').toLowerCase();
@@ -102,7 +102,10 @@ gulp.task('doc:api:endpoints', () => {
const ep = yaml.safeLoad(fs.readFileSync(file, 'utf-8'));
const vars = {
endpoint: ep.endpoint,
- url: `${config.api_url}/${ep.endpoint}`,
+ url: {
+ host: config.api_url,
+ path: ep.endpoint
+ },
desc: ep.desc,
params: sortParams(ep.params.map(p => parseParam(p))),
paramDefs: extractDefs(ep.params),
@@ -113,6 +116,7 @@ gulp.task('doc:api:endpoints', () => {
pug.renderFile('./src/web/docs/api/endpoints/view.pug', Object.assign({}, vars, {
lang,
title: ep.endpoint,
+ src: `https://github.com/syuilo/misskey/tree/master/src/web/docs/api/endpoints/${ep.endpoint}.yaml`,
kebab,
common: commonVars
}), (renderErr, html) => {
@@ -152,6 +156,7 @@ gulp.task('doc:api:entities', () => {
pug.renderFile('./src/web/docs/api/entities/view.pug', Object.assign({}, vars, {
lang,
title: entity.name,
+ src: `https://github.com/syuilo/misskey/tree/master/src/web/docs/api/entities/${kebab(entity.name)}.yaml`,
kebab,
common: commonVars
}), (renderErr, html) => {
diff --git a/src/web/docs/api/mixins.pug b/src/web/docs/api/mixins.pug
index 5180698574..b563a121db 100644
--- a/src/web/docs/api/mixins.pug
+++ b/src/web/docs/api/mixins.pug
@@ -1,10 +1,10 @@
mixin propTable(props)
table.props
thead: tr
- th Name
- th Type
- th Optional
- th Description
+ th= common.i18n[lang]['docs']['api']['props']['name']
+ th= common.i18n[lang]['docs']['api']['props']['type']
+ th= common.i18n[lang]['docs']['api']['props']['optional']
+ th= common.i18n[lang]['docs']['api']['props']['description']
tbody
each prop in props
tr
@@ -29,5 +29,9 @@ mixin propTable(props)
| )
else if prop.kind == 'date'
| (Date)
- td.optional= prop.optional.toString()
+ td.optional
+ if prop.optional
+ = common.i18n[lang]['docs']['api']['props']['yes']
+ else
+ = common.i18n[lang]['docs']['api']['props']['no']
td.desc!= prop.desc[lang] || prop.desc['ja']