refactor: src/types

This commit is contained in:
pa
2025-07-16 12:14:13 +09:00
committed by Natsumi
parent 39381de29e
commit 342850dc7e
14 changed files with 280 additions and 292 deletions

40
src/types/api/avatar.d.ts vendored Normal file
View File

@@ -0,0 +1,40 @@
import { UnityPackage } from '../common';
// API functions
export type GetAvatar = (params: { avatarId: string }) => Promise<{
json: GetAvatarResponse;
params: { avatarId: string };
}>;
// API response types
interface GetAvatarResponse {
acknowledgements: string | null;
authorId: string;
authorName: string;
created_at: string;
description: string;
featured: boolean;
id: string;
imageUrl: string;
name: string;
pendingUpload: boolean;
performance: {
standalonewindows: string;
'standalonewindows-sort': number;
};
releaseStatus: string;
searchable: boolean;
styles: {
primary: string | null;
secondary: string | null;
};
tags: string[];
thumbnailImageUrl: string;
unityPackageUrl: string;
unityPackageUrlObject: {
unityPackageUrl: string;
};
unityPackages: UnityPackage[];
updated_at: string;
version: number;
}

114
src/types/api/favorite.d.ts vendored Normal file
View File

@@ -0,0 +1,114 @@
import { UnityPackage } from '../common';
// API functions
export type GetFavorites = (params: { n: number; offset: number }) => Promise<{
json: GetFavoritesResponseList;
params: { n: number; offset: number };
}>;
export type GetFavoriteAvatars = (params: {
n: number;
offset: number;
tag: string;
}) => Promise<{
json: GetFavoriteAvatarsResponseList;
params: { n: number; offset: number; tag: string };
}>;
export type GetFavoriteWorlds = (params: {
n: number;
offset: number;
}) => Promise<{
json: GetFavoriteWorldsResponseList;
params: { n: number; offset: number };
}>;
export type AddFavorite = (params: {
type: string;
favoriteId: string;
tags: string;
}) => Promise<{
json: AddFavoriteResponse;
params: {
type: string;
favoriteId: string;
tags: string;
};
}>;
// Type aliases
export type GetFavoritesResponseList = GetFavoritesResponseItem[] | undefined;
export type GetFavoriteAvatarsResponseList = GetFavoriteAvatarsResponseItem[];
export type GetFavoriteWorldsResponseList = GetFavoriteWorldsResponseItem[];
// API response types
interface GetFavoritesResponseItem {
favoriteId: string;
id: string;
tags: string[];
type: string;
}
interface GetFavoriteAvatarsResponseItem {
acknowledgements?: null | string;
authorId: string;
authorName: string;
created_at: string;
description: string;
favoriteGroup: string;
favoriteId: string;
featured: boolean;
id: string;
imageUrl: string;
name: string;
performance: {
[platform: string]: string | number;
};
releaseStatus: string;
searchable: boolean;
styles: {
primary: null;
secondary: null;
};
tags: any[];
thumbnailImageUrl: string;
unityPackageUrl: string;
unityPackageUrlObject: Record<string, any>;
unityPackages: UnityPackage[];
updated_at: string;
version: number;
}
interface GetFavoriteWorldsResponseItem {
id: string;
name: string;
authorId: string;
authorName: string;
description: string;
capacity: number;
recommendedCapacity?: number;
occupants?: number;
favorites: number;
visits: number;
heat: number;
popularity: number;
created_at: string;
updated_at: string;
publicationDate?: string;
releaseStatus: string;
version: number;
tags: string[];
imageUrl: string;
thumbnailImageUrl: string;
urlList: string[];
defaultContentSettings: Record<string, any>;
unityPackages: UnityPackage[];
[key: string]: any;
}
interface AddFavoriteResponse {
favoriteId: string;
id: string;
type: 'world' | 'friend' | 'avatar';
tags: string[];
}

43
src/types/api/friend.d.ts vendored Normal file
View File

@@ -0,0 +1,43 @@
// API functions
export type GetFriends = (params: {
n: number;
offline: boolean;
offset: number;
}) => Promise<{
json: GetFriendsResponseList;
params: {
n: number;
offline: boolean;
offset: number;
};
}>;
// Type aliases
export type GetFriendsResponseList = GetFriendsResponseItem[] | undefined;
// API response types
interface GetFriendsResponseItem {
bio: string;
bioLinks: string[];
currentAvatarImageUrl: string;
currentAvatarTags: string[];
currentAvatarThumbnailImageUrl: string;
developerType: string;
displayName: string;
friendKey: string;
id: string;
imageUrl: string;
isFriend: boolean;
last_activity: string;
last_login: string;
last_mobile: string | null;
last_platform: string;
location: string;
platform: string;
profilePicOverride: string;
profilePicOverrideThumbnail: string;
status: string;
statusDescription: string;
tags: string[];
userIcon: string;
}

36
src/types/api/group.d.ts vendored Normal file
View File

@@ -0,0 +1,36 @@
// API functions
export type GetGroup = (params: {
groupId: string;
includeRoles?: boolean;
}) => Promise<{
json: GetGroupResponse;
params: { groupId: string; includeRoles?: boolean };
}>;
// API response types
interface GetGroupResponse {
badges: any[];
bannerId: string;
bannerUrl: string;
createdAt: string;
description: string;
discriminator: string;
galleries: any[];
iconId: string;
iconUrl: string;
id: string;
isVerified: boolean;
joinState: string;
languages: string[];
links: any[];
memberCount: number;
memberCountSyncedAt: string;
membershipStatus: string;
name: string;
onlineMemberCount: number;
ownerId: string;
privacy: string;
rules: string;
shortCode: string;
tags: string[];
}

97
src/types/api/instance.d.ts vendored Normal file
View File

@@ -0,0 +1,97 @@
import { UnityPackage } from '../common';
// API functions
export type GetInstance = (params: {
worldId: string;
instanceId: string;
}) => Promise<{
json: GetInstanceResponse;
params: { worldId: string; instanceId: string };
}>;
export type GetInstanceShortName = (instance: {
worldId: string;
instanceId: string;
shortName?: string;
}) => Promise<{
json: GetInstanceShortNameResponse;
instance: { worldId: string; instanceId: string };
params?: { shortName: string };
}>;
// API response types
interface GetInstanceResponse {
active: boolean;
ageGate: boolean;
canRequestInvite: boolean;
capacity: number;
clientNumber: string;
closedAt: string | null;
contentSettings: Record<string, any>;
displayName: string | null;
full: boolean;
gameServerVersion: number;
hardClose: string | null;
hasCapacityForYou: boolean;
hidden: string;
id: string;
instanceId: string;
instancePersistenceEnabled: boolean | null;
location: string;
n_users: number;
name: string;
ownerId: string;
permanent: boolean;
photonRegion: string;
platforms: {
android: number;
ios: number;
standalonewindows: number;
};
playerPersistenceEnabled: boolean;
queueEnabled: boolean;
queueSize: number;
recommendedCapacity: number;
region: string;
secureName: string;
shortName: string | null;
strict: boolean;
tags: string[];
type: string;
userCount: number;
world: {
authorId: string;
authorName: string;
capacity: number;
created_at: string;
defaultContentSettings: Record<string, any>;
description: string;
favorites: number;
featured: boolean;
heat: number;
id: string;
imageUrl: string;
labsPublicationDate: string;
name: string;
organization: string;
popularity: number;
previewYoutubeId: string | null;
publicationDate: string;
recommendedCapacity: number;
releaseStatus: string;
tags: string[];
thumbnailImageUrl: string;
udonProducts: any[];
unityPackages: UnityPackage[];
updated_at: string;
urlList: any[];
version: number;
visits: number;
};
worldId: string;
}
interface GetInstanceShortNameResponse {
secureName: string;
shortName: string;
}

154
src/types/api/user.d.ts vendored Normal file
View File

@@ -0,0 +1,154 @@
// API functions
export type GetUser = (params: { userId: string }) => Promise<{
cache?: boolean;
json: GetUserResponse;
ref: VrcxUser;
params: { userId: string };
}>;
export type GetCurrentUser = (params: any) => Promise<{
json: GetCurrentUserResponse;
ref: VrcxCurrentUser;
params: GetCurrentUserResponse;
}>;
// Extended user objects
export interface VrcxUser extends GetUserResponse {
$location: {};
$location_at: number;
$online_for: number;
$travelingToTime: number;
$offline_for: number;
$active_for: number;
$isVRCPlus: boolean;
$isModerator: boolean;
$isTroll: boolean;
$isProbableTroll: boolean;
$trustLevel: string;
$trustClass: string;
$userColour: string;
$trustSortNum: number;
$languages: string[];
$joinCount: number;
$timeSpent: number;
$lastSeen: string;
$nickName: string;
$previousLocation: string;
$customTag: string;
$customTagColour: string;
$friendNumber: number;
$lastFetch: number;
}
export interface VrcxCurrentUser extends GetCurrentUserResponse {
$online_for?: number;
$offline_for?: number | null;
$location_at?: number;
$travelingToTime?: number;
$previousAvatarSwapTime?: number | null;
$homeLocation?: {};
$isVRCPlus?: boolean;
$isModerator?: boolean;
$isTroll?: boolean;
$isProbableTroll?: boolean;
$trustLevel?: string;
$trustClass?: string;
$userColour?: string;
$trustSortNum?: number;
$languages?: string[];
$locationTag?: string;
$travelingToLocation?: string;
}
// API response types
interface GetUserResponse {
ageVerificationStatus: string;
ageVerified: boolean;
allowAvatarCopying: boolean;
badges: {
badgeDescription: string;
badgeId: string;
badgeImageUrl: string;
badgeName: string;
showcased: boolean;
}[];
bio: string;
bioLinks: string[];
currentAvatarImageUrl: string;
currentAvatarTags: string[];
currentAvatarThumbnailImageUrl: string;
date_joined: string;
developerType: string;
displayName: string;
friendKey: string;
friendRequestStatus?: string;
id: string;
instanceId?: string;
isFriend: boolean;
last_activity: string;
last_login: string;
last_mobile: string | null;
last_platform: string;
location?: string;
note?: string;
platform?: string;
profilePicOverride: string;
profilePicOverrideThumbnail: string;
pronouns: string;
state: string;
status: string;
statusDescription: string;
tags: string[];
travelingToInstance?: string;
travelingToLocation?: string;
travelingToWorld?: string;
userIcon: string;
worldId?: string;
}
interface GetCurrentUserResponse extends GetUserResponse {
acceptedPrivacyVersion: number;
acceptedTOSVersion: number;
accountDeletionDate: string | null;
accountDeletionLog: string | null;
activeFriends: string[];
currentAvatar: string;
emailVerified: boolean;
fallbackAvatar: string;
friendGroupNames: string[];
friends: string[];
googleId: string;
hasBirthday: boolean;
hasEmail: boolean;
hasLoggedInFromClient: boolean;
hasPendingEmail: boolean;
hideContentFilterSettings: boolean;
homeLocation: string;
isAdult: boolean;
isBoopingEnabled: boolean;
obfuscatedEmail: string;
obfuscatedPendingEmail: string;
oculusId: string;
offlineFriends: string[];
onlineFriends: string[];
pastDisplayNames: { displayName: string; updated_at: string }[];
picoId: string;
presence?: {
avatarThumbnail: string;
currentAvatarTags: string;
debugflag: string;
displayName: string;
groups: string[];
id: string;
instance: string;
instanceType: string;
platform: string;
profilePicOverride: string;
status: string;
travelingToInstance: string;
travelingToWorld: string;
userIcon: string;
world: string;
};
queuedInstance: string | null;
}

42
src/types/api/world.d.ts vendored Normal file
View File

@@ -0,0 +1,42 @@
import { UnityPackage } from '../common';
// API functions
export type GetWorld = (params: { worldId: string }) => Promise<{
json: GetWorldResponse;
params: { worldId: string };
}>;
// API response types
interface GetWorldResponse {
authorId: string;
authorName: string;
capacity: number;
created_at: string;
defaultContentSettings: Record<string, unknown>;
description: string;
favorites: number;
featured: boolean;
heat: number;
id: string;
imageUrl: string;
instances: any[];
labsPublicationDate: string;
name: string;
occupants: number;
organization: string;
popularity: number;
previewYoutubeId: string | null;
privateOccupants: number;
publicOccupants: number;
publicationDate: string;
recommendedCapacity: number;
releaseStatus: string;
tags: string[];
thumbnailImageUrl: string;
udonProducts: any[];
unityPackages: UnityPackage[];
updated_at: string;
urlList: any[];
version: number;
visits: number;
}