> For the complete documentation index, see [llms.txt](https://klemn.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://klemn.gitbook.io/docs/api/utilisateur.md).

# Utilisateur

Endpoints liés aux utilisateurs

## Informations d'un utilisateur

## Retourne les informations d'un utilisateur spécifié

<mark style="color:blue;">`GET`</mark> `/user/:username`

#### Path Parameters

| Name                                        | Type   | Description                         |
| ------------------------------------------- | ------ | ----------------------------------- |
| :username<mark style="color:red;">\*</mark> | String | Nom d'utilisateur du compte demandé |

#### Headers

| Name          | Type   | Description       |
| ------------- | ------ | ----------------- |
| authorization | String | Firebase ID Token |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Response" %}

{% endtab %}

{% tab title="JSON Response (Types)" %}

```json
{
  "visitor_follows_profile": Boolean,
  "id_compte": String,
  "date_creation_compte": Date (String),
  "nom": String,
  "prenom": String,
  "nom_utilisateur": String,
  "nom_affichage": String,
  "nombre_abonnes": Int,
  "nombre_abonnements": Int,
  "biographie": String,
  "url_image_profil": String,
  "url_image_banniere": String,
  "badges": Int
}
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

<table><thead><tr><th width="219">Key</th><th width="177">Type</th><th width="76" data-type="checkbox">Null?</th><th width="304">Description</th><th width="327">Valeur d'exemple</th><th data-hidden>Description</th><th data-hidden>Type</th><th data-hidden>Valeur d'exemple</th></tr></thead><tbody><tr><td>visitor_follows_profile</td><td>Boolean</td><td>false</td><td>Indique si l'utilisateur ayant fait la requête suit le compte demandé</td><td></td><td>Indique si l'utilisateur qui fait la requête suit le compte</td><td>Boolean </td><td></td></tr><tr><td>id_compte</td><td>String</td><td>false</td><td>UserID Firebase du compte</td><td></td><td>ID du compte (UserID Firebase)</td><td>String</td><td>s7QR2tEYRGVnDg85wCDrhISiEHN2</td></tr><tr><td>date_creation_compte</td><td>String (DATETIME MySQL)</td><td>false</td><td>Date de création du compte au format DATETIME UTC de MySQL</td><td>1970-01-01T05:00:00.000Z</td><td>Date de création du compte</td><td>String (DATETIME MySQL)</td><td>1970-01-01T05:00:00.000Z</td></tr><tr><td>nom</td><td>String</td><td>false</td><td></td><td></td><td>Nom de l'utilisateur</td><td>String</td><td></td></tr><tr><td>prenom</td><td>String</td><td>false</td><td></td><td></td><td>Prénom de l'utilisateur</td><td>String</td><td></td></tr><tr><td>nom_utilisateur</td><td>String</td><td>false</td><td>Nom d'utilisateur unique et utilisé pour identifier l'utilisateur.</td><td>Klemn</td><td>Nom d'utilisateur du compte. Cette valeur sert à identifier le compte.</td><td>String</td><td>klemn</td></tr><tr><td>nom_affichage</td><td>String</td><td>false</td><td>Nom d'affichage non unique choisi et modifiable par l'utilisateur qui ne permet pas de l'identifier.</td><td>Réseau social Klemn</td><td>Nom d'affichage du compte. Cette valeur est une valeur qui ne sert <strong>pas</strong> à identifier l'utilisateur.</td><td>String</td><td>Réseau Social Klemn</td></tr><tr><td>nombre_abonnes</td><td>Int</td><td>false</td><td>Nombre d'utilisateurs qui suivent le compte</td><td></td><td></td><td>Int</td><td></td></tr><tr><td>nombre_abonnements</td><td>Int</td><td>false</td><td>Nombre d'utilisateurs que le compte suit.</td><td></td><td></td><td></td><td></td></tr><tr><td>biographie</td><td>String</td><td>true</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>url_image_profil</td><td>String</td><td>false</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>url_image_banniere</td><td>String</td><td>false</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>badges</td><td>Int</td><td>true</td><td>Badges de l'utilisateur. Il faut convertir cette valeur grace à l'operateur bitwise <code>&#x26;</code> pour obtenir tous les badges de l'utilisateur. <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_AND">En savoir plus</a>.</td><td></td><td></td><td></td><td></td></tr></tbody></table>

## Nom d'utilisateur à partir du ID du compte (id\_compte)

## Retourne les informations d'un utilisateur spécifié

<mark style="color:blue;">`GET`</mark> `/username/:id_compte`

#### Path Parameters

| Name                                          | Type   | Description                                               |
| --------------------------------------------- | ------ | --------------------------------------------------------- |
| :id\_compte<mark style="color:red;">\*</mark> | String | ID du compte pour lequel le nom d'utilisateur est demandé |

{% tabs %}
{% tab title="200: OK " %}
{% tabs %}
{% tab title="Response" %}

{% endtab %}

{% tab title="JSON Response (Types)" %}

```json
[
  {
    "nom_utilisateur": "Klemn"
  }
]
```

{% endtab %}
{% endtabs %}
{% endtab %}
{% endtabs %}

<table><thead><tr><th width="219">Key</th><th width="177">Type</th><th width="76" data-type="checkbox">Null?</th><th width="304">Description</th><th width="327">Valeur d'exemple</th><th data-hidden>Description</th><th data-hidden>Type</th><th data-hidden>Valeur d'exemple</th></tr></thead><tbody><tr><td>nom_utilisateur</td><td>String</td><td>false</td><td>Nom d'utilisateur du compte spécifié</td><td></td><td>Indique si l'utilisateur qui fait la requête suit le compte</td><td>Boolean </td><td></td></tr></tbody></table>

## Suivre un utilisateur

## Suivre un utilisateur spécifié

<mark style="color:green;">`POST`</mark> `/user/:id_compte/follow`

#### Path Parameters

| Name                                         | Type   | Description           |
| -------------------------------------------- | ------ | --------------------- |
| id\_compte<mark style="color:red;">\*</mark> | String | ID du compte à suivre |

#### Headers

| Name                                            | Type   | Description       |
| ----------------------------------------------- | ------ | ----------------- |
| authorization<mark style="color:red;">\*</mark> | String | Firebase ID Token |

{% tabs %}
{% tab title="200: OK " %}

{% endtab %}

{% tab title="401: Unauthorized L'utilisateur suit déjà le compte demandé" %}

{% endtab %}

{% tab title="401: Unauthorized L'utilisateur tente de se s'auto-suivre" %}

{% endtab %}
{% endtabs %}

## Ne plus suivre un utilisateur

## Ne plus suivre un utilisateur spécifié

<mark style="color:green;">`POST`</mark> `/user/:id_compte/unfollow`

#### Path Parameters

| Name                                         | Type   | Description           |
| -------------------------------------------- | ------ | --------------------- |
| id\_compte<mark style="color:red;">\*</mark> | String | ID du compte à suivre |

#### Headers

| Name                                            | Type   | Description       |
| ----------------------------------------------- | ------ | ----------------- |
| authorization<mark style="color:red;">\*</mark> | String | Firebase ID Token |

{% tabs %}
{% tab title="200: OK " %}

{% endtab %}

{% tab title="401: Unauthorized L'utilisateur ne suit pas le compte" %}

{% endtab %}

{% tab title="401: Unauthorized L'utilisateur tente de se s'auto-suivre" %}

{% endtab %}
{% endtabs %}
