4D-NetKit

GoogleNotification Class

Overview

GoogleNotification represents a change notification monitor for Gmail or Google Calendar. It supports two modes:

A GoogleNotification object is obtained by calling .notifier() on a GoogleCalendar object, or .notifier() on a GoogleMail object. Call start() to begin monitoring and stop() to end it.

Table of Contents

Functions

Properties

A GoogleNotification object exposes the following properties:

Property Type Description
endPoint Text (read-only) The webhook endpoint URL configured for push mode. Empty string when in pull mode or not yet configured.
expiration Text (read-only) Expiration timestamp of the current subscription. Empty string when not started or when the subscription has no expiration.
isStarted Boolean (read-only) true when the notification monitor is currently active.
timer Integer (read-only) Polling interval in seconds used in pull mode.

Functions

.start()

.start() : Object

Parameters

Parameter Type   Description
Result Object <- Status object with success (Boolean), statusText (Text), and errors (Collection).

Description

.start() activates change notifications for Gmail or Google Calendar in either push or pull mode, and fills the expiration property.

Callbacks (onCreate, onDelete, onModify) are dispatched in the 4D worker where .start() was originally called.

.stop()

.stop() : Object

Parameters

Parameter Type   Description
Result Object <- Status object with success (Boolean), statusText (Text), and errors (Collection).

Description

.stop() stops the notification monitor, cleans up all internal state, and clears the expiration property. In push mode, it also cancels the Gmail watch or Calendar channel subscription on the Google API.

See also