Welcome to mirror list, hosted at ThFree Co, Russian Federation.

retentionService.js « services « src - github.com/nextcloud/files_retention.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1cd747157206c2a82cc5c935dc664bbfd4e2afd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
 * SPDX-FileCopyrightText: Joas Schilling <coding@schilljs.com>
 * SPDX-License-Identifier: AGPL-3.0-only
 */

import axios from '@nextcloud/axios'
import { generateUrl } from '@nextcloud/router'

/**
 * @param {object} rule The retention rule to add
 * @return {object} The axios response
 */
const createRetentionRule = async function(rule) {
	return axios.post(generateUrl('/apps/files_retention/api/v1/retentions'), rule)
}

/**
 * @param {number} ruleId The retention rule to delete
 * @return {object} The axios response
 */
const deleteRetentionRule = async function(ruleId) {
	return axios.delete(generateUrl('/apps/files_retention/api/v1/retentions/' + ruleId))
}

/**
 * @return {object} The axios response
 */
const getRetentionRules = async function() {
	return axios.get(generateUrl('/apps/files_retention/api/v1/retentions'))
}

export {
	createRetentionRule,
	deleteRetentionRule,
	getRetentionRules,
}