# Google Cloud Eventarc Publishing V1 Client - Class CloudEvent (1.2.2)

1.2.2 (latest) 1.2.1 1.1.6 1.0.0 0.6.4 0.5.1 0.4.1 0.3.4 Reference documentation and code samples for the Google Cloud Eventarc Publishing V1 Client class CloudEvent.

CloudEvent represents a vendor-neutral specification for defining the format
of event data.

Generated from protobuf message `google.cloud.eventarc.publishing.v1.CloudEvent`

## Namespace

Google \\ Cloud \\ Eventarc \\ Publishing \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ id` | `string` Required. Identifies the event. Producers MUST ensure that source + id is unique for each distinct event. |
| `↳ source` | `string` Required. Identifies the context in which an event happened. URI-reference |
| `↳ spec_version` | `string` Required. The version of the CloudEvents specification which the event uses. |
| `↳ type` | `string` Required. This attribute contains a value describing the type of event related to the originating occurrence. |
| `↳ attributes` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Optional. Used for Optional \& Extension Attributes |
| `↳ binary_data` | `string` Optional. Binary data. |
| `↳ text_data` | `string` Optional. Text data. |
| `↳ proto_data` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Any` Optional. Proto data. NOTE: The `protoData` field only functions as expected when the payload is specifically a `CloudEvent` message type, and can't be used for arbitrary protocol buffer messages. For any other protocol buffer type, you must serialize your proto message into bytes, and use the `binaryData` field instead. |

### getId

Required. Identifies the event. Producers MUST ensure that source + id is
unique for each distinct event.

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

### setId

Required. Identifies the event. Producers MUST ensure that source + id is
unique for each distinct event.

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

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

### getSource

Required. Identifies the context in which an event happened.

URI-reference

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

### setSource

Required. Identifies the context in which an event happened.

URI-reference

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

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

### getSpecVersion

Required. The version of the CloudEvents specification which the event
uses.

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

### setSpecVersion

Required. The version of the CloudEvents specification which the event
uses.

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

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

### getType

Required. This attribute contains a value describing the type of event
related to the originating occurrence.

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

### setType

Required. This attribute contains a value describing the type of event
related to the originating occurrence.

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

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

### getAttributes

Optional. Used for Optional \& Extension Attributes

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

### setAttributes

Optional. Used for Optional \& Extension Attributes

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

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

### getBinaryData

Optional. Binary data.

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

### hasBinaryData

### setBinaryData

Optional. Binary data.

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

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

### getTextData

Optional. Text data.

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

### hasTextData

### setTextData

Optional. Text data.

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

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

### getProtoData

Optional. Proto data.

NOTE: The `protoData` field only functions as expected when the payload
is specifically a `CloudEvent` message type, and can't be used for
arbitrary protocol buffer messages. For any other protocol buffer type,
you must serialize your proto message into bytes, and use the
`binaryData` field instead.

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

### hasProtoData

### setProtoData

Optional. Proto data.

NOTE: The `protoData` field only functions as expected when the payload
is specifically a `CloudEvent` message type, and can't be used for
arbitrary protocol buffer messages. For any other protocol buffer type,
you must serialize your proto message into bytes, and use the
`binaryData` field instead.

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

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

### getData

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