diff --git a/database/entities/Application.ts b/database/entities/Application.ts index 35264689..bd9c2aa0 100644 --- a/database/entities/Application.ts +++ b/database/entities/Application.ts @@ -1,7 +1,7 @@ import type { InferSelectModel } from "drizzle-orm"; import { db } from "~drizzle/db"; import type { application } from "~drizzle/schema"; -import type { APIApplication } from "~types/entities/application"; +import type { Application as APIApplication } from "~types/mastodon/application"; export type Application = InferSelectModel; diff --git a/database/entities/Attachment.ts b/database/entities/Attachment.ts index 22349a82..c68741d6 100644 --- a/database/entities/Attachment.ts +++ b/database/entities/Attachment.ts @@ -4,8 +4,8 @@ import type * as Lysand from "lysand-types"; import { MediaBackendType } from "media-manager"; import { db } from "~drizzle/db"; import { attachment } from "~drizzle/schema"; -import type { APIAsyncAttachment } from "~types/entities/async_attachment"; -import type { APIAttachment } from "~types/entities/attachment"; +import type { AsyncAttachment as APIAsyncAttachment } from "~types/mastodon/async_attachment"; +import type { Attachment as APIAttachment } from "~types/mastodon/attachment"; export type Attachment = InferSelectModel; diff --git a/database/entities/Emoji.ts b/database/entities/Emoji.ts index cd8490cd..d5cc4554 100644 --- a/database/entities/Emoji.ts +++ b/database/entities/Emoji.ts @@ -2,7 +2,7 @@ import { type InferSelectModel, and, eq } from "drizzle-orm"; import type * as Lysand from "lysand-types"; import { db } from "~drizzle/db"; import { emoji, instance } from "~drizzle/schema"; -import type { APIEmoji } from "~types/entities/emoji"; +import type { Emoji as APIEmoji } from "~types/mastodon/emoji"; import { addInstanceIfNotExists } from "./Instance"; export type EmojiWithInstance = InferSelectModel & { diff --git a/database/entities/Notification.ts b/database/entities/Notification.ts index e502c775..dcc8e20e 100644 --- a/database/entities/Notification.ts +++ b/database/entities/Notification.ts @@ -1,7 +1,7 @@ import type { InferSelectModel } from "drizzle-orm"; import { db } from "~drizzle/db"; import type { notification } from "~drizzle/schema"; -import type { APINotification } from "~types/entities/notification"; +import type { Notification as APINotification } from "~types/mastodon/notification"; import { type StatusWithRelations, findFirstStatuses, diff --git a/database/entities/Relationship.ts b/database/entities/Relationship.ts index 31dadb6f..99d9e92e 100644 --- a/database/entities/Relationship.ts +++ b/database/entities/Relationship.ts @@ -1,7 +1,7 @@ import type { InferSelectModel } from "drizzle-orm"; import { db } from "~drizzle/db"; import { relationship } from "~drizzle/schema"; -import type { APIRelationship } from "~types/entities/relationship"; +import type { Relationship as APIRelationship } from "~types/mastodon/relationship"; import type { User } from "./User"; export type Relationship = InferSelectModel; @@ -82,7 +82,6 @@ export const relationshipToAPI = (rel: Relationship): APIRelationship => { notifying: rel.notifying, requested: rel.requested, showing_reblogs: rel.showingReblogs, - languages: rel.languages ?? [], note: rel.note, }; }; diff --git a/database/entities/Status.ts b/database/entities/Status.ts index 3fa93d29..acbefdb0 100644 --- a/database/entities/Status.ts +++ b/database/entities/Status.ts @@ -5,18 +5,15 @@ import { and, eq, inArray, - isNotNull, isNull, or, sql, } from "drizzle-orm"; import { htmlToText } from "html-to-text"; import linkifyHtml from "linkify-html"; -import linkifyStr from "linkify-string"; import type * as Lysand from "lysand-types"; import { anyOf, - char, charIn, createRegExp, digit, @@ -38,9 +35,9 @@ import { statusToMentions, user, } from "~drizzle/schema"; -import type { APIAttachment } from "~types/entities/attachment"; -import type { APIStatus } from "~types/entities/status"; import type { Note } from "~types/lysand/Object"; +import type { Attachment as APIAttachment } from "~types/mastodon/attachment"; +import type { Status as APIStatus } from "~types/mastodon/status"; import { applicationToAPI } from "./Application"; import { attachmentFromLysand, @@ -64,7 +61,6 @@ import { resolveUser, resolveWebFinger, transformOutputToUserWithRelations, - userExtras, userExtrasTemplate, userRelations, userToAPI, @@ -1270,12 +1266,13 @@ export const statusToAPI = async ( config.http.base_url, ).toString(), bookmarked: false, - quote: statusToConvert.quoting + quote: !!statusToConvert.quotingPostId /* statusToConvert.quoting ? await statusToAPI( statusToConvert.quoting as unknown as StatusWithRelations, userFetching, ) - : null, + : null, */, + // @ts-expect-error Pleroma extension quote_id: statusToConvert.quotingPostId || undefined, }; }; diff --git a/database/entities/User.ts b/database/entities/User.ts index 8562b0db..3f5d534e 100644 --- a/database/entities/User.ts +++ b/database/entities/User.ts @@ -12,8 +12,8 @@ import { relationship, user, } from "~drizzle/schema"; -import type { APIAccount } from "~types/entities/account"; -import type { APISource } from "~types/entities/source"; +import type { Account as APIAccount } from "~types/mastodon/account"; +import type { Source as APISource } from "~types/mastodon/source"; import { type EmojiWithInstance, emojiToAPI, @@ -749,6 +749,7 @@ export const userToAPI = ( discoverable: undefined, mute_expires_at: undefined, group: false, + // @ts-expect-error Pleroma extension pleroma: { is_admin: userToConvert.isAdmin, is_moderator: userToConvert.isAdmin, diff --git a/server/api/api/v1/accounts/[id]/index.test.ts b/server/api/api/v1/accounts/[id]/index.test.ts index c2327b61..a66d6957 100644 --- a/server/api/api/v1/accounts/[id]/index.test.ts +++ b/server/api/api/v1/accounts/[id]/index.test.ts @@ -6,7 +6,7 @@ import { getTestUsers, sendTestRequest, } from "~tests/utils"; -import type { APIAccount } from "~types/entities/account"; +import type { Account as APIAccount } from "~types/mastodon/account"; import { meta } from "./index"; await deleteOldTestUsers(); @@ -86,6 +86,7 @@ describe(meta.route, () => { limited: false, noindex: false, suspended: false, + // @ts-expect-error Pleroma extension pleroma: { is_admin: false, is_moderator: false, diff --git a/server/api/api/v1/accounts/[id]/note.ts b/server/api/api/v1/accounts/[id]/note.ts index a19a0509..487db35f 100644 --- a/server/api/api/v1/accounts/[id]/note.ts +++ b/server/api/api/v1/accounts/[id]/note.ts @@ -1,6 +1,7 @@ import { apiRoute, applyConfig, idValidator } from "@api"; import { errorResponse, jsonResponse } from "@response"; import { eq } from "drizzle-orm"; +import { z } from "zod"; import { relationshipToAPI } from "~database/entities/Relationship"; import { findFirstUser, @@ -8,7 +9,6 @@ import { } from "~database/entities/User"; import { db } from "~drizzle/db"; import { relationship } from "~drizzle/schema"; -import { z } from "zod"; export const meta = applyConfig({ allowedMethods: ["POST"], diff --git a/server/api/api/v1/accounts/lookup/index.test.ts b/server/api/api/v1/accounts/lookup/index.test.ts index a80c1d21..f447053f 100644 --- a/server/api/api/v1/accounts/lookup/index.test.ts +++ b/server/api/api/v1/accounts/lookup/index.test.ts @@ -1,14 +1,11 @@ -import { afterAll, beforeAll, describe, expect, test } from "bun:test"; -import { getUserUri } from "~database/entities/User"; +import { afterAll, describe, expect, test } from "bun:test"; import { config } from "~index"; import { deleteOldTestUsers, - getTestStatuses, getTestUsers, sendTestRequest, } from "~tests/utils"; -import type { APIAccount } from "~types/entities/account"; -import type { APIStatus } from "~types/entities/status"; +import type { Account as APIAccount } from "~types/mastodon/account"; import { meta } from "./index"; await deleteOldTestUsers(); diff --git a/server/api/api/v1/accounts/lookup/index.ts b/server/api/api/v1/accounts/lookup/index.ts index 65d5e7af..4cef6613 100644 --- a/server/api/api/v1/accounts/lookup/index.ts +++ b/server/api/api/v1/accounts/lookup/index.ts @@ -6,10 +6,10 @@ import { createRegExp, digit, exactly, + global, letter, maybe, oneOrMore, - global, } from "magic-regexp"; import { z } from "zod"; import { diff --git a/server/api/api/v1/accounts/search/index.test.ts b/server/api/api/v1/accounts/search/index.test.ts index 1f91497a..41ccc8c4 100644 --- a/server/api/api/v1/accounts/search/index.test.ts +++ b/server/api/api/v1/accounts/search/index.test.ts @@ -1,13 +1,11 @@ -import { afterAll, beforeAll, describe, expect, test } from "bun:test"; -import { getUserUri } from "~database/entities/User"; +import { afterAll, describe, expect, test } from "bun:test"; import { config } from "~index"; import { deleteOldTestUsers, - getTestStatuses, getTestUsers, sendTestRequest, } from "~tests/utils"; -import type { APIAccount } from "~types/entities/account"; +import type { Account as APIAccount } from "~types/mastodon/account"; import { meta } from "./index"; await deleteOldTestUsers(); diff --git a/server/api/api/v1/accounts/search/index.ts b/server/api/api/v1/accounts/search/index.ts index 9345a14b..b1b9e15f 100644 --- a/server/api/api/v1/accounts/search/index.ts +++ b/server/api/api/v1/accounts/search/index.ts @@ -2,15 +2,15 @@ import { apiRoute, applyConfig } from "@api"; import { errorResponse, jsonResponse } from "@response"; import { sql } from "drizzle-orm"; import { - createRegExp, - maybe, - oneOrMore, anyOf, - letter, - digit, charIn, + createRegExp, + digit, exactly, global, + letter, + maybe, + oneOrMore, } from "magic-regexp"; import { z } from "zod"; import { diff --git a/server/api/api/v1/accounts/update_credentials/index.ts b/server/api/api/v1/accounts/update_credentials/index.ts index 25406975..403a693d 100644 --- a/server/api/api/v1/accounts/update_credentials/index.ts +++ b/server/api/api/v1/accounts/update_credentials/index.ts @@ -2,6 +2,7 @@ import { apiRoute, applyConfig } from "@api"; import { convertTextToHtml } from "@formatting"; import { errorResponse, jsonResponse } from "@response"; import { sanitizeHtml } from "@sanitization"; +import { config } from "config-manager"; import { and, eq } from "drizzle-orm"; import ISO6391 from "iso-639-1"; import { MediaBackendType } from "media-manager"; @@ -13,8 +14,7 @@ import { parseEmojis } from "~database/entities/Emoji"; import { findFirstUser, userToAPI } from "~database/entities/User"; import { db } from "~drizzle/db"; import { emojiToUser, user } from "~drizzle/schema"; -import { config } from "config-manager"; -import type { APISource } from "~types/entities/source"; +import type { Source as APISource } from "~types/mastodon/source"; export const meta = applyConfig({ allowedMethods: ["PATCH"], diff --git a/server/api/api/v1/apps/index.ts b/server/api/api/v1/apps/index.ts index 53a83c26..74e000b0 100644 --- a/server/api/api/v1/apps/index.ts +++ b/server/api/api/v1/apps/index.ts @@ -1,9 +1,9 @@ import { randomBytes } from "node:crypto"; import { apiRoute, applyConfig } from "@api"; import { errorResponse, jsonResponse } from "@response"; +import { z } from "zod"; import { db } from "~drizzle/db"; import { application } from "~drizzle/schema"; -import { z } from "zod"; export const meta = applyConfig({ allowedMethods: ["POST"], diff --git a/server/api/api/v1/instance/index.ts b/server/api/api/v1/instance/index.ts index ef149ca2..feee39a1 100644 --- a/server/api/api/v1/instance/index.ts +++ b/server/api/api/v1/instance/index.ts @@ -5,7 +5,7 @@ import { findFirstUser, userToAPI } from "~database/entities/User"; import { db } from "~drizzle/db"; import { instance, status, user } from "~drizzle/schema"; import manifest from "~package.json"; -import type { APIInstance } from "~types/entities/instance"; +import type { Instance as APIInstance } from "~types/mastodon/instance"; export const meta = applyConfig({ allowedMethods: ["GET"], @@ -81,14 +81,6 @@ export default apiRoute(async (req, matchedRoute, extraData) => { return jsonResponse({ approval_required: false, configuration: { - media_attachments: { - image_matrix_limit: config.validation.max_media_attachments, - image_size_limit: config.validation.max_media_size, - supported_mime_types: config.validation.allowed_mime_types, - video_frame_limit: 60, - video_matrix_limit: 10, - video_size_limit: config.validation.max_media_size, - }, polls: { max_characters_per_option: config.validation.max_poll_option_size, @@ -100,11 +92,6 @@ export default apiRoute(async (req, matchedRoute, extraData) => { characters_reserved_per_url: 0, max_characters: config.validation.max_note_size, max_media_attachments: config.validation.max_media_attachments, - supported_mime_types: [ - "text/plain", - "text/markdown", - "text/html", - ], }, }, description: "A test instance", @@ -122,14 +109,12 @@ export default apiRoute(async (req, matchedRoute, extraData) => { user_count: userCount, }, thumbnail: config.instance.logo, - tos_url: config.signups.tos_url, title: config.instance.name, uri: config.http.base_url, urls: { streaming_api: "", }, version: `4.3.0+glitch (compatible; Lysand ${version}})`, - max_toot_chars: config.validation.max_note_size, pleroma: { metadata: { account_activation_required: false, @@ -199,7 +184,6 @@ export default apiRoute(async (req, matchedRoute, extraData) => { }, vapid_public_key: "", }, - // @ts-expect-error Sometimes there just isnt an admin contact_account: contactAccount ? userToAPI(contactAccount) : undefined, } satisfies APIInstance & { pleroma: object; diff --git a/server/api/api/v1/media/[id]/index.ts b/server/api/api/v1/media/[id]/index.ts index 07279bcc..f80efa8b 100644 --- a/server/api/api/v1/media/[id]/index.ts +++ b/server/api/api/v1/media/[id]/index.ts @@ -1,5 +1,6 @@ import { apiRoute, applyConfig, idValidator } from "@api"; import { errorResponse, jsonResponse, response } from "@response"; +import { config } from "config-manager"; import { eq } from "drizzle-orm"; import type { MediaBackend } from "media-manager"; import { MediaBackendType } from "media-manager"; @@ -8,7 +9,6 @@ import { z } from "zod"; import { attachmentToAPI, getUrl } from "~database/entities/Attachment"; import { db } from "~drizzle/db"; import { attachment } from "~drizzle/schema"; -import { config } from "config-manager"; export const meta = applyConfig({ allowedMethods: ["GET", "PUT"], diff --git a/server/api/api/v1/media/index.ts b/server/api/api/v1/media/index.ts index 669e5819..2349f94d 100644 --- a/server/api/api/v1/media/index.ts +++ b/server/api/api/v1/media/index.ts @@ -1,6 +1,7 @@ import { apiRoute, applyConfig } from "@api"; import { errorResponse, jsonResponse } from "@response"; import { encode } from "blurhash"; +import { config } from "config-manager"; import { MediaBackendType } from "media-manager"; import type { MediaBackend } from "media-manager"; import { LocalMediaBackend, S3MediaBackend } from "media-manager"; @@ -9,7 +10,6 @@ import { z } from "zod"; import { attachmentToAPI, getUrl } from "~database/entities/Attachment"; import { db } from "~drizzle/db"; import { attachment } from "~drizzle/schema"; -import { config } from "config-manager"; export const meta = applyConfig({ allowedMethods: ["POST"], diff --git a/server/api/api/v1/statuses/[id]/favourite.ts b/server/api/api/v1/statuses/[id]/favourite.ts index 0b104f88..ad12a624 100644 --- a/server/api/api/v1/statuses/[id]/favourite.ts +++ b/server/api/api/v1/statuses/[id]/favourite.ts @@ -7,7 +7,7 @@ import { statusToAPI, } from "~database/entities/Status"; import { db } from "~drizzle/db"; -import type { APIStatus } from "~types/entities/status"; +import type { Status as APIStatus } from "~types/mastodon/status"; export const meta = applyConfig({ allowedMethods: ["POST"], diff --git a/server/api/api/v1/statuses/[id]/favourited_by.test.ts b/server/api/api/v1/statuses/[id]/favourited_by.test.ts index c76d6ce0..969025b1 100644 --- a/server/api/api/v1/statuses/[id]/favourited_by.test.ts +++ b/server/api/api/v1/statuses/[id]/favourited_by.test.ts @@ -6,7 +6,7 @@ import { getTestUsers, sendTestRequest, } from "~tests/utils"; -import type { APIAccount } from "~types/entities/account"; +import type { Account as APIAccount } from "~types/mastodon/account"; import { meta } from "./favourited_by"; await deleteOldTestUsers(); diff --git a/server/api/api/v1/statuses/[id]/index.ts b/server/api/api/v1/statuses/[id]/index.ts index 55a16ebc..b3ec5a01 100644 --- a/server/api/api/v1/statuses/[id]/index.ts +++ b/server/api/api/v1/statuses/[id]/index.ts @@ -1,7 +1,9 @@ import { apiRoute, applyConfig, idValidator } from "@api"; import { errorResponse, jsonResponse } from "@response"; import { sanitizeHtml } from "@sanitization"; +import { config } from "config-manager"; import { eq } from "drizzle-orm"; +import ISO6391 from "iso-639-1"; import { parse } from "marked"; import { z } from "zod"; import { @@ -12,8 +14,6 @@ import { } from "~database/entities/Status"; import { db } from "~drizzle/db"; import { status } from "~drizzle/schema"; -import { config } from "config-manager"; -import ISO6391 from "iso-639-1"; export const meta = applyConfig({ allowedMethods: ["GET", "DELETE", "PUT"], diff --git a/server/api/api/v1/statuses/[id]/reblogged_by.test.ts b/server/api/api/v1/statuses/[id]/reblogged_by.test.ts index 49c824fd..18de5ab3 100644 --- a/server/api/api/v1/statuses/[id]/reblogged_by.test.ts +++ b/server/api/api/v1/statuses/[id]/reblogged_by.test.ts @@ -6,8 +6,7 @@ import { getTestUsers, sendTestRequest, } from "~tests/utils"; -import type { APIAccount } from "~types/entities/account"; -import type { APIStatus } from "~types/entities/status"; +import type { Account as APIAccount } from "~types/mastodon/account"; import { meta } from "./reblogged_by"; await deleteOldTestUsers(); diff --git a/server/api/api/v1/statuses/[id]/unfavourite.ts b/server/api/api/v1/statuses/[id]/unfavourite.ts index e1526ee8..da708727 100644 --- a/server/api/api/v1/statuses/[id]/unfavourite.ts +++ b/server/api/api/v1/statuses/[id]/unfavourite.ts @@ -6,7 +6,7 @@ import { isViewableByUser, statusToAPI, } from "~database/entities/Status"; -import type { APIStatus } from "~types/entities/status"; +import type { Status as APIStatus } from "~types/mastodon/status"; export const meta = applyConfig({ allowedMethods: ["POST"], diff --git a/server/api/api/v1/statuses/[id]/unreblog.ts b/server/api/api/v1/statuses/[id]/unreblog.ts index 51b065c1..36c6cf63 100644 --- a/server/api/api/v1/statuses/[id]/unreblog.ts +++ b/server/api/api/v1/statuses/[id]/unreblog.ts @@ -8,7 +8,7 @@ import { } from "~database/entities/Status"; import { db } from "~drizzle/db"; import { status } from "~drizzle/schema"; -import type { APIStatus } from "~types/entities/status"; +import type { Status as APIStatus } from "~types/mastodon/status"; export const meta = applyConfig({ allowedMethods: ["POST"], diff --git a/server/api/api/v1/statuses/index.test.ts b/server/api/api/v1/statuses/index.test.ts index dfb4b1a6..c6823470 100644 --- a/server/api/api/v1/statuses/index.test.ts +++ b/server/api/api/v1/statuses/index.test.ts @@ -5,7 +5,7 @@ import { getTestUsers, sendTestRequest, } from "~tests/utils"; -import type { APIStatus } from "~types/entities/status"; +import type { Status as APIStatus } from "~types/mastodon/status"; import { meta } from "./index"; await deleteOldTestUsers(); @@ -292,6 +292,7 @@ describe(meta.route, () => { const object2 = (await response2.json()) as APIStatus; expect(object2.content).toBe("

Hello, world again!

"); + // @ts-expect-error Pleroma extension expect(object2.quote_id).toBe(object.id); }); diff --git a/server/api/api/v1/statuses/index.ts b/server/api/api/v1/statuses/index.ts index 21c2bd26..fa1a918e 100644 --- a/server/api/api/v1/statuses/index.ts +++ b/server/api/api/v1/statuses/index.ts @@ -1,6 +1,8 @@ import { apiRoute, applyConfig, idValidator } from "@api"; import { errorResponse, jsonResponse } from "@response"; import { sanitizeHtml } from "@sanitization"; +import { config } from "config-manager"; +import ISO6391 from "iso-639-1"; import { parse } from "marked"; import { z } from "zod"; import type { StatusWithRelations } from "~database/entities/Status"; @@ -12,8 +14,6 @@ import { statusToAPI, } from "~database/entities/Status"; import { db } from "~drizzle/db"; -import { config } from "config-manager"; -import ISO6391 from "iso-639-1"; export const meta = applyConfig({ allowedMethods: ["POST"], diff --git a/server/api/api/v1/timelines/home.test.ts b/server/api/api/v1/timelines/home.test.ts index 8b472da8..bebfcc47 100644 --- a/server/api/api/v1/timelines/home.test.ts +++ b/server/api/api/v1/timelines/home.test.ts @@ -6,7 +6,7 @@ import { getTestUsers, sendTestRequest, } from "~tests/utils"; -import type { APIStatus } from "~types/entities/status"; +import type { Status as APIStatus } from "~types/mastodon/status"; import { meta } from "./home"; await deleteOldTestUsers(); diff --git a/server/api/api/v1/timelines/public.test.ts b/server/api/api/v1/timelines/public.test.ts index 8de8f0e8..382d23b6 100644 --- a/server/api/api/v1/timelines/public.test.ts +++ b/server/api/api/v1/timelines/public.test.ts @@ -6,7 +6,7 @@ import { getTestUsers, sendTestRequest, } from "~tests/utils"; -import type { APIStatus } from "~types/entities/status"; +import type { Status as APIStatus } from "~types/mastodon/status"; import { meta } from "./public"; await deleteOldTestUsers(); diff --git a/tests/api.test.ts b/tests/api.test.ts index 0df4b782..20cfc293 100644 --- a/tests/api.test.ts +++ b/tests/api.test.ts @@ -3,8 +3,8 @@ import { config } from "config-manager"; import { eq } from "drizzle-orm"; import { db } from "~drizzle/db"; import { emoji } from "~drizzle/schema"; -import type { APIEmoji } from "~types/entities/emoji"; -import type { APIInstance } from "~types/entities/instance"; +import type { Emoji as APIEmoji } from "~types/mastodon/emoji"; +import type { Instance as APIInstance } from "~types/mastodon/instance"; import { getTestUsers, sendTestRequest, wrapRelativeUrl } from "./utils"; const base_url = config.http.base_url; @@ -44,7 +44,6 @@ describe("API Tests", () => { // expect(instance.contact_account).toBeDefined(); expect(instance.rules).toBeDefined(); expect(instance.approval_required).toBeDefined(); - expect(instance.max_toot_chars).toBeDefined(); }); }); diff --git a/tests/api/accounts.test.ts b/tests/api/accounts.test.ts index caebb763..6e6711a6 100644 --- a/tests/api/accounts.test.ts +++ b/tests/api/accounts.test.ts @@ -1,9 +1,9 @@ -import { afterAll, beforeAll, describe, expect, test } from "bun:test"; +import { afterAll, describe, expect, test } from "bun:test"; import { config } from "config-manager"; import { getTestUsers, sendTestRequest, wrapRelativeUrl } from "~tests/utils"; -import type { APIAccount } from "~types/entities/account"; -import type { APIRelationship } from "~types/entities/relationship"; -import type { APIStatus } from "~types/entities/status"; +import type { Account as APIAccount } from "~types/mastodon/account"; +import type { Relationship as APIRelationship } from "~types/mastodon/relationship"; +import type { Status as APIStatus } from "~types/mastodon/status"; const base_url = config.http.base_url; diff --git a/tests/api/statuses.test.ts b/tests/api/statuses.test.ts index 266acd3c..487dc4dc 100644 --- a/tests/api/statuses.test.ts +++ b/tests/api/statuses.test.ts @@ -1,16 +1,10 @@ import { afterAll, describe, expect, test } from "bun:test"; import { config } from "config-manager"; -import { statusToAPI } from "~database/entities/Status"; -import { - getTestStatuses, - getTestUsers, - sendTestRequest, - wrapRelativeUrl, -} from "~tests/utils"; -import type { APIAccount } from "~types/entities/account"; -import type { APIAsyncAttachment } from "~types/entities/async_attachment"; -import type { APIContext } from "~types/entities/context"; -import type { APIStatus } from "~types/entities/status"; +import { getTestUsers, sendTestRequest, wrapRelativeUrl } from "~tests/utils"; +import type { Account as APIAccount } from "~types/mastodon/account"; +import type { AsyncAttachment as APIAsyncAttachment } from "~types/mastodon/async_attachment"; +import type { Context as APIContext } from "~types/mastodon/context"; +import type { Status as APIStatus } from "~types/mastodon/status"; const base_url = config.http.base_url; diff --git a/tests/oauth.test.ts b/tests/oauth.test.ts index ff995c14..e70cf4be 100644 --- a/tests/oauth.test.ts +++ b/tests/oauth.test.ts @@ -1,6 +1,6 @@ import { afterAll, describe, expect, test } from "bun:test"; -import type { APIApplication } from "~types/entities/application"; -import type { APIToken } from "~types/entities/token"; +import type { Application as APIApplication } from "~types/mastodon/application"; +import type { Token as APIToken } from "~types/mastodon/token"; import { deleteOldTestUsers, getTestUsers, diff --git a/types/entities/account.ts b/types/entities-2/account.ts similarity index 100% rename from types/entities/account.ts rename to types/entities-2/account.ts diff --git a/types/entities/activity.ts b/types/entities-2/activity.ts similarity index 100% rename from types/entities/activity.ts rename to types/entities-2/activity.ts diff --git a/types/entities/announcement.ts b/types/entities-2/announcement.ts similarity index 100% rename from types/entities/announcement.ts rename to types/entities-2/announcement.ts diff --git a/types/entities/application.ts b/types/entities-2/application.ts similarity index 100% rename from types/entities/application.ts rename to types/entities-2/application.ts diff --git a/types/entities/async_attachment.ts b/types/entities-2/async_attachment.ts similarity index 100% rename from types/entities/async_attachment.ts rename to types/entities-2/async_attachment.ts diff --git a/types/entities/attachment.ts b/types/entities-2/attachment.ts similarity index 100% rename from types/entities/attachment.ts rename to types/entities-2/attachment.ts diff --git a/types/entities/card.ts b/types/entities-2/card.ts similarity index 100% rename from types/entities/card.ts rename to types/entities-2/card.ts diff --git a/types/entities/context.ts b/types/entities-2/context.ts similarity index 100% rename from types/entities/context.ts rename to types/entities-2/context.ts diff --git a/types/entities/conversation.ts b/types/entities-2/conversation.ts similarity index 100% rename from types/entities/conversation.ts rename to types/entities-2/conversation.ts diff --git a/types/entities/emoji.ts b/types/entities-2/emoji.ts similarity index 100% rename from types/entities/emoji.ts rename to types/entities-2/emoji.ts diff --git a/types/entities/featured_tag.ts b/types/entities-2/featured_tag.ts similarity index 100% rename from types/entities/featured_tag.ts rename to types/entities-2/featured_tag.ts diff --git a/types/entities/field.ts b/types/entities-2/field.ts similarity index 100% rename from types/entities/field.ts rename to types/entities-2/field.ts diff --git a/types/entities/filter.ts b/types/entities-2/filter.ts similarity index 100% rename from types/entities/filter.ts rename to types/entities-2/filter.ts diff --git a/types/entities/history.ts b/types/entities-2/history.ts similarity index 100% rename from types/entities/history.ts rename to types/entities-2/history.ts diff --git a/types/entities/identity_proof.ts b/types/entities-2/identity_proof.ts similarity index 100% rename from types/entities/identity_proof.ts rename to types/entities-2/identity_proof.ts diff --git a/types/entities/instance.ts b/types/entities-2/instance.ts similarity index 100% rename from types/entities/instance.ts rename to types/entities-2/instance.ts diff --git a/types/entities/list.ts b/types/entities-2/list.ts similarity index 100% rename from types/entities/list.ts rename to types/entities-2/list.ts diff --git a/types/entities/marker.ts b/types/entities-2/marker.ts similarity index 100% rename from types/entities/marker.ts rename to types/entities-2/marker.ts diff --git a/types/entities/mention.ts b/types/entities-2/mention.ts similarity index 100% rename from types/entities/mention.ts rename to types/entities-2/mention.ts diff --git a/types/entities/notification.ts b/types/entities-2/notification.ts similarity index 100% rename from types/entities/notification.ts rename to types/entities-2/notification.ts diff --git a/types/entities/poll.ts b/types/entities-2/poll.ts similarity index 100% rename from types/entities/poll.ts rename to types/entities-2/poll.ts diff --git a/types/entities/poll_option.ts b/types/entities-2/poll_option.ts similarity index 100% rename from types/entities/poll_option.ts rename to types/entities-2/poll_option.ts diff --git a/types/entities/preferences.ts b/types/entities-2/preferences.ts similarity index 100% rename from types/entities/preferences.ts rename to types/entities-2/preferences.ts diff --git a/types/entities/push_subscription.ts b/types/entities-2/push_subscription.ts similarity index 100% rename from types/entities/push_subscription.ts rename to types/entities-2/push_subscription.ts diff --git a/types/entities/relationship.ts b/types/entities-2/relationship.ts similarity index 100% rename from types/entities/relationship.ts rename to types/entities-2/relationship.ts diff --git a/types/entities/report.ts b/types/entities-2/report.ts similarity index 100% rename from types/entities/report.ts rename to types/entities-2/report.ts diff --git a/types/entities/results.ts b/types/entities-2/results.ts similarity index 100% rename from types/entities/results.ts rename to types/entities-2/results.ts diff --git a/types/entities/role.ts b/types/entities-2/role.ts similarity index 100% rename from types/entities/role.ts rename to types/entities-2/role.ts diff --git a/types/entities/scheduled_status.ts b/types/entities-2/scheduled_status.ts similarity index 100% rename from types/entities/scheduled_status.ts rename to types/entities-2/scheduled_status.ts diff --git a/types/entities/source.ts b/types/entities-2/source.ts similarity index 100% rename from types/entities/source.ts rename to types/entities-2/source.ts diff --git a/types/entities/stats.ts b/types/entities-2/stats.ts similarity index 100% rename from types/entities/stats.ts rename to types/entities-2/stats.ts diff --git a/types/entities/status.ts b/types/entities-2/status.ts similarity index 100% rename from types/entities/status.ts rename to types/entities-2/status.ts diff --git a/types/entities/status_params.ts b/types/entities-2/status_params.ts similarity index 100% rename from types/entities/status_params.ts rename to types/entities-2/status_params.ts diff --git a/types/entities/status_source.ts b/types/entities-2/status_source.ts similarity index 100% rename from types/entities/status_source.ts rename to types/entities-2/status_source.ts diff --git a/types/entities/tag.ts b/types/entities-2/tag.ts similarity index 100% rename from types/entities/tag.ts rename to types/entities-2/tag.ts diff --git a/types/entities/token.ts b/types/entities-2/token.ts similarity index 100% rename from types/entities/token.ts rename to types/entities-2/token.ts diff --git a/types/entities/urls.ts b/types/entities-2/urls.ts similarity index 100% rename from types/entities/urls.ts rename to types/entities-2/urls.ts diff --git a/types/mastodon/account.ts b/types/mastodon/account.ts new file mode 100644 index 00000000..9d796c8a --- /dev/null +++ b/types/mastodon/account.ts @@ -0,0 +1,34 @@ +import type { Emoji } from "./emoji"; +import type { Field } from "./field"; +import type { Role } from "./role"; +import type { Source } from "./source"; + +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; + moved: Account | null; + fields: Array; + bot: boolean | null; + source?: Source; + role?: Role; + mute_expires_at?: string; +}; diff --git a/types/mastodon/activity.ts b/types/mastodon/activity.ts new file mode 100644 index 00000000..8dbc511e --- /dev/null +++ b/types/mastodon/activity.ts @@ -0,0 +1,6 @@ +export type Activity = { + week: string; + statuses: string; + logins: string; + registrations: string; +}; diff --git a/types/mastodon/announcement.ts b/types/mastodon/announcement.ts new file mode 100644 index 00000000..5a4642cf --- /dev/null +++ b/types/mastodon/announcement.ts @@ -0,0 +1,39 @@ +import type { Emoji } from "./emoji"; +import type { StatusTag } from "./status"; + +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; + statuses: Array; + tags: Array; + emojis: Array; + reactions: Array; +}; + +export type AnnouncementAccount = { + id: string; + username: string; + url: string; + acct: 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; +}; diff --git a/types/mastodon/application.ts b/types/mastodon/application.ts new file mode 100644 index 00000000..fa350331 --- /dev/null +++ b/types/mastodon/application.ts @@ -0,0 +1,5 @@ +export type Application = { + name: string; + website?: string | null; + vapid_key?: string | null; +}; diff --git a/types/mastodon/async_attachment.ts b/types/mastodon/async_attachment.ts new file mode 100644 index 00000000..7b2b5b05 --- /dev/null +++ b/types/mastodon/async_attachment.ts @@ -0,0 +1,13 @@ +import type { 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; +}; diff --git a/types/mastodon/attachment.ts b/types/mastodon/attachment.ts new file mode 100644 index 00000000..c3a36977 --- /dev/null +++ b/types/mastodon/attachment.ts @@ -0,0 +1,47 @@ +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"; + url: string; + remote_url: string | null; + preview_url: string | null; + text_url: string | null; + meta: Meta | null; + description: string | null; + blurhash: string | null; +}; diff --git a/types/mastodon/card.ts b/types/mastodon/card.ts new file mode 100644 index 00000000..6d12122a --- /dev/null +++ b/types/mastodon/card.ts @@ -0,0 +1,16 @@ +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; +}; diff --git a/types/mastodon/context.ts b/types/mastodon/context.ts new file mode 100644 index 00000000..23f96436 --- /dev/null +++ b/types/mastodon/context.ts @@ -0,0 +1,6 @@ +import type { Status } from "./status"; + +export type Context = { + ancestors: Array; + descendants: Array; +}; diff --git a/types/mastodon/conversation.ts b/types/mastodon/conversation.ts new file mode 100644 index 00000000..4a44c9b8 --- /dev/null +++ b/types/mastodon/conversation.ts @@ -0,0 +1,9 @@ +import type { Account } from "./account"; +import type { Status } from "./status"; + +export type Conversation = { + id: string; + accounts: Array; + last_status: Status | null; + unread: boolean; +}; diff --git a/types/mastodon/emoji.ts b/types/mastodon/emoji.ts new file mode 100644 index 00000000..cc8de673 --- /dev/null +++ b/types/mastodon/emoji.ts @@ -0,0 +1,7 @@ +export type Emoji = { + shortcode: string; + static_url: string; + url: string; + visible_in_picker: boolean; + category?: string; +}; diff --git a/types/mastodon/featured_tag.ts b/types/mastodon/featured_tag.ts new file mode 100644 index 00000000..2fe3ba6d --- /dev/null +++ b/types/mastodon/featured_tag.ts @@ -0,0 +1,6 @@ +export type FeaturedTag = { + id: string; + name: string; + statuses_count: number; + last_status_at: string; +}; diff --git a/types/mastodon/field.ts b/types/mastodon/field.ts new file mode 100644 index 00000000..77982696 --- /dev/null +++ b/types/mastodon/field.ts @@ -0,0 +1,6 @@ +export type Field = { + name: string; + value: string; + verified_at?: string | null; + verified?: boolean | false; +}; diff --git a/types/mastodon/filter.ts b/types/mastodon/filter.ts new file mode 100644 index 00000000..a39928cc --- /dev/null +++ b/types/mastodon/filter.ts @@ -0,0 +1,10 @@ +export type Filter = { + id: string; + phrase: string; + context: Array; + expires_at: string | null; + irreversible: boolean; + whole_word: boolean; +}; + +export type FilterContext = string; diff --git a/types/mastodon/follow_request.ts b/types/mastodon/follow_request.ts new file mode 100644 index 00000000..edcc4476 --- /dev/null +++ b/types/mastodon/follow_request.ts @@ -0,0 +1,25 @@ +import type { Emoji } from "./emoji"; +import type { Field } from "./field"; + +export type FollowRequest = { + id: number; + username: string; + acct: string; + display_name: string; + locked: boolean; + bot: boolean; + discoverable?: boolean; + group: boolean; + created_at: string; + note: string; + url: string; + avatar: string; + avatar_static: string; + header: string; + header_static: string; + followers_count: number; + following_count: number; + statuses_count: number; + emojis: Array; + fields: Array; +}; diff --git a/types/mastodon/history.ts b/types/mastodon/history.ts new file mode 100644 index 00000000..22176bde --- /dev/null +++ b/types/mastodon/history.ts @@ -0,0 +1,5 @@ +export type History = { + day: string; + uses: number; + accounts: number; +}; diff --git a/types/mastodon/identity_proof.ts b/types/mastodon/identity_proof.ts new file mode 100644 index 00000000..00d9efcd --- /dev/null +++ b/types/mastodon/identity_proof.ts @@ -0,0 +1,7 @@ +export type IdentityProof = { + provider: string; + provider_username: string; + updated_at: string; + proof_url: string; + profile_url: string; +}; diff --git a/types/mastodon/instance.ts b/types/mastodon/instance.ts new file mode 100644 index 00000000..b2768809 --- /dev/null +++ b/types/mastodon/instance.ts @@ -0,0 +1,38 @@ +import type { Account } from "./account"; +import type { Stats } from "./stats"; +import type { URLs } from "./urls"; + +export type Instance = { + uri: string; + title: string; + description: string; + email: string; + version: string; + thumbnail: string | null; + urls: URLs | null; + stats: Stats; + languages: Array; + registrations: boolean; + approval_required: boolean; + invites_enabled?: boolean; + configuration: { + statuses: { + max_characters: number; + max_media_attachments?: number; + characters_reserved_per_url?: number; + }; + polls?: { + max_options: number; + max_characters_per_option: number; + min_expiration: number; + max_expiration: number; + }; + }; + contact_account?: Account; + rules?: Array; +}; + +export type InstanceRule = { + id: string; + text: string; +}; diff --git a/types/mastodon/list.ts b/types/mastodon/list.ts new file mode 100644 index 00000000..3ae0d375 --- /dev/null +++ b/types/mastodon/list.ts @@ -0,0 +1,7 @@ +export type List = { + id: string; + title: string; + replies_policy: RepliesPolicy | null; +}; + +export type RepliesPolicy = "followed" | "list" | "none"; diff --git a/types/mastodon/marker.ts b/types/mastodon/marker.ts new file mode 100644 index 00000000..d69b0ef8 --- /dev/null +++ b/types/mastodon/marker.ts @@ -0,0 +1,13 @@ +export type Marker = { + home?: { + last_read_id: string; + version: number; + updated_at: string; + }; + notifications?: { + last_read_id: string; + version: number; + updated_at: string; + unread_count?: number; + }; +}; diff --git a/types/mastodon/mention.ts b/types/mastodon/mention.ts new file mode 100644 index 00000000..dba8929b --- /dev/null +++ b/types/mastodon/mention.ts @@ -0,0 +1,6 @@ +export type Mention = { + id: string; + username: string; + url: string; + acct: string; +}; diff --git a/types/mastodon/notification.ts b/types/mastodon/notification.ts new file mode 100644 index 00000000..d240f498 --- /dev/null +++ b/types/mastodon/notification.ts @@ -0,0 +1,15 @@ +import type { Account } from "./account"; +import type { Reaction } from "./reaction"; +import type { Status } from "./status"; + +export type Notification = { + account: Account | null; + created_at: string; + id: string; + status?: Status; + reaction?: Reaction; + type: NotificationType; + target?: Account; +}; + +export type NotificationType = string; diff --git a/types/mastodon/poll.ts b/types/mastodon/poll.ts new file mode 100644 index 00000000..48fed02c --- /dev/null +++ b/types/mastodon/poll.ts @@ -0,0 +1,14 @@ +export type Poll = { + id: string; + expires_at: string | null; + expired: boolean; + multiple: boolean; + votes_count: number; + options: Array; + voted: boolean; +}; + +export type PollOption = { + title: string; + votes_count: number | null; +}; diff --git a/types/mastodon/preferences.ts b/types/mastodon/preferences.ts new file mode 100644 index 00000000..c0efe96c --- /dev/null +++ b/types/mastodon/preferences.ts @@ -0,0 +1,9 @@ +import type { StatusVisibility } from "./status"; + +export type Preferences = { + "posting:default:visibility": StatusVisibility; + "posting:default:sensitive": boolean; + "posting:default:language": string | null; + "reading:expand:media": "default" | "show_all" | "hide_all"; + "reading:expand:spoilers": boolean; +}; diff --git a/types/mastodon/push_subscription.ts b/types/mastodon/push_subscription.ts new file mode 100644 index 00000000..0449551e --- /dev/null +++ b/types/mastodon/push_subscription.ts @@ -0,0 +1,14 @@ +export type Alerts = { + follow: boolean; + favourite: boolean; + mention: boolean; + reblog: boolean; + poll: boolean; +}; + +export type PushSubscription = { + id: string; + endpoint: string; + server_key: string; + alerts: Alerts; +}; diff --git a/types/mastodon/reaction.ts b/types/mastodon/reaction.ts new file mode 100644 index 00000000..e7fffdf9 --- /dev/null +++ b/types/mastodon/reaction.ts @@ -0,0 +1,11 @@ +import type { Account } from "./account"; + +export type Reaction = { + count: number; + me: boolean; + name: string; + url?: string; + static_url?: string; + accounts?: Array; + account_ids?: Array; +}; diff --git a/types/mastodon/relationship.ts b/types/mastodon/relationship.ts new file mode 100644 index 00000000..1d5540de --- /dev/null +++ b/types/mastodon/relationship.ts @@ -0,0 +1,15 @@ +export type Relationship = { + id: string; + following: boolean; + followed_by: boolean; + blocking: boolean; + blocked_by: boolean; + muting: boolean; + muting_notifications: boolean; + requested: boolean; + domain_blocking: boolean; + showing_reblogs: boolean; + endorsed: boolean; + notifying: boolean; + note: string | null; +}; diff --git a/types/mastodon/report.ts b/types/mastodon/report.ts new file mode 100644 index 00000000..385e5d8e --- /dev/null +++ b/types/mastodon/report.ts @@ -0,0 +1,16 @@ +import type { Account } from "./account"; + +export type Report = { + id: string; + action_taken: boolean; + action_taken_at: string | null; + status_ids: Array | null; + rule_ids: Array | null; + // These parameters don't exist in Pleroma + category: Category | null; + comment: string | null; + forwarded: boolean | null; + target_account?: Account | null; +}; + +export type Category = "spam" | "violation" | "other"; diff --git a/types/mastodon/results.ts b/types/mastodon/results.ts new file mode 100644 index 00000000..68ffd531 --- /dev/null +++ b/types/mastodon/results.ts @@ -0,0 +1,9 @@ +import type { Account } from "./account"; +import type { Status } from "./status"; +import type { Tag } from "./tag"; + +export type Results = { + accounts: Array; + statuses: Array; + hashtags: Array; +}; diff --git a/types/mastodon/role.ts b/types/mastodon/role.ts new file mode 100644 index 00000000..fdb98cab --- /dev/null +++ b/types/mastodon/role.ts @@ -0,0 +1,3 @@ +export type Role = { + name: string; +}; diff --git a/types/mastodon/scheduled_status.ts b/types/mastodon/scheduled_status.ts new file mode 100644 index 00000000..e8f8a2a9 --- /dev/null +++ b/types/mastodon/scheduled_status.ts @@ -0,0 +1,9 @@ +import type { Attachment } from "./attachment"; +import type { StatusParams } from "./status_params"; + +export type ScheduledStatus = { + id: string; + scheduled_at: string; + params: StatusParams; + media_attachments: Array | null; +}; diff --git a/types/mastodon/source.ts b/types/mastodon/source.ts new file mode 100644 index 00000000..161be04f --- /dev/null +++ b/types/mastodon/source.ts @@ -0,0 +1,9 @@ +import type { Field } from "./field"; + +export type Source = { + privacy: string | null; + sensitive: boolean | null; + language: string | null; + note: string; + fields: Array; +}; diff --git a/types/mastodon/stats.ts b/types/mastodon/stats.ts new file mode 100644 index 00000000..7654b385 --- /dev/null +++ b/types/mastodon/stats.ts @@ -0,0 +1,5 @@ +export type Stats = { + user_count: number; + status_count: number; + domain_count: number; +}; diff --git a/types/mastodon/status.ts b/types/mastodon/status.ts new file mode 100644 index 00000000..c61c984d --- /dev/null +++ b/types/mastodon/status.ts @@ -0,0 +1,50 @@ +import type { Account } from "./account"; +import type { Application } from "./application"; +import type { Attachment } from "./attachment"; +import type { Card } from "./card"; +import type { Emoji } from "./emoji"; +import type { Mention } from "./mention"; +import type { Poll } from "./poll"; +import type { Reaction } from "./reaction"; + +export type Status = { + id: string; + uri: string; + url: string; + account: Account; + in_reply_to_id: string | null; + in_reply_to_account_id: string | null; + reblog: Status | null; + content: string; + plain_content: string | null; + created_at: string; + edited_at: string | null; + emojis: Emoji[]; + replies_count: number; + reblogs_count: number; + favourites_count: number; + reblogged: boolean | null; + favourited: boolean | null; + muted: boolean | null; + sensitive: boolean; + spoiler_text: string; + visibility: StatusVisibility; + media_attachments: Array; + mentions: Array; + tags: Array; + card: Card | null; + poll: Poll | null; + application: Application | null; + language: string | null; + pinned: boolean | null; + emoji_reactions: Array; + quote: boolean; + bookmarked: boolean; +}; + +export type StatusTag = { + name: string; + url: string; +}; + +export type StatusVisibility = "public" | "unlisted" | "private" | "direct"; diff --git a/types/mastodon/status_params.ts b/types/mastodon/status_params.ts new file mode 100644 index 00000000..89babfbf --- /dev/null +++ b/types/mastodon/status_params.ts @@ -0,0 +1,12 @@ +import type { StatusVisibility } from "./status"; + +export type StatusParams = { + text: string; + in_reply_to_id: string | null; + media_ids: Array | null; + sensitive: boolean | null; + spoiler_text: string | null; + visibility: StatusVisibility | null; + scheduled_at: string | null; + application_id: number | null; +}; diff --git a/types/mastodon/status_source.ts b/types/mastodon/status_source.ts new file mode 100644 index 00000000..346c346a --- /dev/null +++ b/types/mastodon/status_source.ts @@ -0,0 +1,5 @@ +export type StatusSource = { + id: string; + text: string; + spoiler_text: string; +}; diff --git a/types/mastodon/tag.ts b/types/mastodon/tag.ts new file mode 100644 index 00000000..da41dd32 --- /dev/null +++ b/types/mastodon/tag.ts @@ -0,0 +1,8 @@ +import type { History } from "./history"; + +export type Tag = { + name: string; + url: string; + history: Array; + following?: boolean; +}; diff --git a/types/mastodon/token.ts b/types/mastodon/token.ts new file mode 100644 index 00000000..0021a493 --- /dev/null +++ b/types/mastodon/token.ts @@ -0,0 +1,6 @@ +export type Token = { + access_token: string; + token_type: string; + scope: string; + created_at: number; +}; diff --git a/types/mastodon/urls.ts b/types/mastodon/urls.ts new file mode 100644 index 00000000..59cca700 --- /dev/null +++ b/types/mastodon/urls.ts @@ -0,0 +1,3 @@ +export type URLs = { + streaming_api: string; +};