# Endpoints

### Get bans

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

```rust
async fn advanced_paginate(&self, page: u8, per_page: u8) -> HttpResult<BanList, BanError>

async fn paginate(&self) -> HttpResult<BanList, BanError>
//paginate() is an advanced_paginate() shortcut with default parameters (1, 12)
```

{% endtab %}

{% tab title="example" %}

```rust
if let Ok(res) = client.bans.paginate().await {
    match res {
        Ok(bans) => {
            //do something with ban list
        },
        Err(why) => {
            //do something with the <BanError> struct
        }
    }
}
```

{% endtab %}
{% endtabs %}

### Report an user

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

```rust
async fn add<S: ToString>(&self,
      user_id: u64,
      reason: S,
      proof: S,
      moderator: Option<u64>,
      user_name: Option<String>,
      user_discriminator: Option<u16>,
      appeal_possible: Option<bool>)
    -> HttpResult<BanAdditionResponse, BanError>
```

{% endtab %}

{% tab title="example" %}

```rust
if let Ok(res) = client.bans.add(23123123, 
"some reason",
"some proof",
None,
None,
Some("discriminator"),
None).await {
    match res {
        Ok(response) => {
            //Do something with the response
        },
        Err(why) => {
            //Domething with <BanError>
        }
    }
}
```

{% endtab %}
{% endtabs %}

### Check if user is banned

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

```rust
async fn check_ban(&self, user_id: u64) -> Result<BanCheckResponse>
```

{% endtab %}

{% tab title="example" %}

```rust
if let Ok(ban) = client.bans.check_ban(12335454).await {
    //do something with the ban
}
```

{% endtab %}
{% endtabs %}

### Get information about a ban

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

```rust
async fn ban_info(&self, user_id: u64) -> HttpResult<BanInfoResponse, BanError
```

{% endtab %}

{% tab title="example" %}

```rust
if let Ok(res) = client.bans.ban_info(1231231234124).await {
    match res {
        Ok(ban) => {
            //do something with ban info
        },
        Err(why) => {
            //do something with the <BanError> struct
        }
    }
}
```

{% endtab %}
{% endtabs %}

### Delete a ban

{% hint style="danger" %}
To use this method you **must** have BAN\_MANAGER permission
{% endhint %}

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

```rust
async fn delete(&self, user_id: u64) -> HttpResult<BanDeletionResponse, BanError>
//or
async fn delete_forcing(&self, user_id: u64) -> HttpResult<BanDeletionResponse, BanError>
//to force the ban deletion
```

{% endtab %}

{% tab title="example" %}

```rust
if let Ok(res) = client.bans.delete(1231231234124).await {
    match res {
        Ok(ban) => {
            //do something with ban info
        },
        Err(why) => {
            //do something with the <BanError> struct
        }
    }
}
```

{% endtab %}
{% endtabs %}
