# Google Apps Events Subscriptions V1 Client - Class Subscription (0.4.4)

0.4.4 (latest) 0.4.3 0.3.1 0.2.1 0.1.6 Reference documentation and code samples for the Google Apps Events Subscriptions V1 Client class Subscription.

A subscription to receive events about a Google Workspace resource. To learn
more about subscriptions, see the [Google Workspace Events API
overview](https://developers.google.com/workspace/events).

Generated from protobuf message `google.apps.events.subscriptions.v1.Subscription`

## Namespace

Google \\ Apps \\ Events \\ Subscriptions \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ expire_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Non-empty default. The timestamp in UTC when the subscription expires. Always displayed on output, regardless of what was used on input. |
| `↳ ttl` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` Input only. The time-to-live (TTL) or duration for the subscription. If unspecified or set to `0`, uses the maximum possible duration. |
| `↳ name` | `string` Optional. Immutable. Identifier. Resource name of the subscription. Format: `subscriptions/{subscription}` |
| `↳ uid` | `string` Output only. System-assigned unique identifier for the subscription. |
| `↳ target_resource` | `string` Required. Immutable. The Google Workspace resource that's monitored for events, formatted as the [full resource name](https://google.aip.dev/122#full-resource-names). To learn about target resources and the events that they support, see [Supported Google Workspace events](https://developers.google.com/workspace/events#supported-events). A user can only authorize your app to create one subscription for a given target resource. If your app tries to create another subscription with the same user credentials, the request returns an `ALREADY_EXISTS` error. |
| `↳ event_types` | `string[]` Required. Immutable. Unordered list. Input for creating a subscription. Otherwise, output only. One or more types of events to receive about the target resource. Formatted according to the CloudEvents specification. The supported event types depend on the target resource of your subscription. For details, see [Supported Google Workspace events](https://developers.google.com/workspace/events/guides#supported-events). By default, you also receive events about the [lifecycle of your subscription](https://developers.google.com/workspace/events/guides/events-lifecycle). You don't need to specify lifecycle events for this field. If you specify an event type that doesn't exist for the target resource, the request returns an HTTP `400 Bad Request` status code. |
| `↳ payload_options` | `https://docs.cloud.google.com/php/docs/reference/apps-events-subscriptions/latest/V1.PayloadOptions` Optional. Options about what data to include in the event payload. Only supported for Google Chat events. |
| `↳ notification_endpoint` | `https://docs.cloud.google.com/php/docs/reference/apps-events-subscriptions/latest/V1.NotificationEndpoint` Required. Immutable. The endpoint where the subscription delivers events, such as a Pub/Sub topic. |
| `↳ state` | `int` Output only. The state of the subscription. Determines whether the subscription can receive events and deliver them to the notification endpoint. |
| `↳ suspension_reason` | `int` Output only. The error that suspended the subscription. To reactivate the subscription, resolve the error and call the [`ReactivateSubscription`](https://docs.cloud.google.com/php/docs/reference/apps-events-subscriptions/latest/V1.Client.SubscriptionsServiceClient#_Google_Apps_Events_Subscriptions_V1_Client_SubscriptionsServiceClient__reactivateSubscription__) method. |
| `↳ authority` | `string` Output only. The user who authorized the creation of the subscription. Format: `users/{user}` For Google Workspace users, the `{user}` value is the [`user.id`](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users#User.FIELDS.ids) field from the Directory API. |
| `↳ create_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. The time when the subscription is created. |
| `↳ update_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. The last time that the subscription is updated. |
| `↳ reconciling` | `bool` Output only. If `true`, the subscription is in the process of being updated. |
| `↳ etag` | `string` Optional. This checksum is computed by the server based on the value of other fields, and might be sent on update requests to ensure the client has an up-to-date value before proceeding. |

### getExpireTime

Non-empty default. The timestamp in UTC when the subscription expires.

Always displayed on output, regardless of what was used on input.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasExpireTime

### setExpireTime

Non-empty default. The timestamp in UTC when the subscription expires.

Always displayed on output, regardless of what was used on input.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTtl

Input only. The time-to-live (TTL) or duration for the subscription. If
unspecified or set to `0`, uses the maximum possible duration.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration|null` |   |

### hasTtl

### setTtl

Input only. The time-to-live (TTL) or duration for the subscription. If
unspecified or set to `0`, uses the maximum possible duration.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getName

Optional. Immutable. Identifier. Resource name of the subscription.

Format: `subscriptions/{subscription}`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

Optional. Immutable. Identifier. Resource name of the subscription.

Format: `subscriptions/{subscription}`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getUid

Output only. System-assigned unique identifier for the subscription.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setUid

Output only. System-assigned unique identifier for the subscription.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTargetResource

Required. Immutable. The Google Workspace resource that's monitored for
events, formatted as the [full resource
name](https://google.aip.dev/122#full-resource-names). To learn about
target resources and the events that they support, see [Supported Google
Workspace
events](https://developers.google.com/workspace/events#supported-events).

A user can only authorize your app to create one subscription for a given
target resource. If your app tries to create another subscription with the
same user credentials, the request returns an `ALREADY_EXISTS` error.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setTargetResource

Required. Immutable. The Google Workspace resource that's monitored for
events, formatted as the [full resource
name](https://google.aip.dev/122#full-resource-names). To learn about
target resources and the events that they support, see [Supported Google
Workspace
events](https://developers.google.com/workspace/events#supported-events).

A user can only authorize your app to create one subscription for a given
target resource. If your app tries to create another subscription with the
same user credentials, the request returns an `ALREADY_EXISTS` error.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getEventTypes

Required. Immutable. Unordered list. Input for creating a subscription.

Otherwise, output only. One or more types of events to receive about the
target resource. Formatted according to the CloudEvents specification.
The supported event types depend on the target resource of your
subscription. For details, see [Supported Google Workspace
events](https://developers.google.com/workspace/events/guides#supported-events).
By default, you also receive events about the [lifecycle of your
subscription](https://developers.google.com/workspace/events/guides/events-lifecycle).
You don't need to specify lifecycle events for this field.
If you specify an event type that doesn't exist for the target resource,
the request returns an HTTP `400 Bad Request` status code.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setEventTypes

Required. Immutable. Unordered list. Input for creating a subscription.

Otherwise, output only. One or more types of events to receive about the
target resource. Formatted according to the CloudEvents specification.
The supported event types depend on the target resource of your
subscription. For details, see [Supported Google Workspace
events](https://developers.google.com/workspace/events/guides#supported-events).
By default, you also receive events about the [lifecycle of your
subscription](https://developers.google.com/workspace/events/guides/events-lifecycle).
You don't need to specify lifecycle events for this field.
If you specify an event type that doesn't exist for the target resource,
the request returns an HTTP `400 Bad Request` status code.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPayloadOptions

Optional. Options about what data to include in the event payload. Only
supported for Google Chat events.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/apps-events-subscriptions/latest/V1.PayloadOptions|null` |   |

### hasPayloadOptions

### clearPayloadOptions

### setPayloadOptions

Optional. Options about what data to include in the event payload. Only
supported for Google Chat events.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/apps-events-subscriptions/latest/V1.PayloadOptions` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getNotificationEndpoint

Required. Immutable. The endpoint where the subscription delivers events,
such as a Pub/Sub topic.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/apps-events-subscriptions/latest/V1.NotificationEndpoint|null` |   |

### hasNotificationEndpoint

### clearNotificationEndpoint

### setNotificationEndpoint

Required. Immutable. The endpoint where the subscription delivers events,
such as a Pub/Sub topic.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/apps-events-subscriptions/latest/V1.NotificationEndpoint` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getState

Output only. The state of the subscription. Determines whether the
subscription can receive events and deliver them to the notification
endpoint.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [State](https://docs.cloud.google.com/php/docs/reference/apps-events-subscriptions/latest/V1.Subscription.State). |

### setState

Output only. The state of the subscription. Determines whether the
subscription can receive events and deliver them to the notification
endpoint.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [State](https://docs.cloud.google.com/php/docs/reference/apps-events-subscriptions/latest/V1.Subscription.State). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSuspensionReason

Output only. The error that suspended the subscription.

To reactivate the subscription, resolve the error and call the
[`ReactivateSubscription`](https://docs.cloud.google.com/php/docs/reference/apps-events-subscriptions/latest/V1.Client.SubscriptionsServiceClient#_Google_Apps_Events_Subscriptions_V1_Client_SubscriptionsServiceClient__reactivateSubscription__)
method.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [ErrorType](https://docs.cloud.google.com/php/docs/reference/apps-events-subscriptions/latest/V1.Subscription.ErrorType). |

### setSuspensionReason

Output only. The error that suspended the subscription.

To reactivate the subscription, resolve the error and call the
[`ReactivateSubscription`](https://docs.cloud.google.com/php/docs/reference/apps-events-subscriptions/latest/V1.Client.SubscriptionsServiceClient#_Google_Apps_Events_Subscriptions_V1_Client_SubscriptionsServiceClient__reactivateSubscription__)
method.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [ErrorType](https://docs.cloud.google.com/php/docs/reference/apps-events-subscriptions/latest/V1.Subscription.ErrorType). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAuthority

Output only. The user who authorized the creation of the
subscription.

Format: `users/{user}`
For Google Workspace users, the `{user}` value is the
[`user.id`](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users#User.FIELDS.ids)
field from the Directory API.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setAuthority

Output only. The user who authorized the creation of the
subscription.

Format: `users/{user}`
For Google Workspace users, the `{user}` value is the
[`user.id`](https://developers.google.com/admin-sdk/directory/reference/rest/v1/users#User.FIELDS.ids)
field from the Directory API.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCreateTime

Output only. The time when the subscription is created.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasCreateTime

### clearCreateTime

### setCreateTime

Output only. The time when the subscription is created.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getUpdateTime

Output only. The last time that the subscription is updated.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasUpdateTime

### clearUpdateTime

### setUpdateTime

Output only. The last time that the subscription is updated.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getReconciling

Output only. If `true`, the subscription is in the process of being
updated.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setReconciling

Output only. If `true`, the subscription is in the process of being
updated.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getEtag

Optional. This checksum is computed by the server based on the value of
other fields, and might be sent on update requests to ensure the client has
an up-to-date value before proceeding.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setEtag

Optional. This checksum is computed by the server based on the value of
other fields, and might be sent on update requests to ensure the client has
an up-to-date value before proceeding.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getExpiration

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |