refactor: add type definitions for API responses

This commit is contained in:
pa
2025-07-16 13:31:48 +09:00
committed by Natsumi
parent 342850dc7e
commit 0e50a67c25
17 changed files with 601 additions and 206 deletions

268
src/types/api/auth.d.ts vendored Normal file
View File

@@ -0,0 +1,268 @@
// Exported API functions
export type VerifyOTP = (params: { code: string }) => Promise<{
json: any;
params: { code: string };
}>;
export type VerifyTOTP = (params: { code: string }) => Promise<{
json: any;
params: { code: string };
}>;
export type VerifyEmailOTP = (params: { code: string }) => Promise<{
json: any;
params: { code: string };
}>;
export type GetConfig = () => Promise<{
json: ConfigResponse;
}>;
// Exported interfaces
export interface ConfigResponse {
CampaignStatus: string;
DisableBackgroundPreloads: boolean;
VoiceEnableDegradation: boolean;
VoiceEnableReceiverLimiting: boolean;
accessLogsUrls: {
Default: string;
Pico: string;
Quest: string;
XRElite: string;
};
activeDatagramUdpQueue: number;
address: string;
ageVerificationInviteVisible: boolean;
ageVerificationP: boolean;
ageVerificationStatusVisible: boolean;
analysisMaxRetries: number;
analysisRetryInterval: number;
analyticsSegment_NewUI_PctOfUsers: number;
analyticsSegment_NewUI_Salt: string;
announcements: any[];
availableLanguageCodes: string[];
availableLanguages: string[];
avatarPerfLimiter: {
AndroidMobile: { maxSeats: number };
PC: { maxSeats: number };
Pico: { maxSeats: number };
Quest: { maxSeats: number };
XRElite: { maxSeats: number };
iOSMobile: { maxSeats: number };
};
behaviourFormat: number;
bodyHistoryCommunityRelaadventureInternal: number;
cdnIpv6WhereOauth: string;
chatboxLogBufferSeconds: number;
clientApiKey: string;
clientBPSCeiling: number;
clientDisconnectTimeout: number;
clientNetDispatchThread: boolean;
clientNetDispatchThreadMobile: boolean;
clientQR: number;
clientReservedPlayerBPS: number;
clientSentCountAllowance: number;
commitHookResponseHeadFeed: {
alignmentDisplayVideo: number;
timeoutFarClothRotationTracker: null | any;
};
constants: {
GROUPS: {
CAPACITY: number;
GROUP_TRANSFER_REQUIREMENTS: string[];
MAX_INVITES_REQUESTS: number;
MAX_JOINED: number;
MAX_JOINED_PLUS: number;
MAX_LANGUAGES: number;
MAX_LINKS: number;
MAX_MANAGEMENT_ROLES: number;
MAX_OWNED: number;
MAX_ROLES: number;
};
INSTANCE: {
POPULATION_BRACKETS: {
CROWDED: { max: number; min: number };
FEW: { max: number; min: number };
MANY: { max: number; min: number };
};
};
LANGUAGE: {
SPOKEN_LANGUAGE_OPTIONS: {
[key: string]: string;
};
};
};
contactEmail: string;
copyrightEmail: string;
copyrightFormUrl: string;
currentPrivacyVersion: number;
currentTOSVersion: number;
daemonSignatureHeadpatChumpOffline: boolean;
defaultAvatar: string;
defaultStickerSet: string;
devLanguageCodes: string[];
devSdkUrl: string;
devSdkVersion: string;
'dis-countdown': string;
disableAVProInProton: boolean;
disableAvatarCopying: boolean;
disableAvatarGating: boolean;
disableCaptcha: boolean;
disableCommunityLabs: boolean;
disableCommunityLabsPromotion: boolean;
disableEmail: boolean;
disableEventStream: boolean;
disableFeedbackGating: boolean;
disableFrontendBuilds: boolean;
disableGiftDrops: boolean;
disableHello: boolean;
disableOculusSubs: boolean;
disableRegistration: boolean;
disableSteamNetworking: boolean;
disableTwoFactorAuth: boolean;
disableUdon: boolean;
disableUpgradeAccount: boolean;
downloadLinkWindows: string;
downloadUrls: {
bootstrap: string;
sdk2: string;
'sdk3-avatars': string;
'sdk3-worlds': string;
vcc: string;
};
dynamicWorldRows: Array<{
index: number;
name: string;
platform: string;
sortHeading: string;
sortOrder: string;
sortOwnership: string;
tag?: string;
}>;
economyLedgerBackfill: boolean;
economyLedgerMode: string;
economyPauseEnd: string;
economyPauseStart: string;
economyState: number;
events: {
distanceClose: number;
distanceFactor: number;
distanceFar: number;
groupDistance: number;
maximumBunchSize: number;
notVisibleFactor: number;
playerOrderBucketSize: number;
playerOrderFactor: number;
slowUpdateFactorThreshold: number;
useDirectPlayerSerialization: boolean;
viewSegmentLength: number;
};
forceUseLatestWorld: boolean;
giftDisplayType: string;
globalCacheVersion: number;
globalCacheVersionDefault: number;
googleApiClientId: string;
homeWorldId: string;
homepageRedirectTarget: string;
hubWorldId: string;
imageHostUrlList: string[];
iosAppVersion: string[];
iosVersion: {
major: number;
minor: number;
};
jobsEmail: string;
localizationDeploymentRollback: number;
managerDynamicSendKernel: number;
maxUserEmoji: number;
maxUserStickers: number;
minSupportedClientBuildNumber: {
AppStore: MinBuildInfo;
Default: { minBuildNumber: number };
Firebase: MinBuildInfo;
FirebaseiOS: MinBuildInfo;
GooglePlay: MinBuildInfo;
PC: MinBuildInfo;
PicoStore: MinBuildInfo;
QuestAppLab: MinBuildInfo;
QuestStore: MinBuildInfo;
TestFlight: MinBuildInfo;
XRElite: MinBuildInfo;
};
minimumUnityVersionForUploads: string;
moderationEmail: string;
moderationTimestampToolboxSoap: number;
multigrainTokenThrottleEmbed: number;
ninkilim: boolean;
notAllowedToSelectAvatarInPrivateWorldMessage: string;
offlineAnalysis: {
android: boolean;
standalonewindows: boolean;
};
onlyFpsStringGraphContent: string;
photonNameserverOverrides: string[];
photonPublicKeys: string[];
'player-url-resolver-sha1': string;
'player-url-resolver-version': string;
pluginSamlSandwich: boolean;
propComponentList: string[];
publicKey: string;
questMinimumLowMemoryThreshold: {
[key: string]: number;
};
reportCategories: {
[key: string]: {
description?: string;
groupOrder?: number;
text: string;
title?: string;
tooltip: string;
};
};
reportFormUrl: string;
reportOptions: {
[key: string]: {
[key: string]: string[];
};
};
reportReasons: {
[key: string]: {
text: string;
tooltip: string;
};
};
requireAgeVerificationBetaTag: boolean;
scrollAppend: boolean;
sdkDeveloperFaqUrl: string;
sdkDiscordUrl: string;
sdkNotAllowedToPublishMessage: string;
sdkUnityVersion: string;
sessionEthernetPlusStack: number;
stringHostUrlList: string[];
supportEmail: string;
supportFormUrl: string;
timeOutWorldId: string;
timekeeping: boolean;
timestampTagging: boolean;
tutorialWorldId: string;
updateRateMsMaximum: number;
updateRateMsMinimum: number;
updateRateMsNormal: number;
updateRateMsUdonManual: number;
uploadAnalysisPercent: number;
urlList: string[];
useReliableUdpForVoice: boolean;
use_void_requiem_core: boolean;
virtualFriendDocs: string;
viveWindowsUrl: string;
websocketMaxFriendsRefreshDelay: number;
websocketQuickReconnectTime: number;
websocketReconnectMaxDelay: number;
whiteListedAssetUrls: string[];
}
// Internal response types
interface MinBuildInfo {
minBuildNumber: number;
redirectionAddress?: string;
}

View File

@@ -1,40 +1,31 @@
import { UnityPackage } from '../common';
import { BaseAvatar } from '../common';
// API functions
// Exported 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;
export type GetAvatars = (params: {
n: number;
offset: number;
search?: string;
userId?: string;
user?: 'me' | 'friends';
sort?: 'created' | 'updated' | 'order' | '_created_at' | '_updated_at';
order?: 'ascending' | 'descending';
releaseStatus?: 'public' | 'private' | 'hidden' | 'all';
featured?: boolean;
}) => Promise<{
json: any;
params: any;
}>;
// Internal response types
interface GetAvatarResponse extends BaseAvatar {
// Avatar-specific additional fields
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;
}

View File

@@ -1,4 +1,4 @@
import { UnityPackage } from '../common';
import { BaseAvatar, BaseWorld } from '../common';
// API functions
export type GetFavorites = (params: { n: number; offset: number }) => Promise<{
@@ -49,60 +49,24 @@ interface GetFavoritesResponseItem {
type: string;
}
interface GetFavoriteAvatarsResponseItem {
acknowledgements?: null | string;
authorId: string;
authorName: string;
created_at: string;
description: string;
interface GetFavoriteAvatarsResponseItem extends BaseAvatar {
// Favorite avatar specific fields
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;
interface GetFavoriteWorldsResponseItem extends BaseWorld {
// Favorite world specific fields
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;
}

View File

@@ -1,4 +1,4 @@
// API functions
// Exported API functions
export type GetFriends = (params: {
n: number;
offline: boolean;
@@ -12,10 +12,46 @@ export type GetFriends = (params: {
};
}>;
// Type aliases
export type GetFriendsResponseList = GetFriendsResponseItem[] | undefined;
export type SendFriendRequest = (params: { userId: string }) => Promise<{
json: any;
params: { userId: string };
}>;
// API response types
export type CancelFriendRequest = (params: { userId: string }) => Promise<{
json: any;
params: { userId: string };
}>;
export type DeleteFriend = (params: { userId: string }) => Promise<{
json: any;
params: { userId: string };
}>;
export type GetFriendStatus = (params: { userId: string }) => Promise<{
json: FriendStatusResponse;
params: { userId: string };
}>;
export type DeleteHiddenFriendRequest = (
params: any,
userId: string
) => Promise<{
json: any;
params: any;
userId: string;
}>;
// Exported interfaces
export interface FriendStatusResponse {
isFriend: boolean;
outgoingRequest: boolean;
incomingRequest: boolean;
}
// Type aliases
type GetFriendsResponseList = GetFriendsResponseItem[] | undefined;
// Internal response types
interface GetFriendsResponseItem {
bio: string;
bioLinks: string[];
@@ -40,4 +76,4 @@ interface GetFriendsResponseItem {
statusDescription: string;
tags: string[];
userIcon: string;
}
}

View File

@@ -1,6 +1,6 @@
import { UnityPackage } from '../common';
import { BaseWorld } from '../common';
// API functions
// Exported API functions
export type GetInstance = (params: {
worldId: string;
instanceId: string;
@@ -9,6 +9,19 @@ export type GetInstance = (params: {
params: { worldId: string; instanceId: string };
}>;
export type CreateInstance = (params: {
worldId: string;
type: string;
region: string;
ownerId: string;
roleIds: string[];
groupAccessType: string;
queueEnabled: boolean;
}) => Promise<{
json: any;
params: any;
}>;
export type GetInstanceShortName = (instance: {
worldId: string;
instanceId: string;
@@ -19,7 +32,7 @@ export type GetInstanceShortName = (instance: {
params?: { shortName: string };
}>;
// API response types
// Internal response types
interface GetInstanceResponse {
active: boolean;
ageGate: boolean;
@@ -59,31 +72,8 @@ interface GetInstanceResponse {
tags: string[];
type: string;
userCount: number;
world: {
authorId: string;
authorName: string;
capacity: number;
created_at: string;
world: BaseWorld & {
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;

52
src/types/api/notification.d.ts vendored Normal file
View File

@@ -0,0 +1,52 @@
// Exported API functions
export type GetNotifications = (params: {
n: number;
offset: number;
sent: boolean;
type: string;
after: 'five_minutes_ago' | string;
}) => Promise<{
json: NotificationResponse[];
params: any;
}>;
export type GetHiddenFriendRequests = (params: {
n?: number;
offset?: number;
}) => Promise<{
json: NotificationResponse[];
params: any;
}>;
export type GetNotificationsV2 = (params: {
n?: number;
offset?: number;
type?: string;
}) => Promise<{
json: NotificationResponse[];
params: any;
}>;
export type SendNotification = (params: {
receiverUserId: string;
type: string;
message: string;
seen: boolean;
details: string;
}) => Promise<{
json: NotificationResponse;
params: any;
}>;
// Exported interfaces
export interface NotificationResponse {
id: string;
type: string;
senderUserId: string;
receiverUserId: string;
message: string;
details: any;
seen: boolean;
created_at: string;
[key: string]: any;
}

View File

@@ -1,4 +1,4 @@
// API functions
// Exported API functions
export type GetUser = (params: { userId: string }) => Promise<{
cache?: boolean;
json: GetUserResponse;
@@ -12,7 +12,30 @@ export type GetCurrentUser = (params: any) => Promise<{
params: GetCurrentUserResponse;
}>;
// Extended user objects
export type GetCachedUser = (params: { userId: string }) => Promise<{
cache?: boolean;
json: GetUserResponse;
ref: VrcxUser;
params: { userId: string };
}>;
export type GetUsers = (params: {
n: number;
offset: number;
search?: string;
sort?: 'nuisanceFactor' | 'created' | '_created_at' | 'last_login';
order?: 'ascending' | 'descending';
}) => Promise<{
json: UserSearchResponse;
params: any;
}>;
export type AddUserTags = (params: string[]) => Promise<{
json: GetCurrentUserResponse;
params: string[];
}>;
// Exported interfaces
export interface VrcxUser extends GetUserResponse {
$location: {};
$location_at: number;
@@ -60,7 +83,29 @@ export interface VrcxCurrentUser extends GetCurrentUserResponse {
$travelingToLocation?: string;
}
// API response types
// Type aliases
type UserSearchResponse = UserSearchResponseItem[];
// Internal response types
interface UserSearchResponseItem {
bio: string;
bioLinks: string[];
currentAvatarImageUrl: string;
currentAvatarTags: any[];
currentAvatarThumbnailImageUrl: string;
developerType: string;
displayName: string;
id: string;
isFriend: boolean;
last_platform: string;
profilePicOverride: string;
pronouns?: string;
status: string;
statusDescription: string;
tags: string[];
userIcon: string;
}
interface GetUserResponse {
ageVerificationStatus: string;
ageVerified: boolean;
@@ -151,4 +196,4 @@ interface GetCurrentUserResponse extends GetUserResponse {
world: string;
};
queuedInstance: string | null;
}
}

View File

@@ -1,4 +1,4 @@
import { UnityPackage } from '../common';
import { BaseWorld } from '../common';
// API functions
export type GetWorld = (params: { worldId: string }) => Promise<{
@@ -6,37 +6,64 @@ export type GetWorld = (params: { worldId: string }) => Promise<{
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;
export type GetCachedWorld = (params: { worldId: string }) => Promise<{
json: GetWorldResponse;
ref: any;
cache?: boolean;
params: { worldId: string };
}>;
export type GetWorlds = (
params: {
n: number;
offset: number;
search?: string;
userId?: string;
user?: 'me' | 'friend';
sort?:
| 'popularity'
| 'heat'
| 'trust'
| 'shuffle'
| 'favorites'
| 'reportScore'
| 'reportCount'
| 'publicationDate'
| 'labsPublicationDate'
| 'created'
| '_created_at'
| 'updated'
| '_updated_at'
| 'order';
order?: 'ascending' | 'descending';
releaseStatus?: 'public' | 'private' | 'hidden' | 'all';
featured?: boolean;
},
option?: string
) => Promise<{
json: WorldSearchResponse;
params: any;
option?: string;
}>;
// Type aliases
type WorldSearchResponse = WorldSearchResponseItem[];
// Internal response types
interface WorldSearchResponseItem extends BaseWorld {
// World search specific fields
occupants: number;
defaultContentSettings: Record<string, any>;
}
interface GetWorldResponse extends BaseWorld {
// World detail specific fields
instances: any[];
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;
defaultContentSettings: Record<string, unknown>;
urlList: any[];
version: number;
visits: number;
}
}