mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-14 05:42:32 +00:00
- 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>
39 lines
944 B
TypeScript
39 lines
944 B
TypeScript
import { ApiManager, ApiResponse } from "./ApiManager";
|
|
|
|
export class AnalyticsApi extends ApiManager {
|
|
public PostAnalytics({
|
|
maybeLastAction,
|
|
maybeLogToken,
|
|
}: {
|
|
maybeLastAction: string;
|
|
maybeLogToken: string;
|
|
}): Promise<ApiResponse<string>> {
|
|
const endpoint = `${this.ApiTargets.BaseApi}/v1/analytics/log_session`;
|
|
|
|
const body = {
|
|
maybe_last_action: maybeLastAction,
|
|
maybe_log_token: maybeLogToken,
|
|
};
|
|
|
|
return this.post<
|
|
{
|
|
maybe_last_action: string;
|
|
maybe_log_token: string;
|
|
},
|
|
{
|
|
success?: boolean;
|
|
log_token?: string;
|
|
BadInput?: string;
|
|
}
|
|
>({ endpoint, body })
|
|
.then((response) => ({
|
|
success: response.success ?? false,
|
|
data: response.log_token,
|
|
errorMessage: response.BadInput,
|
|
}))
|
|
.catch((err) => {
|
|
return { success: false, errorMessage: err.message };
|
|
});
|
|
}
|
|
}
|