feat: 新API
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import type {
|
||||
GeneratePhysicalFitnessResponse,
|
||||
PhysicalFitnessItem,
|
||||
} from "./types";
|
||||
import { api } from "./client";
|
||||
|
||||
/** 取得指定使用者的 11 項最新體適能測驗成績。 */
|
||||
export function fetchPhysicalFitness(
|
||||
userID: string,
|
||||
): Promise<PhysicalFitnessItem[]> {
|
||||
return api
|
||||
.get(`v1/physical-fitness/${encodeURIComponent(userID)}`)
|
||||
.json<PhysicalFitnessItem[]>();
|
||||
}
|
||||
|
||||
/** 產生指定使用者的體適能評級。 */
|
||||
export function generatePhysicalFitness(
|
||||
userID: string,
|
||||
): Promise<GeneratePhysicalFitnessResponse> {
|
||||
return api
|
||||
.post(`v1/physical-fitness/generate/${encodeURIComponent(userID)}`)
|
||||
.json<GeneratePhysicalFitnessResponse>();
|
||||
}
|
||||
Reference in New Issue
Block a user