# Google Cloud Eventarc Publishing V1 Client - Class PublishEventsRequest (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 PublishEventsRequest.

The request message for the PublishEvents method.

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

## Namespace

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

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ channel` | `string` The full name of the channel to publish to. For example: `projects/{project}/locations/{location}/channels/{channel-id}`. |
| `↳ events` | `array<https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Any>` The CloudEvents v1.0 events to publish. No other types are allowed. If this field is set, then the `text_events` fields must not be set. |
| `↳ text_events` | `string[]` The text representation of events to publish. CloudEvent v1.0 in JSON format is the only allowed type. Refer to <https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md> for specification. If this field is set, then the `events` fields must not be set. |

### getChannel

The full name of the channel to publish to. For example:
`projects/{project}/locations/{location}/channels/{channel-id}`.

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

### setChannel

The full name of the channel to publish to. For example:
`projects/{project}/locations/{location}/channels/{channel-id}`.

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

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

### getEvents

The CloudEvents v1.0 events to publish. No other types are allowed.

If this field is set, then the `text_events` fields must not be set.

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

### setEvents

The CloudEvents v1.0 events to publish. No other types are allowed.

If this field is set, then the `text_events` fields must not be set.

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

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

### getTextEvents

The text representation of events to publish.

CloudEvent v1.0 in JSON format is the only allowed type. Refer to
<https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md>
for specification.
If this field is set, then the `events` fields must not be set.

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

### setTextEvents

The text representation of events to publish.

CloudEvent v1.0 in JSON format is the only allowed type. Refer to
<https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md>
for specification.
If this field is set, then the `events` fields must not be set.

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

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