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

@@ -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();