/** * #scheduler.ts * * Code generated by ts-proto. DO NOT EDIT. * @packageDocumentation */ import _m0 from "protobufjs/minimal.js"; import { Metadata } from "../../../../lib/Types.js"; import { Empty } from "../../../google/protobuf/empty.js"; import { ScheduledAction } from "../../actor/scheduler/action.js"; import { Strings } from "../../runtime/runtime_common.js"; export interface ScheduledActionRequest { /** A time in the future to execute the action */ when?: Date | undefined; /** A crontab parseable string */ cron?: string | undefined; /** Action data to send back to the Actor */ action?: ScheduledAction | undefined; } export interface ScheduledActionResponse { /** Opaque ID for the scheduled action */ id: string; } export interface CancelActionRequest { /** Opaque ID returned from a previous call to Schedule() */ id: string; } export interface StorableAction { id: string; actorHostname: string; request?: ScheduledActionRequest | undefined; metadata: { [key: string]: Strings; }; state?: StorableAction_State | undefined; } export declare enum StorableAction_State { WAITING = 0, CANCELED = 1, FAILED = 2, DELIVERED = 3, UNRECOGNIZED = -1 } export declare function storableAction_StateFromJSON(object: any): StorableAction_State; export declare function storableAction_StateToJSON(object: StorableAction_State): number; export interface StorableAction_MetadataEntry { key: string; value?: Strings | undefined; } export interface ListActionRequest { before?: Date | undefined; after?: Date | undefined; } export interface GetActionResponse { id: string; request?: ScheduledActionRequest | undefined; } export interface ListActionResponse { actions: GetActionResponse[]; } export declare const ScheduledActionRequest: { $type: "devvit.plugin.scheduler.ScheduledActionRequest"; encode(message: ScheduledActionRequest, writer?: _m0.Writer): _m0.Writer; decode(input: _m0.Reader | Uint8Array, length?: number): ScheduledActionRequest; fromJSON(object: any): ScheduledActionRequest; toJSON(message: ScheduledActionRequest): unknown; create(base?: DeepPartial): ScheduledActionRequest; fromPartial(object: DeepPartial): ScheduledActionRequest; }; export declare const ScheduledActionResponse: { $type: "devvit.plugin.scheduler.ScheduledActionResponse"; encode(message: ScheduledActionResponse, writer?: _m0.Writer): _m0.Writer; decode(input: _m0.Reader | Uint8Array, length?: number): ScheduledActionResponse; fromJSON(object: any): ScheduledActionResponse; toJSON(message: ScheduledActionResponse): unknown; create(base?: DeepPartial): ScheduledActionResponse; fromPartial(object: DeepPartial): ScheduledActionResponse; }; export declare const CancelActionRequest: { $type: "devvit.plugin.scheduler.CancelActionRequest"; encode(message: CancelActionRequest, writer?: _m0.Writer): _m0.Writer; decode(input: _m0.Reader | Uint8Array, length?: number): CancelActionRequest; fromJSON(object: any): CancelActionRequest; toJSON(message: CancelActionRequest): unknown; create(base?: DeepPartial): CancelActionRequest; fromPartial(object: DeepPartial): CancelActionRequest; }; export declare const StorableAction: { $type: "devvit.plugin.scheduler.StorableAction"; encode(message: StorableAction, writer?: _m0.Writer): _m0.Writer; decode(input: _m0.Reader | Uint8Array, length?: number): StorableAction; fromJSON(object: any): StorableAction; toJSON(message: StorableAction): unknown; create(base?: DeepPartial): StorableAction; fromPartial(object: DeepPartial): StorableAction; }; export declare const StorableAction_MetadataEntry: { $type: "devvit.plugin.scheduler.StorableAction.MetadataEntry"; encode(message: StorableAction_MetadataEntry, writer?: _m0.Writer): _m0.Writer; decode(input: _m0.Reader | Uint8Array, length?: number): StorableAction_MetadataEntry; fromJSON(object: any): StorableAction_MetadataEntry; toJSON(message: StorableAction_MetadataEntry): unknown; create(base?: DeepPartial): StorableAction_MetadataEntry; fromPartial(object: DeepPartial): StorableAction_MetadataEntry; }; export declare const ListActionRequest: { $type: "devvit.plugin.scheduler.ListActionRequest"; encode(message: ListActionRequest, writer?: _m0.Writer): _m0.Writer; decode(input: _m0.Reader | Uint8Array, length?: number): ListActionRequest; fromJSON(object: any): ListActionRequest; toJSON(message: ListActionRequest): unknown; create(base?: DeepPartial): ListActionRequest; fromPartial(object: DeepPartial): ListActionRequest; }; export declare const GetActionResponse: { $type: "devvit.plugin.scheduler.GetActionResponse"; encode(message: GetActionResponse, writer?: _m0.Writer): _m0.Writer; decode(input: _m0.Reader | Uint8Array, length?: number): GetActionResponse; fromJSON(object: any): GetActionResponse; toJSON(message: GetActionResponse): unknown; create(base?: DeepPartial): GetActionResponse; fromPartial(object: DeepPartial): GetActionResponse; }; export declare const ListActionResponse: { $type: "devvit.plugin.scheduler.ListActionResponse"; encode(message: ListActionResponse, writer?: _m0.Writer): _m0.Writer; decode(input: _m0.Reader | Uint8Array, length?: number): ListActionResponse; fromJSON(object: any): ListActionResponse; toJSON(message: ListActionResponse): unknown; create(base?: DeepPartial): ListActionResponse; fromPartial(object: DeepPartial): ListActionResponse; }; /** * Provides an API for Actors to execute an action sometime in the future. * * Actors will need to implement the SchedulerHandler interface which the Scheduler will call with * the provided ScheduledAction as an argument. * * The Scheduler will fail with an error if the time provided is in the past. */ export interface Scheduler { /** This schedules an action */ Schedule(request: ScheduledActionRequest, metadata?: Metadata): Promise; /** This cancels any scheduled action */ Cancel(request: CancelActionRequest, metadata?: Metadata): Promise; /** This lists all scheduled actions for this installation. */ List(request: ListActionRequest, metadata?: Metadata): Promise; } export declare const SchedulerServiceName = "devvit.plugin.scheduler.Scheduler"; export declare class SchedulerClientImpl implements Scheduler { private readonly rpc; private readonly service; constructor(rpc: Rpc, opts?: { service?: string; }); Schedule(request: ScheduledActionRequest, metadata?: Metadata): Promise; Cancel(request: CancelActionRequest, metadata?: Metadata): Promise; List(request: ListActionRequest, metadata?: Metadata): Promise; } /** * Provides an API for Actors to execute an action sometime in the future. * * Actors will need to implement the SchedulerHandler interface which the Scheduler will call with * the provided ScheduledAction as an argument. * * The Scheduler will fail with an error if the time provided is in the past. */ export type SchedulerDefinition = typeof SchedulerDefinition; export declare const SchedulerDefinition: { readonly name: "Scheduler"; readonly fullName: "devvit.plugin.scheduler.Scheduler"; readonly methods: { /** This schedules an action */ readonly schedule: { readonly name: "Schedule"; readonly requestType: { $type: "devvit.plugin.scheduler.ScheduledActionRequest"; encode(message: ScheduledActionRequest, writer?: _m0.Writer): _m0.Writer; decode(input: _m0.Reader | Uint8Array, length?: number): ScheduledActionRequest; fromJSON(object: any): ScheduledActionRequest; toJSON(message: ScheduledActionRequest): unknown; create(base?: DeepPartial): ScheduledActionRequest; fromPartial(object: DeepPartial): ScheduledActionRequest; }; readonly requestStream: false; readonly responseType: { $type: "devvit.plugin.scheduler.ScheduledActionResponse"; encode(message: ScheduledActionResponse, writer?: _m0.Writer): _m0.Writer; decode(input: _m0.Reader | Uint8Array, length?: number): ScheduledActionResponse; fromJSON(object: any): ScheduledActionResponse; toJSON(message: ScheduledActionResponse): unknown; create(base?: DeepPartial): ScheduledActionResponse; fromPartial(object: DeepPartial): ScheduledActionResponse; }; readonly responseStream: false; readonly options: {}; }; /** This cancels any scheduled action */ readonly cancel: { readonly name: "Cancel"; readonly requestType: { $type: "devvit.plugin.scheduler.CancelActionRequest"; encode(message: CancelActionRequest, writer?: _m0.Writer): _m0.Writer; decode(input: _m0.Reader | Uint8Array, length?: number): CancelActionRequest; fromJSON(object: any): CancelActionRequest; toJSON(message: CancelActionRequest): unknown; create(base?: DeepPartial): CancelActionRequest; fromPartial(object: DeepPartial): CancelActionRequest; }; readonly requestStream: false; readonly responseType: { $type: "google.protobuf.Empty"; encode(_: Empty, writer?: _m0.Writer): _m0.Writer; decode(input: _m0.Reader | Uint8Array, length?: number): Empty; fromJSON(_: any): Empty; toJSON(_: Empty): unknown; create(base?: {}): Empty; fromPartial(_: {}): Empty; }; readonly responseStream: false; readonly options: {}; }; /** This lists all scheduled actions for this installation. */ readonly list: { readonly name: "List"; readonly requestType: { $type: "devvit.plugin.scheduler.ListActionRequest"; encode(message: ListActionRequest, writer?: _m0.Writer): _m0.Writer; decode(input: _m0.Reader | Uint8Array, length?: number): ListActionRequest; fromJSON(object: any): ListActionRequest; toJSON(message: ListActionRequest): unknown; create(base?: DeepPartial): ListActionRequest; fromPartial(object: DeepPartial): ListActionRequest; }; readonly requestStream: false; readonly responseType: { $type: "devvit.plugin.scheduler.ListActionResponse"; encode(message: ListActionResponse, writer?: _m0.Writer): _m0.Writer; decode(input: _m0.Reader | Uint8Array, length?: number): ListActionResponse; fromJSON(object: any): ListActionResponse; toJSON(message: ListActionResponse): unknown; create(base?: DeepPartial): ListActionResponse; fromPartial(object: DeepPartial): ListActionResponse; }; readonly responseStream: false; readonly options: {}; }; }; }; interface Rpc { request(service: string, method: string, data: Uint8Array, metadata?: Metadata): Promise; } type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; type DeepPartial = T extends Builtin ? T : T extends globalThis.Array ? globalThis.Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial; } : Partial; export {}; //# sourceMappingURL=scheduler.d.ts.map