models/communities/LabelsQuery.js

import UserId from '../UserId.js';

export default class LabelsQuery {
    /**
     * Creates a LabelsQuery
     *
     * @constructor LabelsQuery
     * @param {string} search - Term to filter labels list
     */
    constructor(search) {
        this.search = search || null;
    }

    /**
     * All labels.
     *
     * @memberof LabelsQuery
     * @return {LabelsQuery} New instance.
     */
     static all() {
        return new LabelsQuery();
    }

    /**
     * Search for a specific label.
     *
     * @memberof LabelsQuery
     * @param {string} searchTerm - Search term.
     * @return {LabelsQuery} New instance.
     */
    static search(searchTerm) {
        return new LabelsQuery(searchTerm);
    }

    /**
     * Get only trending labels.
     *
     * @memberof LabelsQuery
     * @instance
     * @param {boolean} trending - Only trending labels or all.
     * @return {LabelsQuery} Same query.
     */
     onlyTrending(trending) {
        this.trending = trending;
        return this;
    }

    /**
     * Get labels followed by a specific user.
     *
     * @memberof LabelsQuery
     * @instance
     * @param {UserId} id - User ID.
     * @return {LabelsQuery} Same query.
     */
     followedBy(id) {
        this.follower = id;
        return this;
    }
}