wip
This commit is contained in:
parent
93d111bfb6
commit
f7f8845801
3 changed files with 64 additions and 9 deletions
|
@ -30,14 +30,15 @@ export const paramDef = {
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export default class extends Endpoint<typeof meta, typeof paramDef> {
|
export default class extends Endpoint<'antennas/list'> {
|
||||||
|
name = 'antennas/list' as const;
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(DI.antennasRepository)
|
@Inject(DI.antennasRepository)
|
||||||
private antennasRepository: AntennasRepository,
|
private antennasRepository: AntennasRepository,
|
||||||
|
|
||||||
private antennaEntityService: AntennaEntityService,
|
private antennaEntityService: AntennaEntityService,
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(async (ps, me) => {
|
||||||
const antennas = await this.antennasRepository.findBy({
|
const antennas = await this.antennasRepository.findBy({
|
||||||
userId: me.id,
|
userId: me.id,
|
||||||
});
|
});
|
||||||
|
|
|
@ -50,7 +50,8 @@ export const paramDef = {
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-default-export
|
// eslint-disable-next-line import/no-default-export
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export default class extends Endpoint<typeof meta, typeof paramDef> {
|
export default class extends Endpoint<'antennas/notes'> {
|
||||||
|
name = 'antennas/notes' as const;
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(DI.redis)
|
@Inject(DI.redis)
|
||||||
private redisClient: Redis.Redis,
|
private redisClient: Redis.Redis,
|
||||||
|
@ -66,7 +67,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
private queryService: QueryService,
|
private queryService: QueryService,
|
||||||
private noteReadService: NoteReadService,
|
private noteReadService: NoteReadService,
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(async (ps, me) => {
|
||||||
const antenna = await this.antennasRepository.findOneBy({
|
const antenna = await this.antennasRepository.findOneBy({
|
||||||
id: ps.antennaId,
|
id: ps.antennaId,
|
||||||
userId: me.id,
|
userId: me.id,
|
||||||
|
|
|
@ -2032,16 +2032,16 @@ export const endpoints = {
|
||||||
},
|
},
|
||||||
res: {
|
res: {
|
||||||
$ref: 'https://misskey-hub.net/api/schemas/Antenna',
|
$ref: 'https://misskey-hub.net/api/schemas/Antenna',
|
||||||
}
|
},
|
||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
'antennas/delete': {
|
'antennas/delete': {
|
||||||
tags: ['antennas'],
|
tags: ['antennas'],
|
||||||
|
|
||||||
requireCredential: true,
|
requireCredential: true,
|
||||||
|
|
||||||
kind: 'write:account',
|
kind: 'write:account',
|
||||||
|
|
||||||
errors: {
|
errors: {
|
||||||
noSuchAntenna: {
|
noSuchAntenna: {
|
||||||
message: 'No such antenna.',
|
message: 'No such antenna.',
|
||||||
|
@ -2060,7 +2060,60 @@ export const endpoints = {
|
||||||
},
|
},
|
||||||
res: undefined,
|
res: undefined,
|
||||||
}],
|
}],
|
||||||
}
|
},
|
||||||
|
'antennas/list': {
|
||||||
|
tags: ['antennas', 'account'],
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'read:account',
|
||||||
|
|
||||||
|
defines: [{
|
||||||
|
req: undefined,
|
||||||
|
res: {
|
||||||
|
type: 'array',
|
||||||
|
items: {
|
||||||
|
$ref: 'https://misskey-hub.net/api/schemas/Antenna',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
},
|
||||||
|
'antennas/notes': {
|
||||||
|
tags: ['antennas', 'account', 'notes'],
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
|
||||||
|
kind: 'read:account',
|
||||||
|
|
||||||
|
errors: {
|
||||||
|
noSuchAntenna: {
|
||||||
|
message: 'No such antenna.',
|
||||||
|
code: 'NO_SUCH_ANTENNA',
|
||||||
|
id: '850926e0-fd3b-49b6-b69a-b28a5dbd82fe',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
defines: [{
|
||||||
|
req: {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
antennaId: { type: 'string', format: 'misskey:id' },
|
||||||
|
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
|
||||||
|
sinceId: { type: 'string', format: 'misskey:id' },
|
||||||
|
untilId: { type: 'string', format: 'misskey:id' },
|
||||||
|
sinceDate: { type: 'integer' },
|
||||||
|
untilDate: { type: 'integer' },
|
||||||
|
},
|
||||||
|
required: ['antennaId'],
|
||||||
|
},
|
||||||
|
res: {
|
||||||
|
type: 'array',
|
||||||
|
items: {
|
||||||
|
$ref: 'https://misskey-hub.net/api/schemas/Note',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
},
|
||||||
//#endregion
|
//#endregion
|
||||||
} as const satisfies { [x: string]: IEndpointMeta; };
|
} as const satisfies { [x: string]: IEndpointMeta; };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue