mirror of
https://github.com/kokonect-link/cherrypick
synced 2024-12-13 14:18:26 +09:00
Added notes/events/search endpoint logic
This commit is contained in:
parent
44d05d58c4
commit
1a797eee35
@ -254,6 +254,7 @@ import * as ep___notes_localTimeline from './endpoints/notes/local-timeline.js';
|
|||||||
import * as ep___notes_mentions from './endpoints/notes/mentions.js';
|
import * as ep___notes_mentions from './endpoints/notes/mentions.js';
|
||||||
import * as ep___notes_polls_recommendation from './endpoints/notes/polls/recommendation.js';
|
import * as ep___notes_polls_recommendation from './endpoints/notes/polls/recommendation.js';
|
||||||
import * as ep___notes_polls_vote from './endpoints/notes/polls/vote.js';
|
import * as ep___notes_polls_vote from './endpoints/notes/polls/vote.js';
|
||||||
|
import * as ep___notes_events_search from './endpoints/notes/events/search.js';
|
||||||
import * as ep___notes_reactions from './endpoints/notes/reactions.js';
|
import * as ep___notes_reactions from './endpoints/notes/reactions.js';
|
||||||
import * as ep___notes_reactions_create from './endpoints/notes/reactions/create.js';
|
import * as ep___notes_reactions_create from './endpoints/notes/reactions/create.js';
|
||||||
import * as ep___notes_reactions_delete from './endpoints/notes/reactions/delete.js';
|
import * as ep___notes_reactions_delete from './endpoints/notes/reactions/delete.js';
|
||||||
@ -588,6 +589,7 @@ const $notes_localTimeline: Provider = { provide: 'ep:notes/local-timeline', use
|
|||||||
const $notes_mentions: Provider = { provide: 'ep:notes/mentions', useClass: ep___notes_mentions.default };
|
const $notes_mentions: Provider = { provide: 'ep:notes/mentions', useClass: ep___notes_mentions.default };
|
||||||
const $notes_polls_recommendation: Provider = { provide: 'ep:notes/polls/recommendation', useClass: ep___notes_polls_recommendation.default };
|
const $notes_polls_recommendation: Provider = { provide: 'ep:notes/polls/recommendation', useClass: ep___notes_polls_recommendation.default };
|
||||||
const $notes_polls_vote: Provider = { provide: 'ep:notes/polls/vote', useClass: ep___notes_polls_vote.default };
|
const $notes_polls_vote: Provider = { provide: 'ep:notes/polls/vote', useClass: ep___notes_polls_vote.default };
|
||||||
|
const $notes_events_search: Provider = { provide: 'ep:notes/events/search', useClass: ep___notes_events_search.default };
|
||||||
const $notes_reactions: Provider = { provide: 'ep:notes/reactions', useClass: ep___notes_reactions.default };
|
const $notes_reactions: Provider = { provide: 'ep:notes/reactions', useClass: ep___notes_reactions.default };
|
||||||
const $notes_reactions_create: Provider = { provide: 'ep:notes/reactions/create', useClass: ep___notes_reactions_create.default };
|
const $notes_reactions_create: Provider = { provide: 'ep:notes/reactions/create', useClass: ep___notes_reactions_create.default };
|
||||||
const $notes_reactions_delete: Provider = { provide: 'ep:notes/reactions/delete', useClass: ep___notes_reactions_delete.default };
|
const $notes_reactions_delete: Provider = { provide: 'ep:notes/reactions/delete', useClass: ep___notes_reactions_delete.default };
|
||||||
@ -926,6 +928,7 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention
|
|||||||
$notes_mentions,
|
$notes_mentions,
|
||||||
$notes_polls_recommendation,
|
$notes_polls_recommendation,
|
||||||
$notes_polls_vote,
|
$notes_polls_vote,
|
||||||
|
$notes_events_search,
|
||||||
$notes_reactions,
|
$notes_reactions,
|
||||||
$notes_reactions_create,
|
$notes_reactions_create,
|
||||||
$notes_reactions_delete,
|
$notes_reactions_delete,
|
||||||
@ -1258,6 +1261,7 @@ const $retention: Provider = { provide: 'ep:retention', useClass: ep___retention
|
|||||||
$notes_mentions,
|
$notes_mentions,
|
||||||
$notes_polls_recommendation,
|
$notes_polls_recommendation,
|
||||||
$notes_polls_vote,
|
$notes_polls_vote,
|
||||||
|
$notes_events_search,
|
||||||
$notes_reactions,
|
$notes_reactions,
|
||||||
$notes_reactions_create,
|
$notes_reactions_create,
|
||||||
$notes_reactions_delete,
|
$notes_reactions_delete,
|
||||||
|
@ -254,6 +254,7 @@ import * as ep___notes_localTimeline from './endpoints/notes/local-timeline.js';
|
|||||||
import * as ep___notes_mentions from './endpoints/notes/mentions.js';
|
import * as ep___notes_mentions from './endpoints/notes/mentions.js';
|
||||||
import * as ep___notes_polls_recommendation from './endpoints/notes/polls/recommendation.js';
|
import * as ep___notes_polls_recommendation from './endpoints/notes/polls/recommendation.js';
|
||||||
import * as ep___notes_polls_vote from './endpoints/notes/polls/vote.js';
|
import * as ep___notes_polls_vote from './endpoints/notes/polls/vote.js';
|
||||||
|
import * as ep___notes_events_search from './endpoints/notes/events/search.js';
|
||||||
import * as ep___notes_reactions from './endpoints/notes/reactions.js';
|
import * as ep___notes_reactions from './endpoints/notes/reactions.js';
|
||||||
import * as ep___notes_reactions_create from './endpoints/notes/reactions/create.js';
|
import * as ep___notes_reactions_create from './endpoints/notes/reactions/create.js';
|
||||||
import * as ep___notes_reactions_delete from './endpoints/notes/reactions/delete.js';
|
import * as ep___notes_reactions_delete from './endpoints/notes/reactions/delete.js';
|
||||||
@ -586,6 +587,7 @@ const eps = [
|
|||||||
['notes/mentions', ep___notes_mentions],
|
['notes/mentions', ep___notes_mentions],
|
||||||
['notes/polls/recommendation', ep___notes_polls_recommendation],
|
['notes/polls/recommendation', ep___notes_polls_recommendation],
|
||||||
['notes/polls/vote', ep___notes_polls_vote],
|
['notes/polls/vote', ep___notes_polls_vote],
|
||||||
|
['notes/events/search', ep___notes_events_search],
|
||||||
['notes/reactions', ep___notes_reactions],
|
['notes/reactions', ep___notes_reactions],
|
||||||
['notes/reactions/create', ep___notes_reactions_create],
|
['notes/reactions/create', ep___notes_reactions_create],
|
||||||
['notes/reactions/delete', ep___notes_reactions_delete],
|
['notes/reactions/delete', ep___notes_reactions_delete],
|
||||||
|
134
packages/backend/src/server/api/endpoints/notes/events/search.ts
Normal file
134
packages/backend/src/server/api/endpoints/notes/events/search.ts
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
|
import { Brackets } from 'typeorm';
|
||||||
|
import { Event } from '@/models/entities/Event.js';
|
||||||
|
import type { NotesRepository } from '@/models/index.js';
|
||||||
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
|
import { QueryService } from '@/core/QueryService.js';
|
||||||
|
import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
|
||||||
|
import type { Config } from '@/config.js';
|
||||||
|
import { DI } from '@/di-symbols.js';
|
||||||
|
import { RoleService } from '@/core/RoleService.js';
|
||||||
|
import { ApiError } from '../../../error.js';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
tags: ['notes'],
|
||||||
|
|
||||||
|
requireCredential: false,
|
||||||
|
|
||||||
|
res: {
|
||||||
|
type: 'array',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
items: {
|
||||||
|
type: 'object',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
ref: 'Note',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
errors: {
|
||||||
|
unavailable: {
|
||||||
|
message: 'Search of notes unavailable.',
|
||||||
|
code: 'UNAVAILABLE',
|
||||||
|
id: '0b44998d-77aa-4427-80d0-d2c9b8523011',
|
||||||
|
},
|
||||||
|
invalidParam: {
|
||||||
|
message: 'Invalid Parameter',
|
||||||
|
code: 'INVALID_PARAM',
|
||||||
|
id: 'e70903d3-0aa2-44d5-a955-4de5723c603d',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export const paramDef = {
|
||||||
|
type: 'object',
|
||||||
|
properties: {
|
||||||
|
sinceId: { type: 'string', format: 'misskey:id' },
|
||||||
|
untilId: { type: 'string', format: 'misskey:id' },
|
||||||
|
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
|
||||||
|
host: {
|
||||||
|
type: 'string',
|
||||||
|
nullable: true,
|
||||||
|
description: 'The local host is represented with `null`.',
|
||||||
|
},
|
||||||
|
users: { type: 'array', nullable: true, items: { type: 'object', format: 'misskey:id' } },
|
||||||
|
sinceDate: { type: 'integer', nullable: true },
|
||||||
|
untilDate: { type: 'integer', nullable: true },
|
||||||
|
filters: {
|
||||||
|
type: 'object',
|
||||||
|
nullable: true,
|
||||||
|
description: 'mapping of string -> [string] that filters events based on metadata',
|
||||||
|
},
|
||||||
|
sortBy: { type: 'string', nullable: true, default: 'startDate', enum: ['startDate', 'createdAt'] },
|
||||||
|
},
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
// eslint-disable-next-line import/no-default-export
|
||||||
|
@Injectable()
|
||||||
|
export default class extends Endpoint<typeof meta, typeof paramDef> {
|
||||||
|
constructor(
|
||||||
|
@Inject(DI.config)
|
||||||
|
private config: Config,
|
||||||
|
|
||||||
|
@Inject(DI.notesRepository)
|
||||||
|
private notesRepository: NotesRepository,
|
||||||
|
|
||||||
|
private noteEntityService: NoteEntityService,
|
||||||
|
private queryService: QueryService,
|
||||||
|
private roleService: RoleService,
|
||||||
|
) {
|
||||||
|
super(meta, paramDef, async (ps, me) => {
|
||||||
|
const policies = await this.roleService.getUserPolicies(me ? me.id : null);
|
||||||
|
if (!policies.canSearchNotes) {
|
||||||
|
throw new ApiError(meta.errors.unavailable);
|
||||||
|
}
|
||||||
|
|
||||||
|
const query = this.queryService.makePaginationQuery(this.notesRepository.createQueryBuilder('note'), ps.sinceId, ps.untilId);
|
||||||
|
|
||||||
|
if (ps.users) {
|
||||||
|
if (ps.users.length < 1) throw new ApiError(meta.errors.invalidParam);
|
||||||
|
query.andWhere('note.userId IN (:...users)', { users: ps.users });
|
||||||
|
}
|
||||||
|
|
||||||
|
query
|
||||||
|
.innerJoinAndSelect(Event, 'event', 'event.noteId = note.id')
|
||||||
|
.innerJoinAndSelect('note.user', 'user');
|
||||||
|
|
||||||
|
if (ps.filters) {
|
||||||
|
const filters: Record<string, (string | null)[]> = ps.filters;
|
||||||
|
|
||||||
|
Object.keys(filters).forEach(f => {
|
||||||
|
const matches = filters[f].filter(x => x !== null);
|
||||||
|
if (matches.length < 1) throw new ApiError(meta.errors.invalidParam);
|
||||||
|
query.andWhere(new Brackets((qb) => {
|
||||||
|
qb.where('event.metadata ->> :key IN (:...values)', { key: f, values: filters[f].filter(x => x !== null) });
|
||||||
|
if (filters[f].filter(x => x === null).length > 0) {
|
||||||
|
qb.orWhere('event.metadata ->> :key IS NULL', { key: f });
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ps.sinceDate && ps.untilDate && ps.sinceDate > ps.untilDate) throw new ApiError(meta.errors.invalidParam);
|
||||||
|
const sinceDate = ps.sinceDate ? new Date(ps.sinceDate) : new Date();
|
||||||
|
query.andWhere('event.start > :sinceDate', { sinceDate: sinceDate })
|
||||||
|
.andWhere('(event.end IS NULL OR event.end > :sinceDate)', { sinceDate: sinceDate });
|
||||||
|
if (ps.untilDate) {
|
||||||
|
query.andWhere('event.start < :untilDate', { untilDate: new Date(ps.untilDate) });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ps.sortBy === 'createdAt') {
|
||||||
|
query.orderBy('note.createdAt', 'ASC');
|
||||||
|
} else {
|
||||||
|
query.orderBy('event.start', 'ASC');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.queryService.generateVisibilityQuery(query, me);
|
||||||
|
if (me) this.queryService.generateMutedUserQuery(query, me);
|
||||||
|
if (me) this.queryService.generateBlockedUserQuery(query, me);
|
||||||
|
|
||||||
|
const notes = await query.take(ps.limit).getMany();
|
||||||
|
|
||||||
|
return await this.noteEntityService.packMany(notes, me);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -1757,6 +1757,20 @@ export type Endpoints = {
|
|||||||
};
|
};
|
||||||
res: null;
|
res: null;
|
||||||
};
|
};
|
||||||
|
'notes/events/search': {
|
||||||
|
req: {
|
||||||
|
sinceId?: Note['id'];
|
||||||
|
untilId?: Note['id'];
|
||||||
|
limit?: number;
|
||||||
|
offset?: number;
|
||||||
|
host?: string;
|
||||||
|
users?: User['id'][];
|
||||||
|
sinceDate?: number;
|
||||||
|
untilDate?: number;
|
||||||
|
filters?: Record<string, string[]>;
|
||||||
|
sortBy?: 'startDate' | 'createAt'
|
||||||
|
res: Note[];
|
||||||
|
};
|
||||||
'notes/reactions': {
|
'notes/reactions': {
|
||||||
req: {
|
req: {
|
||||||
noteId: Note['id'];
|
noteId: Note['id'];
|
||||||
@ -2154,9 +2168,9 @@ export type Endpoints = {
|
|||||||
req: TODO;
|
req: TODO;
|
||||||
res: TODO;
|
res: TODO;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
declare namespace entities {
|
declare namespace entities {
|
||||||
export {
|
export {
|
||||||
ID,
|
ID,
|
||||||
DateString,
|
DateString,
|
||||||
@ -2199,11 +2213,11 @@ declare namespace entities {
|
|||||||
UserSorting,
|
UserSorting,
|
||||||
OriginType
|
OriginType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export { entities }
|
export { entities }
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type FetchLike = (input: string, init?: {
|
type FetchLike = (input: string, init?: {
|
||||||
method?: string;
|
method?: string;
|
||||||
body?: string;
|
body?: string;
|
||||||
credentials?: RequestCredentials;
|
credentials?: RequestCredentials;
|
||||||
@ -2211,41 +2225,41 @@ type FetchLike = (input: string, init?: {
|
|||||||
headers: {
|
headers: {
|
||||||
[key in string]: string;
|
[key in string]: string;
|
||||||
};
|
};
|
||||||
}) => Promise<{
|
}) => Promise<{
|
||||||
status: number;
|
status: number;
|
||||||
json(): Promise<any>;
|
json(): Promise<any>;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
export const ffVisibility: readonly ["public", "followers", "private"];
|
export const ffVisibility: readonly ["public", "followers", "private"];
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type Following = {
|
type Following = {
|
||||||
id: ID;
|
id: ID;
|
||||||
createdAt: DateString;
|
createdAt: DateString;
|
||||||
followerId: User['id'];
|
followerId: User['id'];
|
||||||
followeeId: User['id'];
|
followeeId: User['id'];
|
||||||
};
|
};
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type FollowingFolloweePopulated = Following & {
|
type FollowingFolloweePopulated = Following & {
|
||||||
followee: UserDetailed;
|
followee: UserDetailed;
|
||||||
};
|
};
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type FollowingFollowerPopulated = Following & {
|
type FollowingFollowerPopulated = Following & {
|
||||||
follower: UserDetailed;
|
follower: UserDetailed;
|
||||||
};
|
};
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type FollowRequest = {
|
type FollowRequest = {
|
||||||
id: ID;
|
id: ID;
|
||||||
follower: User;
|
follower: User;
|
||||||
followee: User;
|
followee: User;
|
||||||
};
|
};
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type GalleryPost = {
|
type GalleryPost = {
|
||||||
id: ID;
|
id: ID;
|
||||||
createdAt: DateString;
|
createdAt: DateString;
|
||||||
updatedAt: DateString;
|
updatedAt: DateString;
|
||||||
@ -2258,13 +2272,13 @@ type GalleryPost = {
|
|||||||
isSensitive: boolean;
|
isSensitive: boolean;
|
||||||
likedCount: number;
|
likedCount: number;
|
||||||
isLiked?: boolean;
|
isLiked?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type ID = string;
|
type ID = string;
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type Instance = {
|
type Instance = {
|
||||||
id: ID;
|
id: ID;
|
||||||
caughtAt: DateString;
|
caughtAt: DateString;
|
||||||
host: string;
|
host: string;
|
||||||
@ -2291,16 +2305,16 @@ type Instance = {
|
|||||||
faviconUrl: string | null;
|
faviconUrl: string | null;
|
||||||
themeColor: string | null;
|
themeColor: string | null;
|
||||||
infoUpdatedAt: DateString | null;
|
infoUpdatedAt: DateString | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type InstanceMetadata = LiteInstanceMetadata | DetailedInstanceMetadata;
|
type InstanceMetadata = LiteInstanceMetadata | DetailedInstanceMetadata;
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
function isAPIError(reason: any): reason is APIError;
|
function isAPIError(reason: any): reason is APIError;
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type LiteInstanceMetadata = {
|
type LiteInstanceMetadata = {
|
||||||
maintainerName: string | null;
|
maintainerName: string | null;
|
||||||
maintainerEmail: string | null;
|
maintainerEmail: string | null;
|
||||||
version: string;
|
version: string;
|
||||||
@ -2348,10 +2362,10 @@ type LiteInstanceMetadata = {
|
|||||||
imageUrl: string;
|
imageUrl: string;
|
||||||
}[];
|
}[];
|
||||||
translatorAvailable: boolean;
|
translatorAvailable: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type MeDetailed = UserDetailed & {
|
type MeDetailed = UserDetailed & {
|
||||||
avatarId: DriveFile['id'];
|
avatarId: DriveFile['id'];
|
||||||
bannerId: DriveFile['id'];
|
bannerId: DriveFile['id'];
|
||||||
autoAcceptFollowed: boolean;
|
autoAcceptFollowed: boolean;
|
||||||
@ -2376,10 +2390,10 @@ type MeDetailed = UserDetailed & {
|
|||||||
receiveAnnouncementEmail: boolean;
|
receiveAnnouncementEmail: boolean;
|
||||||
usePasswordLessLogin: boolean;
|
usePasswordLessLogin: boolean;
|
||||||
[other: string]: any;
|
[other: string]: any;
|
||||||
};
|
};
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type MessagingMessage = {
|
type MessagingMessage = {
|
||||||
id: ID;
|
id: ID;
|
||||||
createdAt: DateString;
|
createdAt: DateString;
|
||||||
file: DriveFile | null;
|
file: DriveFile | null;
|
||||||
@ -2393,13 +2407,13 @@ type MessagingMessage = {
|
|||||||
recipientId: User['id'] | null;
|
recipientId: User['id'] | null;
|
||||||
group?: UserGroup | null;
|
group?: UserGroup | null;
|
||||||
groupId: UserGroup['id'] | null;
|
groupId: UserGroup['id'] | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
export const mutedNoteReasons: readonly ["word", "manual", "spam", "other"];
|
export const mutedNoteReasons: readonly ["word", "manual", "spam", "other"];
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type Note = {
|
type Note = {
|
||||||
id: ID;
|
id: ID;
|
||||||
createdAt: DateString;
|
createdAt: DateString;
|
||||||
text: string | null;
|
text: string | null;
|
||||||
@ -2410,6 +2424,12 @@ type Note = {
|
|||||||
replyId: Note['id'];
|
replyId: Note['id'];
|
||||||
renote?: Note;
|
renote?: Note;
|
||||||
renoteId: Note['id'];
|
renoteId: Note['id'];
|
||||||
|
event?: {
|
||||||
|
title: string;
|
||||||
|
start: DateString;
|
||||||
|
end: DateString | null;
|
||||||
|
metadata: Record<string, string[]>;
|
||||||
|
};
|
||||||
files: DriveFile[];
|
files: DriveFile[];
|
||||||
fileIds: DriveFile['id'][];
|
fileIds: DriveFile['id'][];
|
||||||
visibility: 'public' | 'home' | 'followers' | 'specified';
|
visibility: 'public' | 'home' | 'followers' | 'specified';
|
||||||
@ -2435,95 +2455,95 @@ type Note = {
|
|||||||
uri?: string;
|
uri?: string;
|
||||||
url?: string;
|
url?: string;
|
||||||
isHidden?: boolean;
|
isHidden?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type NoteFavorite = {
|
type NoteFavorite = {
|
||||||
id: ID;
|
id: ID;
|
||||||
createdAt: DateString;
|
createdAt: DateString;
|
||||||
noteId: Note['id'];
|
noteId: Note['id'];
|
||||||
note: Note;
|
note: Note;
|
||||||
};
|
};
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type NoteReaction = {
|
type NoteReaction = {
|
||||||
id: ID;
|
id: ID;
|
||||||
createdAt: DateString;
|
createdAt: DateString;
|
||||||
user: UserLite;
|
user: UserLite;
|
||||||
type: string;
|
type: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
export const noteVisibilities: readonly ["public", "home", "followers", "specified"];
|
export const noteVisibilities: readonly ["public", "home", "followers", "specified"];
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type Notification_2 = {
|
type Notification_2 = {
|
||||||
id: ID;
|
id: ID;
|
||||||
createdAt: DateString;
|
createdAt: DateString;
|
||||||
isRead: boolean;
|
isRead: boolean;
|
||||||
} & ({
|
} & ({
|
||||||
type: 'reaction';
|
type: 'reaction';
|
||||||
reaction: string;
|
reaction: string;
|
||||||
user: User;
|
user: User;
|
||||||
userId: User['id'];
|
userId: User['id'];
|
||||||
note: Note;
|
note: Note;
|
||||||
} | {
|
} | {
|
||||||
type: 'reply';
|
type: 'reply';
|
||||||
user: User;
|
user: User;
|
||||||
userId: User['id'];
|
userId: User['id'];
|
||||||
note: Note;
|
note: Note;
|
||||||
} | {
|
} | {
|
||||||
type: 'renote';
|
type: 'renote';
|
||||||
user: User;
|
user: User;
|
||||||
userId: User['id'];
|
userId: User['id'];
|
||||||
note: Note;
|
note: Note;
|
||||||
} | {
|
} | {
|
||||||
type: 'quote';
|
type: 'quote';
|
||||||
user: User;
|
user: User;
|
||||||
userId: User['id'];
|
userId: User['id'];
|
||||||
note: Note;
|
note: Note;
|
||||||
} | {
|
} | {
|
||||||
type: 'mention';
|
type: 'mention';
|
||||||
user: User;
|
user: User;
|
||||||
userId: User['id'];
|
userId: User['id'];
|
||||||
note: Note;
|
note: Note;
|
||||||
} | {
|
} | {
|
||||||
type: 'pollVote';
|
type: 'pollVote';
|
||||||
user: User;
|
user: User;
|
||||||
userId: User['id'];
|
userId: User['id'];
|
||||||
note: Note;
|
note: Note;
|
||||||
} | {
|
} | {
|
||||||
type: 'follow';
|
type: 'follow';
|
||||||
user: User;
|
user: User;
|
||||||
userId: User['id'];
|
userId: User['id'];
|
||||||
} | {
|
} | {
|
||||||
type: 'followRequestAccepted';
|
type: 'followRequestAccepted';
|
||||||
user: User;
|
user: User;
|
||||||
userId: User['id'];
|
userId: User['id'];
|
||||||
} | {
|
} | {
|
||||||
type: 'receiveFollowRequest';
|
type: 'receiveFollowRequest';
|
||||||
user: User;
|
user: User;
|
||||||
userId: User['id'];
|
userId: User['id'];
|
||||||
} | {
|
} | {
|
||||||
type: 'groupInvited';
|
type: 'groupInvited';
|
||||||
invitation: UserGroup;
|
invitation: UserGroup;
|
||||||
user: User;
|
user: User;
|
||||||
userId: User['id'];
|
userId: User['id'];
|
||||||
} | {
|
} | {
|
||||||
type: 'app';
|
type: 'app';
|
||||||
header?: string | null;
|
header?: string | null;
|
||||||
body: string;
|
body: string;
|
||||||
icon?: string | null;
|
icon?: string | null;
|
||||||
});
|
});
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
export const notificationTypes: readonly ["follow", "mention", "reply", "renote", "quote", "reaction", "pollVote", "pollEnded", "receiveFollowRequest", "followRequestAccepted", "groupInvited", "app"];
|
export const notificationTypes: readonly ["follow", "mention", "reply", "renote", "quote", "reaction", "pollVote", "pollEnded", "receiveFollowRequest", "followRequestAccepted", "groupInvited", "app"];
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type OriginType = 'combined' | 'local' | 'remote';
|
type OriginType = 'combined' | 'local' | 'remote';
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type Page = {
|
type Page = {
|
||||||
id: ID;
|
id: ID;
|
||||||
createdAt: DateString;
|
createdAt: DateString;
|
||||||
updatedAt: DateString;
|
updatedAt: DateString;
|
||||||
@ -2543,22 +2563,22 @@ type Page = {
|
|||||||
attachedFiles: any;
|
attachedFiles: any;
|
||||||
likedCount: number;
|
likedCount: number;
|
||||||
isLiked?: boolean;
|
isLiked?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type PageEvent = {
|
type PageEvent = {
|
||||||
pageId: Page['id'];
|
pageId: Page['id'];
|
||||||
event: string;
|
event: string;
|
||||||
var: any;
|
var: any;
|
||||||
userId: User['id'];
|
userId: User['id'];
|
||||||
user: User;
|
user: User;
|
||||||
};
|
};
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
export const permissions: string[];
|
export const permissions: string[];
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type ServerInfo = {
|
type ServerInfo = {
|
||||||
machine: string;
|
machine: string;
|
||||||
cpu: {
|
cpu: {
|
||||||
model: string;
|
model: string;
|
||||||
@ -2571,19 +2591,19 @@ type ServerInfo = {
|
|||||||
total: number;
|
total: number;
|
||||||
used: number;
|
used: number;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type Signin = {
|
type Signin = {
|
||||||
id: ID;
|
id: ID;
|
||||||
createdAt: DateString;
|
createdAt: DateString;
|
||||||
ip: string;
|
ip: string;
|
||||||
headers: Record<string, any>;
|
headers: Record<string, any>;
|
||||||
success: boolean;
|
success: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type Stats = {
|
type Stats = {
|
||||||
notesCount: number;
|
notesCount: number;
|
||||||
originalNotesCount: number;
|
originalNotesCount: number;
|
||||||
usersCount: number;
|
usersCount: number;
|
||||||
@ -2591,12 +2611,12 @@ type Stats = {
|
|||||||
instances: number;
|
instances: number;
|
||||||
driveUsageLocal: number;
|
driveUsageLocal: number;
|
||||||
driveUsageRemote: number;
|
driveUsageRemote: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Warning: (ae-forgotten-export) The symbol "StreamEvents" needs to be exported by the entry point index.d.ts
|
// Warning: (ae-forgotten-export) The symbol "StreamEvents" needs to be exported by the entry point index.d.ts
|
||||||
//
|
//
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
export class Stream extends EventEmitter<StreamEvents> {
|
export class Stream extends EventEmitter<StreamEvents> {
|
||||||
constructor(origin: string, user: {
|
constructor(origin: string, user: {
|
||||||
token: string;
|
token: string;
|
||||||
} | null, options?: {
|
} | null, options?: {
|
||||||
@ -2626,13 +2646,13 @@ export class Stream extends EventEmitter<StreamEvents> {
|
|||||||
state: 'initializing' | 'reconnecting' | 'connected';
|
state: 'initializing' | 'reconnecting' | 'connected';
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
useChannel<C extends keyof Channels>(channel: C, params?: Channels[C]['params'], name?: string): ChannelConnection<Channels[C]>;
|
useChannel<C extends keyof Channels>(channel: C, params?: Channels[C]['params'], name?: string): ChannelConnection<Channels[C]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type User = UserLite | UserDetailed;
|
type User = UserLite | UserDetailed;
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type UserDetailed = UserLite & {
|
type UserDetailed = UserLite & {
|
||||||
bannerBlurhash: string | null;
|
bannerBlurhash: string | null;
|
||||||
bannerColor: string | null;
|
bannerColor: string | null;
|
||||||
bannerUrl: string | null;
|
bannerUrl: string | null;
|
||||||
@ -2674,21 +2694,21 @@ type UserDetailed = UserLite & {
|
|||||||
updatedAt: DateString | null;
|
updatedAt: DateString | null;
|
||||||
uri: string | null;
|
uri: string | null;
|
||||||
url: string | null;
|
url: string | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type UserGroup = TODO_2;
|
type UserGroup = TODO_2;
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type UserList = {
|
type UserList = {
|
||||||
id: ID;
|
id: ID;
|
||||||
createdAt: DateString;
|
createdAt: DateString;
|
||||||
name: string;
|
name: string;
|
||||||
userIds: User['id'][];
|
userIds: User['id'][];
|
||||||
};
|
};
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type UserLite = {
|
type UserLite = {
|
||||||
id: ID;
|
id: ID;
|
||||||
username: string;
|
username: string;
|
||||||
host: string | null;
|
host: string | null;
|
||||||
@ -2710,18 +2730,18 @@ type UserLite = {
|
|||||||
faviconUrl: Instance['faviconUrl'];
|
faviconUrl: Instance['faviconUrl'];
|
||||||
themeColor: Instance['themeColor'];
|
themeColor: Instance['themeColor'];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type UserSorting = '+follower' | '-follower' | '+createdAt' | '-createdAt' | '+updatedAt' | '-updatedAt';
|
type UserSorting = '+follower' | '-follower' | '+createdAt' | '-createdAt' | '+updatedAt' | '-updatedAt';
|
||||||
|
|
||||||
// Warnings were encountered during analysis:
|
// Warnings were encountered during analysis:
|
||||||
//
|
//
|
||||||
// src/api.types.ts:16:32 - (ae-forgotten-export) The symbol "TODO" needs to be exported by the entry point index.d.ts
|
// src/api.types.ts:16:32 - (ae-forgotten-export) The symbol "TODO" needs to be exported by the entry point index.d.ts
|
||||||
// src/api.types.ts:18:25 - (ae-forgotten-export) The symbol "NoParams" needs to be exported by the entry point index.d.ts
|
// src/api.types.ts:18:25 - (ae-forgotten-export) The symbol "NoParams" needs to be exported by the entry point index.d.ts
|
||||||
// src/api.types.ts:596:18 - (ae-forgotten-export) The symbol "ShowUserReq" needs to be exported by the entry point index.d.ts
|
// src/api.types.ts:602:27 - (ae-forgotten-export) The symbol "ShowUserReq" needs to be exported by the entry point index.d.ts
|
||||||
// src/streaming.types.ts:33:4 - (ae-forgotten-export) The symbol "FIXME" needs to be exported by the entry point index.d.ts
|
// src/streaming.types.ts:33:4 - (ae-forgotten-export) The symbol "FIXME" needs to be exported by the entry point index.d.ts
|
||||||
|
|
||||||
// (No @packageDocumentation comment for this package)
|
// (No @packageDocumentation comment for this package)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -499,6 +499,7 @@ export type Endpoints = {
|
|||||||
'notes/mentions': { req: { following?: boolean; limit?: number; sinceId?: Note['id']; untilId?: Note['id']; }; res: Note[]; };
|
'notes/mentions': { req: { following?: boolean; limit?: number; sinceId?: Note['id']; untilId?: Note['id']; }; res: Note[]; };
|
||||||
'notes/polls/recommendation': { req: TODO; res: TODO; };
|
'notes/polls/recommendation': { req: TODO; res: TODO; };
|
||||||
'notes/polls/vote': { req: { noteId: Note['id']; choice: number; }; res: null; };
|
'notes/polls/vote': { req: { noteId: Note['id']; choice: number; }; res: null; };
|
||||||
|
'notes/events/search': { req: TODO; res: Note[]; };
|
||||||
'notes/reactions': { req: { noteId: Note['id']; type?: string | null; limit?: number; }; res: NoteReaction[]; };
|
'notes/reactions': { req: { noteId: Note['id']; type?: string | null; limit?: number; }; res: NoteReaction[]; };
|
||||||
'notes/reactions/create': { req: { noteId: Note['id']; reaction: string; }; res: null; };
|
'notes/reactions/create': { req: { noteId: Note['id']; reaction: string; }; res: null; };
|
||||||
'notes/reactions/delete': { req: { noteId: Note['id']; }; res: null; };
|
'notes/reactions/delete': { req: { noteId: Note['id']; }; res: null; };
|
||||||
|
Loading…
Reference in New Issue
Block a user