diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2019-04-15 12:11:58 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2019-04-15 12:11:58 +0900 |
| commit | 31c26354c522d4a0a6dccf1d770bd887af32d4b9 (patch) | |
| tree | fb48c1a71e8b451f109b2674d87cba6dd1473dbd /src/server/api/openapi/description.ts | |
| parent | Update read.ts (diff) | |
| parent | Better permisson Fix #2341 (#4611) (diff) | |
| download | sharkey-31c26354c522d4a0a6dccf1d770bd887af32d4b9.tar.gz sharkey-31c26354c522d4a0a6dccf1d770bd887af32d4b9.tar.bz2 sharkey-31c26354c522d4a0a6dccf1d770bd887af32d4b9.zip | |
Merge branch 'develop' of https://github.com/syuilo/misskey into develop
Diffstat (limited to 'src/server/api/openapi/description.ts')
| -rw-r--r-- | src/server/api/openapi/description.ts | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/server/api/openapi/description.ts b/src/server/api/openapi/description.ts index 04a0b4c719..b801c86387 100644 --- a/src/server/api/openapi/description.ts +++ b/src/server/api/openapi/description.ts @@ -1,6 +1,14 @@ import config from '../../../config'; +import { IKindInfo, kinds } from '../kinds'; + +export function getDescription(lang = 'ja-JP'): string { + const permissionTable = (Object.entries(kinds()) as [string, IKindInfo][]) + .map(e => `|${e[0]}|${e[1].descs[lang]}|${e[1].endpoints.map(f => `[${f}](#operation/${f})`).join(', ')}|`) + .join('\n'); + + const descriptions = { + 'ja-JP': `**Misskey is a decentralized microblogging platform.** -export const description = ` ## Usage **APIはすべてPOSTでリクエスト/レスポンスともにJSON形式です。** 一部のAPIはリクエストに認証情報(APIキー)が必要です。リクエストの際に\`i\`というパラメータでAPIキーを添付してください。 @@ -44,4 +52,12 @@ APIキーの生成方法を擬似コードで表すと次のようになりま \`\`\` js const i = sha256(userToken + secretKey); \`\`\` -`; + +## Permissions +|Permisson (kind)|Description|Endpoints| +|:--|:--|:--| +${permissionTable} +` + } as { [x: string]: string }; + return lang in descriptions ? descriptions[lang] : descriptions['ja-JP']; +} |