MENU

# Introduction

Documentation for the Backend API.

Base URL: `localhost:9000`

This documentation aims to provide all the information you need to work with our API.

As you scroll, you'll see code examples for working with the API in different programming languages in the dark area to the right (or as part of the content on mobile). You can switch the language used with the tabs at the top right (or from the nav menu at the top left on mobile).

# Authenticating requests

To authenticate requests, include an `Authorization` header with the value `"Bearer {YOUR_AUTH_KEY}"`.

All authenticated endpoints are marked with a `requires authentication` badge in the documentation below.

You can manage your tokens at the `profile` page in the `API Tokens` section.

# Discord User By snowflake Managment

APIs to manage DiscordUser records.

These endpoints can be used to identify/create DiscordUser records identified by the snowflake that already exists in the discord app.

## Get the DiscordUser identified by the specified snowflake.

requires authentication

Returns the DiscordUser record for the specified snowflake, given in the url discord_user_snowflake parameter.

If it cannot be found, a 404, Not Found error is returned.

> Example request:

    curl --request GET \
        --get "localhost:9000/api/v1/discord-user-by-snowflake/481398158916845568" \
        --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
        --header "Content-Type: application/json" \
        --header "Accept: application/json"

    const url = new URL(
        "localhost:9000/api/v1/discord-user-by-snowflake/481398158916845568"
    );

    const headers = {
        "Authorization": "Bearer {YOUR_AUTH_KEY}",
        "Content-Type": "application/json",
        "Accept": "application/json",
    };

    fetch(url, {
        method: "GET",
        headers,
    }).then(response => response.json());

    $client = new \GuzzleHttp\Client();
    $url = 'localhost:9000/api/v1/discord-user-by-snowflake/481398158916845568';
    $response = $client->get(
        $url,
        [
            'headers' => [
                'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
                'Content-Type' => 'application/json',
                'Accept' => 'application/json',
            ],
        ]
    );
    $body = $response->getBody();
    print_r(json_decode((string) $body));

    import requests
    import json

    url = 'localhost:9000/api/v1/discord-user-by-snowflake/481398158916845568'
    headers = {
      'Authorization': 'Bearer {YOUR_AUTH_KEY}',
      'Content-Type': 'application/json',
      'Accept': 'application/json'
    }

    response = requests.request('GET', url, headers=headers)
    response.json()

> Example response (200, success):

    {
        "data": {
            "id": 42,
            "snowflake": "481398158916845568",
            "user_name": "bigfootmcfly",
            "global_name": "BigFoot McFly",
            "locale": "hu_HU",
            "timezone": "Europe/Budapest"
        }
    }

> Example response (404, not found):

    {
        "message": "Not Found."
    }

> Received response:

> Request failed with error:

    Tip: Check that you're properly connected to the network.
    If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
    You can check the Dev Tools console for debugging information.

### Request

GET `api/v1/discord-user-by-snowflake/{discord_user_snowflake}`

#### Headers

`Authorization`

Example: `Bearer {YOUR_AUTH_KEY}`

`Content-Type`

Example: `application/json`

`Accept`

Example: `application/json`

#### URL Parameters

`discord_user_snowflake` string

A valid snowflake. Example: `481398158916845568`

## Get _OR_ Update/Create the DiscordUser identified by the specified snowflake.

requires authentication

If the record specified by the url discord_user_snowflake parameter exists, it will be updated with the data provided in the body of the request.

If it does not exists, it will be created using the given data.

Returns the updated/created DiscordUser record.

If anything goes wrong, a 422, Unprocessable Content error with more details will be returned.

> Example request:

    curl --request PUT \
        "localhost:9000/api/v1/discord-user-by-snowflake/481398158916845568" \
        --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
        --header "Content-Type: application/json" \
        --header "Accept: application/json" \
        --data "{
        \"snowflake\": \"481398158916845568\",
        \"user_name\": \"bigfootmcfly\",
        \"global_name\": \"BigFoot McFly\",
        \"locale\": \"en_GB\",
        \"timezone\": \"Europe\\/London\"
    }"

    const url = new URL(
        "localhost:9000/api/v1/discord-user-by-snowflake/481398158916845568"
    );

    const headers = {
        "Authorization": "Bearer {YOUR_AUTH_KEY}",
        "Content-Type": "application/json",
        "Accept": "application/json",
    };

    let body = {
        "snowflake": "481398158916845568",
        "user_name": "bigfootmcfly",
        "global_name": "BigFoot McFly",
        "locale": "en_GB",
        "timezone": "Europe\/London"
    };

    fetch(url, {
        method: "PUT",
        headers,
        body: JSON.stringify(body),
    }).then(response => response.json());

    $client = new \GuzzleHttp\Client();
    $url = 'localhost:9000/api/v1/discord-user-by-snowflake/481398158916845568';
    $response = $client->put(
        $url,
        [
            'headers' => [
                'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
                'Content-Type' => 'application/json',
                'Accept' => 'application/json',
            ],
            'json' => [
                'snowflake' => '481398158916845568',
                'user_name' => 'bigfootmcfly',
                'global_name' => 'BigFoot McFly',
                'locale' => 'en_GB',
                'timezone' => 'Europe/London',
            ],
        ]
    );
    $body = $response->getBody();
    print_r(json_decode((string) $body));

    import requests
    import json

    url = 'localhost:9000/api/v1/discord-user-by-snowflake/481398158916845568'
    payload = {
        "snowflake": "481398158916845568",
        "user_name": "bigfootmcfly",
        "global_name": "BigFoot McFly",
        "locale": "en_GB",
        "timezone": "Europe\/London"
    }
    headers = {
      'Authorization': 'Bearer {YOUR_AUTH_KEY}',
      'Content-Type': 'application/json',
      'Accept': 'application/json'
    }

    response = requests.request('PUT', url, headers=headers, json=payload)
    response.json()

> Example response (200, success):

    {
        "data": {
            "id": 42,
            "snowflake": "481398158916845568",
            "user_name": "bigfootmcfly",
            "global_name": "BigFoot McFly",
            "locale": "en_GB",
            "timezone": "Europe/London"
        },
        "changes": {
            "locale": {
                "old": "hu_HU",
                "new": "en_GB"
            },
            "timezone": {
                "old": "Europe/Budapest",
                "new": "Europe/London"
            }
        }
    }

> Example response (422, Unprocessable Content):

    {
        "errors": {
            "snowflake": [
                "The snowflake field is required."
            ]
        }
    }

> Received response:

> Request failed with error:

    Tip: Check that you're properly connected to the network.
    If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
    You can check the Dev Tools console for debugging information.

### Request

PUT `api/v1/discord-user-by-snowflake/{snowflake}`

#### Headers

`Authorization`

Example: `Bearer {YOUR_AUTH_KEY}`

`Content-Type`

Example: `application/json`

`Accept`

Example: `application/json`

#### URL Parameters

`snowflake` string

A valid snowflake. Example: `481398158916845568`

#### Body Parameters

`snowflake` string

A valid snowflake. Example: `481398158916845568`

`user_name` string optional

The user_name registered in Discord. Example: `bigfootmcfly`

`global_name` string optional

The global_name registered in Discord. Example: `BigFoot McFly`

`avatar` string optional

The avatar url registered in Discord.

`locale` string optional

A valid locale. Example: `en_GB`

`timezone` string optional

A valid time zone. Example: `Europe/London`

# Discord User Managment

APIs to manage DiscordUser records.

These endpoints can be used to Query/Update/Delete DiscordUser records.

## List DiscorUsers.

requires authentication

Paginated list of DiscordUser records.

> Example request:

    curl --request GET \
        --get "localhost:9000/api/v1/discord-users?page_size=25&page=1" \
        --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
        --header "Content-Type: application/json" \
        --header "Accept: application/json"

    const url = new URL(
        "localhost:9000/api/v1/discord-users"
    );

    const params = {
        "page_size": "25",
        "page": "1",
    };
    Object.keys(params)
        .forEach(key => url.searchParams.append(key, params[key]));

    const headers = {
        "Authorization": "Bearer {YOUR_AUTH_KEY}",
        "Content-Type": "application/json",
        "Accept": "application/json",
    };

    fetch(url, {
        method: "GET",
        headers,
    }).then(response => response.json());

    $client = new \GuzzleHttp\Client();
    $url = 'localhost:9000/api/v1/discord-users';
    $response = $client->get(
        $url,
        [
            'headers' => [
                'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
                'Content-Type' => 'application/json',
                'Accept' => 'application/json',
            ],
            'query' => [
                'page_size' => '25',
                'page' => '1',
            ],
        ]
    );
    $body = $response->getBody();
    print_r(json_decode((string) $body));

    import requests
    import json

    url = 'localhost:9000/api/v1/discord-users'
    params = {
      'page_size': '25',
      'page': '1',
    }
    headers = {
      'Authorization': 'Bearer {YOUR_AUTH_KEY}',
      'Content-Type': 'application/json',
      'Accept': 'application/json'
    }

    response = requests.request('GET', url, headers=headers, params=params)
    response.json()

> Example response (200, success):

    {
        "data": [
            {
                "id": 1,
                "snowflake": "481398158916845568",
                "user_name": "bigfootmcfly",
                "global_name": "BigFoot McFly",
                "locale": "hu_HU",
                "timezone": "Europe/Budapest"
            },
            {
                "id": 6,
                "snowflake": "860046989130727450",
                "user_name": "Teszt Elek",
                "global_name": "holnap_is_teszt_elek",
                "locale": "hu",
                "timezone": "Europe/Budapest"
            },
            {
                "id": 12,
                "snowflake": "112233445566778899",
                "user_name": "Igaz Álmos",
                "global_name": "almos#1244",
                "locale": null,
                "timezone": null
            }
        ],
        "meta": {
            "current_page": 1,
            "from": 1,
            "last_page": 1,
            "per_page": 10,
            "to": 3,
            "total": 3
        }
    }

> Received response:

> Request failed with error:

    Tip: Check that you're properly connected to the network.
    If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
    You can check the Dev Tools console for debugging information.

### Request

GET `api/v1/discord-users`

#### Headers

`Authorization`

Example: `Bearer {YOUR_AUTH_KEY}`

`Content-Type`

Example: `application/json`

`Accept`

Example: `application/json`

#### Query Parameters

`page_size` integer optional

Items per page. Defaults to 100. Example: `25`

`page` integer optional

Page to query. Defaults to 1. Example: `1`

## Create a new DiscordUser record.

requires authentication

Creates a new DiscordUser record with the provided parameters.

> Example request:

    curl --request POST \
        "localhost:9000/api/v1/discord-users" \
        --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
        --header "Content-Type: application/json" \
        --header "Accept: application/json" \
        --data "{
        \"snowflake\": \"481398158916845568\",
        \"user_name\": \"bigfootmcfly\",
        \"global_name\": \"BigFoot McFly\",
        \"locale\": \"hu_HU\",
        \"timezone\": \"Europe\\/Budapest\"
    }"

    const url = new URL(
        "localhost:9000/api/v1/discord-users"
    );

    const headers = {
        "Authorization": "Bearer {YOUR_AUTH_KEY}",
        "Content-Type": "application/json",
        "Accept": "application/json",
    };

    let body = {
        "snowflake": "481398158916845568",
        "user_name": "bigfootmcfly",
        "global_name": "BigFoot McFly",
        "locale": "hu_HU",
        "timezone": "Europe\/Budapest"
    };

    fetch(url, {
        method: "POST",
        headers,
        body: JSON.stringify(body),
    }).then(response => response.json());

    $client = new \GuzzleHttp\Client();
    $url = 'localhost:9000/api/v1/discord-users';
    $response = $client->post(
        $url,
        [
            'headers' => [
                'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
                'Content-Type' => 'application/json',
                'Accept' => 'application/json',
            ],
            'json' => [
                'snowflake' => '481398158916845568',
                'user_name' => 'bigfootmcfly',
                'global_name' => 'BigFoot McFly',
                'locale' => 'hu_HU',
                'timezone' => 'Europe/Budapest',
            ],
        ]
    );
    $body = $response->getBody();
    print_r(json_decode((string) $body));

    import requests
    import json

    url = 'localhost:9000/api/v1/discord-users'
    payload = {
        "snowflake": "481398158916845568",
        "user_name": "bigfootmcfly",
        "global_name": "BigFoot McFly",
        "locale": "hu_HU",
        "timezone": "Europe\/Budapest"
    }
    headers = {
      'Authorization': 'Bearer {YOUR_AUTH_KEY}',
      'Content-Type': 'application/json',
      'Accept': 'application/json'
    }

    response = requests.request('POST', url, headers=headers, json=payload)
    response.json()

> Example response (200, success):

    {
        "data": {
            "id": 42,
            "snowflake": "481398158916845568",
            "user_name": "bigfootmcfly",
            "global_name": "BigFoot McFly",
            "locale": "hu_HU",
            "timezone": "Europe/Budapest"
        }
    }

> Example response (422, Unprocessable Content):

    {
        "errors": {
            "snowflake": [
                "The snowflake has already been taken."
            ]
        }
    }

> Received response:

> Request failed with error:

    Tip: Check that you're properly connected to the network.
    If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
    You can check the Dev Tools console for debugging information.

### Request

POST `api/v1/discord-users`

#### Headers

`Authorization`

Example: `Bearer {YOUR_AUTH_KEY}`

`Content-Type`

Example: `application/json`

`Accept`

Example: `application/json`

#### Body Parameters

`snowflake` string

A valid snowflake. Example: `481398158916845568`

`user_name` string optional

The user_name registered in Discord. Example: `bigfootmcfly`

`global_name` string optional

The global_name registered in Discord. Example: `BigFoot McFly`

`avatar` string optional

The avatar url registered in Discord.

`locale` string optional

A valid locale. Example: `hu_HU`

`timezone` string optional

A valid time zone. Example: `Europe/Budapest`

## Get the specified DiscordUser record.

requires authentication

Returns the specified DiscordUser record.

> Example request:

    curl --request GET \
        --get "localhost:9000/api/v1/discord-users/42" \
        --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
        --header "Content-Type: application/json" \
        --header "Accept: application/json"

    const url = new URL(
        "localhost:9000/api/v1/discord-users/42"
    );

    const headers = {
        "Authorization": "Bearer {YOUR_AUTH_KEY}",
        "Content-Type": "application/json",
        "Accept": "application/json",
    };

    fetch(url, {
        method: "GET",
        headers,
    }).then(response => response.json());

    $client = new \GuzzleHttp\Client();
    $url = 'localhost:9000/api/v1/discord-users/42';
    $response = $client->get(
        $url,
        [
            'headers' => [
                'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
                'Content-Type' => 'application/json',
                'Accept' => 'application/json',
            ],
        ]
    );
    $body = $response->getBody();
    print_r(json_decode((string) $body));

    import requests
    import json

    url = 'localhost:9000/api/v1/discord-users/42'
    headers = {
      'Authorization': 'Bearer {YOUR_AUTH_KEY}',
      'Content-Type': 'application/json',
      'Accept': 'application/json'
    }

    response = requests.request('GET', url, headers=headers)
    response.json()

> Example response (200, success):

    {
        "data": {
            "id": 42,
            "snowflake": "481398158916845568",
            "user_name": "bigfootmcfly",
            "global_name": "BigFoot McFly",
            "locale": "hu_HU",
            "timezone": "Europe/Budapest"
        }
    }

> Received response:

> Request failed with error:

    Tip: Check that you're properly connected to the network.
    If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
    You can check the Dev Tools console for debugging information.

### Request

GET `api/v1/discord-users/{id}`

#### Headers

`Authorization`

Example: `Bearer {YOUR_AUTH_KEY}`

`Content-Type`

Example: `application/json`

`Accept`

Example: `application/json`

#### URL Parameters

`id` integer

DiscordUser ID. Example: `42`

## Update the specified DiscordUser record.

requires authentication

Updates the specified DiscordUser with the supplied values.

> Example request:

    curl --request PUT \
        "localhost:9000/api/v1/discord-users/42" \
        --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
        --header "Content-Type: application/json" \
        --header "Accept: application/json" \
        --data "{
        \"snowflake\": \"481398158916845568\",
        \"timezone\": \"Europe\\/London\"
    }"

    const url = new URL(
        "localhost:9000/api/v1/discord-users/42"
    );

    const headers = {
        "Authorization": "Bearer {YOUR_AUTH_KEY}",
        "Content-Type": "application/json",
        "Accept": "application/json",
    };

    let body = {
        "snowflake": "481398158916845568",
        "timezone": "Europe\/London"
    };

    fetch(url, {
        method: "PUT",
        headers,
        body: JSON.stringify(body),
    }).then(response => response.json());

    $client = new \GuzzleHttp\Client();
    $url = 'localhost:9000/api/v1/discord-users/42';
    $response = $client->put(
        $url,
        [
            'headers' => [
                'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
                'Content-Type' => 'application/json',
                'Accept' => 'application/json',
            ],
            'json' => [
                'snowflake' => '481398158916845568',
                'timezone' => 'Europe/London',
            ],
        ]
    );
    $body = $response->getBody();
    print_r(json_decode((string) $body));

    import requests
    import json

    url = 'localhost:9000/api/v1/discord-users/42'
    payload = {
        "snowflake": "481398158916845568",
        "timezone": "Europe\/London"
    }
    headers = {
      'Authorization': 'Bearer {YOUR_AUTH_KEY}',
      'Content-Type': 'application/json',
      'Accept': 'application/json'
    }

    response = requests.request('PUT', url, headers=headers, json=payload)
    response.json()

> Example response (200):

    {
        "data": {
            "id": 42,
            "snowflake": "481398158916845568",
            "user_name": "bigfootmcfly",
            "global_name": "BigFoot McFly",
            "locale": "hu_HU",
            "timezone": "Europe/London"
        }
    }

> Example response (422, Unprocessable Content):

    {
        "errors": {
            "snowflake": [
                "Invalid snowflake"
            ]
        }
    }

> Received response:

> Request failed with error:

    Tip: Check that you're properly connected to the network.
    If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
    You can check the Dev Tools console for debugging information.

### Request

PUT `api/v1/discord-users/{id}`

PATCH `api/v1/discord-users/{id}`

#### Headers

`Authorization`

Example: `Bearer {YOUR_AUTH_KEY}`

`Content-Type`

Example: `application/json`

`Accept`

Example: `application/json`

#### URL Parameters

`id` integer

DiscordUser ID. Example: `42`

#### Body Parameters

`snowflake` string

The snowflake of the DiscordUser to update. Example: `481398158916845568`

`user_name` string optional

The user_name registered in Discord.

`global_name` string optional

The global_name registered in Discord.

`avatar` string optional

The avatar url registered in Discord.

`locale` string optional

A valid locale. Locale list (json)

`timezone` string optional

A valid time zone. Example: `Europe/London`

## Remove the specified DiscordUser record.

requires authentication

Removes the specified DiscordUser record with all the Remainder records belonging to it.

> Example request:

    curl --request DELETE \
        "localhost:9000/api/v1/discord-users/42" \
        --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
        --header "Content-Type: application/json" \
        --header "Accept: application/json" \
        --data "{
        \"snowflake\": \"481398158916845568\"
    }"

    const url = new URL(
        "localhost:9000/api/v1/discord-users/42"
    );

    const headers = {
        "Authorization": "Bearer {YOUR_AUTH_KEY}",
        "Content-Type": "application/json",
        "Accept": "application/json",
    };

    let body = {
        "snowflake": "481398158916845568"
    };

    fetch(url, {
        method: "DELETE",
        headers,
        body: JSON.stringify(body),
    }).then(response => response.json());

    $client = new \GuzzleHttp\Client();
    $url = 'localhost:9000/api/v1/discord-users/42';
    $response = $client->delete(
        $url,
        [
            'headers' => [
                'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
                'Content-Type' => 'application/json',
                'Accept' => 'application/json',
            ],
            'json' => [
                'snowflake' => '481398158916845568',
            ],
        ]
    );
    $body = $response->getBody();
    print_r(json_decode((string) $body));

    import requests
    import json

    url = 'localhost:9000/api/v1/discord-users/42'
    payload = {
        "snowflake": "481398158916845568"
    }
    headers = {
      'Authorization': 'Bearer {YOUR_AUTH_KEY}',
      'Content-Type': 'application/json',
      'Accept': 'application/json'
    }

    response = requests.request('DELETE', url, headers=headers, json=payload)
    response.json()

> Example response (204):

    Empty response

> Received response:

> Request failed with error:

    Tip: Check that you're properly connected to the network.
    If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
    You can check the Dev Tools console for debugging information.

### Request

DELETE `api/v1/discord-users/{id}`

#### Headers

`Authorization`

Example: `Bearer {YOUR_AUTH_KEY}`

`Content-Type`

Example: `application/json`

`Accept`

Example: `application/json`

#### URL Parameters

`id` integer

DiscordUser ID. Example: `42`

#### Body Parameters

`snowflake` string

The snowflake of the DiscordUser to delete. Example: `481398158916845568`

# Remainder Managment

APIs to manage Remainders records.

These endpoints can be used to Query/Update/Delete Remainder records.

## List of Remainder records.

requires authentication

Paginated list of Remainder records belonging to the specified DiscordUser.

> Example request:

    curl --request GET \
        --get "localhost:9000/api/v1/discord-users/42/remainders?page_size=25&page=1" \
        --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
        --header "Content-Type: application/json" \
        --header "Accept: application/json"

    const url = new URL(
        "localhost:9000/api/v1/discord-users/42/remainders"
    );

    const params = {
        "page_size": "25",
        "page": "1",
    };
    Object.keys(params)
        .forEach(key => url.searchParams.append(key, params[key]));

    const headers = {
        "Authorization": "Bearer {YOUR_AUTH_KEY}",
        "Content-Type": "application/json",
        "Accept": "application/json",
    };

    fetch(url, {
        method: "GET",
        headers,
    }).then(response => response.json());

    $client = new \GuzzleHttp\Client();
    $url = 'localhost:9000/api/v1/discord-users/42/remainders';
    $response = $client->get(
        $url,
        [
            'headers' => [
                'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
                'Content-Type' => 'application/json',
                'Accept' => 'application/json',
            ],
            'query' => [
                'page_size' => '25',
                'page' => '1',
            ],
        ]
    );
    $body = $response->getBody();
    print_r(json_decode((string) $body));

    import requests
    import json

    url = 'localhost:9000/api/v1/discord-users/42/remainders'
    params = {
      'page_size': '25',
      'page': '1',
    }
    headers = {
      'Authorization': 'Bearer {YOUR_AUTH_KEY}',
      'Content-Type': 'application/json',
      'Accept': 'application/json'
    }

    response = requests.request('GET', url, headers=headers, params=params)
    response.json()

> Example response (200, success):

    {
        "data": [
            {
                "id": 38,
                "discord_user_id": 42,
                "channel_id": null,
                "due_at": 1736259300,
                "message": "Update todo list",
                "status": "new",
                "error": null
            },
            {
                "id": 121,
                "discord_user_id": 42,
                "channel_id": null,
                "due_at": 1736259480,
                "message": "Water plants",
                "status": "new",
                "error": null
            }
        ],
        "meta": {
            "current_page": 1,
            "from": 1,
            "last_page": 1,
            "per_page": 25,
            "to": 2,
            "total": 2
        }
    }

> Received response:

> Request failed with error:

    Tip: Check that you're properly connected to the network.
    If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
    You can check the Dev Tools console for debugging information.

### Request

GET `api/v1/discord-users/{discord_user_id}/remainders`

#### Headers

`Authorization`

Example: `Bearer {YOUR_AUTH_KEY}`

`Content-Type`

Example: `application/json`

`Accept`

Example: `application/json`

#### URL Parameters

`discord_user_id` integer

DiscordUser ID. Example: `42`

#### Query Parameters

`page_size` integer optional

Items per page. Defaults to 100. Example: `25`

`page` integer optional

Page to query. Defaults to 1. Example: `1`

## Create a new Remainder record.

requires authentication

Creates a new Remainder record with the provided parameters.

> Example request:

    curl --request POST \
        "localhost:9000/api/v1/discord-users/42/remainders" \
        --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
        --header "Content-Type: application/json" \
        --header "Accept: application/json" \
        --data "{
        \"due_at\": \"1732550400\",
        \"message\": \"Check maintance results!\"
    }"

    const url = new URL(
        "localhost:9000/api/v1/discord-users/42/remainders"
    );

    const headers = {
        "Authorization": "Bearer {YOUR_AUTH_KEY}",
        "Content-Type": "application/json",
        "Accept": "application/json",
    };

    let body = {
        "due_at": "1732550400",
        "message": "Check maintance results!"
    };

    fetch(url, {
        method: "POST",
        headers,
        body: JSON.stringify(body),
    }).then(response => response.json());

    $client = new \GuzzleHttp\Client();
    $url = 'localhost:9000/api/v1/discord-users/42/remainders';
    $response = $client->post(
        $url,
        [
            'headers' => [
                'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
                'Content-Type' => 'application/json',
                'Accept' => 'application/json',
            ],
            'json' => [
                'due_at' => '1732550400',
                'message' => 'Check maintance results!',
            ],
        ]
    );
    $body = $response->getBody();
    print_r(json_decode((string) $body));

    import requests
    import json

    url = 'localhost:9000/api/v1/discord-users/42/remainders'
    payload = {
        "due_at": "1732550400",
        "message": "Check maintance results!"
    }
    headers = {
      'Authorization': 'Bearer {YOUR_AUTH_KEY}',
      'Content-Type': 'application/json',
      'Accept': 'application/json'
    }

    response = requests.request('POST', url, headers=headers, json=payload)
    response.json()

> Example response (200):

    {
        "data": {
            "id": 18568,
            "discord_user_id": 42,
            "channel_id": null,
            "due_at": 1732550400,
            "message": "Check maintance results!",
            "status": "new",
            "error": null
        }
    }

> Received response:

> Request failed with error:

    Tip: Check that you're properly connected to the network.
    If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
    You can check the Dev Tools console for debugging information.

### Request

POST `api/v1/discord-users/{discord_user_id}/remainders`

#### Headers

`Authorization`

Example: `Bearer {YOUR_AUTH_KEY}`

`Content-Type`

Example: `application/json`

`Accept`

Example: `application/json`

#### URL Parameters

`discord_user_id` integer

DiscordUser ID. Example: `42`

#### Body Parameters

`due_at` string

The "Due at" time (timestamp) of the remainder Example: `1732550400`

`message` string

The message to send to the discord user. Example: `Check maintance results!`

`channel_id` string optional

The snowflake of the channel to send the remainder to.

## Update the specified Remainder record.

requires authentication

Updates the specified Remainder record with the provided parameters.

> Example request:

    curl --request PUT \
        "localhost:9000/api/v1/discord-users/42/remainders/18568" \
        --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
        --header "Content-Type: application/json" \
        --header "Accept: application/json" \
        --data "{
        \"status\": \"failed\",
        \"error\": \"Unknow user\"
    }"

    const url = new URL(
        "localhost:9000/api/v1/discord-users/42/remainders/18568"
    );

    const headers = {
        "Authorization": "Bearer {YOUR_AUTH_KEY}",
        "Content-Type": "application/json",
        "Accept": "application/json",
    };

    let body = {
        "status": "failed",
        "error": "Unknow user"
    };

    fetch(url, {
        method: "PUT",
        headers,
        body: JSON.stringify(body),
    }).then(response => response.json());

    $client = new \GuzzleHttp\Client();
    $url = 'localhost:9000/api/v1/discord-users/42/remainders/18568';
    $response = $client->put(
        $url,
        [
            'headers' => [
                'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
                'Content-Type' => 'application/json',
                'Accept' => 'application/json',
            ],
            'json' => [
                'status' => 'failed',
                'error' => 'Unknow user',
            ],
        ]
    );
    $body = $response->getBody();
    print_r(json_decode((string) $body));

    import requests
    import json

    url = 'localhost:9000/api/v1/discord-users/42/remainders/18568'
    payload = {
        "status": "failed",
        "error": "Unknow user"
    }
    headers = {
      'Authorization': 'Bearer {YOUR_AUTH_KEY}',
      'Content-Type': 'application/json',
      'Accept': 'application/json'
    }

    response = requests.request('PUT', url, headers=headers, json=payload)
    response.json()

> Example response (200):

    {
        "data": {
            "id": 18568,
            "discord_user_id": 42,
            "channel_id": null,
            "due_at": 1732550400,
            "message": "Check maintance results!",
            "status": "failed",
            "error": "Unknow user"
        },
        "changes": {
            "status": {
                "old": "new",
                "new": "failed"
            },
            "error": {
                "old": null,
                "new": "Unknow user"
            }
        }
    }

> Received response:

> Request failed with error:

    Tip: Check that you're properly connected to the network.
    If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
    You can check the Dev Tools console for debugging information.

### Request

PUT `api/v1/discord-users/{discord_user_id}/remainders/{id}`

#### Headers

`Authorization`

Example: `Bearer {YOUR_AUTH_KEY}`

`Content-Type`

Example: `application/json`

`Accept`

Example: `application/json`

#### URL Parameters

`discord_user_id` integer

DiscordUser ID. Example: `42`

`id` integer

Remainder ID. Example: `18568`

#### Body Parameters

`due_at` string optional

The "Due at" time (timestamp) of the remainder.

`message` string optional

The message to send to the discord user.

`channel_id` string optional

The snowflake of the channel to send the remainder to.

`status` string optional

Status of the Remainder.

For possible values see: RemainderStatus Example: `failed`

`error` string optional

Error description in case of failure. Example: `Unknow user`

## Remove the specified Remainder record.

requires authentication

Removes the specified Remainder record with the provided parameters.

> Example request:

    curl --request DELETE \
        "localhost:9000/api/v1/discord-users/42/remainders/18568" \
        --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
        --header "Content-Type: application/json" \
        --header "Accept: application/json" \
        --data "{
        \"snowflake\": \"481398158916845568\"
    }"

    const url = new URL(
        "localhost:9000/api/v1/discord-users/42/remainders/18568"
    );

    const headers = {
        "Authorization": "Bearer {YOUR_AUTH_KEY}",
        "Content-Type": "application/json",
        "Accept": "application/json",
    };

    let body = {
        "snowflake": "481398158916845568"
    };

    fetch(url, {
        method: "DELETE",
        headers,
        body: JSON.stringify(body),
    }).then(response => response.json());

    $client = new \GuzzleHttp\Client();
    $url = 'localhost:9000/api/v1/discord-users/42/remainders/18568';
    $response = $client->delete(
        $url,
        [
            'headers' => [
                'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
                'Content-Type' => 'application/json',
                'Accept' => 'application/json',
            ],
            'json' => [
                'snowflake' => '481398158916845568',
            ],
        ]
    );
    $body = $response->getBody();
    print_r(json_decode((string) $body));

    import requests
    import json

    url = 'localhost:9000/api/v1/discord-users/42/remainders/18568'
    payload = {
        "snowflake": "481398158916845568"
    }
    headers = {
      'Authorization': 'Bearer {YOUR_AUTH_KEY}',
      'Content-Type': 'application/json',
      'Accept': 'application/json'
    }

    response = requests.request('DELETE', url, headers=headers, json=payload)
    response.json()

> Example response (204):

    Empty response

> Received response:

> Request failed with error:

    Tip: Check that you're properly connected to the network.
    If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
    You can check the Dev Tools console for debugging information.

### Request

DELETE `api/v1/discord-users/{discord_user_id}/remainders/{id}`

#### Headers

`Authorization`

Example: `Bearer {YOUR_AUTH_KEY}`

`Content-Type`

Example: `application/json`

`Accept`

Example: `application/json`

#### URL Parameters

`discord_user_id` integer

DiscordUser ID. Example: `42`

`id` integer

Remainder ID. Example: `18568`

#### Body Parameters

`snowflake` string

The snowflake of the DiscordUser of the Remainder to delete. Example: `481398158916845568`

# Remainder by DueAt Managment

API to get Remainder records.

This endpoint can be used to Query the actual Remainder records.

## Returns all the "actual" reaminders for the given second.

requires authentication

> Example request:

    curl --request GET \
        --get "localhost:9000/api/v1/remainder-by-due-at/1735685999?page_size=25&page=1" \
        --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
        --header "Content-Type: application/json" \
        --header "Accept: application/json"

    const url = new URL(
        "localhost:9000/api/v1/remainder-by-due-at/1735685999"
    );

    const params = {
        "page_size": "25",
        "page": "1",
    };
    Object.keys(params)
        .forEach(key => url.searchParams.append(key, params[key]));

    const headers = {
        "Authorization": "Bearer {YOUR_AUTH_KEY}",
        "Content-Type": "application/json",
        "Accept": "application/json",
    };

    fetch(url, {
        method: "GET",
        headers,
    }).then(response => response.json());

    $client = new \GuzzleHttp\Client();
    $url = 'localhost:9000/api/v1/remainder-by-due-at/1735685999';
    $response = $client->get(
        $url,
        [
            'headers' => [
                'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
                'Content-Type' => 'application/json',
                'Accept' => 'application/json',
            ],
            'query' => [
                'page_size' => '25',
                'page' => '1',
            ],
        ]
    );
    $body = $response->getBody();
    print_r(json_decode((string) $body));

    import requests
    import json

    url = 'localhost:9000/api/v1/remainder-by-due-at/1735685999'
    params = {
      'page_size': '25',
      'page': '1',
    }
    headers = {
      'Authorization': 'Bearer {YOUR_AUTH_KEY}',
      'Content-Type': 'application/json',
      'Accept': 'application/json'
    }

    response = requests.request('GET', url, headers=headers, params=params)
    response.json()

> Example response (200, success):

    {
        "data": [
            {
                "id": 56,
                "discord_user_id": 42,
                "channel_id": null,
                "due_at": 1735685999,
                "message": "Update conatiner registry!",
                "status": "new",
                "error": null
            },
            {
                "id": 192,
                "discord_user_id": 47,
                "channel_id": null,
                "due_at": 1735685999,
                "message": "Get some milk",
                "status": "new",
                "error": null
            }
        ],
        "meta": {
            "current_page": 1,
            "from": 1,
            "last_page": 1,
            "per_page": 100,
            "to": 2,
            "total": 2
        }
    }

> Received response:

> Request failed with error:

    Tip: Check that you're properly connected to the network.
    If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
    You can check the Dev Tools console for debugging information.

### Request

GET `api/v1/remainder-by-due-at/{due_at}`

#### Headers

`Authorization`

Example: `Bearer {YOUR_AUTH_KEY}`

`Content-Type`

Example: `application/json`

`Accept`

Example: `application/json`

#### URL Parameters

`due_at` integer

The time (timestamp) of the requested remainders. Example: `1735685999`

#### Query Parameters

`page_size` integer optional

Items per page. Defaults to 100. Example: `25`

`page` integer optional

Page to query. Defaults to 1. Example: `1`

# Classes

## DiscordUser

This record stores the general informations of a discord user.

### Fields

- id - The unique ID of the DiscordUser record.
- snowflake - The unique snowflake of the discord user.
- user_name - The name of the discord user.
- global_name - The global name of the discord user.
- locale - The locale of the discord user.
- timezone - The timezone of the discord user.

> Exaple:

    {
        "id": 42,
        "snowflake": "481398158916845568",
        "user_name": "bigfootmcfly",
        "global_name": "BigFoot McFly",
        "locale": "hu_HU",
        "timezone": "Europe/Budapest"
    }

## Remainder

### Fields

- id - The unique ID of the Remainder record.
- discord_user_id - The internal ID of the DiscordUser.
- channel_id - The snowflake of the channel the remainder should be sent to.
- due_at - The "Due at" time (timestamp) of the remainder.
- message - The message to send to the discord user.
- status - The status of the remainder.
- error - The error (if any) that caused the remainder to fail.

> Example:

    {
        "id": 18568,
        "discord_user_id": 42,
        "channel_id": null,
        "due_at": 1732950700,
        "message": "Maintance completed.",
        "status": "new",
        "error": null
    }

# Types

## Timestamp

It measures time by the number of non-leap seconds that have elapsed since 00:00:00 UTC on 1 January 1970, the Unix epoch.

See: Unix time on Wikipedia

See: Timestamp converter

## Snowflake

A unique identifier within the discord namespace.

See: Discord reference #snowflakes

## Locale

A valid local identifier.

Locale list (json)

## Timezone

A valid timezone.

Timezone list

## RemainderStatus

The status of a remainder.

Available values:

- new - New remainder.
- failed - Something went wrong, will not try to resend it.
- pending - The remainder is currently being processed.
- deleted - The remainder was deleted.
- finished - The remainder finished succesfully.
- cancelled - The remainder was cancelled.

# Error responses

## Unauthorized (401)

In case no authentication is provided or the authentication fails, a `401, Unauthorized` response is returned.

> Exa mple response (401, Unauthorized):

    {
        "message": "Unauthenticated."
    }

## Not Found (404)

If the requested record cannot be found, a `404, Not Found` response is returned.

> Example response (404, Not Found):

    {
        "message": "Not Found."
    }

## Unprocessable Content (422)

If the request cannot be fulfilled, a `422, Unprocessable Content` response is returned.

See the returned message for details about the failure.

This is mostly due to `validation errors`.

> Example response (422, Unprocessable Content):

    {
        "errors": {
            "snowflake": [
                "Invalid snowflake"
            ]
        }
    }

## Internal Server Error (500)

An internal server error occured. Please try again later or contact the operator.

> Example response (500, Internal Server Error):

    {
        "message": "Server Error"
    }