import { CancelExecutionResult, DateInterval, EnqueueResult, ExecutionErrorCode, ExecutionFilters, ExecutionState, GetExecutionResult, ListExecutionAttemptsResult, ListExecutionsResult, PageRequest, ReRunExecutionResult, RescheduleExecutionResult } from "../backend"; import { DeferableFunction, DeferredFunction } from "../index"; export interface SingleObjectResponse { data: T; } export interface Page { first?: number; after?: string; last?: number; before?: string; } export interface PageInfo { has_next_page: boolean; has_prev_page: boolean; start_cursor: string; end_cursor: string; } export interface ListObjectsResponse { page_info: PageInfo; data: T[]; } export interface ListObjectRequest { page: Page | undefined; filters: T | undefined; } export interface APIExecution { id: string; state: ExecutionState; function_name: string; function_id: string; schedule_for: string; scheduled_at: string; created_at: string; updated_at: string; } export interface CreateExecutionRequest { function_name: string; function_arguments: string[]; schedule_for: string; discard_after: string | undefined; metadata: { [key: string]: string; } | undefined; } export interface CancelExecutionRequest { force: boolean; } export interface RescheduleExecutionRequest { schedule_for: string; } export interface ListExecutionFilters { states?: ExecutionState[] | undefined; function_ids?: string[] | undefined; error_codes?: ExecutionErrorCode[] | undefined; scheduled_at?: DateInterval | undefined; started_at?: DateInterval | undefined; executed_by?: string | undefined; metadata?: { key: string; values: string[]; }[] | undefined; } export type ListExecutionsRequest = ListObjectRequest; export type ListExecutionAttemptsRequest = ListObjectRequest; export interface ReRunExecutionRequest { } export type CreateExecutionResponse = SingleObjectResponse; export type GetExecutionResponse = SingleObjectResponse; export type ReRunExecutionResponse = SingleObjectResponse; export type RescheduleExecutionResponse = SingleObjectResponse; export type CancelExecutionResponse = SingleObjectResponse; export type ListExecutionsResponse = ListObjectsResponse; export type ListExecutionAttemptsResponse = ListObjectsResponse; export declare function enqueue(func: DeferredFunction, args: Parameters, scheduleFor: Date, discardAfter: Date | undefined, metadata: { [key: string]: string; } | undefined): Promise; export declare function getExecution(id: string): Promise; export declare function getExecutionResult(id: string): Promise; export declare function cancelExecution(id: string, force: boolean): Promise; export declare function rescheduleExecution(id: string, scheduleFor: Date): Promise; export declare function reRunExecution(id: string): Promise; export declare function listExecutions(pageRequest?: PageRequest, filters?: ExecutionFilters): Promise; export declare function listExecutionAttempts(id: string, pageRequest?: PageRequest, filters?: ExecutionFilters): Promise;