Skip to content

Commit

Permalink
Merge branch 'h3poteto:master' into refactor/not-implemented-error-me…
Browse files Browse the repository at this point in the history
…ssages
  • Loading branch information
ThatOneCalculator authored Oct 7, 2023
2 parents 93543e2 + 359fa0f commit d0b90d6
Show file tree
Hide file tree
Showing 186 changed files with 2,346 additions and 2,467 deletions.
2 changes: 1 addition & 1 deletion example/browser/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import generator from 'megalodon'
import generator, { Entity } from 'megalodon'

const BASE_URL: string = process.env.MASTODON_URL!
const ACCESS_TOKEN: string = process.env.MASTODON_ACCESS_TOKEN!
Expand Down
67 changes: 33 additions & 34 deletions megalodon/src/entities/account.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
/// <reference path="emoji.ts" />
/// <reference path="source.ts" />
/// <reference path="field.ts" />
/// <reference path="role.ts" />
namespace Entity {
export type Account = {
id: string
username: string
acct: string
display_name: string
locked: boolean
discoverable?: boolean
group: boolean | null
noindex: boolean | null
suspended: boolean | null
limited: boolean | null
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: Array<Emoji>
moved: Account | null
fields: Array<Field>
bot: boolean | null
source?: Source
role?: Role
mute_expires_at?: string
}
import { Emoji } from './emoji'
import { Field } from './field'
import { Source } from './source'
import { Role } from './role'

export type Account = {
id: string
username: string
acct: string
display_name: string
locked: boolean
discoverable?: boolean
group: boolean | null
noindex: boolean | null
suspended: boolean | null
limited: boolean | null
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: Array<Emoji>
moved: Account | null
fields: Array<Field>
bot: boolean | null
source?: Source
role?: Role
mute_expires_at?: string
}
12 changes: 5 additions & 7 deletions megalodon/src/entities/activity.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
namespace Entity {
export type Activity = {
week: string
statuses: string
logins: string
registrations: string
}
export type Activity = {
week: string
statuses: string
logins: string
registrations: string
}
69 changes: 34 additions & 35 deletions megalodon/src/entities/announcement.ts
Original file line number Diff line number Diff line change
@@ -1,40 +1,39 @@
/// <reference path="emoji.ts" />
import { Emoji } from './emoji'
import { StatusTag } from './status'

namespace Entity {
export type Announcement = {
id: string
content: string
starts_at: string | null
ends_at: string | null
published: boolean
all_day: boolean
published_at: string
updated_at: string | null
read: boolean | null
mentions: Array<AnnouncementAccount>
statuses: Array<AnnouncementStatus>
tags: Array<StatusTag>
emojis: Array<Emoji>
reactions: Array<AnnouncementReaction>
}
export type Announcement = {
id: string
content: string
starts_at: string | null
ends_at: string | null
published: boolean
all_day: boolean
published_at: string
updated_at: string | null
read: boolean | null
mentions: Array<AnnouncementAccount>
statuses: Array<AnnouncementStatus>
tags: Array<StatusTag>
emojis: Array<Emoji>
reactions: Array<AnnouncementReaction>
}

export type AnnouncementAccount = {
id: string
username: string
url: string
acct: string
}
export type AnnouncementAccount = {
id: string
username: string
url: string
acct: string
}

export type AnnouncementStatus = {
id: string
url: string
}
export type AnnouncementStatus = {
id: string
url: string
}

export type AnnouncementReaction = {
name: string
count: number
me: boolean | null
url: string | null
static_url: string | null
}
export type AnnouncementReaction = {
name: string
count: number
me: boolean | null
url: string | null
static_url: string | null
}
10 changes: 4 additions & 6 deletions megalodon/src/entities/application.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
namespace Entity {
export type Application = {
name: string
website?: string | null
vapid_key?: string | null
}
export type Application = {
name: string
website?: string | null
vapid_key?: string | null
}
25 changes: 12 additions & 13 deletions megalodon/src/entities/async_attachment.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
/// <reference path="attachment.ts" />
namespace Entity {
export type AsyncAttachment = {
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
description: string | null
blurhash: string | null
}
import { Meta } from './attachment'

export type AsyncAttachment = {
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
description: string | null
blurhash: string | null
}
84 changes: 41 additions & 43 deletions megalodon/src/entities/attachment.ts
Original file line number Diff line number Diff line change
@@ -1,49 +1,47 @@
namespace Entity {
export type Sub = {
// For Image, Gifv, and Video
width?: number
height?: number
size?: string
aspect?: number
export type Sub = {
// For Image, Gifv, and Video
width?: number
height?: number
size?: string
aspect?: number

// For Gifv and Video
frame_rate?: string
// For Gifv and Video
frame_rate?: string

// For Audio, Gifv, and Video
duration?: number
bitrate?: number
}
// For Audio, Gifv, and Video
duration?: number
bitrate?: number
}

export type Focus = {
x: number
y: number
}
export type Focus = {
x: number
y: number
}

export type Meta = {
original?: Sub
small?: Sub
focus?: Focus
length?: string
duration?: number
fps?: number
size?: string
width?: number
height?: number
aspect?: number
audio_encode?: string
audio_bitrate?: string
audio_channel?: string
}
export type Meta = {
original?: Sub
small?: Sub
focus?: Focus
length?: string
duration?: number
fps?: number
size?: string
width?: number
height?: number
aspect?: number
audio_encode?: string
audio_bitrate?: string
audio_channel?: string
}

export type Attachment = {
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
description: string | null
blurhash: string | null
}
export type Attachment = {
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
description: string | null
blurhash: string | null
}
32 changes: 15 additions & 17 deletions megalodon/src/entities/card.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
namespace Entity {
export type Card = {
url: string
title: string
description: string
type: 'link' | 'photo' | 'video' | 'rich'
image: string | null
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
embed_url: string | null
blurhash: string | null
}
export type Card = {
url: string
title: string
description: string
type: 'link' | 'photo' | 'video' | 'rich'
image: string | null
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
embed_url: string | null
blurhash: string | null
}
10 changes: 4 additions & 6 deletions megalodon/src/entities/context.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/// <reference path="status.ts" />
import { Status } from './status'

namespace Entity {
export type Context = {
ancestors: Array<Status>
descendants: Array<Status>
}
export type Context = {
ancestors: Array<Status>
descendants: Array<Status>
}
16 changes: 7 additions & 9 deletions megalodon/src/entities/conversation.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/// <reference path="account.ts" />
/// <reference path="status.ts" />
import { Account } from './account'
import { Status } from './status'

namespace Entity {
export type Conversation = {
id: string
accounts: Array<Account>
last_status: Status | null
unread: boolean
}
export type Conversation = {
id: string
accounts: Array<Account>
last_status: Status | null
unread: boolean
}
14 changes: 6 additions & 8 deletions megalodon/src/entities/emoji.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
namespace Entity {
export type Emoji = {
shortcode: string
static_url: string
url: string
visible_in_picker: boolean
category?: string
}
export type Emoji = {
shortcode: string
static_url: string
url: string
visible_in_picker: boolean
category?: string
}
12 changes: 5 additions & 7 deletions megalodon/src/entities/featured_tag.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
namespace Entity {
export type FeaturedTag = {
id: string
name: string
statuses_count: number
last_status_at: string
}
export type FeaturedTag = {
id: string
name: string
statuses_count: number
last_status_at: string
}
Loading

0 comments on commit d0b90d6

Please sign in to comment.