Skip to content

Spec Update 11/03/2021 #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 130 additions & 0 deletions file_tagging.stone
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
namespace files

import common
import async

alias TagText = String(min_length=1, max_length=32, pattern="[A-Za-z0-9\_]+")

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


union BaseError
unknown
"Action failed."
transient
"Action failed. Try again."
input_validation
"Action failed due to wrong params."
cancelled
"Action cancelled."

struct UserGeneratedTag
tag_text TagText

example default
tag_text = "my_tag"



union BaseTagError extends BaseError
feature_not_supported
"Tags are not turned on for your team. Please turn on the feature."

path_not_found
"Path not found."


#####################################
# 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."

example default
path = "/Prime_Numbers.txt"
tag_text = "MyTag"

union AddTagError extends BaseTagError
too_many_tags
"Item already has max supported tags."

route tags/add(AddTagArg, Void, AddTagError)
"Add a tag to an item. A tag is a string. 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."

example default
path = "/Prime_Numbers.txt"
tag_text = "MyTag"

union RemoveTagError extends BaseTagError
tag_not_exists_for_this_path
"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"
4 changes: 3 additions & 1 deletion files.stone
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ route list_folder (ListFolderArg, ListFolderResult, ListFolderError)

attrs
allow_app_folder_app = true
auth = "app, user"
select_admin_mode = "whole_team"
scope = "files.metadata.read"

Expand All @@ -580,6 +581,7 @@ route list_folder/continue (ListFolderContinueArg, ListFolderResult, ListFolderC

attrs
allow_app_folder_app = true
auth = "app, user"
select_admin_mode = "whole_team"
scope = "files.metadata.read"

Expand Down Expand Up @@ -2553,7 +2555,7 @@ struct GetTemporaryLinkResult

example default
metadata = default
link = "https://content.dropboxapi.com/apitl/1/YXNkZmFzZGcyMzQyMzI0NjU2NDU2NDU2"
link = "https://ucabc123456.dl.dropboxusercontent.com/cd/0/get/abcdefghijklmonpqrstuvwxyz1234567890/file"

union GetTemporaryLinkError
path LookupError
Expand Down