feat: add class for making API calls
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
import { IPC } from "./MCBE-IPC/ipc";
|
||||||
|
|
||||||
|
export class AddonAPICaller {
|
||||||
|
static async call(endpoint, parameterModel, parameterMap, returnDataModel) {
|
||||||
|
return await IPC.invoke(endpoint, parameterModel, parameterMap, returnDataModel).then(result => result.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,5 +3,6 @@ import { APIController } from "./APIController";
|
|||||||
import { VoidModel } from "./APIModels";
|
import { VoidModel } from "./APIModels";
|
||||||
import { APICallerError } from "./Errors/APICallerError";
|
import { APICallerError } from "./Errors/APICallerError";
|
||||||
import { PROTO } from "./MCBE-IPC/ipc";
|
import { PROTO } from "./MCBE-IPC/ipc";
|
||||||
|
import { AddonAPICaller } from "./AddonAPICaller";
|
||||||
|
|
||||||
export { AddonAPI, APIController, VoidModel, APICallerError, PROTO };
|
export { AddonAPI, APIController, VoidModel, APICallerError, PROTO, AddonAPICaller };
|
||||||
Reference in New Issue
Block a user