# Cloud Vision V1 Client - Class CreateProductRequest (2.2.1)

2.2.1 (latest) 2.2.0 2.1.3 2.0.3 1.10.3 1.9.4 1.8.0 1.7.6 1.6.8 Reference documentation and code samples for the Cloud Vision V1 Client class CreateProductRequest.

Request message for the `CreateProduct` method.

Generated from protobuf message `google.cloud.vision.v1.CreateProductRequest`

## Namespace

Google \\ Cloud \\ Vision \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ parent` | `string` Required. The project in which the Product should be created. Format is `projects/PROJECT_ID/locations/LOC_ID`. |
| `↳ product` | `https://docs.cloud.google.com/php/docs/reference/cloud-vision/latest/V1.Product` Required. The product to create. |
| `↳ product_id` | `string` A user-supplied resource id for this Product. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character `/`. |

### getParent

Required. The project in which the Product should be created.

Format is
`projects/PROJECT_ID/locations/LOC_ID`.

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

### setParent

Required. The project in which the Product should be created.

Format is
`projects/PROJECT_ID/locations/LOC_ID`.

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

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

### getProduct

Required. The product to create.

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

### hasProduct

### clearProduct

### setProduct

Required. The product to create.

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

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

### getProductId

A user-supplied resource id for this Product. If set, the server will
attempt to use this value as the resource id. If it is already in use, an
error is returned with code ALREADY_EXISTS. Must be at most 128 characters
long. It cannot contain the character `/`.

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

### setProductId

A user-supplied resource id for this Product. If set, the server will
attempt to use this value as the resource id. If it is already in use, an
error is returned with code ALREADY_EXISTS. Must be at most 128 characters
long. It cannot contain the character `/`.

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

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

### static::build

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `parent` | `string` Required. The project in which the Product should be created. Format is `projects/PROJECT_ID/locations/LOC_ID`. Please see ProductSearchClient::locationName() for help formatting this field. |
| `product` | `https://docs.cloud.google.com/php/docs/reference/cloud-vision/latest/V1.Product` Required. The product to create. |
| `productId` | `string` A user-supplied resource id for this Product. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 characters long. It cannot contain the character `/`. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-vision/latest/V1.CreateProductRequest` |   |