Skip to content

Commit

Permalink
Merge pull request #101 from dropbox/update-spec
Browse files Browse the repository at this point in the history
Update spec
  • Loading branch information
Rajat Goel authored Oct 5, 2021
2 parents d3def53 + a108f02 commit 54923e6
Show file tree
Hide file tree
Showing 9 changed files with 547 additions and 137 deletions.
53 changes: 53 additions & 0 deletions v6/dropbox/files/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,21 @@ type Client interface {
// `Data transport limit page`
// <https://www.dropbox.com/developers/reference/data-transport-limit>.
UploadSessionFinishBatch(arg *UploadSessionFinishBatchArg) (res *UploadSessionFinishBatchLaunch, err error)
// UploadSessionFinishBatch : This route helps you commit many files at once
// into a user's Dropbox. Use `uploadSessionStart` and `uploadSessionAppend`
// to upload file contents. We recommend uploading many files in parallel to
// increase throughput. Once the file contents have been uploaded, rather
// than calling `uploadSessionFinish`, use this route to finish all your
// upload sessions in a single request. `UploadSessionStartArg.close` or
// `UploadSessionAppendArg.close` needs to be true for the last
// `uploadSessionStart` or `uploadSessionAppend` call of each upload
// session. The maximum size of a file one can upload to an upload session
// is 350 GB. We allow up to 1000 entries in a single request. Calls to this
// endpoint will count as data transport calls for any Dropbox Business
// teams with a limit on the number of data transport calls allowed per
// month. For more information, see the `Data transport limit page`
// <https://www.dropbox.com/developers/reference/data-transport-limit>.
UploadSessionFinishBatchV2(arg *UploadSessionFinishBatchArg) (res *UploadSessionFinishBatchResult, err error)
// UploadSessionFinishBatchCheck : Returns the status of an asynchronous job
// for `uploadSessionFinishBatch`. If success, it returns list of result for
// each entry.
Expand Down Expand Up @@ -2862,6 +2877,44 @@ func (dbx *apiImpl) UploadSessionFinishBatch(arg *UploadSessionFinishBatchArg) (
return
}

//UploadSessionFinishBatchV2APIError is an error-wrapper for the upload_session/finish_batch_v2 route
type UploadSessionFinishBatchV2APIError struct {
dropbox.APIError
EndpointError struct{} `json:"error"`
}

func (dbx *apiImpl) UploadSessionFinishBatchV2(arg *UploadSessionFinishBatchArg) (res *UploadSessionFinishBatchResult, err error) {
req := dropbox.Request{
Host: "api",
Namespace: "files",
Route: "upload_session/finish_batch_v2",
Auth: "user",
Style: "rpc",
Arg: arg,
ExtraHeaders: nil,
}

var resp []byte
var respBody io.ReadCloser
resp, respBody, err = (*dropbox.Context)(dbx).Execute(req, nil)
if err != nil {
var appErr UploadSessionFinishBatchV2APIError
err = auth.ParseError(err, &appErr)
if err == &appErr {
err = appErr
}
return
}

err = json.Unmarshal(resp, &res)
if err != nil {
return
}

_ = respBody
return
}

//UploadSessionFinishBatchCheckAPIError is an error-wrapper for the upload_session/finish_batch/check route
type UploadSessionFinishBatchCheckAPIError struct {
dropbox.APIError
Expand Down
23 changes: 16 additions & 7 deletions v6/dropbox/files/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5110,9 +5110,14 @@ func (u *WriteError) UnmarshalJSON(body []byte) error {
type WriteMode struct {
dropbox.Tagged
// Update : Overwrite if the given "rev" matches the existing file's "rev".
// The autorename strategy is to append the string "conflicted copy" to the
// file name. For example, "document.txt" might become "document (conflicted
// copy).txt" or "document (Panda's conflicted copy).txt".
// The supplied value should be the latest known "rev" of the file, for
// example, from `FileMetadata`, from when the file was last downloaded by
// the app. This will cause the file on the Dropbox servers to be
// overwritten if the given "rev" matches the existing file's current "rev"
// on the Dropbox servers. The autorename strategy is to append the string
// "conflicted copy" to the file name. For example, "document.txt" might
// become "document (conflicted copy).txt" or "document (Panda's conflicted
// copy).txt".
Update string `json:"update,omitempty"`
}

Expand All @@ -5128,10 +5133,14 @@ func (u *WriteMode) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// Update : Overwrite if the given "rev" matches the existing file's
// "rev". The autorename strategy is to append the string "conflicted
// copy" to the file name. For example, "document.txt" might become
// "document (conflicted copy).txt" or "document (Panda's conflicted
// copy).txt".
// "rev". The supplied value should be the latest known "rev" of the
// file, for example, from `FileMetadata`, from when the file was last
// downloaded by the app. This will cause the file on the Dropbox
// servers to be overwritten if the given "rev" matches the existing
// file's current "rev" on the Dropbox servers. The autorename strategy
// is to append the string "conflicted copy" to the file name. For
// example, "document.txt" might become "document (conflicted copy).txt"
// or "document (Panda's conflicted copy).txt".
Update string `json:"update,omitempty"`
}
var w wrap
Expand Down
4 changes: 2 additions & 2 deletions v6/dropbox/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ const (
hostAPI = "api"
hostContent = "content"
hostNotify = "notify"
sdkVersion = "6.0.2"
specVersion = "444efad"
sdkVersion = "6.0.3"
specVersion = "65585e4"
)

// Version returns the current SDK version and API Spec version
Expand Down
60 changes: 6 additions & 54 deletions v6/dropbox/sharing/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ type Client interface {
// get access to all the functionality for this folder, you will need to
// call `mountFolder` on their behalf.
AddFolderMember(arg *AddFolderMemberArg) (err error)
// ChangeFileMemberAccess : Identical to update_file_member but with less
// information returned.
// Deprecated: Use `UpdateFileMember` instead
ChangeFileMemberAccess(arg *ChangeFileMemberAccessArgs) (res *FileMemberActionResult, err error)
// CheckJobStatus : Returns the status of an asynchronous job.
CheckJobStatus(arg *async.PollArg) (res *JobStatus, err error)
// CheckRemoveMemberJobStatus : Returns the status of an asynchronous job
Expand All @@ -52,13 +48,11 @@ type Client interface {
// sharing a folder.
CheckShareJobStatus(arg *async.PollArg) (res *ShareFolderJobStatus, err error)
// CreateSharedLink : Create a shared link. If a shared link already exists
// for the given path, that link is returned. Note that in the returned
// `PathLinkMetadata`, the `PathLinkMetadata.url` field is the shortened URL
// if `CreateSharedLinkArg.short_url` argument is set to true. Previously,
// it was technically possible to break a shared link by moving or renaming
// the corresponding file or folder. In the future, this will no longer be
// the case, so your app shouldn't rely on this behavior. Instead, if your
// app needs to revoke a shared link, use `revokeSharedLink`.
// for the given path, that link is returned. Previously, it was technically
// possible to break a shared link by moving or renaming the corresponding
// file or folder. In the future, this will no longer be the case, so your
// app shouldn't rely on this behavior. Instead, if your app needs to revoke
// a shared link, use `revokeSharedLink`.
// Deprecated: Use `CreateSharedLinkWithSettings` instead
CreateSharedLink(arg *CreateSharedLinkArg) (res *PathLinkMetadata, err error)
// CreateSharedLinkWithSettings : Create a shared link with custom settings.
Expand All @@ -82,8 +76,7 @@ type Client interface {
// shared links for the current user, including collection links, up to a
// maximum of 1000 links. If a non-empty path is given, returns a list of
// all shared links that allow access to the given path. Collection links
// are never returned in this case. Note that the url field in the response
// is never the shortened URL.
// are never returned in this case.
// Deprecated: Use `ListSharedLinks` instead
GetSharedLinks(arg *GetSharedLinksArg) (res *GetSharedLinksResult, err error)
// ListFileMembers : Use to obtain the members who have been invited to a
Expand Down Expand Up @@ -289,47 +282,6 @@ func (dbx *apiImpl) AddFolderMember(arg *AddFolderMemberArg) (err error) {
return
}

//ChangeFileMemberAccessAPIError is an error-wrapper for the change_file_member_access route
type ChangeFileMemberAccessAPIError struct {
dropbox.APIError
EndpointError *FileMemberActionError `json:"error"`
}

func (dbx *apiImpl) ChangeFileMemberAccess(arg *ChangeFileMemberAccessArgs) (res *FileMemberActionResult, err error) {
log.Printf("WARNING: API `ChangeFileMemberAccess` is deprecated")
log.Printf("Use API `UpdateFileMember` instead")

req := dropbox.Request{
Host: "api",
Namespace: "sharing",
Route: "change_file_member_access",
Auth: "user",
Style: "rpc",
Arg: arg,
ExtraHeaders: nil,
}

var resp []byte
var respBody io.ReadCloser
resp, respBody, err = (*dropbox.Context)(dbx).Execute(req, nil)
if err != nil {
var appErr ChangeFileMemberAccessAPIError
err = auth.ParseError(err, &appErr)
if err == &appErr {
err = appErr
}
return
}

err = json.Unmarshal(resp, &res)
if err != nil {
return
}

_ = respBody
return
}

//CheckJobStatusAPIError is an error-wrapper for the check_job_status route
type CheckJobStatusAPIError struct {
dropbox.APIError
Expand Down
Loading

0 comments on commit 54923e6

Please sign in to comment.