Source: client/openapi/api/RecorderApi.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 { Recording } from '../model/Recording.js';
import { RecordingData } from '../model/RecordingData.js';

/**
* Recorder service.
* @module api/RecorderApi
* @version v0
*/
export class RecorderApi {

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



    /**
     * Load an existing recording.
     * Load an existing recording.
     * @param {String} recorderName unique name of the recorder to be created after load
     * @param {RecordingData} recordingData recording data serialized to json with save
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    loadWithHttpInfo(recorderName, recordingData) {
      let postBody = recordingData;
      // verify the required parameter 'recorderName' is set
      if (recorderName === undefined || recorderName === null) {
        throw new Error("Missing the required parameter 'recorderName' when calling load");
      }
      // verify the required parameter 'recordingData' is set
      if (recordingData === undefined || recordingData === null) {
        throw new Error("Missing the required parameter 'recordingData' when calling load");
      }

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

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

    /**
     * Load an existing recording.
     * Load an existing recording.
     * @param {String} recorderName unique name of the recorder to be created after load
     * @param {RecordingData} recordingData recording data serialized to json with save
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    load(recorderName, recordingData) {
      return this.loadWithHttpInfo(recorderName, recordingData)
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


    /**
     * Do something with a recording: record, stop, play, delete
     * Do something with a recording: record, stop, play, delete
     * @param {Recording} state Identifies recorder and action to perform.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
     */
    recordingWithHttpInfo(state) {
      let postBody = null;
      // verify the required parameter 'state' is set
      if (state === undefined || state === null) {
        throw new Error("Missing the required parameter 'state' when calling recording");
      }

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

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

    /**
     * Do something with a recording: record, stop, play, delete
     * Do something with a recording: record, stop, play, delete
     * @param {Recording} state Identifies recorder and action to perform.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    recording(state) {
      return this.recordingWithHttpInfo(state)
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


    /**
     * Save current recording.
     * Save current recording.
     * @param {String} recorderName unique name of the recorder to save
     * @return {Promise< RecordingData >} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link RecordingData} and HTTP response
     */
    saveWithHttpInfo(recorderName) {
      let postBody = null;
      // verify the required parameter 'recorderName' is set
      if (recorderName === undefined || recorderName === null) {
        throw new Error("Missing the required parameter 'recorderName' when calling save");
      }

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

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

    /**
     * Save current recording.
     * Save current recording.
     * @param {String} recorderName unique name of the recorder to save
     * @return {Promise< RecordingData >} a {@link https://www.promisejs.org/|Promise}, with data of type {@link RecordingData}
     */
    save(recorderName) {
      return this.saveWithHttpInfo(recorderName)
        .then(function(response_and_data) {
          return response_and_data.data;
        });
    }


}