replicate-api
Version:
A typed client library for the replicate.com API
34 lines (33 loc) • 1.24 kB
TypeScript
import { ShallowPredictionState } from "./helpers/convertShallowPrediction";
import { ReplicateRequestOptions } from "./helpers/makeApiRequest";
export type PagedRequestOptions = {
/** Set to true to get all results */
all?: boolean;
/** Request data at this location. You should probably use the `.next()` method instead */
cursor?: string;
};
export type ListPredictionsOptions = PagedRequestOptions & ReplicateRequestOptions;
export type ListOfPredictions = {
/** Up to 100 predictions */
predictions: ShallowPredictionState[];
/** Get the next predictions */
next: () => Promise<ListOfPredictions>;
/** Cursor to get the next predictions manually. You should probably use the `.next()` method instead */
nextCursor?: string;
};
/** List your past predictions.
*
* ```typescript
* const result = await listPredictions({
* token: "Get your token at https://replicate.com/account"
* })
* ```
*
* Returns up to 100 predictions. To get more, use the `next` function:
* ```typescript
* const moreResults = await result.next()
* ```
*
* @returns A new `ShallowPredictionState`.
*/
export declare const listPredictions: (options: ListPredictionsOptions) => Promise<ListOfPredictions>;