Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

Issue #1788: Pointing to Dropbox's v5.0.0 tag

Mathieu Carbou4138d5aa751b
diff --git a/go.mod b/go.mod
index de30182da..8b615390d 100644
--- a/go.mod
+++ b/go.mod
@@ -3,6 +3,7 @@ module github.com/ncw/rclone
require (
bazil.org/fuse v0.0.0-20180421153158-65cc252bf669
cloud.google.com/go v0.33.1 // indirect
+ github.com/Azure/azure-pipeline-go v0.1.8
github.com/Azure/azure-storage-blob-go v0.0.0-20181023070848-cf01652132cc
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78
github.com/Unknwon/goconfig v0.0.0-20181105214110-56bd8ab18619
@@ -14,7 +15,7 @@ require (
github.com/cpuguy83/go-md2man v1.0.8 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/djherbis/times v1.1.0
- github.com/dropbox/dropbox-sdk-go-unofficial v4.1.0+incompatible
+ github.com/dropbox/dropbox-sdk-go-unofficial v5.0.1-0.20181205034806-56e5f6595305+incompatible
github.com/goftp/file-driver v0.0.0-20180502053751-5d604a0fc0c9 // indirect
github.com/goftp/server v0.0.0-20180914132916-1fd52c8552f1
github.com/google/go-querystring v1.0.0 // indirect
diff --git a/go.sum b/go.sum
index b82870e23..1c75d1746 100644
--- a/go.sum
+++ b/go.sum
@@ -28,6 +28,9 @@ github.com/djherbis/times v1.1.0 h1:NFhBDODme0XNX+/5ETW9qL6v3Ty57psiXIQBrzzg44E=
github.com/djherbis/times v1.1.0/go.mod h1:CGMZlo255K5r4Yw0b9RRfFQpM2y7uOmxg4jm9HsaVf8=
github.com/dropbox/dropbox-sdk-go-unofficial v4.1.0+incompatible h1:ZFvUIiBbGhDY5zF8yjLoWhUAYs7uDodUpbvTS5oelDE=
github.com/dropbox/dropbox-sdk-go-unofficial v4.1.0+incompatible/go.mod h1:lr+LhMM3F6Y3lW1T9j2U5l7QeuWm87N9+PPXo3yH4qY=
+github.com/dropbox/dropbox-sdk-go-unofficial v5.0.0+incompatible h1:FQu9Ef2dkC8g2rQmcQmpXXeoRegXHODBfveKKZu6+e8=
+github.com/dropbox/dropbox-sdk-go-unofficial v5.0.1-0.20181205034806-56e5f6595305+incompatible h1:4HSS6BiPqvgsn/zrwt6KOYY+mw153zmhvewZIRh1+Ds=
+github.com/dropbox/dropbox-sdk-go-unofficial v5.0.1-0.20181205034806-56e5f6595305+incompatible/go.mod h1:lr+LhMM3F6Y3lW1T9j2U5l7QeuWm87N9+PPXo3yH4qY=
github.com/goftp/file-driver v0.0.0-20180502053751-5d604a0fc0c9 h1:cC0Hbb+18DJ4i6ybqDybvj4wdIDS4vnD0QEci98PgM8=
github.com/goftp/file-driver v0.0.0-20180502053751-5d604a0fc0c9/go.mod h1:GpOj6zuVBG3Inr9qjEnuVTgBlk2lZ1S9DcoFiXWyKss=
github.com/goftp/server v0.0.0-20180914132916-1fd52c8552f1 h1:WjgeEHEDLGx56ndxS6FYi6qFjZGajSVHPuEPdpJ60cI=
diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/client.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/client.go
new file mode 100644
index 000000000..ed59c3912
--- /dev/null
+++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/client.go
@@ -0,0 +1,166 @@
+// Copyright (c) Dropbox, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+package auth
+
+import (
+ "bytes"
+ "encoding/json"
+ "io/ioutil"
+ "net/http"
+
+ "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox"
+)
+
+// Client interface describes all routes in this namespace
+type Client interface {
+ // TokenFromOauth1 : Creates an OAuth 2.0 access token from the supplied
+ // OAuth 1.0 access token.
+ TokenFromOauth1(arg *TokenFromOAuth1Arg) (res *TokenFromOAuth1Result, err error)
+ // TokenRevoke : Disables the access token used to authenticate the call.
+ TokenRevoke() (err error)
+}
+
+type apiImpl dropbox.Context
+
+//TokenFromOauth1APIError is an error-wrapper for the token/from_oauth1 route
+type TokenFromOauth1APIError struct {
+ dropbox.APIError
+ EndpointError *TokenFromOAuth1Error `json:"error"`
+}
+
+func (dbx *apiImpl) TokenFromOauth1(arg *TokenFromOAuth1Arg) (res *TokenFromOAuth1Result, err error) {
+ cli := dbx.Client
+
+ dbx.Config.LogDebug("arg: %v", arg)
+ b, err := json.Marshal(arg)
+ if err != nil {
+ return
+ }
+
+ headers := map[string]string{
+ "Content-Type": "application/json",
+ }
+ if dbx.Config.AsMemberID != "" {
+ headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
+ }
+
+ req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "auth", "token/from_oauth1", headers, bytes.NewReader(b))
+ if err != nil {
+ return
+ }
+ dbx.Config.LogInfo("req: %v", req)
+
+ resp, err := cli.Do(req)
+ if err != nil {
+ return
+ }
+
+ dbx.Config.LogInfo("resp: %v", resp)
+ defer resp.Body.Close()
+ body, err := ioutil.ReadAll(resp.Body)
+ if err != nil {
+ return
+ }
+
+ dbx.Config.LogDebug("body: %s", body)
+ if resp.StatusCode == http.StatusOK {
+ err = json.Unmarshal(body, &res)
+ if err != nil {
+ return
+ }
+
+ return
+ }
+ if resp.StatusCode == http.StatusConflict {
+ var apiError TokenFromOauth1APIError
+ err = json.Unmarshal(body, &apiError)
+ if err != nil {
+ return
+ }
+ err = apiError
+ return
+ }
+ err = HandleCommonAuthErrors(dbx.Config, resp, body)
+ if err != nil {
+ return
+ }
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
+ return
+}
+
+//TokenRevokeAPIError is an error-wrapper for the token/revoke route
+type TokenRevokeAPIError struct {
+ dropbox.APIError
+ EndpointError struct{} `json:"error"`
+}
+
+func (dbx *apiImpl) TokenRevoke() (err error) {
+ cli := dbx.Client
+
+ headers := map[string]string{}
+ if dbx.Config.AsMemberID != "" {
+ headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
+ }
+
+ req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "auth", "token/revoke", headers, nil)
+ if err != nil {
+ return
+ }
+ dbx.Config.LogInfo("req: %v", req)
+
+ resp, err := cli.Do(req)
+ if err != nil {
+ return
+ }
+
+ dbx.Config.LogInfo("resp: %v", resp)
+ defer resp.Body.Close()
+ body, err := ioutil.ReadAll(resp.Body)
+ if err != nil {
+ return
+ }
+
+ dbx.Config.LogDebug("body: %s", body)
+ if resp.StatusCode == http.StatusOK {
+ return
+ }
+ if resp.StatusCode == http.StatusConflict {
+ var apiError TokenRevokeAPIError
+ err = json.Unmarshal(body, &apiError)
+ if err != nil {
+ return
+ }
+ err = apiError
+ return
+ }
+ err = HandleCommonAuthErrors(dbx.Config, resp, body)
+ if err != nil {
+ return
+ }
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
+ return
+}
+
+// New returns a Client implementation for this namespace
+func New(c dropbox.Config) Client {
+ ctx := apiImpl(dropbox.NewContext(c))
+ return &ctx
+}
diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/sdk.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/sdk.go
new file mode 100644
index 000000000..c99539bcf
--- /dev/null
+++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/sdk.go
@@ -0,0 +1,38 @@
+package auth
+
+import (
+ "encoding/json"
+ "mime"
+ "net/http"
+ "strconv"
+
+ "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox"
+)
+
+type RateLimitAPIError struct {
+ dropbox.APIError
+ RateLimitError *RateLimitError `json:"error"`
+}
+
+// HandleCommonAuthErrors handles common authentication errors
+func HandleCommonAuthErrors(c dropbox.Config, resp *http.Response, body []byte) error {
+ if resp.StatusCode == http.StatusTooManyRequests {
+ var apiError RateLimitAPIError
+ // Check content-type
+ contentType, _, _ := mime.ParseMediaType(resp.Header.Get("content-type"))
+ if contentType == "application/json" {
+ if err := json.Unmarshal(body, &apiError); err != nil {
+ c.LogDebug("Error unmarshaling '%s' into JSON", body)
+ return err
+ }
+ } else { // assume plain text
+ apiError.ErrorSummary = string(body)
+ reason := RateLimitReason{dropbox.Tagged{Tag: RateLimitReasonTooManyRequests}}
+ apiError.RateLimitError = NewRateLimitError(&reason)
+ timeout, _ := strconv.ParseInt(resp.Header.Get("retry-after"), 10, 64)
+ apiError.RateLimitError.RetryAfter = uint64(timeout)
+ }
+ return apiError
+ }
+ return nil
+}
diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/types.go
new file mode 100644
index 000000000..f694c07aa
--- /dev/null
+++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth/types.go
@@ -0,0 +1,188 @@
+// Copyright (c) Dropbox, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+// Package auth : has no documentation (yet)
+package auth
+
+import (
+ "encoding/json"
+
+ "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox"
+)
+
+// AccessError : Error occurred because the account doesn't have permission to
+// access the resource.
+type AccessError struct {
+ dropbox.Tagged
+ // InvalidAccountType : Current account type cannot access the resource.
+ InvalidAccountType *InvalidAccountTypeError `json:"invalid_account_type,omitempty"`
+ // PaperAccessDenied : Current account cannot access Paper.
+ PaperAccessDenied *PaperAccessError `json:"paper_access_denied,omitempty"`
+}
+
+// Valid tag values for AccessError
+const (
+ AccessErrorInvalidAccountType = "invalid_account_type"
+ AccessErrorPaperAccessDenied = "paper_access_denied"
+ AccessErrorOther = "other"
+)
+
+// UnmarshalJSON deserializes into a AccessError instance
+func (u *AccessError) UnmarshalJSON(body []byte) error {
+ type wrap struct {
+ dropbox.Tagged
+ // InvalidAccountType : Current account type cannot access the resource.
+ InvalidAccountType json.RawMessage `json:"invalid_account_type,omitempty"`
+ // PaperAccessDenied : Current account cannot access Paper.
+ PaperAccessDenied json.RawMessage `json:"paper_access_denied,omitempty"`
+ }
+ var w wrap
+ var err error
+ if err = json.Unmarshal(body, &w); err != nil {
+ return err
+ }
+ u.Tag = w.Tag
+ switch u.Tag {
+ case "invalid_account_type":
+ err = json.Unmarshal(w.InvalidAccountType, &u.InvalidAccountType)
+
+ if err != nil {
+ return err
+ }
+ case "paper_access_denied":
+ err = json.Unmarshal(w.PaperAccessDenied, &u.PaperAccessDenied)
+
+ if err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+// AuthError : Errors occurred during authentication.
+type AuthError struct {
+ dropbox.Tagged
+}
+
+// Valid tag values for AuthError
+const (
+ AuthErrorInvalidAccessToken = "invalid_access_token"
+ AuthErrorInvalidSelectUser = "invalid_select_user"
+ AuthErrorInvalidSelectAdmin = "invalid_select_admin"
+ AuthErrorUserSuspended = "user_suspended"
+ AuthErrorExpiredAccessToken = "expired_access_token"
+ AuthErrorOther = "other"
+)
+
+// InvalidAccountTypeError : has no documentation (yet)
+type InvalidAccountTypeError struct {
+ dropbox.Tagged
+}
+
+// Valid tag values for InvalidAccountTypeError
+const (
+ InvalidAccountTypeErrorEndpoint = "endpoint"
+ InvalidAccountTypeErrorFeature = "feature"
+ InvalidAccountTypeErrorOther = "other"
+)
+
+// PaperAccessError : has no documentation (yet)
+type PaperAccessError struct {
+ dropbox.Tagged
+}
+
+// Valid tag values for PaperAccessError
+const (
+ PaperAccessErrorPaperDisabled = "paper_disabled"
+ PaperAccessErrorNotPaperUser = "not_paper_user"
+ PaperAccessErrorOther = "other"
+)
+
+// RateLimitError : Error occurred because the app is being rate limited.
+type RateLimitError struct {
+ // Reason : The reason why the app is being rate limited.
+ Reason *RateLimitReason `json:"reason"`
+ // RetryAfter : The number of seconds that the app should wait before making
+ // another request.
+ RetryAfter uint64 `json:"retry_after"`
+}
+
+// NewRateLimitError returns a new RateLimitError instance
+func NewRateLimitError(Reason *RateLimitReason) *RateLimitError {
+ s := new(RateLimitError)
+ s.Reason = Reason
+ s.RetryAfter = 1
+ return s
+}
+
+// RateLimitReason : has no documentation (yet)
+type RateLimitReason struct {
+ dropbox.Tagged
+}
+
+// Valid tag values for RateLimitReason
+const (
+ RateLimitReasonTooManyRequests = "too_many_requests"
+ RateLimitReasonTooManyWriteOperations = "too_many_write_operations"
+ RateLimitReasonOther = "other"
+)
+
+// TokenFromOAuth1Arg : has no documentation (yet)
+type TokenFromOAuth1Arg struct {
+ // Oauth1Token : The supplied OAuth 1.0 access token.
+ Oauth1Token string `json:"oauth1_token"`
+ // Oauth1TokenSecret : The token secret associated with the supplied access
+ // token.
+ Oauth1TokenSecret string `json:"oauth1_token_secret"`
+}
+
+// NewTokenFromOAuth1Arg returns a new TokenFromOAuth1Arg instance
+func NewTokenFromOAuth1Arg(Oauth1Token string, Oauth1TokenSecret string) *TokenFromOAuth1Arg {
+ s := new(TokenFromOAuth1Arg)
+ s.Oauth1Token = Oauth1Token
+ s.Oauth1TokenSecret = Oauth1TokenSecret
+ return s
+}
+
+// TokenFromOAuth1Error : has no documentation (yet)
+type TokenFromOAuth1Error struct {
+ dropbox.Tagged
+}
+
+// Valid tag values for TokenFromOAuth1Error
+const (
+ TokenFromOAuth1ErrorInvalidOauth1TokenInfo = "invalid_oauth1_token_info"
+ TokenFromOAuth1ErrorAppIdMismatch = "app_id_mismatch"
+ TokenFromOAuth1ErrorOther = "other"
+)
+
+// TokenFromOAuth1Result : has no documentation (yet)
+type TokenFromOAuth1Result struct {
+ // Oauth2Token : The OAuth 2.0 token generated from the supplied OAuth 1.0
+ // token.
+ Oauth2Token string `json:"oauth2_token"`
+}
+
+// NewTokenFromOAuth1Result returns a new TokenFromOAuth1Result instance
+func NewTokenFromOAuth1Result(Oauth2Token string) *TokenFromOAuth1Result {
+ s := new(TokenFromOAuth1Result)
+ s.Oauth2Token = Oauth2Token
+ return s
+}
diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/file_properties/client.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/file_properties/client.go
index 8b9c79bc2..3679002c4 100644
--- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/file_properties/client.go
+++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/file_properties/client.go
@@ -27,6 +27,7 @@ import (
"net/http"
"github.com/dropbox/dropbox-sdk-go-unofficial/dropbox"
+ "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth"
)
// Client interface describes all routes in this namespace
@@ -142,7 +143,7 @@ func (dbx *apiImpl) PropertiesAdd(arg *AddPropertiesArg) (err error) {
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -155,17 +156,11 @@ func (dbx *apiImpl) PropertiesAdd(arg *AddPropertiesArg) (err error) {
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -209,7 +204,7 @@ func (dbx *apiImpl) PropertiesOverwrite(arg *OverwritePropertyGroupArg) (err err
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -222,17 +217,11 @@ func (dbx *apiImpl) PropertiesOverwrite(arg *OverwritePropertyGroupArg) (err err
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -276,7 +265,7 @@ func (dbx *apiImpl) PropertiesRemove(arg *RemovePropertiesArg) (err error) {
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -289,17 +278,11 @@ func (dbx *apiImpl) PropertiesRemove(arg *RemovePropertiesArg) (err error) {
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -343,7 +326,7 @@ func (dbx *apiImpl) PropertiesSearch(arg *PropertiesSearchArg) (res *PropertiesS
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -361,17 +344,11 @@ func (dbx *apiImpl) PropertiesSearch(arg *PropertiesSearchArg) (res *PropertiesS
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -415,7 +392,7 @@ func (dbx *apiImpl) PropertiesSearchContinue(arg *PropertiesSearchContinueArg) (
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -433,17 +410,11 @@ func (dbx *apiImpl) PropertiesSearchContinue(arg *PropertiesSearchContinueArg) (
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -487,7 +458,7 @@ func (dbx *apiImpl) PropertiesUpdate(arg *UpdatePropertiesArg) (err error) {
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -500,17 +471,11 @@ func (dbx *apiImpl) PropertiesUpdate(arg *UpdatePropertiesArg) (err error) {
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -551,7 +516,7 @@ func (dbx *apiImpl) TemplatesAddForTeam(arg *AddTemplateArg) (res *AddTemplateRe
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -569,17 +534,11 @@ func (dbx *apiImpl) TemplatesAddForTeam(arg *AddTemplateArg) (res *AddTemplateRe
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -623,7 +582,7 @@ func (dbx *apiImpl) TemplatesAddForUser(arg *AddTemplateArg) (res *AddTemplateRe
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -641,17 +600,11 @@ func (dbx *apiImpl) TemplatesAddForUser(arg *AddTemplateArg) (res *AddTemplateRe
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -692,7 +645,7 @@ func (dbx *apiImpl) TemplatesGetForTeam(arg *GetTemplateArg) (res *GetTemplateRe
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -710,17 +663,11 @@ func (dbx *apiImpl) TemplatesGetForTeam(arg *GetTemplateArg) (res *GetTemplateRe
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -764,7 +711,7 @@ func (dbx *apiImpl) TemplatesGetForUser(arg *GetTemplateArg) (res *GetTemplateRe
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -782,17 +729,11 @@ func (dbx *apiImpl) TemplatesGetForUser(arg *GetTemplateArg) (res *GetTemplateRe
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -825,7 +766,7 @@ func (dbx *apiImpl) TemplatesListForTeam() (res *ListTemplateResult, err error)
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -843,17 +784,11 @@ func (dbx *apiImpl) TemplatesListForTeam() (res *ListTemplateResult, err error)
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -889,7 +824,7 @@ func (dbx *apiImpl) TemplatesListForUser() (res *ListTemplateResult, err error)
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -907,17 +842,11 @@ func (dbx *apiImpl) TemplatesListForUser() (res *ListTemplateResult, err error)
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -958,7 +887,7 @@ func (dbx *apiImpl) TemplatesRemoveForTeam(arg *RemoveTemplateArg) (err error) {
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -971,17 +900,11 @@ func (dbx *apiImpl) TemplatesRemoveForTeam(arg *RemoveTemplateArg) (err error) {
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1025,7 +948,7 @@ func (dbx *apiImpl) TemplatesRemoveForUser(arg *RemoveTemplateArg) (err error) {
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -1038,17 +961,11 @@ func (dbx *apiImpl) TemplatesRemoveForUser(arg *RemoveTemplateArg) (err error) {
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1089,7 +1006,7 @@ func (dbx *apiImpl) TemplatesUpdateForTeam(arg *UpdateTemplateArg) (res *UpdateT
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1107,17 +1024,11 @@ func (dbx *apiImpl) TemplatesUpdateForTeam(arg *UpdateTemplateArg) (res *UpdateT
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1161,7 +1072,7 @@ func (dbx *apiImpl) TemplatesUpdateForUser(arg *UpdateTemplateArg) (res *UpdateT
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1179,17 +1090,11 @@ func (dbx *apiImpl) TemplatesUpdateForUser(arg *UpdateTemplateArg) (res *UpdateT
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/client.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/client.go
index bbe7d268f..55c53fe9e 100644
--- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/client.go
+++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/client.go
@@ -30,6 +30,7 @@ import (
"github.com/dropbox/dropbox-sdk-go-unofficial/dropbox"
"github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/async"
+ "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth"
"github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/file_properties"
)
@@ -49,19 +50,34 @@ type Client interface {
AlphaUpload(arg *CommitInfoWithProperties, content io.Reader) (res *FileMetadata, err error)
// Copy : Copy a file or folder to a different location in the user's
// Dropbox. If the source path is a folder all its contents will be copied.
+ CopyV2(arg *RelocationArg) (res *RelocationResult, err error)
+ // Copy : Copy a file or folder to a different location in the user's
+ // Dropbox. If the source path is a folder all its contents will be copied.
// Deprecated: Use `CopyV2` instead
Copy(arg *RelocationArg) (res IsMetadata, err error)
// CopyBatch : Copy multiple files or folders to different locations at once
+ // in the user's Dropbox. This route will replace `copyBatch`. The main
+ // difference is this route will return stutus for each entry, while
+ // `copyBatch` raises failure if any entry fails. This route will either
+ // finish synchronously, or return a job ID and do the async copy job in
+ // background. Please use `copyBatchCheck` to check the job status.
+ CopyBatchV2(arg *RelocationBatchArgBase) (res *RelocationBatchV2Launch, err error)
+ // CopyBatch : Copy multiple files or folders to different locations at once
// in the user's Dropbox. If `RelocationBatchArg.allow_shared_folder` is
- // false, this route is atomic. If on entry failes, the whole transaction
- // will abort. If `RelocationBatchArg.allow_shared_folder` is true, not
- // atomicity is guaranteed, but you will be able to copy the contents of
+ // false, this route is atomic. If one entry fails, the whole transaction
+ // will abort. If `RelocationBatchArg.allow_shared_folder` is true,
+ // atomicity is not guaranteed, but it allows you to copy the contents of
// shared folders to new locations. This route will return job ID
// immediately and do the async copy job in background. Please use
// `copyBatchCheck` to check the job status.
+ // Deprecated: Use `CopyBatchV2` instead
CopyBatch(arg *RelocationBatchArg) (res *RelocationBatchLaunch, err error)
// CopyBatchCheck : Returns the status of an asynchronous job for
+ // `copyBatch`. It returns list of results for each entry.
+ CopyBatchCheckV2(arg *async.PollArg) (res *RelocationBatchV2JobStatus, err error)
+ // CopyBatchCheck : Returns the status of an asynchronous job for
// `copyBatch`. If success, it returns list of results for each entry.
+ // Deprecated: Use `CopyBatchCheckV2` instead
CopyBatchCheck(arg *async.PollArg) (res *RelocationBatchJobStatus, err error)
// CopyReferenceGet : Get a copy reference to a file or folder. This
// reference string can be used to save that file or folder to another
@@ -70,9 +86,8 @@ type Client interface {
// CopyReferenceSave : Save a copy reference returned by `copyReferenceGet`
// to the user's Dropbox.
CopyReferenceSave(arg *SaveCopyReferenceArg) (res *SaveCopyReferenceResult, err error)
- // CopyV2 : Copy a file or folder to a different location in the user's
- // Dropbox. If the source path is a folder all its contents will be copied.
- CopyV2(arg *RelocationArg) (res *RelocationResult, err error)
+ // CreateFolder : Create a folder at a given path.
+ CreateFolderV2(arg *CreateFolderArg) (res *CreateFolderResult, err error)
// CreateFolder : Create a folder at a given path.
// Deprecated: Use `CreateFolderV2` instead
CreateFolder(arg *CreateFolderArg) (res *FolderMetadata, err error)
@@ -88,8 +103,12 @@ type Client interface {
// `createFolderBatch`. If success, it returns list of result for each
// entry.
CreateFolderBatchCheck(arg *async.PollArg) (res *CreateFolderBatchJobStatus, err error)
- // CreateFolderV2 : Create a folder at a given path.
- CreateFolderV2(arg *CreateFolderArg) (res *CreateFolderResult, err error)
+ // Delete : Delete the file or folder at a given path. If the path is a
+ // folder, all its contents will be deleted too. A successful response
+ // indicates that the file or folder was deleted. The returned metadata will
+ // be the corresponding `FileMetadata` or `FolderMetadata` for the item at
+ // time of deletion, and not a `DeletedMetadata` object.
+ DeleteV2(arg *DeleteArg) (res *DeleteResult, err error)
// Delete : Delete the file or folder at a given path. If the path is a
// folder, all its contents will be deleted too. A successful response
// indicates that the file or folder was deleted. The returned metadata will
@@ -104,17 +123,12 @@ type Client interface {
// DeleteBatchCheck : Returns the status of an asynchronous job for
// `deleteBatch`. If success, it returns list of result for each entry.
DeleteBatchCheck(arg *async.PollArg) (res *DeleteBatchJobStatus, err error)
- // DeleteV2 : Delete the file or folder at a given path. If the path is a
- // folder, all its contents will be deleted too. A successful response
- // indicates that the file or folder was deleted. The returned metadata will
- // be the corresponding `FileMetadata` or `FolderMetadata` for the item at
- // time of deletion, and not a `DeletedMetadata` object.
- DeleteV2(arg *DeleteArg) (res *DeleteResult, err error)
// Download : Download a file from a user's Dropbox.
Download(arg *DownloadArg) (res *FileMetadata, content io.ReadCloser, err error)
// DownloadZip : Download a folder from the user's Dropbox, as a zip file.
- // The folder must be less than 1 GB in size and have fewer than 10,000
- // total files. The input cannot be a single file.
+ // The folder must be less than 20 GB in size and have fewer than 10,000
+ // total files. The input cannot be a single file. Any single file must be
+ // less than 4GB in size.
DownloadZip(arg *DownloadZipArg) (res *DownloadZipResult, content io.ReadCloser, err error)
// GetMetadata : Returns the metadata for a file or folder. Note: Metadata
// for the root folder is unsupported.
@@ -127,10 +141,41 @@ type Client interface {
// extension error.
GetPreview(arg *PreviewArg) (res *FileMetadata, content io.ReadCloser, err error)
// GetTemporaryLink : Get a temporary link to stream content of a file. This
- // link will expire in four hours and afterwards you will get 410 Gone.
+ // link will expire in four hours and afterwards you will get 410 Gone. So
+ // this URL should not be used to display content directly in the browser.
// Content-Type of the link is determined automatically by the file's mime
// type.
GetTemporaryLink(arg *GetTemporaryLinkArg) (res *GetTemporaryLinkResult, err error)
+ // GetTemporaryUploadLink : Get a one-time use temporary upload link to
+ // upload a file to a Dropbox location. This endpoint acts as a delayed
+ // `upload`. The returned temporary upload link may be used to make a POST
+ // request with the data to be uploaded. The upload will then be perfomed
+ // with the `CommitInfo` previously provided to `getTemporaryUploadLink` but
+ // evaluated only upon consumption. Hence, errors stemming from invalid
+ // `CommitInfo` with respect to the state of the user's Dropbox will only be
+ // communicated at consumption time. Additionally, these errors are surfaced
+ // as generic HTTP 409 Conflict responses, potentially hiding issue details.
+ // The maximum temporary upload link duration is 4 hours. Upon consumption
+ // or expiration, a new link will have to be generated. Multiple links may
+ // exist for a specific upload path at any given time. The POST request on
+ // the temporary upload link must have its Content-Type set to
+ // "application/octet-stream". Example temporary upload link consumption
+ // request: curl -X POST
+ // https://dl.dropboxusercontent.com/apitul/1/bNi2uIYF51cVBND --header
+ // "Content-Type: application/octet-stream" --data-binary @local_file.txt A
+ // successful temporary upload link consumption request returns the content
+ // hash of the uploaded data in JSON format. Example succesful temporary
+ // upload link consumption response: {"content-hash":
+ // "599d71033d700ac892a0e48fa61b125d2f5994"} An unsuccessful temporary
+ // upload link consumption request returns any of the following status
+ // codes: HTTP 400 Bad Request: Content-Type is not one of
+ // application/octet-stream and text/plain or request is invalid. HTTP 409
+ // Conflict: The temporary upload link does not exist or is currently
+ // unavailable, the upload failed, or another error happened. HTTP 410 Gone:
+ // The temporary upload link is expired or consumed. Example unsuccessful
+ // temporary upload link consumption response: Temporary upload link has
+ // been recently consumed.
+ GetTemporaryUploadLink(arg *GetTemporaryUploadLinkArg) (res *GetTemporaryUploadLinkResult, err error)
// GetThumbnail : Get a thumbnail for an image. This method currently
// supports files with the following file extensions: jpg, jpeg, png, tiff,
// tif, gif and bmp. Photos that are larger than 20MB in size won't be
@@ -194,20 +239,30 @@ type Client interface {
ListRevisions(arg *ListRevisionsArg) (res *ListRevisionsResult, err error)
// Move : Move a file or folder to a different location in the user's
// Dropbox. If the source path is a folder all its contents will be moved.
+ MoveV2(arg *RelocationArg) (res *RelocationResult, err error)
+ // Move : Move a file or folder to a different location in the user's
+ // Dropbox. If the source path is a folder all its contents will be moved.
// Deprecated: Use `MoveV2` instead
Move(arg *RelocationArg) (res IsMetadata, err error)
// MoveBatch : Move multiple files or folders to different locations at once
+ // in the user's Dropbox. This route will replace `moveBatch`. The main
+ // difference is this route will return stutus for each entry, while
+ // `moveBatch` raises failure if any entry fails. This route will either
+ // finish synchronously, or return a job ID and do the async move job in
+ // background. Please use `moveBatchCheck` to check the job status.
+ MoveBatchV2(arg *MoveBatchArg) (res *RelocationBatchV2Launch, err error)
+ // MoveBatch : Move multiple files or folders to different locations at once
// in the user's Dropbox. This route is 'all or nothing', which means if one
// entry fails, the whole transaction will abort. This route will return job
// ID immediately and do the async moving job in background. Please use
// `moveBatchCheck` to check the job status.
MoveBatch(arg *RelocationBatchArg) (res *RelocationBatchLaunch, err error)
// MoveBatchCheck : Returns the status of an asynchronous job for
+ // `moveBatch`. It returns list of results for each entry.
+ MoveBatchCheckV2(arg *async.PollArg) (res *RelocationBatchV2JobStatus, err error)
+ // MoveBatchCheck : Returns the status of an asynchronous job for
// `moveBatch`. If success, it returns list of results for each entry.
MoveBatchCheck(arg *async.PollArg) (res *RelocationBatchJobStatus, err error)
- // MoveV2 : Move a file or folder to a different location in the user's
- // Dropbox. If the source path is a folder all its contents will be moved.
- MoveV2(arg *RelocationArg) (res *RelocationResult, err error)
// PermanentlyDelete : Permanently delete the file or folder at a given path
// (see https://www.dropbox.com/en/help/40). Note: This endpoint is only
// available for Dropbox Business apps.
@@ -230,9 +285,11 @@ type Client interface {
// PropertiesUpdate : has no documentation (yet)
// Deprecated:
PropertiesUpdate(arg *file_properties.UpdatePropertiesArg) (err error)
- // Restore : Restore a file to a specific revision.
+ // Restore : Restore a specific revision of a file to the given path.
Restore(arg *RestoreArg) (res *FileMetadata, err error)
- // SaveUrl : Save a specified URL into a file in user's Dropbox. If the
+ // SaveUrl : Save the data from a specified URL into a file in user's
+ // Dropbox. Note that the transfer from the URL must complete within 5
+ // minutes, or the operation will time out and the job will fail. If the
// given path already exists, the file will be renamed to avoid the conflict
// (e.g. myfile (1).txt).
SaveUrl(arg *SaveUrlArg) (res *SaveUrlResult, err error)
@@ -244,37 +301,57 @@ type Client interface {
Search(arg *SearchArg) (res *SearchResult, err error)
// Upload : Create a new file with the contents provided in the request. Do
// not use this to upload a file larger than 150 MB. Instead, create an
- // upload session with `uploadSessionStart`.
+ // upload session with `uploadSessionStart`. 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>.
Upload(arg *CommitInfo, content io.Reader) (res *FileMetadata, err error)
+ // UploadSessionAppend : Append more data to an upload session. When the
+ // parameter close is set, this call will close the session. A single
+ // request should not upload more than 150 MB. The maximum size of a file
+ // one can upload to an upload session is 350 GB. 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>.
+ UploadSessionAppendV2(arg *UploadSessionAppendArg, content io.Reader) (err error)
// UploadSessionAppend : Append more data to an upload session. A single
// request should not upload more than 150 MB. The maximum size of a file
- // one can upload to an upload session is 350 GB.
+ // one can upload to an upload session is 350 GB. 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>.
// Deprecated: Use `UploadSessionAppendV2` instead
UploadSessionAppend(arg *UploadSessionCursor, content io.Reader) (err error)
- // UploadSessionAppendV2 : Append more data to an upload session. When the
- // parameter close is set, this call will close the session. A single
- // request should not upload more than 150 MB. The maximum size of a file
- // one can upload to an upload session is 350 GB.
- UploadSessionAppendV2(arg *UploadSessionAppendArg, content io.Reader) (err error)
// UploadSessionFinish : Finish an upload session and save the uploaded data
// to the given file path. A single request should not upload more than 150
// MB. The maximum size of a file one can upload to an upload session is 350
- // GB.
+ // GB. 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>.
UploadSessionFinish(arg *UploadSessionFinishArg, content io.Reader) (res *FileMetadata, err error)
// UploadSessionFinishBatch : This route helps you commit many files at once
- // into a user's Dropbox. Use `uploadSessionStart` and
- // `uploadSessionAppendV2` 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 `uploadSessionAppendV2`
- // call. The maximum size of a file one can upload to an upload session is
- // 350 GB. This route will return a job_id immediately and do the async
- // commit job in background. Use `uploadSessionFinishBatchCheck` to check
- // the job status. For the same account, this route should be executed
- // serially. That means you should not start the next job before current job
- // finishes. We allow up to 1000 entries in a single request.
+ // 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. The maximum size of a
+ // file one can upload to an upload session is 350 GB. This route will
+ // return a job_id immediately and do the async commit job in background.
+ // Use `uploadSessionFinishBatchCheck` to check the job status. For the same
+ // account, this route should be executed serially. That means you should
+ // not start the next job before current job finishes. 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>.
UploadSessionFinishBatch(arg *UploadSessionFinishBatchArg) (res *UploadSessionFinishBatchLaunch, err error)
// UploadSessionFinishBatchCheck : Returns the status of an asynchronous job
// for `uploadSessionFinishBatch`. If success, it returns list of result for
@@ -283,14 +360,18 @@ type Client interface {
// UploadSessionStart : Upload sessions allow you to upload a single file in
// one or more requests, for example where the size of the file is greater
// than 150 MB. This call starts a new upload session with the given data.
- // You can then use `uploadSessionAppendV2` to add more data and
+ // You can then use `uploadSessionAppend` to add more data and
// `uploadSessionFinish` to save all the data to a file in Dropbox. A single
// request should not upload more than 150 MB. The maximum size of a file
// one can upload to an upload session is 350 GB. An upload session can be
// used for a maximum of 48 hours. Attempting to use an
- // `UploadSessionStartResult.session_id` with `uploadSessionAppendV2` or
+ // `UploadSessionStartResult.session_id` with `uploadSessionAppend` or
// `uploadSessionFinish` more than 48 hours after its creation will return a
- // `UploadSessionLookupError.not_found`.
+ // `UploadSessionLookupError.not_found`. 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>.
UploadSessionStart(arg *UploadSessionStartArg, content io.Reader) (res *UploadSessionStartResult, err error)
}
@@ -339,7 +420,7 @@ func (dbx *apiImpl) AlphaGetMetadata(arg *AlphaGetMetadataArg) (res IsMetadata,
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
var tmp metadataUnion
err = json.Unmarshal(body, &tmp)
@@ -368,17 +449,11 @@ func (dbx *apiImpl) AlphaGetMetadata(arg *AlphaGetMetadataArg) (res IsMetadata,
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -426,7 +501,7 @@ func (dbx *apiImpl) AlphaUpload(arg *CommitInfoWithProperties, content io.Reader
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -444,17 +519,77 @@ func (dbx *apiImpl) AlphaUpload(arg *CommitInfoWithProperties, content io.Reader
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
+ if err != nil {
+ return
+ }
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
+ return
+}
+
+//CopyV2APIError is an error-wrapper for the copy route
+type CopyV2APIError struct {
+ dropbox.APIError
+ EndpointError *RelocationError `json:"error"`
+}
+
+func (dbx *apiImpl) CopyV2(arg *RelocationArg) (res *RelocationResult, err error) {
+ cli := dbx.Client
+
+ dbx.Config.LogDebug("arg: %v", arg)
+ b, err := json.Marshal(arg)
+ if err != nil {
+ return
+ }
+
+ headers := map[string]string{
+ "Content-Type": "application/json",
+ }
+ if dbx.Config.AsMemberID != "" {
+ headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
+ }
+
+ req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "copy", headers, bytes.NewReader(b))
+ if err != nil {
+ return
+ }
+ dbx.Config.LogInfo("req: %v", req)
+
+ resp, err := cli.Do(req)
+ if err != nil {
+ return
+ }
+
+ dbx.Config.LogInfo("resp: %v", resp)
+ defer resp.Body.Close()
+ body, err := ioutil.ReadAll(resp.Body)
+ if err != nil {
+ return
+ }
+
+ dbx.Config.LogDebug("body: %s", body)
+ if resp.StatusCode == http.StatusOK {
+ err = json.Unmarshal(body, &res)
+ if err != nil {
+ return
+ }
+
+ return
+ }
+ if resp.StatusCode == http.StatusConflict {
+ var apiError CopyAPIError
+ err = json.Unmarshal(body, &apiError)
+ if err != nil {
+ return
+ }
err = apiError
return
}
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -466,7 +601,7 @@ type CopyAPIError struct {
func (dbx *apiImpl) Copy(arg *RelocationArg) (res IsMetadata, err error) {
log.Printf("WARNING: API `Copy` is deprecated")
- log.Printf("Use API `CopyV2` instead")
+ log.Printf("Use API `Copy` instead")
cli := dbx.Client
@@ -501,7 +636,7 @@ func (dbx *apiImpl) Copy(arg *RelocationArg) (res IsMetadata, err error) {
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
var tmp metadataUnion
err = json.Unmarshal(body, &tmp)
@@ -530,17 +665,77 @@ func (dbx *apiImpl) Copy(arg *RelocationArg) (res IsMetadata, err error) {
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
+ if err != nil {
+ return
+ }
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
+ return
+}
+
+//CopyBatchV2APIError is an error-wrapper for the copy_batch route
+type CopyBatchV2APIError struct {
+ dropbox.APIError
+ EndpointError struct{} `json:"error"`
+}
+
+func (dbx *apiImpl) CopyBatchV2(arg *RelocationBatchArgBase) (res *RelocationBatchV2Launch, err error) {
+ cli := dbx.Client
+
+ dbx.Config.LogDebug("arg: %v", arg)
+ b, err := json.Marshal(arg)
+ if err != nil {
+ return
+ }
+
+ headers := map[string]string{
+ "Content-Type": "application/json",
+ }
+ if dbx.Config.AsMemberID != "" {
+ headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
+ }
+
+ req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "copy_batch", headers, bytes.NewReader(b))
+ if err != nil {
+ return
+ }
+ dbx.Config.LogInfo("req: %v", req)
+
+ resp, err := cli.Do(req)
+ if err != nil {
+ return
+ }
+
+ dbx.Config.LogInfo("resp: %v", resp)
+ defer resp.Body.Close()
+ body, err := ioutil.ReadAll(resp.Body)
+ if err != nil {
+ return
+ }
+
+ dbx.Config.LogDebug("body: %s", body)
+ if resp.StatusCode == http.StatusOK {
+ err = json.Unmarshal(body, &res)
+ if err != nil {
+ return
+ }
+
+ return
+ }
+ if resp.StatusCode == http.StatusConflict {
+ var apiError CopyBatchAPIError
+ err = json.Unmarshal(body, &apiError)
+ if err != nil {
+ return
+ }
err = apiError
return
}
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -551,6 +746,9 @@ type CopyBatchAPIError struct {
}
func (dbx *apiImpl) CopyBatch(arg *RelocationBatchArg) (res *RelocationBatchLaunch, err error) {
+ log.Printf("WARNING: API `CopyBatch` is deprecated")
+ log.Printf("Use API `CopyBatch` instead")
+
cli := dbx.Client
dbx.Config.LogDebug("arg: %v", arg)
@@ -584,7 +782,7 @@ func (dbx *apiImpl) CopyBatch(arg *RelocationBatchArg) (res *RelocationBatchLaun
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -602,17 +800,77 @@ func (dbx *apiImpl) CopyBatch(arg *RelocationBatchArg) (res *RelocationBatchLaun
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
+ if err != nil {
+ return
+ }
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
+ return
+}
+
+//CopyBatchCheckV2APIError is an error-wrapper for the copy_batch/check route
+type CopyBatchCheckV2APIError struct {
+ dropbox.APIError
+ EndpointError *async.PollError `json:"error"`
+}
+
+func (dbx *apiImpl) CopyBatchCheckV2(arg *async.PollArg) (res *RelocationBatchV2JobStatus, err error) {
+ cli := dbx.Client
+
+ dbx.Config.LogDebug("arg: %v", arg)
+ b, err := json.Marshal(arg)
+ if err != nil {
+ return
+ }
+
+ headers := map[string]string{
+ "Content-Type": "application/json",
+ }
+ if dbx.Config.AsMemberID != "" {
+ headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
+ }
+
+ req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "copy_batch/check", headers, bytes.NewReader(b))
+ if err != nil {
+ return
+ }
+ dbx.Config.LogInfo("req: %v", req)
+
+ resp, err := cli.Do(req)
+ if err != nil {
+ return
+ }
+
+ dbx.Config.LogInfo("resp: %v", resp)
+ defer resp.Body.Close()
+ body, err := ioutil.ReadAll(resp.Body)
+ if err != nil {
+ return
+ }
+
+ dbx.Config.LogDebug("body: %s", body)
+ if resp.StatusCode == http.StatusOK {
+ err = json.Unmarshal(body, &res)
+ if err != nil {
+ return
+ }
+
+ return
+ }
+ if resp.StatusCode == http.StatusConflict {
+ var apiError CopyBatchCheckAPIError
+ err = json.Unmarshal(body, &apiError)
+ if err != nil {
+ return
+ }
err = apiError
return
}
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -623,6 +881,9 @@ type CopyBatchCheckAPIError struct {
}
func (dbx *apiImpl) CopyBatchCheck(arg *async.PollArg) (res *RelocationBatchJobStatus, err error) {
+ log.Printf("WARNING: API `CopyBatchCheck` is deprecated")
+ log.Printf("Use API `CopyBatchCheck` instead")
+
cli := dbx.Client
dbx.Config.LogDebug("arg: %v", arg)
@@ -656,7 +917,7 @@ func (dbx *apiImpl) CopyBatchCheck(arg *async.PollArg) (res *RelocationBatchJobS
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -674,17 +935,11 @@ func (dbx *apiImpl) CopyBatchCheck(arg *async.PollArg) (res *RelocationBatchJobS
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -728,7 +983,7 @@ func (dbx *apiImpl) CopyReferenceGet(arg *GetCopyReferenceArg) (res *GetCopyRefe
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -746,17 +1001,11 @@ func (dbx *apiImpl) CopyReferenceGet(arg *GetCopyReferenceArg) (res *GetCopyRefe
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -800,7 +1049,7 @@ func (dbx *apiImpl) CopyReferenceSave(arg *SaveCopyReferenceArg) (res *SaveCopyR
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -818,27 +1067,21 @@ func (dbx *apiImpl) CopyReferenceSave(arg *SaveCopyReferenceArg) (res *SaveCopyR
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
-//CopyV2APIError is an error-wrapper for the copy_v2 route
-type CopyV2APIError struct {
+//CreateFolderV2APIError is an error-wrapper for the create_folder route
+type CreateFolderV2APIError struct {
dropbox.APIError
- EndpointError *RelocationError `json:"error"`
+ EndpointError *CreateFolderError `json:"error"`
}
-func (dbx *apiImpl) CopyV2(arg *RelocationArg) (res *RelocationResult, err error) {
+func (dbx *apiImpl) CreateFolderV2(arg *CreateFolderArg) (res *CreateFolderResult, err error) {
cli := dbx.Client
dbx.Config.LogDebug("arg: %v", arg)
@@ -854,7 +1097,7 @@ func (dbx *apiImpl) CopyV2(arg *RelocationArg) (res *RelocationResult, err error
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
}
- req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "copy_v2", headers, bytes.NewReader(b))
+ req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "create_folder", headers, bytes.NewReader(b))
if err != nil {
return
}
@@ -872,7 +1115,7 @@ func (dbx *apiImpl) CopyV2(arg *RelocationArg) (res *RelocationResult, err error
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -882,7 +1125,7 @@ func (dbx *apiImpl) CopyV2(arg *RelocationArg) (res *RelocationResult, err error
return
}
if resp.StatusCode == http.StatusConflict {
- var apiError CopyV2APIError
+ var apiError CreateFolderAPIError
err = json.Unmarshal(body, &apiError)
if err != nil {
return
@@ -890,17 +1133,11 @@ func (dbx *apiImpl) CopyV2(arg *RelocationArg) (res *RelocationResult, err error
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -912,7 +1149,7 @@ type CreateFolderAPIError struct {
func (dbx *apiImpl) CreateFolder(arg *CreateFolderArg) (res *FolderMetadata, err error) {
log.Printf("WARNING: API `CreateFolder` is deprecated")
- log.Printf("Use API `CreateFolderV2` instead")
+ log.Printf("Use API `CreateFolder` instead")
cli := dbx.Client
@@ -947,7 +1184,7 @@ func (dbx *apiImpl) CreateFolder(arg *CreateFolderArg) (res *FolderMetadata, err
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -965,17 +1202,11 @@ func (dbx *apiImpl) CreateFolder(arg *CreateFolderArg) (res *FolderMetadata, err
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1019,7 +1250,7 @@ func (dbx *apiImpl) CreateFolderBatch(arg *CreateFolderBatchArg) (res *CreateFol
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1037,17 +1268,11 @@ func (dbx *apiImpl) CreateFolderBatch(arg *CreateFolderBatchArg) (res *CreateFol
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1091,7 +1316,7 @@ func (dbx *apiImpl) CreateFolderBatchCheck(arg *async.PollArg) (res *CreateFolde
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1109,27 +1334,21 @@ func (dbx *apiImpl) CreateFolderBatchCheck(arg *async.PollArg) (res *CreateFolde
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
-//CreateFolderV2APIError is an error-wrapper for the create_folder_v2 route
-type CreateFolderV2APIError struct {
+//DeleteV2APIError is an error-wrapper for the delete route
+type DeleteV2APIError struct {
dropbox.APIError
- EndpointError *CreateFolderError `json:"error"`
+ EndpointError *DeleteError `json:"error"`
}
-func (dbx *apiImpl) CreateFolderV2(arg *CreateFolderArg) (res *CreateFolderResult, err error) {
+func (dbx *apiImpl) DeleteV2(arg *DeleteArg) (res *DeleteResult, err error) {
cli := dbx.Client
dbx.Config.LogDebug("arg: %v", arg)
@@ -1145,7 +1364,7 @@ func (dbx *apiImpl) CreateFolderV2(arg *CreateFolderArg) (res *CreateFolderResul
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
}
- req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "create_folder_v2", headers, bytes.NewReader(b))
+ req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "delete", headers, bytes.NewReader(b))
if err != nil {
return
}
@@ -1163,7 +1382,7 @@ func (dbx *apiImpl) CreateFolderV2(arg *CreateFolderArg) (res *CreateFolderResul
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1173,7 +1392,7 @@ func (dbx *apiImpl) CreateFolderV2(arg *CreateFolderArg) (res *CreateFolderResul
return
}
if resp.StatusCode == http.StatusConflict {
- var apiError CreateFolderV2APIError
+ var apiError DeleteAPIError
err = json.Unmarshal(body, &apiError)
if err != nil {
return
@@ -1181,17 +1400,11 @@ func (dbx *apiImpl) CreateFolderV2(arg *CreateFolderArg) (res *CreateFolderResul
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1203,7 +1416,7 @@ type DeleteAPIError struct {
func (dbx *apiImpl) Delete(arg *DeleteArg) (res IsMetadata, err error) {
log.Printf("WARNING: API `Delete` is deprecated")
- log.Printf("Use API `DeleteV2` instead")
+ log.Printf("Use API `Delete` instead")
cli := dbx.Client
@@ -1238,7 +1451,7 @@ func (dbx *apiImpl) Delete(arg *DeleteArg) (res IsMetadata, err error) {
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
var tmp metadataUnion
err = json.Unmarshal(body, &tmp)
@@ -1267,17 +1480,11 @@ func (dbx *apiImpl) Delete(arg *DeleteArg) (res IsMetadata, err error) {
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1321,7 +1528,7 @@ func (dbx *apiImpl) DeleteBatch(arg *DeleteBatchArg) (res *DeleteBatchLaunch, er
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1339,17 +1546,11 @@ func (dbx *apiImpl) DeleteBatch(arg *DeleteBatchArg) (res *DeleteBatchLaunch, er
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1393,7 +1594,7 @@ func (dbx *apiImpl) DeleteBatchCheck(arg *async.PollArg) (res *DeleteBatchJobSta
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1411,89 +1612,11 @@ func (dbx *apiImpl) DeleteBatchCheck(arg *async.PollArg) (res *DeleteBatchJobSta
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
- if err != nil {
- return
- }
- err = apiError
- return
-}
-
-//DeleteV2APIError is an error-wrapper for the delete_v2 route
-type DeleteV2APIError struct {
- dropbox.APIError
- EndpointError *DeleteError `json:"error"`
-}
-
-func (dbx *apiImpl) DeleteV2(arg *DeleteArg) (res *DeleteResult, err error) {
- cli := dbx.Client
-
- dbx.Config.LogDebug("arg: %v", arg)
- b, err := json.Marshal(arg)
- if err != nil {
- return
- }
-
- headers := map[string]string{
- "Content-Type": "application/json",
- }
- if dbx.Config.AsMemberID != "" {
- headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
- }
-
- req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "delete_v2", headers, bytes.NewReader(b))
- if err != nil {
- return
- }
- dbx.Config.LogInfo("req: %v", req)
-
- resp, err := cli.Do(req)
- if err != nil {
- return
- }
-
- dbx.Config.LogInfo("resp: %v", resp)
- defer resp.Body.Close()
- body, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- return
- }
-
- dbx.Config.LogDebug("body: %v", body)
- if resp.StatusCode == http.StatusOK {
- err = json.Unmarshal(body, &res)
- if err != nil {
- return
- }
-
- return
- }
- if resp.StatusCode == http.StatusConflict {
- var apiError DeleteV2APIError
- err = json.Unmarshal(body, &apiError)
- if err != nil {
- return
- }
- err = apiError
- return
- }
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1536,7 +1659,7 @@ func (dbx *apiImpl) Download(arg *DownloadArg) (res *FileMetadata, content io.Re
dbx.Config.LogInfo("resp: %v", resp)
body := []byte(resp.Header.Get("Dropbox-API-Result"))
content = resp.Body
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusPartialContent {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1559,17 +1682,11 @@ func (dbx *apiImpl) Download(arg *DownloadArg) (res *FileMetadata, content io.Re
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1609,7 +1726,7 @@ func (dbx *apiImpl) DownloadZip(arg *DownloadZipArg) (res *DownloadZipResult, co
dbx.Config.LogInfo("resp: %v", resp)
body := []byte(resp.Header.Get("Dropbox-API-Result"))
content = resp.Body
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1632,17 +1749,11 @@ func (dbx *apiImpl) DownloadZip(arg *DownloadZipArg) (res *DownloadZipResult, co
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1686,7 +1797,7 @@ func (dbx *apiImpl) GetMetadata(arg *GetMetadataArg) (res IsMetadata, err error)
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
var tmp metadataUnion
err = json.Unmarshal(body, &tmp)
@@ -1715,17 +1826,11 @@ func (dbx *apiImpl) GetMetadata(arg *GetMetadataArg) (res IsMetadata, err error)
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1751,7 +1856,74 @@ func (dbx *apiImpl) GetPreview(arg *PreviewArg) (res *FileMetadata, content io.R
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
}
- req, err := (*dropbox.Context)(dbx).NewRequest("content", "download", true, "files", "get_preview", headers, nil)
+ req, err := (*dropbox.Context)(dbx).NewRequest("content", "download", true, "files", "get_preview", headers, nil)
+ if err != nil {
+ return
+ }
+ dbx.Config.LogInfo("req: %v", req)
+
+ resp, err := cli.Do(req)
+ if err != nil {
+ return
+ }
+
+ dbx.Config.LogInfo("resp: %v", resp)
+ body := []byte(resp.Header.Get("Dropbox-API-Result"))
+ content = resp.Body
+ dbx.Config.LogDebug("body: %s", body)
+ if resp.StatusCode == http.StatusOK {
+ err = json.Unmarshal(body, &res)
+ if err != nil {
+ return
+ }
+
+ return
+ }
+ if resp.StatusCode == http.StatusConflict {
+ defer resp.Body.Close()
+ body, err = ioutil.ReadAll(resp.Body)
+ if err != nil {
+ return
+ }
+ var apiError GetPreviewAPIError
+ err = json.Unmarshal(body, &apiError)
+ if err != nil {
+ return
+ }
+ err = apiError
+ return
+ }
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
+ if err != nil {
+ return
+ }
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
+ return
+}
+
+//GetTemporaryLinkAPIError is an error-wrapper for the get_temporary_link route
+type GetTemporaryLinkAPIError struct {
+ dropbox.APIError
+ EndpointError *GetTemporaryLinkError `json:"error"`
+}
+
+func (dbx *apiImpl) GetTemporaryLink(arg *GetTemporaryLinkArg) (res *GetTemporaryLinkResult, err error) {
+ cli := dbx.Client
+
+ dbx.Config.LogDebug("arg: %v", arg)
+ b, err := json.Marshal(arg)
+ if err != nil {
+ return
+ }
+
+ headers := map[string]string{
+ "Content-Type": "application/json",
+ }
+ if dbx.Config.AsMemberID != "" {
+ headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
+ }
+
+ req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "get_temporary_link", headers, bytes.NewReader(b))
if err != nil {
return
}
@@ -1763,9 +1935,13 @@ func (dbx *apiImpl) GetPreview(arg *PreviewArg) (res *FileMetadata, content io.R
}
dbx.Config.LogInfo("resp: %v", resp)
- body := []byte(resp.Header.Get("Dropbox-API-Result"))
- content = resp.Body
- dbx.Config.LogDebug("body: %v", body)
+ defer resp.Body.Close()
+ body, err := ioutil.ReadAll(resp.Body)
+ if err != nil {
+ return
+ }
+
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1775,12 +1951,7 @@ func (dbx *apiImpl) GetPreview(arg *PreviewArg) (res *FileMetadata, content io.R
return
}
if resp.StatusCode == http.StatusConflict {
- defer resp.Body.Close()
- body, err = ioutil.ReadAll(resp.Body)
- if err != nil {
- return
- }
- var apiError GetPreviewAPIError
+ var apiError GetTemporaryLinkAPIError
err = json.Unmarshal(body, &apiError)
if err != nil {
return
@@ -1788,27 +1959,21 @@ func (dbx *apiImpl) GetPreview(arg *PreviewArg) (res *FileMetadata, content io.R
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
-//GetTemporaryLinkAPIError is an error-wrapper for the get_temporary_link route
-type GetTemporaryLinkAPIError struct {
+//GetTemporaryUploadLinkAPIError is an error-wrapper for the get_temporary_upload_link route
+type GetTemporaryUploadLinkAPIError struct {
dropbox.APIError
- EndpointError *GetTemporaryLinkError `json:"error"`
+ EndpointError struct{} `json:"error"`
}
-func (dbx *apiImpl) GetTemporaryLink(arg *GetTemporaryLinkArg) (res *GetTemporaryLinkResult, err error) {
+func (dbx *apiImpl) GetTemporaryUploadLink(arg *GetTemporaryUploadLinkArg) (res *GetTemporaryUploadLinkResult, err error) {
cli := dbx.Client
dbx.Config.LogDebug("arg: %v", arg)
@@ -1824,7 +1989,7 @@ func (dbx *apiImpl) GetTemporaryLink(arg *GetTemporaryLinkArg) (res *GetTemporar
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
}
- req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "get_temporary_link", headers, bytes.NewReader(b))
+ req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "get_temporary_upload_link", headers, bytes.NewReader(b))
if err != nil {
return
}
@@ -1842,7 +2007,7 @@ func (dbx *apiImpl) GetTemporaryLink(arg *GetTemporaryLinkArg) (res *GetTemporar
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1852,7 +2017,7 @@ func (dbx *apiImpl) GetTemporaryLink(arg *GetTemporaryLinkArg) (res *GetTemporar
return
}
if resp.StatusCode == http.StatusConflict {
- var apiError GetTemporaryLinkAPIError
+ var apiError GetTemporaryUploadLinkAPIError
err = json.Unmarshal(body, &apiError)
if err != nil {
return
@@ -1860,17 +2025,11 @@ func (dbx *apiImpl) GetTemporaryLink(arg *GetTemporaryLinkArg) (res *GetTemporar
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1910,7 +2069,7 @@ func (dbx *apiImpl) GetThumbnail(arg *ThumbnailArg) (res *FileMetadata, content
dbx.Config.LogInfo("resp: %v", resp)
body := []byte(resp.Header.Get("Dropbox-API-Result"))
content = resp.Body
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1933,17 +2092,11 @@ func (dbx *apiImpl) GetThumbnail(arg *ThumbnailArg) (res *FileMetadata, content
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1987,7 +2140,7 @@ func (dbx *apiImpl) GetThumbnailBatch(arg *GetThumbnailBatchArg) (res *GetThumbn
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2005,17 +2158,11 @@ func (dbx *apiImpl) GetThumbnailBatch(arg *GetThumbnailBatchArg) (res *GetThumbn
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2059,7 +2206,7 @@ func (dbx *apiImpl) ListFolder(arg *ListFolderArg) (res *ListFolderResult, err e
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2077,17 +2224,11 @@ func (dbx *apiImpl) ListFolder(arg *ListFolderArg) (res *ListFolderResult, err e
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2131,7 +2272,7 @@ func (dbx *apiImpl) ListFolderContinue(arg *ListFolderContinueArg) (res *ListFol
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2149,17 +2290,11 @@ func (dbx *apiImpl) ListFolderContinue(arg *ListFolderContinueArg) (res *ListFol
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2203,7 +2338,7 @@ func (dbx *apiImpl) ListFolderGetLatestCursor(arg *ListFolderArg) (res *ListFold
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2221,17 +2356,11 @@ func (dbx *apiImpl) ListFolderGetLatestCursor(arg *ListFolderArg) (res *ListFold
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2272,7 +2401,7 @@ func (dbx *apiImpl) ListFolderLongpoll(arg *ListFolderLongpollArg) (res *ListFol
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2290,17 +2419,11 @@ func (dbx *apiImpl) ListFolderLongpoll(arg *ListFolderLongpollArg) (res *ListFol
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2344,7 +2467,7 @@ func (dbx *apiImpl) ListRevisions(arg *ListRevisionsArg) (res *ListRevisionsResu
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2362,17 +2485,77 @@ func (dbx *apiImpl) ListRevisions(arg *ListRevisionsArg) (res *ListRevisionsResu
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
+ if err != nil {
+ return
+ }
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
+ return
+}
+
+//MoveV2APIError is an error-wrapper for the move route
+type MoveV2APIError struct {
+ dropbox.APIError
+ EndpointError *RelocationError `json:"error"`
+}
+
+func (dbx *apiImpl) MoveV2(arg *RelocationArg) (res *RelocationResult, err error) {
+ cli := dbx.Client
+
+ dbx.Config.LogDebug("arg: %v", arg)
+ b, err := json.Marshal(arg)
+ if err != nil {
+ return
+ }
+
+ headers := map[string]string{
+ "Content-Type": "application/json",
+ }
+ if dbx.Config.AsMemberID != "" {
+ headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
+ }
+
+ req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "move", headers, bytes.NewReader(b))
+ if err != nil {
+ return
+ }
+ dbx.Config.LogInfo("req: %v", req)
+
+ resp, err := cli.Do(req)
+ if err != nil {
+ return
+ }
+
+ dbx.Config.LogInfo("resp: %v", resp)
+ defer resp.Body.Close()
+ body, err := ioutil.ReadAll(resp.Body)
+ if err != nil {
+ return
+ }
+
+ dbx.Config.LogDebug("body: %s", body)
+ if resp.StatusCode == http.StatusOK {
+ err = json.Unmarshal(body, &res)
+ if err != nil {
+ return
+ }
+
+ return
+ }
+ if resp.StatusCode == http.StatusConflict {
+ var apiError MoveAPIError
+ err = json.Unmarshal(body, &apiError)
+ if err != nil {
+ return
+ }
err = apiError
return
}
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2384,7 +2567,7 @@ type MoveAPIError struct {
func (dbx *apiImpl) Move(arg *RelocationArg) (res IsMetadata, err error) {
log.Printf("WARNING: API `Move` is deprecated")
- log.Printf("Use API `MoveV2` instead")
+ log.Printf("Use API `Move` instead")
cli := dbx.Client
@@ -2419,7 +2602,7 @@ func (dbx *apiImpl) Move(arg *RelocationArg) (res IsMetadata, err error) {
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
var tmp metadataUnion
err = json.Unmarshal(body, &tmp)
@@ -2448,17 +2631,77 @@ func (dbx *apiImpl) Move(arg *RelocationArg) (res IsMetadata, err error) {
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
+ if err != nil {
+ return
+ }
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
+ return
+}
+
+//MoveBatchV2APIError is an error-wrapper for the move_batch route
+type MoveBatchV2APIError struct {
+ dropbox.APIError
+ EndpointError struct{} `json:"error"`
+}
+
+func (dbx *apiImpl) MoveBatchV2(arg *MoveBatchArg) (res *RelocationBatchV2Launch, err error) {
+ cli := dbx.Client
+
+ dbx.Config.LogDebug("arg: %v", arg)
+ b, err := json.Marshal(arg)
+ if err != nil {
+ return
+ }
+
+ headers := map[string]string{
+ "Content-Type": "application/json",
+ }
+ if dbx.Config.AsMemberID != "" {
+ headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
+ }
+
+ req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "move_batch", headers, bytes.NewReader(b))
+ if err != nil {
+ return
+ }
+ dbx.Config.LogInfo("req: %v", req)
+
+ resp, err := cli.Do(req)
+ if err != nil {
+ return
+ }
+
+ dbx.Config.LogInfo("resp: %v", resp)
+ defer resp.Body.Close()
+ body, err := ioutil.ReadAll(resp.Body)
+ if err != nil {
+ return
+ }
+
+ dbx.Config.LogDebug("body: %s", body)
+ if resp.StatusCode == http.StatusOK {
+ err = json.Unmarshal(body, &res)
+ if err != nil {
+ return
+ }
+
+ return
+ }
+ if resp.StatusCode == http.StatusConflict {
+ var apiError MoveBatchAPIError
+ err = json.Unmarshal(body, &apiError)
+ if err != nil {
+ return
+ }
err = apiError
return
}
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2502,7 +2745,7 @@ func (dbx *apiImpl) MoveBatch(arg *RelocationBatchArg) (res *RelocationBatchLaun
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2520,27 +2763,21 @@ func (dbx *apiImpl) MoveBatch(arg *RelocationBatchArg) (res *RelocationBatchLaun
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
-//MoveBatchCheckAPIError is an error-wrapper for the move_batch/check route
-type MoveBatchCheckAPIError struct {
+//MoveBatchCheckV2APIError is an error-wrapper for the move_batch/check route
+type MoveBatchCheckV2APIError struct {
dropbox.APIError
EndpointError *async.PollError `json:"error"`
}
-func (dbx *apiImpl) MoveBatchCheck(arg *async.PollArg) (res *RelocationBatchJobStatus, err error) {
+func (dbx *apiImpl) MoveBatchCheckV2(arg *async.PollArg) (res *RelocationBatchV2JobStatus, err error) {
cli := dbx.Client
dbx.Config.LogDebug("arg: %v", arg)
@@ -2574,7 +2811,7 @@ func (dbx *apiImpl) MoveBatchCheck(arg *async.PollArg) (res *RelocationBatchJobS
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2592,27 +2829,21 @@ func (dbx *apiImpl) MoveBatchCheck(arg *async.PollArg) (res *RelocationBatchJobS
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
-//MoveV2APIError is an error-wrapper for the move_v2 route
-type MoveV2APIError struct {
+//MoveBatchCheckAPIError is an error-wrapper for the move_batch/check route
+type MoveBatchCheckAPIError struct {
dropbox.APIError
- EndpointError *RelocationError `json:"error"`
+ EndpointError *async.PollError `json:"error"`
}
-func (dbx *apiImpl) MoveV2(arg *RelocationArg) (res *RelocationResult, err error) {
+func (dbx *apiImpl) MoveBatchCheck(arg *async.PollArg) (res *RelocationBatchJobStatus, err error) {
cli := dbx.Client
dbx.Config.LogDebug("arg: %v", arg)
@@ -2628,7 +2859,7 @@ func (dbx *apiImpl) MoveV2(arg *RelocationArg) (res *RelocationResult, err error
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
}
- req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "move_v2", headers, bytes.NewReader(b))
+ req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "files", "move_batch/check", headers, bytes.NewReader(b))
if err != nil {
return
}
@@ -2646,7 +2877,7 @@ func (dbx *apiImpl) MoveV2(arg *RelocationArg) (res *RelocationResult, err error
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2656,7 +2887,7 @@ func (dbx *apiImpl) MoveV2(arg *RelocationArg) (res *RelocationResult, err error
return
}
if resp.StatusCode == http.StatusConflict {
- var apiError MoveV2APIError
+ var apiError MoveBatchCheckAPIError
err = json.Unmarshal(body, &apiError)
if err != nil {
return
@@ -2664,17 +2895,11 @@ func (dbx *apiImpl) MoveV2(arg *RelocationArg) (res *RelocationResult, err error
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2718,7 +2943,7 @@ func (dbx *apiImpl) PermanentlyDelete(arg *DeleteArg) (err error) {
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -2731,17 +2956,11 @@ func (dbx *apiImpl) PermanentlyDelete(arg *DeleteArg) (err error) {
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2787,7 +3006,7 @@ func (dbx *apiImpl) PropertiesAdd(arg *file_properties.AddPropertiesArg) (err er
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -2800,17 +3019,11 @@ func (dbx *apiImpl) PropertiesAdd(arg *file_properties.AddPropertiesArg) (err er
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2856,7 +3069,7 @@ func (dbx *apiImpl) PropertiesOverwrite(arg *file_properties.OverwritePropertyGr
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -2869,17 +3082,11 @@ func (dbx *apiImpl) PropertiesOverwrite(arg *file_properties.OverwritePropertyGr
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2925,7 +3132,7 @@ func (dbx *apiImpl) PropertiesRemove(arg *file_properties.RemovePropertiesArg) (
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -2938,17 +3145,11 @@ func (dbx *apiImpl) PropertiesRemove(arg *file_properties.RemovePropertiesArg) (
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2994,7 +3195,7 @@ func (dbx *apiImpl) PropertiesTemplateGet(arg *file_properties.GetTemplateArg) (
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3012,17 +3213,11 @@ func (dbx *apiImpl) PropertiesTemplateGet(arg *file_properties.GetTemplateArg) (
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3060,7 +3255,7 @@ func (dbx *apiImpl) PropertiesTemplateList() (res *file_properties.ListTemplateR
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3078,17 +3273,11 @@ func (dbx *apiImpl) PropertiesTemplateList() (res *file_properties.ListTemplateR
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3134,7 +3323,7 @@ func (dbx *apiImpl) PropertiesUpdate(arg *file_properties.UpdatePropertiesArg) (
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -3147,17 +3336,11 @@ func (dbx *apiImpl) PropertiesUpdate(arg *file_properties.UpdatePropertiesArg) (
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3201,7 +3384,7 @@ func (dbx *apiImpl) Restore(arg *RestoreArg) (res *FileMetadata, err error) {
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3219,17 +3402,11 @@ func (dbx *apiImpl) Restore(arg *RestoreArg) (res *FileMetadata, err error) {
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3273,7 +3450,7 @@ func (dbx *apiImpl) SaveUrl(arg *SaveUrlArg) (res *SaveUrlResult, err error) {
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3291,17 +3468,11 @@ func (dbx *apiImpl) SaveUrl(arg *SaveUrlArg) (res *SaveUrlResult, err error) {
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3345,7 +3516,7 @@ func (dbx *apiImpl) SaveUrlCheckJobStatus(arg *async.PollArg) (res *SaveUrlJobSt
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3363,17 +3534,11 @@ func (dbx *apiImpl) SaveUrlCheckJobStatus(arg *async.PollArg) (res *SaveUrlJobSt
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3417,7 +3582,7 @@ func (dbx *apiImpl) Search(arg *SearchArg) (res *SearchResult, err error) {
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3435,17 +3600,11 @@ func (dbx *apiImpl) Search(arg *SearchArg) (res *SearchResult, err error) {
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3490,7 +3649,7 @@ func (dbx *apiImpl) Upload(arg *CommitInfo, content io.Reader) (res *FileMetadat
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3508,30 +3667,21 @@ func (dbx *apiImpl) Upload(arg *CommitInfo, content io.Reader) (res *FileMetadat
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
-//UploadSessionAppendAPIError is an error-wrapper for the upload_session/append route
-type UploadSessionAppendAPIError struct {
+//UploadSessionAppendV2APIError is an error-wrapper for the upload_session/append route
+type UploadSessionAppendV2APIError struct {
dropbox.APIError
EndpointError *UploadSessionLookupError `json:"error"`
}
-func (dbx *apiImpl) UploadSessionAppend(arg *UploadSessionCursor, content io.Reader) (err error) {
- log.Printf("WARNING: API `UploadSessionAppend` is deprecated")
- log.Printf("Use API `UploadSessionAppendV2` instead")
-
+func (dbx *apiImpl) UploadSessionAppendV2(arg *UploadSessionAppendArg, content io.Reader) (err error) {
cli := dbx.Client
dbx.Config.LogDebug("arg: %v", arg)
@@ -3566,7 +3716,7 @@ func (dbx *apiImpl) UploadSessionAppend(arg *UploadSessionCursor, content io.Rea
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -3579,27 +3729,24 @@ func (dbx *apiImpl) UploadSessionAppend(arg *UploadSessionCursor, content io.Rea
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
-//UploadSessionAppendV2APIError is an error-wrapper for the upload_session/append_v2 route
-type UploadSessionAppendV2APIError struct {
+//UploadSessionAppendAPIError is an error-wrapper for the upload_session/append route
+type UploadSessionAppendAPIError struct {
dropbox.APIError
EndpointError *UploadSessionLookupError `json:"error"`
}
-func (dbx *apiImpl) UploadSessionAppendV2(arg *UploadSessionAppendArg, content io.Reader) (err error) {
+func (dbx *apiImpl) UploadSessionAppend(arg *UploadSessionCursor, content io.Reader) (err error) {
+ log.Printf("WARNING: API `UploadSessionAppend` is deprecated")
+ log.Printf("Use API `UploadSessionAppend` instead")
+
cli := dbx.Client
dbx.Config.LogDebug("arg: %v", arg)
@@ -3616,7 +3763,7 @@ func (dbx *apiImpl) UploadSessionAppendV2(arg *UploadSessionAppendArg, content i
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
}
- req, err := (*dropbox.Context)(dbx).NewRequest("content", "upload", true, "files", "upload_session/append_v2", headers, content)
+ req, err := (*dropbox.Context)(dbx).NewRequest("content", "upload", true, "files", "upload_session/append", headers, content)
if err != nil {
return
}
@@ -3634,12 +3781,12 @@ func (dbx *apiImpl) UploadSessionAppendV2(arg *UploadSessionAppendArg, content i
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
if resp.StatusCode == http.StatusConflict {
- var apiError UploadSessionAppendV2APIError
+ var apiError UploadSessionAppendAPIError
err = json.Unmarshal(body, &apiError)
if err != nil {
return
@@ -3647,17 +3794,11 @@ func (dbx *apiImpl) UploadSessionAppendV2(arg *UploadSessionAppendArg, content i
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3702,7 +3843,7 @@ func (dbx *apiImpl) UploadSessionFinish(arg *UploadSessionFinishArg, content io.
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3720,17 +3861,11 @@ func (dbx *apiImpl) UploadSessionFinish(arg *UploadSessionFinishArg, content io.
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3774,7 +3909,7 @@ func (dbx *apiImpl) UploadSessionFinishBatch(arg *UploadSessionFinishBatchArg) (
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3792,17 +3927,11 @@ func (dbx *apiImpl) UploadSessionFinishBatch(arg *UploadSessionFinishBatchArg) (
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3846,7 +3975,7 @@ func (dbx *apiImpl) UploadSessionFinishBatchCheck(arg *async.PollArg) (res *Uplo
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3864,17 +3993,11 @@ func (dbx *apiImpl) UploadSessionFinishBatchCheck(arg *async.PollArg) (res *Uplo
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3919,7 +4042,7 @@ func (dbx *apiImpl) UploadSessionStart(arg *UploadSessionStartArg, content io.Re
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3937,17 +4060,11 @@ func (dbx *apiImpl) UploadSessionStart(arg *UploadSessionStartArg, content io.Re
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/types.go
index 22baa418e..fc87512f4 100644
--- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/types.go
+++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files/types.go
@@ -183,6 +183,11 @@ type CommitInfo struct {
Mute bool `json:"mute"`
// PropertyGroups : List of custom properties to add to file.
PropertyGroups []*file_properties.PropertyGroup `json:"property_groups,omitempty"`
+ // StrictConflict : Be more strict about how each `WriteMode` detects
+ // conflict. For example, always return a conflict error when `mode` =
+ // `WriteMode.update` and the given "rev" doesn't match the existing file's
+ // "rev", even if the existing file has been deleted.
+ StrictConflict bool `json:"strict_conflict"`
}
// NewCommitInfo returns a new CommitInfo instance
@@ -192,6 +197,7 @@ func NewCommitInfo(Path string) *CommitInfo {
s.Mode = &WriteMode{Tagged: dropbox.Tagged{"add"}}
s.Autorename = false
s.Mute = false
+ s.StrictConflict = false
return s
}
@@ -207,6 +213,7 @@ func NewCommitInfoWithProperties(Path string) *CommitInfoWithProperties {
s.Mode = &WriteMode{Tagged: dropbox.Tagged{"add"}}
s.Autorename = false
s.Mute = false
+ s.StrictConflict = false
return s
}
@@ -402,7 +409,8 @@ func NewFileOpsResult() *FileOpsResult {
// CreateFolderBatchResult : has no documentation (yet)
type CreateFolderBatchResult struct {
FileOpsResult
- // Entries : has no documentation (yet)
+ // Entries : Each entry in `CreateFolderBatchArg.paths` will appear at the
+ // same position inside `CreateFolderBatchResult.entries`.
Entries []*CreateFolderBatchResultEntry `json:"entries"`
}
@@ -701,7 +709,8 @@ func (u *DeleteBatchLaunch) UnmarshalJSON(body []byte) error {
// DeleteBatchResult : has no documentation (yet)
type DeleteBatchResult struct {
FileOpsResult
- // Entries : has no documentation (yet)
+ // Entries : Each entry in `DeleteBatchArg.entries` will appear at the same
+ // position inside `DeleteBatchResult.entries`.
Entries []*DeleteBatchResultEntry `json:"entries"`
}
@@ -1171,7 +1180,7 @@ type FileMetadata struct {
HasExplicitSharedMembers bool `json:"has_explicit_shared_members,omitempty"`
// ContentHash : A hash of the file content. This field can be used to
// verify data integrity. For more information see our `Content hash`
- // </developers/reference/content-hash> page.
+ // <https://www.dropbox.com/developers/reference/content-hash> page.
ContentHash string `json:"content_hash,omitempty"`
}
@@ -1436,6 +1445,39 @@ func NewGetTemporaryLinkResult(Metadata *FileMetadata, Link string) *GetTemporar
return s
}
+// GetTemporaryUploadLinkArg : has no documentation (yet)
+type GetTemporaryUploadLinkArg struct {
+ // CommitInfo : Contains the path and other optional modifiers for the
+ // future upload commit. Equivalent to the parameters provided to `upload`.
+ CommitInfo *CommitInfo `json:"commit_info"`
+ // Duration : How long before this link expires, in seconds. Attempting to
+ // start an upload with this link longer than this period of time after
+ // link creation will result in an error.
+ Duration float64 `json:"duration"`
+}
+
+// NewGetTemporaryUploadLinkArg returns a new GetTemporaryUploadLinkArg instance
+func NewGetTemporaryUploadLinkArg(CommitInfo *CommitInfo) *GetTemporaryUploadLinkArg {
+ s := new(GetTemporaryUploadLinkArg)
+ s.CommitInfo = CommitInfo
+ s.Duration = 14400.0
+ return s
+}
+
+// GetTemporaryUploadLinkResult : has no documentation (yet)
+type GetTemporaryUploadLinkResult struct {
+ // Link : The temporary link which can be used to stream a file to a Dropbox
+ // location.
+ Link string `json:"link"`
+}
+
+// NewGetTemporaryUploadLinkResult returns a new GetTemporaryUploadLinkResult instance
+func NewGetTemporaryUploadLinkResult(Link string) *GetTemporaryUploadLinkResult {
+ s := new(GetTemporaryUploadLinkResult)
+ s.Link = Link
+ return s
+}
+
// GetThumbnailBatchArg : Arguments for `getThumbnailBatch`.
type GetThumbnailBatchArg struct {
// Entries : List of files to get thumbnails.
@@ -1477,7 +1519,8 @@ func NewGetThumbnailBatchResult(Entries []*GetThumbnailBatchResultEntry) *GetThu
type GetThumbnailBatchResultData struct {
// Metadata : has no documentation (yet)
Metadata *FileMetadata `json:"metadata"`
- // Thumbnail : has no documentation (yet)
+ // Thumbnail : A string containing the base64-encoded thumbnail data for
+ // this file.
Thumbnail string `json:"thumbnail"`
}
@@ -1895,7 +1938,10 @@ func NewListRevisionsResult(IsDeleted bool, Entries []*FileMetadata) *ListRevisi
// LookupError : has no documentation (yet)
type LookupError struct {
dropbox.Tagged
- // MalformedPath : has no documentation (yet)
+ // MalformedPath : The given path does not satisfy the required path format.
+ // Please refer to the `Path formats documentation`
+ // <https://www.dropbox.com/developers/documentation/http/documentation#path-formats>
+ // for more information.
MalformedPath string `json:"malformed_path,omitempty"`
}
@@ -1913,7 +1959,10 @@ const (
func (u *LookupError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
- // MalformedPath : has no documentation (yet)
+ // MalformedPath : The given path does not satisfy the required path
+ // format. Please refer to the `Path formats documentation`
+ // <https://www.dropbox.com/developers/documentation/http/documentation#path-formats>
+ // for more information.
MalformedPath json.RawMessage `json:"malformed_path,omitempty"`
}
var w wrap
@@ -2057,6 +2106,42 @@ func IsMediaMetadataFromJSON(data []byte) (IsMediaMetadata, error) {
return nil, nil
}
+// RelocationBatchArgBase : has no documentation (yet)
+type RelocationBatchArgBase struct {
+ // Entries : List of entries to be moved or copied. Each entry is
+ // `RelocationPath`.
+ Entries []*RelocationPath `json:"entries"`
+ // Autorename : If there's a conflict with any file, have the Dropbox server
+ // try to autorename that file to avoid the conflict.
+ Autorename bool `json:"autorename"`
+}
+
+// NewRelocationBatchArgBase returns a new RelocationBatchArgBase instance
+func NewRelocationBatchArgBase(Entries []*RelocationPath) *RelocationBatchArgBase {
+ s := new(RelocationBatchArgBase)
+ s.Entries = Entries
+ s.Autorename = false
+ return s
+}
+
+// MoveBatchArg : has no documentation (yet)
+type MoveBatchArg struct {
+ RelocationBatchArgBase
+ // AllowOwnershipTransfer : Allow moves by owner even if it would result in
+ // an ownership transfer for the content being moved. This does not apply to
+ // copies.
+ AllowOwnershipTransfer bool `json:"allow_ownership_transfer"`
+}
+
+// NewMoveBatchArg returns a new MoveBatchArg instance
+func NewMoveBatchArg(Entries []*RelocationPath) *MoveBatchArg {
+ s := new(MoveBatchArg)
+ s.Entries = Entries
+ s.Autorename = false
+ s.AllowOwnershipTransfer = false
+ return s
+}
+
// PhotoMetadata : Metadata for a photo.
type PhotoMetadata struct {
MediaMetadata
@@ -2167,17 +2252,12 @@ func NewRelocationArg(FromPath string, ToPath string) *RelocationArg {
// RelocationBatchArg : has no documentation (yet)
type RelocationBatchArg struct {
- // Entries : List of entries to be moved or copied. Each entry is
- // `RelocationPath`.
- Entries []*RelocationPath `json:"entries"`
+ RelocationBatchArgBase
// AllowSharedFolder : If true, `copyBatch` will copy contents in shared
// folder, otherwise `RelocationError.cant_copy_shared_folder` will be
- // returned if `RelocationPath.from_path` contains shared folder. This
- // field is always true for `moveBatch`.
+ // returned if `RelocationPath.from_path` contains shared folder. This field
+ // is always true for `moveBatch`.
AllowSharedFolder bool `json:"allow_shared_folder"`
- // Autorename : If there's a conflict with any file, have the Dropbox server
- // try to autorename that file to avoid the conflict.
- Autorename bool `json:"autorename"`
// AllowOwnershipTransfer : Allow moves by owner even if it would result in
// an ownership transfer for the content being moved. This does not apply to
// copies.
@@ -2188,8 +2268,8 @@ type RelocationBatchArg struct {
func NewRelocationBatchArg(Entries []*RelocationPath) *RelocationBatchArg {
s := new(RelocationBatchArg)
s.Entries = Entries
- s.AllowSharedFolder = false
s.Autorename = false
+ s.AllowSharedFolder = false
s.AllowOwnershipTransfer = false
return s
}
@@ -2217,6 +2297,7 @@ const (
RelocationErrorDuplicatedOrNestedPaths = "duplicated_or_nested_paths"
RelocationErrorCantTransferOwnership = "cant_transfer_ownership"
RelocationErrorInsufficientQuota = "insufficient_quota"
+ RelocationErrorInternalError = "internal_error"
RelocationErrorOther = "other"
)
@@ -2283,6 +2364,7 @@ const (
RelocationBatchErrorDuplicatedOrNestedPaths = "duplicated_or_nested_paths"
RelocationBatchErrorCantTransferOwnership = "cant_transfer_ownership"
RelocationBatchErrorInsufficientQuota = "insufficient_quota"
+ RelocationBatchErrorInternalError = "internal_error"
RelocationBatchErrorOther = "other"
RelocationBatchErrorTooManyWriteOperations = "too_many_write_operations"
)
@@ -2327,6 +2409,45 @@ func (u *RelocationBatchError) UnmarshalJSON(body []byte) error {
return nil
}
+// RelocationBatchErrorEntry : has no documentation (yet)
+type RelocationBatchErrorEntry struct {
+ dropbox.Tagged
+ // RelocationError : User errors that retry won't help.
+ RelocationError *RelocationError `json:"relocation_error,omitempty"`
+}
+
+// Valid tag values for RelocationBatchErrorEntry
+const (
+ RelocationBatchErrorEntryRelocationError = "relocation_error"
+ RelocationBatchErrorEntryInternalError = "internal_error"
+ RelocationBatchErrorEntryTooManyWriteOperations = "too_many_write_operations"
+ RelocationBatchErrorEntryOther = "other"
+)
+
+// UnmarshalJSON deserializes into a RelocationBatchErrorEntry instance
+func (u *RelocationBatchErrorEntry) UnmarshalJSON(body []byte) error {
+ type wrap struct {
+ dropbox.Tagged
+ // RelocationError : User errors that retry won't help.
+ RelocationError json.RawMessage `json:"relocation_error,omitempty"`
+ }
+ var w wrap
+ var err error
+ if err = json.Unmarshal(body, &w); err != nil {
+ return err
+ }
+ u.Tag = w.Tag
+ switch u.Tag {
+ case "relocation_error":
+ err = json.Unmarshal(w.RelocationError, &u.RelocationError)
+
+ if err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
// RelocationBatchJobStatus : has no documentation (yet)
type RelocationBatchJobStatus struct {
dropbox.Tagged
@@ -2469,6 +2590,156 @@ func (u *RelocationBatchResultData) UnmarshalJSON(b []byte) error {
return nil
}
+// RelocationBatchResultEntry : has no documentation (yet)
+type RelocationBatchResultEntry struct {
+ dropbox.Tagged
+ // Success : has no documentation (yet)
+ Success IsMetadata `json:"success,omitempty"`
+ // Failure : has no documentation (yet)
+ Failure *RelocationBatchErrorEntry `json:"failure,omitempty"`
+}
+
+// Valid tag values for RelocationBatchResultEntry
+const (
+ RelocationBatchResultEntrySuccess = "success"
+ RelocationBatchResultEntryFailure = "failure"
+ RelocationBatchResultEntryOther = "other"
+)
+
+// UnmarshalJSON deserializes into a RelocationBatchResultEntry instance
+func (u *RelocationBatchResultEntry) UnmarshalJSON(body []byte) error {
+ type wrap struct {
+ dropbox.Tagged
+ // Success : has no documentation (yet)
+ Success json.RawMessage `json:"success,omitempty"`
+ // Failure : has no documentation (yet)
+ Failure json.RawMessage `json:"failure,omitempty"`
+ }
+ var w wrap
+ var err error
+ if err = json.Unmarshal(body, &w); err != nil {
+ return err
+ }
+ u.Tag = w.Tag
+ switch u.Tag {
+ case "success":
+ u.Success, err = IsMetadataFromJSON(body)
+
+ if err != nil {
+ return err
+ }
+ case "failure":
+ err = json.Unmarshal(w.Failure, &u.Failure)
+
+ if err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+// RelocationBatchV2JobStatus : Result returned by `copyBatch` or `moveBatch`
+// that may either launch an asynchronous job or complete synchronously.
+type RelocationBatchV2JobStatus struct {
+ dropbox.Tagged
+ // Complete : The copy or move batch job has finished.
+ Complete *RelocationBatchV2Result `json:"complete,omitempty"`
+}
+
+// Valid tag values for RelocationBatchV2JobStatus
+const (
+ RelocationBatchV2JobStatusInProgress = "in_progress"
+ RelocationBatchV2JobStatusComplete = "complete"
+)
+
+// UnmarshalJSON deserializes into a RelocationBatchV2JobStatus instance
+func (u *RelocationBatchV2JobStatus) UnmarshalJSON(body []byte) error {
+ type wrap struct {
+ dropbox.Tagged
+ // Complete : The copy or move batch job has finished.
+ Complete json.RawMessage `json:"complete,omitempty"`
+ }
+ var w wrap
+ var err error
+ if err = json.Unmarshal(body, &w); err != nil {
+ return err
+ }
+ u.Tag = w.Tag
+ switch u.Tag {
+ case "complete":
+ err = json.Unmarshal(body, &u.Complete)
+
+ if err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+// RelocationBatchV2Launch : Result returned by `copyBatch` or `moveBatch` that
+// may either launch an asynchronous job or complete synchronously.
+type RelocationBatchV2Launch struct {
+ dropbox.Tagged
+ // 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.
+ AsyncJobId string `json:"async_job_id,omitempty"`
+ // Complete : has no documentation (yet)
+ Complete *RelocationBatchV2Result `json:"complete,omitempty"`
+}
+
+// Valid tag values for RelocationBatchV2Launch
+const (
+ RelocationBatchV2LaunchAsyncJobId = "async_job_id"
+ RelocationBatchV2LaunchComplete = "complete"
+)
+
+// UnmarshalJSON deserializes into a RelocationBatchV2Launch instance
+func (u *RelocationBatchV2Launch) UnmarshalJSON(body []byte) error {
+ type wrap struct {
+ dropbox.Tagged
+ // Complete : has no documentation (yet)
+ Complete json.RawMessage `json:"complete,omitempty"`
+ }
+ var w wrap
+ var err error
+ if err = json.Unmarshal(body, &w); err != nil {
+ return err
+ }
+ u.Tag = w.Tag
+ switch u.Tag {
+ case "async_job_id":
+ err = json.Unmarshal(body, &u.AsyncJobId)
+
+ if err != nil {
+ return err
+ }
+ case "complete":
+ err = json.Unmarshal(body, &u.Complete)
+
+ if err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+// RelocationBatchV2Result : has no documentation (yet)
+type RelocationBatchV2Result struct {
+ FileOpsResult
+ // Entries : Each entry in CopyBatchArg.entries or `MoveBatchArg.entries`
+ // will appear at the same position inside
+ // `RelocationBatchV2Result.entries`.
+ Entries []*RelocationBatchResultEntry `json:"entries"`
+}
+
+// NewRelocationBatchV2Result returns a new RelocationBatchV2Result instance
+func NewRelocationBatchV2Result(Entries []*RelocationBatchResultEntry) *RelocationBatchV2Result {
+ s := new(RelocationBatchV2Result)
+ s.Entries = Entries
+ return s
+}
+
// RelocationResult : has no documentation (yet)
type RelocationResult struct {
FileOpsResult
@@ -2503,9 +2774,9 @@ func (u *RelocationResult) UnmarshalJSON(b []byte) error {
// RestoreArg : has no documentation (yet)
type RestoreArg struct {
- // Path : The path to the file you want to restore.
+ // Path : The path to save the restored file.
Path string `json:"path"`
- // Rev : The revision to restore for the file.
+ // Rev : The revision to restore.
Rev string `json:"rev"`
}
@@ -3258,7 +3529,7 @@ type UploadSessionAppendArg struct {
// Cursor : Contains the upload session ID and the offset.
Cursor *UploadSessionCursor `json:"cursor"`
// Close : If true, the current session will be closed, at which point you
- // won't be able to call `uploadSessionAppendV2` anymore with the current
+ // won't be able to call `uploadSessionAppend` anymore with the current
// session.
Close bool `json:"close"`
}
@@ -3407,7 +3678,8 @@ func (u *UploadSessionFinishBatchLaunch) UnmarshalJSON(body []byte) error {
// UploadSessionFinishBatchResult : has no documentation (yet)
type UploadSessionFinishBatchResult struct {
- // Entries : Commit result for each file in the batch.
+ // Entries : Each entry in `UploadSessionFinishBatchArg.entries` will appear
+ // at the same position inside `UploadSessionFinishBatchResult.entries`.
Entries []*UploadSessionFinishBatchResultEntry `json:"entries"`
}
@@ -3597,7 +3869,7 @@ func NewUploadSessionOffsetError(CorrectOffset uint64) *UploadSessionOffsetError
// UploadSessionStartArg : has no documentation (yet)
type UploadSessionStartArg struct {
// Close : If true, the current session will be closed, at which point you
- // won't be able to call `uploadSessionAppendV2` anymore with the current
+ // won't be able to call `uploadSessionAppend` anymore with the current
// session.
Close bool `json:"close"`
}
@@ -3612,7 +3884,7 @@ func NewUploadSessionStartArg() *UploadSessionStartArg {
// UploadSessionStartResult : has no documentation (yet)
type UploadSessionStartResult struct {
// SessionId : A unique identifier for the upload session. Pass this to
- // `uploadSessionAppendV2` and `uploadSessionFinish`.
+ // `uploadSessionAppend` and `uploadSessionFinish`.
SessionId string `json:"session_id"`
}
@@ -3670,7 +3942,10 @@ const (
// WriteError : has no documentation (yet)
type WriteError struct {
dropbox.Tagged
- // MalformedPath : has no documentation (yet)
+ // MalformedPath : The given path does not satisfy the required path format.
+ // Please refer to the `Path formats documentation`
+ // <https://www.dropbox.com/developers/documentation/http/documentation#path-formats>
+ // for more information.
MalformedPath string `json:"malformed_path,omitempty"`
// Conflict : Couldn't write to the target path because there was something
// in the way.
@@ -3693,7 +3968,10 @@ const (
func (u *WriteError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
- // MalformedPath : has no documentation (yet)
+ // MalformedPath : The given path does not satisfy the required path
+ // format. Please refer to the `Path formats documentation`
+ // <https://www.dropbox.com/developers/documentation/http/documentation#path-formats>
+ // for more information.
MalformedPath json.RawMessage `json:"malformed_path,omitempty"`
// Conflict : Couldn't write to the target path because there was
// something in the way.
diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sdk.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sdk.go
index 673de622e..f13592b2a 100644
--- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sdk.go
+++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sdk.go
@@ -21,6 +21,7 @@
package dropbox
import (
+ "encoding/json"
"fmt"
"io"
"log"
@@ -36,8 +37,8 @@ const (
hostAPI = "api"
hostContent = "content"
hostNotify = "notify"
- sdkVersion = "4.2.0"
- specVersion = "222ba8c"
+ sdkVersion = "5.2.0"
+ specVersion = "097e9ba"
)
// Version returns the current SDK version and API Spec version
@@ -206,8 +207,17 @@ func (e APIError) Error() string {
return e.ErrorSummary
}
-func init() {
- // These are not registered in the oauth library by default
- oauth2.RegisterBrokenAuthHeaderProvider("https://api.dropboxapi.com")
- oauth2.RegisterBrokenAuthHeaderProvider("https://api-dbdev.dev.corp.dropbox.com")
+// HandleCommonAPIErrors handles common API errors
+func HandleCommonAPIErrors(c Config, resp *http.Response, body []byte) error {
+ var apiError APIError
+ if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
+ apiError.ErrorSummary = string(body)
+ return apiError
+ }
+ e := json.Unmarshal(body, &apiError)
+ if e != nil {
+ c.LogDebug("%v", e)
+ return e
+ }
+ return apiError
}
diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/client.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/client.go
index 5e060eab9..4112ccdba 100644
--- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/client.go
+++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/client.go
@@ -30,6 +30,7 @@ import (
"github.com/dropbox/dropbox-sdk-go-unofficial/dropbox"
"github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/async"
+ "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth"
)
// Client interface describes all routes in this namespace
@@ -39,23 +40,19 @@ type Client interface {
// AddFolderMember : Allows an owner or editor (if the ACL update policy
// allows) of a shared folder to add another member. For the new member to
// get access to all the functionality for this folder, you will need to
- // call `mountFolder` on their behalf. Apps must have full Dropbox access to
- // use this endpoint.
+ // 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. Apps must
- // have full Dropbox access to use this endpoint.
+ // CheckJobStatus : Returns the status of an asynchronous job.
CheckJobStatus(arg *async.PollArg) (res *JobStatus, err error)
// CheckRemoveMemberJobStatus : Returns the status of an asynchronous job
- // for sharing a folder. Apps must have full Dropbox access to use this
- // endpoint.
+ // for sharing a folder.
CheckRemoveMemberJobStatus(arg *async.PollArg) (res *RemoveMemberJobStatus, err error)
// CheckShareJobStatus : Returns the status of an asynchronous job for
- // sharing a folder. Apps must have full Dropbox access to use this
- // endpoint.
+ // 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
@@ -76,8 +73,7 @@ type Client interface {
GetFileMetadata(arg *GetFileMetadataArg) (res *SharedFileMetadata, err error)
// GetFileMetadataBatch : Returns shared file metadata.
GetFileMetadataBatch(arg *GetFileMetadataBatchArg) (res []*GetFileMetadataBatchResult, err error)
- // GetFolderMetadata : Returns shared folder metadata by its folder ID. Apps
- // must have full Dropbox access to use this endpoint.
+ // GetFolderMetadata : Returns shared folder metadata by its folder ID.
GetFolderMetadata(arg *GetMetadataArgs) (res *SharedFolderMetadata, err error)
// GetSharedLinkFile : Download the shared link's file from a user's
// Dropbox.
@@ -107,30 +103,26 @@ type Client interface {
// all shared file members.
ListFileMembersContinue(arg *ListFileMembersContinueArg) (res *SharedFileMembers, err error)
// ListFolderMembers : Returns shared folder membership by its folder ID.
- // Apps must have full Dropbox access to use this endpoint.
ListFolderMembers(arg *ListFolderMembersArgs) (res *SharedFolderMembers, err error)
// ListFolderMembersContinue : Once a cursor has been retrieved from
// `listFolderMembers`, use this to paginate through all shared folder
- // members. Apps must have full Dropbox access to use this endpoint.
+ // members.
ListFolderMembersContinue(arg *ListFolderMembersContinueArg) (res *SharedFolderMembers, err error)
// ListFolders : Return the list of all shared folders the current user has
- // access to. Apps must have full Dropbox access to use this endpoint.
+ // access to.
ListFolders(arg *ListFoldersArgs) (res *ListFoldersResult, err error)
// ListFoldersContinue : Once a cursor has been retrieved from
// `listFolders`, use this to paginate through all shared folders. The
// cursor must come from a previous call to `listFolders` or
- // `listFoldersContinue`. Apps must have full Dropbox access to use this
- // endpoint.
+ // `listFoldersContinue`.
ListFoldersContinue(arg *ListFoldersContinueArg) (res *ListFoldersResult, err error)
// ListMountableFolders : Return the list of all shared folders the current
- // user can mount or unmount. Apps must have full Dropbox access to use this
- // endpoint.
+ // user can mount or unmount.
ListMountableFolders(arg *ListFoldersArgs) (res *ListFoldersResult, err error)
// ListMountableFoldersContinue : Once a cursor has been retrieved from
// `listMountableFolders`, use this to paginate through all mountable shared
// folders. The cursor must come from a previous call to
- // `listMountableFolders` or `listMountableFoldersContinue`. Apps must have
- // full Dropbox access to use this endpoint.
+ // `listMountableFolders` or `listMountableFoldersContinue`.
ListMountableFoldersContinue(arg *ListFoldersContinueArg) (res *ListFoldersResult, err error)
// ListReceivedFiles : Returns a list of all files shared with current user.
// Does not include files the user has received via shared folders, and does
@@ -156,20 +148,17 @@ type Client interface {
ModifySharedLinkSettings(arg *ModifySharedLinkSettingsArgs) (res IsSharedLinkMetadata, err error)
// MountFolder : The current user mounts the designated folder. Mount a
// shared folder for a user after they have been added as a member. Once
- // mounted, the shared folder will appear in their Dropbox. Apps must have
- // full Dropbox access to use this endpoint.
+ // mounted, the shared folder will appear in their Dropbox.
MountFolder(arg *MountFolderArg) (res *SharedFolderMetadata, err error)
// RelinquishFileMembership : The current user relinquishes their membership
// in the designated file. Note that the current user may still have
- // inherited access to this file through the parent folder. Apps must have
- // full Dropbox access to use this endpoint.
+ // inherited access to this file through the parent folder.
RelinquishFileMembership(arg *RelinquishFileMembershipArg) (err error)
// RelinquishFolderMembership : The current user relinquishes their
// membership in the designated shared folder and will no longer have access
// to the folder. A folder owner cannot relinquish membership in their own
// folder. This will run synchronously if leave_a_copy is false, and
- // asynchronously if leave_a_copy is true. Apps must have full Dropbox
- // access to use this endpoint.
+ // asynchronously if leave_a_copy is true.
RelinquishFolderMembership(arg *RelinquishFolderMembershipArg) (res *async.LaunchEmptyResult, err error)
// RemoveFileMember : Identical to remove_file_member_2 but with less
// information returned.
@@ -178,8 +167,7 @@ type Client interface {
// RemoveFileMember2 : Removes a specified member from the file.
RemoveFileMember2(arg *RemoveFileMemberArg) (res *FileMemberRemoveActionResult, err error)
// RemoveFolderMember : Allows an owner or editor (if the ACL update policy
- // allows) of a shared folder to remove another member. Apps must have full
- // Dropbox access to use this endpoint.
+ // allows) of a shared folder to remove another member.
RemoveFolderMember(arg *RemoveFolderMemberArg) (res *async.LaunchResultBase, err error)
// RevokeSharedLink : Revoke a shared link. Note that even after revoking a
// shared link to a file, the file may be accessible if there are shared
@@ -198,35 +186,30 @@ type Client interface {
// To make testing the async case repeatable, set
// `ShareFolderArg.force_async`. If a `ShareFolderLaunch.async_job_id` is
// returned, you'll need to call `checkShareJobStatus` until the action
- // completes to get the metadata for the folder. Apps must have full Dropbox
- // access to use this endpoint.
+ // completes to get the metadata for the folder.
ShareFolder(arg *ShareFolderArg) (res *ShareFolderLaunch, err error)
// TransferFolder : Transfer ownership of a shared folder to a member of the
// shared folder. User must have `AccessLevel.owner` access to the shared
- // folder to perform a transfer. Apps must have full Dropbox access to use
- // this endpoint.
+ // folder to perform a transfer.
TransferFolder(arg *TransferFolderArg) (err error)
// UnmountFolder : The current user unmounts the designated folder. They can
- // re-mount the folder at a later time using `mountFolder`. Apps must have
- // full Dropbox access to use this endpoint.
+ // re-mount the folder at a later time using `mountFolder`.
UnmountFolder(arg *UnmountFolderArg) (err error)
// UnshareFile : Remove all members from this file. Does not remove
// inherited members.
UnshareFile(arg *UnshareFileArg) (err error)
// UnshareFolder : Allows a shared folder owner to unshare the folder.
// You'll need to call `checkJobStatus` to determine if the action has
- // completed successfully. Apps must have full Dropbox access to use this
- // endpoint.
+ // completed successfully.
UnshareFolder(arg *UnshareFolderArg) (res *async.LaunchEmptyResult, err error)
// UpdateFileMember : Changes a member's access on a shared file.
UpdateFileMember(arg *UpdateFileMemberArgs) (res *MemberAccessLevelResult, err error)
// UpdateFolderMember : Allows an owner or editor of a shared folder to
- // update another member's permissions. Apps must have full Dropbox access
- // to use this endpoint.
+ // update another member's permissions.
UpdateFolderMember(arg *UpdateFolderMemberArg) (res *MemberAccessLevelResult, err error)
// UpdateFolderPolicy : Update the sharing policies for a shared folder.
// User must have `AccessLevel.owner` access to the shared folder to update
- // its policies. Apps must have full Dropbox access to use this endpoint.
+ // its policies.
UpdateFolderPolicy(arg *UpdateFolderPolicyArg) (res *SharedFolderMetadata, err error)
}
@@ -272,7 +255,7 @@ func (dbx *apiImpl) AddFileMember(arg *AddFileMemberArgs) (res []*FileMemberActi
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -290,17 +273,11 @@ func (dbx *apiImpl) AddFileMember(arg *AddFileMemberArgs) (res []*FileMemberActi
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -344,7 +321,7 @@ func (dbx *apiImpl) AddFolderMember(arg *AddFolderMemberArg) (err error) {
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -357,17 +334,11 @@ func (dbx *apiImpl) AddFolderMember(arg *AddFolderMemberArg) (err error) {
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -414,7 +385,7 @@ func (dbx *apiImpl) ChangeFileMemberAccess(arg *ChangeFileMemberAccessArgs) (res
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -432,17 +403,11 @@ func (dbx *apiImpl) ChangeFileMemberAccess(arg *ChangeFileMemberAccessArgs) (res
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -486,7 +451,7 @@ func (dbx *apiImpl) CheckJobStatus(arg *async.PollArg) (res *JobStatus, err erro
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -504,17 +469,11 @@ func (dbx *apiImpl) CheckJobStatus(arg *async.PollArg) (res *JobStatus, err erro
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -558,7 +517,7 @@ func (dbx *apiImpl) CheckRemoveMemberJobStatus(arg *async.PollArg) (res *RemoveM
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -576,17 +535,11 @@ func (dbx *apiImpl) CheckRemoveMemberJobStatus(arg *async.PollArg) (res *RemoveM
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -630,7 +583,7 @@ func (dbx *apiImpl) CheckShareJobStatus(arg *async.PollArg) (res *ShareFolderJob
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -648,17 +601,11 @@ func (dbx *apiImpl) CheckShareJobStatus(arg *async.PollArg) (res *ShareFolderJob
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -705,7 +652,7 @@ func (dbx *apiImpl) CreateSharedLink(arg *CreateSharedLinkArg) (res *PathLinkMet
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -723,17 +670,11 @@ func (dbx *apiImpl) CreateSharedLink(arg *CreateSharedLinkArg) (res *PathLinkMet
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -777,7 +718,7 @@ func (dbx *apiImpl) CreateSharedLinkWithSettings(arg *CreateSharedLinkWithSettin
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
var tmp sharedLinkMetadataUnion
err = json.Unmarshal(body, &tmp)
@@ -803,17 +744,11 @@ func (dbx *apiImpl) CreateSharedLinkWithSettings(arg *CreateSharedLinkWithSettin
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -857,7 +792,7 @@ func (dbx *apiImpl) GetFileMetadata(arg *GetFileMetadataArg) (res *SharedFileMet
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -875,17 +810,11 @@ func (dbx *apiImpl) GetFileMetadata(arg *GetFileMetadataArg) (res *SharedFileMet
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -929,7 +858,7 @@ func (dbx *apiImpl) GetFileMetadataBatch(arg *GetFileMetadataBatchArg) (res []*G
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -947,17 +876,11 @@ func (dbx *apiImpl) GetFileMetadataBatch(arg *GetFileMetadataBatchArg) (res []*G
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1001,7 +924,7 @@ func (dbx *apiImpl) GetFolderMetadata(arg *GetMetadataArgs) (res *SharedFolderMe
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1019,17 +942,11 @@ func (dbx *apiImpl) GetFolderMetadata(arg *GetMetadataArgs) (res *SharedFolderMe
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1069,7 +986,7 @@ func (dbx *apiImpl) GetSharedLinkFile(arg *GetSharedLinkMetadataArg) (res IsShar
dbx.Config.LogInfo("resp: %v", resp)
body := []byte(resp.Header.Get("Dropbox-API-Result"))
content = resp.Body
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
var tmp sharedLinkMetadataUnion
err = json.Unmarshal(body, &tmp)
@@ -1100,17 +1017,11 @@ func (dbx *apiImpl) GetSharedLinkFile(arg *GetSharedLinkMetadataArg) (res IsShar
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1154,7 +1065,7 @@ func (dbx *apiImpl) GetSharedLinkMetadata(arg *GetSharedLinkMetadataArg) (res Is
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
var tmp sharedLinkMetadataUnion
err = json.Unmarshal(body, &tmp)
@@ -1180,17 +1091,11 @@ func (dbx *apiImpl) GetSharedLinkMetadata(arg *GetSharedLinkMetadataArg) (res Is
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1237,7 +1142,7 @@ func (dbx *apiImpl) GetSharedLinks(arg *GetSharedLinksArg) (res *GetSharedLinksR
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1255,17 +1160,11 @@ func (dbx *apiImpl) GetSharedLinks(arg *GetSharedLinksArg) (res *GetSharedLinksR
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1309,7 +1208,7 @@ func (dbx *apiImpl) ListFileMembers(arg *ListFileMembersArg) (res *SharedFileMem
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1327,17 +1226,11 @@ func (dbx *apiImpl) ListFileMembers(arg *ListFileMembersArg) (res *SharedFileMem
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1381,7 +1274,7 @@ func (dbx *apiImpl) ListFileMembersBatch(arg *ListFileMembersBatchArg) (res []*L
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1399,17 +1292,11 @@ func (dbx *apiImpl) ListFileMembersBatch(arg *ListFileMembersBatchArg) (res []*L
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1453,7 +1340,7 @@ func (dbx *apiImpl) ListFileMembersContinue(arg *ListFileMembersContinueArg) (re
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1471,17 +1358,11 @@ func (dbx *apiImpl) ListFileMembersContinue(arg *ListFileMembersContinueArg) (re
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1525,7 +1406,7 @@ func (dbx *apiImpl) ListFolderMembers(arg *ListFolderMembersArgs) (res *SharedFo
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1543,17 +1424,11 @@ func (dbx *apiImpl) ListFolderMembers(arg *ListFolderMembersArgs) (res *SharedFo
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1597,7 +1472,7 @@ func (dbx *apiImpl) ListFolderMembersContinue(arg *ListFolderMembersContinueArg)
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1615,17 +1490,11 @@ func (dbx *apiImpl) ListFolderMembersContinue(arg *ListFolderMembersContinueArg)
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1669,7 +1538,7 @@ func (dbx *apiImpl) ListFolders(arg *ListFoldersArgs) (res *ListFoldersResult, e
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1687,17 +1556,11 @@ func (dbx *apiImpl) ListFolders(arg *ListFoldersArgs) (res *ListFoldersResult, e
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1741,7 +1604,7 @@ func (dbx *apiImpl) ListFoldersContinue(arg *ListFoldersContinueArg) (res *ListF
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1759,17 +1622,11 @@ func (dbx *apiImpl) ListFoldersContinue(arg *ListFoldersContinueArg) (res *ListF
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1813,7 +1670,7 @@ func (dbx *apiImpl) ListMountableFolders(arg *ListFoldersArgs) (res *ListFolders
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1831,17 +1688,11 @@ func (dbx *apiImpl) ListMountableFolders(arg *ListFoldersArgs) (res *ListFolders
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1885,7 +1736,7 @@ func (dbx *apiImpl) ListMountableFoldersContinue(arg *ListFoldersContinueArg) (r
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1903,17 +1754,11 @@ func (dbx *apiImpl) ListMountableFoldersContinue(arg *ListFoldersContinueArg) (r
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1957,7 +1802,7 @@ func (dbx *apiImpl) ListReceivedFiles(arg *ListFilesArg) (res *ListFilesResult,
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1975,17 +1820,11 @@ func (dbx *apiImpl) ListReceivedFiles(arg *ListFilesArg) (res *ListFilesResult,
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2029,7 +1868,7 @@ func (dbx *apiImpl) ListReceivedFilesContinue(arg *ListFilesContinueArg) (res *L
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2047,17 +1886,11 @@ func (dbx *apiImpl) ListReceivedFilesContinue(arg *ListFilesContinueArg) (res *L
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2101,7 +1934,7 @@ func (dbx *apiImpl) ListSharedLinks(arg *ListSharedLinksArg) (res *ListSharedLin
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2119,17 +1952,11 @@ func (dbx *apiImpl) ListSharedLinks(arg *ListSharedLinksArg) (res *ListSharedLin
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2173,7 +2000,7 @@ func (dbx *apiImpl) ModifySharedLinkSettings(arg *ModifySharedLinkSettingsArgs)
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
var tmp sharedLinkMetadataUnion
err = json.Unmarshal(body, &tmp)
@@ -2199,17 +2026,11 @@ func (dbx *apiImpl) ModifySharedLinkSettings(arg *ModifySharedLinkSettingsArgs)
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2253,7 +2074,7 @@ func (dbx *apiImpl) MountFolder(arg *MountFolderArg) (res *SharedFolderMetadata,
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2271,17 +2092,11 @@ func (dbx *apiImpl) MountFolder(arg *MountFolderArg) (res *SharedFolderMetadata,
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2325,7 +2140,7 @@ func (dbx *apiImpl) RelinquishFileMembership(arg *RelinquishFileMembershipArg) (
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -2338,17 +2153,11 @@ func (dbx *apiImpl) RelinquishFileMembership(arg *RelinquishFileMembershipArg) (
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2392,7 +2201,7 @@ func (dbx *apiImpl) RelinquishFolderMembership(arg *RelinquishFolderMembershipAr
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2410,17 +2219,11 @@ func (dbx *apiImpl) RelinquishFolderMembership(arg *RelinquishFolderMembershipAr
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2467,7 +2270,7 @@ func (dbx *apiImpl) RemoveFileMember(arg *RemoveFileMemberArg) (res *FileMemberA
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2485,17 +2288,11 @@ func (dbx *apiImpl) RemoveFileMember(arg *RemoveFileMemberArg) (res *FileMemberA
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2539,7 +2336,7 @@ func (dbx *apiImpl) RemoveFileMember2(arg *RemoveFileMemberArg) (res *FileMember
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2557,17 +2354,11 @@ func (dbx *apiImpl) RemoveFileMember2(arg *RemoveFileMemberArg) (res *FileMember
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2611,7 +2402,7 @@ func (dbx *apiImpl) RemoveFolderMember(arg *RemoveFolderMemberArg) (res *async.L
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2629,17 +2420,11 @@ func (dbx *apiImpl) RemoveFolderMember(arg *RemoveFolderMemberArg) (res *async.L
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2683,7 +2468,7 @@ func (dbx *apiImpl) RevokeSharedLink(arg *RevokeSharedLinkArg) (err error) {
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -2696,17 +2481,11 @@ func (dbx *apiImpl) RevokeSharedLink(arg *RevokeSharedLinkArg) (err error) {
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2750,7 +2529,7 @@ func (dbx *apiImpl) SetAccessInheritance(arg *SetAccessInheritanceArg) (res *Sha
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2768,17 +2547,11 @@ func (dbx *apiImpl) SetAccessInheritance(arg *SetAccessInheritanceArg) (res *Sha
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2822,7 +2595,7 @@ func (dbx *apiImpl) ShareFolder(arg *ShareFolderArg) (res *ShareFolderLaunch, er
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2840,17 +2613,11 @@ func (dbx *apiImpl) ShareFolder(arg *ShareFolderArg) (res *ShareFolderLaunch, er
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2894,7 +2661,7 @@ func (dbx *apiImpl) TransferFolder(arg *TransferFolderArg) (err error) {
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -2907,17 +2674,11 @@ func (dbx *apiImpl) TransferFolder(arg *TransferFolderArg) (err error) {
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2961,7 +2722,7 @@ func (dbx *apiImpl) UnmountFolder(arg *UnmountFolderArg) (err error) {
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -2974,17 +2735,11 @@ func (dbx *apiImpl) UnmountFolder(arg *UnmountFolderArg) (err error) {
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3028,7 +2783,7 @@ func (dbx *apiImpl) UnshareFile(arg *UnshareFileArg) (err error) {
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -3041,17 +2796,11 @@ func (dbx *apiImpl) UnshareFile(arg *UnshareFileArg) (err error) {
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3095,7 +2844,7 @@ func (dbx *apiImpl) UnshareFolder(arg *UnshareFolderArg) (res *async.LaunchEmpty
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3113,17 +2862,11 @@ func (dbx *apiImpl) UnshareFolder(arg *UnshareFolderArg) (res *async.LaunchEmpty
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3167,7 +2910,7 @@ func (dbx *apiImpl) UpdateFileMember(arg *UpdateFileMemberArgs) (res *MemberAcce
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3185,17 +2928,11 @@ func (dbx *apiImpl) UpdateFileMember(arg *UpdateFileMemberArgs) (res *MemberAcce
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3239,7 +2976,7 @@ func (dbx *apiImpl) UpdateFolderMember(arg *UpdateFolderMemberArg) (res *MemberA
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3257,17 +2994,11 @@ func (dbx *apiImpl) UpdateFolderMember(arg *UpdateFolderMemberArg) (res *MemberA
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3311,7 +3042,7 @@ func (dbx *apiImpl) UpdateFolderPolicy(arg *UpdateFolderPolicyArg) (res *SharedF
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3329,17 +3060,11 @@ func (dbx *apiImpl) UpdateFolderPolicy(arg *UpdateFolderPolicyArg) (res *SharedF
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/types.go
index 506ae4cfd..2ae5b47af 100644
--- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/types.go
+++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing/types.go
@@ -693,6 +693,7 @@ const (
FileActionEnableViewerInfo = "enable_viewer_info"
FileActionInviteViewer = "invite_viewer"
FileActionInviteViewerNoComment = "invite_viewer_no_comment"
+ FileActionInviteEditor = "invite_editor"
FileActionUnshare = "unshare"
FileActionRelinquishMembership = "relinquish_membership"
FileActionShareLink = "share_link"
@@ -1496,7 +1497,9 @@ func NewGroupInfo(GroupName string, GroupId string, GroupManagementType *team_co
// MembershipInfo : The information about a member of the shared content.
type MembershipInfo struct {
- // AccessType : The access type for this member.
+ // AccessType : The access type for this member. It contains inherited
+ // access type from parent folder, and acquired access type from this
+ // folder.
AccessType *AccessLevel `json:"access_type"`
// Permissions : The permissions that requesting user has on this member.
// The set of permissions corresponds to the MemberActions in the request.
@@ -1754,6 +1757,7 @@ type LinkAudience struct {
const (
LinkAudiencePublic = "public"
LinkAudienceTeam = "team"
+ LinkAudienceNoOne = "no_one"
LinkAudienceMembers = "members"
LinkAudienceOther = "other"
)
@@ -3262,6 +3266,8 @@ type ShareFolderArgBase struct {
// ViewerInfoPolicy : Who can enable/disable viewer info for this shared
// folder.
ViewerInfoPolicy *ViewerInfoPolicy `json:"viewer_info_policy,omitempty"`
+ // AccessInheritance : The access inheritance settings for the folder.
+ AccessInheritance *AccessInheritance `json:"access_inheritance"`
}
// NewShareFolderArgBase returns a new ShareFolderArgBase instance
@@ -3269,6 +3275,7 @@ func NewShareFolderArgBase(Path string) *ShareFolderArgBase {
s := new(ShareFolderArgBase)
s.Path = Path
s.ForceAsync = false
+ s.AccessInheritance = &AccessInheritance{Tagged: dropbox.Tagged{"inherit"}}
return s
}
@@ -3289,6 +3296,7 @@ func NewShareFolderArg(Path string) *ShareFolderArg {
s := new(ShareFolderArg)
s.Path = Path
s.ForceAsync = false
+ s.AccessInheritance = &AccessInheritance{Tagged: dropbox.Tagged{"inherit"}}
return s
}
diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team/client.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team/client.go
index 085b953aa..3ff353e4e 100644
--- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team/client.go
+++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team/client.go
@@ -29,6 +29,7 @@ import (
"github.com/dropbox/dropbox-sdk-go-unofficial/dropbox"
"github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/async"
+ "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth"
"github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/file_properties"
)
@@ -37,8 +38,10 @@ type Client interface {
// DevicesListMemberDevices : List all device sessions of a team's member.
DevicesListMemberDevices(arg *ListMemberDevicesArg) (res *ListMemberDevicesResult, err error)
// DevicesListMembersDevices : List all device sessions of a team.
+ // Permission : Team member file access.
DevicesListMembersDevices(arg *ListMembersDevicesArg) (res *ListMembersDevicesResult, err error)
- // DevicesListTeamDevices : List all device sessions of a team.
+ // DevicesListTeamDevices : List all device sessions of a team. Permission :
+ // Team member file access.
// Deprecated: Use `DevicesListMembersDevices` instead
DevicesListTeamDevices(arg *ListTeamDevicesArg) (res *ListTeamDevicesResult, err error)
// DevicesRevokeDeviceSession : Revoke a device session of a team's member.
@@ -168,6 +171,16 @@ type Client interface {
// `membersList`, use this to paginate through all team members. Permission
// : Team information.
MembersListContinue(arg *MembersListContinueArg) (res *MembersListResult, err error)
+ // MembersMoveFormerMemberFiles : Moves removed member's files to a
+ // different member. This endpoint initiates an asynchronous job. To obtain
+ // the final result of the job, the client should periodically poll
+ // `membersMoveFormerMemberFilesJobStatusCheck`. Permission : Team member
+ // management.
+ MembersMoveFormerMemberFiles(arg *MembersDataTransferArg) (res *async.LaunchEmptyResult, err error)
+ // MembersMoveFormerMemberFilesJobStatusCheck : Once an async_job_id is
+ // returned from `membersMoveFormerMemberFiles` , use this to poll the
+ // status of the asynchronous request. Permission : Team member management.
+ MembersMoveFormerMemberFilesJobStatusCheck(arg *async.PollArg) (res *async.PollEmptyResult, err error)
// MembersRecover : Recover a deleted member. Permission : Team member
// management Exactly one of team_member_id, email, or external_id must be
// provided to identify the user account.
@@ -219,16 +232,16 @@ type Client interface {
// `namespacesList`, use this to paginate through all team-accessible
// namespaces. Duplicates may occur in the list.
NamespacesListContinue(arg *TeamNamespacesListContinueArg) (res *TeamNamespacesListResult, err error)
- // PropertiesTemplateAdd : has no documentation (yet)
+ // PropertiesTemplateAdd : Permission : Team member file access.
// Deprecated:
PropertiesTemplateAdd(arg *file_properties.AddTemplateArg) (res *file_properties.AddTemplateResult, err error)
- // PropertiesTemplateGet : has no documentation (yet)
+ // PropertiesTemplateGet : Permission : Team member file access.
// Deprecated:
PropertiesTemplateGet(arg *file_properties.GetTemplateArg) (res *file_properties.GetTemplateResult, err error)
- // PropertiesTemplateList : has no documentation (yet)
+ // PropertiesTemplateList : Permission : Team member file access.
// Deprecated:
PropertiesTemplateList() (res *file_properties.ListTemplateResult, err error)
- // PropertiesTemplateUpdate : has no documentation (yet)
+ // PropertiesTemplateUpdate : Permission : Team member file access.
// Deprecated:
PropertiesTemplateUpdate(arg *file_properties.UpdateTemplateArg) (res *file_properties.UpdateTemplateResult, err error)
// ReportsGetActivity : Retrieves reporting data about a team's user
@@ -320,7 +333,7 @@ func (dbx *apiImpl) DevicesListMemberDevices(arg *ListMemberDevicesArg) (res *Li
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -338,17 +351,11 @@ func (dbx *apiImpl) DevicesListMemberDevices(arg *ListMemberDevicesArg) (res *Li
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -389,7 +396,7 @@ func (dbx *apiImpl) DevicesListMembersDevices(arg *ListMembersDevicesArg) (res *
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -407,17 +414,11 @@ func (dbx *apiImpl) DevicesListMembersDevices(arg *ListMembersDevicesArg) (res *
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -461,7 +462,7 @@ func (dbx *apiImpl) DevicesListTeamDevices(arg *ListTeamDevicesArg) (res *ListTe
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -479,17 +480,11 @@ func (dbx *apiImpl) DevicesListTeamDevices(arg *ListTeamDevicesArg) (res *ListTe
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -530,7 +525,7 @@ func (dbx *apiImpl) DevicesRevokeDeviceSession(arg *RevokeDeviceSessionArg) (err
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -543,17 +538,11 @@ func (dbx *apiImpl) DevicesRevokeDeviceSession(arg *RevokeDeviceSessionArg) (err
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -594,7 +583,7 @@ func (dbx *apiImpl) DevicesRevokeDeviceSessionBatch(arg *RevokeDeviceSessionBatc
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -612,17 +601,11 @@ func (dbx *apiImpl) DevicesRevokeDeviceSessionBatch(arg *RevokeDeviceSessionBatc
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -663,7 +646,7 @@ func (dbx *apiImpl) FeaturesGetValues(arg *FeaturesGetValuesBatchArg) (res *Feat
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -681,17 +664,11 @@ func (dbx *apiImpl) FeaturesGetValues(arg *FeaturesGetValuesBatchArg) (res *Feat
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -724,7 +701,7 @@ func (dbx *apiImpl) GetInfo() (res *TeamGetInfoResult, err error) {
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -742,17 +719,11 @@ func (dbx *apiImpl) GetInfo() (res *TeamGetInfoResult, err error) {
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -793,7 +764,7 @@ func (dbx *apiImpl) GroupsCreate(arg *GroupCreateArg) (res *GroupFullInfo, err e
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -811,17 +782,11 @@ func (dbx *apiImpl) GroupsCreate(arg *GroupCreateArg) (res *GroupFullInfo, err e
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -862,7 +827,7 @@ func (dbx *apiImpl) GroupsDelete(arg *GroupSelector) (res *async.LaunchEmptyResu
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -880,17 +845,11 @@ func (dbx *apiImpl) GroupsDelete(arg *GroupSelector) (res *async.LaunchEmptyResu
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -931,7 +890,7 @@ func (dbx *apiImpl) GroupsGetInfo(arg *GroupsSelector) (res []*GroupsGetInfoItem
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -949,17 +908,11 @@ func (dbx *apiImpl) GroupsGetInfo(arg *GroupsSelector) (res []*GroupsGetInfoItem
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1000,7 +953,7 @@ func (dbx *apiImpl) GroupsJobStatusGet(arg *async.PollArg) (res *async.PollEmpty
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1018,17 +971,11 @@ func (dbx *apiImpl) GroupsJobStatusGet(arg *async.PollArg) (res *async.PollEmpty
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1069,7 +1016,7 @@ func (dbx *apiImpl) GroupsList(arg *GroupsListArg) (res *GroupsListResult, err e
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1087,17 +1034,11 @@ func (dbx *apiImpl) GroupsList(arg *GroupsListArg) (res *GroupsListResult, err e
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1138,7 +1079,7 @@ func (dbx *apiImpl) GroupsListContinue(arg *GroupsListContinueArg) (res *GroupsL
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1156,17 +1097,11 @@ func (dbx *apiImpl) GroupsListContinue(arg *GroupsListContinueArg) (res *GroupsL
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1207,7 +1142,7 @@ func (dbx *apiImpl) GroupsMembersAdd(arg *GroupMembersAddArg) (res *GroupMembers
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1225,17 +1160,11 @@ func (dbx *apiImpl) GroupsMembersAdd(arg *GroupMembersAddArg) (res *GroupMembers
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1276,7 +1205,7 @@ func (dbx *apiImpl) GroupsMembersList(arg *GroupsMembersListArg) (res *GroupsMem
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1294,17 +1223,11 @@ func (dbx *apiImpl) GroupsMembersList(arg *GroupsMembersListArg) (res *GroupsMem
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1345,7 +1268,7 @@ func (dbx *apiImpl) GroupsMembersListContinue(arg *GroupsMembersListContinueArg)
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1363,17 +1286,11 @@ func (dbx *apiImpl) GroupsMembersListContinue(arg *GroupsMembersListContinueArg)
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1414,7 +1331,7 @@ func (dbx *apiImpl) GroupsMembersRemove(arg *GroupMembersRemoveArg) (res *GroupM
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1432,17 +1349,11 @@ func (dbx *apiImpl) GroupsMembersRemove(arg *GroupMembersRemoveArg) (res *GroupM
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1483,7 +1394,7 @@ func (dbx *apiImpl) GroupsMembersSetAccessType(arg *GroupMembersSetAccessTypeArg
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1501,17 +1412,11 @@ func (dbx *apiImpl) GroupsMembersSetAccessType(arg *GroupMembersSetAccessTypeArg
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1552,7 +1457,7 @@ func (dbx *apiImpl) GroupsUpdate(arg *GroupUpdateArgs) (res *GroupFullInfo, err
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1570,17 +1475,11 @@ func (dbx *apiImpl) GroupsUpdate(arg *GroupUpdateArgs) (res *GroupFullInfo, err
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1621,7 +1520,7 @@ func (dbx *apiImpl) LinkedAppsListMemberLinkedApps(arg *ListMemberAppsArg) (res
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1639,17 +1538,11 @@ func (dbx *apiImpl) LinkedAppsListMemberLinkedApps(arg *ListMemberAppsArg) (res
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1690,7 +1583,7 @@ func (dbx *apiImpl) LinkedAppsListMembersLinkedApps(arg *ListMembersAppsArg) (re
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1708,17 +1601,11 @@ func (dbx *apiImpl) LinkedAppsListMembersLinkedApps(arg *ListMembersAppsArg) (re
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1762,7 +1649,7 @@ func (dbx *apiImpl) LinkedAppsListTeamLinkedApps(arg *ListTeamAppsArg) (res *Lis
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1780,17 +1667,11 @@ func (dbx *apiImpl) LinkedAppsListTeamLinkedApps(arg *ListTeamAppsArg) (res *Lis
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1831,7 +1712,7 @@ func (dbx *apiImpl) LinkedAppsRevokeLinkedApp(arg *RevokeLinkedApiAppArg) (err e
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -1844,17 +1725,11 @@ func (dbx *apiImpl) LinkedAppsRevokeLinkedApp(arg *RevokeLinkedApiAppArg) (err e
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1895,7 +1770,7 @@ func (dbx *apiImpl) LinkedAppsRevokeLinkedAppBatch(arg *RevokeLinkedApiAppBatchA
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1913,17 +1788,11 @@ func (dbx *apiImpl) LinkedAppsRevokeLinkedAppBatch(arg *RevokeLinkedApiAppBatchA
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -1964,7 +1833,7 @@ func (dbx *apiImpl) MemberSpaceLimitsExcludedUsersAdd(arg *ExcludedUsersUpdateAr
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -1982,17 +1851,11 @@ func (dbx *apiImpl) MemberSpaceLimitsExcludedUsersAdd(arg *ExcludedUsersUpdateAr
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2033,7 +1896,7 @@ func (dbx *apiImpl) MemberSpaceLimitsExcludedUsersList(arg *ExcludedUsersListArg
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2051,17 +1914,11 @@ func (dbx *apiImpl) MemberSpaceLimitsExcludedUsersList(arg *ExcludedUsersListArg
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2102,7 +1959,7 @@ func (dbx *apiImpl) MemberSpaceLimitsExcludedUsersListContinue(arg *ExcludedUser
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2120,17 +1977,11 @@ func (dbx *apiImpl) MemberSpaceLimitsExcludedUsersListContinue(arg *ExcludedUser
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2171,7 +2022,7 @@ func (dbx *apiImpl) MemberSpaceLimitsExcludedUsersRemove(arg *ExcludedUsersUpdat
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2189,17 +2040,11 @@ func (dbx *apiImpl) MemberSpaceLimitsExcludedUsersRemove(arg *ExcludedUsersUpdat
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2240,7 +2085,7 @@ func (dbx *apiImpl) MemberSpaceLimitsGetCustomQuota(arg *CustomQuotaUsersArg) (r
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2258,17 +2103,11 @@ func (dbx *apiImpl) MemberSpaceLimitsGetCustomQuota(arg *CustomQuotaUsersArg) (r
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2309,7 +2148,7 @@ func (dbx *apiImpl) MemberSpaceLimitsRemoveCustomQuota(arg *CustomQuotaUsersArg)
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2327,17 +2166,11 @@ func (dbx *apiImpl) MemberSpaceLimitsRemoveCustomQuota(arg *CustomQuotaUsersArg)
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2378,7 +2211,7 @@ func (dbx *apiImpl) MemberSpaceLimitsSetCustomQuota(arg *SetCustomQuotaArg) (res
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2396,17 +2229,11 @@ func (dbx *apiImpl) MemberSpaceLimitsSetCustomQuota(arg *SetCustomQuotaArg) (res
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2447,7 +2274,7 @@ func (dbx *apiImpl) MembersAdd(arg *MembersAddArg) (res *MembersAddLaunch, err e
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2465,17 +2292,11 @@ func (dbx *apiImpl) MembersAdd(arg *MembersAddArg) (res *MembersAddLaunch, err e
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2516,7 +2337,7 @@ func (dbx *apiImpl) MembersAddJobStatusGet(arg *async.PollArg) (res *MembersAddJ
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2534,17 +2355,11 @@ func (dbx *apiImpl) MembersAddJobStatusGet(arg *async.PollArg) (res *MembersAddJ
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2585,7 +2400,7 @@ func (dbx *apiImpl) MembersGetInfo(arg *MembersGetInfoArgs) (res []*MembersGetIn
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2603,17 +2418,11 @@ func (dbx *apiImpl) MembersGetInfo(arg *MembersGetInfoArgs) (res []*MembersGetIn
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2654,7 +2463,7 @@ func (dbx *apiImpl) MembersList(arg *MembersListArg) (res *MembersListResult, er
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2672,17 +2481,11 @@ func (dbx *apiImpl) MembersList(arg *MembersListArg) (res *MembersListResult, er
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2723,7 +2526,7 @@ func (dbx *apiImpl) MembersListContinue(arg *MembersListContinueArg) (res *Membe
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2741,17 +2544,137 @@ func (dbx *apiImpl) MembersListContinue(arg *MembersListContinueArg) (res *Membe
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
+ if err != nil {
+ return
+ }
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
+ return
+}
+
+//MembersMoveFormerMemberFilesAPIError is an error-wrapper for the members/move_former_member_files route
+type MembersMoveFormerMemberFilesAPIError struct {
+ dropbox.APIError
+ EndpointError *MembersTransferFormerMembersFilesError `json:"error"`
+}
+
+func (dbx *apiImpl) MembersMoveFormerMemberFiles(arg *MembersDataTransferArg) (res *async.LaunchEmptyResult, err error) {
+ cli := dbx.Client
+
+ dbx.Config.LogDebug("arg: %v", arg)
+ b, err := json.Marshal(arg)
+ if err != nil {
+ return
+ }
+
+ headers := map[string]string{
+ "Content-Type": "application/json",
+ }
+
+ req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/move_former_member_files", headers, bytes.NewReader(b))
+ if err != nil {
+ return
+ }
+ dbx.Config.LogInfo("req: %v", req)
+
+ resp, err := cli.Do(req)
+ if err != nil {
+ return
+ }
+
+ dbx.Config.LogInfo("resp: %v", resp)
+ defer resp.Body.Close()
+ body, err := ioutil.ReadAll(resp.Body)
+ if err != nil {
+ return
+ }
+
+ dbx.Config.LogDebug("body: %s", body)
+ if resp.StatusCode == http.StatusOK {
+ err = json.Unmarshal(body, &res)
+ if err != nil {
+ return
+ }
+
+ return
+ }
+ if resp.StatusCode == http.StatusConflict {
+ var apiError MembersMoveFormerMemberFilesAPIError
+ err = json.Unmarshal(body, &apiError)
+ if err != nil {
+ return
+ }
err = apiError
return
}
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
+ return
+}
+
+//MembersMoveFormerMemberFilesJobStatusCheckAPIError is an error-wrapper for the members/move_former_member_files/job_status/check route
+type MembersMoveFormerMemberFilesJobStatusCheckAPIError struct {
+ dropbox.APIError
+ EndpointError *async.PollError `json:"error"`
+}
+
+func (dbx *apiImpl) MembersMoveFormerMemberFilesJobStatusCheck(arg *async.PollArg) (res *async.PollEmptyResult, err error) {
+ cli := dbx.Client
+
+ dbx.Config.LogDebug("arg: %v", arg)
+ b, err := json.Marshal(arg)
+ if err != nil {
+ return
+ }
+
+ headers := map[string]string{
+ "Content-Type": "application/json",
+ }
+
+ req, err := (*dropbox.Context)(dbx).NewRequest("api", "rpc", true, "team", "members/move_former_member_files/job_status/check", headers, bytes.NewReader(b))
+ if err != nil {
+ return
+ }
+ dbx.Config.LogInfo("req: %v", req)
+
+ resp, err := cli.Do(req)
+ if err != nil {
+ return
+ }
+
+ dbx.Config.LogInfo("resp: %v", resp)
+ defer resp.Body.Close()
+ body, err := ioutil.ReadAll(resp.Body)
+ if err != nil {
+ return
+ }
+
+ dbx.Config.LogDebug("body: %s", body)
+ if resp.StatusCode == http.StatusOK {
+ err = json.Unmarshal(body, &res)
+ if err != nil {
+ return
+ }
+
+ return
+ }
+ if resp.StatusCode == http.StatusConflict {
+ var apiError MembersMoveFormerMemberFilesJobStatusCheckAPIError
+ err = json.Unmarshal(body, &apiError)
+ if err != nil {
+ return
+ }
+ err = apiError
+ return
+ }
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
+ if err != nil {
+ return
+ }
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2792,7 +2715,7 @@ func (dbx *apiImpl) MembersRecover(arg *MembersRecoverArg) (err error) {
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -2805,17 +2728,11 @@ func (dbx *apiImpl) MembersRecover(arg *MembersRecoverArg) (err error) {
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2856,7 +2773,7 @@ func (dbx *apiImpl) MembersRemove(arg *MembersRemoveArg) (res *async.LaunchEmpty
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2874,17 +2791,11 @@ func (dbx *apiImpl) MembersRemove(arg *MembersRemoveArg) (res *async.LaunchEmpty
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2925,7 +2836,7 @@ func (dbx *apiImpl) MembersRemoveJobStatusGet(arg *async.PollArg) (res *async.Po
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -2943,17 +2854,11 @@ func (dbx *apiImpl) MembersRemoveJobStatusGet(arg *async.PollArg) (res *async.Po
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -2994,7 +2899,7 @@ func (dbx *apiImpl) MembersSendWelcomeEmail(arg *UserSelectorArg) (err error) {
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -3007,17 +2912,11 @@ func (dbx *apiImpl) MembersSendWelcomeEmail(arg *UserSelectorArg) (err error) {
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3058,7 +2957,7 @@ func (dbx *apiImpl) MembersSetAdminPermissions(arg *MembersSetPermissionsArg) (r
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3076,17 +2975,11 @@ func (dbx *apiImpl) MembersSetAdminPermissions(arg *MembersSetPermissionsArg) (r
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3127,7 +3020,7 @@ func (dbx *apiImpl) MembersSetProfile(arg *MembersSetProfileArg) (res *TeamMembe
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3145,17 +3038,11 @@ func (dbx *apiImpl) MembersSetProfile(arg *MembersSetProfileArg) (res *TeamMembe
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3196,7 +3083,7 @@ func (dbx *apiImpl) MembersSuspend(arg *MembersDeactivateArg) (err error) {
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -3209,17 +3096,11 @@ func (dbx *apiImpl) MembersSuspend(arg *MembersDeactivateArg) (err error) {
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3260,7 +3141,7 @@ func (dbx *apiImpl) MembersUnsuspend(arg *MembersUnsuspendArg) (err error) {
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -3273,24 +3154,18 @@ func (dbx *apiImpl) MembersUnsuspend(arg *MembersUnsuspendArg) (err error) {
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
//NamespacesListAPIError is an error-wrapper for the namespaces/list route
type NamespacesListAPIError struct {
dropbox.APIError
- EndpointError struct{} `json:"error"`
+ EndpointError *TeamNamespacesListError `json:"error"`
}
func (dbx *apiImpl) NamespacesList(arg *TeamNamespacesListArg) (res *TeamNamespacesListResult, err error) {
@@ -3324,7 +3199,7 @@ func (dbx *apiImpl) NamespacesList(arg *TeamNamespacesListArg) (res *TeamNamespa
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3342,17 +3217,11 @@ func (dbx *apiImpl) NamespacesList(arg *TeamNamespacesListArg) (res *TeamNamespa
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3393,7 +3262,7 @@ func (dbx *apiImpl) NamespacesListContinue(arg *TeamNamespacesListContinueArg) (
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3411,17 +3280,11 @@ func (dbx *apiImpl) NamespacesListContinue(arg *TeamNamespacesListContinueArg) (
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3464,7 +3327,7 @@ func (dbx *apiImpl) PropertiesTemplateAdd(arg *file_properties.AddTemplateArg) (
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3482,17 +3345,11 @@ func (dbx *apiImpl) PropertiesTemplateAdd(arg *file_properties.AddTemplateArg) (
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3535,7 +3392,7 @@ func (dbx *apiImpl) PropertiesTemplateGet(arg *file_properties.GetTemplateArg) (
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3553,17 +3410,11 @@ func (dbx *apiImpl) PropertiesTemplateGet(arg *file_properties.GetTemplateArg) (
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3598,7 +3449,7 @@ func (dbx *apiImpl) PropertiesTemplateList() (res *file_properties.ListTemplateR
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3616,17 +3467,11 @@ func (dbx *apiImpl) PropertiesTemplateList() (res *file_properties.ListTemplateR
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3669,7 +3514,7 @@ func (dbx *apiImpl) PropertiesTemplateUpdate(arg *file_properties.UpdateTemplate
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3687,17 +3532,11 @@ func (dbx *apiImpl) PropertiesTemplateUpdate(arg *file_properties.UpdateTemplate
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3738,7 +3577,7 @@ func (dbx *apiImpl) ReportsGetActivity(arg *DateRange) (res *GetActivityReport,
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3756,17 +3595,11 @@ func (dbx *apiImpl) ReportsGetActivity(arg *DateRange) (res *GetActivityReport,
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3807,7 +3640,7 @@ func (dbx *apiImpl) ReportsGetDevices(arg *DateRange) (res *GetDevicesReport, er
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3825,17 +3658,11 @@ func (dbx *apiImpl) ReportsGetDevices(arg *DateRange) (res *GetDevicesReport, er
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3876,7 +3703,7 @@ func (dbx *apiImpl) ReportsGetMembership(arg *DateRange) (res *GetMembershipRepo
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3894,17 +3721,11 @@ func (dbx *apiImpl) ReportsGetMembership(arg *DateRange) (res *GetMembershipRepo
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -3945,7 +3766,7 @@ func (dbx *apiImpl) ReportsGetStorage(arg *DateRange) (res *GetStorageReport, er
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -3963,17 +3784,11 @@ func (dbx *apiImpl) ReportsGetStorage(arg *DateRange) (res *GetStorageReport, er
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -4014,7 +3829,7 @@ func (dbx *apiImpl) TeamFolderActivate(arg *TeamFolderIdArg) (res *TeamFolderMet
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -4032,17 +3847,11 @@ func (dbx *apiImpl) TeamFolderActivate(arg *TeamFolderIdArg) (res *TeamFolderMet
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -4083,7 +3892,7 @@ func (dbx *apiImpl) TeamFolderArchive(arg *TeamFolderArchiveArg) (res *TeamFolde
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -4101,17 +3910,11 @@ func (dbx *apiImpl) TeamFolderArchive(arg *TeamFolderArchiveArg) (res *TeamFolde
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -4152,7 +3955,7 @@ func (dbx *apiImpl) TeamFolderArchiveCheck(arg *async.PollArg) (res *TeamFolderA
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -4170,17 +3973,11 @@ func (dbx *apiImpl) TeamFolderArchiveCheck(arg *async.PollArg) (res *TeamFolderA
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -4221,7 +4018,7 @@ func (dbx *apiImpl) TeamFolderCreate(arg *TeamFolderCreateArg) (res *TeamFolderM
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -4239,17 +4036,11 @@ func (dbx *apiImpl) TeamFolderCreate(arg *TeamFolderCreateArg) (res *TeamFolderM
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -4290,7 +4081,7 @@ func (dbx *apiImpl) TeamFolderGetInfo(arg *TeamFolderIdListArg) (res []*TeamFold
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -4308,17 +4099,11 @@ func (dbx *apiImpl) TeamFolderGetInfo(arg *TeamFolderIdListArg) (res []*TeamFold
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -4359,7 +4144,7 @@ func (dbx *apiImpl) TeamFolderList(arg *TeamFolderListArg) (res *TeamFolderListR
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -4377,17 +4162,11 @@ func (dbx *apiImpl) TeamFolderList(arg *TeamFolderListArg) (res *TeamFolderListR
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -4428,7 +4207,7 @@ func (dbx *apiImpl) TeamFolderListContinue(arg *TeamFolderListContinueArg) (res
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -4446,17 +4225,11 @@ func (dbx *apiImpl) TeamFolderListContinue(arg *TeamFolderListContinueArg) (res
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -4497,7 +4270,7 @@ func (dbx *apiImpl) TeamFolderPermanentlyDelete(arg *TeamFolderIdArg) (err error
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
return
}
@@ -4510,17 +4283,11 @@ func (dbx *apiImpl) TeamFolderPermanentlyDelete(arg *TeamFolderIdArg) (err error
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -4561,7 +4328,7 @@ func (dbx *apiImpl) TeamFolderRename(arg *TeamFolderRenameArg) (res *TeamFolderM
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -4579,17 +4346,11 @@ func (dbx *apiImpl) TeamFolderRename(arg *TeamFolderRenameArg) (res *TeamFolderM
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -4630,7 +4391,7 @@ func (dbx *apiImpl) TeamFolderUpdateSyncSettings(arg *TeamFolderUpdateSyncSettin
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -4648,17 +4409,11 @@ func (dbx *apiImpl) TeamFolderUpdateSyncSettings(arg *TeamFolderUpdateSyncSettin
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -4691,7 +4446,7 @@ func (dbx *apiImpl) TokenGetAuthenticatedAdmin() (res *TokenGetAuthenticatedAdmi
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -4709,17 +4464,11 @@ func (dbx *apiImpl) TokenGetAuthenticatedAdmin() (res *TokenGetAuthenticatedAdmi
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team/types.go
index 2160d404f..d8f65fad2 100644
--- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team/types.go
+++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team/types.go
@@ -2315,11 +2315,43 @@ func (u *MembersAddLaunch) UnmarshalJSON(body []byte) error {
return nil
}
-// MembersDeactivateArg : Exactly one of team_member_id, email, or external_id
-// must be provided to identify the user account.
-type MembersDeactivateArg struct {
- // User : Identity of user to remove/suspend.
+// MembersDeactivateBaseArg : Exactly one of team_member_id, email, or
+// external_id must be provided to identify the user account.
+type MembersDeactivateBaseArg struct {
+ // User : Identity of user to remove/suspend/have their files moved.
User *UserSelectorArg `json:"user"`
+}
+
+// NewMembersDeactivateBaseArg returns a new MembersDeactivateBaseArg instance
+func NewMembersDeactivateBaseArg(User *UserSelectorArg) *MembersDeactivateBaseArg {
+ s := new(MembersDeactivateBaseArg)
+ s.User = User
+ return s
+}
+
+// MembersDataTransferArg : has no documentation (yet)
+type MembersDataTransferArg struct {
+ MembersDeactivateBaseArg
+ // TransferDestId : Files from the deleted member account will be
+ // transferred to this user.
+ TransferDestId *UserSelectorArg `json:"transfer_dest_id"`
+ // TransferAdminId : Errors during the transfer process will be sent via
+ // email to this user.
+ TransferAdminId *UserSelectorArg `json:"transfer_admin_id"`
+}
+
+// NewMembersDataTransferArg returns a new MembersDataTransferArg instance
+func NewMembersDataTransferArg(User *UserSelectorArg, TransferDestId *UserSelectorArg, TransferAdminId *UserSelectorArg) *MembersDataTransferArg {
+ s := new(MembersDataTransferArg)
+ s.User = User
+ s.TransferDestId = TransferDestId
+ s.TransferAdminId = TransferAdminId
+ return s
+}
+
+// MembersDeactivateArg : has no documentation (yet)
+type MembersDeactivateArg struct {
+ MembersDeactivateBaseArg
// WipeData : If provided, controls if the user's data will be deleted on
// their linked devices.
WipeData bool `json:"wipe_data"`
@@ -2542,6 +2574,27 @@ func NewMembersRemoveArg(User *UserSelectorArg) *MembersRemoveArg {
return s
}
+// MembersTransferFilesError : has no documentation (yet)
+type MembersTransferFilesError struct {
+ dropbox.Tagged
+}
+
+// Valid tag values for MembersTransferFilesError
+const (
+ MembersTransferFilesErrorUserNotFound = "user_not_found"
+ MembersTransferFilesErrorUserNotInTeam = "user_not_in_team"
+ MembersTransferFilesErrorOther = "other"
+ MembersTransferFilesErrorRemovedAndTransferDestShouldDiffer = "removed_and_transfer_dest_should_differ"
+ MembersTransferFilesErrorRemovedAndTransferAdminShouldDiffer = "removed_and_transfer_admin_should_differ"
+ MembersTransferFilesErrorTransferDestUserNotFound = "transfer_dest_user_not_found"
+ MembersTransferFilesErrorTransferDestUserNotInTeam = "transfer_dest_user_not_in_team"
+ MembersTransferFilesErrorTransferAdminUserNotInTeam = "transfer_admin_user_not_in_team"
+ MembersTransferFilesErrorTransferAdminUserNotFound = "transfer_admin_user_not_found"
+ MembersTransferFilesErrorUnspecifiedTransferAdminId = "unspecified_transfer_admin_id"
+ MembersTransferFilesErrorTransferAdminIsNotAdmin = "transfer_admin_is_not_admin"
+ MembersTransferFilesErrorRecipientNotVerified = "recipient_not_verified"
+)
+
// MembersRemoveError : has no documentation (yet)
type MembersRemoveError struct {
dropbox.Tagged
@@ -2552,15 +2605,16 @@ const (
MembersRemoveErrorUserNotFound = "user_not_found"
MembersRemoveErrorUserNotInTeam = "user_not_in_team"
MembersRemoveErrorOther = "other"
- MembersRemoveErrorRemoveLastAdmin = "remove_last_admin"
MembersRemoveErrorRemovedAndTransferDestShouldDiffer = "removed_and_transfer_dest_should_differ"
MembersRemoveErrorRemovedAndTransferAdminShouldDiffer = "removed_and_transfer_admin_should_differ"
MembersRemoveErrorTransferDestUserNotFound = "transfer_dest_user_not_found"
MembersRemoveErrorTransferDestUserNotInTeam = "transfer_dest_user_not_in_team"
- MembersRemoveErrorTransferAdminUserNotFound = "transfer_admin_user_not_found"
MembersRemoveErrorTransferAdminUserNotInTeam = "transfer_admin_user_not_in_team"
+ MembersRemoveErrorTransferAdminUserNotFound = "transfer_admin_user_not_found"
MembersRemoveErrorUnspecifiedTransferAdminId = "unspecified_transfer_admin_id"
MembersRemoveErrorTransferAdminIsNotAdmin = "transfer_admin_is_not_admin"
+ MembersRemoveErrorRecipientNotVerified = "recipient_not_verified"
+ MembersRemoveErrorRemoveLastAdmin = "remove_last_admin"
MembersRemoveErrorCannotKeepAccountAndTransfer = "cannot_keep_account_and_transfer"
MembersRemoveErrorCannotKeepAccountAndDeleteData = "cannot_keep_account_and_delete_data"
MembersRemoveErrorEmailAddressTooLongToBeDisabled = "email_address_too_long_to_be_disabled"
@@ -2692,6 +2746,31 @@ const (
MembersSuspendErrorTeamLicenseLimit = "team_license_limit"
)
+// MembersTransferFormerMembersFilesError : has no documentation (yet)
+type MembersTransferFormerMembersFilesError struct {
+ dropbox.Tagged
+}
+
+// Valid tag values for MembersTransferFormerMembersFilesError
+const (
+ MembersTransferFormerMembersFilesErrorUserNotFound = "user_not_found"
+ MembersTransferFormerMembersFilesErrorUserNotInTeam = "user_not_in_team"
+ MembersTransferFormerMembersFilesErrorOther = "other"
+ MembersTransferFormerMembersFilesErrorRemovedAndTransferDestShouldDiffer = "removed_and_transfer_dest_should_differ"
+ MembersTransferFormerMembersFilesErrorRemovedAndTransferAdminShouldDiffer = "removed_and_transfer_admin_should_differ"
+ MembersTransferFormerMembersFilesErrorTransferDestUserNotFound = "transfer_dest_user_not_found"
+ MembersTransferFormerMembersFilesErrorTransferDestUserNotInTeam = "transfer_dest_user_not_in_team"
+ MembersTransferFormerMembersFilesErrorTransferAdminUserNotInTeam = "transfer_admin_user_not_in_team"
+ MembersTransferFormerMembersFilesErrorTransferAdminUserNotFound = "transfer_admin_user_not_found"
+ MembersTransferFormerMembersFilesErrorUnspecifiedTransferAdminId = "unspecified_transfer_admin_id"
+ MembersTransferFormerMembersFilesErrorTransferAdminIsNotAdmin = "transfer_admin_is_not_admin"
+ MembersTransferFormerMembersFilesErrorRecipientNotVerified = "recipient_not_verified"
+ MembersTransferFormerMembersFilesErrorUserDataIsBeingTransferred = "user_data_is_being_transferred"
+ MembersTransferFormerMembersFilesErrorUserNotRemoved = "user_not_removed"
+ MembersTransferFormerMembersFilesErrorUserDataCannotBeTransferred = "user_data_cannot_be_transferred"
+ MembersTransferFormerMembersFilesErrorUserDataAlreadyTransferred = "user_data_already_transferred"
+)
+
// MembersUnsuspendArg : Exactly one of team_member_id, email, or external_id
// must be provided to identify the user account.
type MembersUnsuspendArg struct {
@@ -2848,12 +2927,16 @@ func (u *RemoveCustomQuotaResult) UnmarshalJSON(body []byte) error {
type RemovedStatus struct {
// IsRecoverable : True if the removed team member is recoverable.
IsRecoverable bool `json:"is_recoverable"`
+ // IsDisconnected : True if the team member's account was converted to
+ // individual account.
+ IsDisconnected bool `json:"is_disconnected"`
}
// NewRemovedStatus returns a new RemovedStatus instance
-func NewRemovedStatus(IsRecoverable bool) *RemovedStatus {
+func NewRemovedStatus(IsRecoverable bool, IsDisconnected bool) *RemovedStatus {
s := new(RemovedStatus)
s.IsRecoverable = IsRecoverable
+ s.IsDisconnected = IsDisconnected
return s
}
@@ -4002,6 +4085,17 @@ func NewTeamNamespacesListContinueArg(Cursor string) *TeamNamespacesListContinue
return s
}
+// TeamNamespacesListError : has no documentation (yet)
+type TeamNamespacesListError struct {
+ dropbox.Tagged
+}
+
+// Valid tag values for TeamNamespacesListError
+const (
+ TeamNamespacesListErrorInvalidArg = "invalid_arg"
+ TeamNamespacesListErrorOther = "other"
+)
+
// TeamNamespacesListContinueError : has no documentation (yet)
type TeamNamespacesListContinueError struct {
dropbox.Tagged
@@ -4009,8 +4103,9 @@ type TeamNamespacesListContinueError struct {
// Valid tag values for TeamNamespacesListContinueError
const (
- TeamNamespacesListContinueErrorInvalidCursor = "invalid_cursor"
+ TeamNamespacesListContinueErrorInvalidArg = "invalid_arg"
TeamNamespacesListContinueErrorOther = "other"
+ TeamNamespacesListContinueErrorInvalidCursor = "invalid_cursor"
)
// TeamNamespacesListResult : Result for `namespacesList`.
diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_policies/types.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_policies/types.go
index 8871bf331..9c003f437 100644
--- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_policies/types.go
+++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_policies/types.go
@@ -23,6 +23,18 @@ package team_policies
import "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox"
+// CameraUploadsPolicyState : has no documentation (yet)
+type CameraUploadsPolicyState struct {
+ dropbox.Tagged
+}
+
+// Valid tag values for CameraUploadsPolicyState
+const (
+ CameraUploadsPolicyStateDisabled = "disabled"
+ CameraUploadsPolicyStateEnabled = "enabled"
+ CameraUploadsPolicyStateOther = "other"
+)
+
// EmmState : has no documentation (yet)
type EmmState struct {
dropbox.Tagged
diff --git a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users/client.go b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users/client.go
index 4ef71b736..c67ed7710 100644
--- a/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users/client.go
+++ b/vendor/github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users/client.go
@@ -27,6 +27,7 @@ import (
"net/http"
"github.com/dropbox/dropbox-sdk-go-unofficial/dropbox"
+ "github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth"
)
// Client interface describes all routes in this namespace
@@ -85,7 +86,7 @@ func (dbx *apiImpl) GetAccount(arg *GetAccountArg) (res *BasicAccount, err error
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -103,17 +104,11 @@ func (dbx *apiImpl) GetAccount(arg *GetAccountArg) (res *BasicAccount, err error
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -157,7 +152,7 @@ func (dbx *apiImpl) GetAccountBatch(arg *GetAccountBatchArg) (res []*BasicAccoun
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -175,17 +170,11 @@ func (dbx *apiImpl) GetAccountBatch(arg *GetAccountBatchArg) (res []*BasicAccoun
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -221,7 +210,7 @@ func (dbx *apiImpl) GetCurrentAccount() (res *FullAccount, err error) {
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -239,17 +228,11 @@ func (dbx *apiImpl) GetCurrentAccount() (res *FullAccount, err error) {
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
@@ -285,7 +268,7 @@ func (dbx *apiImpl) GetSpaceUsage() (res *SpaceUsage, err error) {
return
}
- dbx.Config.LogDebug("body: %v", body)
+ dbx.Config.LogDebug("body: %s", body)
if resp.StatusCode == http.StatusOK {
err = json.Unmarshal(body, &res)
if err != nil {
@@ -303,17 +286,11 @@ func (dbx *apiImpl) GetSpaceUsage() (res *SpaceUsage, err error) {
err = apiError
return
}
- var apiError dropbox.APIError
- if resp.StatusCode == http.StatusBadRequest || resp.StatusCode == http.StatusInternalServerError {
- apiError.ErrorSummary = string(body)
- err = apiError
- return
- }
- err = json.Unmarshal(body, &apiError)
+ err = auth.HandleCommonAuthErrors(dbx.Config, resp, body)
if err != nil {
return
}
- err = apiError
+ err = dropbox.HandleCommonAPIErrors(dbx.Config, resp, body)
return
}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 8762e2757..120d2f35b 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -63,7 +63,7 @@ github.com/cpuguy83/go-md2man/md2man
github.com/davecgh/go-spew/spew
# github.com/djherbis/times v1.1.0
github.com/djherbis/times
-# github.com/dropbox/dropbox-sdk-go-unofficial v4.1.0+incompatible
+# github.com/dropbox/dropbox-sdk-go-unofficial v5.0.1-0.20181205034806-56e5f6595305+incompatible
github.com/dropbox/dropbox-sdk-go-unofficial/dropbox
github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/common
github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/files
@@ -71,6 +71,7 @@ github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/sharing
github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team
github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/users
github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/async
+github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/auth
github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/file_properties
github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/seen_state
github.com/dropbox/dropbox-sdk-go-unofficial/dropbox/team_common