models/communities/TagsQuery.js

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

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

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

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

    /**
     * Filter in which target execute the search.
     *
     * @memberof TagsQuery
     * @instance
     * @param {PostActivityTarget} target - Search target.
     * @return {TagsQuery} Same instance.
     */
    inTarget(target) {
        this.target = target;
        return this;
    }

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

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