# Game


## List

<small class="badge badge-darkred">requires authentication</small>

Use this end point to get the list of games

> Example request:

```bash
curl -X GET \
    -G "https://apiqa.bettorfantasy.com/games" \
    -H "Authorization: Bearer {YOUR_AUTH_KEY}" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
```


> Example response (200):

```json
{
    "message": "Games",
    "data": {
        "games": [
            {
                "id": 1,
                "name": "Football (NFL)",
                "image": "http:\/\/127.0.0.1:8000\/images\/icon-football.png",
                "status": "Active",
                "sequence": 0
            },
            {
                "id": 2,
                "name": "Basketball (NBA)",
                "image": "http:\/\/127.0.0.1:8000\/images\/icon-basketball.png",
                "status": "Active",
                "sequence": 0
            },
            {
                "id": 3,
                "name": "Baseball (MLB)",
                "image": "http:\/\/127.0.0.1:8000\/images\/icon-baseball.png",
                "status": "Active",
                "sequence": 0
            }
        ]
    }
}
```
<div id="execution-results-GETgames" hidden>
    <blockquote>Received response<span id="execution-response-status-GETgames"></span>:</blockquote>
    <pre class="json"><code id="execution-response-content-GETgames"></code></pre>
</div>
<div id="execution-error-GETgames" hidden>
    <blockquote>Request failed with error:</blockquote>
    <pre><code id="execution-error-message-GETgames"></code></pre>
</div>
<form id="form-GETgames" data-method="GET" data-path="games" data-authed="1" data-hasfiles="0" data-headers='{"Authorization":"Bearer {YOUR_AUTH_KEY}","Content-Type":"application\/json","Accept":"application\/json"}' onsubmit="event.preventDefault(); executeTryOut('GETgames', this);">
<h3>
    Request&nbsp;&nbsp;&nbsp;
        <button type="button" style="background-color: #8fbcd4; padding: 5px 10px; border-radius: 5px; border-width: thin;" id="btn-tryout-GETgames" onclick="tryItOut('GETgames');">Try it out ⚡</button>
    <button type="button" style="background-color: #c97a7e; padding: 5px 10px; border-radius: 5px; border-width: thin;" id="btn-canceltryout-GETgames" onclick="cancelTryOut('GETgames');" hidden>Cancel</button>&nbsp;&nbsp;
    <button type="submit" style="background-color: #6ac174; padding: 5px 10px; border-radius: 5px; border-width: thin;" id="btn-executetryout-GETgames" hidden>Send Request 💥</button>
    </h3>
<p>
<small class="badge badge-green">GET</small>
 <b><code>games</code></b>
</p>
<p>
<label id="auth-GETgames" hidden>Authorization header: <b><code>Bearer </code></b><input type="text" name="Authorization" data-prefix="Bearer " data-endpoint="GETgames" data-component="header"></label>
</p>
</form>


## Update

<small class="badge badge-darkred">requires authentication</small>

Use this end point to update game.

> Example request:

```bash
curl -X POST \
    "https://apiqa.bettorfantasy.com/games/3/update" \
    -H "Authorization: Bearer {YOUR_AUTH_KEY}" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{"status":"aliquam","sequence":1}'

```


> Example response (200):

```json
{
    "message": "Game updated successfully",
    "data": {
        "game": {
            "id": 1,
            "name": "Football (NFL)",
            "image": "http:\/\/127.0.0.1:8000\/images\/icon-football.png",
            "status": "Inactive",
            "sequence": 1,
            "created_at": null,
            "updated_at": "2022-07-15T06:45:37.000000Z"
        }
    }
}
```
> Example response (422):

```json
{
    "message": "Please enter required information",
    "errors": {
        "status": [
            "The status field is required."
        ],
        "sequence": [
            "The sequence field is required."
        ]
    }
}
```
> Example response (404):

```json
{
    "message": "Game not found"
}
```
> Example response (403):

```json
{
    "message": "Access Forbidden!"
}
```
<div id="execution-results-POSTgames--id--update" hidden>
    <blockquote>Received response<span id="execution-response-status-POSTgames--id--update"></span>:</blockquote>
    <pre class="json"><code id="execution-response-content-POSTgames--id--update"></code></pre>
</div>
<div id="execution-error-POSTgames--id--update" hidden>
    <blockquote>Request failed with error:</blockquote>
    <pre><code id="execution-error-message-POSTgames--id--update"></code></pre>
</div>
<form id="form-POSTgames--id--update" data-method="POST" data-path="games/{id}/update" data-authed="1" data-hasfiles="0" data-headers='{"Authorization":"Bearer {YOUR_AUTH_KEY}","Content-Type":"application\/json","Accept":"application\/json"}' onsubmit="event.preventDefault(); executeTryOut('POSTgames--id--update', this);">
<h3>
    Request&nbsp;&nbsp;&nbsp;
        <button type="button" style="background-color: #8fbcd4; padding: 5px 10px; border-radius: 5px; border-width: thin;" id="btn-tryout-POSTgames--id--update" onclick="tryItOut('POSTgames--id--update');">Try it out ⚡</button>
    <button type="button" style="background-color: #c97a7e; padding: 5px 10px; border-radius: 5px; border-width: thin;" id="btn-canceltryout-POSTgames--id--update" onclick="cancelTryOut('POSTgames--id--update');" hidden>Cancel</button>&nbsp;&nbsp;
    <button type="submit" style="background-color: #6ac174; padding: 5px 10px; border-radius: 5px; border-width: thin;" id="btn-executetryout-POSTgames--id--update" hidden>Send Request 💥</button>
    </h3>
<p>
<small class="badge badge-black">POST</small>
 <b><code>games/{id}/update</code></b>
</p>
<p>
<label id="auth-POSTgames--id--update" hidden>Authorization header: <b><code>Bearer </code></b><input type="text" name="Authorization" data-prefix="Bearer " data-endpoint="POSTgames--id--update" data-component="header"></label>
</p>
<h4 class="fancy-heading-panel"><b>URL Parameters</b></h4>
<p>
<b><code>id</code></b>&nbsp;&nbsp;<small>integer</small>  &nbsp;
<input type="number" name="id" data-endpoint="POSTgames--id--update" data-component="url" required  hidden>
<br>
The ID of the game. Ex: 1
</p>
<h4 class="fancy-heading-panel"><b>Body Parameters</b></h4>
<p>
<b><code>status</code></b>&nbsp;&nbsp;<small>string</small>  &nbsp;
<input type="text" name="status" data-endpoint="POSTgames--id--update" data-component="body" required  hidden>
<br>
Status of the game. Possible values: Active, Paused, Inactive. Ex: Active
</p>
<p>
<b><code>sequence</code></b>&nbsp;&nbsp;<small>integer</small>  &nbsp;
<input type="number" name="sequence" data-endpoint="POSTgames--id--update" data-component="body" required  hidden>
<br>
Sequence of the sport (Ascending). Ex: 2
</p>

</form>



