A Channel for notifications.
Usually not constructed directly, instead it is returned from helper functions like new_webhook_channel().
| Method | __init__ |
Create a new Channel. |
| Method | body |
Build a body from the Channel. |
| Method | update |
Update a channel with information from the response of watch(). |
| Instance Variable | address |
str, The address of the receiving entity where events are delivered. Specific to the channel type. |
| Instance Variable | expiration |
int, The time, in milliseconds from the epoch, when this channel will expire. |
| Instance Variable | id |
str, A UUID for the channel. |
| Instance Variable | params |
dict, A dictionary of string to string, with additional parameters controlling delivery channel behavior. |
| Instance Variable | resource |
str, An opaque id that identifies the resource that is being watched. Stable across different API versions. |
| Instance Variable | resource |
str, The canonicalized ID of the watched resource. |
| Instance Variable | token |
str, An arbitrary string associated with the channel that is delivered to the target address with each event delivered over this channel. |
| Instance Variable | type |
str, The type of delivery mechanism used by this channel. For example, 'web_hook'. |
def __init__(self, type, id, token, address, expiration=None, params=None, resource_id='', resource_uri=''): ¶
Create a new Channel.
In user code, this Channel constructor will not typically be called manually since there are functions for creating channels for each specific type with a more customized set of arguments to pass.
| Parameters | |
| type | str, The type of delivery mechanism used by this channel. For example, 'web_hook'. |
| id | str, A UUID for the channel. |
| token | str, An arbitrary string associated with the channel that is delivered to the target address with each event delivered over this channel. |
| address | str, The address of the receiving entity where events are delivered. Specific to the channel type. |
| expiration | int, The time, in milliseconds from the epoch, when this channel will expire. |
| params | dict, A dictionary of string to string, with additional parameters controlling delivery channel behavior. |
| resource | str, An opaque id that identifies the resource that is being watched. Stable across different API versions. |
| resource | str, The canonicalized ID of the watched resource. |
Build a body from the Channel.
Constructs a dictionary that's appropriate for passing into watch() methods as the value of body argument.
| Returns | |
| A dictionary representation of the channel. |
Update a channel with information from the response of watch().
When a request is sent to watch() a resource, the response returned from the watch() request is a dictionary with updated channel information, such as the resource_id, which is needed when stopping a subscription.
| Parameters | |
| resp | dict, The response from a watch() method. |
str, The address of the receiving entity where events are delivered. Specific to the channel type.
dict, A dictionary of string to string, with additional parameters controlling delivery channel behavior.
str, An opaque id that identifies the resource that is being watched. Stable across different API versions.
str, An arbitrary string associated with the channel that is delivered to the target address with each event delivered over this channel.