diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2018-08-01 08:34:22 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-01 08:34:22 +0900 |
| commit | 77faf7a84cc28d9a24803940730e59706edd4ec8 (patch) | |
| tree | a3a366deedc99a98bcfe7358eb48aff0ff5fe71c /src/docs/api | |
| parent | New translations ja.yml (English) (diff) | |
| parent | Merge pull request #2033 from syuilo/greenkeeper/qrcode-1.2.2 (diff) | |
| download | misskey-77faf7a84cc28d9a24803940730e59706edd4ec8.tar.gz misskey-77faf7a84cc28d9a24803940730e59706edd4ec8.tar.bz2 misskey-77faf7a84cc28d9a24803940730e59706edd4ec8.zip | |
Merge branch 'master' into l10n_master
Diffstat (limited to 'src/docs/api')
| -rw-r--r-- | src/docs/api/endpoints/style.styl | 23 | ||||
| -rw-r--r-- | src/docs/api/endpoints/view.pug | 76 | ||||
| -rw-r--r-- | src/docs/api/entities/drive-file.yaml | 90 | ||||
| -rw-r--r-- | src/docs/api/entities/note.yaml | 190 | ||||
| -rw-r--r-- | src/docs/api/entities/style.styl | 1 | ||||
| -rw-r--r-- | src/docs/api/entities/user.yaml | 174 | ||||
| -rw-r--r-- | src/docs/api/entities/view.pug | 20 | ||||
| -rw-r--r-- | src/docs/api/mixins.pug | 34 | ||||
| -rw-r--r-- | src/docs/api/style.styl | 11 |
9 files changed, 619 insertions, 0 deletions
diff --git a/src/docs/api/endpoints/style.styl b/src/docs/api/endpoints/style.styl new file mode 100644 index 0000000000..e7e32b3395 --- /dev/null +++ b/src/docs/api/endpoints/style.styl @@ -0,0 +1,23 @@ +@import "../style" + +#url + padding 8px 12px 8px 8px + font-family Consolas, 'Courier New', Courier, Monaco, monospace + color #fff + background #222e40 + border-radius 4px + overflow auto + white-space nowrap + + > .method + display inline-block + margin 0 8px 0 0 + padding 0 6px + color #fff + background #17afc7 + border-radius 4px + user-select none + pointer-events none + + > .host + opacity 0.7 diff --git a/src/docs/api/endpoints/view.pug b/src/docs/api/endpoints/view.pug new file mode 100644 index 0000000000..76e1183302 --- /dev/null +++ b/src/docs/api/endpoints/view.pug @@ -0,0 +1,76 @@ +extends ../../base +include ../mixins + +block meta + link(rel="stylesheet" href="/docs/assets/api/endpoints/style.css") + +block main + h1= title + + p#url + span.method POST + span.host + = endpointUrl.host + | / + span.path= endpointUrl.path + + if endpoint.desc + p#desc= endpoint.desc[lang] || endpoint.desc['ja'] + + if endpoint.requireCredential + div.ui.info: p + i.fas.fa-id-card-alt(style="margin-right: 4px") + = i18n('docs.api.endpoints.require-credential') + + if endpoint.kind + div.ui.info: p + i.fas.fa-unlock-alt(style="margin-right: 4px") + != i18n('docs.api.endpoints.require-permission').replace('{permission}', `<code>${endpoint.kind}</code>`) + + if endpoint.limit + div.ui.info.warn: p + i.far.fa-clock(style="margin-right: 4px") + b!= i18n('docs.api.endpoints.has-limit') + if endpoint.limit.duration + != i18n('docs.api.endpoints.duration-limit').replace('{duration}', endpoint.limit.duration).replace('{max}', endpoint.limit.max) + if endpoint.limit.minInterval + != i18n('docs.api.endpoints.min-interval-limit').replace('{interval}', endpoint.limit.minInterval) + + if params && Object.keys(params).length > 0 + section + h2= i18n('docs.api.endpoints.params') + +propTable(params) + + if paramDefs + each paramDef in paramDefs + 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 + h2= i18n('docs.api.endpoints.res') + + if resProps + +propTable(resProps) + + if resDefs + each resDef in resDefs + section(id= resDef.name) + h3= resDef.name + +propTable(resDef.props) + else + if res.type.startsWith('entity') + a(href=`/docs/${lang}/api/entities/${kebab(res.entity)}`)= res.entity + +block footer + div.ui.info: p + i.fas.fa-info-circle(style="margin-right: 4px") + = i18n('docs.api.endpoints.generated') + p + = i18n('docs.api.endpoints.show-src') + a(href=src target="_blank")= i18n('docs.api.endpoints.show-src-link') diff --git a/src/docs/api/entities/drive-file.yaml b/src/docs/api/entities/drive-file.yaml new file mode 100644 index 0000000000..2d14c6e1f5 --- /dev/null +++ b/src/docs/api/entities/drive-file.yaml @@ -0,0 +1,90 @@ +name: "DriveFile" + +desc: + ja: "ドライブのファイル。" + en: "A file of Drive." + +props: + id: + type: "id" + optional: false + desc: + ja: "ファイルID" + en: "The ID of this file" + + createdAt: + type: "date" + optional: false + desc: + ja: "アップロード日時" + en: "The upload date of this file" + + userId: + type: "id(User)" + optional: false + desc: + ja: "所有者ID" + en: "The ID of the owner of this file" + + user: + type: "entity(User)" + optional: true + desc: + ja: "所有者" + en: "The owner of this file" + + name: + type: "string" + optional: false + desc: + ja: "ファイル名" + en: "The name of this file" + + md5: + type: "string" + optional: false + desc: + ja: "ファイルのMD5ハッシュ値" + en: "The md5 hash value of this file" + + type: + type: "string" + optional: false + desc: + ja: "ファイルの種類" + en: "The type of this file" + + datasize: + type: "number" + optional: false + desc: + ja: "ファイルサイズ(bytes)" + en: "The size of this file (bytes)" + + url: + type: "string" + optional: false + desc: + ja: "ファイルのURL" + en: "The URL of this file" + + folderId: + type: "id(DriveFolder)" + optional: true + desc: + ja: "フォルダID" + en: "The ID of the folder of this file" + + folder: + type: "entity(DriveFolder)" + optional: true + desc: + ja: "フォルダ" + en: "The folder of this file" + + sensitive: + type: "boolean" + optional: true + desc: + ja: "このメディアが「閲覧注意」(NSFW)かどうか" + en: "Whether this media is NSFW" diff --git a/src/docs/api/entities/note.yaml b/src/docs/api/entities/note.yaml new file mode 100644 index 0000000000..04cb3c9824 --- /dev/null +++ b/src/docs/api/entities/note.yaml @@ -0,0 +1,190 @@ +name: "Note" + +desc: + ja: "投稿。" + en: "A note." + +props: + id: + type: "id" + optional: false + desc: + ja: "投稿ID" + en: "The ID of this note" + + createdAt: + type: "date" + optional: false + desc: + ja: "投稿日時" + en: "The posted date of this note" + + viaMobile: + type: "boolean" + optional: true + desc: + ja: "モバイル端末から投稿したか否か(自己申告であることに留意)" + en: "Whether this note sent via a mobile device" + + text: + type: "string" + optional: true + desc: + ja: "投稿の本文" + en: "The text of this note" + + mediaIds: + type: "id(DriveFile)[]" + optional: true + desc: + ja: "添付されているメディアのID (なければレスポンスでは空配列)" + en: "The IDs of the attached media (empty array for response if no media is attached)" + + media: + type: "entity(DriveFile)[]" + optional: true + desc: + ja: "添付されているメディア" + en: "The attached media" + + userId: + type: "id(User)" + optional: false + desc: + ja: "投稿者ID" + en: "The ID of author of this note" + + user: + type: "entity(User)" + optional: true + desc: + ja: "投稿者" + en: "The author of this note" + + myReaction: + type: "string" + optional: true + desc: + ja: "この投稿に対する自分の<a href='/docs/api/reactions'>リアクション</a>" + en: "The your <a href='/docs/api/reactions'>reaction</a> of this note" + + reactionCounts: + type: "object" + optional: false + desc: + ja: "<a href='/docs/api/reactions'>リアクション</a>をキーとし、この投稿に対するそのリアクションの数を値としたオブジェクト" + + replyId: + type: "id(Note)" + optional: true + desc: + ja: "返信した投稿のID" + en: "The ID of the replyed note" + + reply: + type: "entity(Note)" + optional: true + desc: + ja: "返信した投稿" + en: "The replyed note" + + renoteId: + type: "id(Note)" + optional: true + desc: + ja: "引用した投稿のID" + en: "The ID of the quoted note" + + renote: + type: "entity(Note)" + optional: true + desc: + ja: "引用した投稿" + en: "The quoted note" + + poll: + type: "object" + optional: true + desc: + ja: "投票" + en: "The poll" + + props: + choices: + type: "object[]" + optional: false + desc: + ja: "投票の選択肢" + en: "The choices of this poll" + + props: + id: + type: "number" + optional: false + desc: + ja: "選択肢ID" + en: "The ID of this choice" + + isVoted: + type: "boolean" + optional: true + desc: + ja: "自分がこの選択肢に投票したかどうか" + en: "Whether you voted to this choice" + + text: + type: "string" + optional: false + desc: + ja: "選択肢本文" + en: "The text of this choice" + + votes: + type: "number" + optional: false + desc: + ja: "この選択肢に投票された数" + en: "The number voted for this choice" + geo: + type: "object" + optional: true + desc: + ja: "位置情報" + en: "Geo location" + + props: + coordinates: + type: "number[]" + optional: false + desc: + ja: "座標。最初に経度:-180〜180で表す。最後に緯度:-90〜90で表す。" + + altitude: + type: "number" + optional: false + desc: + ja: "高度。メートル単位で表す。" + + accuracy: + type: "number" + optional: false + desc: + ja: "緯度、経度の精度。メートル単位で表す。" + + altitudeAccuracy: + type: "number" + optional: false + desc: + ja: "高度の精度。メートル単位で表す。" + + heading: + type: "number" + optional: false + desc: + ja: "方角。0〜360の角度で表す。0が北、90が東、180が南、270が西。" + + speed: + type: "number" + optional: false + desc: + ja: "速度。メートル / 秒数で表す。" diff --git a/src/docs/api/entities/style.styl b/src/docs/api/entities/style.styl new file mode 100644 index 0000000000..bddf0f53ab --- /dev/null +++ b/src/docs/api/entities/style.styl @@ -0,0 +1 @@ +@import "../style" diff --git a/src/docs/api/entities/user.yaml b/src/docs/api/entities/user.yaml new file mode 100644 index 0000000000..c245974568 --- /dev/null +++ b/src/docs/api/entities/user.yaml @@ -0,0 +1,174 @@ +name: "User" + +desc: + ja: "ユーザー。" + en: "A user." + +props: + id: + type: "id" + optional: false + desc: + ja: "ユーザーID" + en: "The ID of this user" + + createdAt: + type: "date" + optional: false + desc: + ja: "アカウント作成日時" + en: "The registered date of this user" + + username: + type: "string" + optional: false + desc: + ja: "ユーザー名" + en: "The username of this user" + + description: + type: "string" + optional: false + desc: + ja: "アカウントの説明(自己紹介)" + en: "The description of this user" + + avatarId: + type: "id(DriveFile)" + optional: true + desc: + ja: "アバターのID" + en: "The ID of the avatar of this user" + + avatarUrl: + type: "string" + optional: false + desc: + ja: "アバターのURL" + en: "The URL of the avatar of this user" + + bannerId: + type: "id(DriveFile)" + optional: true + desc: + ja: "バナーのID" + en: "The ID of the banner of this user" + + bannerUrl: + type: "string" + optional: false + desc: + ja: "バナーのURL" + en: "The URL of the banner of this user" + + followersCount: + type: "number" + optional: false + desc: + ja: "フォロワーの数" + en: "The number of the followers for this user" + + followingCount: + type: "number" + optional: false + desc: + ja: "フォローしているユーザーの数" + en: "The number of the following users for this user" + + isFollowing: + type: "boolean" + optional: true + desc: + ja: "自分がこのユーザーをフォローしているか" + + isFollowed: + type: "boolean" + optional: true + desc: + ja: "自分がこのユーザーにフォローされているか" + + isMuted: + type: "boolean" + optional: true + desc: + ja: "自分がこのユーザーをミュートしているか" + en: "Whether you muted this user" + + notesCount: + type: "number" + optional: false + desc: + ja: "投稿の数" + en: "The number of the notes of this user" + + pinnedNote: + type: "entity(Note)" + optional: true + desc: + ja: "ピン留めされた投稿" + en: "The pinned note of this user" + + pinnedNoteId: + type: "id(Note)" + optional: true + desc: + ja: "ピン留めされた投稿のID" + en: "The ID of the pinned note of this user" + + host: + type: "string | null" + optional: false + desc: + ja: "ホスト (例: example.com:3000)" + en: "Host (e.g. example.com:3000)" + + twitter: + type: "object" + optional: true + desc: + ja: "連携されているTwitterアカウント情報" + en: "The info of the connected twitter account of this user" + + props: + userId: + type: "string" + optional: false + desc: + ja: "ユーザーID" + en: "The user ID" + + screenName: + type: "string" + optional: false + desc: + ja: "ユーザー名" + en: "The screen name of this user" + + isBot: + type: "boolean" + optional: true + desc: + ja: "botか否か(自己申告であることに留意)" + en: "Whether is bot or not" + + profile: + type: "object" + optional: false + desc: + ja: "プロフィール" + en: "The profile of this user" + + props: + location: + type: "string" + optional: true + desc: + ja: "場所" + en: "The location of this user" + + birthday: + type: "string" + optional: true + desc: + ja: "誕生日 (YYYY-MM-DD)" + en: "The birthday of this user (YYYY-MM-DD)" diff --git a/src/docs/api/entities/view.pug b/src/docs/api/entities/view.pug new file mode 100644 index 0000000000..d5c192f438 --- /dev/null +++ b/src/docs/api/entities/view.pug @@ -0,0 +1,20 @@ +extends ../../base +include ../mixins + +block meta + link(rel="stylesheet" href="/docs/assets/api/entities/style.css") + +block main + h1= name + + p#desc= desc[lang] || desc['ja'] + + section + h2= i18n('docs.api.entities.properties') + +propTable(props) + + if propDefs + each propDef in propDefs + section(id= propDef.name) + h3= propDef.name + +propTable(propDef.props) diff --git a/src/docs/api/mixins.pug b/src/docs/api/mixins.pug new file mode 100644 index 0000000000..925aab2934 --- /dev/null +++ b/src/docs/api/mixins.pug @@ -0,0 +1,34 @@ +mixin type(prop) + i= prop.type + if prop.kind == 'id' + if prop.entity + | ( + a(href=`/docs/${lang}/api/entities/${kebab(prop.entity)}`)= prop.entity + | ID) + else + | (ID) + else if prop.kind == 'entity' + | ( + a(href=`/docs/${lang}/api/entities/${kebab(prop.entity)}`)= prop.entity + | ) + else if prop.kind == 'object' + if prop.hasDef + | ( + a(href=`#${prop.name}`)= prop.name + | ) + else if prop.kind == 'date' + | (Date) + +mixin propTable(props) + table.props + thead: tr + th= i18n('docs.api.props.name') + th= i18n('docs.api.props.type') + th= i18n('docs.api.props.description') + tbody + each prop in props + tr + td.name= prop.name + td.type + +type(prop) + td.desc!= prop.desc ? prop.desc[lang] || prop.desc['ja'] : null diff --git a/src/docs/api/style.styl b/src/docs/api/style.styl new file mode 100644 index 0000000000..3675a4da6f --- /dev/null +++ b/src/docs/api/style.styl @@ -0,0 +1,11 @@ +@import "../style" + +table.props + .name + font-weight bold + + .name + .type + .optional + font-family Consolas, 'Courier New', Courier, Monaco, monospace + |