# Google Mirror API . subscriptions

## Instance Methods

Deletes a subscription.

Creates a new subscription.

Retrieves a list of subscriptions for the authenticated user and service.

Updates an existing subscription in place.

### Method Details

`delete(id)`

    Deletes a subscription.

    Args:
      id: string, The ID of the subscription. (required)

`insert(body)`

    Creates a new subscription.

    Args:
      body: object, The request body. (required)
        The object takes the form of:

    { # A subscription to events on a collection.
        "kind": "mirror#subscription", # The type of resource. This is always mirror#subscription.
        "notification": { # A notification delivered by the API. # Container object for notifications. This is not populated in the Subscription resource.
          "itemId": "A String", # The ID of the item that generated the notification.
          "collection": "A String", # The collection that generated the notification.
          "verifyToken": "A String", # The secret verify token provided by the service when it subscribed for notifications.
          "userToken": "A String", # The user token provided by the service when it subscribed for notifications.
          "userActions": [ # A list of actions taken by the user that triggered the notification.
            { # Represents an action taken by the user that triggered a notification.
              "type": "A String", # The type of action. The value of this can be:
                  # - SHARE - the user shared an item.
                  # - REPLY - the user replied to an item.
                  # - REPLY_ALL - the user replied to all recipients of an item.
                  # - CUSTOM - the user selected a custom menu item on the timeline item.
                  # - DELETE - the user deleted the item.
                  # - PIN - the user pinned the item.
                  # - UNPIN - the user unpinned the item.  In the future, additional types may be added. UserActions with unrecognized types should be ignored.
              "payload": "A String", # An optional payload for the action.
                  #
                  # For actions of type CUSTOM, this is the ID of the custom menu item that was selected.
            },
          ],
          "operation": "A String", # The type of operation that generated the notification.
        },
        "updated": "A String", # The time at which this subscription was last modified, formatted according to RFC 3339.
        "collection": "A String", # The collection to subscribe to. Allowed values are:
            # - timeline - Changes in the timeline including insertion, deletion, and updates.
            # - locations - Location updates.
        "verifyToken": "A String", # A secret token sent to the subscriber in notifications so that it can verify that the notification was generated by Google.
        "userToken": "A String", # An opaque token sent to the subscriber in notifications so that it can determine the ID of the user.
        "operation": [ # A list of operations that should be subscribed to. An empty list indicates that all operations on the collection should be subscribed to. Allowed values are:
            # - UPDATE - The item has been updated.
            # - INSERT - A new item has been inserted.
            # - DELETE - The item has been deleted.
            # - MENU_ACTION - A custom menu item has been triggered by the user.
          "A String",
        ],
        "id": "A String", # The ID of the subscription.
        "callbackUrl": "A String", # The URL where notifications should be delivered (must start with https://).
      }

    Returns:
      An object of the form:

        { # A subscription to events on a collection.
          "kind": "mirror#subscription", # The type of resource. This is always mirror#subscription.
          "notification": { # A notification delivered by the API. # Container object for notifications. This is not populated in the Subscription resource.
            "itemId": "A String", # The ID of the item that generated the notification.
            "collection": "A String", # The collection that generated the notification.
            "verifyToken": "A String", # The secret verify token provided by the service when it subscribed for notifications.
            "userToken": "A String", # The user token provided by the service when it subscribed for notifications.
            "userActions": [ # A list of actions taken by the user that triggered the notification.
              { # Represents an action taken by the user that triggered a notification.
                "type": "A String", # The type of action. The value of this can be:
                    # - SHARE - the user shared an item.
                    # - REPLY - the user replied to an item.
                    # - REPLY_ALL - the user replied to all recipients of an item.
                    # - CUSTOM - the user selected a custom menu item on the timeline item.
                    # - DELETE - the user deleted the item.
                    # - PIN - the user pinned the item.
                    # - UNPIN - the user unpinned the item.  In the future, additional types may be added. UserActions with unrecognized types should be ignored.
                "payload": "A String", # An optional payload for the action.
                    #
                    # For actions of type CUSTOM, this is the ID of the custom menu item that was selected.
              },
            ],
            "operation": "A String", # The type of operation that generated the notification.
          },
          "updated": "A String", # The time at which this subscription was last modified, formatted according to RFC 3339.
          "collection": "A String", # The collection to subscribe to. Allowed values are:
              # - timeline - Changes in the timeline including insertion, deletion, and updates.
              # - locations - Location updates.
          "verifyToken": "A String", # A secret token sent to the subscriber in notifications so that it can verify that the notification was generated by Google.
          "userToken": "A String", # An opaque token sent to the subscriber in notifications so that it can determine the ID of the user.
          "operation": [ # A list of operations that should be subscribed to. An empty list indicates that all operations on the collection should be subscribed to. Allowed values are:
              # - UPDATE - The item has been updated.
              # - INSERT - A new item has been inserted.
              # - DELETE - The item has been deleted.
              # - MENU_ACTION - A custom menu item has been triggered by the user.
            "A String",
          ],
          "id": "A String", # The ID of the subscription.
          "callbackUrl": "A String", # The URL where notifications should be delivered (must start with https://).
        }

`list()`

    Retrieves a list of subscriptions for the authenticated user and service.

    Args:

    Returns:
      An object of the form:

        { # A list of Subscriptions. This is the response from the server to GET requests on the subscription collection.
        "items": [ # The list of subscriptions.
          { # A subscription to events on a collection.
              "kind": "mirror#subscription", # The type of resource. This is always mirror#subscription.
              "notification": { # A notification delivered by the API. # Container object for notifications. This is not populated in the Subscription resource.
                "itemId": "A String", # The ID of the item that generated the notification.
                "collection": "A String", # The collection that generated the notification.
                "verifyToken": "A String", # The secret verify token provided by the service when it subscribed for notifications.
                "userToken": "A String", # The user token provided by the service when it subscribed for notifications.
                "userActions": [ # A list of actions taken by the user that triggered the notification.
                  { # Represents an action taken by the user that triggered a notification.
                    "type": "A String", # The type of action. The value of this can be:
                        # - SHARE - the user shared an item.
                        # - REPLY - the user replied to an item.
                        # - REPLY_ALL - the user replied to all recipients of an item.
                        # - CUSTOM - the user selected a custom menu item on the timeline item.
                        # - DELETE - the user deleted the item.
                        # - PIN - the user pinned the item.
                        # - UNPIN - the user unpinned the item.  In the future, additional types may be added. UserActions with unrecognized types should be ignored.
                    "payload": "A String", # An optional payload for the action.
                        #
                        # For actions of type CUSTOM, this is the ID of the custom menu item that was selected.
                  },
                ],
                "operation": "A String", # The type of operation that generated the notification.
              },
              "updated": "A String", # The time at which this subscription was last modified, formatted according to RFC 3339.
              "collection": "A String", # The collection to subscribe to. Allowed values are:
                  # - timeline - Changes in the timeline including insertion, deletion, and updates.
                  # - locations - Location updates.
              "verifyToken": "A String", # A secret token sent to the subscriber in notifications so that it can verify that the notification was generated by Google.
              "userToken": "A String", # An opaque token sent to the subscriber in notifications so that it can determine the ID of the user.
              "operation": [ # A list of operations that should be subscribed to. An empty list indicates that all operations on the collection should be subscribed to. Allowed values are:
                  # - UPDATE - The item has been updated.
                  # - INSERT - A new item has been inserted.
                  # - DELETE - The item has been deleted.
                  # - MENU_ACTION - A custom menu item has been triggered by the user.
                "A String",
              ],
              "id": "A String", # The ID of the subscription.
              "callbackUrl": "A String", # The URL where notifications should be delivered (must start with https://).
            },
        ],
        "kind": "mirror#subscriptionsList", # The type of resource. This is always mirror#subscriptionsList.
      }

`update(id, body)`

    Updates an existing subscription in place.

    Args:
      id: string, The ID of the subscription. (required)
      body: object, The request body. (required)
        The object takes the form of:

    { # A subscription to events on a collection.
        "kind": "mirror#subscription", # The type of resource. This is always mirror#subscription.
        "notification": { # A notification delivered by the API. # Container object for notifications. This is not populated in the Subscription resource.
          "itemId": "A String", # The ID of the item that generated the notification.
          "collection": "A String", # The collection that generated the notification.
          "verifyToken": "A String", # The secret verify token provided by the service when it subscribed for notifications.
          "userToken": "A String", # The user token provided by the service when it subscribed for notifications.
          "userActions": [ # A list of actions taken by the user that triggered the notification.
            { # Represents an action taken by the user that triggered a notification.
              "type": "A String", # The type of action. The value of this can be:
                  # - SHARE - the user shared an item.
                  # - REPLY - the user replied to an item.
                  # - REPLY_ALL - the user replied to all recipients of an item.
                  # - CUSTOM - the user selected a custom menu item on the timeline item.
                  # - DELETE - the user deleted the item.
                  # - PIN - the user pinned the item.
                  # - UNPIN - the user unpinned the item.  In the future, additional types may be added. UserActions with unrecognized types should be ignored.
              "payload": "A String", # An optional payload for the action.
                  #
                  # For actions of type CUSTOM, this is the ID of the custom menu item that was selected.
            },
          ],
          "operation": "A String", # The type of operation that generated the notification.
        },
        "updated": "A String", # The time at which this subscription was last modified, formatted according to RFC 3339.
        "collection": "A String", # The collection to subscribe to. Allowed values are:
            # - timeline - Changes in the timeline including insertion, deletion, and updates.
            # - locations - Location updates.
        "verifyToken": "A String", # A secret token sent to the subscriber in notifications so that it can verify that the notification was generated by Google.
        "userToken": "A String", # An opaque token sent to the subscriber in notifications so that it can determine the ID of the user.
        "operation": [ # A list of operations that should be subscribed to. An empty list indicates that all operations on the collection should be subscribed to. Allowed values are:
            # - UPDATE - The item has been updated.
            # - INSERT - A new item has been inserted.
            # - DELETE - The item has been deleted.
            # - MENU_ACTION - A custom menu item has been triggered by the user.
          "A String",
        ],
        "id": "A String", # The ID of the subscription.
        "callbackUrl": "A String", # The URL where notifications should be delivered (must start with https://).
      }

    Returns:
      An object of the form:

        { # A subscription to events on a collection.
          "kind": "mirror#subscription", # The type of resource. This is always mirror#subscription.
          "notification": { # A notification delivered by the API. # Container object for notifications. This is not populated in the Subscription resource.
            "itemId": "A String", # The ID of the item that generated the notification.
            "collection": "A String", # The collection that generated the notification.
            "verifyToken": "A String", # The secret verify token provided by the service when it subscribed for notifications.
            "userToken": "A String", # The user token provided by the service when it subscribed for notifications.
            "userActions": [ # A list of actions taken by the user that triggered the notification.
              { # Represents an action taken by the user that triggered a notification.
                "type": "A String", # The type of action. The value of this can be:
                    # - SHARE - the user shared an item.
                    # - REPLY - the user replied to an item.
                    # - REPLY_ALL - the user replied to all recipients of an item.
                    # - CUSTOM - the user selected a custom menu item on the timeline item.
                    # - DELETE - the user deleted the item.
                    # - PIN - the user pinned the item.
                    # - UNPIN - the user unpinned the item.  In the future, additional types may be added. UserActions with unrecognized types should be ignored.
                "payload": "A String", # An optional payload for the action.
                    #
                    # For actions of type CUSTOM, this is the ID of the custom menu item that was selected.
              },
            ],
            "operation": "A String", # The type of operation that generated the notification.
          },
          "updated": "A String", # The time at which this subscription was last modified, formatted according to RFC 3339.
          "collection": "A String", # The collection to subscribe to. Allowed values are:
              # - timeline - Changes in the timeline including insertion, deletion, and updates.
              # - locations - Location updates.
          "verifyToken": "A String", # A secret token sent to the subscriber in notifications so that it can verify that the notification was generated by Google.
          "userToken": "A String", # An opaque token sent to the subscriber in notifications so that it can determine the ID of the user.
          "operation": [ # A list of operations that should be subscribed to. An empty list indicates that all operations on the collection should be subscribed to. Allowed values are:
              # - UPDATE - The item has been updated.
              # - INSERT - A new item has been inserted.
              # - DELETE - The item has been deleted.
              # - MENU_ACTION - A custom menu item has been triggered by the user.
            "A String",
          ],
          "id": "A String", # The ID of the subscription.
          "callbackUrl": "A String", # The URL where notifications should be delivered (must start with https://).
        }