-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathfile_tagging.stone
115 lines (83 loc) · 2.66 KB
/
file_tagging.stone
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
namespace files
import common
import async
alias TagText = String(min_length=1, max_length=32, pattern="[\\w]+")
union Tag
"Tag that can be added in multiple ways."
user_generated_tag UserGeneratedTag
"Tag generated by the user."
example default
user_generated_tag = default
struct UserGeneratedTag
tag_text TagText
example default
tag_text = "my_tag"
union BaseTagError
path LookupError
#####################################
# Add Tag to an item
#####################################
struct AddTagArg
path Path
"Path to the item to be tagged."
tag_text TagText
"The value of the tag to add. Will be automatically converted to lowercase letters."
example default
path = "/Prime_Numbers.txt"
tag_text = "my_tag"
union AddTagError extends BaseTagError
too_many_tags
"The item already has the maximum supported number of tags."
route tags/add(AddTagArg, Void, AddTagError)
"Add a tag to an item. A tag is a string. The strings are automatically converted to lowercase letters. No more than 20 tags can be added to a given item."
attrs
auth = "user"
is_preview = true
scope = "files.metadata.write"
#####################################
# Remove Tag from a item
#####################################
struct RemoveTagArg
path Path
"Path to the item to tag."
tag_text TagText
"The tag to remove. Will be automatically converted to lowercase letters."
example default
path = "/Prime_Numbers.txt"
tag_text = "my_tag"
union RemoveTagError extends BaseTagError
tag_not_present
"That tag doesn't exist at this path."
route tags/remove(RemoveTagArg, Void, RemoveTagError)
"Remove a tag from an item."
attrs
auth = "user"
is_preview = true
scope = "files.metadata.write"
###############################################
# Get tags by item
###############################################
struct GetTagsArg
paths List(Path)
"Path to the items."
example default
paths = ["/Prime_Numbers.txt"]
struct PathToTags
path Path
"Path of the item."
tags List(Tag)
"Tags assigned to this item."
example default
path = "/Prime_Numbers.txt"
tags = [default]
struct GetTagsResult
paths_to_tags List(PathToTags)
"List of paths and their corresponding tags."
example default
paths_to_tags = [default]
route tags/get(GetTagsArg, GetTagsResult, BaseTagError)
"Get list of tags assigned to items."
attrs
auth = "user"
is_preview = true
scope = "files.metadata.read"