1 | import { CloudFunction, EventContext } from "../cloud-functions";
|
2 | import { DeploymentOptions, ScheduleRetryConfig } from "../function-configuration";
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | export declare function topic(topic: string): TopicBuilder;
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | export declare class TopicBuilder {
|
17 | private triggerResource;
|
18 | private options;
|
19 |
|
20 | constructor(triggerResource: () => string, options: DeploymentOptions);
|
21 | /**
|
22 | * Event handler that fires every time a Cloud Pub/Sub message is
|
23 | * published.
|
24 | *
|
25 | * @param handler - Event handler that runs every time a Cloud Pub/Sub message
|
26 | * is published.
|
27 | * @returns A function that you can export and deploy.
|
28 | */
|
29 | onPublish(handler: (message: Message, context: EventContext) => PromiseLike<any> | any): CloudFunction<Message>;
|
30 | }
|
31 | /**
|
32 | * Registers a Cloud Function to run at specified times.
|
33 | *
|
34 | * @param schedule - The schedule, in Unix Crontab or AppEngine syntax.
|
35 | * @returns ScheduleBuilder interface.
|
36 | */
|
37 | export declare function schedule(schedule: string): ScheduleBuilder;
|
38 | /**
|
39 | * The builder for scheduled functions, which are powered by
|
40 | * Google Pub/Sub and Cloud Scheduler. Describes the Cloud Scheduler
|
41 | * job that is deployed to trigger a scheduled function at the provided
|
42 | * frequency. For more information, see
|
43 | * [Schedule functions](/docs/functions/schedule-functions).
|
44 | *
|
45 | * Access via `functions.pubsub.schedule()`.
|
46 | */
|
47 | export declare class ScheduleBuilder {
|
48 | private triggerResource;
|
49 | private options;
|
50 |
|
51 | constructor(triggerResource: () => string, options: DeploymentOptions);
|
52 | retryConfig(config: ScheduleRetryConfig): ScheduleBuilder;
|
53 | timeZone(timeZone: string): ScheduleBuilder;
|
54 | /**
|
55 | * Event handler for scheduled functions. Triggered whenever the associated
|
56 | * scheduler job sends a Pub/Sub message.
|
57 | *
|
58 | * @param handler - Handler that fires whenever the associated
|
59 | * scheduler job sends a Pub/Sub message.
|
60 | * @returns A function that you can export and deploy.
|
61 | */
|
62 | onRun(handler: (context: EventContext) => PromiseLike<any> | any): CloudFunction<unknown>;
|
63 | }
|
64 | /**
|
65 | * Interface representing a Google Cloud Pub/Sub message.
|
66 | *
|
67 | * @param data - Payload of a Pub/Sub message.
|
68 | */
|
69 | export declare class Message {
|
70 | |
71 |
|
72 |
|
73 | readonly data: string;
|
74 | |
75 |
|
76 |
|
77 | readonly attributes: {
|
78 | [key: string]: string;
|
79 | };
|
80 |
|
81 | private _json;
|
82 | constructor(data: any);
|
83 | /**
|
84 | * The JSON data payload of this message object, if any.
|
85 | */
|
86 | get json(): any;
|
87 | /**
|
88 | * Returns a JSON-serializable representation of this object.
|
89 | *
|
90 | * @returns A JSON-serializable representation of this object.
|
91 | */
|
92 | toJSON(): any;
|
93 | }
|