Refactor API (#4770)
* wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update description.ts * wip
This commit is contained in:
@@ -3,6 +3,7 @@ import { ID } from '../../../../misc/cafy-id';
|
||||
import define from '../../define';
|
||||
import { DriveFiles } from '../../../../models';
|
||||
import { makePaginationQuery } from '../../common/make-pagination-query';
|
||||
import { types, bool } from '../../../../misc/schema';
|
||||
|
||||
export const meta = {
|
||||
desc: {
|
||||
@@ -41,10 +42,13 @@ export const meta = {
|
||||
},
|
||||
|
||||
res: {
|
||||
type: 'array',
|
||||
type: types.array,
|
||||
optional: bool.false, nullable: bool.false,
|
||||
items: {
|
||||
type: 'DriveFile',
|
||||
},
|
||||
type: types.object,
|
||||
optional: bool.false, nullable: bool.false,
|
||||
ref: 'DriveFile',
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
@@ -3,6 +3,7 @@ import { ID } from '../../../../../misc/cafy-id';
|
||||
import define from '../../../define';
|
||||
import { ApiError } from '../../../error';
|
||||
import { DriveFiles } from '../../../../../models';
|
||||
import { types, bool } from '../../../../../misc/schema';
|
||||
|
||||
export const meta = {
|
||||
stability: 'stable',
|
||||
@@ -29,10 +30,13 @@ export const meta = {
|
||||
},
|
||||
|
||||
res: {
|
||||
type: 'array',
|
||||
type: types.array,
|
||||
optional: bool.false, nullable: bool.false,
|
||||
items: {
|
||||
type: 'Note',
|
||||
},
|
||||
type: types.object,
|
||||
optional: bool.false, nullable: bool.false,
|
||||
ref: 'Note',
|
||||
}
|
||||
},
|
||||
|
||||
errors: {
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import $ from 'cafy';
|
||||
import define from '../../../define';
|
||||
import { DriveFiles } from '../../../../../models';
|
||||
import { types, bool } from '../../../../../misc/schema';
|
||||
|
||||
export const meta = {
|
||||
desc: {
|
||||
@@ -24,7 +25,13 @@ export const meta = {
|
||||
},
|
||||
|
||||
res: {
|
||||
type: 'DriveFile',
|
||||
type: types.array,
|
||||
optional: bool.false, nullable: bool.false,
|
||||
items: {
|
||||
type: types.object,
|
||||
optional: bool.false, nullable: bool.false,
|
||||
ref: 'DriveFile',
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
@@ -6,6 +6,7 @@ import define from '../../../define';
|
||||
import { apiLogger } from '../../../logger';
|
||||
import { ApiError } from '../../../error';
|
||||
import { DriveFiles } from '../../../../../models';
|
||||
import { types, bool } from '../../../../../misc/schema';
|
||||
|
||||
export const meta = {
|
||||
desc: {
|
||||
@@ -56,7 +57,9 @@ export const meta = {
|
||||
},
|
||||
|
||||
res: {
|
||||
type: 'DriveFile',
|
||||
type: types.object,
|
||||
optional: bool.false, nullable: bool.false,
|
||||
ref: 'DriveFile',
|
||||
},
|
||||
|
||||
errors: {
|
||||
@@ -87,7 +90,7 @@ export default define(meta, async (ps, user, app, file, cleanup) => {
|
||||
try {
|
||||
// Create file
|
||||
const driveFile = await create(user, file.path, name, null, ps.folderId, ps.force, false, null, null, ps.isSensitive);
|
||||
return DriveFiles.pack(driveFile, { self: true });
|
||||
return await DriveFiles.pack(driveFile, { self: true });
|
||||
} catch (e) {
|
||||
apiLogger.error(e);
|
||||
throw new ApiError();
|
||||
|
@@ -2,6 +2,7 @@ import $ from 'cafy';
|
||||
import { ID } from '../../../../../misc/cafy-id';
|
||||
import define from '../../../define';
|
||||
import { DriveFiles } from '../../../../../models';
|
||||
import { types, bool } from '../../../../../misc/schema';
|
||||
|
||||
export const meta = {
|
||||
requireCredential: true,
|
||||
@@ -22,7 +23,17 @@ export const meta = {
|
||||
'ja-JP': 'フォルダID'
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
res: {
|
||||
type: types.array,
|
||||
optional: bool.false, nullable: bool.false,
|
||||
items: {
|
||||
type: types.object,
|
||||
optional: bool.false, nullable: bool.false,
|
||||
ref: 'DriveFile',
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
|
@@ -4,6 +4,7 @@ import define from '../../../define';
|
||||
import { ApiError } from '../../../error';
|
||||
import { DriveFile } from '../../../../../models/entities/drive-file';
|
||||
import { DriveFiles } from '../../../../../models';
|
||||
import { types, bool } from '../../../../../misc/schema';
|
||||
|
||||
export const meta = {
|
||||
stability: 'stable',
|
||||
@@ -38,7 +39,9 @@ export const meta = {
|
||||
},
|
||||
|
||||
res: {
|
||||
type: 'DriveFile',
|
||||
type: types.object,
|
||||
optional: bool.false, nullable: bool.false,
|
||||
ref: 'DriveFile',
|
||||
},
|
||||
|
||||
errors: {
|
||||
|
@@ -3,6 +3,7 @@ import { ID } from '../../../../misc/cafy-id';
|
||||
import define from '../../define';
|
||||
import { DriveFolders } from '../../../../models';
|
||||
import { makePaginationQuery } from '../../common/make-pagination-query';
|
||||
import { types, bool } from '../../../../misc/schema';
|
||||
|
||||
export const meta = {
|
||||
desc: {
|
||||
@@ -37,10 +38,13 @@ export const meta = {
|
||||
},
|
||||
|
||||
res: {
|
||||
type: 'array',
|
||||
type: types.array,
|
||||
optional: bool.false, nullable: bool.false,
|
||||
items: {
|
||||
type: 'DriveFolder',
|
||||
},
|
||||
type: types.object,
|
||||
optional: bool.false, nullable: bool.false,
|
||||
ref: 'DriveFolder',
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
@@ -2,6 +2,7 @@ import $ from 'cafy';
|
||||
import { ID } from '../../../../../misc/cafy-id';
|
||||
import define from '../../../define';
|
||||
import { DriveFolders } from '../../../../../models';
|
||||
import { types, bool } from '../../../../../misc/schema';
|
||||
|
||||
export const meta = {
|
||||
tags: ['drive'],
|
||||
@@ -25,10 +26,13 @@ export const meta = {
|
||||
},
|
||||
|
||||
res: {
|
||||
type: 'array',
|
||||
type: types.array,
|
||||
optional: bool.false, nullable: bool.false,
|
||||
items: {
|
||||
type: 'DriveFolder',
|
||||
},
|
||||
type: types.object,
|
||||
optional: bool.false, nullable: bool.false,
|
||||
ref: 'DriveFolder',
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
@@ -3,6 +3,7 @@ import { ID } from '../../../../../misc/cafy-id';
|
||||
import define from '../../../define';
|
||||
import { ApiError } from '../../../error';
|
||||
import { DriveFolders } from '../../../../../models';
|
||||
import { types, bool } from '../../../../../misc/schema';
|
||||
|
||||
export const meta = {
|
||||
stability: 'stable',
|
||||
@@ -29,7 +30,9 @@ export const meta = {
|
||||
},
|
||||
|
||||
res: {
|
||||
type: 'DriveFolder',
|
||||
type: types.object,
|
||||
optional: bool.false, nullable: bool.false,
|
||||
ref: 'DriveFolder',
|
||||
},
|
||||
|
||||
errors: {
|
||||
|
@@ -3,6 +3,7 @@ import { ID } from '../../../../misc/cafy-id';
|
||||
import define from '../../define';
|
||||
import { DriveFiles } from '../../../../models';
|
||||
import { makePaginationQuery } from '../../common/make-pagination-query';
|
||||
import { types, bool } from '../../../../misc/schema';
|
||||
|
||||
export const meta = {
|
||||
tags: ['drive'],
|
||||
@@ -31,10 +32,13 @@ export const meta = {
|
||||
},
|
||||
|
||||
res: {
|
||||
type: 'array',
|
||||
type: types.array,
|
||||
optional: bool.false, nullable: bool.false,
|
||||
items: {
|
||||
type: 'DriveFile',
|
||||
},
|
||||
type: types.object,
|
||||
optional: bool.false, nullable: bool.false,
|
||||
ref: 'DriveFile',
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user