Source: client/openapi/api/WorldObjectsApi.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 { VRObject } from '../model/VRObject.js';

/**
* WorldObjects service.
* @module api/WorldObjectsApi
* @version v0
*/
export class WorldObjectsApi {

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



    /**
     * Add a shared object to the world, equivalent of websocket Add command.
     * Add a shared object to the world, equivalent of websocket Add command. Once  created, the object is immediately published, i.e. pushed to all clients,  including the creator, through websockets. Unlike Add command, that can be  used to create world objects of any class, e.g. Terrain, this can only create  VRObject class instances.
     * @param {VRObject} vRObject VRObject to create, must not have an id
     * @return {Promise< VRObject >} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link VRObject} and HTTP response
     */
    addObjectWithHttpInfo(vRObject) {
      let postBody = vRObject;
      // verify the required parameter 'vRObject' is set
      if (vRObject === undefined || vRObject === null) {
        throw new Error("Missing the required parameter 'vRObject' when calling addObject");
      }

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

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

    /**
     * Add a shared object to the world, equivalent of websocket Add command.
     * Add a shared object to the world, equivalent of websocket Add command. Once  created, the object is immediately published, i.e. pushed to all clients,  including the creator, through websockets. Unlike Add command, that can be  used to create world objects of any class, e.g. Terrain, this can only create  VRObject class instances.
     * @param {VRObject} vRObject VRObject to create, must not have an id
     * @return {Promise< VRObject >} a {@link https://www.promisejs.org/|Promise}, with data of type {@link VRObject}
     */
    addObject(vRObject) {
      return this.addObjectWithHttpInfo(vRObject)
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


    /**
     * Change position, rotation and/or scale of an object.
     * Change position, rotation and/or scale of an object. The object must be in  the scene. All other object properties are ignored.
     * @param {VRObject} vRObject 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    objectCoordinatesWithHttpInfo(vRObject) {
      let postBody = vRObject;
      // verify the required parameter 'vRObject' is set
      if (vRObject === undefined || vRObject === null) {
        throw new Error("Missing the required parameter 'vRObject' when calling objectCoordinates");
      }

      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/world/coordinates', 'PATCH',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null
      );
    }

    /**
     * Change position, rotation and/or scale of an object.
     * Change position, rotation and/or scale of an object. The object must be in  the scene. All other object properties are ignored.
     * @param {VRObject} vRObject 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    objectCoordinates(vRObject) {
      return this.objectCoordinatesWithHttpInfo(vRObject)
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


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

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

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

    /**
     * Remove a shared VRObject.
     * Remove a shared VRObject.
     * @param {Number} id object id
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    removeObject(id) {
      return this.removeObjectWithHttpInfo(id)
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


}