Skip to content

Instantly share code, notes, and snippets.

@shumbo
Last active April 24, 2017 10:37
Show Gist options
  • Save shumbo/b45446cddb139d54ebf1869dd671a8e8 to your computer and use it in GitHub Desktop.
Save shumbo/b45446cddb139d54ebf1869dd671a8e8 to your computer and use it in GitHub Desktop.
TypeScript interfaces for Mastodon APIs
// Based on https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md
export interface Account {
id: number;
username: string;
acct: string;
display_name: string;
locked: string;
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;
}
export interface Application {
name:string;
website:string;
}
export interface Attachment {
id:string;
type:'image' | 'video' | 'gifv';
url:string;
remote_url:string;
preview_url:string;
text_url:string;
}
export interface Card {
url:string;
title:string;
description:string;
image:string;
}
export interface Context {
ancestors: Status[];
descendants: Status[];
}
export interface Error {
error:string;
}
export interface Instance {
uri:string;
title:string;
description:string;
email:string;
}
export interface Mention {
url:string;
username:string;
acct:string;
id:string;
}
export interface Notification {
id:string;
type:'mention' | 'reblog' | 'favourite' | 'follow';
created_at: string;
account: Account;
status?: Status;
}
export interface Relationship {
id:string;
following:string;
followed_by:string;
blocking:string;
muting:string;
requested:string;
}
export interface Report {
id:string;
action_taken:boolean;
}
export interface Results{
accounts:Account[];
statuses:Status[];
hashtags:string[];
}
export interface Status {
id: string;
uri: string;
url: string;
account: string;
in_reply_to_id: string;
in_reply_to_account_id: string;
reblog: string;
content: string;
created_at: string;
reblogs_count: string;
favourites_count: string;
reblogged: string;
favourited: string;
sensitive: string;
spoiler_text: string;
visibility: string;
media_attachments: string;
mentions: string;
tags: string;
application: Application;
}
export interface Tag {
name:string;
url:string;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment