models/communities/AddGroupMembersQuery.js

import UserIdList from '../UserIdList.js';
import UpdateGroupMembersQuery from './UpdateGroupMembersQuery.js';

export default class AddGroupMembersQuery {
    /**
     * Creates an AddGroupMembersQuery.
     *
     * @constructor AddGroupMembersQuery
     * @param {UpdateGroupMembersQuery} query - Group Members Query
     */
     constructor(query) {
         this.internalQuery = query;
     }

    /**
     * Create query to add users to a group.
     *
     * @memberof AddGroupMembersQuery
     * @param {string} groupId - Group ID.
     * @param {UserIdList} userIdList - Users to add to group.
     * @return {AddGroupMembersQuery} - New instance.
     */
    static create(groupId, userIdList) {
        const uQuery = UpdateGroupMembersQuery.create(groupId, userIdList);
        return new AddGroupMembersQuery(uQuery);
    }

    /**
     * Define role for users.
     *
     * @memberof AddGroupMembersQuery
     * @instance
     * @param {number} role - Default User's role.
     * @return {UpdateGroupMembersQuery} - Same instance.
     */
    withRole(role) {
        this.internalQuery.role = role;
        return this;
    }

    /**
     * Define status for users.
     *
     * @memberof AddGroupMembersQuery
     * @instance
     * @param {number} memberStatus - Default User's status.
     * @return {UpdateGroupMembersQuery} - Same instance.
     */
    withMemberStatus(memberStatus) {
        this.internalQuery.status = memberStatus;
        return this;
    }
}