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

View file

@ -8,6 +8,36 @@ import { ApiError } from '../../error.js';
import { getNote } from '../../common/getters.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 = {
tags: ['notes'],
@ -16,6 +46,13 @@ export const meta = {
res: {
type: 'object',
optional: false, nullable: false,
properties: {
sourceLang: {
type: 'string',
enum: sourceLangs,
},
text: { type: 'string' },
},
},
errors: {
@ -34,35 +71,7 @@ export const paramDef = {
noteId: { type: 'string', format: 'misskey:id' },
sourceLang: {
type: 'string',
enum: [
'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',
],
enum: sourceLangs,
},
targetLang: {
type: 'string',