Implement WebFinger, rework TS

This commit is contained in:
Jesse Wierzbinski 2023-09-12 10:48:10 -10:00
parent 29f63dfcb7
commit c573052450
No known key found for this signature in database
GPG key ID: F9A1E418934E40B0
56 changed files with 560 additions and 239 deletions

View file

@ -1,9 +1,9 @@
import { Emoji } from "./emoji";
import { Field } from "./field";
import { Role } from "./role";
import { Source } from "./source";
import { APIEmoji } from "./emoji";
import { APIField } from "./field";
import { APIRole } from "./role";
import { APISource } from "./source";
export interface Account {
export interface APIAccount {
id: string;
username: string;
acct: string;
@ -24,11 +24,11 @@ export interface Account {
avatar_static: string;
header: string;
header_static: string;
emojis: Emoji[];
moved: Account | null;
fields: Field[];
emojis: APIEmoji[];
moved: APIAccount | null;
fields: APIField[];
bot: boolean;
source?: Source;
role?: Role;
source?: APISource;
role?: APIRole;
mute_expires_at?: string;
}

View file

@ -1,4 +1,4 @@
export interface Activity {
export interface APIActivity {
week: string;
statuses: string;
logins: string;

View file

@ -1,7 +1,7 @@
import { Emoji } from "./emoji";
import { StatusTag } from "./status";
import { APIEmoji } from "./emoji";
import { APIStatusTag } from "./status";
export interface Announcement {
export interface APIAnnouncement {
id: string;
content: string;
starts_at: string | null;
@ -13,8 +13,8 @@ export interface Announcement {
read: boolean | null;
mentions: AnnouncementAccount[];
statuses: AnnouncementStatus[];
tags: StatusTag[];
emojis: Emoji[];
tags: APIStatusTag[];
emojis: APIEmoji[];
reactions: AnnouncementReaction[];
}

View file

@ -1,4 +1,4 @@
export interface Application {
export interface APIApplication {
name: string;
website?: string | null;
vapid_key?: string | null;

View file

@ -1,13 +1,13 @@
import { Meta } from "./attachment";
import { APIMeta } from "./attachment";
export interface AsyncAttachment {
export interface APIAsyncAttachment {
id: string;
type: "unknown" | "image" | "gifv" | "video" | "audio";
url: string | null;
remote_url: string | null;
preview_url: string;
text_url: string | null;
meta: Meta | null;
meta: APIMeta | null;
description: string | null;
blurhash: string | null;
}

View file

@ -1,4 +1,4 @@
export interface Sub {
export interface APISub {
// For Image, Gifv, and Video
width?: number;
height?: number;
@ -13,15 +13,15 @@ export interface Sub {
bitrate?: number;
}
export interface Focus {
export interface APIFocus {
x: number;
y: number;
}
export interface Meta {
original?: Sub;
small?: Sub;
focus?: Focus;
export interface APIMeta {
original?: APISub;
small?: APISub;
focus?: APIFocus;
length?: string;
duration?: number;
fps?: number;
@ -34,14 +34,14 @@ export interface Meta {
audio_channel?: string;
}
export interface Attachment {
export interface APIAttachment {
id: string;
type: "unknown" | "image" | "gifv" | "video" | "audio";
url: string;
remote_url: string | null;
preview_url: string | null;
text_url: string | null;
meta: Meta | null;
meta: APIMeta | null;
description: string | null;
blurhash: string | null;
}

View file

@ -1,4 +1,4 @@
export interface Card {
export interface APICard {
url: string;
title: string;
description: string;

View file

@ -1,6 +1,6 @@
import { Status } from "./status";
import { APIStatus } from "./status";
export interface Context {
ancestors: Status[];
descendants: Status[];
export interface APIContext {
ancestors: APIStatus[];
descendants: APIStatus[];
}

View file

@ -1,9 +1,9 @@
import { Account } from "./account";
import { Status } from "./status";
import { APIAccount } from "./account";
import { APIStatus } from "./status";
export interface Conversation {
export interface APIConversation {
id: string;
accounts: Account[];
last_status: Status | null;
accounts: APIAccount[];
last_status: APIStatus | null;
unread: boolean;
}

View file

@ -1,4 +1,4 @@
export interface Emoji {
export interface APIEmoji {
shortcode: string;
static_url: string;
url: string;

View file

@ -1,4 +1,4 @@
export interface FeaturedTag {
export interface APIFeaturedTag {
id: string;
name: string;
statuses_count: number;

View file

@ -1,4 +1,4 @@
export interface Field {
export interface APIField {
name: string;
value: string;
verified_at: string | null;

View file

@ -1,4 +1,4 @@
export interface Filter {
export interface APIFilter {
id: string;
phrase: string;
context: FilterContext[];

View file

@ -1,4 +1,4 @@
export interface History {
export interface APIHistory {
day: string;
uses: number;
accounts: number;

View file

@ -1,4 +1,4 @@
export interface IdentityProof {
export interface APIIdentityProof {
provider: string;
provider_username: string;
updated_at: string;

View file

@ -1,16 +1,16 @@
import { Account } from "./account";
import { Stats } from "./stats";
import { URLs } from "./urls";
import { APIAccount } from "./account";
import { APIStats } from "./stats";
import { APIURLs } from "./urls";
export interface Instance {
export interface APIInstance {
uri: string;
title: string;
description: string;
email: string;
version: string;
thumbnail: string | null;
urls: URLs;
stats: Stats;
urls: APIURLs;
stats: APIStats;
languages: string[];
registrations: boolean;
approval_required: boolean;
@ -37,11 +37,11 @@ export interface Instance {
max_expiration: number;
};
};
contact_account: Account;
rules: InstanceRule[];
contact_account: APIAccount;
rules: APIInstanceRule[];
}
export interface InstanceRule {
export interface APIInstanceRule {
id: string;
text: string;
}

View file

@ -1,7 +1,7 @@
export interface List {
export interface APIList {
id: string;
title: string;
replies_policy: RepliesPolicy;
replies_policy: APIRepliesPolicy;
}
export type RepliesPolicy = "followed" | "list" | "none";
export type APIRepliesPolicy = "followed" | "list" | "none";

View file

@ -1,4 +1,4 @@
export interface Marker {
export interface APIMarker {
home: {
last_read_id: string;
version: number;

View file

@ -1,4 +1,4 @@
export interface Mention {
export interface APIMention {
id: string;
username: string;
url: string;

View file

@ -1,12 +1,12 @@
import { Account } from "./account";
import { Status } from "./status";
import { APIAccount } from "./account";
import { APIStatus } from "./status";
export interface Notification {
account: Account;
export interface APINotification {
account: APIAccount;
created_at: string;
id: string;
status?: Status;
type: NotificationType;
status?: APIStatus;
type: APINotificationType;
}
export type NotificationType = string;
export type APINotificationType = string;

View file

@ -1,11 +1,11 @@
import { PollOption } from "./poll_option";
import { APIPollOption } from "./poll_option";
export interface Poll {
export interface APIPoll {
id: string;
expires_at: string | null;
expired: boolean;
multiple: boolean;
votes_count: number;
options: PollOption[];
options: APIPollOption[];
voted: boolean;
}

View file

@ -1,4 +1,4 @@
export interface PollOption {
export interface APIPollOption {
title: string;
votes_count: number | null;
}

View file

@ -1,4 +1,4 @@
export interface Preferences {
export interface APIPreferences {
"posting:default:visibility": "public" | "unlisted" | "private" | "direct";
"posting:default:sensitive": boolean;
"posting:default:language": string | null;

View file

@ -1,4 +1,4 @@
export interface Alerts {
export interface APIAlerts {
follow: boolean;
favourite: boolean;
mention: boolean;
@ -6,9 +6,9 @@ export interface Alerts {
poll: boolean;
}
export interface PushSubscription {
export interface APIPushSubscription {
id: string;
endpoint: string;
server_key: string;
alerts: Alerts;
alerts: APIAlerts;
}

View file

@ -1,4 +1,4 @@
export interface Relationship {
export interface APIRelationship {
id: string;
following: boolean;
followed_by: boolean;

View file

@ -1,15 +1,15 @@
import { Account } from "./account";
import { APIAccount } from "./account";
export interface Report {
export interface APIReport {
id: string;
action_taken: boolean;
action_taken_at: string | null;
category: Category;
category: APICategory;
comment: string;
forwarded: boolean;
status_ids: string[] | null;
rule_ids: string[] | null;
target_account: Account;
target_account: APIAccount;
}
export type Category = "spam" | "violation" | "other";
export type APICategory = "spam" | "violation" | "other";

View file

@ -1,9 +1,9 @@
import { Account } from "./account";
import { Status } from "./status";
import { Tag } from "./tag";
import { APIAccount } from "./account";
import { APIStatus } from "./status";
import { APITag } from "./tag";
export interface Results {
accounts: Account[];
statuses: Status[];
hashtags: Tag[];
export interface APIResults {
accounts: APIAccount[];
statuses: APIStatus[];
hashtags: APITag[];
}

View file

@ -1,3 +1,3 @@
export interface Role {
export interface APIRole {
name: string;
}

View file

@ -1,9 +1,9 @@
import { Attachment } from "./attachment";
import { StatusParams } from "./status_params";
import { APIAttachment } from "./attachment";
import { APIStatusParams } from "./status_params";
export interface ScheduledStatus {
export interface APIScheduledStatus {
id: string;
scheduled_at: string;
params: StatusParams;
media_attachments: Attachment[];
params: APIStatusParams;
media_attachments: APIAttachment[];
}

View file

@ -1,9 +1,9 @@
import { Field } from "./field";
import { APIField } from "./field";
export interface Source {
export interface APISource {
privacy: string | null;
sensitive: boolean | null;
language: string | null;
note: string;
fields: Field[];
fields: APIField[];
}

View file

@ -1,4 +1,4 @@
export interface Stats {
export interface APIStats {
user_count: number;
status_count: number;
domain_count: number;

View file

@ -1,22 +1,22 @@
import { Account } from "./account";
import { Application } from "./application";
import { Attachment } from "./attachment";
import { Card } from "./card";
import { Emoji } from "./emoji";
import { Mention } from "./mention";
import { Poll } from "./poll";
import { APIAccount } from "./account";
import { APIApplication } from "./application";
import { APIAttachment } from "./attachment";
import { APICard } from "./card";
import { APIEmoji } from "./emoji";
import { APIMention } from "./mention";
import { APIPoll } from "./poll";
export interface Status {
export interface APIStatus {
id: string;
uri: string;
url: string;
account: Account;
account: APIAccount;
in_reply_to_id: string | null;
in_reply_to_account_id: string | null;
reblog: Status | null;
reblog: APIStatus | null;
content: string;
created_at: string;
emojis: Emoji[];
emojis: APIEmoji[];
replies_count: number;
reblogs_count: number;
favourites_count: number;
@ -26,21 +26,21 @@ export interface Status {
sensitive: boolean;
spoiler_text: string;
visibility: "public" | "unlisted" | "private" | "direct";
media_attachments: Attachment[];
mentions: Mention[];
tags: StatusTag[];
card: Card | null;
poll: Poll | null;
application: Application | null;
media_attachments: APIAttachment[];
mentions: APIMention[];
tags: APIStatusTag[];
card: APICard | null;
poll: APIPoll | null;
application: APIApplication | null;
language: string | null;
pinned: boolean | null;
bookmarked?: boolean;
// These parameters are unique parameters in fedibird.com for quote.
quote_id?: string;
quote?: Status | null;
quote?: APIStatus | null;
}
export interface StatusTag {
export interface APIStatusTag {
name: string;
url: string;
}

View file

@ -1,4 +1,4 @@
export interface StatusParams {
export interface APIStatusParams {
text: string;
in_reply_to_id: string | null;
media_ids: string[] | null;

View file

@ -1,4 +1,4 @@
export interface StatusSource {
export interface APIStatusSource {
id: string;
text: string;
spoiler_text: string;

View file

@ -1,8 +1,8 @@
import { History } from "./history";
import { APIHistory } from "./history";
export interface Tag {
export interface APITag {
name: string;
url: string;
history: History[];
history: APIHistory[];
following?: boolean;
}

View file

@ -1,4 +1,4 @@
export interface Token {
export interface APIToken {
access_token: string;
token_type: string;
scope: string;

View file

@ -1,3 +1,3 @@
export interface URLs {
export interface APIURLs {
streaming_api: string;
}