Files
artcraft/app/Classes/ApiManager/EngineApi.ts
T
a627cddbdc Api Manager 5 Squashed and Copied to Main (#495)
- Add rename media file
- add delete media file
- Add many load functions
- add user bookmarks (no tests yet)
- user bookmarks - fixes and unit tests
- user rating
- Add analytics
- add beta keys endpoints
- add comments endpoints
- Add conversion endpoint
- Add featured items endpoints
- Add to Jobs enpoints
- Add moderation endpoint
- Initial weights endpoints
- All weight enpoints, no unit tests
- unit tests for weights

extra fixes from wil:
- turn off proxy settings for node_env === development
- audit packages

---------

Co-authored-by: Christopher Oliphant <christopheroliphant@christophersmbp.home>
Co-authored-by: wil <wil@storyteller.ai>
2024-06-18 19:30:33 -04:00

40 lines
1.0 KiB
TypeScript

import { ApiManager, ApiResponse } from "./ApiManager";
export class EngineApi extends ApiManager {
public async ConvertTbxToGltf({
mediaFileToken,
uuidIdempotencyToken,
}: {
mediaFileToken: string;
uuidIdempotencyToken: string;
}): Promise<ApiResponse<string>> {
const endpoint = `${this.ApiTargets.BaseApi}/v1/conversion/enqueue_fbx_to_gltf`;
const body = {
media_file_token: mediaFileToken,
uuid_idempotency_token: uuidIdempotencyToken,
};
return this.post<
{ media_file_token: string; uuid_idempotency_token: string },
{ success?: boolean; inference_job_token?: string; BadInput?: string }
>({
endpoint,
body: body,
})
.then((response) => {
return {
success: response.success ?? false,
data: response.inference_job_token,
errorMessage: response.BadInput,
};
})
.catch((err) => {
return {
success: false,
errorMessage: err.message,
};
});
}
}