Source: client/openapi/api/WorldsApi.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 { CreateWorldOptions } from '../model/CreateWorldOptions.js';
import { World } from '../model/World.js';
import { WorldStatus } from '../model/WorldStatus.js';

/**
* Worlds service.
* @module api/WorldsApi
* @version v0
*/
export class WorldsApi {

    /**
    * Constructs a new WorldsApi. 
    * @alias module:api/WorldsApi
    * @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;
    }



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

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

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

    /**
     * @param {CreateWorldOptions} createWorldOptions 
     * @return {Promise< String >} a {@link https://www.promisejs.org/|Promise}, with data of type {@link String}
     */
    createWorld(createWorldOptions) {
      return this.createWorldWithHttpInfo(createWorldOptions)
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


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

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

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

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


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

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

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

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


}