import { CloudFunction, EventContext } from '../cloud-functions'; import { DeploymentOptions, ScheduleRetryConfig } from '../function-configuration'; /** @hidden */ export declare const provider = "google.pubsub"; /** @hidden */ export declare const service = "pubsub.googleapis.com"; /** * Registers a Cloud Function triggered when a Google Cloud Pub/Sub message * is sent to a specified topic. * * @param topic - The Pub/Sub topic to watch for message events. * @returns Pub/Sub topic builder interface. */ export declare function topic(topic: string): TopicBuilder; /** @hidden */ export declare function _topicWithOptions(topic: string, options: DeploymentOptions): TopicBuilder; /** * The Google Cloud Pub/Sub topic builder. * * Access via [`functions.pubsub.topic()`](providers_pubsub_.html#topic). */ export declare class TopicBuilder { private triggerResource; private options; /** @hidden */ constructor(triggerResource: () => string, options: DeploymentOptions); /** * Event handler that fires every time a Cloud Pub/Sub message is * published. * * @param handler - Event handler that runs every time a Cloud Pub/Sub message * is published. * @return A Cloud Function that you can export and deploy. */ onPublish(handler: (message: Message, context: EventContext) => PromiseLike | any): CloudFunction; } /** * Registers a Cloud Function to run at specified times. * * @param schedule - The schedule, in Unix Crontab or AppEngine syntax. * @return ScheduleBuilder interface. */ export declare function schedule(schedule: string): ScheduleBuilder; /** @hidden */ export declare function _scheduleWithOptions(schedule: string, options: DeploymentOptions): ScheduleBuilder; /** * The builder for scheduled functions, which are powered by * Google Pub/Sub and Cloud Scheduler. Describes the Cloud Scheduler * job that is deployed to trigger a scheduled function at the provided * frequency. For more information, see * [Schedule functions](/docs/functions/schedule-functions). * * Access via [`functions.pubsub.schedule()`](providers_pubsub_.html#schedule). */ export declare class ScheduleBuilder { private triggerResource; private options; /** @hidden */ constructor(triggerResource: () => string, options: DeploymentOptions); retryConfig(config: ScheduleRetryConfig): ScheduleBuilder; timeZone(timeZone: string): ScheduleBuilder; /** * Event handler for scheduled functions. Triggered whenever the associated * scheduler job sends a Pub/Sub message. * * @param handler - Handler that fires whenever the associated * scheduler job sends a Pub/Sub message. * @return A Cloud Function that you can export and deploy. */ onRun(handler: (context: EventContext) => PromiseLike | any): CloudFunction; } /** * Interface representing a Google Cloud Pub/Sub message. * * @param data - Payload of a Pub/Sub message. */ export declare class Message { /** * The data payload of this message object as a base64-encoded string. */ readonly data: string; /** * User-defined attributes published with the message, if any. */ readonly attributes: { [key: string]: string; }; /** @hidden */ private _json; constructor(data: any); /** * The JSON data payload of this message object, if any. */ get json(): any; /** * Returns a JSON-serializable representation of this object. * * @return A JSON-serializable representation of this object. */ toJSON(): any; }