Skip to content
Open
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
49 changes: 0 additions & 49 deletions account.stone

This file was deleted.

83 changes: 83 additions & 0 deletions account_account_photo.stone
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
namespace account

import account_id
import common


union PhotoSourceArg
base64_data String
"Image data in base64-encoded bytes."

example default
base64_data = "SW1hZ2UgZGF0YSBpbiBiYXNlNjQtZW5jb2RlZCBieXRlcy4gTm90IGEgdmFsaWQgZXhhbXBsZS4="

union SetProfilePhotoError
file_type_error
"File cannot be set as profile photo."
file_size_error
"File cannot exceed 10 MB."
dimension_error
"Image must be larger than 128 x 128."
thumbnail_error
"Image could not be thumbnailed."
transient_error
"Temporary infrastructure failure, please retry."

struct SetProfilePhotoArg
photo PhotoSourceArg
"Image to set as the user's new profile photo."

example default
photo = default

struct SetProfilePhotoResult
profile_photo_url String
"URL for the photo representing the user, if one is set."

example default
profile_photo_url = "https://dl-web.dropbox.com/account_photo/get/dbaphid%3AAAHWGmIXV3sUuOmBfTz0wPsiqHUpBWvv3ZA?vers=1556069330102&size=128x128"

struct AccountPhotoGetArg
dbx_account_id String
"Encoded ID of the user. Must start either with 'dbid:' or 'dbaphid:'."
size String
"A string representing the size of the photo."
circle_crop Boolean
"True if the photo should be cropped and false otherwise."
expect_account_photo Boolean
"True if we expect account photo to exist."

example default
dbx_account_id = "dbid:s0meEnc0ded1d"
size = "16x16"
circle_crop = false
expect_account_photo = true

union ThumbnailError
permanent_failure
"Indicates permanent infrastructural failure."
temporary_failure
"Indicates temporary infrastructural failure."

union AccountPhotoGetError
thumbnail_error ThumbnailError
"Indicates infrastructural failure."
account_photo_missing
"Account photo is missing (but we did not expect it to exist)."
expected_account_photo_missing
"Account photo was expected to exist, but it's missing."

struct AccountPhotoGetResult
content_type String
"The data returned by get_photo."

example default
content_type = "image/jpeg"

route set_profile_photo (SetProfilePhotoArg, SetProfilePhotoResult, SetProfilePhotoError)
"Sets a user's profile photo."

attrs
auth = "user"
scope = "account_info.write"

13 changes: 13 additions & 0 deletions account_account_photo_block.stone
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace account

route get_photo (AccountPhotoGetArg, AccountPhotoGetResult, AccountPhotoGetError)
"This lovely endpoint gets the account photo of a given user."

attrs
allow_app_folder_app = true
auth = "user"
host = "content"
scope = "account_info.read"
select_admin_mode = "whole_team"
style = "download"

6 changes: 6 additions & 0 deletions account_id.stone
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace account_id

annotation_type ContainsDbidAnnotation
"Annotation type should be applied to Response object fields which contain account id"

authorize_caller Boolean = true
39 changes: 5 additions & 34 deletions async.stone → async_common_async.stone
Original file line number Diff line number Diff line change
@@ -1,31 +1,15 @@
namespace async

#
# Types for writing asynchronous API methods.
#
# There are two calls for each asynchronous method:
# 1. A "Launch" method that (optionally) launches the asynchronous job
# 2. A "Polling" method that polls for the status of the job that was launched by the first call.
#
# The following definitions are prefixed by "Launch" or "Poll", according to their intended use.

import common

alias AsyncJobId = String(min_length=1)


#
# Launch
#

union_closed LaunchResultBase
"Result returned by methods that launch an asynchronous job.

A method who may either launch an asynchronous job, or complete the request
synchronously, can use this union by extending it, and adding a 'complete' field
with the type of the synchronous response.

See :type:`LaunchEmptyResult` for an example."

async_job_id AsyncJobId
"This response indicates that the processing is asynchronous.
The string is an id that can be used to obtain the status of the asynchronous job."
Expand All @@ -36,63 +20,50 @@ union_closed LaunchResultBase
union_closed LaunchEmptyResult extends LaunchResultBase
"Result returned by methods that may either launch an asynchronous job or complete synchronously.
Upon synchronous completion of the job, no additional information is returned."

complete
"The job finished synchronously and successfully."

example complete
complete = null

example async_job_id
async_job_id = "34g93hh34h04y384084"

#
# Poll
#

struct PollArg
"Arguments for methods that poll the status of an asynchronous job."

async_job_id AsyncJobId
"Id of the asynchronous job.
This is the value of a response returned from the method that launched the job."

example default
async_job_id = "34g93hh34h04y384084"

# TODO(kelkabany): Remove `error_msg` since others might want to return it
# differently.
union_closed PollResultBase
"Result returned by methods that poll for the status of an asynchronous job.
Unions that extend this union should add a 'complete' field with a type of
the information returned upon job completion.

See :type:`PollEmptyResult` for an example."

See :type:`PollEmptyResult` for an example"
in_progress
"The asynchronous job is still in progress."


union_closed PollEmptyResult extends PollResultBase
"Result returned by methods that poll for the status of an asynchronous job.
Upon completion of the job, no additional information is returned."

complete
"The asynchronous job has completed successfully."

example complete
complete = null

example in_progress
in_progress = null


union PollError
"Error returned by methods for polling the status of asynchronous job."

invalid_async_job_id
"The job ID is invalid."
internal_error
"Something went wrong with the job on Dropbox's end. You'll need to
verify that the action you were taking succeeded, and if not, try
again. This should happen very rarely."

Loading