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

View File

@@ -53,6 +53,9 @@ const loginReq = {
});
},
/**
* @returns {Promise<{json: any}>}
*/
getConfig() {
return request('config', {
method: 'GET'

View File

@@ -3,7 +3,7 @@ import { useUserStore } from '../stores';
const avatarReq = {
/**
* @type {import('../types/avatar').getAvatar}
* @type {import('../types/api/avatar').GetAvatar}
*/
getAvatar(params) {
return request(`avatars/${params.avatarId}`, {
@@ -18,22 +18,7 @@ const avatarReq = {
},
/**
* @typedef {{
* 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
* }} GetAvatarsParameter
*/
/**
*
* @param {GetAvatarsParameter} params
* @returns {Promise<{json: any, params}>}
* @type {import('../types/api/avatar').GetAvatars}
*/
getAvatars(params) {
return request('avatars', {

View File

@@ -92,6 +92,11 @@ const friendReq = {
});
},
/**
* @param {any} params
* @param {string} userId
* @returns {Promise<{json: any, params: any, userId: string}>}
*/
deleteHiddenFriendRequest(params, userId) {
return request(`user/${userId}/friendRequest`, {
method: 'DELETE',

View File

@@ -5,7 +5,7 @@ import { useInstanceStore } from '../stores';
const instanceReq = {
/**
* @type {import('../types/instance').getInstance}
* @type {import('../types/api/instance').GetInstance}
*/
getInstance(params) {
const instanceStore = useInstanceStore();
@@ -22,19 +22,7 @@ const instanceReq = {
},
/**
* CreateInstanceParameter
* @typedef {Object} CreateInstanceParameter
* @property {string} worldId
* @property {string} type
* @property {string} region
* @property {string} ownerId
* @property {string[]} roleIds
* @property {string} groupAccessType
* @property {boolean} queueEnabled
*/
/**
* @param {CreateInstanceParameter} params
* @returns {Promise<{json: any, params}>}
* @type {import('../types/api/instance').CreateInstance}
*/
createInstance(params) {
const instanceStore = useInstanceStore();
@@ -52,7 +40,7 @@ const instanceReq = {
},
/**
* @type {import('../types/instance').getInstanceShortName}
* @type {import('../types/api/instance').GetInstanceShortName}
*/
getInstanceShortName(instance) {
const params = {};

View File

@@ -1,6 +1,9 @@
import { request } from '../service/request';
import { useGroupStore, useNotificationStore } from '../stores';
/**
* @returns {any}
*/
function getGalleryStore() {
return useGroupStore();
}
@@ -35,6 +38,10 @@ const notificationReq = {
});
},
/**
* @param {{n?: number, offset?: number}} params
* @returns {Promise<{json: any, params: any}>}
*/
getHiddenFriendRequests(params) {
return request('auth/user/notifications', {
method: 'GET',
@@ -52,6 +59,10 @@ const notificationReq = {
});
},
/**
* @param {{n?: number, offset?: number, type?: string}} params
* @returns {Promise<{json: any, params: any}>}
*/
getNotificationsV2(params) {
return request('notifications', {
method: 'GET',

View File

@@ -1,6 +1,9 @@
import { request } from '../service/request';
import { useUserStore } from '../stores';
/**
* @returns {string}
*/
function getCurrentUserId() {
return useUserStore().currentUser.id;
}
@@ -9,7 +12,7 @@ const userReq = {
/**
* Fetch user from API.
* identifier of registered user
* @type {import('../types/user').getUser}
* @type {import('../types/api/user').GetUser}
*/
getUser(params) {
const userStore = useUserStore();
@@ -32,7 +35,7 @@ const userReq = {
/**
* Fetch user from cache if they're in it. Otherwise, calls API.
* @type {import('../types/user').getUser}
* @type {import('../types/api/user').GetCachedUser}
*/
getCachedUser(params) {
const userStore = useUserStore();
@@ -58,17 +61,7 @@ const userReq = {
},
/**
* @typedef {object} GetUsersParameters
* @property {number} n
* @property {number} offset
* @property {string} search
* @property {'nuisanceFactor' | 'created' | '_created_at' | 'last_login'} sort
* @property {'ascending' | 'descending'} order
*/
/**
* Fetch multiple users from API.
* @param params {GetUsersParameters} filtering and sorting parameters
* @returns {Promise<{json: any, params}>}
* @type {import('../types/api/user').GetUsers}
*/
getUsers(params) {
return request('users', {
@@ -84,8 +77,8 @@ const userReq = {
},
/**
* @param params {string[]}
* @returns {Promise<{json: any, params}>}
* @param {string[]} params User tags to add
* @returns {Promise<{json: any, params: string[]}>}
*/
addUserTags(params) {
const userStore = useUserStore();
@@ -103,8 +96,8 @@ const userReq = {
},
/**
* @param params {string[]}
* @returns {Promise<{json: any, params}>}
* @param {string[]} params User tags to remove
* @returns {Promise<{json: any, params: string[]}>}
*/
removeUserTags(params) {
const userStore = useUserStore();
@@ -122,8 +115,8 @@ const userReq = {
},
/**
* @param params {{ userId: string }}
* @returns {Promise<{json: any, params}>}
* @param {{ userId: string }} params
* @returns {Promise<{json: any, params: { userId: string }}>}
*/
getUserFeedback(params) {
return request(`users/${params.userId}/feedback`, {
@@ -142,7 +135,7 @@ const userReq = {
/**
* Updates current user's status.
* @type {import('../types/user').getCurrentUser}
* @type {import('../types/api/user').GetCurrentUser}
*/
saveCurrentUser(params) {
const userStore = useUserStore();
@@ -160,8 +153,8 @@ const userReq = {
},
/**
* @param params {{ offset: number, n: number }}
* @returns {Promise<{json: any, params}>}
* @param {{ offset: number, n: number }} params
* @returns {Promise<{json: any, params: { offset: number, n: number }}>}
*/
getUserNotes(params) {
return request(`userNotes`, {

View File

@@ -3,7 +3,7 @@ import { useWorldStore } from '../stores';
const worldReq = {
/**
* @type {import('../types/world').getWorld}
* @type {import('../types/api/world').GetWorld}
*/
getWorld(params) {
const worldStore = useWorldStore();
@@ -47,22 +47,7 @@ const worldReq = {
},
/**
* @typedef {object} WorldSearchParameter
* @property {number} n
* @property {number} offset
* @property {string} search
* @property {string} userId
* @property {'me' | 'friend'} user
* @property {'popularity' | 'heat' | 'trust' | 'shuffle' | 'favorites' | 'reportScore' | 'reportCount' | 'publicationDate' | 'labsPublicationDate' | 'created' | '_created_at' | 'updated' | '_updated_at' | 'order'} sort
* @property {'ascending' | 'descending'} order
* @property {'public' | 'private' | 'hidden' | 'all'} releaseStatus
* @property {boolean} featured
*/
/**
*
* @param {WorldSearchParameter} params
* @param {string?} option sub-path of calling endpoint
* @returns {Promise<{json: any, params, option}>}
* @type {import('../types/api/world').GetWorlds}
*/
getWorlds(params, option) {
const worldStore = useWorldStore();

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;
}
}

50
src/types/common.d.ts vendored
View File

@@ -13,4 +13,54 @@ export interface UnityPackage {
unitySortNumber?: number;
worldSignature?: string;
[key: string]: any;
}
// Base content types
export interface BaseContent {
id: string;
name: string;
authorId: string;
authorName: string;
description: string;
imageUrl: string;
thumbnailImageUrl: string;
created_at: string;
updated_at: string;
releaseStatus: string;
tags: string[];
featured: boolean;
unityPackages: UnityPackage[];
}
// Base Avatar - core avatar properties
export interface BaseAvatar extends BaseContent {
acknowledgements: string | null;
pendingUpload: boolean;
performance: {
[platform: string]: string | number;
};
searchable: boolean;
styles: {
primary: string | null;
secondary: string | null;
};
unityPackageUrl: string;
unityPackageUrlObject: {
unityPackageUrl: string;
};
version: number;
}
// Base World - core world properties
export interface BaseWorld extends BaseContent {
capacity: number;
recommendedCapacity: number;
favorites: number;
heat: number;
popularity: number;
previewYoutubeId: string | null;
publicationDate: string;
labsPublicationDate: string;
organization: string;
udonProducts: any[];
}

View File

@@ -6,6 +6,8 @@ export * from './api/world';
export * from './api/instance';
export * from './api/group';
export * from './api/favorite';
export * from './api/auth';
export * from './api/notification';
// Common Types
export * from './common';