2023-07-27 14:31:52 +09:00
|
|
|
/*
|
2024-02-13 15:59:27 +00:00
|
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 14:31:52 +09:00
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
*/
|
|
|
|
|
|
2024-10-07 18:56:48 -04:00
|
|
|
import { Injectable } from '@nestjs/common';
|
2022-09-18 03:27:08 +09:00
|
|
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
|
|
|
|
import { FollowingEntityService } from '@/core/entities/FollowingEntityService.js';
|
2020-01-30 04:37:25 +09:00
|
|
|
|
|
|
|
|
export const meta = {
|
2020-04-03 22:42:29 +09:00
|
|
|
tags: ['federation'],
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2024-10-04 17:55:02 -04:00
|
|
|
requireCredential: true,
|
|
|
|
|
kind: 'read:account',
|
2020-01-30 04:37:25 +09:00
|
|
|
|
|
|
|
|
res: {
|
2022-01-18 22:27:10 +09:00
|
|
|
type: 'array',
|
|
|
|
|
optional: false, nullable: false,
|
2020-01-30 04:37:25 +09:00
|
|
|
items: {
|
2022-01-18 22:27:10 +09:00
|
|
|
type: 'object',
|
|
|
|
|
optional: false, nullable: false,
|
2020-01-30 04:37:25 +09:00
|
|
|
ref: 'Following',
|
2021-12-09 23:58:30 +09:00
|
|
|
},
|
2020-01-30 04:37:25 +09:00
|
|
|
},
|
2022-01-18 22:27:10 +09:00
|
|
|
} as const;
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2022-02-20 13:15:40 +09:00
|
|
|
export const paramDef = {
|
2022-02-19 14:05:32 +09:00
|
|
|
type: 'object',
|
|
|
|
|
properties: {
|
|
|
|
|
host: { type: 'string' },
|
|
|
|
|
sinceId: { type: 'string', format: 'misskey:id' },
|
|
|
|
|
untilId: { type: 'string', format: 'misskey:id' },
|
|
|
|
|
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
|
2024-10-07 16:23:24 +02:00
|
|
|
includeFollower: { type: 'boolean', default: false },
|
2024-10-07 16:47:15 +02:00
|
|
|
includeFollowee: { type: 'boolean', default: true },
|
2022-02-19 14:05:32 +09:00
|
|
|
},
|
|
|
|
|
required: ['host'],
|
|
|
|
|
} as const;
|
|
|
|
|
|
2022-09-18 03:27:08 +09:00
|
|
|
@Injectable()
|
2023-08-17 21:20:58 +09:00
|
|
|
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
2022-09-18 03:27:08 +09:00
|
|
|
constructor(
|
|
|
|
|
private followingEntityService: FollowingEntityService,
|
|
|
|
|
) {
|
|
|
|
|
super(meta, paramDef, async (ps, me) => {
|
2024-10-07 18:56:48 -04:00
|
|
|
return this.followingEntityService.getFollowing(me, ps);
|
2022-09-18 03:27:08 +09:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|