Update api definitions
This commit is contained in:
parent
aacfb5e221
commit
16726789da
66 changed files with 586 additions and 156 deletions
|
@ -3,6 +3,10 @@ import $ from 'cafy';
|
||||||
import App, { isValidNameId, pack } from '../../../../models/app';
|
import App, { isValidNameId, pack } from '../../../../models/app';
|
||||||
import { ILocalUser } from '../../../../models/user';
|
import { ILocalUser } from '../../../../models/user';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
requireCredential: true
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @swagger
|
* @swagger
|
||||||
* /app/create:
|
* /app/create:
|
||||||
|
|
|
@ -6,6 +6,11 @@ import AuthSess from '../../../../models/auth-session';
|
||||||
import AccessToken from '../../../../models/access-token';
|
import AccessToken from '../../../../models/access-token';
|
||||||
import { ILocalUser } from '../../../../models/user';
|
import { ILocalUser } from '../../../../models/user';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
requireCredential: true,
|
||||||
|
secure: true
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @swagger
|
* @swagger
|
||||||
* /auth/accept:
|
* /auth/accept:
|
||||||
|
|
|
@ -1,9 +1,17 @@
|
||||||
import DriveFile from '../../../models/drive-file';
|
import DriveFile from '../../../models/drive-file';
|
||||||
import { ILocalUser } from '../../../models/user';
|
import { ILocalUser } from '../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Get drive information
|
desc: {
|
||||||
*/
|
ja: 'ドライブの情報を取得します。',
|
||||||
|
en: 'Get drive information.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'drive-read'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Calculate drive usage
|
// Calculate drive usage
|
||||||
const usage = await DriveFile
|
const usage = await DriveFile
|
||||||
|
|
|
@ -2,9 +2,17 @@ import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||||
import DriveFile, { pack } from '../../../../models/drive-file';
|
import DriveFile, { pack } from '../../../../models/drive-file';
|
||||||
import { ILocalUser } from '../../../../models/user';
|
import { ILocalUser } from '../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Get drive files
|
desc: {
|
||||||
*/
|
ja: 'ドライブのファイル一覧を取得します。',
|
||||||
|
en: 'Get files of drive.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'drive-read'
|
||||||
|
};
|
||||||
|
|
||||||
export default async (params: any, user: ILocalUser) => {
|
export default async (params: any, user: ILocalUser) => {
|
||||||
// Get 'limit' parameter
|
// Get 'limit' parameter
|
||||||
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
||||||
|
|
|
@ -8,7 +8,8 @@ import getParams from '../../../get-params';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
desc: {
|
desc: {
|
||||||
ja: 'ドライブにファイルをアップロードします。'
|
ja: 'ドライブにファイルをアップロードします。',
|
||||||
|
en: 'Upload a file to drive.'
|
||||||
},
|
},
|
||||||
|
|
||||||
requireCredential: true,
|
requireCredential: true,
|
||||||
|
|
|
@ -4,9 +4,17 @@ import del from '../../../../../services/drive/delete-file';
|
||||||
import { publishDriveStream } from '../../../../../stream';
|
import { publishDriveStream } from '../../../../../stream';
|
||||||
import { ILocalUser } from '../../../../../models/user';
|
import { ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Delete a file
|
desc: {
|
||||||
*/
|
ja: 'ドライブのファイルを削除します。',
|
||||||
|
en: 'Delete a file of drive.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'drive-write'
|
||||||
|
};
|
||||||
|
|
||||||
export default async (params: any, user: ILocalUser) => {
|
export default async (params: any, user: ILocalUser) => {
|
||||||
// Get 'fileId' parameter
|
// Get 'fileId' parameter
|
||||||
const [fileId, fileIdErr] = $.type(ID).get(params.fileId);
|
const [fileId, fileIdErr] = $.type(ID).get(params.fileId);
|
||||||
|
|
|
@ -2,9 +2,12 @@ import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
|
||||||
import DriveFile, { pack } from '../../../../../models/drive-file';
|
import DriveFile, { pack } from '../../../../../models/drive-file';
|
||||||
import { ILocalUser } from '../../../../../models/user';
|
import { ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Find a file(s)
|
requireCredential: true,
|
||||||
*/
|
|
||||||
|
kind: 'drive-read'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'name' parameter
|
// Get 'name' parameter
|
||||||
const [name, nameErr] = $.str.get(params.name);
|
const [name, nameErr] = $.str.get(params.name);
|
||||||
|
|
|
@ -2,9 +2,17 @@ import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
|
||||||
import DriveFile, { pack } from '../../../../../models/drive-file';
|
import DriveFile, { pack } from '../../../../../models/drive-file';
|
||||||
import { ILocalUser } from '../../../../../models/user';
|
import { ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Show a file
|
desc: {
|
||||||
*/
|
ja: '指定したドライブのファイルの情報を取得します。',
|
||||||
|
en: 'Get specified file of drive.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'drive-read'
|
||||||
|
};
|
||||||
|
|
||||||
export default async (params: any, user: ILocalUser) => {
|
export default async (params: any, user: ILocalUser) => {
|
||||||
// Get 'fileId' parameter
|
// Get 'fileId' parameter
|
||||||
const [fileId, fileIdErr] = $.type(ID).get(params.fileId);
|
const [fileId, fileIdErr] = $.type(ID).get(params.fileId);
|
||||||
|
|
|
@ -4,9 +4,17 @@ import DriveFile, { validateFileName, pack } from '../../../../../models/drive-f
|
||||||
import { publishDriveStream } from '../../../../../stream';
|
import { publishDriveStream } from '../../../../../stream';
|
||||||
import { ILocalUser } from '../../../../../models/user';
|
import { ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Update a file
|
desc: {
|
||||||
*/
|
ja: '指定したドライブのファイルの情報を更新します。',
|
||||||
|
en: 'Update specified file of drive.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'drive-write'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'fileId' parameter
|
// Get 'fileId' parameter
|
||||||
const [fileId, fileIdErr] = $.type(ID).get(params.fileId);
|
const [fileId, fileIdErr] = $.type(ID).get(params.fileId);
|
||||||
|
|
|
@ -1,11 +1,24 @@
|
||||||
/**
|
|
||||||
* Module dependencies
|
|
||||||
*/
|
|
||||||
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
|
import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
|
||||||
|
const ms = require('ms');
|
||||||
import { pack } from '../../../../../models/drive-file';
|
import { pack } from '../../../../../models/drive-file';
|
||||||
import uploadFromUrl from '../../../../../services/drive/upload-from-url';
|
import uploadFromUrl from '../../../../../services/drive/upload-from-url';
|
||||||
import { ILocalUser } from '../../../../../models/user';
|
import { ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
desc: {
|
||||||
|
ja: 'ドライブに指定されたURLに存在するファイルをアップロードします。'
|
||||||
|
},
|
||||||
|
|
||||||
|
limit: {
|
||||||
|
duration: ms('1hour'),
|
||||||
|
max: 10
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'drive-write'
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a file from a URL
|
* Create a file from a URL
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,9 +2,17 @@ import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||||
import DriveFolder, { pack } from '../../../../models/drive-folder';
|
import DriveFolder, { pack } from '../../../../models/drive-folder';
|
||||||
import { ILocalUser } from '../../../../models/user';
|
import { ILocalUser } from '../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Get drive folders
|
desc: {
|
||||||
*/
|
ja: 'ドライブのフォルダ一覧を取得します。',
|
||||||
|
en: 'Get folders of drive.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'drive-read'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
// Get 'limit' parameter
|
||||||
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
||||||
|
|
|
@ -3,9 +3,17 @@ import DriveFolder, { isValidFolderName, pack } from '../../../../../models/driv
|
||||||
import { publishDriveStream } from '../../../../../stream';
|
import { publishDriveStream } from '../../../../../stream';
|
||||||
import { ILocalUser } from '../../../../../models/user';
|
import { ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Create drive folder
|
desc: {
|
||||||
*/
|
ja: 'ドライブのフォルダを作成します。',
|
||||||
|
en: 'Create a folder of drive.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'drive-write'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'name' parameter
|
// Get 'name' parameter
|
||||||
const [name = '無題のフォルダー', nameErr] = $.str.optional.pipe(isValidFolderName).get(params.name);
|
const [name = '無題のフォルダー', nameErr] = $.str.optional.pipe(isValidFolderName).get(params.name);
|
||||||
|
|
|
@ -2,9 +2,12 @@ import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
|
||||||
import DriveFolder, { pack } from '../../../../../models/drive-folder';
|
import DriveFolder, { pack } from '../../../../../models/drive-folder';
|
||||||
import { ILocalUser } from '../../../../../models/user';
|
import { ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Find a folder(s)
|
requireCredential: true,
|
||||||
*/
|
|
||||||
|
kind: 'drive-read'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'name' parameter
|
// Get 'name' parameter
|
||||||
const [name, nameErr] = $.str.get(params.name);
|
const [name, nameErr] = $.str.get(params.name);
|
||||||
|
|
|
@ -2,9 +2,16 @@ import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
|
||||||
import DriveFolder, { pack } from '../../../../../models/drive-folder';
|
import DriveFolder, { pack } from '../../../../../models/drive-folder';
|
||||||
import { ILocalUser } from '../../../../../models/user';
|
import { ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Show a folder
|
desc: {
|
||||||
*/
|
ja: '指定したドライブのフォルダの情報を取得します。'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'drive-read'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'folderId' parameter
|
// Get 'folderId' parameter
|
||||||
const [folderId, folderIdErr] = $.type(ID).get(params.folderId);
|
const [folderId, folderIdErr] = $.type(ID).get(params.folderId);
|
||||||
|
|
|
@ -3,9 +3,17 @@ import DriveFolder, { isValidFolderName, pack } from '../../../../../models/driv
|
||||||
import { publishDriveStream } from '../../../../../stream';
|
import { publishDriveStream } from '../../../../../stream';
|
||||||
import { ILocalUser } from '../../../../../models/user';
|
import { ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Update a folder
|
desc: {
|
||||||
*/
|
ja: '指定したドライブのフォルダの情報を更新します。',
|
||||||
|
en: 'Update specified folder of drive.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'drive-write'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'folderId' parameter
|
// Get 'folderId' parameter
|
||||||
const [folderId, folderIdErr] = $.type(ID).get(params.folderId);
|
const [folderId, folderIdErr] = $.type(ID).get(params.folderId);
|
||||||
|
|
|
@ -2,9 +2,12 @@ import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||||
import DriveFile, { pack } from '../../../../models/drive-file';
|
import DriveFile, { pack } from '../../../../models/drive-file';
|
||||||
import { ILocalUser } from '../../../../models/user';
|
import { ILocalUser } from '../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Get drive stream
|
requireCredential: true,
|
||||||
*/
|
|
||||||
|
kind: 'drive-read'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
// Get 'limit' parameter
|
||||||
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
||||||
|
|
|
@ -1,11 +1,25 @@
|
||||||
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||||
|
const ms = require('ms');
|
||||||
import User, { pack, ILocalUser } from '../../../../models/user';
|
import User, { pack, ILocalUser } from '../../../../models/user';
|
||||||
import Following from '../../../../models/following';
|
import Following from '../../../../models/following';
|
||||||
import create from '../../../../services/following/create';
|
import create from '../../../../services/following/create';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Follow a user
|
desc: {
|
||||||
*/
|
ja: '指定したユーザーをフォローします。',
|
||||||
|
en: 'Follow a user.'
|
||||||
|
},
|
||||||
|
|
||||||
|
limit: {
|
||||||
|
duration: ms('1hour'),
|
||||||
|
max: 100
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'following-write'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
const follower = user;
|
const follower = user;
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,25 @@
|
||||||
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||||
|
const ms = require('ms');
|
||||||
import User, { pack, ILocalUser } from '../../../../models/user';
|
import User, { pack, ILocalUser } from '../../../../models/user';
|
||||||
import Following from '../../../../models/following';
|
import Following from '../../../../models/following';
|
||||||
import deleteFollowing from '../../../../services/following/delete';
|
import deleteFollowing from '../../../../services/following/delete';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Unfollow a user
|
desc: {
|
||||||
*/
|
ja: '指定したユーザーのフォローを解除します。',
|
||||||
|
en: 'Unfollow a user.'
|
||||||
|
},
|
||||||
|
|
||||||
|
limit: {
|
||||||
|
duration: ms('1hour'),
|
||||||
|
max: 100
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'following-write'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
const follower = user;
|
const follower = user;
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,17 @@ import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
|
||||||
import acceptFollowRequest from '../../../../../services/following/requests/accept';
|
import acceptFollowRequest from '../../../../../services/following/requests/accept';
|
||||||
import User, { ILocalUser } from '../../../../../models/user';
|
import User, { ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Accept a follow request
|
desc: {
|
||||||
*/
|
ja: '自分に届いた、指定したフォローリクエストを承認します。',
|
||||||
|
en: 'Accept a follow request.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'following-write'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'userId' parameter
|
// Get 'userId' parameter
|
||||||
const [followerId, followerIdErr] = $.type(ID).get(params.userId);
|
const [followerId, followerIdErr] = $.type(ID).get(params.userId);
|
||||||
|
|
|
@ -2,9 +2,17 @@ import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
|
||||||
import cancelFollowRequest from '../../../../../services/following/requests/cancel';
|
import cancelFollowRequest from '../../../../../services/following/requests/cancel';
|
||||||
import User, { pack, ILocalUser } from '../../../../../models/user';
|
import User, { pack, ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Cancel a follow request
|
desc: {
|
||||||
*/
|
ja: '自分が作成した、指定したフォローリクエストをキャンセルします。',
|
||||||
|
en: 'Cancel a follow request.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'following-write'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'userId' parameter
|
// Get 'userId' parameter
|
||||||
const [followeeId, followeeIdErr] = $.type(ID).get(params.userId);
|
const [followeeId, followeeIdErr] = $.type(ID).get(params.userId);
|
||||||
|
|
|
@ -2,9 +2,17 @@
|
||||||
import FollowRequest, { pack } from '../../../../../models/follow-request';
|
import FollowRequest, { pack } from '../../../../../models/follow-request';
|
||||||
import { ILocalUser } from '../../../../../models/user';
|
import { ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Get all pending received follow requests
|
desc: {
|
||||||
*/
|
ja: '自分に届いたフォローリクエストの一覧を取得します。',
|
||||||
|
en: 'Get all pending received follow requests.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'following-read'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
const reqs = await FollowRequest.find({
|
const reqs = await FollowRequest.find({
|
||||||
followeeId: user._id
|
followeeId: user._id
|
||||||
|
|
|
@ -2,9 +2,17 @@ import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
|
||||||
import rejectFollowRequest from '../../../../../services/following/requests/reject';
|
import rejectFollowRequest from '../../../../../services/following/requests/reject';
|
||||||
import User, { ILocalUser } from '../../../../../models/user';
|
import User, { ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Reject a follow request
|
desc: {
|
||||||
*/
|
ja: '自分に届いた、指定したフォローリクエストを拒否します。',
|
||||||
|
en: 'Reject a follow request.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'following-write'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'userId' parameter
|
// Get 'userId' parameter
|
||||||
const [followerId, followerIdErr] = $.type(ID).get(params.userId);
|
const [followerId, followerIdErr] = $.type(ID).get(params.userId);
|
||||||
|
|
|
@ -2,9 +2,17 @@ import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||||
import Following from '../../../../models/following';
|
import Following from '../../../../models/following';
|
||||||
import { ILocalUser } from '../../../../models/user';
|
import { ILocalUser } from '../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Stalk a user
|
desc: {
|
||||||
*/
|
ja: '指定したユーザーをストーキングします。',
|
||||||
|
en: 'Stalk a user.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'following-write'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
const follower = user;
|
const follower = user;
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,17 @@ import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||||
import Following from '../../../../models/following';
|
import Following from '../../../../models/following';
|
||||||
import { ILocalUser } from '../../../../models/user';
|
import { ILocalUser } from '../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Unstalk a user
|
desc: {
|
||||||
*/
|
ja: '指定したユーザーのストーキングをやめます。',
|
||||||
|
en: 'Unstalk a user.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'following-write'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
const follower = user;
|
const follower = user;
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,10 @@ import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
|
||||||
import ReversiGame, { pack } from '../../../../../models/games/reversi/game';
|
import ReversiGame, { pack } from '../../../../../models/games/reversi/game';
|
||||||
import { ILocalUser } from '../../../../../models/user';
|
import { ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
requireCredential: true
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'my' parameter
|
// Get 'my' parameter
|
||||||
const [my = false, myErr] = $.bool.optional.get(params.my);
|
const [my = false, myErr] = $.bool.optional.get(params.my);
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
import Matching, { pack as packMatching } from '../../../../../models/games/reversi/matching';
|
import Matching, { pack as packMatching } from '../../../../../models/games/reversi/matching';
|
||||||
import { ILocalUser } from '../../../../../models/user';
|
import { ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
requireCredential: true
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Find session
|
// Find session
|
||||||
const invitations = await Matching.find({
|
const invitations = await Matching.find({
|
||||||
|
|
|
@ -5,6 +5,10 @@ import User, { ILocalUser } from '../../../../../models/user';
|
||||||
import publishUserStream, { publishReversiStream } from '../../../../../stream';
|
import publishUserStream, { publishReversiStream } from '../../../../../stream';
|
||||||
import { eighteight } from '../../../../../games/reversi/maps';
|
import { eighteight } from '../../../../../games/reversi/maps';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
requireCredential: true
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'userId' parameter
|
// Get 'userId' parameter
|
||||||
const [childId, childIdErr] = $.type(ID).get(params.userId);
|
const [childId, childIdErr] = $.type(ID).get(params.userId);
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
import Matching from '../../../../../../models/games/reversi/matching';
|
import Matching from '../../../../../../models/games/reversi/matching';
|
||||||
import { ILocalUser } from '../../../../../../models/user';
|
import { ILocalUser } from '../../../../../../models/user';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
requireCredential: true
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
await Matching.remove({
|
await Matching.remove({
|
||||||
parentId: user._id
|
parentId: user._id
|
||||||
|
|
|
@ -2,6 +2,11 @@ import $ from 'cafy';
|
||||||
import * as speakeasy from 'speakeasy';
|
import * as speakeasy from 'speakeasy';
|
||||||
import User, { ILocalUser } from '../../../../../models/user';
|
import User, { ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
requireCredential: true,
|
||||||
|
secure: true
|
||||||
|
};
|
||||||
|
|
||||||
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'token' parameter
|
// Get 'token' parameter
|
||||||
const [token, tokenErr] = $.str.get(params.token);
|
const [token, tokenErr] = $.str.get(params.token);
|
||||||
|
|
|
@ -5,6 +5,11 @@ import * as QRCode from 'qrcode';
|
||||||
import User, { ILocalUser } from '../../../../../models/user';
|
import User, { ILocalUser } from '../../../../../models/user';
|
||||||
import config from '../../../../../config';
|
import config from '../../../../../config';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
requireCredential: true,
|
||||||
|
secure: true
|
||||||
|
};
|
||||||
|
|
||||||
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'password' parameter
|
// Get 'password' parameter
|
||||||
const [password, passwordErr] = $.str.get(params.password);
|
const [password, passwordErr] = $.str.get(params.password);
|
||||||
|
|
|
@ -2,6 +2,11 @@ import $ from 'cafy';
|
||||||
import * as bcrypt from 'bcryptjs';
|
import * as bcrypt from 'bcryptjs';
|
||||||
import User, { ILocalUser } from '../../../../../models/user';
|
import User, { ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
requireCredential: true,
|
||||||
|
secure: true
|
||||||
|
};
|
||||||
|
|
||||||
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'password' parameter
|
// Get 'password' parameter
|
||||||
const [password, passwordErr] = $.str.get(params.password);
|
const [password, passwordErr] = $.str.get(params.password);
|
||||||
|
|
|
@ -3,9 +3,11 @@ import AccessToken from '../../../../models/access-token';
|
||||||
import { pack } from '../../../../models/app';
|
import { pack } from '../../../../models/app';
|
||||||
import { ILocalUser } from '../../../../models/user';
|
import { ILocalUser } from '../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Get authorized apps of my account
|
requireCredential: true,
|
||||||
*/
|
secure: true
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
// Get 'limit' parameter
|
||||||
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
||||||
|
|
|
@ -2,9 +2,11 @@ import $ from 'cafy';
|
||||||
import * as bcrypt from 'bcryptjs';
|
import * as bcrypt from 'bcryptjs';
|
||||||
import User, { ILocalUser } from '../../../../models/user';
|
import User, { ILocalUser } from '../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Change password
|
requireCredential: true,
|
||||||
*/
|
secure: true
|
||||||
|
};
|
||||||
|
|
||||||
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'currentPasword' parameter
|
// Get 'currentPasword' parameter
|
||||||
const [currentPassword, currentPasswordErr] = $.str.get(params.currentPasword);
|
const [currentPassword, currentPasswordErr] = $.str.get(params.currentPasword);
|
||||||
|
|
|
@ -2,9 +2,17 @@ import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||||
import Favorite, { pack } from '../../../../models/favorite';
|
import Favorite, { pack } from '../../../../models/favorite';
|
||||||
import { ILocalUser } from '../../../../models/user';
|
import { ILocalUser } from '../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Get favorited notes
|
desc: {
|
||||||
*/
|
ja: 'お気に入りに登録した投稿一覧を取得します。',
|
||||||
|
en: 'Get favorited notes'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'favorites-read'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
// Get 'limit' parameter
|
||||||
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
||||||
|
|
|
@ -4,9 +4,11 @@ import User, { ILocalUser } from '../../../../models/user';
|
||||||
import event from '../../../../stream';
|
import event from '../../../../stream';
|
||||||
import generateUserToken from '../../common/generate-native-user-token';
|
import generateUserToken from '../../common/generate-native-user-token';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Regenerate native token
|
requireCredential: true,
|
||||||
*/
|
secure: true
|
||||||
|
};
|
||||||
|
|
||||||
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'password' parameter
|
// Get 'password' parameter
|
||||||
const [password, passwordErr] = $.str.get(params.password);
|
const [password, passwordErr] = $.str.get(params.password);
|
||||||
|
|
|
@ -2,9 +2,11 @@ import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||||
import Signin, { pack } from '../../../../models/signin';
|
import Signin, { pack } from '../../../../models/signin';
|
||||||
import { ILocalUser } from '../../../../models/user';
|
import { ILocalUser } from '../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Get signin history of my account
|
requireCredential: true,
|
||||||
*/
|
secure: true
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
// Get 'limit' parameter
|
||||||
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
||||||
|
|
|
@ -5,9 +5,17 @@ import DriveFile from '../../../../models/drive-file';
|
||||||
import acceptAllFollowRequests from '../../../../services/following/requests/accept-all';
|
import acceptAllFollowRequests from '../../../../services/following/requests/accept-all';
|
||||||
import { IApp } from '../../../../models/app';
|
import { IApp } from '../../../../models/app';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Update myself
|
desc: {
|
||||||
*/
|
ja: 'アカウント情報を更新します。',
|
||||||
|
en: 'Update myself'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'account-write'
|
||||||
|
};
|
||||||
|
|
||||||
export default async (params: any, user: ILocalUser, app: IApp) => new Promise(async (res, rej) => {
|
export default async (params: any, user: ILocalUser, app: IApp) => new Promise(async (res, rej) => {
|
||||||
const isSecure = user != null && app == null;
|
const isSecure = user != null && app == null;
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,11 @@ import $ from 'cafy';
|
||||||
import User, { ILocalUser } from '../../../../models/user';
|
import User, { ILocalUser } from '../../../../models/user';
|
||||||
import event from '../../../../stream';
|
import event from '../../../../stream';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Update myself
|
requireCredential: true,
|
||||||
*/
|
secure: true
|
||||||
|
};
|
||||||
|
|
||||||
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'name' parameter
|
// Get 'name' parameter
|
||||||
const [name, nameErr] = $.str.get(params.name);
|
const [name, nameErr] = $.str.get(params.name);
|
||||||
|
|
|
@ -2,6 +2,11 @@ import $ from 'cafy';
|
||||||
import User, { ILocalUser } from '../../../../models/user';
|
import User, { ILocalUser } from '../../../../models/user';
|
||||||
import event from '../../../../stream';
|
import event from '../../../../stream';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
requireCredential: true,
|
||||||
|
secure: true
|
||||||
|
};
|
||||||
|
|
||||||
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'home' parameter
|
// Get 'home' parameter
|
||||||
const [home, homeErr] = $.arr($.obj({
|
const [home, homeErr] = $.arr($.obj({
|
||||||
|
|
|
@ -2,6 +2,11 @@ import $ from 'cafy';
|
||||||
import User, { ILocalUser } from '../../../../models/user';
|
import User, { ILocalUser } from '../../../../models/user';
|
||||||
import event from '../../../../stream';
|
import event from '../../../../stream';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
requireCredential: true,
|
||||||
|
secure: true
|
||||||
|
};
|
||||||
|
|
||||||
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'home' parameter
|
// Get 'home' parameter
|
||||||
const [home, homeErr] = $.arr($.obj({
|
const [home, homeErr] = $.arr($.obj({
|
||||||
|
|
|
@ -2,6 +2,11 @@ import $ from 'cafy';
|
||||||
import User, { ILocalUser } from '../../../../models/user';
|
import User, { ILocalUser } from '../../../../models/user';
|
||||||
import event from '../../../../stream';
|
import event from '../../../../stream';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
requireCredential: true,
|
||||||
|
secure: true
|
||||||
|
};
|
||||||
|
|
||||||
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'id' parameter
|
// Get 'id' parameter
|
||||||
const [id, idErr] = $.str.get(params.id);
|
const [id, idErr] = $.str.get(params.id);
|
||||||
|
|
|
@ -4,9 +4,17 @@ import Mute from '../../../../models/mute';
|
||||||
import { pack } from '../../../../models/messaging-message';
|
import { pack } from '../../../../models/messaging-message';
|
||||||
import { ILocalUser } from '../../../../models/user';
|
import { ILocalUser } from '../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Show messaging history
|
desc: {
|
||||||
*/
|
ja: 'Messagingの履歴を取得します。',
|
||||||
|
en: 'Show messaging history.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'messaging-read'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
// Get 'limit' parameter
|
||||||
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
||||||
|
|
|
@ -4,9 +4,17 @@ import User, { ILocalUser } from '../../../../models/user';
|
||||||
import { pack } from '../../../../models/messaging-message';
|
import { pack } from '../../../../models/messaging-message';
|
||||||
import read from '../../common/read-messaging-message';
|
import read from '../../common/read-messaging-message';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Get messages
|
desc: {
|
||||||
*/
|
ja: '指定したユーザーとのMessagingのメッセージ一覧を取得します。',
|
||||||
|
en: 'Get messages of messaging.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'messaging-read'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'userId' parameter
|
// Get 'userId' parameter
|
||||||
const [recipientId, recipientIdErr] = $.type(ID).get(params.userId);
|
const [recipientId, recipientIdErr] = $.type(ID).get(params.userId);
|
||||||
|
|
|
@ -11,9 +11,17 @@ import { publishMessagingStream, publishMessagingIndexStream } from '../../../..
|
||||||
import pushSw from '../../../../../push-sw';
|
import pushSw from '../../../../../push-sw';
|
||||||
import config from '../../../../../config';
|
import config from '../../../../../config';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Create a message
|
desc: {
|
||||||
*/
|
ja: '指定したユーザーへMessagingのメッセージを送信します。',
|
||||||
|
en: 'Create a message of messaging.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'messaging-write'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'userId' parameter
|
// Get 'userId' parameter
|
||||||
const [recipientId, recipientIdErr] = $.type(ID).get(params.userId);
|
const [recipientId, recipientIdErr] = $.type(ID).get(params.userId);
|
||||||
|
|
|
@ -2,9 +2,17 @@ import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||||
import User, { ILocalUser } from '../../../../models/user';
|
import User, { ILocalUser } from '../../../../models/user';
|
||||||
import Mute from '../../../../models/mute';
|
import Mute from '../../../../models/mute';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Mute a user
|
desc: {
|
||||||
*/
|
ja: 'ユーザーをミュートします。',
|
||||||
|
en: 'Mute a user'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'account/write'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
const muter = user;
|
const muter = user;
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,17 @@ import $ from 'cafy'; import ID from '../../../../misc/cafy-id';
|
||||||
import User, { ILocalUser } from '../../../../models/user';
|
import User, { ILocalUser } from '../../../../models/user';
|
||||||
import Mute from '../../../../models/mute';
|
import Mute from '../../../../models/mute';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Unmute a user
|
desc: {
|
||||||
*/
|
ja: 'ユーザーのミュートを解除します。',
|
||||||
|
en: 'Unmute a user'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'account/write'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
const muter = user;
|
const muter = user;
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,17 @@ import Mute from '../../../../models/mute';
|
||||||
import { pack, ILocalUser } from '../../../../models/user';
|
import { pack, ILocalUser } from '../../../../models/user';
|
||||||
import { getFriendIds } from '../../common/get-friends';
|
import { getFriendIds } from '../../common/get-friends';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Get muted users of a user
|
desc: {
|
||||||
*/
|
ja: 'ミュートしているユーザー一覧を取得します。',
|
||||||
|
en: 'Get muted users.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'account/read'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, me: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, me: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'iknow' parameter
|
// Get 'iknow' parameter
|
||||||
const [iknow = false, iknowErr] = $.bool.optional.get(params.iknow);
|
const [iknow = false, iknowErr] = $.bool.optional.get(params.iknow);
|
||||||
|
|
|
@ -2,9 +2,15 @@ import $ from 'cafy';
|
||||||
import App, { pack } from '../../../../models/app';
|
import App, { pack } from '../../../../models/app';
|
||||||
import { ILocalUser } from '../../../../models/user';
|
import { ILocalUser } from '../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Get my apps
|
desc: {
|
||||||
*/
|
ja: '自分のアプリケーション一覧を取得します。',
|
||||||
|
en: 'Get my apps'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
// Get 'limit' parameter
|
||||||
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
||||||
|
|
|
@ -3,9 +3,17 @@ import Note from '../../../../models/note';
|
||||||
import deleteNote from '../../../../services/note/delete';
|
import deleteNote from '../../../../services/note/delete';
|
||||||
import { ILocalUser } from '../../../../models/user';
|
import { ILocalUser } from '../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Delete a note
|
desc: {
|
||||||
*/
|
ja: '指定した投稿を削除します。',
|
||||||
|
en: 'Delete a note.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'note-write'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'noteId' parameter
|
// Get 'noteId' parameter
|
||||||
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
|
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
|
||||||
|
|
|
@ -3,9 +3,17 @@ import Favorite from '../../../../../models/favorite';
|
||||||
import Note from '../../../../../models/note';
|
import Note from '../../../../../models/note';
|
||||||
import { ILocalUser } from '../../../../../models/user';
|
import { ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Favorite a note
|
desc: {
|
||||||
*/
|
ja: '指定した投稿をお気に入りに登録します。',
|
||||||
|
en: 'Favorite a note.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'favorite-write'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'noteId' parameter
|
// Get 'noteId' parameter
|
||||||
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
|
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
|
||||||
|
|
|
@ -3,9 +3,17 @@ import Favorite from '../../../../../models/favorite';
|
||||||
import Note from '../../../../../models/note';
|
import Note from '../../../../../models/note';
|
||||||
import { ILocalUser } from '../../../../../models/user';
|
import { ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Unfavorite a note
|
desc: {
|
||||||
*/
|
ja: '指定した投稿のお気に入りを解除します。',
|
||||||
|
en: 'Unfavorite a note.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'favorite-write'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'noteId' parameter
|
// Get 'noteId' parameter
|
||||||
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
|
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
|
||||||
|
|
|
@ -4,9 +4,15 @@ import { getFriendIds } from '../../common/get-friends';
|
||||||
import { pack } from '../../../../models/note';
|
import { pack } from '../../../../models/note';
|
||||||
import { ILocalUser } from '../../../../models/user';
|
import { ILocalUser } from '../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Get mentions of myself
|
desc: {
|
||||||
*/
|
ja: '自分に言及している投稿の一覧を取得します。',
|
||||||
|
en: 'Get mentions of myself.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'following' parameter
|
// Get 'following' parameter
|
||||||
const [following = false, followingError] =
|
const [following = false, followingError] =
|
||||||
|
|
|
@ -3,9 +3,15 @@ import Vote from '../../../../../models/poll-vote';
|
||||||
import Note, { pack } from '../../../../../models/note';
|
import Note, { pack } from '../../../../../models/note';
|
||||||
import { ILocalUser } from '../../../../../models/user';
|
import { ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Get recommended polls
|
desc: {
|
||||||
*/
|
ja: 'おすすめのアンケート一覧を取得します。',
|
||||||
|
en: 'Get recommended polls.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
// Get 'limit' parameter
|
||||||
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
||||||
|
|
|
@ -7,9 +7,17 @@ import { publishNoteStream } from '../../../../../stream';
|
||||||
import notify from '../../../../../notify';
|
import notify from '../../../../../notify';
|
||||||
import { ILocalUser } from '../../../../../models/user';
|
import { ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Vote poll of a note
|
desc: {
|
||||||
*/
|
ja: '指定した投稿のアンケートに投票します。',
|
||||||
|
en: 'Vote poll of a note.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'vote-write'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'noteId' parameter
|
// Get 'noteId' parameter
|
||||||
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
|
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
|
||||||
|
|
|
@ -3,9 +3,15 @@ import Note from '../../../../models/note';
|
||||||
import Reaction, { pack } from '../../../../models/note-reaction';
|
import Reaction, { pack } from '../../../../models/note-reaction';
|
||||||
import { ILocalUser } from '../../../../models/user';
|
import { ILocalUser } from '../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Show reactions of a note
|
desc: {
|
||||||
*/
|
ja: '指定した投稿のリアクション一覧を取得します。',
|
||||||
|
en: 'Show reactions of a note.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'noteId' parameter
|
// Get 'noteId' parameter
|
||||||
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
|
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
|
||||||
|
@ -46,6 +52,5 @@ export default (params: any, user: ILocalUser) => new Promise(async (res, rej) =
|
||||||
});
|
});
|
||||||
|
|
||||||
// Serialize
|
// Serialize
|
||||||
res(await Promise.all(reactions.map(async reaction =>
|
res(await Promise.all(reactions.map(reaction => pack(reaction, user))));
|
||||||
await pack(reaction, user))));
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,12 +6,15 @@ import { ILocalUser } from '../../../../../models/user';
|
||||||
import getParams from '../../../get-params';
|
import getParams from '../../../get-params';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
name: 'notes/reactions/create',
|
|
||||||
|
|
||||||
desc: {
|
desc: {
|
||||||
ja: '投稿にリアクションします。'
|
ja: '指定した投稿にリアクションします。',
|
||||||
|
en: 'React to a note.'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'reaction-write',
|
||||||
|
|
||||||
params: {
|
params: {
|
||||||
noteId: $.type(ID).note({
|
noteId: $.type(ID).note({
|
||||||
desc: {
|
desc: {
|
||||||
|
@ -27,9 +30,6 @@ export const meta = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* React to a note
|
|
||||||
*/
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
const [ps, psErr] = getParams(meta, params);
|
const [ps, psErr] = getParams(meta, params);
|
||||||
if (psErr) return rej(psErr);
|
if (psErr) return rej(psErr);
|
||||||
|
|
|
@ -3,9 +3,17 @@ import Reaction from '../../../../../models/note-reaction';
|
||||||
import Note from '../../../../../models/note';
|
import Note from '../../../../../models/note';
|
||||||
import { ILocalUser } from '../../../../../models/user';
|
import { ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Unreact to a note
|
desc: {
|
||||||
*/
|
ja: '指定した投稿へのリアクションを取り消します。',
|
||||||
|
en: 'Unreact to a note.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'reaction-write'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'noteId' parameter
|
// Get 'noteId' parameter
|
||||||
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
|
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
|
||||||
|
|
|
@ -3,9 +3,15 @@ import $ from 'cafy';
|
||||||
import Note, { pack } from '../../../../models/note';
|
import Note, { pack } from '../../../../models/note';
|
||||||
import { ILocalUser } from '../../../../models/user';
|
import { ILocalUser } from '../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Get trend notes
|
desc: {
|
||||||
*/
|
ja: '人気の投稿の一覧を取得します。',
|
||||||
|
en: 'Get trend notes.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
// Get 'limit' parameter
|
||||||
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
||||||
|
|
|
@ -5,9 +5,15 @@ import { pack } from '../../../../models/note';
|
||||||
import UserList from '../../../../models/user-list';
|
import UserList from '../../../../models/user-list';
|
||||||
import { ILocalUser } from '../../../../models/user';
|
import { ILocalUser } from '../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Get timeline of a user list
|
desc: {
|
||||||
*/
|
ja: '指定したユーザーリストのタイムラインを取得します。',
|
||||||
|
en: 'Get timeline of a user list.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true
|
||||||
|
};
|
||||||
|
|
||||||
export default async (params: any, user: ILocalUser) => {
|
export default async (params: any, user: ILocalUser) => {
|
||||||
// Get 'limit' parameter
|
// Get 'limit' parameter
|
||||||
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
||||||
|
|
|
@ -2,6 +2,17 @@ import Notification from '../../../../models/notification';
|
||||||
import event from '../../../../stream';
|
import event from '../../../../stream';
|
||||||
import User, { ILocalUser } from '../../../../models/user';
|
import User, { ILocalUser } from '../../../../models/user';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
desc: {
|
||||||
|
ja: '全ての通知を既読にします。',
|
||||||
|
en: 'Mark as read all notifications.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'notification-write'
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark as read all notifications
|
* Mark as read all notifications
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,6 +2,10 @@ import $ from 'cafy';
|
||||||
import Subscription from '../../../../models/sw-subscription';
|
import Subscription from '../../../../models/sw-subscription';
|
||||||
import { ILocalUser } from '../../../../models/user';
|
import { ILocalUser } from '../../../../models/user';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
requireCredential: true
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* subscribe service worker
|
* subscribe service worker
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,9 +2,17 @@ import $ from 'cafy';
|
||||||
import UserList, { pack } from '../../../../../models/user-list';
|
import UserList, { pack } from '../../../../../models/user-list';
|
||||||
import { ILocalUser } from '../../../../../models/user';
|
import { ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Create a user list
|
desc: {
|
||||||
*/
|
ja: 'ユーザーリストを作成します。',
|
||||||
|
en: 'Create a user list'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'account-write'
|
||||||
|
};
|
||||||
|
|
||||||
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
export default async (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'title' parameter
|
// Get 'title' parameter
|
||||||
const [title, titleErr] = $.str.range(1, 100).get(params.title);
|
const [title, titleErr] = $.str.range(1, 100).get(params.title);
|
||||||
|
|
|
@ -1,9 +1,16 @@
|
||||||
import UserList, { pack } from '../../../../../models/user-list';
|
import UserList, { pack } from '../../../../../models/user-list';
|
||||||
import { ILocalUser } from '../../../../../models/user';
|
import { ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Add a user to a user list
|
desc: {
|
||||||
*/
|
ja: '自分の作成したユーザーリスト一覧を取得します。'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'account-read'
|
||||||
|
};
|
||||||
|
|
||||||
export default async (params: any, me: ILocalUser) => new Promise(async (res, rej) => {
|
export default async (params: any, me: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Fetch lists
|
// Fetch lists
|
||||||
const userLists = await UserList.find({
|
const userLists = await UserList.find({
|
||||||
|
|
|
@ -6,6 +6,17 @@ import ap from '../../../../../remote/activitypub/renderer';
|
||||||
import renderFollow from '../../../../../remote/activitypub/renderer/follow';
|
import renderFollow from '../../../../../remote/activitypub/renderer/follow';
|
||||||
import { deliver } from '../../../../../queue';
|
import { deliver } from '../../../../../queue';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
desc: {
|
||||||
|
ja: '指定したユーザーリストに指定したユーザーを追加します。',
|
||||||
|
en: 'Add a user to a user list.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'account-write'
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a user to a user list
|
* Add a user to a user list
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,9 +2,17 @@ import $ from 'cafy'; import ID from '../../../../../misc/cafy-id';
|
||||||
import UserList, { pack } from '../../../../../models/user-list';
|
import UserList, { pack } from '../../../../../models/user-list';
|
||||||
import { ILocalUser } from '../../../../../models/user';
|
import { ILocalUser } from '../../../../../models/user';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Show a user list
|
desc: {
|
||||||
*/
|
ja: '指定したユーザーリストの情報を取得します。',
|
||||||
|
en: 'Show a user list.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'account-read'
|
||||||
|
};
|
||||||
|
|
||||||
export default async (params: any, me: ILocalUser) => new Promise(async (res, rej) => {
|
export default async (params: any, me: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'listId' parameter
|
// Get 'listId' parameter
|
||||||
const [listId, listIdErr] = $.type(ID).get(params.listId);
|
const [listId, listIdErr] = $.type(ID).get(params.listId);
|
||||||
|
|
|
@ -4,9 +4,16 @@ import User, { pack, ILocalUser } from '../../../../models/user';
|
||||||
import { getFriendIds } from '../../common/get-friends';
|
import { getFriendIds } from '../../common/get-friends';
|
||||||
import Mute from '../../../../models/mute';
|
import Mute from '../../../../models/mute';
|
||||||
|
|
||||||
/**
|
export const meta = {
|
||||||
* Get recommended users
|
desc: {
|
||||||
*/
|
ja: 'おすすめのユーザー一覧を取得します。'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'account-read'
|
||||||
|
};
|
||||||
|
|
||||||
export default (params: any, me: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, me: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
// Get 'limit' parameter
|
// Get 'limit' parameter
|
||||||
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
||||||
|
|
Loading…
Reference in a new issue