# Refresh 🎨

### Wall Colors (8 options)

* `white` - Clean, bright white walls
* `egg shell` - Soft, warm off-white tone
* `black` - Bold, dramatic black walls
* `gray` - Modern, neutral gray
* `blue` - Classic blue accent
* `deep blue` - Rich, sophisticated navy
* `olive` - Earthy, natural green tone
* `terracotta` - Warm, Mediterranean orange-red

### Floor Types (5 options)

* `parquet`
* `tile`
* `marble`
* `carpet`
* `concrete`&#x20;

### Endpoint

<mark style="color:green;">`POST`</mark> `https://europe-west1-gepettoai.cloudfunctions.net/v1/refresh`

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer {{API\_KEY}} |

#### Request Body

<table><thead><tr><th width="269">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>url<mark style="color:red;">*</mark></td><td>String (Url)</td><td><p>Image URL of the room to be redesigned.</p><p>Ex: <a href="https://theneo-prod-public.s3.amazonaws.com/images-1695201150801.jpg">https://theneo-prod-public.s3.amazonaws.com/images-1695201150801.jpg</a></p></td></tr><tr><td>transformation<mark style="color:red;">*</mark></td><td>String</td><td>The type of transformation:<br><code>walls</code> or <code>floor</code></td></tr><tr><td>value<mark style="color:red;">*</mark></td><td>String</td><td>The <a href="#wall-colors-8-options">color</a> or <a href="#floor-types-6-options">floor type</a></td></tr><tr><td>webhook</td><td>String</td><td>(optional) Webhook <strong>POST</strong> URL to send the result on completion.<br><br>If not provided, the request will wait for the result.</td></tr></tbody></table>

{% tabs %}
{% tab title="200: OK If webhook is not set" %}

```json
{
  "base64": "<base64 encoded image>",
  "status": "success"
}
```

{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}

{% tab title="400: Bad Request " %}

{% endtab %}

{% tab title="500: Internal Server Error " %}

{% endtab %}

{% tab title="200: OK If webhook is provided" %}

```json
{
  "status": "pending",
  "id": "xxxxxxxxxxxxxx", // You can use that id with Get Job
  "styleId": "your_style",
  "roomId": "your_room",
  "creativity": 14,
  "mode": "redesign"
}
```

{% endtab %}
{% endtabs %}

### Code Examples

{% tabs %}
{% tab title="CURL" %}

```bash
curl --location 'https://europe-west1-gepettoai.cloudfunctions.net/v1/refresh' \
--header 'Authorization: Bearer {{API_KEY}}' \
--header 'Content-Type: application/json' \
--data '{
  "url": "https://theneo-prod-public.s3.amazonaws.com/images-1695201150801.jpg",
  "transformation": "walls",
  "value": "white"
}'
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer {{API_KEY}}");
myHeaders.append("Content-Type", "application/json");

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: JSON.stringify({
    "url": "https://theneo-prod-public.s3.amazonaws.com/images-1695201150801.jpg",
    "transformation": "walls",
    "value": "white"
  })
};

const response = await fetch("https://europe-west1-gepettoai.cloudfunctions.net/v1/refresh", requestOptions)
const body = await reponse.json();
console.log(body)
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

url = "https://europe-west1-gepettoai.cloudfunctions.net/v1/refresh"

payload = json.dumps({
  "url": "https://theneo-prod-public.s3.amazonaws.com/images-1695201150801.jpg",
  "transformation": "walls",
  "value": "white"
})
headers = {
  'Authorization': 'Bearer {{API_KEY}}',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$client = new Client();
$headers = [
  'Authorization' => 'Bearer {{API_KEY}}',
  'Content-Type' => 'application/json'
];
$body = '{
  "url": "https://theneo-prod-public.s3.amazonaws.com/images-1695201150801.jpg",
  "transformation": "walls",
  "value": "white"
}';
$request = new Request('POST', 'https://europe-west1-gepettoai.cloudfunctions.net/v1/refresh', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();

```

{% endtab %}

{% tab title="GO" %}

```go
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://europe-west1-gepettoai.cloudfunctions.net/v1/refresh"
  method := "POST"

  payload := strings.NewReader(`{
    "url": "https://theneo-prod-public.s3.amazonaws.com/images-1695201150801.jpg",
    "transformation": "walls",
    "value": "white"
}`)

  client := &http.Client {}
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Authorization", "Bearer {{API_KEY}}")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require "uri"
require "json"
require "net/http"

url = URI("https://europe-west1-gepettoai.cloudfunctions.net/v1/refresh")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer {{API_KEY}}"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
  "url": "https://theneo-prod-public.s3.amazonaws.com/images-1695201150801.jpg",
  "transformation": "walls",
  "value": "white"
})

response = https.request(request)
puts response.read_body

```

{% endtab %}
{% endtabs %}

### Results To Expect

| Before                                                                                                                                                                                                                                                                                     | After                                                                                                                                                                                                                                                                                                                                                            |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <div><figure><img src="https://3386250929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FG6Nk007rm3iTJDH6P5EJ%2Fuploads%2FYhKfbYQuUuFBXRHbKESt%2Fimage.png?alt=media&#x26;token=52e2fd65-61d8-43ff-817a-6f0e09200e36" alt=""><figcaption></figcaption></figure></div> | <div><figure><img src="https://3386250929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FG6Nk007rm3iTJDH6P5EJ%2Fuploads%2FDFZ9eKR6StF59l7GE46k%2Fimage.png?alt=media&#x26;token=b51bfe5c-7a94-4c82-ba2b-bf601f0c30b4" alt=""><figcaption><p>transformation: <code>walls</code>, value: <code>white</code></p></figcaption></figure></div>   |
| <div><figure><img src="https://3386250929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FG6Nk007rm3iTJDH6P5EJ%2Fuploads%2FmLjZ5cAHEuw7jfs14SqE%2Fimage.png?alt=media&#x26;token=ddee785c-9cd5-46c8-87de-643dc0e7d24a" alt=""><figcaption></figcaption></figure></div> | <div><figure><img src="https://3386250929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FG6Nk007rm3iTJDH6P5EJ%2Fuploads%2FTsqwpqrdpYSwwE5MrB96%2Fimage.png?alt=media&#x26;token=aa2a93f1-5c81-44d6-a498-bda30f4f0de0" alt=""><figcaption><p>transformation: <code>floor</code>, value: <code>parquet</code></p></figcaption></figure></div> |
