mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-02-03 13:33:32 -05:00
22 lines
624 B
TypeScript
22 lines
624 B
TypeScript
import type { ApiSearchResultsJSON } from 'mastodon/api_types/search';
|
|
import type { ApiHashtagJSON } from 'mastodon/api_types/tags';
|
|
|
|
export type SearchType = 'account' | 'hashtag' | 'accounts' | 'statuses';
|
|
|
|
export interface RecentSearch {
|
|
q: string;
|
|
type?: SearchType;
|
|
}
|
|
|
|
export interface SearchResults {
|
|
accounts: string[];
|
|
statuses: string[];
|
|
hashtags: ApiHashtagJSON[];
|
|
}
|
|
|
|
export const createSearchResults = (serverJSON: ApiSearchResultsJSON) => ({
|
|
accounts: serverJSON.accounts.map((account) => account.id),
|
|
statuses: serverJSON.statuses.map((status) => status.id),
|
|
hashtags: serverJSON.hashtags,
|
|
});
|