gotohuman
Version:
gotoHuman - The easiest way to review AI‑generated content, give approvals, or provide input to your AI workflows.
97 lines (95 loc) • 2.64 kB
text/typescript
type JsonValue = string | number | boolean | {
[key: string]: JsonValue;
} | JsonValue[];
type FormFields = {
[key: string]: JsonValue;
};
type FetchLike = typeof fetch;
type GotoHumanConfig = {
fetch?: FetchLike;
origin?: string;
originV?: string;
baseUrl?: string;
};
type ReviewResponse = {
reviewId: string;
gthLink?: string;
};
declare class Review {
private readonly formId;
private readonly apiKey;
private readonly baseUrl;
private readonly fetchImpl;
private readonly origin;
private readonly originV;
private fields;
private meta;
private assignTo?;
private assignToGroups?;
constructor(formId: string, apiKey: string, baseUrl: string, fetchImpl: FetchLike, origin: string, originV: string);
/**
* Add a field value to the review
*/
addFieldData(fieldName: string, value?: JsonValue): Review;
/**
* Set multiple field values at once
*/
setFieldsData(fields?: FormFields): Review;
/**
* Clear all fields in the current review
*/
clearFieldData(): Review;
/**
* Add a field to the meta data
*/
addMetaData(attribute: string, value?: JsonValue): Review;
/**
* Set multiple meta field values at once
*/
setMetaData(fields?: FormFields): Review;
/**
* Assign the review request to specific users
*/
assignToUsers(userEmails: string[]): Review;
/**
* Assign the review request to specific user groups
*/
assignToUserGroups(groupIds: string[]): Review;
/**
* Send the review request to the API
*/
sendRequest(): Promise<ReviewResponse>;
}
declare class GotoHuman {
private baseUrl;
private apiKey;
private fetchImpl;
private origin;
private originV;
constructor(params?: {
apiKey?: string;
} & GotoHumanConfig);
/**
* Initialize a new review with a form ID
*/
createReview(formId: string | undefined): Review;
/**
* Fetch all available review forms
*/
fetchReviewForms(): Promise<any>;
/**
* Fetch the schema for a specific form's fields
*/
fetchSchemaForFormFields(formId: string): Promise<any>;
/**
* Retrieves the base URL from the environment variable.
* @returns The base URL if set, otherwise undefined.
*/
private static getBaseUrlFromEnv;
/**
* Retrieves the API key from the environment variable.
* @returns The API key if set, otherwise undefined.
*/
private static getApiKeyFromEnv;
}
export { type FormFields, GotoHuman, type JsonValue, Review, type ReviewResponse };