forked from FoundKeyGang/FoundKey
fix API definitions
This commit is contained in:
parent
ee70ad52fc
commit
cfb8723618
2 changed files with 43 additions and 30 deletions
|
@ -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;
|
||||||
|
|
|
@ -8,33 +8,7 @@ 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';
|
||||||
|
|
||||||
export const meta = {
|
const sourceLangs = [
|
||||||
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: [
|
|
||||||
'BG',
|
'BG',
|
||||||
'CS',
|
'CS',
|
||||||
'DA',
|
'DA',
|
||||||
|
@ -62,7 +36,42 @@ export const paramDef = {
|
||||||
'TR',
|
'TR',
|
||||||
'UK',
|
'UK',
|
||||||
'ZH',
|
'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: {
|
targetLang: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
|
Loading…
Reference in a new issue