1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-25 22:34:04 +02:00
This commit is contained in:
tamaina
2023-07-03 06:14:32 +00:00
parent ae3ce71bb2
commit 726fdb9e93
10 changed files with 160 additions and 339 deletions

View File

@@ -4702,6 +4702,125 @@ export const endpoints = {
}]
},
//#endregion
//#region following
'following/requests/accept': {
tags: ['following', 'account'],
requireCredential: true,
kind: 'write:following',
errors: {
noSuchUser: {
message: 'No such user.',
code: 'NO_SUCH_USER',
id: '66ce1645-d66c-46bb-8b79-96739af885bd',
},
noFollowRequest: {
message: 'No follow request.',
code: 'NO_FOLLOW_REQUEST',
id: 'bcde4f8b-0913-4614-8881-614e522fb041',
},
},
defines: [{
req: {
type: 'object',
properties: {
userId: { type: 'string', format: 'misskey:id' },
},
required: ['userId'],
},
res: undefined,
}]
},
'following/requests/cancel': {
tags: ['following', 'account'],
requireCredential: true,
kind: 'write:following',
errors: {
noSuchUser: {
message: 'No such user.',
code: 'NO_SUCH_USER',
id: '4e68c551-fc4c-4e46-bb41-7d4a37bf9dab',
},
followRequestNotFound: {
message: 'Follow request not found.',
code: 'FOLLOW_REQUEST_NOT_FOUND',
id: '089b125b-d338-482a-9a09-e2622ac9f8d4',
},
},
defines: [{
req: {
type: 'object',
properties: {
userId: { type: 'string', format: 'misskey:id' },
},
required: ['userId'],
},
res: {
$ref: 'https://misskey-hub.net/api/schemas/UserLite',
}
}]
},
'following/requests/list': {
tags: ['following', 'account'],
requireCredential: true,
kind: 'read:following',
defines: [{
req: {
type: 'object',
properties: {
sinceId: { type: 'string', format: 'misskey:id' },
untilId: { type: 'string', format: 'misskey:id' },
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
},
required: [],
},
res: {
type: 'array',
items: {
$ref: 'https://misskey-hub.net/api/schemas/FollowRequest',
},
}
}]
},
'following/requests/reject': {
tags: ['following', 'account'],
requireCredential: true,
kind: 'write:following',
errors: {
noSuchUser: {
message: 'No such user.',
code: 'NO_SUCH_USER',
id: 'abc2ffa6-25b2-4380-ba99-321ff3a94555',
},
},
defines: [{
req: {
type: 'object',
properties: {
userId: { type: 'string', format: 'misskey:id' },
},
required: ['userId'],
},
res: undefined,
}]
},
//#endregion
} as const satisfies { [x: string]: IEndpointMeta; };
/**

View File

@@ -122,11 +122,7 @@ export type Stats = {
export type AuthSession = Packed<'AuthSession'>;
export type FollowRequest = {
id: ID;
follower: User;
followee: User;
};
export type FollowRequest = Packed<'FollowRequest'>;
export type FollowingFolloweePopulated = Following & {
followee: UserDetailed;

View File

@@ -18,7 +18,10 @@ import { packedUserListSchema } from './schemas/user-list.js';
import { packedAppSchema } from './schemas/app.js';
import { packedDriveFileSchema } from './schemas/drive-file.js';
import { packedDriveFolderSchema } from './schemas/drive-folder.js';
import { packedFollowingSchema } from './schemas/following.js';
import {
packedFollowingSchema,
packedFollowRequestSchema,
} from './schemas/following.js';
import { packedMutingSchema } from './schemas/muting.js';
import { packedRenoteMutingSchema } from './schemas/renote-muting.js';
import { packedBlockingSchema } from './schemas/blocking.js';
@@ -82,6 +85,7 @@ export const refs = {
DriveFile: packedDriveFileSchema,
DriveFolder: packedDriveFolderSchema,
Following: packedFollowingSchema,
FollowRequest: packedFollowRequestSchema,
Muting: packedMutingSchema,
RenoteMuting: packedRenoteMutingSchema,
Blocking: packedBlockingSchema,

View File

@@ -22,3 +22,19 @@ export const packedFollowingSchema = {
'followerId',
],
} as const satisfies JSONSchema7Definition;
export const packedFollowRequestSchema = {
$id: 'https://misskey-hub.net/api/schemas/FollowRequest',
type: 'object',
properties: {
id: { $ref: 'https://misskey-hub.net/api/schemas/Id' },
followee: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' },
follower: { $ref: 'https://misskey-hub.net/api/schemas/UserLite' },
},
required: [
'id',
'followee',
'follower',
],
} as const satisfies JSONSchema7Definition;