mirror of
https://github.com/paricafe/misskey.git
synced 2024-12-02 16:26:44 -06:00
a07d753da8
* Update api document in admin/announcements * Update api document in announcements * Update api document in i/read-announcements * Update api document in username/available * Update api document & Fix typo in API 403 error * Update api document * Update api document * Update api document * Fix API permission definition * Update api document * Update api document * Update api document * Update api document * Update api document * Update api document * Update api document * Update api document * Fix bug in users (api) * Apply reviews #6757 * Apply reviews #6757 Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
52 lines
1 KiB
TypeScript
52 lines
1 KiB
TypeScript
import $ from 'cafy';
|
|
import { ID } from '../../../../misc/cafy-id';
|
|
import define from '../../define';
|
|
import { ApiError } from '../../error';
|
|
import { Antennas } from '../../../../models';
|
|
|
|
export const meta = {
|
|
desc: {
|
|
'ja-JP': '指定したアンテナの情報を取得します。',
|
|
'en-US': 'Acquires the information of the specified antenna.'
|
|
},
|
|
|
|
tags: ['antennas', 'account'],
|
|
|
|
requireCredential: true as const,
|
|
|
|
kind: 'read:account',
|
|
|
|
params: {
|
|
antennaId: {
|
|
validator: $.type(ID),
|
|
},
|
|
},
|
|
|
|
errors: {
|
|
noSuchAntenna: {
|
|
message: 'No such antenna.',
|
|
code: 'NO_SUCH_ANTENNA',
|
|
id: 'c06569fb-b025-4f23-b22d-1fcd20d2816b'
|
|
},
|
|
},
|
|
|
|
res: {
|
|
type: 'object' as const,
|
|
optional: false as const, nullable: false as const,
|
|
ref: 'Antenna'
|
|
}
|
|
};
|
|
|
|
export default define(meta, async (ps, me) => {
|
|
// Fetch the antenna
|
|
const antenna = await Antennas.findOne({
|
|
id: ps.antennaId,
|
|
userId: me.id,
|
|
});
|
|
|
|
if (antenna == null) {
|
|
throw new ApiError(meta.errors.noSuchAntenna);
|
|
}
|
|
|
|
return await Antennas.pack(antenna);
|
|
});
|