# Update Primary Image

Use this method to update an item's primary image.&#x20;

### Usage in your script

```csharp
UpdatePrimaryImage
  .Initialize(destroyAtEnd: true)
  .SetParameters(
    address: "0x...",
    token_id: "1",
    imageIdex:"1"
  )
  .OnError(error => Debug.Log(error))
  .OnComplete(result => Debug.Log(result))
  .Run();
```

#### Member Functions

**`.Initialize()`**

<table><thead><tr><th width="193">Parameter</th><th width="80">Type</th><th width="105">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>destroyAtEnd</code></td><td><strong>bool</strong></td><td><strong>Optional</strong></td><td>defines if this component will be destroyed after <code>.Run()</code></td></tr></tbody></table>

**`.SetParameters()`**

<table><thead><tr><th width="193.33333333333331">Parameter</th><th width="88">Type</th><th width="109">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>address</code></td><td><strong>String</strong></td><td><strong>Yes</strong></td><td>Collection address</td></tr><tr><td><code>token_id</code></td><td><strong>String</strong></td><td><strong>Yes</strong></td><td>Altura Guard code.</td></tr><tr><td><code>imageIdex</code></td><td><strong>String</strong></td><td><strong>Yes</strong></td><td>The index of the image you wish to change to</td></tr></tbody></table>

**`.onError()`**

*Action on Error: returns error information.*

**`.onComplete()`**

*Action on successful: returns* [*`Items_model`*](https://docs.altura.com/altura-documentation-1/schema#items-model) *type.*

**`.Run()`**

*Runs the API call and fills the corresponding model in the component on success.*
