2022-07-04 12:12:45 +02:00

255 lines
10 KiB
JavaScript
Generated

/**
* Flamenco manager
* Render Farm manager API
*
* The version of the OpenAPI document: 1.0.0
*
*
* 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";
import Error from '../model/Error';
import ShamanCheckout from '../model/ShamanCheckout';
import ShamanCheckoutResult from '../model/ShamanCheckoutResult';
import ShamanRequirementsRequest from '../model/ShamanRequirementsRequest';
import ShamanRequirementsResponse from '../model/ShamanRequirementsResponse';
import ShamanSingleFileStatus from '../model/ShamanSingleFileStatus';
/**
* Shaman service.
* @module manager/ShamanApi
* @version 0.0.0
*/
export default class ShamanApi {
/**
* Constructs a new ShamanApi.
* @alias module:manager/ShamanApi
* @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 directory, and symlink the required files into it. The files must all have been uploaded to Shaman before calling this endpoint.
* @param {module:model/ShamanCheckout} shamanCheckout Set of files to check out.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ShamanCheckoutResult} and HTTP response
*/
shamanCheckoutWithHttpInfo(shamanCheckout) {
let postBody = shamanCheckout;
// verify the required parameter 'shamanCheckout' is set
if (shamanCheckout === undefined || shamanCheckout === null) {
throw new Error("Missing the required parameter 'shamanCheckout' when calling shamanCheckout");
}
let pathParams = {
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = [];
let contentTypes = ['application/json'];
let accepts = ['application/json'];
let returnType = ShamanCheckoutResult;
return this.apiClient.callApi(
'/api/v3/shaman/checkout/create', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null
);
}
/**
* Create a directory, and symlink the required files into it. The files must all have been uploaded to Shaman before calling this endpoint.
* @param {module:model/ShamanCheckout} shamanCheckout Set of files to check out.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ShamanCheckoutResult}
*/
shamanCheckout(shamanCheckout) {
return this.shamanCheckoutWithHttpInfo(shamanCheckout)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Checks a Shaman Requirements file, and reports which files are unknown.
* @param {module:model/ShamanRequirementsRequest} shamanRequirementsRequest Set of files to check
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ShamanRequirementsResponse} and HTTP response
*/
shamanCheckoutRequirementsWithHttpInfo(shamanRequirementsRequest) {
let postBody = shamanRequirementsRequest;
// verify the required parameter 'shamanRequirementsRequest' is set
if (shamanRequirementsRequest === undefined || shamanRequirementsRequest === null) {
throw new Error("Missing the required parameter 'shamanRequirementsRequest' when calling shamanCheckoutRequirements");
}
let pathParams = {
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = [];
let contentTypes = ['application/json'];
let accepts = ['application/json'];
let returnType = ShamanRequirementsResponse;
return this.apiClient.callApi(
'/api/v3/shaman/checkout/requirements', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null
);
}
/**
* Checks a Shaman Requirements file, and reports which files are unknown.
* @param {module:model/ShamanRequirementsRequest} shamanRequirementsRequest Set of files to check
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ShamanRequirementsResponse}
*/
shamanCheckoutRequirements(shamanRequirementsRequest) {
return this.shamanCheckoutRequirementsWithHttpInfo(shamanRequirementsRequest)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Store a new file on the Shaman server. Note that the Shaman server can forcibly close the HTTP connection when another client finishes uploading the exact same file, to prevent double uploads. The file's contents should be sent in the request body.
* @param {String} checksum SHA256 checksum of the file.
* @param {Number} filesize Size of the file in bytes.
* @param {File} body Contents of the file
* @param {Object} opts Optional parameters
* @param {Boolean} opts.xShamanCanDeferUpload The client indicates that it can defer uploading this file. The \"208\" response will not only be returned when the file is already fully known to the Shaman server, but also when someone else is currently uploading this file.
* @param {String} opts.xShamanOriginalFilename The original filename. If sent along with the request, it will be included in the server logs, which can aid in debugging.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
shamanFileStoreWithHttpInfo(checksum, filesize, body, opts) {
opts = opts || {};
let postBody = body;
// verify the required parameter 'checksum' is set
if (checksum === undefined || checksum === null) {
throw new Error("Missing the required parameter 'checksum' when calling shamanFileStore");
}
// verify the required parameter 'filesize' is set
if (filesize === undefined || filesize === null) {
throw new Error("Missing the required parameter 'filesize' when calling shamanFileStore");
}
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling shamanFileStore");
}
let pathParams = {
'checksum': checksum,
'filesize': filesize
};
let queryParams = {
};
let headerParams = {
'X-Shaman-Can-Defer-Upload': opts['xShamanCanDeferUpload'],
'X-Shaman-Original-Filename': opts['xShamanOriginalFilename']
};
let formParams = {
};
let authNames = [];
let contentTypes = ['application/octet-stream'];
let accepts = ['application/json'];
let returnType = null;
return this.apiClient.callApi(
'/api/v3/shaman/files/{checksum}/{filesize}', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null
);
}
/**
* Store a new file on the Shaman server. Note that the Shaman server can forcibly close the HTTP connection when another client finishes uploading the exact same file, to prevent double uploads. The file's contents should be sent in the request body.
* @param {String} checksum SHA256 checksum of the file.
* @param {Number} filesize Size of the file in bytes.
* @param {File} body Contents of the file
* @param {Object} opts Optional parameters
* @param {Boolean} opts.xShamanCanDeferUpload The client indicates that it can defer uploading this file. The \"208\" response will not only be returned when the file is already fully known to the Shaman server, but also when someone else is currently uploading this file.
* @param {String} opts.xShamanOriginalFilename The original filename. If sent along with the request, it will be included in the server logs, which can aid in debugging.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
shamanFileStore(checksum, filesize, body, opts) {
return this.shamanFileStoreWithHttpInfo(checksum, filesize, body, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Check the status of a file on the Shaman server.
* @param {String} checksum SHA256 checksum of the file.
* @param {Number} filesize Size of the file in bytes.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ShamanSingleFileStatus} and HTTP response
*/
shamanFileStoreCheckWithHttpInfo(checksum, filesize) {
let postBody = null;
// verify the required parameter 'checksum' is set
if (checksum === undefined || checksum === null) {
throw new Error("Missing the required parameter 'checksum' when calling shamanFileStoreCheck");
}
// verify the required parameter 'filesize' is set
if (filesize === undefined || filesize === null) {
throw new Error("Missing the required parameter 'filesize' when calling shamanFileStoreCheck");
}
let pathParams = {
'checksum': checksum,
'filesize': filesize
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = [];
let contentTypes = [];
let accepts = ['application/json'];
let returnType = ShamanSingleFileStatus;
return this.apiClient.callApi(
'/api/v3/shaman/files/{checksum}/{filesize}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null
);
}
/**
* Check the status of a file on the Shaman server.
* @param {String} checksum SHA256 checksum of the file.
* @param {Number} filesize Size of the file in bytes.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ShamanSingleFileStatus}
*/
shamanFileStoreCheck(checksum, filesize) {
return this.shamanFileStoreCheckWithHttpInfo(checksum, filesize)
.then(function(response_and_data) {
return response_and_data.data;
});
}
}