Merge pull request #1526 from h3poteto/feat/impl/object

Implement objects in entities
This commit is contained in:
AkiraFukushima 2023-01-05 00:55:10 +09:00 committed by GitHub
commit 1f9d4a7c75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 177 additions and 35 deletions

View file

@ -1,5 +1,6 @@
/// <reference path="emoji.ts" />
/// <reference path="source.ts" />
/// <reference path="field.ts" />
namespace Entity {
export type Account = {
id: string
@ -19,7 +20,7 @@ namespace Entity {
header_static: string
emojis: Array<Emoji>
moved: Account | null
fields: object | null
fields: Array<Field>
bot: boolean | null
source?: Source
}

View file

@ -1,3 +1,4 @@
/// <reference path="attachment.ts" />
namespace Entity {
export type AsyncAttachment = {
id: string
@ -6,7 +7,7 @@ namespace Entity {
remote_url: string | null
preview_url: string
text_url: string | null
meta: object | null
meta: Meta | null
description: string | null
blurhash: string | null
}

View file

@ -1,4 +1,40 @@
namespace Entity {
export type Sub = {
// For Image, Gifv, and Video
width?: number
height?: number
size?: string
aspect?: number
// For Gifv and Video
frame_rate?: string
// For Audio, Gifv, and Video
duration?: number
bitrate?: 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 Attachment = {
id: string
type: 'unknown' | 'image' | 'gifv' | 'video' | 'audio'
@ -6,7 +42,7 @@ namespace Entity {
remote_url: string | null
preview_url: string | null
text_url: string | null
meta: object | null
meta: Meta | null
description: string | null
blurhash: string | null
}

View file

@ -1,8 +1,16 @@
namespace Entity {
export type Alerts = {
follow: boolean
favourite: boolean
mention: boolean
reblog: boolean
poll: boolean
}
export type PushSubscription = {
id: string
endpoint: string
server_key: string
alerts: object
alerts: Alerts
}
}

View file

@ -1,10 +1,10 @@
// <reference path="attachment.ts" />
/// <reference path="attachment.ts" />
/// <reference path="status_params.ts" />
namespace Entity {
export type ScheduledStatus = {
id: string
scheduled_at: string
params: object
params: StatusParams
media_attachments: Array<Attachment>
}
}

View file

@ -1,9 +1,10 @@
/// <reference path="field.ts" />
namespace Entity {
export type Source = {
privacy: string | null
sensitive: boolean | null
language: string | null
note: string
fields: object
fields: Array<Field>
}
}

View file

@ -1,6 +1,6 @@
/// <reference path="emoji.ts" />
/// <reference path="source.ts" />
/// <reference path="field.ts" />
namespace MastodonEntity {
export type Account = {
id: string
@ -20,7 +20,7 @@ namespace MastodonEntity {
header_static: string
emojis: Array<Emoji>
moved: Account | null
fields: object | null
fields: Array<Field>
bot: boolean | null
source?: Source
}

View file

@ -1,3 +1,4 @@
/// <reference path="attachment.ts" />
namespace MastodonEntity {
export type AsyncAttachment = {
id: string
@ -6,7 +7,7 @@ namespace MastodonEntity {
remote_url: string | null
preview_url: string
text_url: string | null
meta: object | null
meta: Meta | null
description: string | null
blurhash: string | null
}

View file

@ -1,4 +1,40 @@
namespace MastodonEntity {
export type Sub = {
// For Image, Gifv, and Video
width?: number
height?: number
size?: string
aspect?: number
// For Gifv and Video
frame_rate?: string
// For Audio, Gifv, and Video
duration?: number
bitrate?: 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 Attachment = {
id: string
type: 'unknown' | 'image' | 'gifv' | 'video' | 'audio'
@ -6,7 +42,7 @@ namespace MastodonEntity {
remote_url: string | null
preview_url: string | null
text_url: string | null
meta: object | null
meta: Meta | null
description: string | null
blurhash: string | null
}

View file

@ -1,8 +1,16 @@
namespace MastodonEntity {
export type Alerts = {
follow: boolean
favourite: boolean
mention: boolean
reblog: boolean
poll: boolean
}
export type PushSubscription = {
id: string
endpoint: string
server_key: string
alerts: object
alerts: Alerts
}
}

View file

@ -1,10 +1,10 @@
// <reference path="attachment.ts" />
/// <reference path="attachment.ts" />
/// <reference path="status_params.ts" />
namespace MastodonEntity {
export type ScheduledStatus = {
id: string
scheduled_at: string
params: object
params: StatusParams
media_attachments: Array<Attachment>
}
}

View file

@ -1,9 +1,10 @@
/// <reference path="field.ts" />
namespace MastodonEntity {
export type Source = {
privacy: string | null
sensitive: boolean | null
language: string | null
note: string
fields: object
fields: Array<Field>
}
}

View file

@ -72,7 +72,7 @@ namespace MisskeyAPI {
header_static: '',
emojis: u.emojis.map(e => emoji(e)),
moved: null,
fields: null,
fields: [],
bot: null
}
}
@ -100,7 +100,7 @@ namespace MisskeyAPI {
header_static: u.bannerColor,
emojis: u.emojis.map(e => emoji(e)),
moved: null,
fields: null,
fields: [],
bot: u.isBot
}
}
@ -155,7 +155,10 @@ namespace MisskeyAPI {
remote_url: f.url,
preview_url: f.thumbnailUrl,
text_url: f.url,
meta: null,
meta: {
width: f.properties.width,
height: f.properties.height
},
description: null,
blurhash: null
}

View file

@ -1,6 +1,6 @@
/// <reference path="emoji.ts" />
/// <reference path="source.ts" />
/// <reference path="field.ts" />
namespace PleromaEntity {
export type Account = {
id: string
@ -20,7 +20,7 @@ namespace PleromaEntity {
header_static: string
emojis: Array<Emoji>
moved: Account | null
fields: object | null
fields: Array<Field>
bot: boolean | null
source?: Source
}

View file

@ -1,3 +1,4 @@
/// <reference path="attachment.ts" />
namespace PleromaEntity {
export type AsyncAttachment = {
id: string
@ -6,7 +7,7 @@ namespace PleromaEntity {
remote_url: string | null
preview_url: string
text_url: string | null
meta: object | null
meta: Meta | null
description: string | null
blurhash: string | null
}

View file

@ -1,4 +1,40 @@
namespace PleromaEntity {
export type Sub = {
// For Image, Gifv, and Video
width?: number
height?: number
size?: string
aspect?: number
// For Gifv and Video
frame_rate?: string
// For Audio, Gifv, and Video
duration?: number
bitrate?: 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 Attachment = {
id: string
type: 'unknown' | 'image' | 'gifv' | 'video' | 'audio'
@ -6,7 +42,7 @@ namespace PleromaEntity {
remote_url: string | null
preview_url: string | null
text_url: string | null
meta: object | null
meta: Meta | null
description: string | null
blurhash: string | null
}

View file

@ -1,8 +1,16 @@
namespace PleromaEntity {
export type Alerts = {
follow: boolean
favourite: boolean
mention: boolean
reblog: boolean
poll: boolean
}
export type PushSubscription = {
id: string
endpoint: string
server_key: string
alerts: object
alerts: Alerts
}
}

View file

@ -1,10 +1,10 @@
// <reference path="attachment.ts" />
/// <reference path="attachment.ts" />
/// <reference path="status_params.ts" />
namespace PleromaEntity {
export type ScheduledStatus = {
id: string
scheduled_at: string
params: object
params: StatusParams
media_attachments: Array<Attachment>
}
}

View file

@ -1,9 +1,10 @@
/// <reference path="field.ts" />
namespace PleromaEntity {
export type Source = {
privacy: string | null
sensitive: boolean | null
language: string | null
note: string
fields: object
fields: Array<Field>
}
}

View file

@ -24,7 +24,7 @@ const account: MastodonEntity.Account = {
header_static: '',
emojis: [],
moved: null,
fields: null,
fields: [],
bot: false
}

View file

@ -23,7 +23,7 @@ const account: Entity.Account = {
header_static: '',
emojis: [],
moved: null,
fields: null,
fields: [],
bot: false
}

View file

@ -24,7 +24,7 @@ const account: PleromaEntity.Account = {
header_static: '',
emojis: [],
moved: null,
fields: null,
fields: [],
bot: false
}

View file

@ -19,7 +19,7 @@ const account: Entity.Account = {
header_static: '',
emojis: [],
moved: null,
fields: null,
fields: [],
bot: false
}

View file

@ -22,7 +22,7 @@ const account: PleromaEntity.Account = {
header_static: '',
emojis: [],
moved: null,
fields: null,
fields: [],
bot: false
}

View file

@ -19,7 +19,7 @@ const account: Entity.Account = {
header_static: '',
emojis: [],
moved: null,
fields: null,
fields: [],
bot: false
}
const status: Entity.Status = {