/**
* 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 { Welcome } from '../model/Welcome.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;
}
/**
* Create a private world, the user must be authenticated.
* Create a private world, the user must be authenticated. If the world already exists, owner may change isPublic or isTemporary parameters. Returns HTTP 201 CREATED for created world, or HTTP 200 OK if world already exists.
* @param {CreateWorldOptions} createWorldOptions world options
* @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
);
}
/**
* Create a private world, the user must be authenticated.
* Create a private world, the user must be authenticated. If the world already exists, owner may change isPublic or isTemporary parameters. Returns HTTP 201 CREATED for created world, or HTTP 200 OK if world already exists.
* @param {CreateWorldOptions} createWorldOptions world options
* @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;
});
}
/**
* Enter a world
* @param {String} worldName Name of the world to enter
* @param {Object} opts Optional parameters
* @param {String} [token] Optional token required to enter private world
* @param {Boolean} [async] If set, the Welcome answer is sent over the websocket, and this will return null
* @return {Promise< Welcome >} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Welcome} and HTTP response
*/
enterWorldWithHttpInfo(worldName, opts) {
opts = opts || {};
let postBody = null;
// verify the required parameter 'worldName' is set
if (worldName === undefined || worldName === null) {
throw new Error("Missing the required parameter 'worldName' when calling enterWorld");
}
let pathParams = {
};
let queryParams = {
'worldName': worldName,
'token': opts['token'],
'async': opts['async']
};
let headerParams = {
};
let formParams = {
};
let authNames = [];
let contentTypes = [];
let accepts = ['*/*'];
let returnType = Welcome;
return this.apiClient.callApi(
'/vrspace/api/worlds/enter', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null
);
}
/**
* Enter a world
* @param {String} worldName Name of the world to enter
* @param {Object} opts Optional parameters
* @param {String} opts.token Optional token required to enter private world
* @param {Boolean} opts.async If set, the Welcome answer is sent over the websocket, and this will return null
* @return {Promise< Welcome >} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Welcome}
*/
enterWorld(worldName, opts) {
return this.enterWorldWithHttpInfo(worldName, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List worlds available on the server, ones found in the content/worlds directory, that can be created on demand.
* List worlds available on the server, ones found in the content/worlds directory, that can be created on demand. Some temporary worlds may be existing at the moment, these have id, while non-existing ones do not.
* @return {Promise< Array.<World> >} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.<World>} and HTTP response
*/
listAvailableWithHttpInfo() {
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/listAvailable', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null
);
}
/**
* List worlds available on the server, ones found in the content/worlds directory, that can be created on demand.
* List worlds available on the server, ones found in the content/worlds directory, that can be created on demand. Some temporary worlds may be existing at the moment, these have id, while non-existing ones do not.
* @return {Promise< Array.<World> >} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<World>}
*/
listAvailable() {
return this.listAvailableWithHttpInfo()
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List worlds currently existing on the server, i.e. all worlds in the database.
* List worlds currently existing on the server, i.e. all worlds in the database.
* @return {Promise< Array.<World> >} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Array.<World>} and HTTP response
*/
listExistingWithHttpInfo() {
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/listExisting', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null
);
}
/**
* List worlds currently existing on the server, i.e. all worlds in the database.
* List worlds currently existing on the server, i.e. all worlds in the database.
* @return {Promise< Array.<World> >} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Array.<World>}
*/
listExisting() {
return this.listExistingWithHttpInfo()
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List worlds, and number users/clients currently in them.
* List worlds, and number users/clients currently in them. Number of clients includes bots etc, totals include disconnected clients that are still in the world.
* @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
);
}
/**
* List worlds, and number users/clients currently in them.
* List worlds, and number users/clients currently in them. Number of clients includes bots etc, totals include disconnected clients that are still in the world.
* @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;
});
}
}