Source: client/openapi/api/GroupControllerApi.js

/**
 * OpenAPI definition
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: v0
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 *
 */


import {ApiClient} from "../ApiClient.js";
import { Client } from '../model/Client.js';
import { GroupMember } from '../model/GroupMember.js';
import { GroupMessage } from '../model/GroupMessage.js';
import { UserGroup } from '../model/UserGroup.js';

/**
* GroupController service.
* @module api/GroupControllerApi
* @version v0
*/
export class GroupControllerApi {

    /**
    * Constructs a new GroupControllerApi. 
    * @alias module:api/GroupControllerApi
    * @class
    * @param {module:ApiClient} [apiClient] Optional API client implementation to use,
    * default to {@link module:ApiClient#instance} if unspecified.
    */
    constructor(apiClient) {
        this.apiClient = apiClient || ApiClient.instance;
    }



    /**
     * Accept invitation to a private group.
     * Accept invitation to a private group.
     * @param {Number} groupId 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    acceptWithHttpInfo(groupId) {
      let postBody = null;
      // verify the required parameter 'groupId' is set
      if (groupId === undefined || groupId === null) {
        throw new Error("Missing the required parameter 'groupId' when calling accept");
      }

      let pathParams = {
        'groupId': groupId
      };
      let queryParams = {
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = [];
      let contentTypes = [];
      let accepts = [];
      let returnType = null;
      return this.apiClient.callApi(
        '/vrspace/api/groups/{groupId}/accept', 'POST',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null
      );
    }

    /**
     * Accept invitation to a private group.
     * Accept invitation to a private group.
     * @param {Number} groupId 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    accept(groupId) {
      return this.acceptWithHttpInfo(groupId)
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


    /**
     * Allow a user (who asked) to join a private group.
     * Allow a user (who asked) to join a private group. Only group owner(s) can do  that.
     * @param {Number} groupId Group to join
     * @param {Number} clientId Client that asked to join
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    allowWithHttpInfo(groupId, clientId) {
      let postBody = null;
      // verify the required parameter 'groupId' is set
      if (groupId === undefined || groupId === null) {
        throw new Error("Missing the required parameter 'groupId' when calling allow");
      }
      // verify the required parameter 'clientId' is set
      if (clientId === undefined || clientId === null) {
        throw new Error("Missing the required parameter 'clientId' when calling allow");
      }

      let pathParams = {
        'groupId': groupId
      };
      let queryParams = {
        'clientId': clientId
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = [];
      let contentTypes = [];
      let accepts = [];
      let returnType = null;
      return this.apiClient.callApi(
        '/vrspace/api/groups/{groupId}/allow', 'POST',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null
      );
    }

    /**
     * Allow a user (who asked) to join a private group.
     * Allow a user (who asked) to join a private group. Only group owner(s) can do  that.
     * @param {Number} groupId Group to join
     * @param {Number} clientId Client that asked to join
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    allow(groupId, clientId) {
      return this.allowWithHttpInfo(groupId, clientId)
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


    /**
     * Ask to join a private group.
     * Ask to join a private group. Group owner needs to allow new members to join.
     * @param {Number} groupId 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    askWithHttpInfo(groupId) {
      let postBody = null;
      // verify the required parameter 'groupId' is set
      if (groupId === undefined || groupId === null) {
        throw new Error("Missing the required parameter 'groupId' when calling ask");
      }

      let pathParams = {
        'groupId': groupId
      };
      let queryParams = {
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = [];
      let contentTypes = [];
      let accepts = [];
      let returnType = null;
      return this.apiClient.callApi(
        '/vrspace/api/groups/{groupId}/ask', 'POST',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null
      );
    }

    /**
     * Ask to join a private group.
     * Ask to join a private group. Group owner needs to allow new members to join.
     * @param {Number} groupId 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    ask(groupId) {
      return this.askWithHttpInfo(groupId)
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


    /**
     * Delete a group.
     * Delete a group. A group can only be deleted by the owner(s).
     * @param {Number} groupId 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    callDeleteWithHttpInfo(groupId) {
      let postBody = null;
      // verify the required parameter 'groupId' is set
      if (groupId === undefined || groupId === null) {
        throw new Error("Missing the required parameter 'groupId' when calling callDelete");
      }

      let pathParams = {
        'groupId': groupId
      };
      let queryParams = {
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = [];
      let contentTypes = [];
      let accepts = [];
      let returnType = null;
      return this.apiClient.callApi(
        '/vrspace/api/groups/{groupId}', 'DELETE',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null
      );
    }

    /**
     * Delete a group.
     * Delete a group. A group can only be deleted by the owner(s).
     * @param {Number} groupId 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    callDelete(groupId) {
      return this.callDeleteWithHttpInfo(groupId)
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


    /**
     * Create a group.
     * Create a group.
     * @param {String} name Group name
     * @param {Object} opts Optional parameters
     * @param {Boolean} [isPublic] 
     * @return {Promise< UserGroup >} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link UserGroup} and HTTP response
     */
    createWithHttpInfo(name, opts) {
      opts = opts || {};
      let postBody = null;
      // verify the required parameter 'name' is set
      if (name === undefined || name === null) {
        throw new Error("Missing the required parameter 'name' when calling create");
      }

      let pathParams = {
      };
      let queryParams = {
        'name': name,
        'isPublic': opts['isPublic']
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = [];
      let contentTypes = [];
      let accepts = ['application/json'];
      let returnType = UserGroup;
      return this.apiClient.callApi(
        '/vrspace/api/groups', 'POST',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null
      );
    }

    /**
     * Create a group.
     * Create a group.
     * @param {String} name Group name
     * @param {Object} opts Optional parameters
     * @param {Boolean} opts.isPublic 
     * @return {Promise< UserGroup >} a {@link https://www.promisejs.org/|Promise}, with data of type {@link UserGroup}
     */
    create(name, opts) {
      return this.createWithHttpInfo(name, opts)
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


    /**
     * Invite a user to a group.
     * Invite a user to a group. Only group owner(s) can invite users to private  groups. Invited users have to accept invitation.
     * @param {Number} groupId Group to invite to
     * @param {Number} clientId Client to invite
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    inviteWithHttpInfo(groupId, clientId) {
      let postBody = null;
      // verify the required parameter 'groupId' is set
      if (groupId === undefined || groupId === null) {
        throw new Error("Missing the required parameter 'groupId' when calling invite");
      }
      // verify the required parameter 'clientId' is set
      if (clientId === undefined || clientId === null) {
        throw new Error("Missing the required parameter 'clientId' when calling invite");
      }

      let pathParams = {
        'groupId': groupId
      };
      let queryParams = {
        'clientId': clientId
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = [];
      let contentTypes = [];
      let accepts = [];
      let returnType = null;
      return this.apiClient.callApi(
        '/vrspace/api/groups/{groupId}/invite', 'POST',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null
      );
    }

    /**
     * Invite a user to a group.
     * Invite a user to a group. Only group owner(s) can invite users to private  groups. Invited users have to accept invitation.
     * @param {Number} groupId Group to invite to
     * @param {Number} clientId Client to invite
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    invite(groupId, clientId) {
      return this.inviteWithHttpInfo(groupId, clientId)
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


    /**
     * Join a public group.
     * Join a public group.
     * @param {Number} groupId 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    joinWithHttpInfo(groupId) {
      let postBody = null;
      // verify the required parameter 'groupId' is set
      if (groupId === undefined || groupId === null) {
        throw new Error("Missing the required parameter 'groupId' when calling join");
      }

      let pathParams = {
        'groupId': groupId
      };
      let queryParams = {
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = [];
      let contentTypes = [];
      let accepts = [];
      let returnType = null;
      return this.apiClient.callApi(
        '/vrspace/api/groups/{groupId}/join', 'POST',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null
      );
    }

    /**
     * Join a public group.
     * Join a public group.
     * @param {Number} groupId 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    join(groupId) {
      return this.joinWithHttpInfo(groupId)
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


    /**
     * Kick a user from a group.
     * Kick a user from a group. Only group owner(s) can do that. Also used to  reject request to join.
     * @param {Number} groupId Where to kick from
     * @param {Number} clientId Whom to kick
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    kickWithHttpInfo(groupId, clientId) {
      let postBody = null;
      // verify the required parameter 'groupId' is set
      if (groupId === undefined || groupId === null) {
        throw new Error("Missing the required parameter 'groupId' when calling kick");
      }
      // verify the required parameter 'clientId' is set
      if (clientId === undefined || clientId === null) {
        throw new Error("Missing the required parameter 'clientId' when calling kick");
      }

      let pathParams = {
        'groupId': groupId
      };
      let queryParams = {
        'clientId': clientId
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = [];
      let contentTypes = [];
      let accepts = [];
      let returnType = null;
      return this.apiClient.callApi(
        '/vrspace/api/groups/{groupId}/kick', 'POST',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null
      );
    }

    /**
     * Kick a user from a group.
     * Kick a user from a group. Only group owner(s) can do that. Also used to  reject request to join.
     * @param {Number} groupId Where to kick from
     * @param {Number} clientId Whom to kick
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    kick(groupId, clientId) {
      return this.kickWithHttpInfo(groupId, clientId)
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


    /**
     * Leave a group.
     * Leave a group. Group owners can not leave. Also used to reject invitation to  join the group.
     * @param {Number} groupId 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    leaveWithHttpInfo(groupId) {
      let postBody = null;
      // verify the required parameter 'groupId' is set
      if (groupId === undefined || groupId === null) {
        throw new Error("Missing the required parameter 'groupId' when calling leave");
      }

      let pathParams = {
        'groupId': groupId
      };
      let queryParams = {
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = [];
      let contentTypes = [];
      let accepts = [];
      let returnType = null;
      return this.apiClient.callApi(
        '/vrspace/api/groups/{groupId}/leave', 'POST',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null
      );
    }

    /**
     * Leave a group.
     * Leave a group. Group owners can not leave. Also used to reject invitation to  join the group.
     * @param {Number} groupId 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    leave(groupId) {
      return this.leaveWithHttpInfo(groupId)
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


    /**
     * List pending invitations to groups for the current user.
     * List pending invitations to groups for the current user.
     * @return {Promise< Array.<GroupMember> >} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.<GroupMember>} and HTTP response
     */
    listInvitesWithHttpInfo() {
      let postBody = null;

      let pathParams = {
      };
      let queryParams = {
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = [];
      let contentTypes = [];
      let accepts = ['*/*'];
      let returnType = [GroupMember];
      return this.apiClient.callApi(
        '/vrspace/api/groups/invitations', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null
      );
    }

    /**
     * List pending invitations to groups for the current user.
     * List pending invitations to groups for the current user.
     * @return {Promise< Array.<GroupMember> >} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<GroupMember>}
     */
    listInvites() {
      return this.listInvitesWithHttpInfo()
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


    /**
     * List all user groups the user is member of.
     * List all user groups the user is member of.
     * @return {Promise< Array.<UserGroup> >} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.<UserGroup>} and HTTP response
     */
    listMyGroupsWithHttpInfo() {
      let postBody = null;

      let pathParams = {
      };
      let queryParams = {
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = [];
      let contentTypes = [];
      let accepts = ['*/*'];
      let returnType = [UserGroup];
      return this.apiClient.callApi(
        '/vrspace/api/groups', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null
      );
    }

    /**
     * List all user groups the user is member of.
     * List all user groups the user is member of.
     * @return {Promise< Array.<UserGroup> >} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<UserGroup>}
     */
    listMyGroups() {
      return this.listMyGroupsWithHttpInfo()
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


    /**
     * List all user groups the user owns.
     * List all user groups the user owns.
     * @return {Promise< Array.<UserGroup> >} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.<UserGroup>} and HTTP response
     */
    listOwnedGroupsWithHttpInfo() {
      let postBody = null;

      let pathParams = {
      };
      let queryParams = {
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = [];
      let contentTypes = [];
      let accepts = ['*/*'];
      let returnType = [UserGroup];
      return this.apiClient.callApi(
        '/vrspace/api/groups/owned', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null
      );
    }

    /**
     * List all user groups the user owns.
     * List all user groups the user owns.
     * @return {Promise< Array.<UserGroup> >} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<UserGroup>}
     */
    listOwnedGroups() {
      return this.listOwnedGroupsWithHttpInfo()
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


    /**
     * @param {Number} groupId 
     * @return {Promise< Array.<Client> >} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.<Client>} and HTTP response
     */
    listOwnersWithHttpInfo(groupId) {
      let postBody = null;
      // verify the required parameter 'groupId' is set
      if (groupId === undefined || groupId === null) {
        throw new Error("Missing the required parameter 'groupId' when calling listOwners");
      }

      let pathParams = {
        'groupId': groupId
      };
      let queryParams = {
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = [];
      let contentTypes = [];
      let accepts = ['*/*'];
      let returnType = [Client];
      return this.apiClient.callApi(
        '/vrspace/api/groups/{groupId}/owners', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null
      );
    }

    /**
     * @param {Number} groupId 
     * @return {Promise< Array.<Client> >} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<Client>}
     */
    listOwners(groupId) {
      return this.listOwnersWithHttpInfo(groupId)
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


    /**
     * List pending requests to join the group.
     * List pending requests to join the group. Only group owners can do that.
     * @param {Number} groupId 
     * @return {Promise< Array.<GroupMember> >} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.<GroupMember>} and HTTP response
     */
    listRequestsWithHttpInfo(groupId) {
      let postBody = null;
      // verify the required parameter 'groupId' is set
      if (groupId === undefined || groupId === null) {
        throw new Error("Missing the required parameter 'groupId' when calling listRequests");
      }

      let pathParams = {
        'groupId': groupId
      };
      let queryParams = {
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = [];
      let contentTypes = [];
      let accepts = ['*/*'];
      let returnType = [GroupMember];
      return this.apiClient.callApi(
        '/vrspace/api/groups/{groupId}/requests', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null
      );
    }

    /**
     * List pending requests to join the group.
     * List pending requests to join the group. Only group owners can do that.
     * @param {Number} groupId 
     * @return {Promise< Array.<GroupMember> >} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<GroupMember>}
     */
    listRequests(groupId) {
      return this.listRequestsWithHttpInfo(groupId)
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


    /**
     * @return {Promise< Array.<UserGroup> >} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.<UserGroup>} and HTTP response
     */
    listUnreadGroupsWithHttpInfo() {
      let postBody = null;

      let pathParams = {
      };
      let queryParams = {
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = [];
      let contentTypes = [];
      let accepts = ['*/*'];
      let returnType = [UserGroup];
      return this.apiClient.callApi(
        '/vrspace/api/groups/unread', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null
      );
    }

    /**
     * @return {Promise< Array.<UserGroup> >} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<UserGroup>}
     */
    listUnreadGroups() {
      return this.listUnreadGroupsWithHttpInfo()
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


    /**
     * @param {Number} groupId 
     * @return {Promise< Array.<GroupMessage> >} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.<GroupMessage>} and HTTP response
     */
    listUnreadMessagesWithHttpInfo(groupId) {
      let postBody = null;
      // verify the required parameter 'groupId' is set
      if (groupId === undefined || groupId === null) {
        throw new Error("Missing the required parameter 'groupId' when calling listUnreadMessages");
      }

      let pathParams = {
        'groupId': groupId
      };
      let queryParams = {
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = [];
      let contentTypes = [];
      let accepts = ['*/*'];
      let returnType = [GroupMessage];
      return this.apiClient.callApi(
        '/vrspace/api/groups/{groupId}/unread', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null
      );
    }

    /**
     * @param {Number} groupId 
     * @return {Promise< Array.<GroupMessage> >} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<GroupMessage>}
     */
    listUnreadMessages(groupId) {
      return this.listUnreadMessagesWithHttpInfo(groupId)
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


    /**
     * Show all members of a group.
     * Show all members of a group.
     * @param {Number} groupId 
     * @return {Promise< Array.<Client> >} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.<Client>} and HTTP response
     */
    showWithHttpInfo(groupId) {
      let postBody = null;
      // verify the required parameter 'groupId' is set
      if (groupId === undefined || groupId === null) {
        throw new Error("Missing the required parameter 'groupId' when calling show");
      }

      let pathParams = {
        'groupId': groupId
      };
      let queryParams = {
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = [];
      let contentTypes = [];
      let accepts = ['*/*'];
      let returnType = [Client];
      return this.apiClient.callApi(
        '/vrspace/api/groups/{groupId}/show', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null
      );
    }

    /**
     * Show all members of a group.
     * Show all members of a group.
     * @param {Number} groupId 
     * @return {Promise< Array.<Client> >} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<Client>}
     */
    show(groupId) {
      return this.showWithHttpInfo(groupId)
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


    /**
     * Update a group.
     * Update a group.
     * @param {UserGroup} userGroup updated group
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    updateWithHttpInfo(userGroup) {
      let postBody = userGroup;
      // verify the required parameter 'userGroup' is set
      if (userGroup === undefined || userGroup === null) {
        throw new Error("Missing the required parameter 'userGroup' when calling update");
      }

      let pathParams = {
      };
      let queryParams = {
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = [];
      let contentTypes = ['application/json'];
      let accepts = [];
      let returnType = null;
      return this.apiClient.callApi(
        '/vrspace/api/groups', 'PUT',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null
      );
    }

    /**
     * Update a group.
     * Update a group.
     * @param {UserGroup} userGroup updated group
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    update(userGroup) {
      return this.updateWithHttpInfo(userGroup)
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


    /**
     * Write something to a group.
     * Write something to a group.
     * @param {Number} groupId The group
     * @param {String} body The message
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    writeWithHttpInfo(groupId, body) {
      let postBody = body;
      // verify the required parameter 'groupId' is set
      if (groupId === undefined || groupId === null) {
        throw new Error("Missing the required parameter 'groupId' when calling write");
      }
      // verify the required parameter 'body' is set
      if (body === undefined || body === null) {
        throw new Error("Missing the required parameter 'body' when calling write");
      }

      let pathParams = {
        'groupId': groupId
      };
      let queryParams = {
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = [];
      let contentTypes = ['application/json'];
      let accepts = [];
      let returnType = null;
      return this.apiClient.callApi(
        '/vrspace/api/groups/{groupId}/write', 'POST',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null
      );
    }

    /**
     * Write something to a group.
     * Write something to a group.
     * @param {Number} groupId The group
     * @param {String} body The message
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    write(groupId, body) {
      return this.writeWithHttpInfo(groupId, body)
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


}