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

isystemtagobjectmapper.php « systemtag « public « lib - github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e2ac1fab1241eef00fcc9d7927489482d96c77eb (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
/**
 * @author Vincent Petry <pvince81@owncloud.com>
 *
 * @copyright Copyright (c) 2015, ownCloud, Inc.
 * @license AGPL-3.0
 *
 * This code is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License, version 3,
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License, version 3,
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 *
 */

namespace OCP\SystemTag;

/**
 * Public interface to access and manage system-wide tags.
 *
 * @since 9.0.0
 */
interface ISystemTagObjectMapper {

	/**
	 * Get a list of tag ids for the given object ids.
	 *
	 * This returns an array that maps object id to tag ids
	 * [
	 *   1 => array('id1', 'id2'),
	 *   2 => array('id3', 'id2'),
	 *   3 => array('id5'),
	 *   4 => array()
	 * ]
	 *
	 * Untagged objects will have an empty array associated.
	 *
	 * @param string|array $objIds object ids
	 * @param string $objectType object type
	 *
	 * @return array with object id as key and an array
	 * of tag ids as value
	 *
	 * @since 9.0.0
	 */
	public function getTagIdsForObjects($objIds, $objectType);

	/**
	 * Get a list of objects tagged with $tagIds.
	 *
	 * @param string|array $tagIds Tag id or array of tag ids.
	 * @param string $objectType object type
	 *
	 * @return string[] array of object ids or empty array if none found
	 *
	 * @throws \OCP\SystemTag\TagNotFoundException if at least one of the
	 * given tags does not exist
	 *
	 * @since 9.0.0
	 */
	public function getObjectIdsForTags($tagIds, $objectType);

	/**
	 * Assign the given tags to the given object.
	 *
	 * If at least one of the given tag ids doesn't exist, none of the tags
	 * will be assigned.
	 *
	 * If the relationship already existed, fail silently.
	 *
	 * @param string $objId object id
	 * @param string $objectType object type
	 * @param string|array $tagIds tag id or array of tag ids to assign
	 *
	 * @throws \OCP\SystemTag\TagNotFoundException if at least one of the
	 * given tags does not exist
	 *
	 * @since 9.0.0
	 */
	public function assignTags($objId, $objectType, $tagIds);

	/**
	 * Unassign the given tags from the given object.
	 *
	 * If at least one of the given tag ids doesn't exist, none of the tags
	 * will be unassigned.
	 *
	 * If the relationship did not exist in the first place, fail silently.
	 *
	 * @param string $objId object id
	 * @param string $objectType object type
	 * @param string|array $tagIds tag id or array of tag ids to unassign
	 *
	 * @throws \OCP\SystemTag\TagNotFoundException if at least one of the
	 * given tags does not exist
	 *
	 * @since 9.0.0
	 */
	public function unassignTags($objId, $objectType, $tagIds);

	/**
	 * Checks whether the given objects have the given tag.
	 *
	 * @param string|array $objIds object ids
	 * @param string $objectType object type
	 * @param string $tagId tag id to check
	 * @param bool $all true to check that ALL objects have the tag assigned,
	 * false to check that at least ONE object has the tag.
	 *
	 * @return bool true if the condition set by $all is matched, false
	 * otherwise
	 *
	 * @throws \OCP\SystemTag\TagNotFoundException if the tag does not exist
	 *
	 * @since 9.0.0
	 */
	public function haveTag($objIds, $objectType, $tagId, $all = true);

}