# Users

Users can interact with channels in different ways.

# Discover Channels

This is used to discover new channels and to subscribe to them.

# Resource URL

https://humtog.com/api/channels/discover

# Resource Method

GET

# Params

Name Required Type Description
filter No string Search for channel
order_by Yes string Set order of channels by following values Newest, Oldest, Subscribers and Activity
exclude_subscribeds Yes boolean Exclude subscribed channels, true or false
newbie No null Present only when user register and login for first time and has no value

# Example Response

{
    "data": [
        {
            "id": `9`,
            "name": "chanelName",
            "title": "chanelTitle",
            "rules": "rules",
            "settings": null,
            "tagline": "tagline",
            "description": "desc",
            "nsfw": false,
            "public": true,
            "cover_color": "Blue",
            "avatar": "/imgs/channel-avatar.png",
            "location": {
                ...
            },
            "relatedChannel": [],
            "subscribers_count": 0,
            "comments_count": 0,
            "submissions_count": 0,
            "created_at": "2020-04-29 13:34:57"
        },
        ...
    }
}

# List Bookmarked Channels

# Resource URL

https://humtog.com/api/channels/bookmarked

# Resource Method

GET

# Example Response

{
    "data": [
        {
            "id": 1,
            "name": "chanelName",
            "title": "chanelTitle",
            "rules": "rules",
            "settings": null,
            "tagline": "tagline",
            "description": "desc",
            "nsfw": false,
            "public": false,
            "cover_color": "Blue",
            "avatar": "/imgs/channel-avatar.png",
            "location": {
                ...
            },
            ...
        },
        ...
    ],
    "links": {
        "first": "https://humtog.com/api/channels/bookmarked?page=1",
        "last": null,
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "path": "https://humtog.com/api/channels/bookmarked",
        "per_page": 20,
        "to": 1
    }
}

# Bookmark Channel

This route toggles the "bookmark" action for the channel. Meaning that the first time you call it, it'll bookmark the channel; the second call for the same record will cause removing "bookmark" record.

TIP

The response is different for "bookmark" and "undo bookmark". You can use either the response's message or status code to detect whether the action has caused "bookmark" or "undo bookmark". Since the "bookmark" action causes creating a record in our database, it has the status code of 201. The "undo bookmark" isn't creating anything; thus it has the status code of 200.

# Resource URL

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

# Resource Method

POST

# Example Response

When performed a "bookmark" action:

{
    "message": "Bookmarked successfully."
}

When performed an "undo bookmark" action:

{
    "message": "Undid bookmark successfully."
}

# List Subscrubed Channels

# Resource URL

https://humtog.com/api/channels/subscribed

# Resource Method

GET

# Example Response

{
    "data": [
        {
            "id": 1,
            "name": "chanelName",
            "title": "chanelTitle",
            "rules": "rules",
            "settings": null,
            "tagline": "tagline",
            "description": "desc",
            "nsfw": false,
            "public": false,
            "cover_color": "Blue",
            "avatar": "/imgs/channel-avatar.png",
            "location": {
                ...
            },
            ...
        },
        ...
    ],
    "links": {
        "first": "https://humtog.com/api/channels/bookmarked?page=1",
        "last": null,
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "path": "https://humtog.com/api/channels/bookmarked",
        "per_page": 20,
        "to": 1
    }
}

# Subscribe to Channel

This route toggles the "subscribe" action for the channel in same way bookmark do.

# Resource URL

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

# Resource Method

POST

# Example Response

When performed a "subscribe" action:

{
    "message": "Subscribed to channelName successfully."
}

When performed an "unsubscribed" action:

{
    "message": "Unsubscribed from channelName channel successfully."
}

# Block Channel

It has same functionality as bookmark and subscribed POST routes

# Resource URL

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

# Resource Method

POST

# Example Response

When performed a "block" action:

{
    "message": "Blocked channel successfully."
}

When performed an "unblock" action:

{
    "message": "Unblocked channel successfully."
}