Import types from hyperspace-classic

This commit is contained in:
Marquis Kurt 2019-03-25 16:23:04 -04:00
parent b3e48d00b3
commit 48323d519c
9 changed files with 154 additions and 0 deletions

27
src/types/Account.tsx Normal file
View File

@ -0,0 +1,27 @@
import { MastodonEmoji } from './Emojis';
import { Field } from './Field';
/**
* Basic type for an account on Mastodon
*/
export type Account = {
id: string;
username: string;
acct: string;
display_name: string;
locked: boolean;
created_at: string;
followers_count: number;
following_count: number;
statuses_count: number;
note: string;
url: string;
avatar: string;
avatar_static: string;
header: string;
header_static: string;
emojis: [MastodonEmoji];
moved: Account | null;
fields: [Field];
bot: boolean | null;
}

13
src/types/Attachment.tsx Normal file
View File

@ -0,0 +1,13 @@
/**
* Basic type for an attachment, usually on Statuses
*/
export type Attachment = {
id: string;
type: "unknown" | "image" | "gifv" | "video";
url: string;
remote_url: string | null;
preview_url: string;
text_url: string | null;
meta: any | null;
description: string | null;
}

17
src/types/Card.tsx Normal file
View File

@ -0,0 +1,17 @@
/**
* Basic type for Cards, usually in Statuses
*/
export type Card = {
url: string;
title: string;
description: string;
image: string | null;
type: "link" | "photo" | "video" | "rich";
author_name: string | null;
author_url: string | null;
provider_name: string | null;
provider_url: string | null;
html: string | null;
width: number | null;
height: number | null;
}

17
src/types/Emojis.tsx Normal file
View File

@ -0,0 +1,17 @@
/**
* Basic type for Emojis on Mastodon.
*/
export type MastodonEmoji = {
shortcode: string;
static_url: string;
url: string;
visible_in_picker: boolean;
};
/**
* Trimmed type of Emoji from emoji-mart
*/
export type Emoji = {
name: string;
imageUrl: string;
};

8
src/types/Field.tsx Normal file
View File

@ -0,0 +1,8 @@
/**
* Basic type for a table entry, usually in Account
*/
export type Field = {
name: string;
value: string;
verified_at: string | null;
}

9
src/types/Mention.tsx Normal file
View File

@ -0,0 +1,9 @@
/**
* Basic type for a person mentioned in a Status
*/
export type Mention = {
url: string;
username: string;
acct: string;
id: string;
}

20
src/types/Poll.tsx Normal file
View File

@ -0,0 +1,20 @@
/**
* Basic type for a Poll on Mastodon
*/
export type Poll = {
id: string;
expires_at: string | null;
expired: boolean;
multiple: boolean;
votes_count: number;
options: [PollOption];
voted: boolean | null;
}
/**
* Basic type for a Poll option in a Poll
*/
export type PollOption = {
title: string;
votes_count: number | null;
}

39
src/types/Status.tsx Normal file
View File

@ -0,0 +1,39 @@
import { MastodonEmoji } from './Emojis';
import { Visibility } from './Visibility';
import { Account } from './Account';
import { Attachment } from './Attachment';
import { Mention } from './Mention';
import { Poll } from './Poll';
import { Card } from './Card';
/**
* Basic type for a status on Mastodon
*/
export type Status = {
id: string;
uri: string;
url: string | null;
account: Account;
in_reply_to_id: string | null;
in_reply_to_account_id: string | null;
reblog: Status | null;
content: string;
created_at: string;
emojis: [MastodonEmoji];
replies_count: number;
reblogs_count: number;
favourites_count: number;
reblogged: boolean | null;
favourited: boolean | null;
muted: boolean | null;
sensitive: boolean;
spoiler_text: string;
visibility: Visibility;
media_attachments: [Attachment];
mentions: [Mention];
tags: any;
card: Card | null;
poll: Poll | null;
application: any;
pinned: boolean | null;
}

4
src/types/Visibility.tsx Normal file
View File

@ -0,0 +1,4 @@
/**
* Types of a post's visibility on Mastodon.
*/
export type Visibility = "direct" | "private" | "unlisted" | "public";