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,33 +8,7 @@ import { ApiError } from '../../error.js';
import { getNote } from '../../common/getters.js';
import define from '../../define.js';
export const meta = {
tags: ['notes'],
requireCredential: false,
res: {
type: 'object',
optional: false, nullable: false,
},
errors: {
noSuchNote: {
message: 'No such note.',
code: 'NO_SUCH_NOTE',
id: 'bea9b03f-36e0-49c5-a4db-627a029f8971',
},
},
} as const;
// List of permitted languages from https://www.deepl.com/docs-api/translate-text/translate-text/
export const paramDef = {
type: 'object',
properties: {
noteId: { type: 'string', format: 'misskey:id' },
sourceLang: {
type: 'string',
enum: [
const sourceLangs = [
'BG',
'CS',
'DA',
@ -62,7 +36,42 @@ export const paramDef = {
'TR',
'UK',
'ZH',
],
];
export const meta = {
tags: ['notes'],
requireCredential: false,
res: {
type: 'object',
optional: false, nullable: false,
properties: {
sourceLang: {
type: 'string',
enum: sourceLangs,
},
text: { type: 'string' },
},
},
errors: {
noSuchNote: {
message: 'No such note.',
code: 'NO_SUCH_NOTE',
id: 'bea9b03f-36e0-49c5-a4db-627a029f8971',
},
},
} as const;
// List of permitted languages from https://www.deepl.com/docs-api/translate-text/translate-text/
export const paramDef = {
type: 'object',
properties: {
noteId: { type: 'string', format: 'misskey:id' },
sourceLang: {
type: 'string',
enum: sourceLangs,
},
targetLang: {
type: 'string',