fix API definitions

This commit is contained in:
Johann150 2022-10-20 20:40:48 +02:00
parent ee70ad52fc
commit cfb8723618
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1
2 changed files with 43 additions and 30 deletions

View file

@ -1,4 +1,5 @@
import { Brackets } from 'typeorm'; import { Brackets } from 'typeorm';
import { noteVisibilities } from 'foundkey-js';
import read from '@/services/note/read.js'; import read from '@/services/note/read.js';
import { Notes, Followings } from '@/models/index.js'; import { Notes, Followings } from '@/models/index.js';
import define from '../../define.js'; import define from '../../define.js';
@ -31,7 +32,10 @@ export const paramDef = {
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 }, limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
sinceId: { type: 'string', format: 'misskey:id' }, sinceId: { type: 'string', format: 'misskey:id' },
untilId: { type: 'string', format: 'misskey:id' }, untilId: { type: 'string', format: 'misskey:id' },
visibility: { type: 'string' }, visibility: {
type: 'string',
enum: noteVisibilities,
},
}, },
required: [], required: [],
} as const; } as const;

View file

@ -8,6 +8,36 @@ import { ApiError } from '../../error.js';
import { getNote } from '../../common/getters.js'; import { getNote } from '../../common/getters.js';
import define from '../../define.js'; import define from '../../define.js';
const sourceLangs = [
'BG',
'CS',
'DA',
'DE',
'EL',
'EN',
'ES',
'ET',
'FI',
'FR',
'HU',
'ID',
'IT',
'JA',
'LT',
'LV',
'NL',
'PL',
'PT',
'RO',
'RU',
'SK',
'SL',
'SV',
'TR',
'UK',
'ZH',
];
export const meta = { export const meta = {
tags: ['notes'], tags: ['notes'],
@ -16,6 +46,13 @@ export const meta = {
res: { res: {
type: 'object', type: 'object',
optional: false, nullable: false, optional: false, nullable: false,
properties: {
sourceLang: {
type: 'string',
enum: sourceLangs,
},
text: { type: 'string' },
},
}, },
errors: { errors: {
@ -34,35 +71,7 @@ export const paramDef = {
noteId: { type: 'string', format: 'misskey:id' }, noteId: { type: 'string', format: 'misskey:id' },
sourceLang: { sourceLang: {
type: 'string', type: 'string',
enum: [ enum: sourceLangs,
'BG',
'CS',
'DA',
'DE',
'EL',
'EN',
'ES',
'ET',
'FI',
'FR',
'HU',
'ID',
'IT',
'JA',
'LT',
'LV',
'NL',
'PL',
'PT',
'RO',
'RU',
'SK',
'SL',
'SV',
'TR',
'UK',
'ZH',
],
}, },
targetLang: { targetLang: {
type: 'string', type: 'string',