refactor: upgrade masto 5 (#867)

This commit is contained in:
三咲智子 Kevin Deng 2023-01-08 14:21:09 +08:00 committed by GitHub
parent 39034c5777
commit 5c8f75b9b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
108 changed files with 438 additions and 445 deletions

View file

@ -1,15 +1,7 @@
// masto types and notification types differs
// Any type used from masto api retrieving notification from push notification id is no camel case, it is snake case
// I just copy/paste any entry from masto api and convert it to snake case, reusing types not including camel case props
import type {
AccountCredentials,
AttachmentMeta,
AttachmentType,
Card,
Mention,
StatusVisibility,
Tag,
} from 'masto'
import type { mastodon } from 'masto'
export type NotificationType = 'mention' | 'status' | 'reblog' | 'follow' | 'follow_request' | 'favourite' | 'poll' | 'update' | 'admin.sign_up' | 'admin.report'
@ -26,7 +18,7 @@ export interface PushPayload {
export interface UserLogin {
server: string
token?: string
account: AccountCredentials
account: mastodon.v1.AccountCredentials
}
export interface NotificationInfo {
@ -74,7 +66,7 @@ export interface Attachment {
/** The ID of the attachment in the database. */
id: string
/** The type of the attachment. */
type: AttachmentType
type: mastodon.v1.MediaAttachmentType
/** The location of the original full-size attachment. */
url?: string | null
/** The location of a scaled-down preview of the attachment. */
@ -86,7 +78,7 @@ export interface Attachment {
/** A shorter URL for the attachment. */
text_url?: string | null
/** Metadata returned by Paperclip. */
meta?: AttachmentMeta | null
meta?: mastodon.v1.MediaAttachmentMeta | null
/**
* Alternate text that describes what is in the media attachment,
* to be used for the visually impaired or when media attachments do not load.
@ -126,7 +118,7 @@ export interface Status {
/** HTML-encoded status content. */
content: string
/** Visibility of this status. */
visibility: StatusVisibility
visibility: mastodon.v1.StatusVisibility
/** Is this status marked as sensitive content? */
sensitive: boolean
/** Subject or summary line, below which status content is collapsed until expanded. */
@ -136,9 +128,9 @@ export interface Status {
/** The application used to post this status. */
// application: Application
/** Mentions of users within the status content. */
mentions: Mention[]
mentions: mastodon.v1.StatusMention[]
/** Hashtags used within the status content. */
tags: Tag[]
tags: mastodon.v1.Tag[]
/** Custom emoji to be used when rendering status content. */
emojis: Emoji[]
/** How many boosts this status has received. */
@ -158,7 +150,7 @@ export interface Status {
/** The poll attached to the status. */
poll?: Poll | null
/** Preview card for links included within status content. */
card?: Card | null
card?: mastodon.v1.PreviewCard | null
/** Primary language of this status. */
language?: string | null
/**