mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-14 13:52:11 +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>
43 lines
960 B
TypeScript
43 lines
960 B
TypeScript
import { ApiManager, ApiResponse } from "./ApiManager";
|
|
|
|
export class ModerationApi extends ApiManager {
|
|
public async UpdateFeatureFlagsByToken({
|
|
usernameOrToken,
|
|
flags,
|
|
}: {
|
|
usernameOrToken: string;
|
|
flags: string[];
|
|
}): Promise<
|
|
ApiResponse<{
|
|
inference_job_token?: string;
|
|
inference_job_token_type?: string;
|
|
}>
|
|
> {
|
|
const endpoint = `${this.ApiTargets.BaseApi}/v1/moderation/user_feature_flags/${usernameOrToken}`;
|
|
|
|
const body = {
|
|
action: {
|
|
AddFlags: {
|
|
flags,
|
|
},
|
|
},
|
|
};
|
|
|
|
return this.post<
|
|
{ action: { AddFlags: { flags: string[] } } },
|
|
{ success?: boolean; BadInput?: string }
|
|
>({
|
|
endpoint,
|
|
body: body,
|
|
})
|
|
.then((response) => ({
|
|
success: response.success ?? false,
|
|
errorMessage: response.BadInput,
|
|
}))
|
|
.catch((err) => ({
|
|
success: false,
|
|
errorMessage: err.message,
|
|
}));
|
|
}
|
|
}
|