refactor: ⬆️ Update @lysand-org/client to 0.2.0, use its types instead

This commit is contained in:
Jesse Wierzbinski 2024-06-19 13:57:38 -10:00
parent cd1fb48b68
commit 8a984abfb2
No known key found for this signature in database
75 changed files with 63 additions and 640 deletions

BIN
bun.lockb

Binary file not shown.

View file

@ -46,9 +46,8 @@
</template>
<script lang="ts" setup>
import type { Instance, Status } from "@lysand-org/client/types";
import { nanoid } from "nanoid";
import type { Instance } from "~/types/mastodon/instance";
import type { Status } from "~/types/mastodon/status";
import { OverlayScrollbarsComponent } from "#imports";
import type FileUploader from "./file-uploader.vue";

View file

@ -10,8 +10,8 @@
</template>
<script lang="ts" setup>
import type { Emoji } from "@lysand-org/client/types";
import { distance } from "fastest-levenshtein";
import type { CustomEmoji } from "~/composables/Identities";
const props = defineProps<{
currentlyTypingEmoji: string | null;
textarea: HTMLTextAreaElement | undefined;
@ -30,7 +30,7 @@ const { Tab, ArrowRight, ArrowLeft, Enter } = useMagicKeys({
},
});
const identity = useCurrentIdentity();
const topEmojis = ref<CustomEmoji[] | null>(null);
const topEmojis = ref<Emoji[] | null>(null);
const selectedEmojiIndex = ref<number | null>(null);
watchEffect(() => {

View file

@ -9,8 +9,8 @@
</template>
<script lang="ts" setup>
import type { Account } from "@lysand-org/client/types";
import { distance } from "fastest-levenshtein";
import type { Account } from "~/types/mastodon/account";
const props = defineProps<{
currentlyTypingMention: string | null;
textarea: HTMLTextAreaElement | undefined;

View file

@ -25,7 +25,7 @@
</div>
<div class="mt-3 px-4">
<InputsRichTextbox v-model:model-content="note" :max-characters="noteCharacterLimit" :disabled="loading"
<InputsRichTextbox v-model:model-content="note" :max-characters="bio" :disabled="loading"
class="rounded ring-white/10 ring-2 focus:ring-primary-600 px-4 py-2 max-h-[40dvh] max-w-full" />
</div>
@ -52,7 +52,7 @@ const account = computed(() => identity.value?.account);
const note = ref(account.value?.source?.note ?? "");
const displayName = ref(account.value?.display_name ?? "");
const acct = ref(account.value?.acct ?? "");
const noteCharacterLimit = computed(
const bio = computed(
() => identity.value?.instance.configuration.statuses.max_characters ?? 0,
);

View file

@ -44,7 +44,7 @@
<script lang="ts" setup>
import { Dialog } from "@ark-ui/vue";
import type { Attachment } from "~/types/mastodon/attachment";
import type { Attachment } from "@lysand-org/client/types";
const lightbox = ref(false);
const attachment = ref<Attachment | null>(null);

View file

@ -39,7 +39,7 @@
<script lang="ts" setup>
import { Popover } from "@ark-ui/vue";
import type { Attachment } from "~/types/mastodon/attachment";
import type { Attachment } from "@lysand-org/client/types";
const props = defineProps<{
attachment: Attachment;

View file

@ -66,7 +66,7 @@
</template>
<script lang="ts" setup>
import type { Status } from "~/types/mastodon/status";
import type { Status } from "@lysand-org/client/types";
const props = defineProps<{
note?: Status;

View file

@ -8,7 +8,7 @@
</template>
<script lang="ts" setup>
import type { Account } from "~/types/mastodon/account";
import type { Account } from "@lysand-org/client/types";
const props = defineProps<{
account: Account;

View file

@ -27,7 +27,7 @@
</template>
<script lang="ts" setup>
import type { Status } from "~/types/mastodon/status";
import type { Status } from "@lysand-org/client/types";
const props = defineProps<{
content: string | null;

View file

@ -130,11 +130,11 @@
<Menu.Item value="">
<ButtonsDropdownElement @click="outputtedNote && useEvent('note:report', outputtedNote)"
icon="tabler:flag" class="w-full"
:disabled="!permissions.includes(RolePermissions.MANAGE_OWN_REPORTS)">
:disabled="!permissions.includes(RolePermission.ManageOwnReports)">
Report
</ButtonsDropdownElement>
</Menu.Item>
<Menu.Item value="" v-if="permissions.includes(RolePermissions.MANAGE_ACCOUNTS)">
<Menu.Item value="" v-if="permissions.includes(RolePermission.ManageAccounts)">
<ButtonsDropdownElement icon="tabler:shield-bolt" class="w-full">
Open Moderation Panel
</ButtonsDropdownElement>
@ -149,8 +149,8 @@
<script lang="ts" setup>
import { Menu } from "@ark-ui/vue";
import { RolePermission, type Status } from "@lysand-org/client/types";
import Skeleton from "~/components/skeleton/Skeleton.vue";
import type { Status } from "~/types/mastodon/status";
const props = withDefaults(
defineProps<{

View file

@ -29,8 +29,7 @@
</template>
<script lang="ts" setup>
import type { Notification } from "~/types/mastodon/notification";
import type { Relationship } from "~/types/mastodon/relationship";
import type { Notification, Relationship } from "@lysand-org/client/types";
const props = defineProps<{
notification?: Notification;

View file

@ -98,7 +98,7 @@
</template>
<script lang="ts" setup>
import type { Account } from "~/types/mastodon/account";
import type { Account } from "@lysand-org/client/types";
const props = defineProps<{
account?: Account;

View file

@ -27,7 +27,7 @@
</template>
<script lang="ts" setup>
import type { Account } from "~/types/mastodon/account";
import type { Account } from "@lysand-org/client/types";
import { NuxtLink } from "#components";
const props = defineProps<{

View file

@ -13,7 +13,7 @@
</template>
<script lang="ts" setup>
import type { Status } from "~/types/mastodon/status";
import type { Status } from "@lysand-org/client/types";
const props = defineProps<{
timeline: Status[];

View file

@ -1,5 +1,5 @@
import type { LysandClient } from "@lysand-org/client";
import type { Account } from "~/types/mastodon/account";
import type { Account } from "@lysand-org/client/types";
export const useAccount = (
client: MaybeRef<LysandClient | null>,

View file

@ -1,5 +1,5 @@
import type { LysandClient } from "@lysand-org/client";
import type { Account } from "~/types/mastodon/account";
import type { Account } from "@lysand-org/client/types";
export const useAccountSearch = (
client: MaybeRef<LysandClient | null>,

View file

@ -1,5 +1,5 @@
import type { LysandClient } from "@lysand-org/client";
import type { Status } from "~/types/mastodon/status";
import type { Status } from "@lysand-org/client/types";
export const useAccountTimeline = (
client: LysandClient | null,

View file

@ -1,10 +1,6 @@
import type { LysandClient } from "@lysand-org/client";
import type { ApplicationData } from "@lysand-org/client/types";
import { StorageSerializers } from "@vueuse/core";
export type ApplicationData = Awaited<
ReturnType<LysandClient["createApp"]>
>["data"];
export const useAppData = () => {
return useLocalStorage<ApplicationData | null>("lysand:app_data", null, {
serializer: StorageSerializers.object,

View file

@ -1,5 +1,6 @@
import type { LysandClient } from "@lysand-org/client";
import { type RolePermissions, useCurrentIdentity } from "./Identities";
import type { RolePermission } from "@lysand-org/client/types";
import { useCurrentIdentity } from "./Identities";
export const useCacheRefresh = (client: MaybeRef<LysandClient | null>) => {
if (import.meta.server) return;
@ -48,7 +49,7 @@ export const useCacheRefresh = (client: MaybeRef<LysandClient | null>) => {
if (identity.value)
identity.value.permissions =
permissions as unknown as RolePermissions[];
permissions as unknown as RolePermission[];
});
}

View file

@ -1,6 +1,5 @@
import type { Attachment, Status } from "@lysand-org/client/types";
import mitt from "mitt";
import type { Attachment } from "~/types/mastodon/attachment";
import type { Status } from "~/types/mastodon/status";
import type { Identity } from "./Identities";
export type NotificationEvent = {

View file

@ -1,5 +1,5 @@
import type { LysandClient } from "@lysand-org/client";
import type { Status } from "~/types/mastodon/status";
import type { Status } from "@lysand-org/client/types";
export const useHomeTimeline = (
client: LysandClient | null,

View file

@ -1,65 +1,19 @@
import type { LysandClient, Token } from "@lysand-org/client";
import type { Token } from "@lysand-org/client";
import type {
Account,
Emoji,
Instance,
RolePermission,
} from "@lysand-org/client/types";
import { StorageSerializers } from "@vueuse/core";
import type { Account } from "~/types/mastodon/account";
import type { Instance } from "./Instance";
export type Role = Awaited<ReturnType<LysandClient["getRole"]>>["data"];
export enum RolePermissions {
MANAGE_NOTES = "notes",
MANAGE_OWN_NOTES = "owner:note",
VIEW_NOTES = "read:note",
VIEW_NOTE_LIKES = "read:note_likes",
VIEW_NOTE_BOOSTS = "read:note_boosts",
MANAGE_ACCOUNTS = "accounts",
MANAGE_OWN_ACCOUNT = "owner:account",
VIEW_ACCOUNT_FOLLOWS = "read:account_follows",
MANAGE_LIKES = "likes",
MANAGE_OWN_LIKES = "owner:like",
MANAGE_BOOSTS = "boosts",
MANAGE_OWN_BOOSTS = "owner:boost",
VIEW_ACCOUNTS = "read:account",
MANAGE_EMOJIS = "emojis",
VIEW_EMOJIS = "read:emoji",
MANAGE_OWN_EMOJIS = "owner:emoji",
MANAGE_MEDIA = "media",
MANAGE_OWN_MEDIA = "owner:media",
MANAGE_BLOCKS = "blocks",
MANAGE_OWN_BLOCKS = "owner:block",
MANAGE_FILTERS = "filters",
MANAGE_OWN_FILTERS = "owner:filter",
MANAGE_MUTES = "mutes",
MANAGE_OWN_MUTES = "owner:mute",
MANAGE_REPORTS = "reports",
MANAGE_OWN_REPORTS = "owner:report",
MANAGE_SETTINGS = "settings",
MANAGE_OWN_SETTINGS = "owner:settings",
MANAGE_ROLES = "roles",
MANAGE_NOTIFICATIONS = "notifications",
MANAGE_OWN_NOTIFICATIONS = "owner:notification",
MANAGE_FOLLOWS = "follows",
MANAGE_OWN_FOLLOWS = "owner:follow",
MANAGE_OWN_APPS = "owner:app",
SEARCH = "search",
VIEW_PUBLIC_TIMELINES = "public_timelines",
VIEW_PRIVATE_TIMELINES = "private_timelines",
IGNORE_RATE_LIMITS = "ignore_rate_limits",
IMPERSONATE = "impersonate",
MANAGE_INSTANCE = "instance",
MANAGE_INSTANCE_FEDERATION = "instance:federation",
MANAGE_INSTANCE_SETTINGS = "instance:settings",
OAUTH = "oauth",
}
export type CustomEmoji = Awaited<
ReturnType<LysandClient["getInstanceCustomEmojis"]>
>["data"][0];
export type Identity = {
id: string;
tokens: Token;
account: Account;
instance: Instance;
permissions: RolePermissions[];
emojis: CustomEmoji[];
permissions: RolePermission[];
emojis: Emoji[];
};
export const useIdentities = (): Ref<Identity[]> => {

View file

@ -1,10 +1,5 @@
import type { LysandClient } from "@lysand-org/client";
// Return type of LysandClient.getInstance
export type Instance = Awaited<ReturnType<LysandClient["getInstance"]>>["data"];
export type ExtendedDescription = Awaited<
ReturnType<LysandClient["getInstanceExtendedDescription"]>
>["data"];
import type { ExtendedDescription, Instance } from "@lysand-org/client/types";
export const useInstance = () => {
const identity = useCurrentIdentity();

View file

@ -1,5 +1,5 @@
import type { LysandClient } from "@lysand-org/client";
import type { Status } from "~/types/mastodon/status";
import type { Status } from "@lysand-org/client/types";
export const useLocalTimeline = (
client: LysandClient | null,
@ -42,7 +42,7 @@ export const useLocalTimeline = (
);
if (newNotes.length > 0) {
fetchedNotes.value = [...fetchedNotes.value, ...newNotes];
nextMaxId = newNotes[newNotes.length - 1].id;
nextMaxId = newNotes[newNotes.length - 1]?.id;
for (const note of newNotes) {
fetchedNoteIds.add(note.id);
}
@ -63,7 +63,7 @@ export const useLocalTimeline = (
);
if (newNotes.length > 0) {
fetchedNotes.value = [...newNotes, ...fetchedNotes.value];
prevMinId = newNotes[0].id;
prevMinId = newNotes[0]?.id;
for (const note of newNotes) {
fetchedNoteIds.add(note.id);
}

View file

@ -1,5 +1,5 @@
import type { LysandClient } from "@lysand-org/client";
import type { Status } from "~/types/mastodon/status";
import type { Status } from "@lysand-org/client/types";
export const useNote = (
client: MaybeRef<LysandClient | null>,

View file

@ -1,5 +1,5 @@
import type { LysandClient } from "@lysand-org/client";
import type { Context } from "~/types/mastodon/context";
import type { Context } from "@lysand-org/client/types";
export const useNoteContext = (
client: MaybeRef<LysandClient | null>,

View file

@ -1,6 +1,6 @@
import type { LysandClient } from "@lysand-org/client";
import type { Status } from "@lysand-org/client/types";
import { SettingIds, type Settings } from "~/settings";
import type { Status } from "~/types/mastodon/status";
export const useNoteData = (
noteProp: MaybeRef<Status | undefined>,

View file

@ -1,5 +1,5 @@
import type { LysandClient } from "@lysand-org/client";
import type { Notification } from "~/types/mastodon/notification";
import type { Notification } from "@lysand-org/client/types";
export const useNotificationTimeline = (
client: LysandClient | null,
@ -18,6 +18,7 @@ export const useNotificationTimeline = (
} => {
return useTimeline(
client,
// @ts-expect-error dont listen to the voices jesse
(client, options) => client?.getNotifications(options),
options,
);

View file

@ -1,7 +1,6 @@
import type { Account, Emoji } from "@lysand-org/client/types";
import { renderToString } from "vue/server-renderer";
import { SettingIds, type Settings, getSettingById } from "~/settings";
import type { Account } from "~/types/mastodon/account";
import type { Emoji } from "~/types/mastodon/emoji";
import MentionComponent from "../components/social-elements/notes/mention.vue";
/**

View file

@ -1,5 +1,5 @@
import type { LysandClient } from "@lysand-org/client";
import type { Status } from "~/types/mastodon/status";
import type { Status } from "@lysand-org/client/types";
export const usePublicTimeline = (
client: LysandClient | null,

View file

@ -1,5 +1,5 @@
import type { LysandClient } from "@lysand-org/client";
import type { Relationship } from "~/types/mastodon/relationship";
import type { Relationship } from "@lysand-org/client/types";
import { useCurrentIdentity } from "./Identities";
export const useRelationship = (

View file

@ -1,6 +1,5 @@
import type { LysandClient } from "@lysand-org/client";
import type { Account } from "~/types/mastodon/account";
import type { Mention } from "~/types/mastodon/mention";
import type { Account, Mention } from "@lysand-org/client/types";
export const useResolveMentions = (
mentions: Ref<Mention[]>,

View file

@ -1,4 +1,4 @@
import type { Instance } from "./Instance";
import type { Instance } from "@lysand-org/client/types";
export const useSSOConfig = (): Ref<Instance["sso"] | null> => {
const instance = useInstance();

View file

@ -30,7 +30,7 @@
},
"dependencies": {
"@ark-ui/vue": "^3.4.0",
"@lysand-org/client": "^0.1.8",
"@lysand-org/client": "^0.2.0",
"@nuxt/fonts": "^0.7.0",
"@tailwindcss/typography": "^0.5.13",
"@vee-validate/nuxt": "^4.13.1",
@ -61,7 +61,8 @@
"@tailwindcss/forms": "^0.5.7",
"@types/html-to-text": "^9.0.4",
"@vue-email/nuxt": "^0.8.19",
"typescript": "^5.4.5"
"typescript": "^5.4.5",
"vue-tsc": "^2.0.21"
},
"trustedDependencies": [
"@biomejs/biome",

View file

@ -10,7 +10,7 @@
</template>
<script setup lang="ts">
import type { Account } from "~/types/mastodon/account";
import type { Account } from "@lysand-org/client/types";
definePageMeta({
layout: "app",

View file

@ -1,36 +0,0 @@
import type { Role as LysandRole } from "~/composables/Identities";
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<Emoji>;
moved: Account | null;
fields: Array<Field>;
bot: boolean | null;
source?: Source;
role?: Role;
roles: LysandRole[];
mute_expires_at?: string;
};

View file

@ -1,6 +0,0 @@
export type Activity = {
week: string;
statuses: string;
logins: string;
registrations: string;
};

View file

@ -1,39 +0,0 @@
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<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 AnnouncementStatus = {
id: string;
url: string;
};
export type AnnouncementReaction = {
name: string;
count: number;
me: boolean | null;
url: string | null;
static_url: string | null;
};

View file

@ -1,5 +0,0 @@
export type Application = {
name: string;
website?: string | null;
vapid_key?: string | null;
};

View file

@ -1,13 +0,0 @@
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;
};

View file

@ -1,47 +0,0 @@
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;
};

View file

@ -1,16 +0,0 @@
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;
};

View file

@ -1,6 +0,0 @@
import type { Status } from "./status";
export type Context = {
ancestors: Array<Status>;
descendants: Array<Status>;
};

View file

@ -1,9 +0,0 @@
import type { Account } from "./account";
import type { Status } from "./status";
export type Conversation = {
id: string;
accounts: Array<Account>;
last_status: Status | null;
unread: boolean;
};

View file

@ -1,7 +0,0 @@
export type Emoji = {
shortcode: string;
static_url: string;
url: string;
visible_in_picker: boolean;
category?: string;
};

View file

@ -1,6 +0,0 @@
export type FeaturedTag = {
id: string;
name: string;
statuses_count: number;
last_status_at: string;
};

View file

@ -1,6 +0,0 @@
export type Field = {
name: string;
value: string;
verified_at?: string | null;
verified?: boolean | false;
};

View file

@ -1,10 +0,0 @@
export type Filter = {
id: string;
phrase: string;
context: Array<FilterContext>;
expires_at: string | null;
irreversible: boolean;
whole_word: boolean;
};
export type FilterContext = string;

View file

@ -1,25 +0,0 @@
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<Emoji>;
fields: Array<Field>;
};

View file

@ -1,5 +0,0 @@
export type History = {
day: string;
uses: number;
accounts: number;
};

View file

@ -1,7 +0,0 @@
export type IdentityProof = {
provider: string;
provider_username: string;
updated_at: string;
proof_url: string;
profile_url: string;
};

View file

@ -1,38 +0,0 @@
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<string>;
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<InstanceRule>;
};
export type InstanceRule = {
id: string;
text: string;
};

View file

@ -1,7 +0,0 @@
export type List = {
id: string;
title: string;
replies_policy: RepliesPolicy | null;
};
export type RepliesPolicy = "followed" | "list" | "none";

View file

@ -1,13 +0,0 @@
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;
};
};

View file

@ -1,6 +0,0 @@
export type Mention = {
id: string;
username: string;
url: string;
acct: string;
};

View file

@ -1,15 +0,0 @@
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;

View file

@ -1,14 +0,0 @@
export type Poll = {
id: string;
expires_at: string | null;
expired: boolean;
multiple: boolean;
votes_count: number;
options: Array<PollOption>;
voted: boolean;
};
export type PollOption = {
title: string;
votes_count: number | null;
};

View file

@ -1,9 +0,0 @@
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;
};

View file

@ -1,14 +0,0 @@
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;
};

View file

@ -1,11 +0,0 @@
import type { Account } from "./account";
export type Reaction = {
count: number;
me: boolean;
name: string;
url?: string;
static_url?: string;
accounts?: Array<Account>;
account_ids?: Array<string>;
};

View file

@ -1,16 +0,0 @@
export type Relationship = {
id: string;
following: boolean;
followed_by: boolean;
blocking: boolean;
blocked_by: boolean;
muting: boolean;
muting_notifications: boolean;
requested: boolean;
requested_by: boolean;
domain_blocking: boolean;
showing_reblogs: boolean;
endorsed: boolean;
notifying: boolean;
note: string | null;
};

View file

@ -1,16 +0,0 @@
import type { Account } from "./account";
export type Report = {
id: string;
action_taken: boolean;
action_taken_at: string | null;
status_ids: Array<string> | null;
rule_ids: Array<string> | 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";

View file

@ -1,9 +0,0 @@
import type { Account } from "./account";
import type { Status } from "./status";
import type { Tag } from "./tag";
export type Results = {
accounts: Array<Account>;
statuses: Array<Status>;
hashtags: Array<Tag>;
};

View file

@ -1,3 +0,0 @@
export type Role = {
name: string;
};

View file

@ -1,9 +0,0 @@
import type { Attachment } from "./attachment";
import type { StatusParams } from "./status_params";
export type ScheduledStatus = {
id: string;
scheduled_at: string;
params: StatusParams;
media_attachments: Array<Attachment> | null;
};

View file

@ -1,9 +0,0 @@
import type { Field } from "./field";
export type Source = {
privacy: string | null;
sensitive: boolean | null;
language: string | null;
note: string;
fields: Array<Field>;
};

View file

@ -1,5 +0,0 @@
export type Stats = {
user_count: number;
status_count: number;
domain_count: number;
};

View file

@ -1,50 +0,0 @@
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<Attachment>;
mentions: Array<Mention>;
tags: Array<StatusTag>;
card: Card | null;
poll: Poll | null;
application: Application | null;
language: string | null;
pinned: boolean | null;
emoji_reactions: Array<Reaction>;
quote: Status | null;
bookmarked: boolean;
};
export type StatusTag = {
name: string;
url: string;
};
export type StatusVisibility = "public" | "unlisted" | "private" | "direct";

View file

@ -1,12 +0,0 @@
import type { StatusVisibility } from "./status";
export type StatusParams = {
text: string;
in_reply_to_id: string | null;
media_ids: Array<string> | null;
sensitive: boolean | null;
spoiler_text: string | null;
visibility: StatusVisibility | null;
scheduled_at: string | null;
application_id: number | null;
};

View file

@ -1,5 +0,0 @@
export type StatusSource = {
id: string;
text: string;
spoiler_text: string;
};

View file

@ -1,8 +0,0 @@
import type { History } from "./history";
export type Tag = {
name: string;
url: string;
history: Array<History>;
following?: boolean;
};

View file

@ -1,6 +0,0 @@
export type Token = {
access_token: string;
token_type: string;
scope: string;
created_at: number;
};

View file

@ -1,3 +0,0 @@
export type URLs = {
streaming_api: string;
};

View file

@ -1,3 +1,4 @@
import type { ApplicationData } from "@lysand-org/client/types";
import { nanoid } from "nanoid";
export const signInWithCode = (code: string, appData: ApplicationData) => {