vendor: update all dependencies

This commit is contained in:
Nick Craig-Wood 2020-02-25 14:20:57 +00:00
parent 17b4058ee9
commit abb9f89f65
443 changed files with 32118 additions and 18237 deletions

View file

@ -49,6 +49,10 @@ const (
func (u *LaunchResultBase) UnmarshalJSON(body []byte) error {
type wrap 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"`
}
var w wrap
var err error
@ -58,7 +62,7 @@ func (u *LaunchResultBase) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "async_job_id":
err = json.Unmarshal(body, &u.AsyncJobId)
u.AsyncJobId = w.AsyncJobId
if err != nil {
return err
@ -88,6 +92,10 @@ const (
func (u *LaunchEmptyResult) UnmarshalJSON(body []byte) error {
type wrap 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"`
}
var w wrap
var err error
@ -97,7 +105,7 @@ func (u *LaunchEmptyResult) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "async_job_id":
err = json.Unmarshal(body, &u.AsyncJobId)
u.AsyncJobId = w.AsyncJobId
if err != nil {
return err

View file

@ -49,9 +49,9 @@ 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"`
InvalidAccountType *InvalidAccountTypeError `json:"invalid_account_type,omitempty"`
// PaperAccessDenied : Current account cannot access Paper.
PaperAccessDenied json.RawMessage `json:"paper_access_denied,omitempty"`
PaperAccessDenied *PaperAccessError `json:"paper_access_denied,omitempty"`
}
var w wrap
var err error
@ -61,13 +61,13 @@ func (u *AccessError) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "invalid_account_type":
err = json.Unmarshal(w.InvalidAccountType, &u.InvalidAccountType)
u.InvalidAccountType = w.InvalidAccountType
if err != nil {
return err
}
case "paper_access_denied":
err = json.Unmarshal(w.PaperAccessDenied, &u.PaperAccessDenied)
u.PaperAccessDenied = w.PaperAccessDenied
if err != nil {
return err
@ -79,6 +79,9 @@ func (u *AccessError) UnmarshalJSON(body []byte) error {
// AuthError : Errors occurred during authentication.
type AuthError struct {
dropbox.Tagged
// MissingScope : The access token does not have the required scope to
// access the route.
MissingScope *TokenScopeError `json:"missing_scope,omitempty"`
}
// Valid tag values for AuthError
@ -88,9 +91,32 @@ const (
AuthErrorInvalidSelectAdmin = "invalid_select_admin"
AuthErrorUserSuspended = "user_suspended"
AuthErrorExpiredAccessToken = "expired_access_token"
AuthErrorMissingScope = "missing_scope"
AuthErrorOther = "other"
)
// UnmarshalJSON deserializes into a AuthError instance
func (u *AuthError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
}
var w wrap
var err error
if err = json.Unmarshal(body, &w); err != nil {
return err
}
u.Tag = w.Tag
switch u.Tag {
case "missing_scope":
err = json.Unmarshal(body, &u.MissingScope)
if err != nil {
return err
}
}
return nil
}
// InvalidAccountTypeError : has no documentation (yet)
type InvalidAccountTypeError struct {
dropbox.Tagged
@ -186,3 +212,16 @@ func NewTokenFromOAuth1Result(Oauth2Token string) *TokenFromOAuth1Result {
s.Oauth2Token = Oauth2Token
return s
}
// TokenScopeError : has no documentation (yet)
type TokenScopeError struct {
// RequiredScope : The required scope to access the route.
RequiredScope string `json:"required_scope"`
}
// NewTokenScopeError returns a new TokenScopeError instance
func NewTokenScopeError(RequiredScope string) *TokenScopeError {
s := new(TokenScopeError)
s.RequiredScope = RequiredScope
return s
}

View file

@ -52,6 +52,14 @@ const (
func (u *PathRoot) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// Root : Paths are relative to the authenticating user's root namespace
// (This results in `PathRootError.invalid_root` if the user's root
// namespace has changed.).
Root string `json:"root,omitempty"`
// NamespaceId : Paths are relative to given namespace id (This results
// in `PathRootError.no_permission` if you don't have access to this
// namespace.).
NamespaceId string `json:"namespace_id,omitempty"`
}
var w wrap
var err error
@ -61,13 +69,13 @@ func (u *PathRoot) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "root":
err = json.Unmarshal(body, &u.Root)
u.Root = w.Root
if err != nil {
return err
}
case "namespace_id":
err = json.Unmarshal(body, &u.NamespaceId)
u.NamespaceId = w.NamespaceId
if err != nil {
return err
@ -107,7 +115,7 @@ func (u *PathRootError) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "invalid_root":
u.InvalidRoot, err = IsRootInfoFromJSON(body)
u.InvalidRoot, err = IsRootInfoFromJSON(w.InvalidRoot)
if err != nil {
return err
@ -161,10 +169,6 @@ const (
func (u *rootInfoUnion) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// Team : has no documentation (yet)
Team json.RawMessage `json:"team,omitempty"`
// User : has no documentation (yet)
User json.RawMessage `json:"user,omitempty"`
}
var w wrap
var err error

View file

@ -86,6 +86,8 @@ const (
func (u *TemplateError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// TemplateNotFound : Template does not exist for the given identifier.
TemplateNotFound string `json:"template_not_found,omitempty"`
}
var w wrap
var err error
@ -95,7 +97,7 @@ func (u *TemplateError) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "template_not_found":
err = json.Unmarshal(body, &u.TemplateNotFound)
u.TemplateNotFound = w.TemplateNotFound
if err != nil {
return err
@ -126,8 +128,10 @@ const (
func (u *PropertiesError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// TemplateNotFound : Template does not exist for the given identifier.
TemplateNotFound string `json:"template_not_found,omitempty"`
// Path : has no documentation (yet)
Path json.RawMessage `json:"path,omitempty"`
Path *LookupError `json:"path,omitempty"`
}
var w wrap
var err error
@ -137,13 +141,13 @@ func (u *PropertiesError) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "template_not_found":
err = json.Unmarshal(body, &u.TemplateNotFound)
u.TemplateNotFound = w.TemplateNotFound
if err != nil {
return err
}
case "path":
err = json.Unmarshal(w.Path, &u.Path)
u.Path = w.Path
if err != nil {
return err
@ -176,8 +180,10 @@ const (
func (u *InvalidPropertyGroupError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// TemplateNotFound : Template does not exist for the given identifier.
TemplateNotFound string `json:"template_not_found,omitempty"`
// Path : has no documentation (yet)
Path json.RawMessage `json:"path,omitempty"`
Path *LookupError `json:"path,omitempty"`
}
var w wrap
var err error
@ -187,13 +193,13 @@ func (u *InvalidPropertyGroupError) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "template_not_found":
err = json.Unmarshal(body, &u.TemplateNotFound)
u.TemplateNotFound = w.TemplateNotFound
if err != nil {
return err
}
case "path":
err = json.Unmarshal(w.Path, &u.Path)
u.Path = w.Path
if err != nil {
return err
@ -227,8 +233,10 @@ const (
func (u *AddPropertiesError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// TemplateNotFound : Template does not exist for the given identifier.
TemplateNotFound string `json:"template_not_found,omitempty"`
// Path : has no documentation (yet)
Path json.RawMessage `json:"path,omitempty"`
Path *LookupError `json:"path,omitempty"`
}
var w wrap
var err error
@ -238,13 +246,13 @@ func (u *AddPropertiesError) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "template_not_found":
err = json.Unmarshal(body, &u.TemplateNotFound)
u.TemplateNotFound = w.TemplateNotFound
if err != nil {
return err
}
case "path":
err = json.Unmarshal(w.Path, &u.Path)
u.Path = w.Path
if err != nil {
return err
@ -388,6 +396,8 @@ const (
func (u *LookupError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// MalformedPath : has no documentation (yet)
MalformedPath string `json:"malformed_path,omitempty"`
}
var w wrap
var err error
@ -397,7 +407,7 @@ func (u *LookupError) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "malformed_path":
err = json.Unmarshal(body, &u.MalformedPath)
u.MalformedPath = w.MalformedPath
if err != nil {
return err
@ -428,6 +438,8 @@ const (
func (u *ModifyTemplateError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// TemplateNotFound : Template does not exist for the given identifier.
TemplateNotFound string `json:"template_not_found,omitempty"`
}
var w wrap
var err error
@ -437,7 +449,7 @@ func (u *ModifyTemplateError) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "template_not_found":
err = json.Unmarshal(body, &u.TemplateNotFound)
u.TemplateNotFound = w.TemplateNotFound
if err != nil {
return err
@ -522,7 +534,7 @@ func (u *PropertiesSearchError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// PropertyGroupLookup : has no documentation (yet)
PropertyGroupLookup json.RawMessage `json:"property_group_lookup,omitempty"`
PropertyGroupLookup *LookUpPropertiesError `json:"property_group_lookup,omitempty"`
}
var w wrap
var err error
@ -532,7 +544,7 @@ func (u *PropertiesSearchError) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "property_group_lookup":
err = json.Unmarshal(w.PropertyGroupLookup, &u.PropertyGroupLookup)
u.PropertyGroupLookup = w.PropertyGroupLookup
if err != nil {
return err
@ -580,6 +592,8 @@ const (
func (u *PropertiesSearchMode) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// FieldName : Search for a value associated with this field name.
FieldName string `json:"field_name,omitempty"`
}
var w wrap
var err error
@ -589,7 +603,7 @@ func (u *PropertiesSearchMode) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "field_name":
err = json.Unmarshal(body, &u.FieldName)
u.FieldName = w.FieldName
if err != nil {
return err
@ -768,10 +782,12 @@ const (
func (u *RemovePropertiesError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// TemplateNotFound : Template does not exist for the given identifier.
TemplateNotFound string `json:"template_not_found,omitempty"`
// Path : has no documentation (yet)
Path json.RawMessage `json:"path,omitempty"`
Path *LookupError `json:"path,omitempty"`
// PropertyGroupLookup : has no documentation (yet)
PropertyGroupLookup json.RawMessage `json:"property_group_lookup,omitempty"`
PropertyGroupLookup *LookUpPropertiesError `json:"property_group_lookup,omitempty"`
}
var w wrap
var err error
@ -781,19 +797,19 @@ func (u *RemovePropertiesError) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "template_not_found":
err = json.Unmarshal(body, &u.TemplateNotFound)
u.TemplateNotFound = w.TemplateNotFound
if err != nil {
return err
}
case "path":
err = json.Unmarshal(w.Path, &u.Path)
u.Path = w.Path
if err != nil {
return err
}
case "property_group_lookup":
err = json.Unmarshal(w.PropertyGroupLookup, &u.PropertyGroupLookup)
u.PropertyGroupLookup = w.PropertyGroupLookup
if err != nil {
return err
@ -836,7 +852,7 @@ func (u *TemplateFilterBase) UnmarshalJSON(body []byte) error {
dropbox.Tagged
// FilterSome : Only templates with an ID in the supplied list will be
// returned (a subset of templates will be returned).
FilterSome json.RawMessage `json:"filter_some,omitempty"`
FilterSome []string `json:"filter_some,omitempty"`
}
var w wrap
var err error
@ -846,7 +862,7 @@ func (u *TemplateFilterBase) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "filter_some":
err = json.Unmarshal(body, &u.FilterSome)
u.FilterSome = w.FilterSome
if err != nil {
return err
@ -876,7 +892,7 @@ func (u *TemplateFilter) UnmarshalJSON(body []byte) error {
dropbox.Tagged
// FilterSome : Only templates with an ID in the supplied list will be
// returned (a subset of templates will be returned).
FilterSome json.RawMessage `json:"filter_some,omitempty"`
FilterSome []string `json:"filter_some,omitempty"`
}
var w wrap
var err error
@ -886,7 +902,7 @@ func (u *TemplateFilter) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "filter_some":
err = json.Unmarshal(body, &u.FilterSome)
u.FilterSome = w.FilterSome
if err != nil {
return err
@ -950,10 +966,12 @@ const (
func (u *UpdatePropertiesError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// TemplateNotFound : Template does not exist for the given identifier.
TemplateNotFound string `json:"template_not_found,omitempty"`
// Path : has no documentation (yet)
Path json.RawMessage `json:"path,omitempty"`
Path *LookupError `json:"path,omitempty"`
// PropertyGroupLookup : has no documentation (yet)
PropertyGroupLookup json.RawMessage `json:"property_group_lookup,omitempty"`
PropertyGroupLookup *LookUpPropertiesError `json:"property_group_lookup,omitempty"`
}
var w wrap
var err error
@ -963,19 +981,19 @@ func (u *UpdatePropertiesError) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "template_not_found":
err = json.Unmarshal(body, &u.TemplateNotFound)
u.TemplateNotFound = w.TemplateNotFound
if err != nil {
return err
}
case "path":
err = json.Unmarshal(w.Path, &u.Path)
u.Path = w.Path
if err != nil {
return err
}
case "property_group_lookup":
err = json.Unmarshal(w.PropertyGroupLookup, &u.PropertyGroupLookup)
u.PropertyGroupLookup = w.PropertyGroupLookup
if err != nil {
return err

View file

@ -57,7 +57,7 @@ type Client interface {
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
// difference is this route will return status 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.
@ -130,19 +130,23 @@ type Client interface {
// 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)
// Export : Export a file from a user's Dropbox. This route only supports
// exporting files that cannot be downloaded directly and whose
// `ExportResult.file_metadata` has `ExportInfo.export_as` populated.
Export(arg *ExportArg) (res *ExportResult, content io.ReadCloser, err error)
// GetMetadata : Returns the metadata for a file or folder. Note: Metadata
// for the root folder is unsupported.
GetMetadata(arg *GetMetadataArg) (res IsMetadata, err error)
// GetPreview : Get a preview for a file. Currently, PDF previews are
// generated for files with the following extensions: .ai, .doc, .docm,
// .docx, .eps, .odp, .odt, .pps, .ppsm, .ppsx, .ppt, .pptm, .pptx, .rtf.
// HTML previews are generated for files with the following extensions:
// .csv, .ods, .xls, .xlsm, .xlsx. Other formats will return an unsupported
// extension error.
// .docx, .eps, .gdoc, .gslides, .odp, .odt, .pps, .ppsm, .ppsx, .ppt,
// .pptm, .pptx, .rtf. HTML previews are generated for files with the
// following extensions: .csv, .ods, .xls, .xlsm, .gsheet, .xlsx. Other
// formats will return an unsupported 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. So
// this URL should not be used to display content directly in the browser.
// link will expire in four hours and afterwards you will get 410 Gone. This
// URL should not be used to display content directly in the browser. The
// Content-Type of the link is determined automatically by the file's mime
// type.
GetTemporaryLink(arg *GetTemporaryLinkArg) (res *GetTemporaryLinkResult, err error)
@ -246,7 +250,7 @@ type Client interface {
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
// difference is this route will return status 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.
@ -477,7 +481,7 @@ func (dbx *apiImpl) AlphaUpload(arg *CommitInfoWithProperties, content io.Reader
headers := map[string]string{
"Content-Type": "application/octet-stream",
"Dropbox-API-Arg": string(b),
"Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b),
}
if dbx.Config.AsMemberID != "" {
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
@ -1636,7 +1640,7 @@ func (dbx *apiImpl) Download(arg *DownloadArg) (res *FileMetadata, content io.Re
}
headers := map[string]string{
"Dropbox-API-Arg": string(b),
"Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b),
}
for k, v := range arg.ExtraHeaders {
headers[k] = v
@ -1706,7 +1710,7 @@ func (dbx *apiImpl) DownloadZip(arg *DownloadZipArg) (res *DownloadZipResult, co
}
headers := map[string]string{
"Dropbox-API-Arg": string(b),
"Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b),
}
if dbx.Config.AsMemberID != "" {
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
@ -1757,6 +1761,73 @@ func (dbx *apiImpl) DownloadZip(arg *DownloadZipArg) (res *DownloadZipResult, co
return
}
//ExportAPIError is an error-wrapper for the export route
type ExportAPIError struct {
dropbox.APIError
EndpointError *ExportError `json:"error"`
}
func (dbx *apiImpl) Export(arg *ExportArg) (res *ExportResult, content io.ReadCloser, err error) {
cli := dbx.Client
dbx.Config.LogDebug("arg: %v", arg)
b, err := json.Marshal(arg)
if err != nil {
return
}
headers := map[string]string{
"Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b),
}
if dbx.Config.AsMemberID != "" {
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
}
req, err := (*dropbox.Context)(dbx).NewRequest("content", "download", true, "files", "export", 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 ExportAPIError
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
}
//GetMetadataAPIError is an error-wrapper for the get_metadata route
type GetMetadataAPIError struct {
dropbox.APIError
@ -1850,7 +1921,7 @@ func (dbx *apiImpl) GetPreview(arg *PreviewArg) (res *FileMetadata, content io.R
}
headers := map[string]string{
"Dropbox-API-Arg": string(b),
"Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b),
}
if dbx.Config.AsMemberID != "" {
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
@ -2049,7 +2120,7 @@ func (dbx *apiImpl) GetThumbnail(arg *ThumbnailArg) (res *FileMetadata, content
}
headers := map[string]string{
"Dropbox-API-Arg": string(b),
"Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b),
}
if dbx.Config.AsMemberID != "" {
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
@ -2116,7 +2187,7 @@ func (dbx *apiImpl) GetThumbnailBatch(arg *GetThumbnailBatchArg) (res *GetThumbn
}
headers := map[string]string{
"Dropbox-API-Arg": string(b),
"Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b),
}
if dbx.Config.AsMemberID != "" {
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
@ -3625,7 +3696,7 @@ func (dbx *apiImpl) Upload(arg *CommitInfo, content io.Reader) (res *FileMetadat
headers := map[string]string{
"Content-Type": "application/octet-stream",
"Dropbox-API-Arg": string(b),
"Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b),
}
if dbx.Config.AsMemberID != "" {
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
@ -3692,7 +3763,7 @@ func (dbx *apiImpl) UploadSessionAppendV2(arg *UploadSessionAppendArg, content i
headers := map[string]string{
"Content-Type": "application/octet-stream",
"Dropbox-API-Arg": string(b),
"Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b),
}
if dbx.Config.AsMemberID != "" {
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
@ -3757,7 +3828,7 @@ func (dbx *apiImpl) UploadSessionAppend(arg *UploadSessionCursor, content io.Rea
headers := map[string]string{
"Content-Type": "application/octet-stream",
"Dropbox-API-Arg": string(b),
"Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b),
}
if dbx.Config.AsMemberID != "" {
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
@ -3819,7 +3890,7 @@ func (dbx *apiImpl) UploadSessionFinish(arg *UploadSessionFinishArg, content io.
headers := map[string]string{
"Content-Type": "application/octet-stream",
"Dropbox-API-Arg": string(b),
"Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b),
}
if dbx.Config.AsMemberID != "" {
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID
@ -4018,7 +4089,7 @@ func (dbx *apiImpl) UploadSessionStart(arg *UploadSessionStartArg, content io.Re
headers := map[string]string{
"Content-Type": "application/octet-stream",
"Dropbox-API-Arg": string(b),
"Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b),
}
if dbx.Config.AsMemberID != "" {
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID

File diff suppressed because it is too large Load diff

View file

@ -21,6 +21,7 @@
package dropbox
import (
"bytes"
"encoding/json"
"fmt"
"io"
@ -37,8 +38,8 @@ const (
hostAPI = "api"
hostContent = "content"
hostNotify = "notify"
sdkVersion = "5.4.0"
specVersion = "097e9ba"
sdkVersion = "5.6.0"
specVersion = "0e697d7"
)
// Version returns the current SDK version and API Spec version
@ -221,3 +222,20 @@ func HandleCommonAPIErrors(c Config, resp *http.Response, body []byte) error {
}
return apiError
}
// HTTPHeaderSafeJSON encode the JSON passed in b []byte passed in in
// a way that is suitable for HTTP headers.
//
// See: https://www.dropbox.com/developers/reference/json-encoding
func HTTPHeaderSafeJSON(b []byte) string {
var s bytes.Buffer
s.Grow(len(b))
for _, r := range string(b) {
if r >= 0x007f {
fmt.Fprintf(&s, "\\u%04x", r)
} else {
s.WriteRune(r)
}
}
return s.String()
}

View file

@ -30,9 +30,12 @@ type PlatformType struct {
// Valid tag values for PlatformType
const (
PlatformTypeWeb = "web"
PlatformTypeMobile = "mobile"
PlatformTypeDesktop = "desktop"
PlatformTypeUnknown = "unknown"
PlatformTypeOther = "other"
PlatformTypeWeb = "web"
PlatformTypeDesktop = "desktop"
PlatformTypeMobileIos = "mobile_ios"
PlatformTypeMobileAndroid = "mobile_android"
PlatformTypeApi = "api"
PlatformTypeUnknown = "unknown"
PlatformTypeMobile = "mobile"
PlatformTypeOther = "other"
)

View file

@ -966,7 +966,7 @@ func (dbx *apiImpl) GetSharedLinkFile(arg *GetSharedLinkMetadataArg) (res IsShar
}
headers := map[string]string{
"Dropbox-API-Arg": string(b),
"Dropbox-API-Arg": dropbox.HTTPHeaderSafeJSON(b),
}
if dbx.Config.AsMemberID != "" {
headers["Dropbox-API-Select-User"] = dbx.Config.AsMemberID

File diff suppressed because it is too large Load diff

View file

@ -153,11 +153,11 @@ func (u *BaseTeamFolderError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// AccessError : has no documentation (yet)
AccessError json.RawMessage `json:"access_error,omitempty"`
AccessError *TeamFolderAccessError `json:"access_error,omitempty"`
// StatusError : has no documentation (yet)
StatusError json.RawMessage `json:"status_error,omitempty"`
StatusError *TeamFolderInvalidStatusError `json:"status_error,omitempty"`
// TeamSharedDropboxError : has no documentation (yet)
TeamSharedDropboxError json.RawMessage `json:"team_shared_dropbox_error,omitempty"`
TeamSharedDropboxError *TeamFolderTeamSharedDropboxError `json:"team_shared_dropbox_error,omitempty"`
}
var w wrap
var err error
@ -167,19 +167,19 @@ func (u *BaseTeamFolderError) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "access_error":
err = json.Unmarshal(w.AccessError, &u.AccessError)
u.AccessError = w.AccessError
if err != nil {
return err
}
case "status_error":
err = json.Unmarshal(w.StatusError, &u.StatusError)
u.StatusError = w.StatusError
if err != nil {
return err
}
case "team_shared_dropbox_error":
err = json.Unmarshal(w.TeamSharedDropboxError, &u.TeamSharedDropboxError)
u.TeamSharedDropboxError = w.TeamSharedDropboxError
if err != nil {
return err
@ -219,10 +219,8 @@ const (
func (u *CustomQuotaResult) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// Success : User's custom quota.
Success json.RawMessage `json:"success,omitempty"`
// InvalidUser : Invalid user (not in team).
InvalidUser json.RawMessage `json:"invalid_user,omitempty"`
InvalidUser *UserSelectorArg `json:"invalid_user,omitempty"`
}
var w wrap
var err error
@ -238,7 +236,7 @@ func (u *CustomQuotaResult) UnmarshalJSON(body []byte) error {
return err
}
case "invalid_user":
err = json.Unmarshal(w.InvalidUser, &u.InvalidUser)
u.InvalidUser = w.InvalidUser
if err != nil {
return err
@ -540,13 +538,13 @@ func (u *FeatureValue) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// UploadApiRateLimit : has no documentation (yet)
UploadApiRateLimit json.RawMessage `json:"upload_api_rate_limit,omitempty"`
UploadApiRateLimit *UploadApiRateLimitValue `json:"upload_api_rate_limit,omitempty"`
// HasTeamSharedDropbox : has no documentation (yet)
HasTeamSharedDropbox json.RawMessage `json:"has_team_shared_dropbox,omitempty"`
HasTeamSharedDropbox *HasTeamSharedDropboxValue `json:"has_team_shared_dropbox,omitempty"`
// HasTeamFileEvents : has no documentation (yet)
HasTeamFileEvents json.RawMessage `json:"has_team_file_events,omitempty"`
HasTeamFileEvents *HasTeamFileEventsValue `json:"has_team_file_events,omitempty"`
// HasTeamSelectiveSync : has no documentation (yet)
HasTeamSelectiveSync json.RawMessage `json:"has_team_selective_sync,omitempty"`
HasTeamSelectiveSync *HasTeamSelectiveSyncValue `json:"has_team_selective_sync,omitempty"`
}
var w wrap
var err error
@ -556,25 +554,25 @@ func (u *FeatureValue) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "upload_api_rate_limit":
err = json.Unmarshal(w.UploadApiRateLimit, &u.UploadApiRateLimit)
u.UploadApiRateLimit = w.UploadApiRateLimit
if err != nil {
return err
}
case "has_team_shared_dropbox":
err = json.Unmarshal(w.HasTeamSharedDropbox, &u.HasTeamSharedDropbox)
u.HasTeamSharedDropbox = w.HasTeamSharedDropbox
if err != nil {
return err
}
case "has_team_file_events":
err = json.Unmarshal(w.HasTeamFileEvents, &u.HasTeamFileEvents)
u.HasTeamFileEvents = w.HasTeamFileEvents
if err != nil {
return err
}
case "has_team_selective_sync":
err = json.Unmarshal(w.HasTeamSelectiveSync, &u.HasTeamSelectiveSync)
u.HasTeamSelectiveSync = w.HasTeamSelectiveSync
if err != nil {
return err
@ -1010,12 +1008,12 @@ func (u *GroupMembersAddError) UnmarshalJSON(body []byte) error {
// Currently, you cannot add members to a group if they are not part of
// your team, though this may change in a subsequent version. To add new
// members to your Dropbox Business team, use the `membersAdd` endpoint.
MembersNotInTeam json.RawMessage `json:"members_not_in_team,omitempty"`
MembersNotInTeam []string `json:"members_not_in_team,omitempty"`
// UsersNotFound : These users were not found in Dropbox.
UsersNotFound json.RawMessage `json:"users_not_found,omitempty"`
UsersNotFound []string `json:"users_not_found,omitempty"`
// UserCannotBeManagerOfCompanyManagedGroup : A company-managed group
// cannot be managed by a user.
UserCannotBeManagerOfCompanyManagedGroup json.RawMessage `json:"user_cannot_be_manager_of_company_managed_group,omitempty"`
UserCannotBeManagerOfCompanyManagedGroup []string `json:"user_cannot_be_manager_of_company_managed_group,omitempty"`
}
var w wrap
var err error
@ -1025,19 +1023,19 @@ func (u *GroupMembersAddError) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "members_not_in_team":
err = json.Unmarshal(body, &u.MembersNotInTeam)
u.MembersNotInTeam = w.MembersNotInTeam
if err != nil {
return err
}
case "users_not_found":
err = json.Unmarshal(body, &u.UsersNotFound)
u.UsersNotFound = w.UsersNotFound
if err != nil {
return err
}
case "user_cannot_be_manager_of_company_managed_group":
err = json.Unmarshal(body, &u.UserCannotBeManagerOfCompanyManagedGroup)
u.UserCannotBeManagerOfCompanyManagedGroup = w.UserCannotBeManagerOfCompanyManagedGroup
if err != nil {
return err
@ -1123,9 +1121,9 @@ func (u *GroupMembersRemoveError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// MembersNotInTeam : These members are not part of your team.
MembersNotInTeam json.RawMessage `json:"members_not_in_team,omitempty"`
MembersNotInTeam []string `json:"members_not_in_team,omitempty"`
// UsersNotFound : These users were not found in Dropbox.
UsersNotFound json.RawMessage `json:"users_not_found,omitempty"`
UsersNotFound []string `json:"users_not_found,omitempty"`
}
var w wrap
var err error
@ -1135,13 +1133,13 @@ func (u *GroupMembersRemoveError) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "members_not_in_team":
err = json.Unmarshal(body, &u.MembersNotInTeam)
u.MembersNotInTeam = w.MembersNotInTeam
if err != nil {
return err
}
case "users_not_found":
err = json.Unmarshal(body, &u.UsersNotFound)
u.UsersNotFound = w.UsersNotFound
if err != nil {
return err
@ -1207,6 +1205,10 @@ const (
func (u *GroupSelector) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// GroupId : Group ID.
GroupId string `json:"group_id,omitempty"`
// GroupExternalId : External ID of the group.
GroupExternalId string `json:"group_external_id,omitempty"`
}
var w wrap
var err error
@ -1216,13 +1218,13 @@ func (u *GroupSelector) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "group_id":
err = json.Unmarshal(body, &u.GroupId)
u.GroupId = w.GroupId
if err != nil {
return err
}
case "group_external_id":
err = json.Unmarshal(body, &u.GroupExternalId)
u.GroupExternalId = w.GroupExternalId
if err != nil {
return err
@ -1301,8 +1303,11 @@ const (
func (u *GroupsGetInfoItem) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// GroupInfo : Info about a group.
GroupInfo json.RawMessage `json:"group_info,omitempty"`
// IdNotFound : An ID that was provided as a parameter to
// `groupsGetInfo`, and did not match a corresponding group. The ID can
// be a group ID, or an external ID, depending on how the method was
// called.
IdNotFound string `json:"id_not_found,omitempty"`
}
var w wrap
var err error
@ -1312,7 +1317,7 @@ func (u *GroupsGetInfoItem) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "id_not_found":
err = json.Unmarshal(body, &u.IdNotFound)
u.IdNotFound = w.IdNotFound
if err != nil {
return err
@ -1482,9 +1487,9 @@ func (u *GroupsSelector) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// GroupIds : List of group IDs.
GroupIds json.RawMessage `json:"group_ids,omitempty"`
GroupIds []string `json:"group_ids,omitempty"`
// GroupExternalIds : List of external IDs of groups.
GroupExternalIds json.RawMessage `json:"group_external_ids,omitempty"`
GroupExternalIds []string `json:"group_external_ids,omitempty"`
}
var w wrap
var err error
@ -1494,13 +1499,13 @@ func (u *GroupsSelector) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "group_ids":
err = json.Unmarshal(body, &u.GroupIds)
u.GroupIds = w.GroupIds
if err != nil {
return err
}
case "group_external_ids":
err = json.Unmarshal(body, &u.GroupExternalIds)
u.GroupExternalIds = w.GroupExternalIds
if err != nil {
return err
@ -1526,6 +1531,8 @@ const (
func (u *HasTeamFileEventsValue) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// Enabled : Does this team have file events.
Enabled bool `json:"enabled,omitempty"`
}
var w wrap
var err error
@ -1535,7 +1542,7 @@ func (u *HasTeamFileEventsValue) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "enabled":
err = json.Unmarshal(body, &u.Enabled)
u.Enabled = w.Enabled
if err != nil {
return err
@ -1561,6 +1568,9 @@ const (
func (u *HasTeamSelectiveSyncValue) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// HasTeamSelectiveSync : Does this team have team selective sync
// enabled.
HasTeamSelectiveSync bool `json:"has_team_selective_sync,omitempty"`
}
var w wrap
var err error
@ -1570,7 +1580,7 @@ func (u *HasTeamSelectiveSyncValue) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "has_team_selective_sync":
err = json.Unmarshal(body, &u.HasTeamSelectiveSync)
u.HasTeamSelectiveSync = w.HasTeamSelectiveSync
if err != nil {
return err
@ -1596,6 +1606,8 @@ const (
func (u *HasTeamSharedDropboxValue) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// HasTeamSharedDropbox : Does this team have a shared team root.
HasTeamSharedDropbox bool `json:"has_team_shared_dropbox,omitempty"`
}
var w wrap
var err error
@ -1605,7 +1617,7 @@ func (u *HasTeamSharedDropboxValue) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "has_team_shared_dropbox":
err = json.Unmarshal(body, &u.HasTeamSharedDropbox)
u.HasTeamSharedDropbox = w.HasTeamSharedDropbox
if err != nil {
return err
@ -2019,8 +2031,36 @@ const (
func (u *MemberAddResult) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// Success : Describes a user that was successfully added to the team.
Success json.RawMessage `json:"success,omitempty"`
// TeamLicenseLimit : Team is already full. The organization has no
// available licenses.
TeamLicenseLimit string `json:"team_license_limit,omitempty"`
// FreeTeamMemberLimitReached : Team is already full. The free team
// member limit has been reached.
FreeTeamMemberLimitReached string `json:"free_team_member_limit_reached,omitempty"`
// UserAlreadyOnTeam : User is already on this team. The provided email
// address is associated with a user who is already a member of
// (including in recoverable state) or invited to the team.
UserAlreadyOnTeam string `json:"user_already_on_team,omitempty"`
// UserOnAnotherTeam : User is already on another team. The provided
// email address is associated with a user that is already a member or
// invited to another team.
UserOnAnotherTeam string `json:"user_on_another_team,omitempty"`
// UserAlreadyPaired : User is already paired.
UserAlreadyPaired string `json:"user_already_paired,omitempty"`
// UserMigrationFailed : User migration has failed.
UserMigrationFailed string `json:"user_migration_failed,omitempty"`
// DuplicateExternalMemberId : A user with the given external member ID
// already exists on the team (including in recoverable state).
DuplicateExternalMemberId string `json:"duplicate_external_member_id,omitempty"`
// DuplicateMemberPersistentId : A user with the given persistent ID
// already exists on the team (including in recoverable state).
DuplicateMemberPersistentId string `json:"duplicate_member_persistent_id,omitempty"`
// PersistentIdDisabled : Persistent ID is only available to teams with
// persistent ID SAML configuration. Please contact Dropbox for more
// information.
PersistentIdDisabled string `json:"persistent_id_disabled,omitempty"`
// UserCreationFailed : User creation has failed.
UserCreationFailed string `json:"user_creation_failed,omitempty"`
}
var w wrap
var err error
@ -2036,61 +2076,61 @@ func (u *MemberAddResult) UnmarshalJSON(body []byte) error {
return err
}
case "team_license_limit":
err = json.Unmarshal(body, &u.TeamLicenseLimit)
u.TeamLicenseLimit = w.TeamLicenseLimit
if err != nil {
return err
}
case "free_team_member_limit_reached":
err = json.Unmarshal(body, &u.FreeTeamMemberLimitReached)
u.FreeTeamMemberLimitReached = w.FreeTeamMemberLimitReached
if err != nil {
return err
}
case "user_already_on_team":
err = json.Unmarshal(body, &u.UserAlreadyOnTeam)
u.UserAlreadyOnTeam = w.UserAlreadyOnTeam
if err != nil {
return err
}
case "user_on_another_team":
err = json.Unmarshal(body, &u.UserOnAnotherTeam)
u.UserOnAnotherTeam = w.UserOnAnotherTeam
if err != nil {
return err
}
case "user_already_paired":
err = json.Unmarshal(body, &u.UserAlreadyPaired)
u.UserAlreadyPaired = w.UserAlreadyPaired
if err != nil {
return err
}
case "user_migration_failed":
err = json.Unmarshal(body, &u.UserMigrationFailed)
u.UserMigrationFailed = w.UserMigrationFailed
if err != nil {
return err
}
case "duplicate_external_member_id":
err = json.Unmarshal(body, &u.DuplicateExternalMemberId)
u.DuplicateExternalMemberId = w.DuplicateExternalMemberId
if err != nil {
return err
}
case "duplicate_member_persistent_id":
err = json.Unmarshal(body, &u.DuplicateMemberPersistentId)
u.DuplicateMemberPersistentId = w.DuplicateMemberPersistentId
if err != nil {
return err
}
case "persistent_id_disabled":
err = json.Unmarshal(body, &u.PersistentIdDisabled)
u.PersistentIdDisabled = w.PersistentIdDisabled
if err != nil {
return err
}
case "user_creation_failed":
err = json.Unmarshal(body, &u.UserCreationFailed)
u.UserCreationFailed = w.UserCreationFailed
if err != nil {
return err
@ -2160,11 +2200,17 @@ type MemberProfile struct {
// JoinedOn : The date and time the user joined as a member of a specific
// team.
JoinedOn time.Time `json:"joined_on,omitempty"`
// SuspendedOn : The date and time the user was suspended from the team
// (contains value only when the member's status matches
// `TeamMemberStatus.suspended`.
SuspendedOn time.Time `json:"suspended_on,omitempty"`
// PersistentId : Persistent ID that a team can attach to the user. The
// persistent ID is unique ID to be used for SAML authentication.
PersistentId string `json:"persistent_id,omitempty"`
// IsDirectoryRestricted : Whether the user is a directory restricted user.
IsDirectoryRestricted bool `json:"is_directory_restricted,omitempty"`
// ProfilePhotoUrl : URL for the photo representing the user, if one is set.
ProfilePhotoUrl string `json:"profile_photo_url,omitempty"`
}
// NewMemberProfile returns a new MemberProfile instance
@ -2243,7 +2289,10 @@ func (u *MembersAddJobStatus) UnmarshalJSON(body []byte) error {
// Complete : The asynchronous job has finished. For each member that
// was specified in the parameter `MembersAddArg` that was provided to
// `membersAdd`, a corresponding item is returned in this list.
Complete []json.RawMessage `json:"complete,omitempty"`
Complete []*MemberAddResult `json:"complete,omitempty"`
// Failed : The asynchronous job returned an error. The string contains
// an error message.
Failed string `json:"failed,omitempty"`
}
var w wrap
var err error
@ -2253,13 +2302,13 @@ func (u *MembersAddJobStatus) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "complete":
err = json.Unmarshal(body, &u.Complete)
u.Complete = w.Complete
if err != nil {
return err
}
case "failed":
err = json.Unmarshal(body, &u.Failed)
u.Failed = w.Failed
if err != nil {
return err
@ -2289,8 +2338,12 @@ const (
func (u *MembersAddLaunch) UnmarshalJSON(body []byte) error {
type wrap 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 []json.RawMessage `json:"complete,omitempty"`
Complete []*MemberAddResult `json:"complete,omitempty"`
}
var w wrap
var err error
@ -2300,13 +2353,13 @@ func (u *MembersAddLaunch) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "async_job_id":
err = json.Unmarshal(body, &u.AsyncJobId)
u.AsyncJobId = w.AsyncJobId
if err != nil {
return err
}
case "complete":
err = json.Unmarshal(body, &u.Complete)
u.Complete = w.Complete
if err != nil {
return err
@ -2422,8 +2475,11 @@ const (
func (u *MembersGetInfoItem) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// MemberInfo : Info about a team member.
MemberInfo json.RawMessage `json:"member_info,omitempty"`
// IdNotFound : An ID that was provided as a parameter to
// `membersGetInfo`, and did not match a corresponding user. This might
// be a team_member_id, an email, or an external ID, depending on how
// the method was called.
IdNotFound string `json:"id_not_found,omitempty"`
}
var w wrap
var err error
@ -2433,7 +2489,7 @@ func (u *MembersGetInfoItem) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "id_not_found":
err = json.Unmarshal(body, &u.IdNotFound)
u.IdNotFound = w.IdNotFound
if err != nil {
return err
@ -2896,9 +2952,9 @@ func (u *RemoveCustomQuotaResult) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// Success : Successfully removed user.
Success json.RawMessage `json:"success,omitempty"`
Success *UserSelectorArg `json:"success,omitempty"`
// InvalidUser : Invalid user (not in team).
InvalidUser json.RawMessage `json:"invalid_user,omitempty"`
InvalidUser *UserSelectorArg `json:"invalid_user,omitempty"`
}
var w wrap
var err error
@ -2908,13 +2964,13 @@ func (u *RemoveCustomQuotaResult) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "success":
err = json.Unmarshal(w.Success, &u.Success)
u.Success = w.Success
if err != nil {
return err
}
case "invalid_user":
err = json.Unmarshal(w.InvalidUser, &u.InvalidUser)
u.InvalidUser = w.InvalidUser
if err != nil {
return err
@ -2980,12 +3036,6 @@ const (
func (u *RevokeDeviceSessionArg) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// WebSession : End an active session.
WebSession json.RawMessage `json:"web_session,omitempty"`
// DesktopClient : Unlink a linked desktop device.
DesktopClient json.RawMessage `json:"desktop_client,omitempty"`
// MobileClient : Unlink a linked mobile device.
MobileClient json.RawMessage `json:"mobile_client,omitempty"`
}
var w wrap
var err error
@ -3242,11 +3292,11 @@ func (u *TeamFolderActivateError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// AccessError : has no documentation (yet)
AccessError json.RawMessage `json:"access_error,omitempty"`
AccessError *TeamFolderAccessError `json:"access_error,omitempty"`
// StatusError : has no documentation (yet)
StatusError json.RawMessage `json:"status_error,omitempty"`
StatusError *TeamFolderInvalidStatusError `json:"status_error,omitempty"`
// TeamSharedDropboxError : has no documentation (yet)
TeamSharedDropboxError json.RawMessage `json:"team_shared_dropbox_error,omitempty"`
TeamSharedDropboxError *TeamFolderTeamSharedDropboxError `json:"team_shared_dropbox_error,omitempty"`
}
var w wrap
var err error
@ -3256,19 +3306,19 @@ func (u *TeamFolderActivateError) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "access_error":
err = json.Unmarshal(w.AccessError, &u.AccessError)
u.AccessError = w.AccessError
if err != nil {
return err
}
case "status_error":
err = json.Unmarshal(w.StatusError, &u.StatusError)
u.StatusError = w.StatusError
if err != nil {
return err
}
case "team_shared_dropbox_error":
err = json.Unmarshal(w.TeamSharedDropboxError, &u.TeamSharedDropboxError)
u.TeamSharedDropboxError = w.TeamSharedDropboxError
if err != nil {
return err
@ -3329,11 +3379,11 @@ func (u *TeamFolderArchiveError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// AccessError : has no documentation (yet)
AccessError json.RawMessage `json:"access_error,omitempty"`
AccessError *TeamFolderAccessError `json:"access_error,omitempty"`
// StatusError : has no documentation (yet)
StatusError json.RawMessage `json:"status_error,omitempty"`
StatusError *TeamFolderInvalidStatusError `json:"status_error,omitempty"`
// TeamSharedDropboxError : has no documentation (yet)
TeamSharedDropboxError json.RawMessage `json:"team_shared_dropbox_error,omitempty"`
TeamSharedDropboxError *TeamFolderTeamSharedDropboxError `json:"team_shared_dropbox_error,omitempty"`
}
var w wrap
var err error
@ -3343,19 +3393,19 @@ func (u *TeamFolderArchiveError) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "access_error":
err = json.Unmarshal(w.AccessError, &u.AccessError)
u.AccessError = w.AccessError
if err != nil {
return err
}
case "status_error":
err = json.Unmarshal(w.StatusError, &u.StatusError)
u.StatusError = w.StatusError
if err != nil {
return err
}
case "team_shared_dropbox_error":
err = json.Unmarshal(w.TeamSharedDropboxError, &u.TeamSharedDropboxError)
u.TeamSharedDropboxError = w.TeamSharedDropboxError
if err != nil {
return err
@ -3386,12 +3436,9 @@ const (
func (u *TeamFolderArchiveJobStatus) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// Complete : The archive job has finished. The value is the metadata
// for the resulting team folder.
Complete json.RawMessage `json:"complete,omitempty"`
// Failed : Error occurred while performing an asynchronous job from
// `teamFolderArchive`.
Failed json.RawMessage `json:"failed,omitempty"`
Failed *TeamFolderArchiveError `json:"failed,omitempty"`
}
var w wrap
var err error
@ -3407,7 +3454,7 @@ func (u *TeamFolderArchiveJobStatus) UnmarshalJSON(body []byte) error {
return err
}
case "failed":
err = json.Unmarshal(w.Failed, &u.Failed)
u.Failed = w.Failed
if err != nil {
return err
@ -3437,8 +3484,10 @@ const (
func (u *TeamFolderArchiveLaunch) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// Complete : has no documentation (yet)
Complete json.RawMessage `json:"complete,omitempty"`
// 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"`
}
var w wrap
var err error
@ -3448,7 +3497,7 @@ func (u *TeamFolderArchiveLaunch) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "async_job_id":
err = json.Unmarshal(body, &u.AsyncJobId)
u.AsyncJobId = w.AsyncJobId
if err != nil {
return err
@ -3500,7 +3549,7 @@ func (u *TeamFolderCreateError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// SyncSettingsError : An error occurred setting the sync settings.
SyncSettingsError json.RawMessage `json:"sync_settings_error,omitempty"`
SyncSettingsError *files.SyncSettingsError `json:"sync_settings_error,omitempty"`
}
var w wrap
var err error
@ -3510,7 +3559,7 @@ func (u *TeamFolderCreateError) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "sync_settings_error":
err = json.Unmarshal(w.SyncSettingsError, &u.SyncSettingsError)
u.SyncSettingsError = w.SyncSettingsError
if err != nil {
return err
@ -3539,8 +3588,9 @@ const (
func (u *TeamFolderGetInfoItem) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// TeamFolderMetadata : Properties of a team folder.
TeamFolderMetadata json.RawMessage `json:"team_folder_metadata,omitempty"`
// IdNotFound : An ID that was provided as a parameter to
// `teamFolderGetInfo` did not match any of the team's team folders.
IdNotFound string `json:"id_not_found,omitempty"`
}
var w wrap
var err error
@ -3550,7 +3600,7 @@ func (u *TeamFolderGetInfoItem) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "id_not_found":
err = json.Unmarshal(body, &u.IdNotFound)
u.IdNotFound = w.IdNotFound
if err != nil {
return err
@ -3717,11 +3767,11 @@ func (u *TeamFolderPermanentlyDeleteError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// AccessError : has no documentation (yet)
AccessError json.RawMessage `json:"access_error,omitempty"`
AccessError *TeamFolderAccessError `json:"access_error,omitempty"`
// StatusError : has no documentation (yet)
StatusError json.RawMessage `json:"status_error,omitempty"`
StatusError *TeamFolderInvalidStatusError `json:"status_error,omitempty"`
// TeamSharedDropboxError : has no documentation (yet)
TeamSharedDropboxError json.RawMessage `json:"team_shared_dropbox_error,omitempty"`
TeamSharedDropboxError *TeamFolderTeamSharedDropboxError `json:"team_shared_dropbox_error,omitempty"`
}
var w wrap
var err error
@ -3731,19 +3781,19 @@ func (u *TeamFolderPermanentlyDeleteError) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "access_error":
err = json.Unmarshal(w.AccessError, &u.AccessError)
u.AccessError = w.AccessError
if err != nil {
return err
}
case "status_error":
err = json.Unmarshal(w.StatusError, &u.StatusError)
u.StatusError = w.StatusError
if err != nil {
return err
}
case "team_shared_dropbox_error":
err = json.Unmarshal(w.TeamSharedDropboxError, &u.TeamSharedDropboxError)
u.TeamSharedDropboxError = w.TeamSharedDropboxError
if err != nil {
return err
@ -3794,11 +3844,11 @@ func (u *TeamFolderRenameError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// AccessError : has no documentation (yet)
AccessError json.RawMessage `json:"access_error,omitempty"`
AccessError *TeamFolderAccessError `json:"access_error,omitempty"`
// StatusError : has no documentation (yet)
StatusError json.RawMessage `json:"status_error,omitempty"`
StatusError *TeamFolderInvalidStatusError `json:"status_error,omitempty"`
// TeamSharedDropboxError : has no documentation (yet)
TeamSharedDropboxError json.RawMessage `json:"team_shared_dropbox_error,omitempty"`
TeamSharedDropboxError *TeamFolderTeamSharedDropboxError `json:"team_shared_dropbox_error,omitempty"`
}
var w wrap
var err error
@ -3808,19 +3858,19 @@ func (u *TeamFolderRenameError) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "access_error":
err = json.Unmarshal(w.AccessError, &u.AccessError)
u.AccessError = w.AccessError
if err != nil {
return err
}
case "status_error":
err = json.Unmarshal(w.StatusError, &u.StatusError)
u.StatusError = w.StatusError
if err != nil {
return err
}
case "team_shared_dropbox_error":
err = json.Unmarshal(w.TeamSharedDropboxError, &u.TeamSharedDropboxError)
u.TeamSharedDropboxError = w.TeamSharedDropboxError
if err != nil {
return err
@ -3898,13 +3948,13 @@ func (u *TeamFolderUpdateSyncSettingsError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// AccessError : has no documentation (yet)
AccessError json.RawMessage `json:"access_error,omitempty"`
AccessError *TeamFolderAccessError `json:"access_error,omitempty"`
// StatusError : has no documentation (yet)
StatusError json.RawMessage `json:"status_error,omitempty"`
StatusError *TeamFolderInvalidStatusError `json:"status_error,omitempty"`
// TeamSharedDropboxError : has no documentation (yet)
TeamSharedDropboxError json.RawMessage `json:"team_shared_dropbox_error,omitempty"`
TeamSharedDropboxError *TeamFolderTeamSharedDropboxError `json:"team_shared_dropbox_error,omitempty"`
// SyncSettingsError : An error occurred setting the sync settings.
SyncSettingsError json.RawMessage `json:"sync_settings_error,omitempty"`
SyncSettingsError *files.SyncSettingsError `json:"sync_settings_error,omitempty"`
}
var w wrap
var err error
@ -3914,25 +3964,25 @@ func (u *TeamFolderUpdateSyncSettingsError) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "access_error":
err = json.Unmarshal(w.AccessError, &u.AccessError)
u.AccessError = w.AccessError
if err != nil {
return err
}
case "status_error":
err = json.Unmarshal(w.StatusError, &u.StatusError)
u.StatusError = w.StatusError
if err != nil {
return err
}
case "team_shared_dropbox_error":
err = json.Unmarshal(w.TeamSharedDropboxError, &u.TeamSharedDropboxError)
u.TeamSharedDropboxError = w.TeamSharedDropboxError
if err != nil {
return err
}
case "sync_settings_error":
err = json.Unmarshal(w.SyncSettingsError, &u.SyncSettingsError)
u.SyncSettingsError = w.SyncSettingsError
if err != nil {
return err
@ -4026,9 +4076,6 @@ const (
func (u *TeamMemberStatus) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// Removed : User is no longer a member of the team. Removed users are
// only listed when include_removed is true in members/list.
Removed json.RawMessage `json:"removed,omitempty"`
}
var w wrap
var err error
@ -4129,6 +4176,19 @@ func NewTeamNamespacesListResult(Namespaces []*NamespaceMetadata, Cursor string,
return s
}
// TeamReportFailureReason : has no documentation (yet)
type TeamReportFailureReason struct {
dropbox.Tagged
}
// Valid tag values for TeamReportFailureReason
const (
TeamReportFailureReasonTemporaryError = "temporary_error"
TeamReportFailureReasonManyReportsAtOnce = "many_reports_at_once"
TeamReportFailureReasonTooMuchData = "too_much_data"
TeamReportFailureReasonOther = "other"
)
// TokenGetAuthenticatedAdminError : Error returned by
// `tokenGetAuthenticatedAdmin`.
type TokenGetAuthenticatedAdminError struct {
@ -4173,6 +4233,8 @@ const (
func (u *UploadApiRateLimitValue) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// Limit : The number of upload API calls allowed per month.
Limit uint32 `json:"limit,omitempty"`
}
var w wrap
var err error
@ -4182,7 +4244,7 @@ func (u *UploadApiRateLimitValue) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "limit":
err = json.Unmarshal(body, &u.Limit)
u.Limit = w.Limit
if err != nil {
return err
@ -4247,6 +4309,12 @@ const (
func (u *UserSelectorArg) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// TeamMemberId : has no documentation (yet)
TeamMemberId string `json:"team_member_id,omitempty"`
// ExternalId : has no documentation (yet)
ExternalId string `json:"external_id,omitempty"`
// Email : has no documentation (yet)
Email string `json:"email,omitempty"`
}
var w wrap
var err error
@ -4256,19 +4324,19 @@ func (u *UserSelectorArg) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "team_member_id":
err = json.Unmarshal(body, &u.TeamMemberId)
u.TeamMemberId = w.TeamMemberId
if err != nil {
return err
}
case "external_id":
err = json.Unmarshal(body, &u.ExternalId)
u.ExternalId = w.ExternalId
if err != nil {
return err
}
case "email":
err = json.Unmarshal(body, &u.Email)
u.Email = w.Email
if err != nil {
return err
@ -4301,11 +4369,11 @@ func (u *UsersSelectorArg) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// TeamMemberIds : List of member IDs.
TeamMemberIds json.RawMessage `json:"team_member_ids,omitempty"`
TeamMemberIds []string `json:"team_member_ids,omitempty"`
// ExternalIds : List of external user IDs.
ExternalIds json.RawMessage `json:"external_ids,omitempty"`
ExternalIds []string `json:"external_ids,omitempty"`
// Emails : List of email addresses.
Emails json.RawMessage `json:"emails,omitempty"`
Emails []string `json:"emails,omitempty"`
}
var w wrap
var err error
@ -4315,19 +4383,19 @@ func (u *UsersSelectorArg) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "team_member_ids":
err = json.Unmarshal(body, &u.TeamMemberIds)
u.TeamMemberIds = w.TeamMemberIds
if err != nil {
return err
}
case "external_ids":
err = json.Unmarshal(body, &u.ExternalIds)
u.ExternalIds = w.ExternalIds
if err != nil {
return err
}
case "emails":
err = json.Unmarshal(body, &u.Emails)
u.Emails = w.Emails
if err != nil {
return err

View file

@ -71,6 +71,18 @@ const (
OfficeAddInPolicyOther = "other"
)
// PaperDefaultFolderPolicy : has no documentation (yet)
type PaperDefaultFolderPolicy struct {
dropbox.Tagged
}
// Valid tag values for PaperDefaultFolderPolicy
const (
PaperDefaultFolderPolicyEveryoneInTeam = "everyone_in_team"
PaperDefaultFolderPolicyInviteOnly = "invite_only"
PaperDefaultFolderPolicyOther = "other"
)
// PaperDeploymentPolicy : has no documentation (yet)
type PaperDeploymentPolicy struct {
dropbox.Tagged
@ -83,6 +95,18 @@ const (
PaperDeploymentPolicyOther = "other"
)
// PaperDesktopPolicy : has no documentation (yet)
type PaperDesktopPolicy struct {
dropbox.Tagged
}
// Valid tag values for PaperDesktopPolicy
const (
PaperDesktopPolicyDisabled = "disabled"
PaperDesktopPolicyEnabled = "enabled"
PaperDesktopPolicyOther = "other"
)
// PaperEnabledPolicy : has no documentation (yet)
type PaperEnabledPolicy struct {
dropbox.Tagged
@ -278,3 +302,15 @@ const (
TwoStepVerificationPolicyRequireTfaDisable = "require_tfa_disable"
TwoStepVerificationPolicyOther = "other"
)
// TwoStepVerificationState : has no documentation (yet)
type TwoStepVerificationState struct {
dropbox.Tagged
}
// Valid tag values for TwoStepVerificationState
const (
TwoStepVerificationStateRequired = "required"
TwoStepVerificationStateOptional = "optional"
TwoStepVerificationStateOther = "other"
)

View file

@ -278,6 +278,9 @@ const (
func (u *GetAccountBatchError) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// NoAccount : The value is an account ID specified in
// `GetAccountBatchArg.account_ids` that does not exist.
NoAccount string `json:"no_account,omitempty"`
}
var w wrap
var err error
@ -287,7 +290,7 @@ func (u *GetAccountBatchError) UnmarshalJSON(body []byte) error {
u.Tag = w.Tag
switch u.Tag {
case "no_account":
err = json.Unmarshal(body, &u.NoAccount)
u.NoAccount = w.NoAccount
if err != nil {
return err
@ -372,11 +375,6 @@ const (
func (u *SpaceAllocation) UnmarshalJSON(body []byte) error {
type wrap struct {
dropbox.Tagged
// Individual : The user's space allocation applies only to their
// individual account.
Individual json.RawMessage `json:"individual,omitempty"`
// Team : The user shares space with other members of their team.
Team json.RawMessage `json:"team,omitempty"`
}
var w wrap
var err error