# Moderator

Moderators have ability to change channel rules, ban users, block domains and add another users and moderators.

# Get All Moderators

# Resource URL

https://humtog.com/api/channels/:channel_id/moderators

# Resource Method

GET

# Example Response

{
    "data": [
        {
            "user": {
                "id": 1,
                "username": "userName",
                "name": "fullName",
                "bio": null,
                "avatar": "/imgs/default-avatar.png",
                "email": "email@example.com",
                "verified_email": true,
                "cover_color": "Dark",
                "created_at": "2020-04-29 09:21:42",
                "info": {
                    "location": "loactionName",
                    "twitter": null,
                    "website": null
                }
            },
            "role": "administrator"
        },
        ...
    ]
}

# Add New Moderator

# Resource URL

https://humtog.com/api/channels/:channel_id/moderators

# Resource Method

POST

# Params

Name Required Type Description
user_id Yes integer User Id
role Yes string Can be administrator or moderator

# Example Response

{
    "data": [
        {
            "user": {
                "id": 1,
                "username": "userName",
                "name": "fullName",
                "bio": null,
                "avatar": "/imgs/default-avatar.png",
                "email": "email@example.com",
                "verified_email": true,
                "cover_color": "Dark",
                "created_at": "2020-04-29 09:21:42",
                "info": {
                    "location": "loactionName",
                    "twitter": null,
                    "website": null
                }
            },
            "role": "administrator"
        }
    ]
}

# Remove Moderator

# Resource URL

https://humtog.com/api/channels/:channel_id/moderators/:user_id

# Resource Method

DELETE

# Example Response

{
    "message": ":userName is no longer a moderator at #:channelName"
}

# Get All Users

# Resource URL

https://humtog.com/api/channels/:channel_id/users

# Resource Method

GET

# Example Response

{
    "data": [
        {
            "id": 1,
            "username": "userName",
            "name": "fullName",
            "bio": null,
            "avatar": "/imgs/default-avatar.png",
            "email": "email@example.com",
            "verified_email": true,
            "cover_color": "Dark",
            "created_at": "2020-04-29 09:21:42",
            "info": {
                "location": "loactionName",
                "twitter": null,
                "website": null
            },
            ...
        }
    ]
}

# Add New User

# Resource URL

https://humtog.com/api/channels/:channel_id/users

# Resource Method

POST

# Params

Name Required Type Description
user_id Yes integer User Id
role Yes string Can be only user

# Example Response

{
    "data": [
        {
            "id": 1,
            "username": "userName",
            "name": "fullName",
            "bio": null,
            "avatar": "/imgs/default-avatar.png",
            "email": "email@example.com",
            "verified_email": true,
            "cover_color": "Dark",
            "created_at": "2020-04-29 09:21:42",
            "info": {
                "location": "loactionName",
                "twitter": null,
                "website": null
            }
        }
    ]
}

# Remove User

# Resource URL

https://humtog.com/api/channels/:channel_id/moderators/:user_id

# Resource Method

DELETE

# Example Response

{
    "message": ":userName is no longer a user at #:channelName"
}

# Get All Banned Users

# Resource URL

https://humtog.com/api/channels/:channel_id/banned-users

# Resource Method

GET

# Example Response

{
    "data": [
        {
            "id": 2,
            "channel_name": "channelName",
            "description": null,
            "user_id": "2",
            "unban_at": "2020-05-24 16:59:14",
            "created_at": "2020-05-22 16:59:14",
            "user": {
                "id": 2,
                "username": "userName",
                "name": "fullName",
                "bio": null,
                "avatar": "/imgs/default-avatar.png",
                "verified_email": true,
                ...
            }
        },
        ...
    ]
}

# Ban User

# Resource URL

https://humtog.com/api/channels/:channel_id/banned-users

# Resource Method

POST

# Params

Name Required Type Description
user_id Yes integer User Id
duration Yes integer In days, int 0-999, required. If set to 0 user will be banned for 17 years
description No string Short description why is user baned. Max 5000 characters

# Example Response

{
    "data": [
        {
            "id": 2,
            "channel_name": "channelName",
            "description": null,
            "user_id": "2",
            "unban_at": "2020-05-24 16:59:14",
            "created_at": "2020-05-22 16:59:14",
            "user": {
                "id": 2,
                "username": "userName",
                "name": "fullName",
                "bio": null,
                "avatar": "/imgs/default-avatar.png",
                "verified_email": true,
                ...
            }
        },
        ...
    ]
}

# Un-ban User

# Resource URL

https://humtog.com/api/channels/:channel_id/banned-users/:user_id

# Resource Method

DELETE

# Example Response

{
    "message": "User unbanned successfully."
}

# List Blocked Domains

# Resource URL

https://humtog.com/api/channels/:channel_id/blocked-domains

# Resource Method

GET

# Example Response

{
    "data": {
        "id": 1,
        "channel_name": "channelName",
        "description": null,
        "domain": "example.com",
        "created_at": "2020-05-22 16:53:20"
    }
}

# Block Domain

# Resource URL

https://humtog.com/api/channels/:channel_id/blocked-domains

# Resource Method

POST

# Params

Name Required Type Description
domain Yes integer Full domain url
description No string Short description why domain is blocked. Max 5000 characters

# Example Response

{
    "data": {
        "id": 1,
        "channel_name": "channelName",
        "description": null,
        "domain": "example.com",
        "created_at": "2020-05-22 16:53:20"
    }
}

# Un-block Domain

# Resource URL

https://humtog.com/api/channels/:channel_id/blocked-domains/:domain_name

# Resource Method

DELETE

# Example Response

{
    "message": "example.com is no longer blacklisted at #channelName. "
}

# List All Rules

# Resource URL

https://humtog.com/api/channels/:channel_id/rules

# Resource Method

GET

# Example Response

{
    "data": [
        {
            "id": 2,
            "body": "This is example of rule",
            "channel_id": 1,
            "created_at": "2020-05-22 16:39:10",
            "updated_at": "2020-05-22 16:39:10"
        }
    ]
}

# Create Rule

# Resource URL

https://humtog.com/api/channels/:channel_id/rules

# Resource Method

POST

# Params

Name Required Type Description
body yes string Up to 5 rules can exist per channel and no longer than 300 characters

# Example Response

{
    "data": [
        {
            "id": 2,
            "body": "This is example of rule",
            "channel_id": 1,
            "created_at": "2020-05-22 16:39:10",
            "updated_at": "2020-05-22 16:39:10"
        }
    ]
}

# Update Rule

# Resource URL

https://humtog.com/api/channels/:channel_id/rules/:rule_id

# Resource Method

PATCH

# Params

Name Required Type Description
body yes string Up to 300 characters long

# Example Response

{
    "data": [
        {
            "id": 2,
            "body": "This is example of rule",
            "channel_id": 1,
            "created_at": "2020-05-22 16:39:10",
            "updated_at": "2020-05-22 16:39:10"
        }
    ]
}

# Remove Rule

# Resource URL

https://humtog.com/api/channels/:channel_id/rules/:rule_id

# Resource Method

DELETE

# Example Response

{
    "message": "Rule was deleted."
}