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

The request message for the Publish method.

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

## Namespace

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

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ message_bus` | `string` Required. The full name of the message bus to publish events to. Format: `projects/{project}/locations/{location}/messageBuses/{messageBus}`. |
| `↳ proto_message` | `https://docs.cloud.google.com/php/docs/reference/cloud-eventarc-publishing/latest/V1.CloudEvent` The Protobuf format of the CloudEvent being published. Specification can be found here: <https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/protobuf-format.md> |
| `↳ json_message` | `string` The JSON format of the CloudEvent being published. Specification can be found here: <https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md> |
| `↳ avro_message` | `string` The Avro format of the CloudEvent being published. Specification can be found here: <https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/avro-format.md> |

### getMessageBus

Required. The full name of the message bus to publish events to. Format:
`projects/{project}/locations/{location}/messageBuses/{messageBus}`.

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

### setMessageBus

Required. The full name of the message bus to publish events to. Format:
`projects/{project}/locations/{location}/messageBuses/{messageBus}`.

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

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

### getProtoMessage

The Protobuf format of the CloudEvent being published. Specification can
be found here:
<https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/protobuf-format.md>

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-eventarc-publishing/latest/V1.CloudEvent|null` |   |

### hasProtoMessage

### setProtoMessage

The Protobuf format of the CloudEvent being published. Specification can
be found here:
<https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/protobuf-format.md>

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-eventarc-publishing/latest/V1.CloudEvent` |

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

### getJsonMessage

The JSON format of the CloudEvent being published. Specification can be
found here:
<https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md>

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

### hasJsonMessage

### setJsonMessage

The JSON format of the CloudEvent being published. Specification can be
found here:
<https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md>

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

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

### getAvroMessage

The Avro format of the CloudEvent being published. Specification can
be found here:
<https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/avro-format.md>

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

### hasAvroMessage

### setAvroMessage

The Avro format of the CloudEvent being published. Specification can
be found here:
<https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/avro-format.md>

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

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

### getFormat

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