import UserId from './../UserId.js';
export default class GroupsQuery {
/**
* Creates a GroupsQuery.
*
* @constructor GroupsQuery
*/
constructor() {
this.search = null;
this.followerId = null;
this.memberId = null;
}
/**
* Get all groups.
*
* @memberof GroupsQuery
* @return {GroupsQuery} New instance.
*/
static all() {
const instance = new GroupsQuery();
return instance;
}
/**
* Find groups by name or description.
*
* @memberof GroupsQuery
* @param {string} searchTerm - Groups name/description or part of it.
* @return {GroupsQuery} New instance.
*/
static find(searchTerm) {
const instance = new GroupsQuery();
instance.search = searchTerm;
return instance;
}
/**
* Get groups followed by a specific user.
*
* @memberof GroupsQuery
* @instance
* @param {UserId} userId - User ID.
* @return {GroupsQuery} Same query.
*/
followedBy(userId) {
this.followerId = userId;
return this;
}
/**
* Get groups by member.
*
* @memberof GroupsQuery
* @instance
* @param {UserId} userId - User ID.
* @return {GroupsQuery} Same query.
*/
withMember(userId) {
this.memberId = userId;
return this;
}
/**
* Get only trending groups.
*
* @memberof GroupsQuery
* @instance
* @param {boolean} trending - Only trending groups or all.
* @return {GroupsQuery} Same query.
*/
onlyTrending(trending) {
this.trending = trending;
return this;
}
/**
* Get groups matching the specified properties.
*
* @memberof GroupsQuery
* @instance
* @param {Object<string, string>} properties - Properties.
* @return {GroupsQuery} same query.
*/
withProperties(properties) {
this.properties = properties;
return this;
}
/**
* Get groups matching the specified labels.
*
* @memberof GroupsQuery
* @instance
* @param {string[]} labels - Labels list.
* @return {GroupsQuery} same query.
*/
withLabels(labels) {
this.labels = labels;
return this;
}
}