Skip to content

Commit

Permalink
Merge pull request #29 from h3poteto/iss-28
Browse files Browse the repository at this point in the history
closes #28 Add all entities
  • Loading branch information
h3poteto authored Feb 23, 2019
2 parents 324759e + 099142e commit 6180bf3
Show file tree
Hide file tree
Showing 22 changed files with 179 additions and 31 deletions.
27 changes: 17 additions & 10 deletions src/entities/account.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
import Emoji from './emoji'
import Source from './source'

export default interface Account {
id: number,
username: string,
acct: string,
avatar: string,
avatar_static: string,
created_at: string,
display_name: string,
locked: boolean,
created_at: string,
followers_count: number,
following_count: number,
header: string,
header_static: string,
id: number,
locked: boolean,
note: string,
source?: object, // Source
statuses_count: number,
note: string,
url: string,
username: string
avatar: string,
avatar_static: string,
header: string,
header_static: string,
emojis: Emoji[],
moved: Account | null,
fields: object | null,
bot: boolean | null,
source?: Source
}
10 changes: 5 additions & 5 deletions src/entities/attachment.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export default interface Attachment {
id: number,
type: string,
type: 'unknown' | 'image' | 'gifv' | 'video',
url: string,
remote_url: string,
remote_url: string | null,
preview_url: string,
text_url: string,
meta: object,
description: string
text_url: string | null,
meta: object | null,
description: string | null
}
14 changes: 14 additions & 0 deletions src/entities/card.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export default interface 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
}
6 changes: 6 additions & 0 deletions src/entities/context.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Status from './status'

export default interface Context {
ancestors: Status[],
descendants: Status[]
}
2 changes: 1 addition & 1 deletion src/entities/conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import Status from './status'
export default interface Conversation {
id: number,
accounts: Account[],
last_status: Status,
last_status: Status | null,
unread: boolean
}
7 changes: 7 additions & 0 deletions src/entities/emoji.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default interface Emoji {
shortcode: string,
static_url: string,
url: string,
visible_in_picker: boolean
}

5 changes: 5 additions & 0 deletions src/entities/field.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default interface Field {
name: string,
value: string,
verified_at: string | null
}
8 changes: 8 additions & 0 deletions src/entities/filter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default interface Filter {
id: number,
phrase: string,
context: string[],
expires_at: string | null,
irreversible: boolean,
whole_word: boolean
}
5 changes: 5 additions & 0 deletions src/entities/history.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default interface History {
day: string,
uses: number,
accounts: number
}
17 changes: 17 additions & 0 deletions src/entities/instance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Account from './account'
import URLs from './urls'
import Stats from './stats'

export default interface Instance {
uri: string,
title: string,
description: string,
email: string,
version: string,
thumbnail: string | null,
urls: URLs,
stats: Stats,
languages: string[],
contact_account: Account | null
}

4 changes: 4 additions & 0 deletions src/entities/list.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default interface List {
id: number,
title: string
}
6 changes: 6 additions & 0 deletions src/entities/push_subscription.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default interface PushSubscription {
id: number,
endpoint: string,
server_key: string,
alerts: object
}
12 changes: 12 additions & 0 deletions src/entities/relationship.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default interface Relationship {
id: number,
following: boolean,
followed_by: boolean,
blocking: boolean,
muting: boolean,
muting_notifications: boolean,
requested: boolean,
domain_blocking: boolean,
showing_reblogs: boolean,
endorsed: boolean,
}
9 changes: 9 additions & 0 deletions src/entities/results.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Account from './account'
import Status from './status'
import Tag from './tag'

export default interface Results {
accounts: Account[],
statuses: Status[],
hashtags: Tag[]
}
8 changes: 8 additions & 0 deletions src/entities/scheduled_status.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Attachment from './attachment'

export default interface ScheduledStatus {
id: number,
scheduled_at: string,
params: object,
media_attachments: Attachment[]
}
7 changes: 7 additions & 0 deletions src/entities/source.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default interface Source {
privacy: string | null,
sensitive: boolean | null,
language: string | null,
note: string,
fields: object
}
5 changes: 5 additions & 0 deletions src/entities/stats.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default interface Stats {
user_count: number,
status_count: number,
domain_count: number
}
34 changes: 20 additions & 14 deletions src/entities/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,34 @@ import Application from './application'
import Mention from './mention'
import Tag from './tag'
import Attachment from './attachment'
import Emoji from './emoji'
import Card from './card'

export default interface Status {
id: number,
uri: string,
url: string,
account: Account,
application: Application | null,
in_reply_to_id: number | null,
in_reply_to_account_id: number | null,
reblog: Status | null,
content: string,
created_at: string,
favourited: boolean | null,
emojis: Emoji[],
replies_count: number,
reblogs_count: number,
favourites_count: number,
id: number,
in_reply_to_account_id: number | null,
in_reply_to_id: number | null,
language: string | null,
media_attachments: Attachment[],
mentions: Mention[],
muted: boolean | null,
reblog: Status | null,
reblogged: boolean | null,
reblogs_count: number,
favourited: boolean | null,
muted: boolean | null,
sensitive: boolean,
spoiler_text: string,
visibility: 'public' | 'unlisted' | 'private' | 'direct',
media_attachments: Attachment[],
mentions: Mention[],
tags: Tag[],
uri: string,
url: string,
visibility: string
card: Card | null,
application: Application,
language: string | null,
pinned: boolean | null
}
10 changes: 10 additions & 0 deletions src/entities/status_params.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default interface StatusParams {
text: string,
in_reply_to_id: string | null,
media_ids: string[] | null,
sensitive: boolean | null,
spoiler_text: string | null,
visibility: 'public' | 'unlisted' | 'private' | 'direct',
scheduled_at: string | null,
application_id: string
}
5 changes: 4 additions & 1 deletion src/entities/tag.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import History from './history'

export default interface Tag {
name: string,
url: string
url: string,
history: History[] | null
}
6 changes: 6 additions & 0 deletions src/entities/token.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default interface Token {
access_token: string,
token_type: string,
scope: string,
created_at: number
}
3 changes: 3 additions & 0 deletions src/entities/urls.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default interface URLs {
streaming_api: string
}

0 comments on commit 6180bf3

Please sign in to comment.