summaryrefslogtreecommitdiff
path: root/src/server/api/endpoints/app/create.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2018-08-01 08:34:22 +0900
committerGitHub <noreply@github.com>2018-08-01 08:34:22 +0900
commit77faf7a84cc28d9a24803940730e59706edd4ec8 (patch)
treea3a366deedc99a98bcfe7358eb48aff0ff5fe71c /src/server/api/endpoints/app/create.ts
parentNew translations ja.yml (English) (diff)
parentMerge pull request #2033 from syuilo/greenkeeper/qrcode-1.2.2 (diff)
downloadmisskey-77faf7a84cc28d9a24803940730e59706edd4ec8.tar.gz
misskey-77faf7a84cc28d9a24803940730e59706edd4ec8.tar.bz2
misskey-77faf7a84cc28d9a24803940730e59706edd4ec8.zip
Merge branch 'master' into l10n_master
Diffstat (limited to 'src/server/api/endpoints/app/create.ts')
-rw-r--r--src/server/api/endpoints/app/create.ts59
1 files changed, 5 insertions, 54 deletions
diff --git a/src/server/api/endpoints/app/create.ts b/src/server/api/endpoints/app/create.ts
index c7bc91a079..5df8bd2f25 100644
--- a/src/server/api/endpoints/app/create.ts
+++ b/src/server/api/endpoints/app/create.ts
@@ -3,63 +3,14 @@ import $ from 'cafy';
import App, { isValidNameId, pack } from '../../../../models/app';
import { ILocalUser } from '../../../../models/user';
-/**
- * @swagger
- * /app/create:
- * note:
- * summary: Create an application
- * parameters:
- * - $ref: "#/parameters/AccessToken"
- * -
- * name: nameId
- * description: Application unique name
- * in: formData
- * required: true
- * type: string
- * -
- * name: name
- * description: Application name
- * in: formData
- * required: true
- * type: string
- * -
- * name: description
- * description: Application description
- * in: formData
- * required: true
- * type: string
- * -
- * name: permission
- * description: Permissions that application has
- * in: formData
- * required: true
- * type: array
- * items:
- * type: string
- * collectionFormat: csv
- * -
- * name: callbackUrl
- * description: URL called back after authentication
- * in: formData
- * required: false
- * type: string
- *
- * responses:
- * 200:
- * description: Created application's information
- * schema:
- * $ref: "#/definitions/Application"
- *
- * default:
- * description: Failed
- * schema:
- * $ref: "#/definitions/Error"
- */
+export const meta = {
+ requireCredential: true
+};
/**
* Create an app
*/
-module.exports = async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
+export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'nameId' parameter
const [nameId, nameIdErr] = $.str.pipe(isValidNameId).get(params.nameId);
if (nameIdErr) return rej('invalid nameId param');
@@ -78,7 +29,7 @@ module.exports = async (params: any, user: ILocalUser) => new Promise(async (res
// Get 'callbackUrl' parameter
// TODO: Check it is valid url
- const [callbackUrl = null, callbackUrlErr] = $.str.optional().nullable().get(params.callbackUrl);
+ const [callbackUrl = null, callbackUrlErr] = $.str.optional.nullable.get(params.callbackUrl);
if (callbackUrlErr) return rej('invalid callbackUrl param');
// Generate secret