34 lines
1005 B
TypeScript
34 lines
1005 B
TypeScript
import type {
|
|
BodyCompositionResponse,
|
|
GeneratePhysicalFitnessResponse,
|
|
PhysicalFitnessResponse,
|
|
} from "./types";
|
|
import { api } from "./client";
|
|
|
|
/** 取得指定使用者的 11 項最新體適能測驗成績。 */
|
|
export function fetchPhysicalFitness(
|
|
userID: string,
|
|
): Promise<PhysicalFitnessResponse> {
|
|
return api
|
|
.get(`v1/physical-fitness/${encodeURIComponent(userID)}`)
|
|
.json<PhysicalFitnessResponse>();
|
|
}
|
|
|
|
/** 產生指定使用者的體適能評級。 */
|
|
export function generatePhysicalFitness(
|
|
userID: string,
|
|
): Promise<GeneratePhysicalFitnessResponse> {
|
|
return api
|
|
.post(`v1/physical-fitness/generate/${encodeURIComponent(userID)}`)
|
|
.json<GeneratePhysicalFitnessResponse>();
|
|
}
|
|
|
|
/** 取得指定使用者的身體組成分析。 */
|
|
export function fetchBodyComposition(
|
|
userCode: string,
|
|
): Promise<BodyCompositionResponse> {
|
|
return api
|
|
.get(`v1/physical-fitness/body-composition/${encodeURIComponent(userCode)}`)
|
|
.json<BodyCompositionResponse>();
|
|
}
|