documentation

This commit is contained in:
hay-kot 2021-03-29 10:20:15 -08:00
commit c51b209dc4
2 changed files with 31 additions and 5 deletions

View file

@ -14,25 +14,46 @@ const backupURLs = {
};
export default {
/**
* Request all backups available on the server
* @returns {Array} List of Available Backups
*/
async requestAvailable() {
let response = await apiReq.get(backupURLs.available);
return response.data;
},
/**
* Calls for importing a file on the server
* @param {string} fileName
* @param {object} data
* @returns A report containing status of imported items
*/
async import(fileName, data) {
let response = await apiReq.post(backupURLs.importBackup(fileName), data);
store.dispatch("requestRecentRecipes");
return response;
},
/**
* Removes a file from the server
* @param {string} fileName
*/
async delete(fileName) {
await apiReq.delete(backupURLs.deleteBackup(fileName));
},
async create(data) {
let response = apiReq.post(backupURLs.createBackup, data);
/**
* Creates a backup on the serve given a set of options
* @param {object} data
* @returns
*/
async create(options) {
let response = apiReq.post(backupURLs.createBackup, options);
return response;
},
/**
* Downloads a file from the server. I don't actually think this is used?
* @param {string} fileName
* @returns Download URL
*/
async download(fileName) {
let response = await apiReq.get(backupURLs.downloadBackup(fileName));
return response.data;

View file

@ -19,6 +19,11 @@ const recipeURLs = {
};
export default {
/**
* Create a Recipe by URL
* @param {String} recipeURL
* @returns {String} Recipe Slug
*/
async createByURL(recipeURL) {
let response = await apiReq.post(recipeURLs.createByURL, {
url: recipeURL,