From 5e268f0611d91734458614ad2e9f30b779f9c070 Mon Sep 17 00:00:00 2001 From: tamaina Date: Fri, 12 May 2023 07:54:50 +0000 Subject: [PATCH] wip endpoints --- packages/misskey-js/src/endpoints.ts | 70 +++++++++++++++++++++++++ packages/misskey-js/src/schemas/user.ts | 1 + 2 files changed, 71 insertions(+) diff --git a/packages/misskey-js/src/endpoints.ts b/packages/misskey-js/src/endpoints.ts index 3d058f56a..5dc5aa5d7 100644 --- a/packages/misskey-js/src/endpoints.ts +++ b/packages/misskey-js/src/endpoints.ts @@ -159,4 +159,74 @@ export const endpoints = { res: undefined, }], }, + "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', + }, + }], + }, } as const satisfies { [x: string]: IEndpointMeta; }; diff --git a/packages/misskey-js/src/schemas/user.ts b/packages/misskey-js/src/schemas/user.ts index 6da5205a1..c865edd8b 100644 --- a/packages/misskey-js/src/schemas/user.ts +++ b/packages/misskey-js/src/schemas/user.ts @@ -477,6 +477,7 @@ export const packedUserDetailedSchema = { }], } as const satisfies JSONSchema7Definition; +// NOTE: 極力この型を使うのは避け、UserLite か UserDetailed か明示するように export const packedUserSchema = { $id: 'https://misskey-hub.net/api/schemas/User',