2023-05-21 15:54:39 +03:00
|
|
|
import { IEndpointMeta } from "./endpoints.types";
|
2023-05-02 19:51:41 +03:00
|
|
|
import { localUsernameSchema, passwordSchema } from "./schemas/user";
|
2023-05-02 15:05:17 +03:00
|
|
|
|
|
|
|
export const endpoints = {
|
|
|
|
"admin/accounts/create": {
|
|
|
|
tags: ['admin'],
|
|
|
|
defines: [{
|
|
|
|
req: {
|
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
username: localUsernameSchema,
|
|
|
|
password: passwordSchema,
|
|
|
|
},
|
|
|
|
required: ['username', 'password'],
|
|
|
|
},
|
|
|
|
res: {
|
2023-05-15 11:59:30 +03:00
|
|
|
allOf: [{
|
|
|
|
$ref: 'https://misskey-hub.net/api/schemas/MeDetailed',
|
|
|
|
}, {
|
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
token: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
required: ['token'],
|
|
|
|
}],
|
2023-05-02 15:05:17 +03:00
|
|
|
},
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
"admin/accounts/delete": {
|
|
|
|
tags: ['admin'],
|
|
|
|
|
|
|
|
requireCredential: true,
|
|
|
|
requireAdmin: true,
|
|
|
|
defines: [{
|
|
|
|
req: {
|
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
userId: { type: 'string', format: 'misskey:id' },
|
|
|
|
},
|
|
|
|
required: ['userId'],
|
|
|
|
},
|
|
|
|
res: undefined,
|
|
|
|
}],
|
|
|
|
},
|
2023-05-12 10:54:50 +03:00
|
|
|
"admin/ad/create": {
|
|
|
|
tags: ['admin'],
|
|
|
|
|
|
|
|
requireCredential: true,
|
|
|
|
requireModerator: true,
|
|
|
|
|
|
|
|
defines: [{
|
|
|
|
req: {
|
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
url: { type: 'string', minLength: 1 },
|
|
|
|
memo: { type: 'string' },
|
|
|
|
place: { type: 'string' },
|
|
|
|
priority: { type: 'string' },
|
|
|
|
ratio: { type: 'integer' },
|
|
|
|
expiresAt: { type: 'integer' },
|
|
|
|
startsAt: { type: 'integer' },
|
|
|
|
imageUrl: { type: 'string', minLength: 1 },
|
|
|
|
},
|
|
|
|
required: ['url', 'memo', 'place', 'priority', 'ratio', 'expiresAt', 'startsAt', 'imageUrl'],
|
|
|
|
},
|
|
|
|
res: undefined,
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
"admin/ad/delete": {
|
|
|
|
tags: ['admin'],
|
|
|
|
|
|
|
|
requireCredential: true,
|
|
|
|
requireModerator: true,
|
|
|
|
|
|
|
|
errors: {
|
|
|
|
noSuchAd: {
|
|
|
|
message: 'No such ad.',
|
|
|
|
code: 'NO_SUCH_AD',
|
|
|
|
id: 'ccac9863-3a03-416e-b899-8a64041118b1',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
defines: [{
|
|
|
|
req: {
|
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
id: { type: 'string', format: 'misskey:id' },
|
|
|
|
},
|
|
|
|
required: ['id'],
|
|
|
|
},
|
|
|
|
res: undefined,
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
"admin/ad/list": {
|
|
|
|
tags: ['admin'],
|
|
|
|
|
|
|
|
requireCredential: true,
|
|
|
|
requireModerator: true,
|
|
|
|
|
|
|
|
defines: [{
|
|
|
|
req: {
|
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
|
|
|
|
sinceId: { type: 'string', format: 'misskey:id' },
|
|
|
|
untilId: { type: 'string', format: 'misskey:id' },
|
|
|
|
},
|
|
|
|
required: [],
|
|
|
|
},
|
|
|
|
res: {
|
|
|
|
type: 'array',
|
2023-05-15 11:45:38 +03:00
|
|
|
items: {
|
|
|
|
$ref: 'https://misskey-hub.net/api/schemas/Ad',
|
|
|
|
},
|
2023-05-12 10:54:50 +03:00
|
|
|
},
|
|
|
|
}],
|
|
|
|
},
|
2023-05-15 11:30:52 +03:00
|
|
|
"admin/ad/update": {
|
|
|
|
tags: ['admin'],
|
|
|
|
|
|
|
|
requireCredential: true,
|
|
|
|
requireModerator: true,
|
|
|
|
|
|
|
|
errors: {
|
|
|
|
noSuchAd: {
|
|
|
|
message: 'No such ad.',
|
|
|
|
code: 'NO_SUCH_AD',
|
|
|
|
id: 'b7aa1727-1354-47bc-a182-3a9c3973d300',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
defines: [{
|
|
|
|
req: {
|
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
id: { type: 'string', format: 'misskey:id' },
|
|
|
|
memo: { type: 'string' },
|
|
|
|
url: { type: 'string', minLength: 1 },
|
|
|
|
imageUrl: { type: 'string', minLength: 1 },
|
|
|
|
place: { type: 'string' },
|
|
|
|
priority: { type: 'string' },
|
|
|
|
ratio: { type: 'integer' },
|
|
|
|
expiresAt: { type: 'integer' },
|
|
|
|
startsAt: { type: 'integer' },
|
|
|
|
},
|
|
|
|
required: ['id', 'memo', 'url', 'imageUrl', 'place', 'priority', 'ratio', 'expiresAt', 'startsAt'],
|
|
|
|
},
|
|
|
|
res: undefined,
|
|
|
|
}],
|
|
|
|
},
|
2023-05-15 11:59:30 +03:00
|
|
|
"admin/announcements/create": {
|
|
|
|
tags: ['admin'],
|
|
|
|
|
|
|
|
requireCredential: true,
|
|
|
|
requireModerator: true,
|
|
|
|
|
|
|
|
defines: [{
|
|
|
|
req: {
|
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
title: { type: 'string', minLength: 1 },
|
|
|
|
text: { type: 'string', minLength: 1 },
|
2023-05-15 12:19:36 +03:00
|
|
|
imageUrl: {
|
|
|
|
oneOf: [
|
|
|
|
{ type: 'string', minLength: 1 },
|
|
|
|
{ type: 'null' },
|
|
|
|
],
|
|
|
|
},
|
2023-05-15 11:59:30 +03:00
|
|
|
},
|
|
|
|
required: ['title', 'text', 'imageUrl'],
|
|
|
|
},
|
|
|
|
res: {
|
|
|
|
$ref: 'https://misskey-hub.net/api/schemas/Announcement',
|
2023-05-15 12:16:27 +03:00
|
|
|
},
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
"admin/announcements/delete": {
|
|
|
|
tags: ['admin'],
|
|
|
|
|
|
|
|
requireCredential: true,
|
|
|
|
requireModerator: true,
|
|
|
|
|
|
|
|
errors: {
|
|
|
|
noSuchAnnouncement: {
|
|
|
|
message: 'No such announcement.',
|
|
|
|
code: 'NO_SUCH_ANNOUNCEMENT',
|
|
|
|
id: 'ecad8040-a276-4e85-bda9-015a708d291e',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
defines: [{
|
|
|
|
req: {
|
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
id: { type: 'string', format: 'misskey:id' },
|
|
|
|
},
|
|
|
|
required: ['id'],
|
|
|
|
},
|
|
|
|
res: undefined,
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
"admin/announcements/list": {
|
|
|
|
tags: ['admin'],
|
|
|
|
|
|
|
|
requireCredential: true,
|
|
|
|
requireModerator: true,
|
|
|
|
|
|
|
|
defines: [{
|
|
|
|
req: {
|
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
|
|
|
|
sinceId: { type: 'string', format: 'misskey:id' },
|
|
|
|
untilId: { type: 'string', format: 'misskey:id' },
|
|
|
|
},
|
|
|
|
required: [],
|
|
|
|
},
|
|
|
|
res: {
|
|
|
|
type: 'array',
|
|
|
|
items: {
|
|
|
|
$ref: 'https://misskey-hub.net/api/schemas/Announcement',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
"admin/announcements/update": {
|
|
|
|
tags: ['admin'],
|
|
|
|
|
|
|
|
requireCredential: true,
|
|
|
|
requireModerator: true,
|
|
|
|
|
|
|
|
errors: {
|
|
|
|
noSuchAnnouncement: {
|
|
|
|
message: 'No such announcement.',
|
|
|
|
code: 'NO_SUCH_ANNOUNCEMENT',
|
|
|
|
id: 'd3aae5a7-6372-4cb4-b61c-f511ffc2d7cc',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
defines: [{
|
|
|
|
req: {
|
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
id: { type: 'string', format: 'misskey:id' },
|
|
|
|
title: { type: 'string', minLength: 1 },
|
|
|
|
text: { type: 'string', minLength: 1 },
|
2023-05-15 12:19:36 +03:00
|
|
|
imageUrl: {
|
|
|
|
oneOf: [
|
|
|
|
{ type: 'string', minLength: 1 },
|
|
|
|
{ type: 'null' },
|
|
|
|
],
|
|
|
|
},
|
2023-05-15 12:16:27 +03:00
|
|
|
},
|
|
|
|
required: ['id', 'title', 'text', 'imageUrl'],
|
|
|
|
},
|
|
|
|
res: undefined,
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
"admin/drive/clean-remote-files": {
|
|
|
|
tags: ['admin'],
|
|
|
|
|
|
|
|
requireCredential: true,
|
|
|
|
requireModerator: true,
|
|
|
|
|
|
|
|
defines: [{
|
|
|
|
req: undefined,
|
|
|
|
res: undefined,
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
"admin/drive/clenaup": {
|
|
|
|
tags: ['admin'],
|
|
|
|
|
|
|
|
requireCredential: true,
|
|
|
|
requireModerator: true,
|
|
|
|
|
|
|
|
defines: [{
|
|
|
|
req: undefined,
|
|
|
|
res: undefined,
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
"admin/drive/files": {
|
|
|
|
tags: ['admin'],
|
|
|
|
|
|
|
|
requireCredential: true,
|
|
|
|
requireModerator: true,
|
|
|
|
|
|
|
|
defines: [{
|
|
|
|
req: {
|
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
|
|
|
|
sinceId: { type: 'string', format: 'misskey:id' },
|
|
|
|
untilId: { type: 'string', format: 'misskey:id' },
|
2023-05-15 12:19:36 +03:00
|
|
|
userId: {
|
|
|
|
oneOf: [
|
|
|
|
{ type: 'string', format: 'misskey:id' },
|
|
|
|
{ type: 'null' },
|
|
|
|
],
|
|
|
|
},
|
|
|
|
type: {
|
|
|
|
oneOf: [
|
|
|
|
{ type: 'string', pattern: /^[a-zA-Z0-9\/\-*]+$/.toString().slice(1, -1) },
|
|
|
|
{ type: 'null' },
|
|
|
|
],
|
|
|
|
},
|
2023-05-15 12:16:27 +03:00
|
|
|
origin: { type: 'string', enum: ['combined', 'local', 'remote'], default: 'local' },
|
|
|
|
hostname: {
|
2023-05-15 12:19:36 +03:00
|
|
|
oneOf: [
|
|
|
|
{
|
|
|
|
type: 'string',
|
|
|
|
default: null,
|
|
|
|
description: 'The local host is represented with `null`.',
|
|
|
|
},
|
|
|
|
{ type: 'null' },
|
|
|
|
],
|
2023-05-15 12:16:27 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
required: [],
|
|
|
|
},
|
|
|
|
res: {
|
|
|
|
type: 'array',
|
|
|
|
items: {
|
|
|
|
$ref: 'https://misskey-hub.net/api/schemas/DriveFile',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}],
|
|
|
|
},
|
|
|
|
"admin/drive/show-file": {
|
|
|
|
tags: ['admin'],
|
|
|
|
|
|
|
|
requireCredential: true,
|
|
|
|
requireModerator: true,
|
|
|
|
|
|
|
|
errors: {
|
|
|
|
noSuchFile: {
|
|
|
|
message: 'No such file.',
|
|
|
|
code: 'NO_SUCH_FILE',
|
|
|
|
id: 'caf3ca38-c6e5-472e-a30c-b05377dcc240',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
defines: [{
|
|
|
|
req: {
|
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
fileId: { type: 'string', format: 'misskey:id' },
|
|
|
|
url: { type: 'string' },
|
|
|
|
},
|
|
|
|
anyOf: [
|
|
|
|
{ required: ['fileId'] },
|
|
|
|
{ required: ['url'] },
|
|
|
|
],
|
|
|
|
},
|
|
|
|
res: {
|
|
|
|
allOf: [{
|
|
|
|
$ref: 'https://misskey-hub.net/api/schemas/DriveFile',
|
|
|
|
}, {
|
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
requestIp: {
|
|
|
|
type: ['string', 'null'],
|
|
|
|
},
|
|
|
|
requestHeaders: {
|
|
|
|
oneOf: [{
|
|
|
|
type: 'object',
|
|
|
|
}, {
|
|
|
|
type: 'null',
|
|
|
|
}],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
required: ['requestIp', 'requestHeaders'],
|
|
|
|
}],
|
|
|
|
},
|
2023-05-15 11:59:30 +03:00
|
|
|
}],
|
|
|
|
},
|
2023-05-02 20:31:17 +03:00
|
|
|
} as const satisfies { [x: string]: IEndpointMeta; };
|