feat(builder): client side api implementation

This commit is contained in:
Nicholas Tindle
2024-09-10 12:30:49 -05:00
parent 943e3241c9
commit 7154f80927
2 changed files with 23 additions and 0 deletions

View File

@@ -8,6 +8,8 @@ import {
GraphExecuteResponse,
NodeExecutionResult,
User,
UserData,
TutorialStepData,
} from "./types";
export default class AutoGPTServerAPI {
@@ -32,6 +34,15 @@ export default class AutoGPTServerAPI {
return this._request("POST", "/auth/user", {});
}
// Analytics
async logCreateUser(userData: UserData): Promise<string> {
return this._request("POST", "/analytics/log_new_user", userData);
}
async logTutorialStep(data: TutorialStepData): Promise<string> {
return this._request("POST", "/analytics/log_tutorial_step", data);
}
async getBlocks(): Promise<Block[]> {
return await this._get("/blocks");
}

View File

@@ -182,3 +182,15 @@ export type User = {
id: string;
email: string;
};
export type UserData = {
user_id: string;
email: string;
name: string;
username: string;
};
export type TutorialStepData = {
step: number;
data: { [key: string]: any };
};