|
| 1 | +declare namespace GoogleCloudPlatform { |
| 2 | + |
| 3 | + export namespace CloudFunctions { |
| 4 | + export interface PubsubEvent { |
| 5 | + eventId: string |
| 6 | + timestamp: string // ISO 8601 |
| 7 | + eventType: string |
| 8 | + resource: string |
| 9 | + data: PubSub.PubsubMessage |
| 10 | + } |
| 11 | + |
| 12 | + type Callback = () => void; |
| 13 | + } |
| 14 | + |
| 15 | + // From v.0.13.1 |
| 16 | + // https://www.npmjs.com/package/@google-cloud/pubsub |
| 17 | + export namespace PubSub { |
| 18 | + /** |
| 19 | + * A message data and its attributes. The message payload must not be empty; |
| 20 | + * it must contain either a non-empty data field, or at least one attribute. |
| 21 | + * |
| 22 | + * @property {string} data |
| 23 | + * The message payload. |
| 24 | + * |
| 25 | + * @property {Object.<string, string>} attributes |
| 26 | + * Optional attributes for this message. |
| 27 | + * |
| 28 | + * @property {string} messageId |
| 29 | + * ID of this message, assigned by the server when the message is published. |
| 30 | + * Guaranteed to be unique within the topic. This value may be read by a |
| 31 | + * subscriber that receives a `PubsubMessage` via a `Pull` call or a push |
| 32 | + * delivery. It must not be populated by the publisher in a `Publish` call. |
| 33 | + * |
| 34 | + * @property {Object} publishTime |
| 35 | + * The time at which the message was published, populated by the server when |
| 36 | + * it receives the `Publish` call. It must not be populated by the |
| 37 | + * publisher in a `Publish` call. |
| 38 | + * |
| 39 | + * This object should have the same structure as [google.protobuf.Timestamp]{@link external:"google.protobuf.Timestamp"} |
| 40 | + * Example: "2017-07-17T07:35:53.742Z" |
| 41 | + * |
| 42 | + * @class |
| 43 | + * @see [google.pubsub.v1.PubsubMessage definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/pubsub/v1/pubsub.proto} |
| 44 | + */ |
| 45 | + export interface PubsubMessage { |
| 46 | + data?: string |
| 47 | + attributes: { [key: string]: string; } |
| 48 | + messageId: string |
| 49 | + publishTime: string |
| 50 | + } |
| 51 | + } |
| 52 | + |
| 53 | +} |
0 commit comments